Changes to support a jquery based tablesorter for the Ward Callings page
authorAlan Pippin <apippin@pippins.net>
Thu, 28 Oct 2010 02:40:53 +0000 (20:40 -0600)
committerAlan J. Pippin <ajp@pippins.net>
Thu, 28 Oct 2010 02:40:53 +0000 (20:40 -0600)
20 files changed:
images/tablesorter_asc.gif [new file with mode: 0644]
images/tablesorter_bg.gif [new file with mode: 0644]
images/tablesorter_desc.gif [new file with mode: 0644]
inc/class.tc.inc.php
inc/jquery/jquery.metadata.js [new file with mode: 0644]
inc/jquery/jquery.tablesorter.css [new file with mode: 0644]
inc/jquery/jquery.tablesorter.js [new file with mode: 0644]
inc/jquery/tablesorter/jquery.metadata.js [deleted file]
inc/jquery/tablesorter/jquery.tablesorter.js [deleted file]
inc/jquery/tablesorter/themes/blue/asc.gif [deleted file]
inc/jquery/tablesorter/themes/blue/bg.gif [deleted file]
inc/jquery/tablesorter/themes/blue/blue.zip [deleted file]
inc/jquery/tablesorter/themes/blue/desc.gif [deleted file]
inc/jquery/tablesorter/themes/blue/style.css [deleted file]
inc/jquery/tablesorter/themes/green/asc.png [deleted file]
inc/jquery/tablesorter/themes/green/bg.png [deleted file]
inc/jquery/tablesorter/themes/green/desc.png [deleted file]
inc/jquery/tablesorter/themes/green/green.zip [deleted file]
inc/jquery/tablesorter/themes/green/style.css [deleted file]
templates/default/org_view.tpl

diff --git a/images/tablesorter_asc.gif b/images/tablesorter_asc.gif
new file mode 100644 (file)
index 0000000..7415786
Binary files /dev/null and b/images/tablesorter_asc.gif differ
diff --git a/images/tablesorter_bg.gif b/images/tablesorter_bg.gif
new file mode 100644 (file)
index 0000000..fac668f
Binary files /dev/null and b/images/tablesorter_bg.gif differ
diff --git a/images/tablesorter_desc.gif b/images/tablesorter_desc.gif
new file mode 100644 (file)
index 0000000..3b30b3c
Binary files /dev/null and b/images/tablesorter_desc.gif differ
index 0346adedf6cfcf3ff8528fd855fdf76b2bc30679..35357da8cddd39774b2103b78bdc1af406a6df32 100644 (file)
@@ -92,6 +92,11 @@ class tc
                $this->grants     = $GLOBALS['phpgw']->acl->get_grants('tc');
                $this->grants[$this->account] = PHPGW_ACL_READ + PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE;
 
+               $GLOBALS['phpgw_info']['flags']['css'] .= "-->\n</style>\n"
+                  . '<link rel="stylesheet" type="text/css" media="all" href="'
+                  . $GLOBALS['phpgw']->link('inc/jquery/jquery.tablesorter.css').'"/>'
+                  . "\n<style type=\"text/css\">\n<!--\n";
+
                $this->jscal = CreateObject('tc.jscalendar');   // before phpgw_header() !!!
                $this->cal_options = 'daFormat    : "%Y-%m-%d",
                                      ifFormat    : "%Y-%m-%d",
