Revision: 2519
          https://sourceforge.net/p/mrbs/code/2519/
Author:   cimorrison
Date:     2012-10-22 16:53:57 +0000 (Mon, 22 Oct 2012)
Log Message:
-----------
Restructured code so that the search, users and pending tables are more 
resilient to changes in column order

Modified Paths:
--------------
    mrbs/trunk/web/edit_users.php
    mrbs/trunk/web/js/edit_users.js.php
    mrbs/trunk/web/js/pending.js.php
    mrbs/trunk/web/js/search.js.php
    mrbs/trunk/web/pending.php
    mrbs/trunk/web/search.php

Modified: mrbs/trunk/web/edit_users.php
===================================================================
--- mrbs/trunk/web/edit_users.php       2012-10-22 16:06:34 UTC (rev 2518)
+++ mrbs/trunk/web/edit_users.php       2012-10-22 16:53:57 UTC (rev 2519)
@@ -872,7 +872,17 @@
     
       if (!in_array($fieldname, $ignore_columns))
       {
-        echo "<th>" . get_loc_field_name($tbl_users, $fieldname) . "</th>";
+        $heading = get_loc_field_name($tbl_users, $fieldname);
+        // We give some columns an stype data value so that the JavaScript 
knows how to sort them
+        switch ($fieldname)
+        {
+          case 'level':
+            $heading = '<span class="normal" data-stype="title-numeric">' . 
$heading . '</span>';
+            break;
+          default:
+            break;
+        }
+        echo "<th>$heading</th>";
       }
     }
   

Modified: mrbs/trunk/web/js/edit_users.js.php
===================================================================
--- mrbs/trunk/web/js/edit_users.js.php 2012-1====================ic">' . 
$heading . '</span>';mn 
orderr�@�*��&���&��uj@�*��A�*�a�*�x]�*�&�����*��&����&��k�@�*6
 
��!�!��&���&��x4]�*��&���b@�*��@�*��&��`b@�*Ϸ&���/��*uj@�*
 
��*�$��*�)��*��A�*x4]�*��&����&��k�@�*�!�!��&���&��H�<�*Ю&���b@�*��@�*��&��`b@�*Ϸ&����&����&��8�a�*�p��&��uj@�*��A�*Ю&����&��k�@�*GHIJKMNOP��&���&��H��*p�&���b@�*��@�*��&��0/��*uj@�*@]�*����*
 
��*�$��*�)��*��A�*H��*p�&����&��k�@�*8��*p�&����&��k�@�*(��*p�&���&��k�@�*��*p�&��@�&��k�@�*
     
�.��*uj@�*�)��*��&���8��*ei@�*�$��*��&��y8��*ei@�*
 ��*�&��Z8��*ei@�*����*@]�*����* 
��*�D]�*�$��*�)��*��A�*8�a�*���*�&��p{��*��&����&��k�@�*5678:<=>?@BD��&���&��୹�*�&��uj@�*�a�*@�&�����*ei@�*�a�*�_@f�S
 
Q��l���È�*�&��୹�*в&����&��k�@�*u]��
   
4Q��U^Qʉ��u������*ēv��&���&��H���*D��*@�&���P$
    �*�P$ �*����*Ϸ&���&����&�� 
�&��O]�*uj@�*�D]�*��&���P$  
�*P�&����&�����������P$ 
�*�&��0-22 16:06:34 UTC (rev 2518)
+++ mrbs/trunk/web/js/edit_users.js.php 2012-10-22 16:53:57 UTC (rev 2519)
@@ -37,9 +37,10 @@
     tableOptions.sAjaxSource = "<?php echo $ajax_url ?>";
     <?php
   }
+
+  // Get the sTypes and feed those into dataTables
   ?>
-  <?php // The Rights column has a span with title for sorting ?>
-  tableOptions.aoColumnDefs = [{"sType": "title-numeric", "aTargets": [1]}]; 
+  tableOptions.aoColumnDefs = getSTypes($('#users_table'));
   var usersTable = makeDataTable('#users_table',
                                  tableOptions,
                                  {sWidth: "relative", iWidth: 33});

