From 9884bfe175913c50c2cb169a8628067fceba5290 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Mon, 28 Sep 2009 15:06:33 -0600 Subject: [PATCH] Rename Virtual Folder section to Saved Searches Hopefully, I will be introducing the code for filtering soon. This is an example of a saved search that is not a virtual folder, so go ahead and do the necessary UI changes now. While I'm here, tweak a bit of the search page CSS. --- imp/js/search.js | 4 ++-- imp/search.php | 24 +++++++++++++++--------- imp/templates/search/search.html | 12 +++++++++--- imp/themes/screen.css | 7 +++++++ 4 files changed, 33 insertions(+), 14 deletions(-) diff --git a/imp/js/search.js b/imp/js/search.js index 0d67c0008..139018e8b 100644 --- a/imp/js/search.js +++ b/imp/js/search.js @@ -249,8 +249,8 @@ var ImpSearch = { if (!this._getAll().findAll(function(i) { return i.checked; }).size()) { alert(this.text.need_folder); - } else if ($F('vfolder_save') && $F('vfolder_label').empty()) { - alert(this.text.need_vfolder_label); + } else if ($F('search_save') && $F('search_label').empty()) { + alert(this.text.need_label); } else { tmp = $('search_criteria_table').childElements().pluck('id'); if (tmp.size()) { diff --git a/imp/search.php b/imp/search.php index c07a6f4fa..183e509b0 100644 --- a/imp/search.php +++ b/imp/search.php @@ -10,12 +10,13 @@ * 'edit_query' - (string) The search query to edit. * 'edit_query_vfolder' - (string) The name of the vfolder being edited. * 'search_folders_form' - (array) The list of folders to add to the query. + * 'search_label' - (string) The label to use when saving the search. * 'search_mailbox' - (string) Use this mailbox as the default value. * DEFAULT: INBOX + * 'search_save' - (boolean) If set, save search. + * 'search_type' - (string) The type of saved search ('vfolder'). * 'show_unsub' - (integer) If set, return a JSON object with folder * information used to create the folder list. - * 'vfolder_label' - (string) The label to use when saving as a virtual folder. - * 'vfolder_save' - (boolean) If set, save search as a virtual folder. * * Copyright 1999-2009 The Horde Project (http://www.horde.org/) * @@ -54,12 +55,17 @@ if (!empty($criteria)) { $imp_ui_search = new IMP_UI_Search(); $query = $imp_ui_search->createQuery($criteria); - /* Save the search as a virtual folder if requested. */ - if (Horde_Util::getFormData('vfolder_save')) { - $edit_query_vfolder = Horde_Util::getFormData('edit_query_vfolder'); - $vfolder_label = Horde_Util::getFormData('vfolder_label'); - $id = $imp_search->addVFolder($query, $folders, $criteria, $vfolder_label, empty($edit_query_vfolder) ? null : $edit_query_vfolder); - $notification->push(sprintf(_("Virtual Folder \"%s\" created succesfully."), $vfolder_label), 'horde.success'); + /* Save the search if requested. */ + if (Horde_Util::getFormData('search_save')) { + $search_label = Horde_Util::getFormData('search_label'); + + switch (Horde_Util::getFormData('search_type')) { + case 'vfolder': + $edit_query_vfolder = Horde_Util::getFormData('edit_query_vfolder'); + $id = $imp_search->addVFolder($query, $folders, $criteria, $search_label, empty($edit_query_vfolder) ? null : $edit_query_vfolder); + $notification->push(sprintf(_("Virtual Folder \"%s\" created succesfully."), $search_label), 'horde.success'); + break; + } } else { /* Set the search in the session. */ $id = $imp_search->createSearchQuery($query, $folders, $criteria, _("Search Results")); @@ -178,7 +184,7 @@ $gettext_strings = array( 'loading' => _("Loading..."), 'need_criteria' => _("Please select at least one search criteria."), 'need_folder' => _("Please select at least one folder to search."), - 'need_vfolder_label' => _("Virtual Folders require a label."), + 'need_label' => _("Saved searches require a label."), 'not_match' => _("Do NOT Match"), 'search_term' => _("Search Term:") ); diff --git a/imp/templates/search/search.html b/imp/templates/search/search.html index ba4382a32..7c4813710 100644 --- a/imp/templates/search/search.html +++ b/imp/templates/search/search.html @@ -61,7 +61,7 @@
- Virtual Folders + Saved Searches
@@ -69,11 +69,17 @@
- + +
+
+ +
- +
diff --git a/imp/themes/screen.css b/imp/themes/screen.css index eb70f2296..9cdc609f3 100644 --- a/imp/themes/screen.css +++ b/imp/themes/screen.css @@ -161,6 +161,13 @@ div.msgActions, #fmanager div.folderActions { } /* Search page styling. */ +#search_form DIV.item { + padding: 1px 0 1px 0; +} +#search_form .checkbox { + vertical-align: middle; +} + .searchuiCalendar { background-image: url("graphics/calendar.png"); } -- 2.11.0