@@ -3776,36 +3781,11 @@ class tc
        function org_view()
        {
                $this->t->set_file(array('org_view_t' => 'org_view.tpl'));
-               $this->t->set_block('org_view_t','calling_list','list1');
-               $this->t->set_block('org_view_t','org_list','list2');
-
-               # Display a list ordered alphabetically
-               $sql = "SELECT * FROM tc_calling AS tc JOIN tc_individual AS ti WHERE tc.individual=ti.individual ORDER BY name ASC";
-               $this->db->query($sql,__LINE__,__FILE__);
-               $i=0;
-               while ($this->db->next_record()) {
-                       $calling[$i]['name'] = $this->db->f('name');
-                       $calling[$i]['position'] = $this->db->f('position');
-                       $calling[$i]['sustained'] = $this->db->f('sustained');
-                       $calling[$i]['organization'] = $this->db->f('organization');
-                       $i++;
-               }   
-               for ($i=0; $i < count($calling); $i++) {
-                       $name = $calling[$i]['name'];
-                       $position = $calling[$i]['position'];
-                       $sustained = $calling[$i]['sustained'];
-                       $organization = $calling[$i]['organization'];
-                       $this->t->set_var('name', $name);
-                       $this->t->set_var('position', $position);
-                       $this->t->set_var('sustained', $sustained);
-                       $this->t->set_var('organization', $organization);
-                       $tr_color = $this->nextmatchs->alternate_row_color($tr_color);
-                       $this->t->set_var('tr_color',$tr_color);
-                       $this->t->fp('list1','calling_list',True);
-               }
+               $this->t->set_block('org_view_t','calling_list','list');
+           $this->t->set_var('jquery_url',$GLOBALS['phpgw']->link('inc/jquery/jquery.js'));
+           $this->t->set_var('jquery_tablesorter_url',$GLOBALS['phpgw']->link('inc/jquery/jquery.tablesorter.js'));
 
-               # Display a list ordered by organization
-               $sql = "SELECT * FROM tc_calling AS tc JOIN tc_individual AS ti where tc.individual=ti.individual ORDER BY organization ASC";
+               $sql = "SELECT * FROM tc_calling AS tc JOIN tc_individual AS ti where tc.individual=ti.individual ORDER BY name ASC";
                $this->db->query($sql,__LINE__,__FILE__);
                $i=0;
                while ($this->db->next_record()) {
@@ -3826,7 +3806,7 @@ class tc
                        $this->t->set_var('organization', $organization);
                        $tr_color = $this->nextmatchs->alternate_row_color($tr_color);
                        $this->t->set_var('tr_color',$tr_color);
-                       $this->t->fp('list2','org_list',True);
+                       $this->t->fp('list','calling_list',True);
                }
 
                $this->t->pfp('out','org_view_t');
diff --git a/inc/jquery/jquery.metadata.js b/inc/jquery/jquery.metadata.js
new file mode 100644 (file)
index 0000000..6a984db
--- /dev/null
@@ -0,0 +1,122 @@
+/*
+ * Metadata - jQuery plugin for parsing metadata from elements
+ *
+ * Copyright (c) 2006 John Resig, Yehuda Katz, J�örn Zaefferer, Paul McLanahan
+ *
+ * Dual licensed under the MIT and GPL licenses:
+ *   http://www.opensource.org/licenses/mit-license.php
+ *   http://www.gnu.org/licenses/gpl.html
+ *
+ * Revision: $Id$
+ *
+ */
+
+/**
+ * Sets the type of metadata to use. Metadata is encoded in JSON, and each property
+ * in the JSON will become a property of the element itself.
+ *
+ * There are three supported types of metadata storage:
+ *
+ *   attr:  Inside an attribute. The name parameter indicates *which* attribute.
+ *          
+ *   class: Inside the class attribute, wrapped in curly braces: { }
+ *   
+ *   elem:  Inside a child element (e.g. a script tag). The
+ *          name parameter indicates *which* element.
+ *          
+ * The metadata for an element is loaded the first time the element is accessed via jQuery.
+ *
+ * As a result, you can define the metadata type, use $(expr) to load the metadata into the elements
+ * matched by expr, then redefine the metadata type and run another $(expr) for other elements.
+ * 
+ * @name $.metadata.setType
+ *
+ * @example <p id="one" class="some_class {item_id: 1, item_label: 'Label'}">This is a p</p>
+ * @before $.metadata.setType("class")
+ * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
+ * @desc Reads metadata from the class attribute
+ * 
+ * @example <p id="one" class="some_class" data="{item_id: 1, item_label: 'Label'}">This is a p</p>
+ * @before $.metadata.setType("attr", "data")
+ * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
+ * @desc Reads metadata from a "data" attribute
+ * 
+ * @example <p id="one" class="some_class"><script>{item_id: 1, item_label: 'Label'}</script>This is a p</p>
+ * @before $.metadata.setType("elem", "script")
+ * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
+ * @desc Reads metadata from a nested script element
+ * 
+ * @param String type The encoding type
+ * @param String name The name of the attribute to be used to get metadata (optional)
+ * @cat Plugins/Metadata
+ * @descr Sets the type of encoding to be used when loading metadata for the first time
+ * @type undefined
+ * @see metadata()
+ */
+
+(function($) {
+
+$.extend({
+       metadata : {
+               defaults : {
+                       type: 'class',
+                       name: 'metadata',
+                       cre: /({.*})/,
+                       single: 'metadata'
+               },
+               setType: function( type, name ){
+                       this.defaults.type = type;
+                       this.defaults.name = name;
+               },
+               get: function( elem, opts ){
+                       var settings = $.extend({},this.defaults,opts);
+                       // check for empty string in single property
+                       if ( !settings.single.length ) settings.single = 'metadata';
+                       
+                       var data = $.data(elem, settings.single);
+                       // returned cached data if it already exists
+                       if ( data ) return data;
+                       
+                       data = "{}";
+                       
+                       if ( settings.type == "class" ) {
+                               var m = settings.cre.exec( elem.className );
+                               if ( m )
+                                       data = m[1];
+                       } else if ( settings.type == "elem" ) {
+                               if( !elem.getElementsByTagName )
+                                       return undefined;
+                               var e = elem.getElementsByTagName(settings.name);
+                               if ( e.length )
+                                       data = $.trim(e[0].innerHTML);
+                       } else if ( elem.getAttribute != undefined ) {
+                               var attr = elem.getAttribute( settings.name );
+                               if ( attr )
+                                       data = attr;
+                       }
+                       
+                       if ( data.indexOf( '{' ) <0 )
+                       data = "{" + data + "}";
+                       
+                       data = eval("(" + data + ")");
+                       
+                       $.data( elem, settings.single, data );
+                       return data;
+               }
+       }
+});
+
+/**
+ * Returns the metadata object for the first member of the jQuery object.
+ *
+ * @name metadata
+ * @descr Returns element's metadata object
+ * @param Object opts An object contianing settings to override the defaults
+ * @type jQuery
+ * @cat Plugins/Metadata
+ */
+$.fn.metadata = function( opts ){
+       return $.metadata.get( this[0], opts );
+};
+
+})(jQuery);
\ No newline at end of file
diff --git a/inc/jquery/jquery.tablesorter.css b/inc/jquery/jquery.tablesorter.css
new file mode 100644 (file)
index 0000000..96b2dbb
--- /dev/null
@@ -0,0 +1,19 @@
+th.headerSort { 
+    background-image: url(../../images/tablesorter_bg.gif);     
+    cursor: pointer; 
+    font-weight: bold; 
+    background-repeat: no-repeat; 
+    background-position: center left; 
+    padding-left: 20px; 
+    border-right: 1px solid #dad9c7; 
+    margin-left: -1px; 
+} 
+
+th.headerSortUp {
+    background-image: url(../../images/tablesorter_asc.gif);
+}
+
+th.headerSortDown {
+    background-image: url(../../images/tablesorter_desc.gif);
+}
+
diff --git a/inc/jquery/jquery.tablesorter.js b/inc/jquery/jquery.tablesorter.js
new file mode 100644 (file)
index 0000000..9b58731
--- /dev/null
@@ -0,0 +1,1031 @@
+/*\r
+ * \r
+ * TableSorter 2.0 - Client-side table sorting with ease!\r
+ * Version 2.0.5b\r
+ * @requires jQuery v1.2.3\r
+ * \r
+ * Copyright (c) 2007 Christian Bach\r
+ * Examples and docs at: http://tablesorter.com\r
+ * Dual licensed under the MIT and GPL licenses:\r
+ * http://www.opensource.org/licenses/mit-license.php\r
+ * http://www.gnu.org/licenses/gpl.html\r
+ * \r
+ */\r
+/**\r
+ * \r
+ * @description Create a sortable table with multi-column sorting capabilitys\r
+ * \r
+ * @example $('table').tablesorter();\r
+ * @desc Create a simple tablesorter interface.\r
+ * \r
+ * @example $('table').tablesorter({ sortList:[[0,0],[1,0]] });\r
+ * @desc Create a tablesorter interface and sort on the first and secound column column headers.\r
+ * \r
+ * @example $('table').tablesorter({ headers: { 0: { sorter: false}, 1: {sorter: false} } });\r
+ *          \r
+ * @desc Create a tablesorter interface and disableing the first and second  column headers.\r
+ *      \r
+ * \r
+ * @example $('table').tablesorter({ headers: { 0: {sorter:"integer"}, 1: {sorter:"currency"} } });\r
+ * \r
+ * @desc Create a tablesorter interface and set a column parser for the first\r
+ *       and second column.\r
+ * \r
+ * \r
+ * @param Object\r
+ *            settings An object literal containing key/value pairs to provide\r
+ *            optional settings.\r
+ * \r
+ * \r
+ * @option String cssHeader (optional) A string of the class name to be appended\r
+ *         to sortable tr elements in the thead of the table. Default value:\r
+ *         "header"\r
+ * \r
+ * @option String cssAsc (optional) A string of the class name to be appended to\r
+ *         sortable tr elements in the thead on a ascending sort. Default value:\r
+ *         "headerSortUp"\r
+ * \r
+ * @option String cssDesc (optional) A string of the class name to be appended\r
+ *         to sortable tr elements in the thead on a descending sort. Default\r
+ *         value: "headerSortDown"\r
+ * \r
+ * @option String sortInitialOrder (optional) A string of the inital sorting\r
+ *         order can be asc or desc. Default value: "asc"\r
+ * \r
+ * @option String sortMultisortKey (optional) A string of the multi-column sort\r
+ *         key. Default value: "shiftKey"\r
+ * \r
+ * @option String textExtraction (optional) A string of the text-extraction\r
+ *         method to use. For complex html structures inside td cell set this\r
+ *         option to "complex", on large tables the complex option can be slow.\r
+ *         Default value: "simple"\r
+ * \r
+ * @option Object headers (optional) An array containing the forces sorting\r
+ *         rules. This option let's you specify a default sorting rule. Default\r
+ *         value: null\r
+ * \r
+ * @option Array sortList (optional) An array containing the forces sorting\r
+ *         rules. This option let's you specify a default sorting rule. Default\r
+ *         value: null\r
+ * \r
+ * @option Array sortForce (optional) An array containing forced sorting rules.\r
+ *         This option let's you specify a default sorting rule, which is\r
+ *         prepended to user-selected rules. Default value: null\r
+ * \r
+ * @option Boolean sortLocaleCompare (optional) Boolean flag indicating whatever\r
+ *         to use String.localeCampare method or not. Default set to true.\r
+ * \r
+ * \r
+ * @option Array sortAppend (optional) An array containing forced sorting rules.\r
+ *         This option let's you specify a default sorting rule, which is\r
+ *         appended to user-selected rules. Default value: null\r
+ * \r
+ * @option Boolean widthFixed (optional) Boolean flag indicating if tablesorter\r
+ *         should apply fixed widths to the table columns. This is usefull when\r
+ *         using the pager companion plugin. This options requires the dimension\r
+ *         jquery plugin. Default value: false\r
+ * \r
+ * @option Boolean cancelSelection (optional) Boolean flag indicating if\r
+ *         tablesorter should cancel selection of the table headers text.\r
+ *         Default value: true\r
+ * \r
+ * @option Boolean debug (optional) Boolean flag indicating if tablesorter\r
+ *         should display debuging information usefull for development.\r
+ * \r
+ * @type jQuery\r
+ * \r
+ * @name tablesorter\r
+ * \r
+ * @cat Plugins/Tablesorter\r
+ * \r
+ * @author Christian Bach/christian.bach@polyester.se\r
+ */\r
+\r
+(function ($) {\r
+    $.extend({\r
+        tablesorter: new\r
+        function () {\r
+\r
+            var parsers = [],\r
+                widgets = [];\r
+\r
+            this.defaults = {\r
+                cssHeader: "header",\r
+                cssAsc: "headerSortUp",\r
+                cssDesc: "headerSortDown",\r
+                cssChildRow: "expand-child",\r
+                sortInitialOrder: "asc",\r
+                sortMultiSortKey: "shiftKey",\r
+                sortForce: null,\r
+                sortAppend: null,\r
+                sortLocaleCompare: true,\r
+                textExtraction: "simple",\r
+                parsers: {}, widgets: [],\r
+                widgetZebra: {\r
+                    css: ["even", "odd"]\r
+                }, headers: {}, widthFixed: false,\r
+                cancelSelection: true,\r
+                sortList: [],\r
+                headerList: [],\r
+                dateFormat: "us",\r
+                decimal: '/\.|\,/g',\r
+                onRenderHeader: null,\r
+                selectorHeaders: 'thead th',\r
+                debug: false\r
+            };\r
+\r
+            /* debuging utils */\r
+\r
+            function benchmark(s, d) {\r
+                log(s + "," + (new Date().getTime() - d.getTime()) + "ms");\r
+            }\r
+\r
+            this.benchmark = benchmark;\r
+\r
+            function log(s) {\r
+                if (typeof console != "undefined" && typeof console.debug != "undefined") {\r
+                    console.log(s);\r
+                } else {\r
+                    alert(s);\r
+                }\r
+            }\r
+\r
+            /* parsers utils */\r
+\r
+            function buildParserCache(table, $headers) {\r
+\r
+                if (table.config.debug) {\r
+                    var parsersDebug = "";\r
+                }\r
+\r
+                if (table.tBodies.length == 0) return; // In the case of empty tables\r
+                var rows = table.tBodies[0].rows;\r
+\r
+                if (rows[0]) {\r
+\r
+                    var list = [],\r
+                        cells = rows[0].cells,\r
+                        l = cells.length;\r
+\r
+                    for (var i = 0; i < l; i++) {\r
+\r
+                        var p = false;\r
+\r
+                        if ($.metadata && ($($headers[i]).metadata() && $($headers[i]).metadata().sorter)) {\r
+\r
+                            p = getParserById($($headers[i]).metadata().sorter);\r
+\r
+                        } else if ((table.config.headers[i] && table.config.headers[i].sorter)) {\r
+\r
+                            p = getParserById(table.config.headers[i].sorter);\r
+                        }\r
+                        if (!p) {\r
+\r
+                            p = detectParserForColumn(table, rows, -1, i);\r
+                        }\r
+\r
+                        if (table.config.debug) {\r
+                            parsersDebug += "column:" + i + " parser:" + p.id + "\n";\r
+                        }\r
+\r
+                        list.push(p);\r
+                    }\r
+                }\r
+\r
+                if (table.config.debug) {\r
+                    log(parsersDebug);\r
+                }\r
+\r
+                return list;\r
+            };\r
+\r
+            function detectParserForColumn(table, rows, rowIndex, cellIndex) {\r
+                var l = parsers.length,\r
+                    node = false,\r
+                    nodeValue = false,\r
+                    keepLooking = true;\r
+                while (nodeValue == '' && keepLooking) {\r
+                    rowIndex++;\r
+                    if (rows[rowIndex]) {\r
+                        node = getNodeFromRowAndCellIndex(rows, rowIndex, cellIndex);\r
+                        nodeValue = trimAndGetNodeText(table.config, node);\r
+                        if (table.config.debug) {\r
+                            log('Checking if value was empty on row:' + rowIndex);\r
+                        }\r
+                    } else {\r
+                        keepLooking = false;\r
+                    }\r
+                }\r
+                for (var i = 1; i < l; i++) {\r
+                    if (parsers[i].is(nodeValue, table, node)) {\r
+                        return parsers[i];\r
+                    }\r
+                }\r
+                // 0 is always the generic parser (text)\r
+                return parsers[0];\r
+            }\r
+\r
+            function getNodeFromRowAndCellIndex(rows, rowIndex, cellIndex) {\r
+                return rows[rowIndex].cells[cellIndex];\r
+            }\r
+\r
+            function trimAndGetNodeText(config, node) {\r
+                return $.trim(getElementText(config, node));\r
+            }\r
+\r
+            function getParserById(name) {\r
+                var l = parsers.length;\r
+                for (var i = 0; i < l; i++) {\r
+                    if (parsers[i].id.toLowerCase() == name.toLowerCase()) {\r
+                        return parsers[i];\r
+                    }\r
+                }\r
+                return false;\r
+            }\r
+\r
+            /* utils */\r
+\r
+            function buildCache(table) {\r
+\r
+                if (table.config.debug) {\r
+                    var cacheTime = new Date();\r
+                }\r
+\r
+                var totalRows = (table.tBodies[0] && table.tBodies[0].rows.length) || 0,\r
+                    totalCells = (table.tBodies[0].rows[0] && table.tBodies[0].rows[0].cells.length) || 0,\r
+                    parsers = table.config.parsers,\r
+                    cache = {\r
+                        row: [],\r
+                        normalized: []\r
+                    };\r
+\r
+                for (var i = 0; i < totalRows; ++i) {\r
+\r
+                    /** Add the table data to main data array */\r
+                    var c = $(table.tBodies[0].rows[i]),\r
+                        cols = [];\r
+\r
+                    // if this is a child row, add it to the last row's children and\r
+                    // continue to the next row\r
+                    if (c.hasClass(table.config.cssChildRow)) {\r
+                        cache.row[cache.row.length - 1] = cache.row[cache.row.length - 1].add(c);\r
+                        // go to the next for loop\r
+                        continue;\r
+                    }\r
+\r
+                    cache.row.push(c);\r
+\r
+                    for (var j = 0; j < totalCells; ++j) {\r
+                        cols.push(parsers[j].format(getElementText(table.config, c[0].cells[j]), table, c[0].cells[j]));\r
+                    }\r
+\r
+                    cols.push(cache.normalized.length); // add position for rowCache\r
+                    cache.normalized.push(cols);\r
+                    cols = null;\r
+                };\r
+\r
+                if (table.config.debug) {\r
+                    benchmark("Building cache for " + totalRows + " rows:", cacheTime);\r
+                }\r
+\r
+                return cache;\r
+            };\r
+\r
+            function getElementText(config, node) {\r
+\r
+                var text = "";\r
+\r
+                if (!node) return "";\r
+\r
+                if (!config.supportsTextContent) config.supportsTextContent = node.textContent || false;\r
+\r
+                if (config.textExtraction == "simple") {\r
+                    if (config.supportsTextContent) {\r
+                        text = node.textContent;\r
+                    } else {\r
+                        if (node.childNodes[0] && node.childNodes[0].hasChildNodes()) {\r
+                            text = node.childNodes[0].innerHTML;\r
+                        } else {\r
+                            text = node.innerHTML;\r
+                        }\r
+                    }\r
+                } else {\r
+                    if (typeof(config.textExtraction) == "function") {\r
+                        text = config.textExtraction(node);\r
+                    } else {\r
+                        text = $(node).text();\r
+                    }\r
+                }\r
+                return text;\r
+            }\r
+\r
+            function appendToTable(table, cache) {\r
+\r
+                if (table.config.debug) {\r
+                    var appendTime = new Date()\r
+                }\r
+\r
+                var c = cache,\r
+                    r = c.row,\r
+                    n = c.normalized,\r
+                    totalRows = n.length,\r
+                    checkCell = (n[0].length - 1),\r
+                    tableBody = $(table.tBodies[0]),\r
+                    rows = [];\r
+\r
+\r
+                for (var i = 0; i < totalRows; i++) {\r
+                    var pos = n[i][checkCell];\r
+\r
+                    rows.push(r[pos]);\r
+\r
+                    if (!table.config.appender) {\r
+\r
+                        //var o = ;\r
+                        var l = r[pos].length;\r
+                        for (var j = 0; j < l; j++) {\r
+                            tableBody[0].appendChild(r[pos][j]);\r
+                        }\r
+\r
+                        // \r
+                    }\r
+                }\r
+\r
+\r
+\r
+                if (table.config.appender) {\r
+\r
+                    table.config.appender(table, rows);\r
+                }\r
+\r
+                rows = null;\r
+\r
+                if (table.config.debug) {\r
+                    benchmark("Rebuilt table:", appendTime);\r
+                }\r
+\r
+                // apply table widgets\r
+                applyWidget(table);\r
+\r
+                // trigger sortend\r
+                setTimeout(function () {\r
+                    $(table).trigger("sortEnd");\r
+                }, 0);\r
+\r
+            };\r
+\r
+            function buildHeaders(table) {\r
+\r
+                if (table.config.debug) {\r
+                    var time = new Date();\r
+                }\r
+\r
+                var meta = ($.metadata) ? true : false;\r
+                \r
+                var header_index = computeTableHeaderCellIndexes(table);\r
+\r
+                $tableHeaders = $(table.config.selectorHeaders, table).each(function (index) {\r
+\r
+                    this.column = header_index[this.parentNode.rowIndex + "-" + this.cellIndex];\r
+                    // this.column = index;\r
+                    this.order = formatSortingOrder(table.config.sortInitialOrder);\r
+                    \r
+                                       \r
+                                       this.count = this.order;\r
+\r
+                    if (checkHeaderMetadata(this) || checkHeaderOptions(table, index)) this.sortDisabled = true;\r
+                                       if (checkHeaderOptionsSortingLocked(table, index)) this.order = this.lockedOrder = checkHeaderOptionsSortingLocked(table, index);\r
+\r
+                    if (!this.sortDisabled) {\r
+                        var $th = $(this).addClass(table.config.cssHeader);\r
+                        if (table.config.onRenderHeader) table.config.onRenderHeader.apply($th);\r
+                    }\r
+\r
+                    // add cell to headerList\r
+                    table.config.headerList[index] = this;\r
+                });\r
+\r
+                if (table.config.debug) {\r
+                    benchmark("Built headers:", time);\r
+                    log($tableHeaders);\r
+                }\r
+\r
+                return $tableHeaders;\r
+\r
+            };\r
+\r
+            // from:\r
+            // http://www.javascripttoolbox.com/lib/table/examples.php\r
+            // http://www.javascripttoolbox.com/temp/table_cellindex.html\r
+\r
+\r
+            function computeTableHeaderCellIndexes(t) {\r
+                var matrix = [];\r
+                var lookup = {};\r
+                var thead = t.getElementsByTagName('THEAD')[0];\r
+                var trs = thead.getElementsByTagName('TR');\r
+\r
+                for (var i = 0; i < trs.length; i++) {\r
+                    var cells = trs[i].cells;\r
+                    for (var j = 0; j < cells.length; j++) {\r
+                        var c = cells[j];\r
+\r
+                        var rowIndex = c.parentNode.rowIndex;\r
+                        var cellId = rowIndex + "-" + c.cellIndex;\r
+                        var rowSpan = c.rowSpan || 1;\r
+                        var colSpan = c.colSpan || 1\r
+                        var firstAvailCol;\r
+                        if (typeof(matrix[rowIndex]) == "undefined") {\r
+                            matrix[rowIndex] = [];\r
+                        }\r
+                        // Find first available column in the first row\r
+                        for (var k = 0; k < matrix[rowIndex].length + 1; k++) {\r
+                            if (typeof(matrix[rowIndex][k]) == "undefined") {\r
+                                firstAvailCol = k;\r
+                                break;\r
+                            }\r
+                        }\r
+                        lookup[cellId] = firstAvailCol;\r
+                        for (var k = rowIndex; k < rowIndex + rowSpan; k++) {\r
+                            if (typeof(matrix[k]) == "undefined") {\r
+                                matrix[k] = [];\r
+                            }\r
+                            var matrixrow = matrix[k];\r
+                            for (var l = firstAvailCol; l < firstAvailCol + colSpan; l++) {\r
+                                matrixrow[l] = "x";\r
+                            }\r
+                        }\r
+                    }\r
+                }\r
+                return lookup;\r
+            }\r
+\r
+            function checkCellColSpan(table, rows, row) {\r
+                var arr = [],\r
+                    r = table.tHead.rows,\r
+                    c = r[row].cells;\r
+\r
+                for (var i = 0; i < c.length; i++) {\r
+                    var cell = c[i];\r
+\r
+                    if (cell.colSpan > 1) {\r
+                        arr = arr.concat(checkCellColSpan(table, headerArr, row++));\r
+                    } else {\r
+                        if (table.tHead.length == 1 || (cell.rowSpan > 1 || !r[row + 1])) {\r
+                            arr.push(cell);\r
+                        }\r
+                        // headerArr[row] = (i+row);\r
+                    }\r
+                }\r
+                return arr;\r
+            };\r
+\r
+            function checkHeaderMetadata(cell) {\r
+                if (($.metadata) && ($(cell).metadata().sorter === false)) {\r
+                    return true;\r
+                };\r
+                return false;\r
+            }\r
+\r
+            function checkHeaderOptions(table, i) {\r
+                if ((table.config.headers[i]) && (table.config.headers[i].sorter === false)) {\r
+                    return true;\r
+                };\r
+                return false;\r
+            }\r
+                       \r
+                        function checkHeaderOptionsSortingLocked(table, i) {\r
+                if ((table.config.headers[i]) && (table.config.headers[i].lockedOrder)) return table.config.headers[i].lockedOrder;\r
+                return false;\r
+            }\r
+                       \r
+            function applyWidget(table) {\r
+                var c = table.config.widgets;\r
+                var l = c.length;\r
+                for (var i = 0; i < l; i++) {\r
+\r
+                    getWidgetById(c[i]).format(table);\r
+                }\r
+\r
+            }\r
+\r
+            function getWidgetById(name) {\r
+                var l = widgets.length;\r
+                for (var i = 0; i < l; i++) {\r
+                    if (widgets[i].id.toLowerCase() == name.toLowerCase()) {\r
+                        return widgets[i];\r
+                    }\r
+                }\r
+            };\r
+\r
+            function formatSortingOrder(v) {\r
+                if (typeof(v) != "Number") {\r
+                    return (v.toLowerCase() == "desc") ? 1 : 0;\r
+                } else {\r
+                    return (v == 1) ? 1 : 0;\r
+                }\r
+            }\r
+\r
+            function isValueInArray(v, a) {\r
+                var l = a.length;\r
+                for (var i = 0; i < l; i++) {\r
+                    if (a[i][0] == v) {\r
+                        return true;\r
+                    }\r
+                }\r
+                return false;\r
+            }\r
+\r
+            function setHeadersCss(table, $headers, list, css) {\r
+                // remove all header information\r
+                $headers.removeClass(css[0]).removeClass(css[1]);\r
+\r
+                var h = [];\r
+                $headers.each(function (offset) {\r
+                    if (!this.sortDisabled) {\r
+                        h[this.column] = $(this);\r
+                    }\r
+                });\r
+\r
+                var l = list.length;\r
+                for (var i = 0; i < l; i++) {\r
+                    h[list[i][0]].addClass(css[list[i][1]]);\r
+                }\r
+            }\r
+\r
+            function fixColumnWidth(table, $headers) {\r
+                var c = table.config;\r
+                if (c.widthFixed) {\r
+                    var colgroup = $('<colgroup>');\r
+                    $("tr:first td", table.tBodies[0]).each(function () {\r
+                        colgroup.append($('<col>').css('width', $(this).width()));\r
+                    });\r
+                    $(table).prepend(colgroup);\r
+                };\r
+            }\r
+\r
+            function updateHeaderSortCount(table, sortList) {\r
+                var c = table.config,\r
+                    l = sortList.length;\r
+                for (var i = 0; i < l; i++) {\r
+                    var s = sortList[i],\r
+                        o = c.headerList[s[0]];\r
+                    o.count = s[1];\r
+                    o.count++;\r
+                }\r
+            }\r
+\r
+            /* sorting methods */\r
+\r
+            function multisort(table, sortList, cache) {\r
+\r
+                if (table.config.debug) {\r
+                    var sortTime = new Date();\r
+                }\r
+\r
+                var dynamicExp = "var sortWrapper = function(a,b) {",\r
+                    l = sortList.length;\r
+\r
+                // TODO: inline functions.\r
+                for (var i = 0; i < l; i++) {\r
+\r
+                    var c = sortList[i][0];\r
+                    var order = sortList[i][1];\r
+                    // var s = (getCachedSortType(table.config.parsers,c) == "text") ?\r
+                    // ((order == 0) ? "sortText" : "sortTextDesc") : ((order == 0) ?\r
+                    // "sortNumeric" : "sortNumericDesc");\r
+                    // var s = (table.config.parsers[c].type == "text") ? ((order == 0)\r
+                    // ? makeSortText(c) : makeSortTextDesc(c)) : ((order == 0) ?\r
+                    // makeSortNumeric(c) : makeSortNumericDesc(c));\r
+                    var s = (table.config.parsers[c].type == "text") ? ((order == 0) ? makeSortFunction("text", "asc", c) : makeSortFunction("text", "desc", c)) : ((order == 0) ? makeSortFunction("numeric", "asc", c) : makeSortFunction("numeric", "desc", c));\r
+                    var e = "e" + i;\r
+\r
+                    dynamicExp += "var " + e + " = " + s; // + "(a[" + c + "],b[" + c\r
+                    // + "]); ";\r
+                    dynamicExp += "if(" + e + ") { return " + e + "; } ";\r
+                    dynamicExp += "else { ";\r
+\r
+                }\r
+\r
+                // if value is the same keep orignal order\r
+                var orgOrderCol = cache.normalized[0].length - 1;\r
+                dynamicExp += "return a[" + orgOrderCol + "]-b[" + orgOrderCol + "];";\r
+\r
+                for (var i = 0; i < l; i++) {\r
+                    dynamicExp += "}; ";\r
+                }\r
+\r
+                dynamicExp += "return 0; ";\r
+                dynamicExp += "}; ";\r
+\r
+                if (table.config.debug) {\r
+                    benchmark("Evaling expression:" + dynamicExp, new Date());\r
+                }\r
+\r
+                eval(dynamicExp);\r
+\r
+                cache.normalized.sort(sortWrapper);\r
+\r
+                if (table.config.debug) {\r
+                    benchmark("Sorting on " + sortList.toString() + " and dir " + order + " time:", sortTime);\r
+                }\r
+\r
+                return cache;\r
+            };\r
+\r
+            function makeSortFunction(type, direction, index) {\r
+                var a = "a[" + index + "]",\r
+                    b = "b[" + index + "]";\r
+                if (type == 'text' && direction == 'asc') {\r
+                    return "(" + a + " == " + b + " ? 0 : (" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : (" + a + " < " + b + ") ? -1 : 1 )));";\r
+                } else if (type == 'text' && direction == 'desc') {\r
+                    return "(" + a + " == " + b + " ? 0 : (" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : (" + b + " < " + a + ") ? -1 : 1 )));";\r
+                } else if (type == 'numeric' && direction == 'asc') {\r
+                    return "(" + a + " === null && " + b + " === null) ? 0 :(" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : " + a + " - " + b + "));";\r
+                } else if (type == 'numeric' && direction == 'desc') {\r
+                    return "(" + a + " === null && " + b + " === null) ? 0 :(" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : " + b + " - " + a + "));";\r
+                }\r
+            };\r
+\r
+            function makeSortText(i) {\r
+                return "((a[" + i + "] < b[" + i + "]) ? -1 : ((a[" + i + "] > b[" + i + "]) ? 1 : 0));";\r
+            };\r
+\r
+            function makeSortTextDesc(i) {\r
+                return "((b[" + i + "] < a[" + i + "]) ? -1 : ((b[" + i + "] > a[" + i + "]) ? 1 : 0));";\r
+            };\r
+\r
+            function makeSortNumeric(i) {\r
+                return "a[" + i + "]-b[" + i + "];";\r
+            };\r
+\r
+            function makeSortNumericDesc(i) {\r
+                return "b[" + i + "]-a[" + i + "];";\r
+            };\r
+\r
+            function sortText(a, b) {\r
+                if (table.config.sortLocaleCompare) return a.localeCompare(b);\r
+                return ((a < b) ? -1 : ((a > b) ? 1 : 0));\r
+            };\r
+\r
+            function sortTextDesc(a, b) {\r
+                if (table.config.sortLocaleCompare) return b.localeCompare(a);\r
+                return ((b < a) ? -1 : ((b > a) ? 1 : 0));\r
+            };\r
+\r
+            function sortNumeric(a, b) {\r
+                return a - b;\r
+            };\r
+\r
+            function sortNumericDesc(a, b) {\r
+                return b - a;\r
+            };\r
+\r
+            function getCachedSortType(parsers, i) {\r
+                return parsers[i].type;\r
+            }; /* public methods */\r
+            this.construct = function (settings) {\r
+                return this.each(function () {\r
+                    // if no thead or tbody quit.\r
+                    if (!this.tHead || !this.tBodies) return;\r
+                    // declare\r
+                    var $this, $document, $headers, cache, config, shiftDown = 0,\r
+                        sortOrder;\r
+                    // new blank config object\r
+                    this.config = {};\r
+                    // merge and extend.\r
+                    config = $.extend(this.config, $.tablesorter.defaults, settings);\r
+                    // store common expression for speed\r
+                    $this = $(this);\r
+                    // save the settings where they read\r
+                    $.data(this, "tablesorter", config);\r
+                    // build headers\r
+                    $headers = buildHeaders(this);\r
+                    // try to auto detect column type, and store in tables config\r
+                    this.config.parsers = buildParserCache(this, $headers);\r
+                    // build the cache for the tbody cells\r
+                    cache = buildCache(this);\r
+                    // get the css class names, could be done else where.\r
+                    var sortCSS = [config.cssDesc, config.cssAsc];\r
+                    // fixate columns if the users supplies the fixedWidth option\r
+                    fixColumnWidth(this);\r
+                    // apply event handling to headers\r
+                    // this is to big, perhaps break it out?\r
+                    $headers.click(\r
+\r
+                    function (e) {\r
+                        var totalRows = ($this[0].tBodies[0] && $this[0].tBodies[0].rows.length) || 0;\r
+                        if (!this.sortDisabled && totalRows > 0) {\r
+                            // Only call sortStart if sorting is\r
+                            // enabled.\r
+                            $this.trigger("sortStart");\r
+                            // store exp, for speed\r
+                            var $cell = $(this);\r
+                            // get current column index\r
+                            var i = this.column;\r
+                            // get current column sort order\r
+                            this.order = this.count++ % 2;\r
+                                                       // always sort on the locked order.\r
+                                                       if(this.lockedOrder) this.order = this.lockedOrder;\r
+                                                       \r
+                                                       // user only whants to sort on one\r
+                            // column\r
+                            if (!e[config.sortMultiSortKey]) {\r
+                                // flush the sort list\r
+                                config.sortList = [];\r
+                                if (config.sortForce != null) {\r
+                                    var a = config.sortForce;\r
+                                    for (var j = 0; j < a.length; j++) {\r
+                                        if (a[j][0] != i) {\r
+                                            config.sortList.push(a[j]);\r
+                                        }\r
+                                    }\r
+                                }\r
+                                // add column to sort list\r
+                                config.sortList.push([i, this.order]);\r
+                                // multi column sorting\r
+                            } else {\r
+                                // the user has clicked on an all\r
+                                // ready sortet column.\r
+                                if (isValueInArray(i, config.sortList)) {\r
+                                    // revers the sorting direction\r
+                                    // for all tables.\r
+                                    for (var j = 0; j < config.sortList.length; j++) {\r
+                                        var s = config.sortList[j],\r
+                                            o = config.headerList[s[0]];\r
+                                        if (s[0] == i) {\r
+                                            o.count = s[1];\r
+                                            o.count++;\r
+                                            s[1] = o.count % 2;\r
+                                        }\r
+                                    }\r
+                                } else {\r
+                                    // add column to sort list array\r
+                                    config.sortList.push([i, this.order]);\r
+                                }\r
+                            };\r
+                            setTimeout(function () {\r
+                                // set css for headers\r
+                                setHeadersCss($this[0], $headers, config.sortList, sortCSS);\r
+                                appendToTable(\r
+                                       $this[0], multisort(\r
+                                       $this[0], config.sortList, cache)\r
+                                                               );\r
+                            }, 1);\r
+                            // stop normal event by returning false\r
+                            return false;\r
+                        }\r
+                        // cancel selection\r
+                    }).mousedown(function () {\r
+                        if (config.cancelSelection) {\r
+                            this.onselectstart = function () {\r
+                                return false\r
+                            };\r
+                            return false;\r
+                        }\r
+                    });\r
+                    // apply easy methods that trigger binded events\r
+                    $this.bind("update", function () {\r
+                        var me = this;\r
+                        setTimeout(function () {\r
+                            // rebuild parsers.\r
+                            me.config.parsers = buildParserCache(\r
+                            me, $headers);\r
+                            // rebuild the cache map\r
+                            cache = buildCache(me);\r
+                        }, 1);\r
+                    }).bind("updateCell", function (e, cell) {\r
+                        var config = this.config;\r
+                        // get position from the dom.\r
+                        var pos = [(cell.parentNode.rowIndex - 1), cell.cellIndex];\r
+                        // update cache\r
+                        cache.normalized[pos[0]][pos[1]] = config.parsers[pos[1]].format(\r
+                        getElementText(config, cell), cell);\r
+                    }).bind("sorton", function (e, list) {\r
+                        $(this).trigger("sortStart");\r
+                        config.sortList = list;\r
+                        // update and store the sortlist\r
+                        var sortList = config.sortList;\r
+                        // update header count index\r
+                        updateHeaderSortCount(this, sortList);\r
+                        // set css for headers\r
+                        setHeadersCss(this, $headers, sortList, sortCSS);\r
+                        // sort the table and append it to the dom\r
+                        appendToTable(this, multisort(this, sortList, cache));\r
+                    }).bind("appendCache", function () {\r
+                        appendToTable(this, cache);\r
+                    }).bind("applyWidgetId", function (e, id) {\r
+                        getWidgetById(id).format(this);\r
+                    }).bind("applyWidgets", function () {\r
+                        // apply widgets\r
+                        applyWidget(this);\r
+                    });\r
+                    if ($.metadata && ($(this).metadata() && $(this).metadata().sortlist)) {\r
+                        config.sortList = $(this).metadata().sortlist;\r
+                    }\r
+                    // if user has supplied a sort list to constructor.\r
+                    if (config.sortList.length > 0) {\r
+                        $this.trigger("sorton", [config.sortList]);\r
+                    }\r
+                    // apply widgets\r
+                    applyWidget(this);\r
+                });\r
+            };\r
+            this.addParser = function (parser) {\r
+                var l = parsers.length,\r
+                    a = true;\r
+                for (var i = 0; i < l; i++) {\r
+                    if (parsers[i].id.toLowerCase() == parser.id.toLowerCase()) {\r
+                        a = false;\r
+                    }\r
+                }\r
+                if (a) {\r
+                    parsers.push(parser);\r
+                };\r
+            };\r
+            this.addWidget = function (widget) {\r
+                widgets.push(widget);\r
+            };\r
+            this.formatFloat = function (s) {\r
+                var i = parseFloat(s);\r
+                return (isNaN(i)) ? 0 : i;\r
+            };\r
+            this.formatInt = function (s) {\r
+                var i = parseInt(s);\r
+                return (isNaN(i)) ? 0 : i;\r
+            };\r
+            this.isDigit = function (s, config) {\r
+                // replace all an wanted chars and match.\r
+                return /^[-+]?\d*$/.test($.trim(s.replace(/[,.']/g, '')));\r
+            };\r
+            this.clearTableBody = function (table) {\r
+                if ($.browser.msie) {\r
+                    function empty() {\r
+                        while (this.firstChild)\r
+                        this.removeChild(this.firstChild);\r
+                    }\r
+                    empty.apply(table.tBodies[0]);\r
+                } else {\r
+                    table.tBodies[0].innerHTML = "";\r
+                }\r
+            };\r
+        }\r
+    });\r
+\r
+    // extend plugin scope\r
+    $.fn.extend({\r
+        tablesorter: $.tablesorter.construct\r
+    });\r
+\r
+    // make shortcut\r
+    var ts = $.tablesorter;\r
+\r
+    // add default parsers\r
+    ts.addParser({\r
+        id: "text",\r
+        is: function (s) {\r
+            return true;\r
+        }, format: function (s) {\r
+            return $.trim(s.toLocaleLowerCase());\r
+        }, type: "text"\r
+    });\r
+\r
+    ts.addParser({\r
+        id: "digit",\r
+        is: function (s, table) {\r
+            var c = table.config;\r
+            return $.tablesorter.isDigit(s, c);\r
+        }, format: function (s) {\r
+            return $.tablesorter.formatFloat(s);\r
+        }, type: "numeric"\r
+    });\r
+\r
+    ts.addParser({\r
+        id: "currency",\r
+        is: function (s) {\r
+            return /^[£$€?.]/.test(s);\r
+        }, format: function (s) {\r
+            return $.tablesorter.formatFloat(s.replace(new RegExp(/[£$€]/g), ""));\r
+        }, type: "numeric"\r
+    });\r
+\r
+    ts.addParser({\r
+        id: "ipAddress",\r
+        is: function (s) {\r
+            return /^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/.test(s);\r
+        }, format: function (s) {\r
+            var a = s.split("."),\r
+                r = "",\r
+                l = a.length;\r
+            for (var i = 0; i < l; i++) {\r
+                var item = a[i];\r
+                if (item.length == 2) {\r
+                    r += "0" + item;\r
+                } else {\r
+                    r += item;\r
+                }\r
+            }\r
+            return $.tablesorter.formatFloat(r);\r
+        }, type: "numeric"\r
+    });\r
+\r
+    ts.addParser({\r
+        id: "url",\r
+        is: function (s) {\r
+            return /^(https?|ftp|file):\/\/$/.test(s);\r
+        }, format: function (s) {\r
+            return jQuery.trim(s.replace(new RegExp(/(https?|ftp|file):\/\//), ''));\r
+        }, type: "text"\r
+    });\r
+\r
+    ts.addParser({\r
+        id: "isoDate",\r
+        is: function (s) {\r
+            return /^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(s);\r
+        }, format: function (s) {\r
+            return $.tablesorter.formatFloat((s != "") ? new Date(s.replace(\r
+            new RegExp(/-/g), "/")).getTime() : "0");\r
+        }, type: "numeric"\r
+    });\r
+\r
+    ts.addParser({\r
+        id: "percent",\r
+        is: function (s) {\r
+            return /\%$/.test($.trim(s));\r
+        }, format: function (s) {\r
+            return $.tablesorter.formatFloat(s.replace(new RegExp(/%/g), ""));\r
+        }, type: "numeric"\r
+    });\r
+\r
+    ts.addParser({\r
+        id: "usLongDate",\r
+        is: function (s) {\r
+            return s.match(new RegExp(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/));\r
+        }, format: function (s) {\r
+            return $.tablesorter.formatFloat(new Date(s).getTime());\r
+        }, type: "numeric"\r
+    });\r
+\r
+    ts.addParser({\r
+        id: "shortDate",\r
+        is: function (s) {\r
+            return /\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/.test(s);\r
+        }, format: function (s, table) {\r
+            var c = table.config;\r
+            s = s.replace(/\-/g, "/");\r
+            if (c.dateFormat == "us") {\r
+                // reformat the string in ISO format\r
+                s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/, "$3/$1/$2");\r
+            } else if (c.dateFormat == "uk") {\r
+                // reformat the string in ISO format\r
+                s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/, "$3/$2/$1");\r
+            } else if (c.dateFormat == "dd/mm/yy" || c.dateFormat == "dd-mm-yy") {\r
+                s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/, "$1/$2/$3");\r
+            }\r
+            return $.tablesorter.formatFloat(new Date(s).getTime());\r
+        }, type: "numeric"\r
+    });\r
+    ts.addParser({\r
+        id: "time",\r
+        is: function (s) {\r
+            return /^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/.test(s);\r
+        }, format: function (s) {\r
+            return $.tablesorter.formatFloat(new Date("2000/01/01 " + s).getTime());\r
+        }, type: "numeric"\r
+    });\r
+    ts.addParser({\r
+        id: "metadata",\r
+        is: function (s) {\r
+            return false;\r
+        }, format: function (s, table, cell) {\r
+            var c = table.config,\r
+                p = (!c.parserMetadataName) ? 'sortValue' : c.parserMetadataName;\r
+            return $(cell).metadata()[p];\r
+        }, type: "numeric"\r
+    });\r
+    // add default widgets\r
+    ts.addWidget({\r
+        id: "zebra",\r
+        format: function (table) {\r
+            if (table.config.debug) {\r
+                var time = new Date();\r
+            }\r
+            var $tr, row = -1,\r
+                odd;\r
+            // loop through the visible rows\r
+            $("tr:visible", table.tBodies[0]).each(function (i) {\r
+                $tr = $(this);\r
+                // style children rows the same way the parent\r
+                // row was styled\r
+                if (!$tr.hasClass(table.config.cssChildRow)) row++;\r
+                odd = (row % 2 == 0);\r
+                $tr.removeClass(\r
+                table.config.widgetZebra.css[odd ? 0 : 1]).addClass(\r
+                table.config.widgetZebra.css[odd ? 1 : 0])\r
+            });\r
+            if (table.config.debug) {\r
+                $.tablesorter.benchmark("Applying Zebra widget", time);\r
+            }\r
+        }\r
+    });\r
+})(jQuery);
\ No newline at end of file
diff --git a/inc/jquery/tablesorter/jquery.metadata.js b/inc/jquery/tablesorter/jquery.metadata.js
deleted file mode 100644 (file)
index 6a984db..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Metadata - jQuery plugin for parsing metadata from elements
- *
- * Copyright (c) 2006 John Resig, Yehuda Katz, J�örn Zaefferer, Paul McLanahan
- *
- * Dual licensed under the MIT and GPL licenses:
- *   http://www.opensource.org/licenses/mit-license.php
- *   http://www.gnu.org/licenses/gpl.html
- *
- * Revision: $Id$
- *
- */
-
-/**
- * Sets the type of metadata to use. Metadata is encoded in JSON, and each property
- * in the JSON will become a property of the element itself.
- *
- * There are three supported types of metadata storage:
- *
- *   attr:  Inside an attribute. The name parameter indicates *which* attribute.
- *          
- *   class: Inside the class attribute, wrapped in curly braces: { }
- *   
- *   elem:  Inside a child element (e.g. a script tag). The
- *          name parameter indicates *which* element.
- *          
- * The metadata for an element is loaded the first time the element is accessed via jQuery.
- *
- * As a result, you can define the metadata type, use $(expr) to load the metadata into the elements
- * matched by expr, then redefine the metadata type and run another $(expr) for other elements.
- * 
- * @name $.metadata.setType
- *
- * @example <p id="one" class="some_class {item_id: 1, item_label: 'Label'}">This is a p</p>
- * @before $.metadata.setType("class")
- * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
- * @desc Reads metadata from the class attribute
- * 
- * @example <p id="one" class="some_class" data="{item_id: 1, item_label: 'Label'}">This is a p</p>
- * @before $.metadata.setType("attr", "data")
- * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
- * @desc Reads metadata from a "data" attribute
- * 
- * @example <p id="one" class="some_class"><script>{item_id: 1, item_label: 'Label'}</script>This is a p</p>
- * @before $.metadata.setType("elem", "script")
- * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
- * @desc Reads metadata from a nested script element
- * 
- * @param String type The encoding type
- * @param String name The name of the attribute to be used to get metadata (optional)
- * @cat Plugins/Metadata
- * @descr Sets the type of encoding to be used when loading metadata for the first time
- * @type undefined
- * @see metadata()
- */
-
-(function($) {
-
-$.extend({
-       metadata : {
-               defaults : {
-                       type: 'class',
-                       name: 'metadata',
-                       cre: /({.*})/,
-                       single: 'metadata'
-               },
-               setType: function( type, name ){
-                       this.defaults.type = type;
-                       this.defaults.name = name;
-               },
-               get: function( elem, opts ){
-                       var settings = $.extend({},this.defaults,opts);
-                       // check for empty string in single property
-                       if ( !settings.single.length ) settings.single = 'metadata';
-                       
-                       var data = $.data(elem, settings.single);
-                       // returned cached data if it already exists
-                       if ( data ) return data;
-                       
-                       data = "{}";
-                       
-                       if ( settings.type == "class" ) {
-                               var m = settings.cre.exec( elem.className );
-                               if ( m )
-                                       data = m[1];
-                       } else if ( settings.type == "elem" ) {
-                               if( !elem.getElementsByTagName )
-                                       return undefined;
-                               var e = elem.getElementsByTagName(settings.name);
-                               if ( e.length )
-                                       data = $.trim(e[0].innerHTML);
-                       } else if ( elem.getAttribute != undefined ) {
-                               var attr = elem.getAttribute( settings.name );
-                               if ( attr )
-                                       data = attr;
-                       }
-                       
-                       if ( data.indexOf( '{' ) <0 )
-                       data = "{" + data + "}";
-                       
-                       data = eval("(" + data + ")");
-                       
-                       $.data( elem, settings.single, data );
-                       return data;
-               }
-       }
-});
-
-/**
- * Returns the metadata object for the first member of the jQuery object.
- *
- * @name metadata
- * @descr Returns element's metadata object
- * @param Object opts An object contianing settings to override the defaults
- * @type jQuery
- * @cat Plugins/Metadata
- */
-$.fn.metadata = function( opts ){
-       return $.metadata.get( this[0], opts );
-};
-
-})(jQuery);
\ No newline at end of file
diff --git a/inc/jquery/tablesorter/jquery.tablesorter.js b/inc/jquery/tablesorter/jquery.tablesorter.js
deleted file mode 100644 (file)
index 9b58731..0000000
+++ /dev/null
@@ -1,1031 +0,0 @@
-/*\r
- * \r
- * TableSorter 2.0 - Client-side table sorting with ease!\r
- * Version 2.0.5b\r
- * @requires jQuery v1.2.3\r
- * \r
- * Copyright (c) 2007 Christian Bach\r
- * Examples and docs at: http://tablesorter.com\r
- * Dual licensed under the MIT and GPL licenses:\r
- * http://www.opensource.org/licenses/mit-license.php\r
- * http://www.gnu.org/licenses/gpl.html\r
- * \r
- */\r
-/**\r
- * \r
- * @description Create a sortable table with multi-column sorting capabilitys\r
- * \r
- * @example $('table').tablesorter();\r
- * @desc Create a simple tablesorter interface.\r
- * \r
- * @example $('table').tablesorter({ sortList:[[0,0],[1,0]] });\r
- * @desc Create a tablesorter interface and sort on the first and secound column column headers.\r
- * \r
- * @example $('table').tablesorter({ headers: { 0: { sorter: false}, 1: {sorter: false} } });\r
- *          \r
- * @desc Create a tablesorter interface and disableing the first and second  column headers.\r
- *      \r
- * \r
- * @example $('table').tablesorter({ headers: { 0: {sorter:"integer"}, 1: {sorter:"currency"} } });\r
- * \r
- * @desc Create a tablesorter interface and set a column parser for the first\r
- *       and second column.\r
- * \r
- * \r
- * @param Object\r
- *            settings An object literal containing key/value pairs to provide\r
- *            optional settings.\r
- * \r
- * \r
- * @option String cssHeader (optional) A string of the class name to be appended\r
- *         to sortable tr elements in the thead of the table. Default value:\r
- *         "header"\r
- * \r
- * @option String cssAsc (optional) A string of the class name to be appended to\r
- *         sortable tr elements in the thead on a ascending sort. Default value:\r
- *         "headerSortUp"\r
- * \r
- * @option String cssDesc (optional) A string of the class name to be appended\r
- *         to sortable tr elements in the thead on a descending sort. Default\r
- *         value: "headerSortDown"\r
- * \r
- * @option String sortInitialOrder (optional) A string of the inital sorting\r
- *         order can be asc or desc. Default value: "asc"\r
- * \r
- * @option String sortMultisortKey (optional) A string of the multi-column sort\r
- *         key. Default value: "shiftKey"\r
- * \r
- * @option String textExtraction (optional) A string of the text-extraction\r
- *         method to use. For complex html structures inside td cell set this\r
- *         option to "complex", on large tables the complex option can be slow.\r
- *         Default value: "simple"\r
- * \r
- * @option Object headers (optional) An array containing the forces sorting\r
- *         rules. This option let's you specify a default sorting rule. Default\r
- *         value: null\r
- * \r
- * @option Array sortList (optional) An array containing the forces sorting\r
- *         rules. This option let's you specify a default sorting rule. Default\r
- *         value: null\r
- * \r
- * @option Array sortForce (optional) An array containing forced sorting rules.\r
- *         This option let's you specify a default sorting rule, which is\r
- *         prepended to user-selected rules. Default value: null\r
- * \r
- * @option Boolean sortLocaleCompare (optional) Boolean flag indicating whatever\r
- *         to use String.localeCampare method or not. Default set to true.\r
- * \r
- * \r
- * @option Array sortAppend (optional) An array containing forced sorting rules.\r
- *         This option let's you specify a default sorting rule, which is\r
- *         appended to user-selected rules. Default value: null\r
- * \r
- * @option Boolean widthFixed (optional) Boolean flag indicating if tablesorter\r
- *         should apply fixed widths to the table columns. This is usefull when\r
- *         using the pager companion plugin. This options requires the dimension\r
- *         jquery plugin. Default value: false\r
- * \r
- * @option Boolean cancelSelection (optional) Boolean flag indicating if\r
- *         tablesorter should cancel selection of the table headers text.\r
- *         Default value: true\r
- * \r
- * @option Boolean debug (optional) Boolean flag indicating if tablesorter\r
- *         should display debuging information usefull for development.\r
- * \r
- * @type jQuery\r
- * \r
- * @name tablesorter\r
- * \r
- * @cat Plugins/Tablesorter\r
- * \r
- * @author Christian Bach/christian.bach@polyester.se\r
- */\r
-\r
-(function ($) {\r
-    $.extend({\r
-        tablesorter: new\r
-        function () {\r
-\r
-            var parsers = [],\r
-                widgets = [];\r
-\r
-            this.defaults = {\r
-                cssHeader: "header",\r
-                cssAsc: "headerSortUp",\r
-                cssDesc: "headerSortDown",\r
-                cssChildRow: "expand-child",\r
-                sortInitialOrder: "asc",\r
-                sortMultiSortKey: "shiftKey",\r
-                sortForce: null,\r
-                sortAppend: null,\r
-                sortLocaleCompare: true,\r
-                textExtraction: "simple",\r
-                parsers: {}, widgets: [],\r
-                widgetZebra: {\r
-                    css: ["even", "odd"]\r
-                }, headers: {}, widthFixed: false,\r
-                cancelSelection: true,\r
-                sortList: [],\r
-                headerList: [],\r
-                dateFormat: "us",\r
-                decimal: '/\.|\,/g',\r
-                onRenderHeader: null,\r
-                selectorHeaders: 'thead th',\r
-                debug: false\r
-            };\r
-\r
-            /* debuging utils */\r
-\r
-            function benchmark(s, d) {\r
-                log(s + "," + (new Date().getTime() - d.getTime()) + "ms");\r
-            }\r
-\r
-            this.benchmark = benchmark;\r
-\r
-            function log(s) {\r
-                if (typeof console != "undefined" && typeof console.debug != "undefined") {\r
-                    console.log(s);\r
-                } else {\r
-                    alert(s);\r
-                }\r
-            }\r
-\r
-            /* parsers utils */\r
-\r
-            function buildParserCache(table, $headers) {\r
-\r
-                if (table.config.debug) {\r
-                    var parsersDebug = "";\r
-                }\r
-\r
-                if (table.tBodies.length == 0) return; // In the case of empty tables\r
-                var rows = table.tBodies[0].rows;\r
-\r
-                if (rows[0]) {\r
-\r
-                    var list = [],\r
-                        cells = rows[0].cells,\r
-                        l = cells.length;\r
-\r
-                    for (var i = 0; i < l; i++) {\r
-\r
-                        var p = false;\r
-\r
-                        if ($.metadata && ($($headers[i]).metadata() && $($headers[i]).metadata().sorter)) {\r
-\r
-                            p = getParserById($($headers[i]).metadata().sorter);\r
-\r
-                        } else if ((table.config.headers[i] && table.config.headers[i].sorter)) {\r
-\r
-                            p = getParserById(table.config.headers[i].sorter);\r
-                        }\r
-                        if (!p) {\r
-\r
-                            p = detectParserForColumn(table, rows, -1, i);\r
-                        }\r
-\r
-                        if (table.config.debug) {\r
-                            parsersDebug += "column:" + i + " parser:" + p.id + "\n";\r
-                        }\r
-\r
-                        list.push(p);\r
-                    }\r
-                }\r
-\r
-                if (table.config.debug) {\r
-                    log(parsersDebug);\r
-                }\r
-\r
-                return list;\r
-            };\r
-\r
-            function detectParserForColumn(table, rows, rowIndex, cellIndex) {\r
-                var l = parsers.length,\r
-                    node = false,\r
-                    nodeValue = false,\r
-                    keepLooking = true;\r
-                while (nodeValue == '' && keepLooking) {\r
-                    rowIndex++;\r
-                    if (rows[rowIndex]) {\r
-                        node = getNodeFromRowAndCellIndex(rows, rowIndex, cellIndex);\r
-                        nodeValue = trimAndGetNodeText(table.config, node);\r
-                        if (table.config.debug) {\r
-                            log('Checking if value was empty on row:' + rowIndex);\r
-                        }\r
-                    } else {\r
-                        keepLooking = false;\r
-                    }\r
-                }\r
-                for (var i = 1; i < l; i++) {\r
-                    if (parsers[i].is(nodeValue, table, node)) {\r
-                        return parsers[i];\r
-                    }\r
-                }\r
-                // 0 is always the generic parser (text)\r
-                return parsers[0];\r
-            }\r
-\r
-            function getNodeFromRowAndCellIndex(rows, rowIndex, cellIndex) {\r
-                return rows[rowIndex].cells[cellIndex];\r
-            }\r
-\r
-            function trimAndGetNodeText(config, node) {\r
-                return $.trim(getElementText(config, node));\r
-            }\r
-\r
-            function getParserById(name) {\r
-                var l = parsers.length;\r
-                for (var i = 0; i < l; i++) {\r
-                    if (parsers[i].id.toLowerCase() == name.toLowerCase()) {\r
-                        return parsers[i];\r
-                    }\r
-                }\r
-                return false;\r
-            }\r
-\r
-            /* utils */\r
-\r
-            function buildCache(table) {\r
-\r
-                if (table.config.debug) {\r
-                    var cacheTime = new Date();\r
-                }\r
-\r
-                var totalRows = (table.tBodies[0] && table.tBodies[0].rows.length) || 0,\r
-                    totalCells = (table.tBodies[0].rows[0] && table.tBodies[0].rows[0].cells.length) || 0,\r
-                    parsers = table.config.parsers,\r
-                    cache = {\r
-                        row: [],\r
-                        normalized: []\r
-                    };\r
-\r
-                for (var i = 0; i < totalRows; ++i) {\r
-\r
-                    /** Add the table data to main data array */\r
-                    var c = $(table.tBodies[0].rows[i]),\r
-                        cols = [];\r
-\r
-                    // if this is a child row, add it to the last row's children and\r
-                    // continue to the next row\r
-                    if (c.hasClass(table.config.cssChildRow)) {\r
-                        cache.row[cache.row.length - 1] = cache.row[cache.row.length - 1].add(c);\r
-                        // go to the next for loop\r
-                        continue;\r
-                    }\r
-\r
-                    cache.row.push(c);\r
-\r
-                    for (var j = 0; j < totalCells; ++j) {\r
-                        cols.push(parsers[j].format(getElementText(table.config, c[0].cells[j]), table, c[0].cells[j]));\r
-                    }\r
-\r
-                    cols.push(cache.normalized.length); // add position for rowCache\r
-                    cache.normalized.push(cols);\r
-                    cols = null;\r
-                };\r
-\r
-                if (table.config.debug) {\r
-                    benchmark("Building cache for " + totalRows + " rows:", cacheTime);\r
-                }\r
-\r
-                return cache;\r
-            };\r
-\r
-            function getElementText(config, node) {\r
-\r
-                var text = "";\r
-\r
-                if (!node) return "";\r
-\r
-                if (!config.supportsTextContent) config.supportsTextContent = node.textContent || false;\r
-\r
-                if (config.textExtraction == "simple") {\r
-                    if (config.supportsTextContent) {\r
-                        text = node.textContent;\r
-                    } else {\r
-                        if (node.childNodes[0] && node.childNodes[0].hasChildNodes()) {\r
-                            text = node.childNodes[0].innerHTML;\r
-                        } else {\r
-                            text = node.innerHTML;\r
-                        }\r
-                    }\r
-                } else {\r
-                    if (typeof(config.textExtraction) == "function") {\r
-                        text = config.textExtraction(node);\r
-                    } else {\r
-                        text = $(node).text();\r
-                    }\r
-                }\r
-                return text;\r
-            }\r
-\r
-            function appendToTable(table, cache) {\r
-\r
-                if (table.config.debug) {\r
-                    var appendTime = new Date()\r
-                }\r
-\r
-                var c = cache,\r
-                    r = c.row,\r
-                    n = c.normalized,\r
-                    totalRows = n.length,\r
-                    checkCell = (n[0].length - 1),\r
-                    tableBody = $(table.tBodies[0]),\r
-                    rows = [];\r
-\r
-\r
-                for (var i = 0; i < totalRows; i++) {\r
-                    var pos = n[i][checkCell];\r
-\r
-                    rows.push(r[pos]);\r
-\r
-                    if (!table.config.appender) {\r
-\r
-                        //var o = ;\r
-                        var l = r[pos].length;\r
-                        for (var j = 0; j < l; j++) {\r
-                            tableBody[0].appendChild(r[pos][j]);\r
-                        }\r
-\r
-                        // \r
-                    }\r
-                }\r
-\r
-\r
-\r
-                if (table.config.appender) {\r
-\r
-                    table.config.appender(table, rows);\r
-                }\r
-\r
-                rows = null;\r
-\r
-                if (table.config.debug) {\r
-                    benchmark("Rebuilt table:", appendTime);\r
-                }\r
-\r
-                // apply table widgets\r
-                applyWidget(table);\r
-\r
-                // trigger sortend\r
-                setTimeout(function () {\r
-                    $(table).trigger("sortEnd");\r
-                }, 0);\r
-\r
-            };\r
-\r
-            function buildHeaders(table) {\r
-\r
-                if (table.config.debug) {\r
-                    var time = new Date();\r
-                }\r
-\r
-                var meta = ($.metadata) ? true : false;\r
-                \r
-                var header_index = computeTableHeaderCellIndexes(table);\r
-\r
-                $tableHeaders = $(table.config.selectorHeaders, table).each(function (index) {\r
-\r
-                    this.column = header_index[this.parentNode.rowIndex + "-" + this.cellIndex];\r
-                    // this.column = index;\r
-                    this.order = formatSortingOrder(table.config.sortInitialOrder);\r
-                    \r
-                                       \r
-                                       this.count = this.order;\r
-\r
-                    if (checkHeaderMetadata(this) || checkHeaderOptions(table, index)) this.sortDisabled = true;\r
-                                       if (checkHeaderOptionsSortingLocked(table, index)) this.order = this.lockedOrder = checkHeaderOptionsSortingLocked(table, index);\r
-\r
-                    if (!this.sortDisabled) {\r
-                        var $th = $(this).addClass(table.config.cssHeader);\r
-                        if (table.config.onRenderHeader) table.config.onRenderHeader.apply($th);\r
-                    }\r
-\r
-                    // add cell to headerList\r
-                    table.config.headerList[index] = this;\r
-                });\r
-\r
-                if (table.config.debug) {\r
-                    benchmark("Built headers:", time);\r
-                    log($tableHeaders);\r
-                }\r
-\r
-                return $tableHeaders;\r
-\r
-            };\r
-\r
-            // from:\r
-            // http://www.javascripttoolbox.com/lib/table/examples.php\r
-            // http://www.javascripttoolbox.com/temp/table_cellindex.html\r
-\r
-\r
-            function computeTableHeaderCellIndexes(t) {\r
-                var matrix = [];\r
-                var lookup = {};\r
-                var thead = t.getElementsByTagName('THEAD')[0];\r
-                var trs = thead.getElementsByTagName('TR');\r
-\r
-                for (var i = 0; i < trs.length; i++) {\r
-                    var cells = trs[i].cells;\r
-                    for (var j = 0; j < cells.length; j++) {\r
-                        var c = cells[j];\r
-\r
-                        var rowIndex = c.parentNode.rowIndex;\r
-                        var cellId = rowIndex + "-" + c.cellIndex;\r
-                        var rowSpan = c.rowSpan || 1;\r
-                        var colSpan = c.colSpan || 1\r
-                        var firstAvailCol;\r
-                        if (typeof(matrix[rowIndex]) == "undefined") {\r
-                            matrix[rowIndex] = [];\r
-                        }\r
-                        // Find first available column in the first row\r
-                        for (var k = 0; k < matrix[rowIndex].length + 1; k++) {\r
-                            if (typeof(matrix[rowIndex][k]) == "undefined") {\r
-                                firstAvailCol = k;\r
-                                break;\r
-                            }\r
-                        }\r
-                        lookup[cellId] = firstAvailCol;\r
-                        for (var k = rowIndex; k < rowIndex + rowSpan; k++) {\r
-                            if (typeof(matrix[k]) == "undefined") {\r
-                                matrix[k] = [];\r
-                            }\r
-                            var matrixrow = matrix[k];\r
-                            for (var l = firstAvailCol; l < firstAvailCol + colSpan; l++) {\r
-                                matrixrow[l] = "x";\r
-                            }\r
-                        }\r
-                    }\r
-                }\r
-                return lookup;\r
-            }\r
-\r
-            function checkCellColSpan(table, rows, row) {\r
-                var arr = [],\r
-                    r = table.tHead.rows,\r
-                    c = r[row].cells;\r
-\r
-                for (var i = 0; i < c.length; i++) {\r
-                    var cell = c[i];\r
-\r
-                    if (cell.colSpan > 1) {\r
-                        arr = arr.concat(checkCellColSpan(table, headerArr, row++));\r
-                    } else {\r
-                        if (table.tHead.length == 1 || (cell.rowSpan > 1 || !r[row + 1])) {\r
-                            arr.push(cell);\r
-                        }\r
-                        // headerArr[row] = (i+row);\r
-                    }\r
-                }\r
-                return arr;\r
-            };\r
-\r
-            function checkHeaderMetadata(cell) {\r
-                if (($.metadata) && ($(cell).metadata().sorter === false)) {\r
-                    return true;\r
-                };\r
-                return false;\r
-            }\r
-\r
-            function checkHeaderOptions(table, i) {\r
-                if ((table.config.headers[i]) && (table.config.headers[i].sorter === false)) {\r
-                    return true;\r
-                };\r
-                return false;\r
-            }\r
-                       \r
-                        function checkHeaderOptionsSortingLocked(table, i) {\r
-                if ((table.config.headers[i]) && (table.config.headers[i].lockedOrder)) return table.config.headers[i].lockedOrder;\r
-                return false;\r
-            }\r
-                       \r
-            function applyWidget(table) {\r
-                var c = table.config.widgets;\r
-                var l = c.length;\r
-                for (var i = 0; i < l; i++) {\r
-\r
-                    getWidgetById(c[i]).format(table);\r
-                }\r
-\r
-            }\r
-\r
-            function getWidgetById(name) {\r
-                var l = widgets.length;\r
-                for (var i = 0; i < l; i++) {\r
-                    if (widgets[i].id.toLowerCase() == name.toLowerCase()) {\r
-                        return widgets[i];\r
-                    }\r
-                }\r
-            };\r
-\r
-            function formatSortingOrder(v) {\r
-                if (typeof(v) != "Number") {\r
-                    return (v.toLowerCase() == "desc") ? 1 : 0;\r
-                } else {\r
-                    return (v == 1) ? 1 : 0;\r
-                }\r
-            }\r
-\r
-            function isValueInArray(v, a) {\r
-                var l = a.length;\r
-                for (var i = 0; i < l; i++) {\r
-                    if (a[i][0] == v) {\r
-                        return true;\r
-                    }\r
-                }\r
-                return false;\r
-            }\r
-\r
-            function setHeadersCss(table, $headers, list, css) {\r
-                // remove all header information\r
-                $headers.removeClass(css[0]).removeClass(css[1]);\r
-\r
-                var h = [];\r
-                $headers.each(function (offset) {\r
-                    if (!this.sortDisabled) {\r
-                        h[this.column] = $(this);\r
-                    }\r
-                });\r
-\r
-                var l = list.length;\r
-                for (var i = 0; i < l; i++) {\r
-                    h[list[i][0]].addClass(css[list[i][1]]);\r
-                }\r
-            }\r
-\r
-            function fixColumnWidth(table, $headers) {\r
-                var c = table.config;\r
-                if (c.widthFixed) {\r
-                    var colgroup = $('<colgroup>');\r
-                    $("tr:first td", table.tBodies[0]).each(function () {\r
-                        colgroup.append($('<col>').css('width', $(this).width()));\r
-                    });\r
-                    $(table).prepend(colgroup);\r
-                };\r
-            }\r
-\r
-            function updateHeaderSortCount(table, sortList) {\r
-                var c = table.config,\r
-                    l = sortList.length;\r
-                for (var i = 0; i < l; i++) {\r
-                    var s = sortList[i],\r
-                        o = c.headerList[s[0]];\r
-                    o.count = s[1];\r
-                    o.count++;\r
-                }\r
-            }\r
-\r
-            /* sorting methods */\r
-\r
-            function multisort(table, sortList, cache) {\r
-\r
-                if (table.config.debug) {\r
-                    var sortTime = new Date();\r
-                }\r
-\r
-                var dynamicExp = "var sortWrapper = function(a,b) {",\r
-                    l = sortList.length;\r
-\r
-                // TODO: inline functions.\r
-                for (var i = 0; i < l; i++) {\r
-\r
-                    var c = sortList[i][0];\r
-                    var order = sortList[i][1];\r
-                    // var s = (getCachedSortType(table.config.parsers,c) == "text") ?\r
-                    // ((order == 0) ? "sortText" : "sortTextDesc") : ((order == 0) ?\r
-                    // "sortNumeric" : "sortNumericDesc");\r
-                    // var s = (table.config.parsers[c].type == "text") ? ((order == 0)\r
-                    // ? makeSortText(c) : makeSortTextDesc(c)) : ((order == 0) ?\r
-                    // makeSortNumeric(c) : makeSortNumericDesc(c));\r
-                    var s = (table.config.parsers[c].type == "text") ? ((order == 0) ? makeSortFunction("text", "asc", c) : makeSortFunction("text", "desc", c)) : ((order == 0) ? makeSortFunction("numeric", "asc", c) : makeSortFunction("numeric", "desc", c));\r
-                    var e = "e" + i;\r
-\r
-                    dynamicExp += "var " + e + " = " + s; // + "(a[" + c + "],b[" + c\r
-                    // + "]); ";\r
-                    dynamicExp += "if(" + e + ") { return " + e + "; } ";\r
-                    dynamicExp += "else { ";\r
-\r
-                }\r
-\r
-                // if value is the same keep orignal order\r
-                var orgOrderCol = cache.normalized[0].length - 1;\r
-                dynamicExp += "return a[" + orgOrderCol + "]-b[" + orgOrderCol + "];";\r
-\r
-                for (var i = 0; i < l; i++) {\r
-                    dynamicExp += "}; ";\r
-                }\r
-\r
-                dynamicExp += "return 0; ";\r
-                dynamicExp += "}; ";\r
-\r
-                if (table.config.debug) {\r
-                    benchmark("Evaling expression:" + dynamicExp, new Date());\r
-                }\r
-\r
-                eval(dynamicExp);\r
-\r
-                cache.normalized.sort(sortWrapper);\r
-\r
-                if (table.config.debug) {\r
-                    benchmark("Sorting on " + sortList.toString() + " and dir " + order + " time:", sortTime);\r
-                }\r
-\r
-                return cache;\r
-            };\r
-\r
-            function makeSortFunction(type, direction, index) {\r
-                var a = "a[" + index + "]",\r
-                    b = "b[" + index + "]";\r
-                if (type == 'text' && direction == 'asc') {\r
-                    return "(" + a + " == " + b + " ? 0 : (" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : (" + a + " < " + b + ") ? -1 : 1 )));";\r
-                } else if (type == 'text' && direction == 'desc') {\r
-                    return "(" + a + " == " + b + " ? 0 : (" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : (" + b + " < " + a + ") ? -1 : 1 )));";\r
-                } else if (type == 'numeric' && direction == 'asc') {\r
-                    return "(" + a + " === null && " + b + " === null) ? 0 :(" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : " + a + " - " + b + "));";\r
-                } else if (type == 'numeric' && direction == 'desc') {\r
-                    return "(" + a + " === null && " + b + " === null) ? 0 :(" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : " + b + " - " + a + "));";\r
-                }\r
-            };\r
-\r
-            function makeSortText(i) {\r
-                return "((a[" + i + "] < b[" + i + "]) ? -1 : ((a[" + i + "] > b[" + i + "]) ? 1 : 0));";\r
-            };\r
-\r
-            function makeSortTextDesc(i) {\r
-                return "((b[" + i + "] < a[" + i + "]) ? -1 : ((b[" + i + "] > a[" + i + "]) ? 1 : 0));";\r
-            };\r
-\r
-            function makeSortNumeric(i) {\r
-                return "a[" + i + "]-b[" + i + "];";\r
-            };\r
-\r
-            function makeSortNumericDesc(i) {\r
-                return "b[" + i + "]-a[" + i + "];";\r
-            };\r
-\r
-            function sortText(a, b) {\r
-                if (table.config.sortLocaleCompare) return a.localeCompare(b);\r
-                return ((a < b) ? -1 : ((a > b) ? 1 : 0));\r
-            };\r
-\r
-            function sortTextDesc(a, b) {\r
-                if (table.config.sortLocaleCompare) return b.localeCompare(a);\r
-                return ((b < a) ? -1 : ((b > a) ? 1 : 0));\r
-            };\r
-\r
-            function sortNumeric(a, b) {\r
-                return a - b;\r
-            };\r
-\r
-            function sortNumericDesc(a, b) {\r
-                return b - a;\r
-            };\r
-\r
-            function getCachedSortType(parsers, i) {\r
-                return parsers[i].type;\r
-            }; /* public methods */\r
-            this.construct = function (settings) {\r
-                return this.each(function () {\r
-                    // if no thead or tbody quit.\r
-                    if (!this.tHead || !this.tBodies) return;\r
-                    // declare\r
-                    var $this, $document, $headers, cache, config, shiftDown = 0,\r
-                        sortOrder;\r
-                    // new blank config object\r
-                    this.config = {};\r
-                    // merge and extend.\r
-                    config = $.extend(this.config, $.tablesorter.defaults, settings);\r
-                    // store common expression for speed\r
-                    $this = $(this);\r
-                    // save the settings where they read\r
-                    $.data(this, "tablesorter", config);\r
-                    // build headers\r
-                    $headers = buildHeaders(this);\r
-                    // try to auto detect column type, and store in tables config\r
-                    this.config.parsers = buildParserCache(this, $headers);\r
-                    // build the cache for the tbody cells\r
-                    cache = buildCache(this);\r
-                    // get the css class names, could be done else where.\r
-                    var sortCSS = [config.cssDesc, config.cssAsc];\r
-                    // fixate columns if the users supplies the fixedWidth option\r
-                    fixColumnWidth(this);\r
-                    // apply event handling to headers\r
-                    // this is to big, perhaps break it out?\r
-                    $headers.click(\r
-\r
-                    function (e) {\r
-                        var totalRows = ($this[0].tBodies[0] && $this[0].tBodies[0].rows.length) || 0;\r
-                        if (!this.sortDisabled && totalRows > 0) {\r
-                            // Only call sortStart if sorting is\r
-                            // enabled.\r
-                            $this.trigger("sortStart");\r
-                            // store exp, for speed\r
-                            var $cell = $(this);\r
-                            // get current column index\r
-                            var i = this.column;\r
-                            // get current column sort order\r
-                            this.order = this.count++ % 2;\r
-                                                       // always sort on the locked order.\r
-                                                       if(this.lockedOrder) this.order = this.lockedOrder;\r
-                                                       \r
-                                                       // user only whants to sort on one\r
-                            // column\r
-                            if (!e[config.sortMultiSortKey]) {\r
-                                // flush the sort list\r
-                                config.sortList = [];\r
-                                if (config.sortForce != null) {\r
-                                    var a = config.sortForce;\r
-                                    for (var j = 0; j < a.length; j++) {\r
-                                        if (a[j][0] != i) {\r
-                                            config.sortList.push(a[j]);\r
-                                        }\r
-                                    }\r
-                                }\r
-                                // add column to sort list\r
-                                config.sortList.push([i, this.order]);\r
-                                // multi column sorting\r
-                            } else {\r
-                                // the user has clicked on an all\r
-                                // ready sortet column.\r
-                                if (isValueInArray(i, config.sortList)) {\r
-                                    // revers the sorting direction\r
-                                    // for all tables.\r
-                                    for (var j = 0; j < config.sortList.length; j++) {\r
-                                        var s = config.sortList[j],\r
-                                            o = config.headerList[s[0]];\r
-                                        if (s[0] == i) {\r
-                                            o.count = s[1];\r
-                                            o.count++;\r
-                                            s[1] = o.count % 2;\r
-                                        }\r
-                                    }\r
-                                } else {\r
-                                    // add column to sort list array\r
-                                    config.sortList.push([i, this.order]);\r
-                                }\r
-                            };\r
-                            setTimeout(function () {\r
-                                // set css for headers\r
-                                setHeadersCss($this[0], $headers, config.sortList, sortCSS);\r
-                                appendToTable(\r
-                                       $this[0], multisort(\r
-                                       $this[0], config.sortList, cache)\r
-                                                               );\r
-                            }, 1);\r
-                            // stop normal event by returning false\r
-                            return false;\r
-                        }\r
-                        // cancel selection\r
-                    }).mousedown(function () {\r
-                        if (config.cancelSelection) {\r
-                            this.onselectstart = function () {\r
-                                return false\r
-                            };\r
-                            return false;\r
-                        }\r
-                    });\r
-                    // apply easy methods that trigger binded events\r
-                    $this.bind("update", function () {\r
-                        var me = this;\r
-                        setTimeout(function () {\r
-                            // rebuild parsers.\r
-                            me.config.parsers = buildParserCache(\r
-                            me, $headers);\r
-                            // rebuild the cache map\r
-                            cache = buildCache(me);\r
-                        }, 1);\r
-                    }).bind("updateCell", function (e, cell) {\r
-                        var config = this.config;\r
-                        // get position from the dom.\r
-                        var pos = [(cell.parentNode.rowIndex - 1), cell.cellIndex];\r
-                        // update cache\r
-                        cache.normalized[pos[0]][pos[1]] = config.parsers[pos[1]].format(\r
-                        getElementText(config, cell), cell);\r
-                    }).bind("sorton", function (e, list) {\r
-                        $(this).trigger("sortStart");\r
-                        config.sortList = list;\r
-                        // update and store the sortlist\r
-                        var sortList = config.sortList;\r
-                        // update header count index\r
-                        updateHeaderSortCount(this, sortList);\r
-                        // set css for headers\r
-                        setHeadersCss(this, $headers, sortList, sortCSS);\r
-                        // sort the table and append it to the dom\r
-                        appendToTable(this, multisort(this, sortList, cache));\r
-                    }).bind("appendCache", function () {\r
-                        appendToTable(this, cache);\r
-                    }).bind("applyWidgetId", function (e, id) {\r
-                        getWidgetById(id).format(this);\r
-                    }).bind("applyWidgets", function () {\r
-                        // apply widgets\r
-                        applyWidget(this);\r
-                    });\r
-                    if ($.metadata && ($(this).metadata() && $(this).metadata().sortlist)) {\r
-                        config.sortList = $(this).metadata().sortlist;\r
-                    }\r
-                    // if user has supplied a sort list to constructor.\r
-                    if (config.sortList.length > 0) {\r
-                        $this.trigger("sorton", [config.sortList]);\r
-                    }\r
-                    // apply widgets\r
-                    applyWidget(this);\r
-                });\r
-            };\r
-            this.addParser = function (parser) {\r
-                var l = parsers.length,\r
-                    a = true;\r
-                for (var i = 0; i < l; i++) {\r
-                    if (parsers[i].id.toLowerCase() == parser.id.toLowerCase()) {\r
-                        a = false;\r
-                    }\r
-                }\r
-                if (a) {\r
-                    parsers.push(parser);\r
-                };\r
-            };\r
-            this.addWidget = function (widget) {\r
-                widgets.push(widget);\r
-            };\r
-            this.formatFloat = function (s) {\r
-                var i = parseFloat(s);\r
-                return (isNaN(i)) ? 0 : i;\r
-            };\r
-            this.formatInt = function (s) {\r
-                var i = parseInt(s);\r
-                return (isNaN(i)) ? 0 : i;\r
-            };\r
-            this.isDigit = function (s, config) {\r
-                // replace all an wanted chars and match.\r
-                return /^[-+]?\d*$/.test($.trim(s.replace(/[,.']/g, '')));\r
-            };\r
-            this.clearTableBody = function (table) {\r
-                if ($.browser.msie) {\r
-                    function empty() {\r
-                        while (this.firstChild)\r
-                        this.removeChild(this.firstChild);\r
-                    }\r
-                    empty.apply(table.tBodies[0]);\r
-                } else {\r
-                    table.tBodies[0].innerHTML = "";\r
-                }\r
-            };\r
-        }\r
-    });\r
-\r
-    // extend plugin scope\r
-    $.fn.extend({\r
-        tablesorter: $.tablesorter.construct\r
-    });\r
-\r
-    // make shortcut\r
-    var ts = $.tablesorter;\r
-\r
-    // add default parsers\r
-    ts.addParser({\r
-        id: "text",\r
-        is: function (s) {\r
-            return true;\r
-        }, format: function (s) {\r
-            return $.trim(s.toLocaleLowerCase());\r
-        }, type: "text"\r
-    });\r
-\r
-    ts.addParser({\r
-        id: "digit",\r
-        is: function (s, table) {\r
-            var c = table.config;\r
-            return $.tablesorter.isDigit(s, c);\r
-        }, format: function (s) {\r
-            return $.tablesorter.formatFloat(s);\r
-        }, type: "numeric"\r
-    });\r
-\r
-    ts.addParser({\r
-        id: "currency",\r
-        is: function (s) {\r
-            return /^[£$€?.]/.test(s);\r
-        }, format: function (s) {\r
-            return $.tablesorter.formatFloat(s.replace(new RegExp(/[£$€]/g), ""));\r
-        }, type: "numeric"\r
-    });\r
-\r
-    ts.addParser({\r
-        id: "ipAddress",\r
-        is: function (s) {\r
-            return /^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/.test(s);\r
-        }, format: function (s) {\r
-            var a = s.split("."),\r
-                r = "",\r
-                l = a.length;\r
-            for (var i = 0; i < l; i++) {\r
-                var item = a[i];\r
-                if (item.length == 2) {\r
-                    r += "0" + item;\r
-                } else {\r
-                    r += item;\r
-                }\r
-            }\r
-            return $.tablesorter.formatFloat(r);\r
-        }, type: "numeric"\r
-    });\r
-\r
-    ts.addParser({\r
-        id: "url",\r
-        is: function (s) {\r
-            return /^(https?|ftp|file):\/\/$/.test(s);\r
-        }, format: function (s) {\r
-            return jQuery.trim(s.replace(new RegExp(/(https?|ftp|file):\/\//), ''));\r
-        }, type: "text"\r
-    });\r
-\r
-    ts.addParser({\r
-        id: "isoDate",\r
-        is: function (s) {\r
-            return /^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(s);\r
-        }, format: function (s) {\r
-            return $.tablesorter.formatFloat((s != "") ? new Date(s.replace(\r
-            new RegExp(/-/g), "/")).getTime() : "0");\r
-        }, type: "numeric"\r
-    });\r
-\r
-    ts.addParser({\r
-        id: "percent",\r
-        is: function (s) {\r
-            return /\%$/.test($.trim(s));\r
-        }, format: function (s) {\r
-            return $.tablesorter.formatFloat(s.replace(new RegExp(/%/g), ""));\r
-        }, type: "numeric"\r
-    });\r
-\r
-    ts.addParser({\r
-        id: "usLongDate",\r
-        is: function (s) {\r
-            return s.match(new RegExp(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/));\r
-        }, format: function (s) {\r
-            return $.tablesorter.formatFloat(new Date(s).getTime());\r
-        }, type: "numeric"\r
-    });\r
-\r
-    ts.addParser({\r
-        id: "shortDate",\r
-        is: function (s) {\r
-            return /\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/.test(s);\r
-        }, format: function (s, table) {\r
-            var c = table.config;\r
-            s = s.replace(/\-/g, "/");\r
-            if (c.dateFormat == "us") {\r
-                // reformat the string in ISO format\r
-                s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/, "$3/$1/$2");\r
-            } else if (c.dateFormat == "uk") {\r
-                // reformat the string in ISO format\r
-                s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/, "$3/$2/$1");\r
-            } else if (c.dateFormat == "dd/mm/yy" || c.dateFormat == "dd-mm-yy") {\r
-                s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/, "$1/$2/$3");\r
-            }\r
-            return $.tablesorter.formatFloat(new Date(s).getTime());\r
-        }, type: "numeric"\r
-    });\r
-    ts.addParser({\r
-        id: "time",\r
-        is: function (s) {\r
-            return /^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/.test(s);\r
-        }, format: function (s) {\r
-            return $.tablesorter.formatFloat(new Date("2000/01/01 " + s).getTime());\r
-        }, type: "numeric"\r
-    });\r
-    ts.addParser({\r
-        id: "metadata",\r
-        is: function (s) {\r
-            return false;\r
-        }, format: function (s, table, cell) {\r
-            var c = table.config,\r
-                p = (!c.parserMetadataName) ? 'sortValue' : c.parserMetadataName;\r
-            return $(cell).metadata()[p];\r
-        }, type: "numeric"\r
-    });\r
-    // add default widgets\r
-    ts.addWidget({\r
-        id: "zebra",\r
-        format: function (table) {\r
-            if (table.config.debug) {\r
-                var time = new Date();\r
-            }\r
-            var $tr, row = -1,\r
-                odd;\r
-            // loop through the visible rows\r
-            $("tr:visible", table.tBodies[0]).each(function (i) {\r
-                $tr = $(this);\r
-                // style children rows the same way the parent\r
-                // row was styled\r
-                if (!$tr.hasClass(table.config.cssChildRow)) row++;\r
-                odd = (row % 2 == 0);\r
-                $tr.removeClass(\r
-                table.config.widgetZebra.css[odd ? 0 : 1]).addClass(\r
-                table.config.widgetZebra.css[odd ? 1 : 0])\r
-            });\r
-            if (table.config.debug) {\r
-                $.tablesorter.benchmark("Applying Zebra widget", time);\r
-            }\r
-        }\r
-    });\r
-})(jQuery);
\ No newline at end of file
diff --git a/inc/jquery/tablesorter/themes/blue/asc.gif b/inc/jquery/tablesorter/themes/blue/asc.gif
deleted file mode 100644 (file)
index 7415786..0000000
Binary files a/inc/jquery/tablesorter/themes/blue/asc.gif and /dev/null differ
diff --git a/inc/jquery/tablesorter/themes/blue/bg.gif b/inc/jquery/tablesorter/themes/blue/bg.gif
deleted file mode 100644 (file)
index fac668f..0000000
Binary files a/inc/jquery/tablesorter/themes/blue/bg.gif and /dev/null differ
diff --git a/inc/jquery/tablesorter/themes/blue/blue.zip b/inc/jquery/tablesorter/themes/blue/blue.zip
deleted file mode 100644 (file)
index 9945a92..0000000
Binary files a/inc/jquery/tablesorter/themes/blue/blue.zip and /dev/null differ
diff --git a/inc/jquery/tablesorter/themes/blue/desc.gif b/inc/jquery/tablesorter/themes/blue/desc.gif
deleted file mode 100644 (file)
index 3b30b3c..0000000
Binary files a/inc/jquery/tablesorter/themes/blue/desc.gif and /dev/null differ
diff --git a/inc/jquery/tablesorter/themes/blue/style.css b/inc/jquery/tablesorter/themes/blue/style.css
deleted file mode 100644 (file)
index eb41f70..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/* tables */
-table.tablesorter {
-       font-family:arial;
-       background-color: #CDCDCD;
-       margin:10px 0pt 15px;
-       font-size: 8pt;
-       width: 100%;
-       text-align: left;
-}
-table.tablesorter thead tr th, table.tablesorter tfoot tr th {
-       background-color: #e6EEEE;
-       border: 1px solid #FFF;
-       font-size: 8pt;
-       padding: 4px;
-}
-table.tablesorter thead tr .header {
-       background-image: url(bg.gif);
-       background-repeat: no-repeat;
-       background-position: center right;
-       cursor: pointer;
-}
-table.tablesorter tbody td {
-       color: #3D3D3D;
-       padding: 4px;
-       background-color: #FFF;
-       vertical-align: top;
-}
-table.tablesorter tbody tr.odd td {
-       background-color:#F0F0F6;
-}
-table.tablesorter thead tr .headerSortUp {
-       background-image: url(asc.gif);
-}
-table.tablesorter thead tr .headerSortDown {
-       background-image: url(desc.gif);
-}
-table.tablesorter thead tr .headerSortDown, table.tablesorter thead tr .headerSortUp {
-background-color: #8dbdd8;
-}
diff --git a/inc/jquery/tablesorter/themes/green/asc.png b/inc/jquery/tablesorter/themes/green/asc.png
deleted file mode 100644 (file)
index 66e39ca..0000000
Binary files a/inc/jquery/tablesorter/themes/green/asc.png and /dev/null differ
diff --git a/inc/jquery/tablesorter/themes/green/bg.png b/inc/jquery/tablesorter/themes/green/bg.png
deleted file mode 100644 (file)
index ca83716..0000000
Binary files a/inc/jquery/tablesorter/themes/green/bg.png and /dev/null differ
diff --git a/inc/jquery/tablesorter/themes/green/desc.png b/inc/jquery/tablesorter/themes/green/desc.png
deleted file mode 100644 (file)
index 431f63a..0000000
Binary files a/inc/jquery/tablesorter/themes/green/desc.png and /dev/null differ
diff --git a/inc/jquery/tablesorter/themes/green/green.zip b/inc/jquery/tablesorter/themes/green/green.zip
deleted file mode 100644 (file)
index 6a14d24..0000000
Binary files a/inc/jquery/tablesorter/themes/green/green.zip and /dev/null differ
diff --git a/inc/jquery/tablesorter/themes/green/style.css b/inc/jquery/tablesorter/themes/green/style.css
deleted file mode 100644 (file)
index 4a54589..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-table.tablesorter {
-       font-size: 12px;
-       background-color: #4D4D4D;
-       width: 1024px;
-       border: 1px solid #000;
-}
-table.tablesorter th {
-       text-align: left;
-       padding: 5px;
-       background-color: #6E6E6E;
-}
-table.tablesorter td {
-       color: #FFF;
-       padding: 5px;
-}
-table.tablesorter .even {
-       background-color: #3D3D3D;
-}
-table.tablesorter .odd {
-       background-color: #6E6E6E;
-}
-table.tablesorter .header {
-       background-image: url(bg.png);
-       background-repeat: no-repeat;
-       border-left: 1px solid #FFF;
-       border-right: 1px solid #000;
-       border-top: 1px solid #FFF;
-       padding-left: 30px;
-       padding-top: 8px;
-       height: auto;
-}
-table.tablesorter .headerSortUp {
-       background-image: url(asc.png);
-       background-repeat: no-repeat;
-}
-table.tablesorter .headerSortDown {
-       background-image: url(desc.png);
-       background-repeat: no-repeat;
-}
\ No newline at end of file
index b9d25fd3c7566b24897aa6606bfb236c1588e9d6..70ce6d80f9fabe7d7c27c02b18e2dbd5ab8105f6 100644 (file)
@@ -1,42 +1,43 @@
 <center>
