[Jaws-commits] r9759 - in branches/0.8/jaws/html/gadgets: Blog Chatbox Contact Phoo Users

afz at jaws-project.com afz at jaws-project.com
Fri Oct 31 20:18:16 UTC 2008


Author: afz
Date: 2008-10-31 20:18:15 +0000 (Fri, 31 Oct 2008)
New Revision: 9759

Modified:
   branches/0.8/jaws/html/gadgets/Blog/HTML.php
   branches/0.8/jaws/html/gadgets/Chatbox/HTML.php
   branches/0.8/jaws/html/gadgets/Chatbox/LayoutHTML.php
   branches/0.8/jaws/html/gadgets/Contact/HTML.php
   branches/0.8/jaws/html/gadgets/Contact/LayoutHTML.php
   branches/0.8/jaws/html/gadgets/Phoo/HTML.php
   branches/0.8/jaws/html/gadgets/Users/HTML.php
   branches/0.8/jaws/html/gadgets/Users/LayoutHTML.php
Log:
fix problem when using more than one gadget that use PushSimpleResponse for sending result in all gadgets

Modified: branches/0.8/jaws/html/gadgets/Blog/HTML.php
===================================================================
--- branches/0.8/jaws/html/gadgets/Blog/HTML.php	2008-10-31 20:16:26 UTC (rev 9758)
+++ branches/0.8/jaws/html/gadgets/Blog/HTML.php	2008-10-31 20:18:15 UTC (rev 9759)
@@ -785,7 +785,7 @@
             $tpl->ParseBlock('commentform/captcha');
         }
 
-        if ($response = $GLOBALS['app']->Session->PopSimpleResponse()) {
+        if ($response = $GLOBALS['app']->Session->PopSimpleResponse('Blog')) {
             $tpl->SetBlock('commentform/response');
             $tpl->SetVariable('msg', $response);
             $tpl->ParseBlock('commentform/response');
@@ -816,7 +816,7 @@
         $model = $GLOBALS['app']->LoadGadget('Blog', 'Model');
         $entry = $model->GetEntry($id, true);
         if (Jaws_Error::isError($entry)) {
-            $GLOBALS['app']->Session->PushSimpleResponse($entry->getMessage());
+            $GLOBALS['app']->Session->PushSimpleResponse($entry->getMessage(), 'Blog');
             $url = $this->GetURLFor('DefaultAction');
             Jaws_Header::Location($url);
         }
@@ -896,7 +896,7 @@
         $model = $GLOBALS['app']->LoadGadget('Blog', 'Model');
         $entry = $model->GetEntry($id, true);
         if (Jaws_Error::isError($entry)) {
-            $GLOBALS['app']->Session->PushSimpleResponse($entry->getMessage());
+            $GLOBALS['app']->Session->PushSimpleResponse($entry->getMessage(), 'Blog');
             $url = $this->GetURLFor('DefaultAction');
             Jaws_Header::Location($url);
         }
@@ -924,7 +924,7 @@
         }
 
         if (trim($post['name']) == '' || trim($post['title']) == '' || trim($post['comments']) == '') {
-            $GLOBALS['app']->Session->PushSimpleResponse(_t('GLOBAL_ERROR_INCOMPLETE_FIELDS'));
+            $GLOBALS['app']->Session->PushSimpleResponse(_t('GLOBAL_ERROR_INCOMPLETE_FIELDS'), 'Blog');
             return $this->SingleView($id);
         }
 
@@ -934,7 +934,7 @@
             require_once JAWS_PATH . 'gadgets/Policy/captchas/' . $_captcha . '.php';
             $captcha = new $_captcha();
             if (!$captcha->Check()) {
-                $GLOBALS['app']->Session->PushSimpleResponse(_t('GLOBAL_CAPTCHA_ERROR_DOES_NOT_MATCH'));
+                $GLOBALS['app']->Session->PushSimpleResponse(_t('GLOBAL_CAPTCHA_ERROR_DOES_NOT_MATCH'), 'Blog');
                 Jaws_Header::Location($url);
             }
         }
