[Jaws-commits] r13215 - in branches/0.8/html/gadgets/Contact: . languages resources templates

afz at jaws-project.com afz at jaws-project.com
Fri Aug 3 06:55:28 UTC 2012


Author: afz
Date: 2012-08-03 06:55:28 +0000 (Fri, 03 Aug 2012)
New Revision: 13215

Modified:
   branches/0.8/html/gadgets/Contact/AdminAjax.php
   branches/0.8/html/gadgets/Contact/AdminHTML.php
   branches/0.8/html/gadgets/Contact/AdminModel.php
   branches/0.8/html/gadgets/Contact/HTML.php
   branches/0.8/html/gadgets/Contact/LayoutHTML.php
   branches/0.8/html/gadgets/Contact/languages/en.php
   branches/0.8/html/gadgets/Contact/resources/script.js
   branches/0.8/html/gadgets/Contact/templates/AdminProperties.html
Log:
[Contact]: Added enable attachment option

Modified: branches/0.8/html/gadgets/Contact/AdminAjax.php
===================================================================
--- branches/0.8/html/gadgets/Contact/AdminAjax.php	2012-08-02 19:37:20 UTC (rev 13214)
+++ branches/0.8/html/gadgets/Contact/AdminAjax.php	2012-08-03 06:55:28 UTC (rev 13215)
@@ -210,10 +210,10 @@
      * @param   string  $comments
      * @return  boolean True if change is successful, if not, returns Jaws_Error on any error
      */
-    function UpdateProperties($use_antispam, $email_format, $comments)
+    function UpdateProperties($use_antispam, $email_format, $enable_attachment, $comments)
     {
         $this->CheckSession('Contact', 'UpdateProperties');
-        $this->_Model->UpdateProperties($use_antispam, $email_format, $comments);
+        $this->_Model->UpdateProperties($use_antispam, $email_format, $enable_attachment, $comments);
         return $GLOBALS['app']->Session->PopLastResponse();
     }
 

Modified: branches/0.8/html/gadgets/Contact/AdminHTML.php
===================================================================
--- branches/0.8/html/gadgets/Contact/AdminHTML.php	2012-08-02 19:37:20 UTC (rev 13214)
+++ branches/0.8/html/gadgets/Contact/AdminHTML.php	2012-08-03 06:55:28 UTC (rev 13215)
@@ -660,6 +660,15 @@
         $tpl->SetVariable('lbl_email_format', _t('CONTACT_PROPERTIES_EMAIL_FORMAT'));
         $tpl->SetVariable('email_format', $formatCombo->Get());
 
+        $attachment = $GLOBALS['app']->Registry->Get('/gadgets/Contact/enable_attachment');
+        $combo =& Piwi::CreateWidget('Combo', 'enable_attachment');
+        $combo->setStyle('width: 140px;');
+        $combo->AddOption(_t('GLOBAL_NO'), 'false');
+        $combo->AddOption(_t('GLOBAL_YES'), 'true');
+        $combo->SetDefault($attachment);
+        $tpl->SetVariable('lbl_enable_attachment', _t('CONTACT_PROPERTIES_ENABLE_ATTACHMENT'));
+        $tpl->SetVariable('enable_attachment', $combo->Get());
+
         // Comments
         $comments = $GLOBALS['app']->Registry->Get('/gadgets/Contact/comments');
         $editor =& $GLOBALS['app']->LoadEditor('Contact', 'comments', $comments, false);

Modified: branches/0.8/html/gadgets/Contact/AdminModel.php
===================================================================
--- branches/0.8/html/gadgets/Contact/AdminModel.php	2012-08-02 19:37:20 UTC (rev 13214)
+++ branches/0.8/html/gadgets/Contact/AdminModel.php	2012-08-03 06:55:28 UTC (rev 13215)
@@ -67,6 +67,7 @@
         $GLOBALS['app']->Registry->DeleteKey('/gadgets/Contact/email_format');
         $GLOBALS['app']->Registry->DeleteKey('/gadgets/Contact/enable_attachment');
         $GLOBALS['app']->Registry->DeleteKey('/gadgets/Contact/comments');
+        $GLOBALS['app']->Registry->DeleteKey('/gadgets/Contact/default_items');
 
         return true;
     }
@@ -478,12 +479,13 @@
      * @param   string  $email_format
      * @return  boolean True if change is successful, if not, returns Jaws_Error on any error
      */