+<script type="text/javascript" src="{jquery_url}"></script>
+<script type="text/javascript" src="{jquery_tablesorter_url}"></script>
+<script type="text/javascript">                                         
+$(document).ready(function() 
+    { 
+         $("#callings").tablesorter( {
+                                                                 cssHeader: "headerSort",
+                                                                 cssAsc: "headerSortUp",
+                                                                 cssDesc: "headerSortDown"
+                                                                 } );
+    } 
+); 
+</script>   
+
        <table border="0" width="80%" cellspacing="2" cellpadding="2">
                <tr>
                        <td align="center" bgcolor="#c9c9c9"><font face="{font}"><b>Ward Callings</b></font></td>
                </tr>
        </table>
-       <br><h2>By Name</h2>
 
-       <table border="0" width=80% cellspacing="2" cellpadding="2">
-               <tr>
-                       <td colspan="1" align="center" bgcolor="#c9c9c9"><font face="{font}"><b>Name</b></font></td>
-                       <td colspan="1" align="center" bgcolor="#c9c9c9"><font face="{font}"><b>Calling</b></font></td>
-                       <td colspan="1" align="center" bgcolor="#c9c9c9"><font face="{font}"><b>Date Sustained</b></font></td>
+       <table id="callings" class="tablesorter" border="0" width=80% cellspacing="2" cellpadding="2">
+               <thead>
+               <tr
+                       <th colspan="1" align="center" bgcolor="#c9c9c9"><font face="{font}"><b>Name</b></font></th>
+                       <th colspan="1" align="center" bgcolor="#c9c9c9"><font face="{font}"><b>Calling</b></font></th>
+                       <th colspan="1" align="center" bgcolor="#c9c9c9"><font face="{font}"><b>Organization</b></font></th>
+                       <th colspan="1" align="center" bgcolor="#c9c9c9"><font face="{font}"><b>Date Sustained</b></font></th>
                </tr>