@@ -943,9 +943,9 @@
                            $post['email'], $post['comments'], $post['parent'],
                            $post['parent_id']);
         if (Jaws_Error::IsError($result)) {
-            $GLOBALS['app']->Session->PushSimpleResponse($result->getMessage());
+            $GLOBALS['app']->Session->PushSimpleResponse($result->getMessage(), 'Blog');
         } else {
-            $GLOBALS['app']->Session->PushSimpleResponse(_t('GLOBAL_MESSAGE_SENT'));
+            $GLOBALS['app']->Session->PushSimpleResponse(_t('GLOBAL_MESSAGE_SENT'), 'Blog');
         }
 
         Jaws_Header::Location($url);

Modified: branches/0.8/jaws/html/gadgets/Chatbox/HTML.php
===================================================================
--- branches/0.8/jaws/html/gadgets/Chatbox/HTML.php	2008-10-31 20:16:26 UTC (rev 9758)
+++ branches/0.8/jaws/html/gadgets/Chatbox/HTML.php	2008-10-31 20:18:15 UTC (rev 9759)
@@ -52,7 +52,7 @@
         }
 
         if (trim($post['message']) == ''|| trim($post['name']) == '') {
-            $GLOBALS['app']->Session->SetAttribute('Chatbox', _t('CHATBOX_DONT_SEND_EMPTY_MESSAGES'));
+            $GLOBALS['app']->Session->PushSimpleResponse(_t('CHATBOX_DONT_SEND_EMPTY_MESSAGES'), 'Chatbox');
             Jaws_Header::Location($urlRedirect);
         }
 
@@ -62,7 +62,7 @@
             require_once JAWS_PATH . 'gadgets/Policy/captchas/' . $_captcha . '.php';
             $captcha = new $_captcha();
             if (!$captcha->Check()) {
-                $GLOBALS['app']->Session->SetAttribute('Chatbox', _t('GLOBAL_CAPTCHA_ERROR_DOES_NOT_MATCH'));
+                $GLOBALS['app']->Session->PushSimpleResponse(_t('GLOBAL_CAPTCHA_ERROR_DOES_NOT_MATCH'), 'Chatbox');
                 Jaws_Header::Location($urlRedirect);
             }
         }
@@ -70,9 +70,9 @@
         $res = $model->NewEntry($post['name'], $post['message'],
                                 $post['email'], $post['url'], $_SERVER['REMOTE_ADDR']);
         if (Jaws_Error::isError($res)) {
-            $GLOBALS['app']->Session->SetAttribute('Chatbox', $res->getMessage());
+            $GLOBALS['app']->Session->PushSimpleResponse($res->getMessage(), 'Chatbox');
         } else {
-            $GLOBALS['app']->Session->SetAttribute('Chatbox', _t('GLOBAL_MESSAGE_SENT'));
+            $GLOBALS['app']->Session->PushSimpleResponse(_t('GLOBAL_MESSAGE_SENT'), 'Chatbox');
         }
 
         Jaws_Header::Location($urlRedirect);

Modified: branches/0.8/jaws/html/gadgets/Chatbox/LayoutHTML.php
===================================================================
--- branches/0.8/jaws/html/gadgets/Chatbox/LayoutHTML.php	2008-10-31 20:16:26 UTC (rev 9758)
+++ branches/0.8/jaws/html/gadgets/Chatbox/LayoutHTML.php	2008-10-31 20:18:15 UTC (rev 9759)
@@ -40,7 +40,7 @@
         $tpl->SetVariable('email', _t('GLOBAL_EMAIL'));
         $tpl->SetVariable('emailvalue', isset($email) ? $xss->filter($email) : '');
 