-    function UpdateProperties($use_antispam, $email_format, $comments)
+    function UpdateProperties($use_antispam, $email_format, $enable_attachment, $comments)
     {
         $rs = array();
-        $rs[] = $GLOBALS['app']->Registry->Set('/gadgets/Contact/use_antispam', $use_antispam);
-        $rs[] = $GLOBALS['app']->Registry->Set('/gadgets/Contact/email_format', $email_format);
-        $rs[] = $GLOBALS['app']->Registry->Set('/gadgets/Contact/comments',     $comments);
+        $rs[] = $GLOBALS['app']->Registry->Set('/gadgets/Contact/use_antispam',      $use_antispam);
+        $rs[] = $GLOBALS['app']->Registry->Set('/gadgets/Contact/email_format',      $email_format);
+        $rs[] = $GLOBALS['app']->Registry->Set('/gadgets/Contact/enable_attachment', $enable_attachment);
+        $rs[] = $GLOBALS['app']->Registry->Set('/gadgets/Contact/comments',          $comments);
 
         foreach ($rs as $r) {
             if (Jaws_Error::IsError($r) || !$r) {

Modified: branches/0.8/html/gadgets/Contact/HTML.php
===================================================================
--- branches/0.8/html/gadgets/Contact/HTML.php	2012-08-02 19:37:20 UTC (rev 13214)
+++ branches/0.8/html/gadgets/Contact/HTML.php	2012-08-03 06:55:28 UTC (rev 13215)
@@ -119,7 +119,9 @@
         }
 
         $attachment = null;
-        if ($GLOBALS['app']->Session->GetPermission('Contact', 'AllowAttachment')) {
+        if (($GLOBALS['app']->Registry->Get('/gadgets/Contact/enable_attachment') == 'true') &&
+            $GLOBALS['app']->Session->GetPermission('Contact', 'AllowAttachment')) 
+        {
             $attach = Jaws_Utils::UploadFiles($_FILES,
                                               JAWS_DATA. 'contact',
                                               '',

Modified: branches/0.8/html/gadgets/Contact/LayoutHTML.php
===================================================================
--- branches/0.8/html/gadgets/Contact/LayoutHTML.php	2012-08-02 19:37:20 UTC (rev 13214)
+++ branches/0.8/html/gadgets/Contact/LayoutHTML.php	2012-08-03 06:55:28 UTC (rev 13215)
@@ -182,6 +182,7 @@
 
         //attachment
         if (in_array('attachment', $items_array) &&
+            ($GLOBALS['app']->Registry->Get('/gadgets/Contact/enable_attachment') == 'true') &&
             $GLOBALS['app']->Session->GetPermission('Contact', 'AllowAttachment'))
         {
             $tpl->SetBlock('contact/attachment');

Modified: branches/0.8/html/gadgets/Contact/languages/en.php
===================================================================
--- branches/0.8/html/gadgets/Contact/languages/en.php	2012-08-02 19:37:20 UTC (rev 13214)
+++ branches/0.8/html/gadgets/Contact/languages/en.php	2012-08-03 06:55:28 UTC (rev 13215)
@@ -78,6 +78,7 @@
 define('_EN_CONTACT_PROPERTIES_EMAIL_FORMAT', "Email Format");
 define('_EN_CONTACT_PROPERTIES_EMAIL_FORMAT_PLAINTEXT', "Plain Text");
 define('_EN_CONTACT_PROPERTIES_EMAIL_FORMAT_HTML', "HTML");
+define('_EN_CONTACT_PROPERTIES_ENABLE_ATTACHMENT', "Front End Attachment");
 define('_EN_CONTACT_PROPERTIES_COMMENTS', "Comments");
 
 /* Properties Responses */

Modified: branches/0.8/html/gadgets/Contact/resources/script.js
===================================================================
--- branches/0.8/html/gadgets/Contact/resources/script.js	2012-08-02 19:37:20 UTC (rev 13214)
+++ branches/0.8/html/gadgets/Contact/resources/script.js	2012-08-03 06:55:28 UTC (rev 13215)
@@ -358,6 +358,7 @@
     contactAsync.updateproperties(
                         $('use_antispam').value,
                         $('email_format').value,
+                        $('enable_attachment').value,
                         getEditorValue('comments'));
 }
 

Modified: branches/0.8/html/gadgets/Contact/templates/AdminProperties.html
===================================================================
--- branches/0.8/html/gadgets/Contact/templates/AdminProperties.html	2012-08-02 19:37:20 UTC (rev 13214)
+++ branches/0.8/html/gadgets/Contact/templates/AdminProperties.html	2012-08-03 06:55:28 UTC (rev 13215)
@@ -6,6 +6,7 @@
     <table id="settings" cellpadding="2" cellspacing="2">
       <tr><td class="title_label"><label for="use_antispam">{lbl_use_antispam}:</label></td><td>{use_antispam}</td></tr>
       <tr><td class="title_label"><label for="email_format">{lbl_email_format}:</label></td><td>{email_format}</td></tr>
+      <tr><td class="title_label"><label for="enable_attachment">{lbl_enable_attachment}:</label></td><td>{enable_attachment}</td></tr>
       <tr><td class="title_label"><label for="comments">{lbl_comments}:</label></td><td>{comments}</td></tr>
     </table>
   </td></tr>



More information about the Jaws-commits mailing list