Index: trunk/core/kernel/db/db_tag_processor.php =================================================================== diff -u -N -r6751 -r6833 --- trunk/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 6751) +++ trunk/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 6833) @@ -745,7 +745,8 @@ $saved_value = $object->GetDBField($field); $object->SetDBField($field, $this->SearchField($params)); - $custom_filter = $this->Application->RecallVar($this->getPrefixSpecial().'_custom_filter'); + $view_name = $this->Application->RecallVar($this->getPrefixSpecial().'_current_view'); + $custom_filter = $this->Application->RecallPersistentVar($this->getPrefixSpecial().'_custom_filter.'.$view_name); $ret = $this->PredefinedOptions($params); $object->SetDBField($field, $saved_value); @@ -1434,7 +1435,8 @@ { $field = $this->SelectParam($params, 'field,name'); - $custom_filter = $this->Application->RecallVar($this->getPrefixSpecial().'_custom_filter'); + $view_name = $this->Application->RecallVar($this->getPrefixSpecial().'_current_view'); + $custom_filter = $this->Application->RecallPersistentVar($this->getPrefixSpecial().'_custom_filter.'.$view_name); $custom_filter = $custom_filter ? unserialize($custom_filter) : Array(); if (isset($custom_filter[ $params['grid'] ][$field])) { Index: trunk/core/kernel/session/session.php =================================================================== diff -u -N -r6685 -r6833 --- trunk/core/kernel/session/session.php (.../session.php) (revision 6685) +++ trunk/core/kernel/session/session.php (.../session.php) (revision 6833) @@ -66,6 +66,8 @@ var $DirectVars = Array(); var $ChangedDirectVars = Array(); + var $PersistentVars = Array (); + var $OriginalData=Array(); var $TimestampField; @@ -248,6 +250,52 @@ } return $expired_sids; } + + function LoadPersistentVars(&$session) + { + $user_id = $this->Application->GetVar('u_id'); + if ($user_id != -2) { + // root & normal users + $sql = 'SELECT VariableValue, VariableName + FROM '.TABLE_PREFIX.'PersistantSessionData + WHERE PortalUserId = '.$user_id; + $this->PersistentVars = $this->Conn->GetCol($sql, 'VariableName'); + } + else { + $this->PersistentVars = Array (); + } + } + + function StorePersistentVar(&$session, $var_name, $var_value) + { + $this->PersistentVars[$var_name] = $var_value; + + $replace_hash = Array ( + 'PortalUserId' => $this->Application->GetVar('u_id'), + 'VariableName' => $var_name, + 'VariableValue' => $var_value + ); + $this->Conn->doInsert($replace_hash, TABLE_PREFIX.'PersistantSessionData', 'REPLACE'); + + } + + function RecallPersistentVar(&$session, $var_name, $default = false) + { + return isset($this->PersistentVars[$var_name]) ? $this->PersistentVars[$var_name] : $default; + } + + function RemovePersistentVar(&$session, $var_name) + { + unset($this->PersistentVars[$var_name]); + + $user_id = $this->Application->GetVar('u_id'); + + if ($user_id != -2) { + $sql = 'DELETE FROM '.TABLE_PREFIX.'PersistantSessionData + WHERE PortalUserId = '.$user_id.' AND VariableName = '.$this->Conn->qstr($var_name); + $this->Conn->Query($sql); + } + } } define('smAUTO', 1); @@ -676,6 +724,7 @@ function PrintSession($comment='') { if($this->Application->isDebugMode() && constOn('DBG_SHOW_SESSIONDATA')) { + // dump session data $this->Application->Debugger->appendHTML('SessionStorage ('.$comment.'):'); $session_data = $this->Data->GetParams(); ksort($session_data); @@ -686,10 +735,22 @@ } $this->Application->Debugger->dumpVars($session_data); - // to insert after HTTPQuery if it's visible - $new_row = constOn('DBG_SHOW_HTTPQUERY') ? 4 : 2; - - //$debugger->moveAfterRow($new_row,2); + // dump persistent session data + if ($this->Storage->PersistentVars) { + $this->Application->Debugger->appendHTML('Persistant Session:'); + $session_data = $this->Storage->PersistentVars; + ksort($session_data); + foreach ($session_data as $session_key => $session_value) { + if (IsSerialized($session_value)) { + $session_data[$session_key] = unserialize($session_value); + } + } + $this->Application->Debugger->dumpVars($session_data); + } + +// to insert after HTTPQuery if it's visible +// $new_row = constOn('DBG_SHOW_HTTPQUERY') ? 4 : 2; +// $debugger->moveAfterRow($new_row,2); } } @@ -717,7 +778,17 @@ { $this->Data->Set($name, $value); } - + + function StorePersistentVar($name, $value) + { + $this->Storage->StorePersistentVar($this, $name, $value); + } + + function LoadPersistentVars() + { + $this->Storage->LoadPersistentVars($this); + } + function StoreVarDefault($name, $value) { $tmp = $this->RecallVar($name); @@ -727,18 +798,28 @@ } } - function RecallVar($name,$default=false) + function RecallVar($name, $default = false) { $ret = $this->Data->Get($name); - return ($ret===false) ? $default : $ret; + return ($ret === false) ? $default : $ret; } + function RecallPersistentVar($name, $default = false) + { + return $this->Storage->RecallPersistentVar($this, $name, $default); + } + function RemoveVar($name) { $this->Storage->RemoveFromData($this, $name); $this->Data->Remove($name); } + function RemovePersistentVar($name) + { + return $this->Storage->RemovePersistentVar($this, $name); + } + /** * Ignores session varible value set before * Index: trunk/core/kernel/application.php =================================================================== diff -u -N -r6685 -r6833 --- trunk/core/kernel/application.php (.../application.php) (revision 6685) +++ trunk/core/kernel/application.php (.../application.php) (revision 6833) @@ -843,6 +843,11 @@ return $this->Session->RemoveVar($var); } + function RemovePersistentVar($var) + { + return $this->Session->RemovePersistentVar($var); + } + /** * Restores Session variable to it's db version * @@ -869,6 +874,11 @@ return $this->Session->RecallVar($var,$default); } + function RecallPersistentVar($var, $default = false) + { + return $this->Session->RecallPersistentVar($var, $default); + } + /** * Stores variable $val in session under name $var * @@ -884,6 +894,11 @@ $this->Session->StoreVar($var, $val); } + function StorePersistentVar($var, $val) + { + $this->Session->StorePersistentVar($var, $val); + } + function StoreVarDefault($var, $val) { $session =& $this->recallObject('Session'); @@ -1557,8 +1572,22 @@ $http_query =& $this->recallObject('HTTPQuery'); $http_query->writeRequestLog(DBG_REQUREST_LOG); } + + if ($user_id != -2) { + // normal users + root + $this->LoadPersistentVars(); + } } + /** + * Loads current user persistent session data + * + */ + function LoadPersistentVars() + { + $this->Session->LoadPersistentVars(); + } + function LoadCache() { $cache_key = $this->GetVar('t').$this->GetVar('m_theme').$this->GetVar('m_lang').$this->IsAdmin(); $query = sprintf("SELECT PhraseList, ConfigVariables FROM %s WHERE Template = %s", Index: trunk/core/units/general/helpers/search_helper.php =================================================================== diff -u -N -r6832 -r6833 --- trunk/core/units/general/helpers/search_helper.php (.../search_helper.php) (revision 6832) +++ trunk/core/units/general/helpers/search_helper.php (.../search_helper.php) (revision 6833) @@ -282,7 +282,8 @@ $grid_name = $this->Application->GetVar('grid_name'); // update "custom filter" with values from submit: begin - $custom_filters = $this->Application->RecallVar($event->getPrefixSpecial().'_custom_filter'); + $view_name = $this->Application->RecallVar($event->getPrefixSpecial().'_current_view'); + $custom_filters = $this->Application->RecallPersistentVar($event->getPrefixSpecial().'_custom_filter.'.$view_name); if ($custom_filters) { $custom_filters = unserialize($custom_filters); $custom_filter = isset($custom_filters[$grid_name]) ? $custom_filters[$grid_name] : Array (); @@ -327,7 +328,7 @@ if (!$custom_filter) { // in case when no filters specified, there are nothing to process - $this->Application->StoreVar($event->getPrefixSpecial().'_custom_filter', serialize($custom_filters) ); + $this->Application->StorePersistentVar($event->getPrefixSpecial().'_custom_filter.'.$view_name, serialize($custom_filters) ); return false; } @@ -344,7 +345,7 @@ } $custom_filters[$grid_name] = $custom_filter; - $this->Application->StoreVar($event->getPrefixSpecial().'_custom_filter', serialize($custom_filters) ); + $this->Application->StorePersistentVar($event->getPrefixSpecial().'_custom_filter.'.$view_name, serialize($custom_filters) ); return $custom_filter; } @@ -494,7 +495,8 @@ $this->Application->RemoveVar($event->getPrefixSpecial().'_search_filter'); $this->Application->RemoveVar($event->getPrefixSpecial().'_search_keyword'); - $this->Application->RemoveVar($event->getPrefixSpecial().'_custom_filter'); + $view_name = $this->Application->RecallVar($event->getPrefixSpecial().'_current_view'); + $this->Application->RemovePersistentVar($event->getPrefixSpecial().'_custom_filter.'.$view_name); } Index: trunk/core/units/users/users_event_handler.php =================================================================== diff -u -N -r6791 -r6833 --- trunk/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 6791) +++ trunk/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 6833) @@ -104,6 +104,7 @@ */ function OnLogin(&$event) { + // persistent session data after login is not refreshed, because redirect will follow in any case $object =& $this->Application->recallObject('u', null, Array('skip_autoload' => true)); $password = $this->Application->GetVar('password'); Index: trunk/core/kernel/db/db_event_handler.php =================================================================== diff -u -N -r6756 -r6833 --- trunk/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 6756) +++ trunk/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 6833) @@ -693,7 +693,8 @@ } // add custom filter - $custom_filters = $this->Application->RecallVar($event->getPrefixSpecial().'_custom_filter'); + $view_name = $this->Application->RecallVar($event->getPrefixSpecial().'_current_view'); + $custom_filters = $this->Application->RecallPersistentVar($event->getPrefixSpecial().'_custom_filter.'.$view_name); if ($custom_filters) { $grid_name = $event->getEventParam('grid'); $custom_filters = unserialize($custom_filters);