fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [7022] system messages


From: Sigurd Nes
Subject: [Fmsystem-commits] [7022] system messages
Date: Sun, 20 Feb 2011 12:52:16 +0000

Revision: 7022
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7022
Author:   sigurdne
Date:     2011-02-20 12:52:15 +0000 (Sun, 20 Feb 2011)
Log Message:
-----------
system messages

Modified Paths:
--------------
    trunk/login.php
    trunk/phpgwapi/inc/class.cache.inc.php
    trunk/phpgwapi/inc/class.js.inc.php
    trunk/property/inc/class.hook_helper.inc.php
    trunk/property/inc/class.sogeneric.inc.php
    trunk/property/inc/class.uiworkorder.inc.php

Modified: trunk/login.php
===================================================================
--- trunk/login.php     2011-02-18 14:34:46 UTC (rev 7021)
+++ trunk/login.php     2011-02-20 12:52:15 UTC (rev 7022)
@@ -188,7 +188,7 @@
 //                             
$GLOBALS['phpgw']->redirect_link("/{$partial_url}", array('cd' =>22)); // 
already within a session
 //                             exit;
 
-                               $receipt['message'][]=array('msg'=> lang('Info: 
you have changed domain from "%1" to "%2"' ,$_COOKIE['domain'],$logindomain));
+                               $receipt[] = lang('Info: you have changed 
domain from "%1" to "%2"' ,$_COOKIE['domain'],$logindomain);
                        }
                }
 
@@ -209,7 +209,7 @@
 
                if($receipt)
                {
-                       phpgwapi_cache::session_set('phpgwapi', 
'phpgw_messages', $receipt);
+                       phpgwapi_cache::message_set($receipt, 'message');
                }
 
                $forward = phpgw::get_var('phpgw_forward');

Modified: trunk/phpgwapi/inc/class.cache.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.cache.inc.php      2011-02-18 14:34:46 UTC (rev 
7021)
+++ trunk/phpgwapi/inc/class.cache.inc.php      2011-02-20 12:52:15 UTC (rev 
7022)
@@ -561,4 +561,39 @@
                        }
                        return self::_file_set($key, $value);
                }
+
+               /**
+                * Store system message in the session cache
+                *
+                * @param string or array $message the message set to register
+                * @param string $type the type (error/message) of message
+                * @return bool was the data stored in the session cache?
+                */
+               public static function message_set($message, $type = 'message')
+               {
+                       if(!$type == 'message')
+                       {
+                               $type == 'error';
+                       }
+                       $receipt = self::session_get('phpgwapi', 
'phpgw_messages');
+                       if(!is_array($receipt))
+                       {
+                               $receipt =array();
+                       }
+                       
+                       if(!is_array($message))
+                       {
+                               $_input = array($message);
+                       }
+                       else
+                       {
+                               $_input = $message;
+                       }
+                       foreach($_input as $msg)
+                       {
+                               $receipt[$type][]=array('msg'=> $msg);
+                       }
+
+                       return !!self::session_set('phpgwapi', 
'phpgw_messages', $receipt);
+               }
        }

Modified: trunk/phpgwapi/inc/class.js.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.js.inc.php 2011-02-18 14:34:46 UTC (rev 7021)
+++ trunk/phpgwapi/inc/class.js.inc.php 2011-02-20 12:52:15 UTC (rev 7022)
@@ -124,9 +124,8 @@
                                $combine = false;
                                
if(isset($GLOBALS['phpgw_info']['user']['apps']['admin']))
                                {
-                                       $receipt = array();
-                                       $receipt['error'][]=array('msg'=> 
'Speed could be gained from setting suhosin.get.max_value_length = 2000 in 
php.ini');
-                                       phpgwapi_cache::session_set('phpgwapi', 
'phpgw_messages', $receipt);
+                                       $message ='Speed could be gained from 
setting suhosin.get.max_value_length = 2000 in php.ini';
+                                       phpgwapi_cache::message_set($message, 
'error');
                                }
                        }
                        $links = "<!--JS Imports from phpGW javascript class 
-->\n";

Modified: trunk/property/inc/class.hook_helper.inc.php
===================================================================
--- trunk/property/inc/class.hook_helper.inc.php        2011-02-18 14:34:46 UTC 
(rev 7021)
+++ trunk/property/inc/class.hook_helper.inc.php        2011-02-20 12:52:15 UTC 
(rev 7022)
@@ -41,7 +41,7 @@
                public function clear_userlist()
                {
                        $cleared = 
ExecMethod('property.bocommon.reset_fm_cache_userlist');
-                       $receipt['message'][] = array('msg' => lang('%1 
userlists cleared from cache',$cleared));
-                       phpgwapi_cache::session_set('phpgwapi', 
'phpgw_messages', $receipt);
+                       $message =lang('%1 userlists cleared from 
cache',$cleared);
+                       phpgwapi_cache::message_set($message, 'message');
                }
        }

Modified: trunk/property/inc/class.sogeneric.inc.php
===================================================================
--- trunk/property/inc/class.sogeneric.inc.php  2011-02-18 14:34:46 UTC (rev 
7021)
+++ trunk/property/inc/class.sogeneric.inc.php  2011-02-20 12:52:15 UTC (rev 
7022)
@@ -1891,9 +1891,8 @@
 
 // END BOOKING TABLES
                        default:
-                               $receipt = array();
-                               $receipt['error'][]=array('msg'=>lang('ERROR: 
illegal type %1', $type));
-                               phpgwapi_cache::session_set('phpgwapi', 
'phpgw_messages', $receipt);
+                               $message =lang('ERROR: illegal type %1', $type);
+                               phpgwapi_cache::message_set($message, 'error');
 //                             throw new Exception(lang('ERROR: illegal type 
%1', $type));
                        }
 

Modified: trunk/property/inc/class.uiworkorder.inc.php
===================================================================
--- trunk/property/inc/class.uiworkorder.inc.php        2011-02-18 14:34:46 UTC 
(rev 7021)
+++ trunk/property/inc/class.uiworkorder.inc.php        2011-02-20 12:52:15 UTC 
(rev 7022)
@@ -1767,7 +1767,11 @@
                        $receipt = 
$GLOBALS['phpgw']->session->appsession('receipt','property');
                        
$GLOBALS['phpgw']->session->appsession('receipt','property','');
 
-                       $id     = phpgw::get_var('id');
+                       if(!$id = phpgw::get_var('id'))
+                       {
+                               phpgwapi_cache::message_set('ID is required for 
the function uiworkorder::view()', 'error'); 
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uiworkorder.index'));
+                       }
 
                        $GLOBALS['phpgw']->xslttpl->add_file(array('workorder', 
'hour_data_view', 'files'));
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]