[Rt-commit] [svn] r1168 - in rt/branches/rt-3.1/html/Search: . Elements

alexmv at pallas.eruditorum.org alexmv at pallas.eruditorum.org
Tue Jun 29 07:41:38 EDT 2004


Author: alexmv
Date: Tue Jun 29 07:41:37 2004
New Revision: 1168

Modified:
   rt/branches/rt-3.1/html/Search/Build.html
   rt/branches/rt-3.1/html/Search/Elements/DisplayOptions
Log:
 * Allow user to choose if the sort is ascending or descending


Modified: rt/branches/rt-3.1/html/Search/Build.html
==============================================================================
--- rt/branches/rt-3.1/html/Search/Build.html	(original)
+++ rt/branches/rt-3.1/html/Search/Build.html	Tue Jun 29 07:41:37 2004
@@ -27,6 +27,7 @@
     Title => $title,
     Format => $Format,
     Query => $Query,
+    Order => $Order,
     OrderBy => $OrderBy,
     Rows => $RowsPerPage
 &>
@@ -68,7 +69,7 @@
 <td colspan=2 class="boxcontainer">
 
 <& Elements/DisplayOptions, %ARGS, Format=> $Format,
-AvailableColumns => $AvailableColumns,  CurrentFormat => $CurrentFormat, RowsPerPage => $RowsPerPage, OrderBy => $OrderBy &>
+AvailableColumns => $AvailableColumns,  CurrentFormat => $CurrentFormat, RowsPerPage => $RowsPerPage, OrderBy => $OrderBy, Order => $Order &>
 </td>
 </tr>
 </table>
@@ -83,12 +84,13 @@
 
 # {{{ Clear out unwanted data
 if ($NewQuery or $ARGS{'Delete'}) {
-    # Wipe all seven data-carrying variables clear if we want a new
+    # Wipe all data-carrying variables clear if we want a new
     # search, or we're deleting an old one..
     $Query = '';
     $Format = '';
     $Description = '';
     $SearchId = '';
+    $Order = '';
     $OrderBy = '';
     $RowsPerPage = '';
     # ($search hasn't been set yet; no need to clear)
@@ -106,12 +108,13 @@
 # We don't read or write to the session again until the end
 $search_hash = $session{'CurrentSearchHash'};
 
-# These seven variables are what define a search_hash; this is also
+# These variables are what define a search_hash; this is also
 # where we give sane defaults.
 $Query ||= $search_hash->{'Query'};
 $Format ||= $search_hash->{'Format'};
 $Description ||= $search_hash->{'Description'};
 $SearchId ||= $search_hash->{'SearchId'} || 'new';
+$Order ||= $search_hash->{'Order'} || 'ASC';
 $OrderBy ||= $search_hash->{'OrderBy'} || 'id';
 $RowsPerPage ||= $search_hash->{'RowsPerPage'} || 50;
 $search ||= $search_hash->{'Object'};
@@ -183,11 +186,12 @@
         $search = $group->Attributes->WithId($search_id);
     }
 
-    # We have a $search and now; import the other 4
+    # We have a $search and now; import the others
     $SearchId    = $ARGS{'LoadSavedSearch'};
     $Description = $search->Description;
     $Format      = $search->SubValue('Format');
     $Query       = $search->SubValue('Query');
+    $Order       = $search->SubValue('Order');
     $OrderBy     = $search->SubValue('OrderBy');
     $RowsPerPage = $search->SubValue('RowsPerPage');
 }
@@ -660,6 +664,7 @@
         $search->SetSubValues(
             Format      => $Format,
             Query       => $Query,
+            Order       => $Order,
             OrderBy     => $OrderBy,
             RowsPerPage => $RowsPerPage,
         );
@@ -690,6 +695,7 @@
 									     Content     => {
 											     Format      => $Format,
 											     Query       => $Query,
+											     Order       => $Order,
 											     OrderBy     => $OrderBy,
 											     RowsPerPage => $RowsPerPage,
 											    }
@@ -716,6 +722,7 @@
 $dirty = 1 if defined $search and 
   ($search->SubValue('Format')      ne $Format      or
    $search->SubValue('Query')       ne $Query       or 
+   $search->SubValue('Order')       ne $Order       or
    $search->SubValue('OrderBy')     ne $OrderBy     or
    $search->SubValue('RowsPerPage') ne $RowsPerPage);
 # }}}
@@ -726,6 +733,7 @@
 $search_hash->{'Query'} = $Query;
 $search_hash->{'Description'} = $Description;
 $search_hash->{'Object'} = $search;
+$search_hash->{'Order'} = $Order;
 $search_hash->{'OrderBy'} = $OrderBy;
 $search_hash->{'RowsPerPage'} = $RowsPerPage;
 
@@ -734,7 +742,7 @@
 
 # {{{ Show the results, if we were asked.
 if ( $ARGS{"DoSearch"} ) {
-    $m->comp("Results.html" , Query => $Query, Format => $Format, OrderBy => $OrderBy, Rows => $RowsPerPage);
+    $m->comp("Results.html" , Query => $Query, Format => $Format, Order => $Order, OrderBy => $OrderBy, Rows => $RowsPerPage);
     $m->abort();
 }
 # }}}
@@ -748,6 +756,7 @@
     $QueryString = '?' . $m->comp('/Elements/QueryString', 
             Query => $Query,
             Format => $Format,
+            Order => $Order,
             OrderBy => $OrderBy,
             Rows => $RowsPerPage) if ($Query);
 }
@@ -761,6 +770,7 @@
 $Query => undef
 $Format => undef 
 $Description => undef
+$Order => undef
 $OrderBy => undef
 $RowsPerPage => undef
 $HideResults => 0

Modified: rt/branches/rt-3.1/html/Search/Elements/DisplayOptions
==============================================================================
--- rt/branches/rt-3.1/html/Search/Elements/DisplayOptions	(original)
+++ rt/branches/rt-3.1/html/Search/Elements/DisplayOptions	Tue Jun 29 07:41:37 2004
@@ -44,6 +44,18 @@
 ><%$field%></option>
 % }
 </select>
+<select name="Order">
+<option value="ASC"
+% if ($Order eq "ASC") {
+SELECTED
+% }
+><&|/l&>Ascending</&></option>
+<option value="DESC"
+% if ($Order eq "DESC") {
+SELECTED
+% }
+><&|/l&>Descending</&></option>
+</select>
 </td>
 </tr>
 <td class=label>
@@ -67,6 +79,7 @@
 </%INIT>
 
 <%ARGS>
+$Order => undef
 $OrderBy => undef
 $RowsPerPage => undef
 $Format => undef


More information about the Rt-commit mailing list