diff --git a/felamimail/inc/class.ajaxfelamimail.inc.php b/felamimail/inc/class.ajaxfelamimail.inc.php index 7e96d4c53a..c839a5c2b2 100644 --- a/felamimail/inc/class.ajaxfelamimail.inc.php +++ b/felamimail/inc/class.ajaxfelamimail.inc.php @@ -199,13 +199,11 @@ class ajaxfelamimail $this->bofelamimail->restoreSessionData(); $this->bofelamimail->compressFolder($this->sessionData['mailbox']); - $bofilter = new felamimail_bofilter(); - $sortResult = $this->bofelamimail->getSortedList( $this->sessionData['mailbox'], $this->sessionData['sort'], $this->sessionData['sortReverse'], - $bofilter->getFilter($this->sessionData['activeFilter']) + $this->sessionData['messageFilter'] ); if(!is_array($sortResult) || empty($sortResult)) { @@ -657,19 +655,6 @@ class ajaxfelamimail return $this->generateMessageList($this->sessionData['mailbox']); } - function extendedSearch($_filterID) - { - // start displaying at message 1 - $this->sessionData['startMessage'] = 1; - $this->sessionData['activeFilter'] = (int)$_filterID; - // unset the previewID, as the Message will not probably not be within the selection - unset($this->sessionData['previewMessage']); - $this->saveSessionData(true); - - // generate the new messageview - return $this->generateMessageList($this->sessionData['mailbox']); - } - /* * flag messages as read, unread, flagged, ... * @@ -1105,11 +1090,20 @@ class ajaxfelamimail } } + function clearSearch() + { + $this->sessionData['messageFilter'] = array(); + + $this->sessionData['startMessage'] = 1; + + $this->saveSessionData(true); + + // generate the new messageview + return $this->generateMessageList($this->sessionData['mailbox']); + } + function quickSearch($_searchType, $_searchString, $_status) { - // save the filter - $bofilter = new felamimail_bofilter(); - $filter['filterName'] = lang('Quicksearch'); $filter['type'] = $_searchType; $filter['string'] = str_replace('"','\"', str_replace('\\','\\\\',$_searchString)); diff --git a/felamimail/inc/class.felamimail_bofilter.inc.php b/felamimail/inc/class.felamimail_bofilter.inc.php deleted file mode 100644 index 7442ff13b1..0000000000 --- a/felamimail/inc/class.felamimail_bofilter.inc.php +++ /dev/null @@ -1,168 +0,0 @@ - True, - 'flagMessages' => True - ); - - function __construct($_restoreSession=true) - { - $this->accountid = $GLOBALS['egw_info']['user']['account_id']; - - $this->sofilter = new felamimail_sofilter(); - - $this->sessionData['activeFilter'] = "-1"; - - if ($_restoreSession) $this->restoreSessionData(); - - if(!is_array($this->sessionData['filter'])) { - $this->sessionData['filter'][0]['filterName'] = lang('Quicksearch'); - $this->saveSessionData(); - } - if(!isset($this->sessionData['activeFilter'])) { - $this->sessionData['activeFilter'] = "-1"; - } - } - - function deleteFilter($_filterID) - { - unset($this->sessionData['filter'][$_filterID]); - $this->saveSessionData(); - $this->sofilter->saveFilter($this->sessionData['filter']); - } - - function getActiveFilter() - { - return $this->sessionData['activeFilter']; - } - - function getFilter($_filterID) - { - return $this->sessionData['filter'][$_filterID]; - } - - function getFilterList() - { - return $this->sessionData['filter']; - } - - function restoreSessionData() - { - $arrayFunctions =& CreateObject('phpgwapi.arrayfunctions'); - - $this->sessionData = $GLOBALS['egw']->session->appsession('filter_session_data'); - - // sort the filter list - $unsortedFilter = $this->sofilter->restoreFilter(); - - // save the quicksearchfilter - // must always have id=0 - if(is_array($unsortedFilter[0])) - { - $quickSearchFilter[0] = $unsortedFilter[0]; - unset($unsortedFilter[0]); - } - // or create the array - else - { - $quickSearchFilter[0] = array('filterName' => lang('quicksearch')); - } - - // _debug_array($this->sessionData['filter']); - // the first one is always the quicksearch filter - if(count($unsortedFilter) > 0) - { - $sortedFilter = $arrayFunctions->arfsort($unsortedFilter, array('filterName')); - $sortedFilter = array_merge($quickSearchFilter, $sortedFilter); - } - else - { - $sortedFilter = $quickSearchFilter; - } - #_debug_array($sortedFilter); - - $this->sessionData['filter'] = $sortedFilter; - } - - function saveFilter($_formData, $_filterID='') - { - if(!empty($_formData['filterName'])) - $data['filterName'] = $_formData['filterName']; - if(!empty($_formData['from'])) - $data['from'] = $_formData['from']; - if(!empty($_formData['to'])) - $data['to'] = $_formData['to']; - if(!empty($_formData['subject'])) - $data['subject']= $_formData['subject']; - - if($_filterID === '') - { - $this->sessionData['filter'][] = $data; - } - else - { - $this->sessionData['filter'][$_filterID] = $data; - } - - $this->saveSessionData(); - - $this->sofilter->saveFilter($this->sessionData['filter']); - } - - function saveSessionData() - { - $GLOBALS['egw']->session->appsession('filter_session_data','',$this->sessionData); - } - - function setActiveFilter($_filter) - { - $this->sessionData['activeFilter'] = "$_filter"; - $this->saveSessionData(); - } - - function updateFilter($_data) - { - $filter = $this->getFilterList(); - $activeFilter = $this->getActiveFilter(); - - // check for new quickfilter - if($activeFilter == $_data['filter'] && isset($_data['quickSearch'])) - { - #print " new Quickfilter $_quickSearch
"; - if($_data['quickSearch'] == '') - { - $this->setActiveFilter("-1"); - } - else - { - $this->setActiveFilter("0"); - $data['filterName'] = lang('Quicksearch'); - $data['subject'] = $_data['quickSearch']; - $data['from'] = $_data['quickSearch']; - $this->saveFilter($data, '0'); - } - } - else - { - $this->setActiveFilter($_data['filter']); - } - } - } - -?> diff --git a/felamimail/inc/class.felamimail_sofilter.inc.php b/felamimail/inc/class.felamimail_sofilter.inc.php deleted file mode 100644 index 7fe7ea6a16..0000000000 --- a/felamimail/inc/class.felamimail_sofilter.inc.php +++ /dev/null @@ -1,51 +0,0 @@ -accountid = $GLOBALS['egw_info']['user']['account_id']; - $this->db = clone($GLOBALS['egw']->db); - } - - function saveFilter($_filterArray) - { - $this->db->insert($this->filter_table,array( - 'fmail_filter_data' => serialize($_filterArray) - ),array( - 'fmail_filter_accountid' => $this->accountid - ),__LINE__,__FILE__,'felamimail'); - - unset($this->sessionData['filter'][$_filterID]); - } - - function restoreFilter() - { - $this->db->select($this->filter_table,'fmail_filter_data',array( - 'fmail_filter_accountid' => $this->accountid - ),__LINE__,__FILE__,False,False,'felamimail'); - - - if ($this->db->next_record()) - { - $filter = unserialize($this->db->f('fmail_filter_data')); - return $filter; - } - } - } -?> diff --git a/felamimail/inc/class.uifelamimail.inc.php b/felamimail/inc/class.uifelamimail.inc.php index 25e8c425c8..d7ed0e66e8 100644 --- a/felamimail/inc/class.uifelamimail.inc.php +++ b/felamimail/inc/class.uifelamimail.inc.php @@ -19,7 +19,6 @@ class uifelamimail var $public_functions = array ( 'addVcard' => True, - 'changeFilter' => True, 'changeFolder' => True, 'changeSorting' => True, 'compressFolder' => True, @@ -45,7 +44,6 @@ class uifelamimail static $icServerID; var $connectionStatus = false; var $bofelamimail; - var $bofilter; var $bopreferences; function uifelamimail() @@ -80,7 +78,6 @@ class uifelamimail //error_log(__METHOD__.'->'.self::$icServerID); $this->bofelamimail = felamimail_bo::getInstance(false,self::$icServerID); self::$icServerID = $GLOBALS['egw_info']['user']['preferences']['felamimail']['ActiveProfileID'] = $this->bofelamimail->profileID; - $this->bofilter = new felamimail_bofilter(false); $this->bopreferences=& $this->bofelamimail->bopreferences; $this->preferences =& $this->bofelamimail->mailPreferences; if (is_object($this->preferences)) @@ -354,23 +351,6 @@ class uifelamimail $GLOBALS['egw']->common->egw_exit(); } - function changeFilter() - { - error_log(__METHOD__." called from:".function_backtrace()); - if(isset($_POST["filter"])) - { - $data['quickSearch'] = $_POST["quickSearch"]; - $data['filter'] = $_POST["filter"]; - $this->bofilter->updateFilter($data); - } - elseif(isset($_GET["filter"])) - { - $data['filter'] = $_GET["filter"]; - $this->bofilter->updateFilter($data); - } - $this->viewMainScreen(); - } - function changeFolder() { // change folder @@ -799,7 +779,6 @@ class uifelamimail //error_log(__METHOD__.__LINE__.$connectionReset); #printf ("this->uifelamimail->viewMainScreen() start: %s
",date("H:i:s",mktime())); - $bofilter =& $this->bofilter; $uiwidgets = CreateObject('felamimail.uiwidgets'); // fetch the active account with prefs and identities $preferences =& $this->preferences; diff --git a/felamimail/js/jscode/viewMainScreen.js b/felamimail/js/jscode/viewMainScreen.js index d569c80533..a9a8beb991 100644 --- a/felamimail/js/jscode/viewMainScreen.js +++ b/felamimail/js/jscode/viewMainScreen.js @@ -894,19 +894,6 @@ function toggleFolderRadio(inputBox, _refreshTimeOut) { } } -function extendedSearch(_selectBox) { - mail_resetMessageSelect(); - //disable select allMessages in Folder Checkbox, as it is not implemented for filters - document.getElementById('selectAllMessagesCheckBox').disabled = true; - egw_appWindow('felamimail').setStatusMessage('Applying filter '+_selectBox.options[_selectBox.selectedIndex].text+''); - mail_cleanup(); - document.getElementById('divMessageList').innerHTML = ''; - - document.getElementById('quickSearch').value = ''; - - egw_appWindow('felamimail').xajax_doXMLHTTP('felamimail.ajaxfelamimail.extendedSearch',_selectBox.options[_selectBox.selectedIndex].value); -} - function mail_flagMessages(_flag) { var Check=true; @@ -1304,6 +1291,7 @@ function fm_clearSearch() { } inputQuickSearch.focus(); + xajax_doXMLHTTP('felamimail.ajaxfelamimail.clearSearch'); } function changeActiveAccount(_accountSelection)