[whups] clear saved searches

Bo Daley bo at tilda.com.au
Fri Jun 20 01:56:11 PDT 2003


hi again,

this patch adds a link allowing people to clear their list of saved searches.
those search lists seem to have a habit of getting long very quickly.

bo.


Index: templates/useractions.inc
===================================================================
RCS file: /repository/whups/templates/useractions.inc,v
retrieving revision 1.8
diff -u -r1.8 useractions.inc
--- templates/useractions.inc   27 Apr 2003 00:28:21 -0000      1.8
+++ templates/useractions.inc   20 Jun 2003 08:05:13 -0000
@@ -18,6 +18,8 @@

         $renderer->beginActive($title);

+        echo "<tr class=\"item\"><td colspan=\"2\" align=\"right\">" .
Horde::widget(Horde::addParameter('clearsearch.php', 'clear', '1'), _("Clear
Searches"), 'widget', '', '', _("Clear Searches")) . "</td></tr>\n";
+
         $z = 0;
         foreach ($results as $name => $search_getvars) {
             $z++;




Index: lib/Driver/sql.php
===================================================================
RCS file: /repository/whups/lib/Driver/sql.php,v
retrieving revision 1.105
diff -u -r1.105 sql.php
--- lib/Driver/sql.php  19 Jun 2003 18:48:16 -0000      1.105
+++ lib/Driver/sql.php  20 Jun 2003 08:05:35 -0000
@@ -1333,6 +1351,16 @@
         }

         return $searches;
+    }
+
+    function clearUserSearches($user, $search_name=null)
+    {
+        $query = 'DELETE FROM whups_users_searches WHERE user_uid = ' .
$this->_db->quote($user);
+        if (!empty($search_name)) {
+            $query .= ' AND search_name = ' . $this->_db->quote($search_name);
+        }
+        Horde::logMessage('SQL Query by Whups_Driver_sql::getUserSearches(): '
. $query, __FILE__, __LINE__, PEAR_LOG_DEBUG);
+        return $this->_query($query);
     }

     function saveSearch($name, $getvars)





More information about the whups mailing list