From: Michael M Slusarz Date: Thu, 17 Sep 2009 17:47:53 +0000 (-0600) Subject: Request #6875: More tweaks to advanced search page X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=b8b83c8bf9bfe309df32403b6a31dfb2cfa651b5;p=horde.git Request #6875: More tweaks to advanced search page --- diff --git a/imp/js/DimpBase.js b/imp/js/DimpBase.js index de36e4220..eb770d05e 100644 --- a/imp/js/DimpBase.js +++ b/imp/js/DimpBase.js @@ -238,6 +238,7 @@ var DimpBase = { return; } + f = this.folder; this.folder = null; $('dimpmain_folder').hide(); $('dimpmain_portal').update(DIMP.text.loading).show(); @@ -262,7 +263,7 @@ var DimpBase = { case 'search': this.highlightSidebar(); DimpCore.setTitle(DIMP.text.search); - this.iframeContent(loc, DimpCore.addURLParam(DIMP.conf.URI_SEARCH, { search_mailbox: this.folder })); + this.iframeContent(loc, DimpCore.addURLParam(DIMP.conf.URI_SEARCH, { search_mailbox: f })); break; case 'portal': diff --git a/imp/js/search.js b/imp/js/search.js index f6ad78d17..53fb3170b 100644 --- a/imp/js/search.js +++ b/imp/js/search.js @@ -7,7 +7,7 @@ var ImpSearch = { // The following variables are defined in search.php: - // months, text, types + // data, text criteria: {}, saved_searches: {}, show_unsub: false, @@ -60,7 +60,7 @@ var ImpSearch = { this.resetCriteria(); criteria.each(function(c) { - switch (this.types[c.t]) { + switch (this.data.types[c.t]) { case 'header': case 'body': case 'text': @@ -118,7 +118,7 @@ var ImpSearch = { break; case 'search_criteria': - switch (this.types[val]) { + switch (this.data.types[val]) { case 'header': case 'body': case 'text': @@ -213,7 +213,7 @@ var ImpSearch = { replaceDate: function(id, type, data) { - $(id).down('TD SPAN SPAN').update(this.months[data.m] + ' ' + data.d + ', ' + data.y); + $(id).down('TD SPAN SPAN').update(this.data.months[data.m] + ' ' + data.d + ', ' + data.y); // Need to store date information at all times in criteria, since we // have no other way to track this information (there is not form // field for this type). @@ -255,7 +255,7 @@ var ImpSearch = { tmp.each(function(c) { var tmp2; - switch (this.types[this.criteria[c].t]) { + switch (this.data.types[this.criteria[c].t]) { case 'header': case 'body': case 'text': @@ -323,6 +323,11 @@ var ImpSearch = { this.selectFolders(false); return; + case 'search_dimp_return': + e.stop(); + window.parent.DimpBase.go('folder:' + this.data.searchmbox); + return; + case 'link_sel_all': case 'link_sel_none': this.selectFolders(id == 'link_sel_all'); diff --git a/imp/search.php b/imp/search.php index caea203ba..c63db6431 100644 --- a/imp/search.php +++ b/imp/search.php @@ -42,6 +42,7 @@ $charset = Horde_Nls::getCharset(); $criteria = Horde_Util::getFormData('criteria_form'); $dimp_view = ($_SESSION['imp']['view'] == 'dimp'); $search_fields = $imp_search->searchFields(); +$search_mailbox = Horde_Util::getFormData('search_mailbox', 'INBOX'); /* Generate the search query if 'criteria_form' is present in the form * data. */ @@ -115,7 +116,7 @@ if (!empty($saved_searches)) { } /* Preselect mailboxes. */ -$on_domload[] = 'ImpSearch.updateSelectedFolders(' . Horde_Serialize::serialize(array(Horde_Util::getFormData('search_mailbox', 'INBOX')), Horde_Serialize::JSON, $charset) . ')'; +$on_domload[] = 'ImpSearch.updateSelectedFolders(' . Horde_Serialize::serialize(array($search_mailbox), Horde_Serialize::JSON, $charset) . ')'; /* Prepare the search template. */ $t = new Horde_Template(); @@ -174,17 +175,26 @@ $gettext_strings = array( 'search_term' => _("Search Term:") ); +/* Javascript data for this page. */ +$js_data = array( + 'months' => Horde_UI_JsCalendar::months(), + 'searchmbox' => $search_mailbox, + 'types' => $types +); + Horde::addInlineScript(array( - 'ImpSearch.months = ' . Horde_Serialize::serialize(Horde_UI_JsCalendar::months(), Horde_Serialize::JSON, $charset), - 'ImpSearch.text = ' . Horde_Serialize::serialize($gettext_strings, Horde_Serialize::JSON, $charset), - 'ImpSearch.types = ' . Horde_Serialize::serialize($types, Horde_Serialize::JSON, $charset) + 'ImpSearch.data = ' . Horde_Serialize::serialize($js_data, Horde_Serialize::JSON, $charset), + 'ImpSearch.text = ' . Horde_Serialize::serialize($gettext_strings, Horde_Serialize::JSON, $charset) )); Horde::addInlineScript($on_domload, 'dom'); $title = _("Search"); Horde::addScriptFile('horde.js', 'horde', true); Horde::addScriptFile('search.js', 'imp', true); -if (!$dimp_view) { + +if ($dimp_view) { + $t->set('return_mailbox_text', htmlspecialchars($search_mailbox)); +} else { IMP::prepareMenu(); } require IMP_TEMPLATES . '/common-header.inc'; diff --git a/imp/templates/search/search.html b/imp/templates/search/search.html index c1ae7c92e..5255f216e 100644 --- a/imp/templates/search/search.html +++ b/imp/templates/search/search.html @@ -45,7 +45,7 @@ Search Folders -