-        if ($response = $GLOBALS['app']->Session->GetAttribute('Chatbox')) {
+        if ($response = $GLOBALS['app']->Session->PopSimpleResponse('Chatbox')) {
             $tpl->SetBlock('chatbox/response');
             $tpl->SetVariable('msg', $response);
             $tpl->ParseBlock('chatbox/response');

Modified: branches/0.8/jaws/html/gadgets/Contact/HTML.php
===================================================================
--- branches/0.8/jaws/html/gadgets/Contact/HTML.php	2008-10-31 20:16:26 UTC (rev 9758)
+++ branches/0.8/jaws/html/gadgets/Contact/HTML.php	2008-10-31 20:18:15 UTC (rev 9759)
@@ -96,7 +96,7 @@
             trim($post['contact_subject']) == '' ||
             trim($post['contact_message']) == '')
         {
-            $GLOBALS['app']->Session->PushSimpleResponse(_t('GLOBAL_ERROR_INCOMPLETE_FIELDS'));
+            $GLOBALS['app']->Session->PushSimpleResponse(_t('GLOBAL_ERROR_INCOMPLETE_FIELDS'), 'Contact');
             Jaws_Header::Location($urlRedirect);
         }
 
@@ -107,7 +107,7 @@
                 require_once JAWS_PATH . 'gadgets/Policy/captchas/' . $_captcha . '.php';
                 $captcha = new $_captcha();
                 if (!$captcha->Check()) {
-                    $GLOBALS['app']->Session->PushSimpleResponse(_t('GLOBAL_CAPTCHA_ERROR_DOES_NOT_MATCH'));
+                    $GLOBALS['app']->Session->PushSimpleResponse(_t('GLOBAL_CAPTCHA_ERROR_DOES_NOT_MATCH'), 'Contact');
                     Jaws_Header::Location($urlRedirect);
                 }
             }
@@ -116,7 +116,7 @@
         if ($GLOBALS['app']->Registry->Get('/gadgets/Contact/use_antispam') == 'true') {
             require_once JAWS_PATH . 'libraries/pear/Validate.php';
             if (Validate::email($post['contact_email'], true) === false) {
-                $GLOBALS['app']->Session->PushSimpleResponse(_t('CONTACT_RESULT_BAD_EMAIL_ADDRESS'));
+                $GLOBALS['app']->Session->PushSimpleResponse(_t('CONTACT_RESULT_BAD_EMAIL_ADDRESS'), 'Contact');
                 Jaws_Header::Location($urlRedirect);
             }
         }
@@ -149,7 +149,7 @@
             }
             $res_msg = _t('CONTACT_RESULT_SENT');
         }
-        $GLOBALS['app']->Session->PushSimpleResponse($res_msg);
+        $GLOBALS['app']->Session->PushSimpleResponse($res_msg, 'Contact');
         Jaws_Header::Location($urlRedirect);
     }
 }

Modified: branches/0.8/jaws/html/gadgets/Contact/LayoutHTML.php
===================================================================
--- branches/0.8/jaws/html/gadgets/Contact/LayoutHTML.php	2008-10-31 20:16:26 UTC (rev 9758)
+++ branches/0.8/jaws/html/gadgets/Contact/LayoutHTML.php	2008-10-31 20:18:15 UTC (rev 9759)
@@ -48,7 +48,7 @@
         $btnSend->SetSubmit();
         $tpl->SetVariable('btn_send', $btnSend->Get());
 
