Das Umsortieren der Ergebnisliste der Historiensuchmaschine gefixt und ohne JavaScrip...
authorMoritz Bunkus <m.bunkus@linet-services.de>
Wed, 6 May 2009 14:11:00 +0000 (14:11 +0000)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Wed, 6 May 2009 14:11:00 +0000 (14:11 +0000)
bin/mozilla/am.pl
templates/webpages/common/show_history_de.html
templates/webpages/common/show_history_master.html

index b382360..a99204c 100644 (file)
@@ -2818,6 +2818,9 @@ sub show_am_history {
 
   $auth->assert('config');
 
+  my $callback     = build_std_url(qw(action einschraenkungen fromdate todate mitarbeiter searchid what2search));
+  $form->{order} ||= 'h.itime--1';
+
   my %search = ( "Artikelnummer"          => "parts",
                  "Kundennummer"           => "customer",
                  "Lieferantennummer"      => "vendor",
@@ -2867,7 +2870,8 @@ sub show_am_history {
                                      "SUCCESS"        => ($form->get_history($dbh, $daten, $restriction, $form->{order}) ne "0"),
                                      "NONEWWINDOW"    => 1,
                                      uc($sort)        => 1,
-                                     uc($sort) . "BY" => $sortby
+                                     uc($sort) . "BY" => $sortby,
+                                     'callback'       => $callback,
                                    });
   $dbh->disconnect();
 
index 5443530..e7f90d8 100644 (file)
@@ -1,22 +1,21 @@
 [% USE HTML %]
 [% IF SUCCESS %]
-<script type="text/javascript">
-  function orderBy(order,desc) {
-    var reg = /\&order\=(.+)\-\-(\d)$/;
-    reg.exec(document.location.href);
-    if(RegExp.$1 == order) {
-      document.location.href = document.location.href.substring(0,document.location.href.lastIndexOf("&order=")) + "&order=" + order + "--" + desc;
-    }
-    else {
-      if(reg.test(document.location.href)) {
-        document.location.href = document.location.href.substring(0,document.location.href.lastIndexOf("&order=")) + "&order=" + order + "--" + desc;
-      }
-      else {
-        document.location.href = document.location.href + "&order=" + order + "--" + desc;
-      }
-    }
-  }
-</script>
+
+[% BLOCK column_header %]
+            <table height="0" width="0" cellpadding="0" cellspacing="0" marginheight="0" marginwidth="0" valign="top" border="0">
+             [% IF THIS_COLUMN && !THIS_COLUMN_DOWN %]
+               <tr><td><a title="Reihenfolge" style="background: #ccccff; border: solid 1px #aaaade;">&and;</a></td></tr>
+             [% ELSE %]
+               <tr><td><a href="[% callback %]&order=[% column %]--0" title="Reihenfolge" style="border: solid 1px #aaaade;">&and;</a></td></tr>
+             [% END %]
+             [% IF THIS_COLUMN &&  THIS_COLUMN_DOWN %]
+               <tr><td><a title="Reihenfolge" style="background: #ccccff; border: solid 1px #aaaade;">&or;</a></td></tr>
+             [% ELSE %]
+               <tr><td><a href="[% callback %]&order=[% column %]--1" title="Reihenfolge" style="border: solid 1px #aaaade;">&or;</a></td></tr>
+             [% END %]
+            </table>
+[% END %]
+
 <table>
        <tr>
                <th class="listtop">
                             &nbsp;Zeitpunkt&nbsp;
           </td>
           <td valign="top">
-            <table height="0" width="0" cellpadding="0" cellspacing="0" marginheight="0" marginwidth="0" valign="top" border="0">
-              [% IF ITIME %]
-                [% IF ITIMEBY %]
-                  <tr><td><a href="javascript:orderBy('h.itime',0);" title="Reihenfolge" style="border: solid 1px #aaaade;">&and;</a></td></tr>
-                  <tr><td><a title="Reihenfolge" style="background: #ccccff; border: solid 1px #aaaade;">&or;</a></td></tr>
-                [% ELSE %]
-                  <tr><td><a title="Reihenfolge" style="background: #ccccff; border: solid 1px #aaaade;">&and;</a></td></tr>
-                  <tr><td><a href="javascript:orderBy('h.itime',1);" style="border: solid 1px #aaaade;">&or;</a></td></tr>
-                [% END %]
-              [% ELSE %]
-                <tr><td><a href="javascript:orderBy('h.itime',0);" title="Reihenfolge" style="border: solid 1px #aaaade;">&and;</a></td></tr>
-                <tr><td><a href="javascript:orderBy('h.itime',1);" title="Reihenfolge" style="border: solid 1px #aaaade;">&or;</a></td></tr>
-              [% END %]
-            </table>
+           [% PROCESS column_header THIS_COLUMN=ITIME THIS_COLUMN_DOWN=ITIMEBY column='h.itime' %]
           </td>
         </tr>
       </table>
             &nbsp;Mitarbeiter&nbsp;
           </td>
           <td valign="top">
-            <table height="0" width="0" cellpadding="0" cellspacing="0" marginheight="0" marginwidth="0" valign="top" border="0">
-              [% IF NAME %]
-                [% IF NAMEBY %]
-                  <tr><td height="0" width="0"><a href="javascript:orderBy('emp.name',0);" title="Reihenfolge" style="border: solid 1px #aaaade;">&and;</a></td></tr>
-                  <tr><td height="0" width="0"><a title="Reihenfolge" style="background: #ccccff; border: solid 1px #aaaade;">&or;</a></td></tr>
-                [% ELSE %]
-                  <tr><td><a title="Reihenfolge" style="background: #ccccff; border: solid 1px #aaaade;">&and;</a></td></tr>
-                  <tr><td><a href="javascript:orderBy('emp.name',1);" style="border: solid 1px #aaaade;">&or;</a></td></tr>
-                [% END %]
-              [% ELSE %]
-                <tr><td><a href="javascript:orderBy('emp.name',0);" title="Reihenfolge" style="border: solid 1px #aaaade;">&and;</a></td></tr>
-                <tr><td><a href="javascript:orderBy('emp.name',1);" title="Reihenfolge" style="border: solid 1px #aaaade;">&or;</a></td></tr>
-              [% END %]
-            </table>
+           [% PROCESS column_header THIS_COLUMN=NAME THIS_COLUMN_DOWN=NAMEBY column='emp.name' %]
           </td>
         </tr>
       </table>
            &nbsp;ID-Nummer (intern)&nbsp;
           </td>
           <td valign="top">
-            <table height="0" width="0" cellpadding="0" cellspacing="0" marginheight="0" marginwidth="0" valign="top" border="0">
-              [% IF TRANS_ID %]
-                [% IF TRANS_IDBY %]
-                  <tr><td height="0" width="0"><a href="javascript:orderBy('h.trans_id',0);" title="Reihenfolge" style="border: solid 1px #aaaade;">&and;</a></td></tr>
-                  <tr><td height="0" width="0"><a title="Reihenfolge" style="background: #ccccff; border: solid 1px #aaaade;">&or;</a></td></tr>
-                [% ELSE %]
-                  <tr><td><a title="Reihenfolge" style="background: #ccccff; border: solid 1px #aaaade;">&and;</a></td></tr>
-                  <tr><td><a href="javascript:orderBy('h.trans_id',1);" style="border: solid 1px #aaaade;">&or;</a></td></tr>
-                [% END %]
-              [% ELSE %]
-                <tr><td><a href="javascript:orderBy('h.trans_id',0);" title="Reihenfolge" style="border: solid 1px #aaaade;">&and;</a></td></tr>
-                <tr><td><a href="javascript:orderBy('h.trans_id',1);" title="Reihenfolge" style="border: solid 1px #aaaade;">&or;</a></td></tr>
-              [% END %]
-            </table>
+            [% PROCESS column_header THIS_COLUMN=TRANS_ID THIS_COLUMN_DOWN=TRANS_IDBY column='h.trans_id' %]
           </td>
         </tr>
       </table>
            &nbsp;Buchungsnummer&nbsp;
           </td>
           <td valign="top">
-            <table height="0" width="0" cellpadding="0" cellspacing="0" marginheight="0" marginwidth="0" valign="top" border="0" >
-              [% IF SNUMBERS %]
-                [% IF SNUMBERSBY %]
-                  <tr><td height="0" width="0"><a href="javascript:orderBy('h.snumbers',0);" title="Reihenfolge" style="border: solid 1px #aaaade;">&and;</a></td></tr>
-                  <tr><td height="0" width="0"><a title="Reihenfolge" style="background: #ccccff; border: solid 1px #aaaade;">&or;</a></td></tr>
-                [% ELSE %]
-                  <tr><td><a title="Reihenfolge" style="background: #ccccff; border: solid 1px #aaaade;">&and;</a></td></tr>
-                  <tr><td><a href="javascript:orderBy('h.snumbers',1);" style="border: solid 1px #aaaade;">&or;</a></td></tr>
-                [% END %]
-              [% ELSE %]
-                <tr><td><a href="javascript:orderBy('h.snumbers',0);" title="Reihenfolge" style="border: solid 1px #aaaade;">&and;</a></td></tr>
-                <tr><td><a href="javascript:orderBy('h.snumbers',1);" title="Reihenfolge" style="border: solid 1px #aaaade;">&or;</a></td></tr>
-              [% END %]
-            </table>
+            [% PROCESS column_header THIS_COLUMN=SNUMBERS THIS_COLUMN_DOWN=SNUMBERSBY column='h.snumbers' %]
           </td>
         </tr>
       </table>
index 038d7fc..4e28b33 100644 (file)
@@ -1,22 +1,21 @@
 [% USE HTML %]
 [% IF SUCCESS %]
-<script type="text/javascript">
-  function orderBy(order,desc) {
-    var reg = /\&order\=(.+)\-\-(\d)$/;
-    reg.exec(document.location.href);
-    if(RegExp.$1 == order) {
-      document.location.href = document.location.href.substring(0,document.location.href.lastIndexOf("&order=")) + "&order=" + order + "--" + desc;
-    }
-    else {
-      if(reg.test(document.location.href)) {
-        document.location.href = document.location.href.substring(0,document.location.href.lastIndexOf("&order=")) + "&order=" + order + "--" + desc;
-      }
-      else {
-        document.location.href = document.location.href + "&order=" + order + "--" + desc;
-      }
-    }
-  }
-</script>
+
+[% BLOCK column_header %]
+            <table height="0" width="0" cellpadding="0" cellspacing="0" marginheight="0" marginwidth="0" valign="top" border="0">
+             [% IF THIS_COLUMN && !THIS_COLUMN_DOWN %]
+               <tr><td><a title="<translate>order</translate>" style="background: #ccccff; border: solid 1px #aaaade;">&and;</a></td></tr>
+             [% ELSE %]
+               <tr><td><a href="[% callback %]&order=[% column %]--0" title="<translate>order</translate>" style="border: solid 1px #aaaade;">&and;</a></td></tr>
+             [% END %]
+             [% IF THIS_COLUMN &&  THIS_COLUMN_DOWN %]
+               <tr><td><a title="<translate>order</translate>" style="background: #ccccff; border: solid 1px #aaaade;">&or;</a></td></tr>
+             [% ELSE %]
+               <tr><td><a href="[% callback %]&order=[% column %]--1" title="<translate>order</translate>" style="border: solid 1px #aaaade;">&or;</a></td></tr>
+             [% END %]
+            </table>
+[% END %]
+
 <table>
        <tr>
                <th class="listtop">
                             &nbsp;<translate>Zeitpunkt</translate>&nbsp;
           </td>
           <td valign="top">
-            <table height="0" width="0" cellpadding="0" cellspacing="0" marginheight="0" marginwidth="0" valign="top" border="0">
-              [% IF ITIME %]
-                [% IF ITIMEBY %]
-                  <tr><td><a href="javascript:orderBy('h.itime',0);" title="<translate>order</translate>" style="border: solid 1px #aaaade;">&and;</a></td></tr>
-                  <tr><td><a title="<translate>order</translate>" style="background: #ccccff; border: solid 1px #aaaade;">&or;</a></td></tr>
-                [% ELSE %]
-                  <tr><td><a title="<translate>order</translate>" style="background: #ccccff; border: solid 1px #aaaade;">&and;</a></td></tr>
-                  <tr><td><a href="javascript:orderBy('h.itime',1);" style="border: solid 1px #aaaade;">&or;</a></td></tr>
-                [% END %]
-              [% ELSE %]
-                <tr><td><a href="javascript:orderBy('h.itime',0);" title="<translate>order</translate>" style="border: solid 1px #aaaade;">&and;</a></td></tr>
-                <tr><td><a href="javascript:orderBy('h.itime',1);" title="<translate>order</translate>" style="border: solid 1px #aaaade;">&or;</a></td></tr>
-              [% END %]
-            </table>
+           [% PROCESS column_header THIS_COLUMN=ITIME THIS_COLUMN_DOWN=ITIMEBY column='h.itime' %]
           </td>
         </tr>
       </table>
             &nbsp;<translate>Mitarbeiter</translate>&nbsp;
           </td>
           <td valign="top">
-            <table height="0" width="0" cellpadding="0" cellspacing="0" marginheight="0" marginwidth="0" valign="top" border="0">
-              [% IF NAME %]
-                [% IF NAMEBY %]
-                  <tr><td height="0" width="0"><a href="javascript:orderBy('emp.name',0);" title="<translate>order</translate>" style="border: solid 1px #aaaade;">&and;</a></td></tr>
-                  <tr><td height="0" width="0"><a title="<translate>order</translate>" style="background: #ccccff; border: solid 1px #aaaade;">&or;</a></td></tr>
-                [% ELSE %]
-                  <tr><td><a title="<translate>order</translate>" style="background: #ccccff; border: solid 1px #aaaade;">&and;</a></td></tr>
-                  <tr><td><a href="javascript:orderBy('emp.name',1);" style="border: solid 1px #aaaade;">&or;</a></td></tr>
-                [% END %]
-              [% ELSE %]
-                <tr><td><a href="javascript:orderBy('emp.name',0);" title="<translate>order</translate>" style="border: solid 1px #aaaade;">&and;</a></td></tr>
-                <tr><td><a href="javascript:orderBy('emp.name',1);" title="<translate>order</translate>" style="border: solid 1px #aaaade;">&or;</a></td></tr>
-              [% END %]
-            </table>
+           [% PROCESS column_header THIS_COLUMN=NAME THIS_COLUMN_DOWN=NAMEBY column='emp.name' %]
           </td>
         </tr>
       </table>
            &nbsp;<translate>ID-Nummer</translate>&nbsp;
           </td>
           <td valign="top">
-            <table height="0" width="0" cellpadding="0" cellspacing="0" marginheight="0" marginwidth="0" valign="top" border="0">
-              [% IF TRANS_ID %]
-                [% IF TRANS_IDBY %]
-                  <tr><td height="0" width="0"><a href="javascript:orderBy('h.trans_id',0);" title="<translate>order</translate>" style="border: solid 1px #aaaade;">&and;</a></td></tr>
-                  <tr><td height="0" width="0"><a title="<translate>order</translate>" style="background: #ccccff; border: solid 1px #aaaade;">&or;</a></td></tr>
-                [% ELSE %]
-                  <tr><td><a title="<translate>order</translate>" style="background: #ccccff; border: solid 1px #aaaade;">&and;</a></td></tr>
-                  <tr><td><a href="javascript:orderBy('h.trans_id',1);" style="border: solid 1px #aaaade;">&or;</a></td></tr>
-                [% END %]
-              [% ELSE %]
-                <tr><td><a href="javascript:orderBy('h.trans_id',0);" title="<translate>order</translate>" style="border: solid 1px #aaaade;">&and;</a></td></tr>
-                <tr><td><a href="javascript:orderBy('h.trans_id',1);" title="<translate>order</translate>" style="border: solid 1px #aaaade;">&or;</a></td></tr>
-              [% END %]
-            </table>
+            [% PROCESS column_header THIS_COLUMN=TRANS_ID THIS_COLUMN_DOWN=TRANS_IDBY column='h.trans_id' %]
           </td>
         </tr>
       </table>
            &nbsp;<translate>Belegnummer</translate>&nbsp;
           </td>
           <td valign="top">
-            <table height="0" width="0" cellpadding="0" cellspacing="0" marginheight="0" marginwidth="0" valign="top" border="0" >
-              [% IF SNUMBERS %]
-                [% IF SNUMBERSBY %]
-                  <tr><td height="0" width="0"><a href="javascript:orderBy('h.snumbers',0);" title="<translate>order</translate>" style="border: solid 1px #aaaade;">&and;</a></td></tr>
-                  <tr><td height="0" width="0"><a title="<translate>order</translate>" style="background: #ccccff; border: solid 1px #aaaade;">&or;</a></td></tr>
-                [% ELSE %]
-                  <tr><td><a title="<translate>order</translate>" style="background: #ccccff; border: solid 1px #aaaade;">&and;</a></td></tr>
-                  <tr><td><a href="javascript:orderBy('h.snumbers',1);" style="border: solid 1px #aaaade;">&or;</a></td></tr>
-                [% END %]
-              [% ELSE %]
-                <tr><td><a href="javascript:orderBy('h.snumbers',0);" title="<translate>order</translate>" style="border: solid 1px #aaaade;">&and;</a></td></tr>
-                <tr><td><a href="javascript:orderBy('h.snumbers',1);" title="<translate>order</translate>" style="border: solid 1px #aaaade;">&or;</a></td></tr>
-              [% END %]
-            </table>
+            [% PROCESS column_header THIS_COLUMN=SNUMBERS THIS_COLUMN_DOWN=SNUMBERSBY column='h.snumbers' %]
           </td>
         </tr>
       </table>