Modified: mrbs/trunk/web/js/pending.js.php
===================================================================
--- mrbs/trunk/web/js/pending.js.php    2012-10-22 16:06:34 UTC (rev 2518)
+++ mrbs/trunk/web/js/pending.js.php    2012-10-22 16:53:57 UTC (rev 2519)
@@ -67,8 +67,8 @@
       });
     maxActionWidth += 16; <?php // to allow for padding in the <td> ?>
     var colDefsMain = [{"sWidth": "1.2em", "aTargets": [0] },
-                       {"sWidth": maxActionWidth + "px", "aTargets": [6] },
-                       {"sType": "title-numeric", "aTargets": [5]} ];
+                       {"sWidth": maxActionWidth + "px", "aTargets": [6] }];
+    colDefsMain = colDefsMain.concat(getSTypes(maintable));
     <?php
     // Set up a click event that "opens" the table row and inserts the subtable
     ?>

Modified: mrbs/trunk/web/js/search.js.php
===================================================================
--- mrbs/trunk/web/js/search.js.php     2012-10-22 16:06:34 UTC (rev 2518)
+++ mrbs/trunk/web/js/search.js.php     2012-10-22 16:53:57 UTC (rev 2519)
@@ -58,7 +58,8 @@
     $ajax_url = "search.php?" . (empty($query_string) ? '' : "$query_string&") 
. "ajax=1";
     ?>
     tableOptions.sAjaxSource = "<?php echo $ajax_url ?>";
-    tableOptions.aoColumnDefs = [{"sType": "title-numeric", "aTargets": [2]}]; 
+    <?php // Get the sTypes and feed those into dataTables ?>
+    tableOptions.aoColumnDefs = getSTypes($('#search_results'));
       
     var searchTable = makeDataTable('#search_results', 
                                     tableOptions, 

Modified: mrbs/trunk/web/pending.php
===================================================================
--- mrbs/trunk/web/pending.php  2012-10-22 16:06:34 UTC (rev 2518)
+++ mrbs/trunk/web/pending.php  2012-10-22 16:53:57 UTC (rev 2519)
@@ -93,12 +93,13 @@
 {
   echo "<thead>\n";
   echo "<tr>\n";
+  // We give some columns an stype data value so that the JavaScript knows how 
to sort them
   echo "<th class=\"control\">&nbsp;</th>\n";
   echo "<th class=\"header_name\">" . get_vocab("entry") . "</th>\n";
   echo "<th class=\"header_create\">" . get_vocab("createdby") . "</th>\n";
   echo "<th class=\"header_area\">" . get_vocab("area") . "</th>\n";
   echo "<th class=\"header_room\">" . get_vocab("room") . "</th>\n";
-  echo "<th class=\"header_start_time\">" . get_vocab("start_date") . 
"</th>\n";
+  echo "<th class=\"header_start_time\"><span class=\"normal\" 
data-stype=\"title-numeric\">" . get_vocab("start_date") . "</span></th>\n";
   echo "<th class=\"header_action\">" . get_vocab("action") . "</th>\n";
   echo "</tr>\n";
   echo "</thead>\n";

Modified: mrbs/trunk/web/search.php
===================================================================
--- mrbs/trunk/web/search.php   2012-10-22 16:06:34 UTC (rev 2518)
+++ mrbs/trunk/web/search.php   2012-10-22 16:53:57 UTC (rev 2519)
@@ -327,9 +327,10 @@
   echo "<table id=\"search_results\" class=\"admin_table display\">\n";
   echo "<thead>\n";
   echo "<tr>\n";
+  // We give some columns an stype data value so that the JavaScript knows how 
to sort them
   echo "<th>" . get_vocab("namebooker") . "</th>\n";
   echo "<th>" . get_vocab("createdby") . "</th>\n";
-  echo "<th>" . get_vocab("start_date") . "</th>\n";
+  echo "<th><span class=\"normal\" data-stype=\"title-numeric\">" . 
get_vocab("start_date") . "</span></th>\n";
   echo "<th>" . get_vocab("description") . "</th>\n";
   echo "</tr>\n";
   echo "</thead>\n";
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to