-        if ($response = $GLOBALS['app']->Session->PopSimpleResponse()) {
+        if ($response = $GLOBALS['app']->Session->PopSimpleResponse('Contact')) {
             $tpl->SetBlock('contact/response');
             $tpl->SetVariable('msg', $response);
             $tpl->ParseBlock('contact/response');

Modified: branches/0.8/jaws/html/gadgets/Phoo/HTML.php
===================================================================
--- branches/0.8/jaws/html/gadgets/Phoo/HTML.php	2008-10-31 20:16:26 UTC (rev 9758)
+++ branches/0.8/jaws/html/gadgets/Phoo/HTML.php	2008-10-31 20:18:15 UTC (rev 9759)
@@ -672,7 +672,7 @@
             $tpl->ParseBlock('commentform/captcha');
         }
 
-        if ($response = $GLOBALS['app']->Session->PopSimpleResponse()) {
+        if ($response = $GLOBALS['app']->Session->PopSimpleResponse('Phoo')) {
             $tpl->SetBlock('commentform/response');
             $tpl->SetVariable('msg', $response);
             $tpl->ParseBlock('commentform/response');
@@ -703,7 +703,7 @@
         $model = $GLOBALS['app']->LoadGadget('Phoo', 'Model');
         $image = $model->GetImage($post['parent_id'], $post['albumid']);
         if (Jaws_Error::isError($image)) {
-            $GLOBALS['app']->Session->PushSimpleResponse($image->getMessage());
+            $GLOBALS['app']->Session->PushSimpleResponse($image->getMessage(), 'Phoo');
             $url = $this->GetURLFor('DefaultAction');
             Jaws_Header::Location($url);
         }
@@ -784,7 +784,7 @@
         $model = $GLOBALS['app']->LoadGadget('Phoo', 'Model');
         $image = $model->GetImage($post['parent_id'], $post['albumid']);
         if (Jaws_Error::isError($image)) {
-            $GLOBALS['app']->Session->PushSimpleResponse($entry->getMessage());
+            $GLOBALS['app']->Session->PushSimpleResponse($entry->getMessage(), 'Phoo');
             $url = $this->GetURLFor('DefaultAction');
             Jaws_Header::Location($url);
         }
@@ -801,7 +801,7 @@
         }
 
         if (trim($post['name']) == '' || trim($post['title']) == '' || trim($post['comments']) == '') {
-            $GLOBALS['app']->Session->PushSimpleResponse(_t('GLOBAL_ERROR_INCOMPLETE_FIELDS'));
+            $GLOBALS['app']->Session->PushSimpleResponse(_t('GLOBAL_ERROR_INCOMPLETE_FIELDS'), 'Phoo');
             return $this->ViewImage($post['parent_id'], $post['albumid']);
         }
 
@@ -811,7 +811,7 @@
             require_once JAWS_PATH . 'gadgets/Policy/captchas/' . $_captcha . '.php';
             $captcha = new $_captcha();
             if (!$captcha->Check()) {
-                $GLOBALS['app']->Session->PushSimpleResponse(_t('GLOBAL_CAPTCHA_ERROR_DOES_NOT_MATCH'));
+                $GLOBALS['app']->Session->PushSimpleResponse(_t('GLOBAL_CAPTCHA_ERROR_DOES_NOT_MATCH'), 'Phoo');
                 Jaws_Header::Location($url);
             }
         }
@@ -819,9 +819,9 @@
         $result = $model->NewComment($post['name'], $post['title'], $post['url'],
                                      $post['email'], $post['comments'], $post['parent'], $post['parent_id'], $url);
         if (Jaws_Error::isError($result)) {
-            $GLOBALS['app']->Session->PushSimpleResponse($result->getMessage());
+            $GLOBALS['app']->Session->PushSimpleResponse($result->getMessage(), 'Phoo');
         } else {
-            $GLOBALS['app']->Session->PushSimpleResponse(_t('GLOBAL_MESSAGE_SENT'));
+            $GLOBALS['app']->Session->PushSimpleResponse(_t('GLOBAL_MESSAGE_SENT'), 'Phoo');
         }
 
         Jaws_Header::Location($url);

Modified: branches/0.8/jaws/html/gadgets/Users/HTML.php
===================================================================
--- branches/0.8/jaws/html/gadgets/Users/HTML.php	2008-10-31 20:16:26 UTC (rev 9758)
+++ branches/0.8/jaws/html/gadgets/Users/HTML.php	2008-10-31 20:18:15 UTC (rev 9759)
@@ -58,7 +58,7 @@
             require_once JAWS_PATH . 'gadgets/Policy/captchas/' . $_captcha . '.php';
             $captcha = new $_captcha();
             if (!$captcha->Check()) {
-                $GLOBALS['app']->Session->PushSimpleResponse(_t('GLOBAL_CAPTCHA_ERROR_DOES_NOT_MATCH'));
+                $GLOBALS['app']->Session->PushSimpleResponse(_t('GLOBAL_CAPTCHA_ERROR_DOES_NOT_MATCH'), 'Users');
                 Jaws_Header::Location($this->GetURLFor('ForgotPassword'));
             }
         }
@@ -66,9 +66,9 @@
         $model  = $GLOBALS['app']->LoadGadget('Users', 'Model');
         $result = $model->SendRecoveryKey($post['username'], $post['email']);
         if (Jaws_Error::IsError($result)) {
-            $GLOBALS['app']->Session->PushSimpleResponse($result->GetMessage());
+            $GLOBALS['app']->Session->PushSimpleResponse($result->GetMessage(), 'Users');
         } else {
-            $GLOBALS['app']->Session->PushSimpleResponse(_t('USERS_FORGOT_MAIL_SENT'));
+            $GLOBALS['app']->Session->PushSimpleResponse(_t('USERS_FORGOT_MAIL_SENT'), 'Users');
         }
         Jaws_Header::Location($this->GetURLFor('ForgotPassword'));
     }
