IMP search fixes.
authorMichael M Slusarz <slusarz@curecanti.org>
Fri, 3 Sep 2010 21:45:11 +0000 (15:45 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Mon, 6 Sep 2010 20:31:14 +0000 (14:31 -0600)
Fix basic search.
Fix since/equals/before searching.

imp/js/search.js
imp/lib/Search.php
imp/lib/Ui/Search.php
imp/search-basic.php

index 431c44c..50ce93b 100644 (file)
@@ -411,8 +411,8 @@ var ImpSearch = {
 
     calendarSelectHandler: function(e)
     {
-        var elt = e.element();
-        this.replaceDate(elt.up('TR').identify(), this.criteria[elt.identify()], e.memo);
+        var id = e.findElement('TR').identify();
+        this.replaceDate(id, this.criteria[id].t, e.memo);
     }
 
 };
index b5139c3..b5a288a 100644 (file)
@@ -183,17 +183,17 @@ class IMP_Search
                'not' => true
             ),
             'date_on' => array(
-                'label' => _("Date ="),
+                'label' => _("Date Equals (=)"),
                 'type' => 'date',
                 'not' => true
             ),
             'date_until' => array(
-                'label' => _("Date <"),
+                'label' => _("Date Until (<)"),
                 'type' => 'date',
                 'not' => true
             ),
             'date_since' => array(
-                'label' => _("Date >="),
+                'label' => _("Date Since (>=)"),
                 'type' => 'date',
                 'not' => true
             ),
@@ -732,7 +732,8 @@ class IMP_Search
                 break;
 
             case 'date':
-                $text_array[] = sprintf("%s '%s'", $searchfields[$field]['label'], strftime("%x", mktime(0, 0, 0, $rule->v->m + 1, $rule->v->d, $rule->v->y)));
+                $date_ob = new Horde_Date($rule->v);
+                $text_array[] = sprintf("%s '%s'", $searchfields[$field]['label'], $date_ob->strftime("%x"));
                 break;
 
             case 'within':
index ce70488..586972b 100644 (file)
@@ -78,7 +78,7 @@ class IMP_Ui_Search
 
             case 'date':
                 if (!empty($rule->v)) {
-                    $date = new Horde_Date(array('year' => $rule->v->y, 'month' => $rule->v->m + 1, 'mday' => $rule->v->d));
+                    $date = new Horde_Date($rule->v);
                     $ob->dateSearch($date, ($rule->t == 'date_on') ? Horde_Imap_Client_Search_Query::DATE_ON : (($rule->t == 'date_until') ? Horde_Imap_Client_Search_Query::DATE_BEFORE : Horde_Imap_Client_Search_Query::DATE_SINCE));
                     $search_array[] = $ob;
                 }
index 8d75ca3..8d92de8 100644 (file)
 require_once dirname(__FILE__) . '/lib/Application.php';
 Horde_Registry::appInit('imp');
 
+/* This is an IMP-only script. */
+if ($_SESSION['imp']['view'] != 'imp') {
+    exit;
+}
+
 if ($_SESSION['imp']['protocol'] == 'pop') {
-    if ($_SESSION['imp']['view'] == 'imp') {
-        $notification->push(_("Searching is not available with a POP3 server."), 'horde.error');
-        $from_message_page = true;
-        $actionID = $start = null;
-        require_once IMP_BASE . '/mailbox.php';
-    }
+    $notification->push(_("Searching is not available with a POP3 server."), 'horde.error');
+    $from_message_page = true;
+    $actionID = $start = null;
+    require_once IMP_BASE . '/mailbox.php';
     exit;
 }
 
@@ -30,7 +33,7 @@ $imp_search = $injector->getInstance('IMP_Search');
 $vars = Horde_Variables::getDefaultVariables();
 
 /* If search_basic_mbox is set, we are processing the search query. */
-if ($vars->search_mailbox) {
+if ($vars->search_basic_mailbox) {
     $imp_ui_search = new IMP_Ui_Search();
     $id = $imp_ui_search->processBasicSearch($vars->search_mailbox, $vars->search_criteria, $vars->search_criteria_text, $vars->search_criteria_not, $vars->search_flags);