Rename Virtual Folder section to Saved Searches
authorMichael M Slusarz <slusarz@curecanti.org>
Mon, 28 Sep 2009 21:06:33 +0000 (15:06 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Mon, 28 Sep 2009 21:06:33 +0000 (15:06 -0600)
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
imp/search.php
imp/templates/search/search.html
imp/themes/screen.css

index 0d67c00..139018e 100644 (file)
@@ -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()) {
index c07a6f4..183e509 100644 (file)
  * '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:")
 );
index ba4382a..7c48137 100644 (file)
@@ -61,7 +61,7 @@
  <div class="smallheader leftAlign">
   <span class="searchuiImg arrowExpanded" style="display:none"></span>
   <span class="searchuiImg arrowCollapsed"></span>
-  <gettext>Virtual Folders</gettext>
+  <gettext>Saved Searches</gettext>
  </div>
 
  <div style="display:none">
   <input type="hidden" name="edit_query_vfolder" value="" />
 <else:edit_query_vfolder>
   <div class="item">
-   <label for="vfolder_save"><gettext>Save search as a virtual folder?</gettext></label> <input type="checkbox" class="checkbox" id="vfolder_save" name="vfolder_save" />
+   <input type="checkbox" class="checkbox" id="search_save" name="search_save" /> <label for="search_save"><gettext>Save search?</gettext></label>
+  </div>
+  <div class="item">
+   <label for="search_type"><gettext>Type:</gettext></label>
+   <select id="search_type">
+    <option value="vfolder"><gettext>Virtual Folder</gettext></option>
+   </select>
   </div>
 </else:edit_query_vfolder></if:edit_query_vfolder>
   <div class="item">
-   <label for="vfolder_label"><gettext>Label:</gettext></label> <input type="text" name="vfolder_label" id="vfolder_label" />
+   <label for="search_label"><gettext>Label:</gettext></label> <input type="text" name="search_label" id="search_label" />
   </div>
  </div>
 </if:virtualfolder>
index eb70f22..9cdc609 100644 (file)
@@ -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");
 }