+               </thead>
+               <tbody>
 <!-- BEGIN calling_list -->
                <tr bgcolor="{tr_color}">
                        <td align="left" width=25%><font face="{font}">{name}</font></td>
                        <td align="left" width=25%><font face="{font}">{position}</font></td>
-                       <td align="left" width=25%><font face="{font}">{sustained}</font></td>
-               </tr>
-<!-- END calling_list -->
-       </table>
-
-       <br><h2>By Organization</h2>
-       <table border="0" width=80% cellspacing="2" cellpadding="2">
-               <tr>
-                       <td colspan="1" align="center" bgcolor="#c9c9c9"><font face="{font}"><b>Organization</b></font></td>
-                       <td colspan="1" align="center" bgcolor="#c9c9c9"><font face="{font}"><b>Name</b></font></td>
-                       <td colspan="1" align="center" bgcolor="#c9c9c9"><font face="{font}"><b>Calling</b></font></td>
-                       <td colspan="1" align="center" bgcolor="#c9c9c9"><font face="{font}"><b>Date Sustained</b></font></td>
-               </tr>
-<!-- BEGIN org_list -->
-               <tr bgcolor="{tr_color}">
                        <td align="left" width=25%><font face="{font}">{organization}</font></td>
-                       <td align="left" width=25%><font face="{font}">{name}</font></td>
-                       <td align="left" width=25%><font face="{font}">{position}</font></td>
                        <td align="left" width=25%><font face="{font}">{sustained}</font></td>
                </tr>
-<!-- END org_list -->
+<!-- END calling_list -->
+               </tbody>
 
        </table>
 </center>