@@ -136,7 +136,7 @@
             $tpl->ParseBlock('forgot/captcha');
         }
 
-        if ($response = $GLOBALS['app']->Session->PopSimpleResponse()) {
+        if ($response = $GLOBALS['app']->Session->PopSimpleResponse('Users')) {
             $tpl->SetBlock('forgot/response');
             $tpl->SetVariable('msg', $response);
             $tpl->ParseBlock('forgot/response');
@@ -180,7 +180,7 @@
         $tpl->SetVariable('emptypassword', _t('USERS_NOCHANGE_PASSWORD'));
         $tpl->SetVariable('password', _t('USERS_USERS_PASSWORD'));
         $tpl->SetVariable('checkpassword', _t('USERS_USERS_PASSWORD_VERIFY'));
-        if ($response = $GLOBALS['app']->Session->PopSimpleResponse()) {
+        if ($response = $GLOBALS['app']->Session->PopSimpleResponse('Users')) {
             $tpl->SetBlock('your_profile/response');
             $tpl->SetVariable('msg', $response);
             $tpl->ParseBlock('your_profile/response');
@@ -211,9 +211,9 @@
                                         ($post['password'] != ''));
 
         if (!Jaws_Error::IsError($result)) {
-            $GLOBALS['app']->Session->PushSimpleResponse(_t('USERS_MYACCOUNT_UPDATED'));
+            $GLOBALS['app']->Session->PushSimpleResponse(_t('USERS_MYACCOUNT_UPDATED'), 'Users');
         } else {
-            $GLOBALS['app']->Session->PushSimpleResponse($result->GetMessage());
+            $GLOBALS['app']->Session->PushSimpleResponse($result->GetMessage(), 'Users');
         }
         require_once JAWS_PATH . 'include/Jaws/Header.php';
         Jaws_Header::Location($this->GetURLFor('YourAccount'));
@@ -237,7 +237,7 @@
 
         $login = $GLOBALS['app']->Session->Login($post['username'], $post['password'], $post['remember']);
         if (Jaws_Error::isError($login)) {
-            $GLOBALS['app']->Session->PushSimpleResponse($login->GetMessage());
+            $GLOBALS['app']->Session->PushSimpleResponse($login->GetMessage(), 'Users');
         }
 
         require_once JAWS_PATH . 'include/Jaws/Header.php';
@@ -355,7 +355,7 @@
         }
 
         if (!empty($error)) {
-            $GLOBALS['app']->Session->PushSimpleResponse($error);
+            $GLOBALS['app']->Session->PushSimpleResponse($error, 'Users');
             Jaws_Header::Location($this->GetURLFor('Register'));
         }
     }
@@ -406,7 +406,7 @@
                 $tpl->SetVariable('captcha_msg', _t('GLOBAL_CAPTCHA_CODE_DESC'));
                 $tpl->ParseBlock('register/captcha');
             }
-            if ($response = $GLOBALS['app']->Session->PopSimpleResponse()) {
+            if ($response = $GLOBALS['app']->Session->PopSimpleResponse('Users')) {
                 $tpl->SetBlock('register/response');
                 $tpl->SetVariable('msg', $response);
                 $tpl->ParseBlock('register/response');

Modified: branches/0.8/jaws/html/gadgets/Users/LayoutHTML.php
===================================================================
--- branches/0.8/jaws/html/gadgets/Users/LayoutHTML.php	2008-10-31 20:16:26 UTC (rev 9758)
+++ branches/0.8/jaws/html/gadgets/Users/LayoutHTML.php	2008-10-31 20:18:15 UTC (rev 9759)
@@ -42,7 +42,7 @@
                 $tpl->SetVariable('forgot-password', $link->Get());
             }
 
-            if ($response = $GLOBALS['app']->Session->PopSimpleResponse()) {
+            if ($response = $GLOBALS['app']->Session->PopSimpleResponse('Users')) {
                 $tpl->SetBlock('LoginBox/response');
                 $tpl->SetVariable('msg', $response);
                 $tpl->ParseBlock('LoginBox/response');



More information about the Jaws-commits mailing list