WP-Table Reloaded - Version 1.4

Version Description

Download this release

Release Info

Developer TobiasBg
Plugin Icon wp plugin WP-Table Reloaded
Version 1.4
Comparing to
See all releases

Code changes from version 1.3 to 1.4

Files changed (44) hide show
  1. admin/admin-editor-buttons-script.dev.js +36 -0
  2. admin/admin-editor-buttons-script.js +1 -37
  3. admin/admin-script.dev.js +249 -0
  4. admin/admin-script.js +1 -161
  5. admin/admin-style.css +1 -59
  6. admin/admin-style.dev.css +177 -0
  7. admin/index.php +3 -0
  8. img/index.php +3 -0
  9. index.php +3 -0
  10. js/index.php +3 -0
  11. js/jquery.tablesorter.extended.js +988 -0
  12. languages/index.php +3 -0
  13. languages/wp-table-reloaded-cs_CZ.mo +0 -0
  14. languages/wp-table-reloaded-cs_CZ.po +654 -304
  15. languages/wp-table-reloaded-de_DE.mo +0 -0
  16. languages/wp-table-reloaded-de_DE.po +957 -324
  17. languages/wp-table-reloaded-es_ES.mo +0 -0
  18. languages/wp-table-reloaded-es_ES.po +1600 -726
  19. languages/wp-table-reloaded-it_IT.mo +0 -0
  20. languages/wp-table-reloaded-it_IT.po +1306 -0
  21. languages/wp-table-reloaded-ja.mo +0 -0
  22. languages/wp-table-reloaded-ja.po +1313 -0
  23. languages/wp-table-reloaded-pt_BR.mo +0 -0
  24. languages/wp-table-reloaded-pt_BR.po +950 -317
  25. languages/wp-table-reloaded-ru_RU.mo +0 -0
  26. languages/wp-table-reloaded-ru_RU.po +753 -312
  27. languages/wp-table-reloaded-sv_SE.mo +0 -0
  28. languages/wp-table-reloaded-sv_SE.po +638 -290
  29. languages/wp-table-reloaded.pot +612 -265
  30. php/arraysort.class.php +2 -6
  31. php/index.php +3 -0
  32. php/parsecsv.class.php +5 -3
  33. php/wp-table-reloaded-export.class.php +3 -3
  34. php/wp-table-reloaded-import.class.php +83 -23
  35. readme.txt +27 -14
  36. screenshot-1.png +0 -0
  37. screenshot-2.png +0 -0
  38. screenshot-3.png +0 -0
  39. screenshot-4.png +0 -0
  40. screenshot-5.png +0 -0
  41. screenshot-6.png +0 -0
  42. wp-table-reloaded-admin.php +973 -304
  43. wp-table-reloaded-frontend.php +148 -16
  44. wp-table-reloaded.php +28 -32
admin/admin-editor-buttons-script.dev.js ADDED
@@ -0,0 +1,36 @@
1
+ jQuery(document).ready(function($){
2
+
3
+ var editor_toolbar = $("#ed_toolbar");
4
+
5
+ if ( editor_toolbar ) {
6
+ var theButton = document.createElement('input');
7
+ theButton.type = 'button';
8
+ theButton.value = WP_Table_Reloaded_Admin.str_EditorButtonCaption;
9
+ theButton.className = 'ed_button';
10
+ theButton.title = WP_Table_Reloaded_Admin.str_EditorButtonCaption;
11
+ theButton.id = 'ed_button_wp_table_reloaded';
12
+ editor_toolbar.append( theButton );
13
+ $("#ed_button_wp_table_reloaded").click( wp_table_reloaded_button_click );
14
+ }
15
+
16
+ function wp_table_reloaded_button_click() {
17
+
18
+ var title = 'WP-Table Reloaded';
19
+ var url = WP_Table_Reloaded_Admin.str_EditorButtonAjaxURL;
20
+
21
+ tb_show( title, url, false);
22
+
23
+ $("#TB_ajaxContent").width("auto").height("94.5%")
24
+ .click(function(event) {
25
+ var $target = $(event.target);
26
+ if ( $target.is('a.send_table_to_editor') ) {
27
+ var table_id = $target.attr('title');
28
+ send_to_editor( '[table id=' + table_id + ' /]' );
29
+ }
30
+ return false;
31
+ });
32
+
33
+ return false;
34
+ }
35
+
36
+ });
admin/admin-editor-buttons-script.js CHANGED
@@ -1,37 +1 @@
1
- jQuery(document).ready(function($){
2
-
3
- var editor_toolbar = $("#ed_toolbar");
4
-
5
- if ( editor_toolbar ) {
6
- var theButton = document.createElement('input');
7
- theButton.type = 'button';
8
- theButton.value = WP_Table_Reloaded_Admin.str_EditorButtonCaption;
9
- theButton.className = 'ed_button';
10
- theButton.title = WP_Table_Reloaded_Admin.str_EditorButtonCaption;
11
- theButton.id = 'ed_button_wp_table_reloaded';
12
- editor_toolbar.append( theButton );
13
- $("#ed_button_wp_table_reloaded").click( wp_table_reloaded_button_click );
14
- }
15
-
16
- function wp_table_reloaded_button_click() {
17
-
18
- var title = 'WP-Table Reloaded';
19
- var url = WP_Table_Reloaded_Admin.str_EditorButtonAjaxURL.replace(/&/g, "&");
20
- url = url.replace(/&/g, "&");
21
-
22
- tb_show( title, url, false);
23
-
24
- $("#TB_ajaxContent").width("100%").height("100%")
25
- .click(function(event) {
26
- var $target = $(event.target);
27
- if ( $target.is('a.send_table_to_editor') ) {
28
- var table_id = $target.attr('title');
29
- send_to_editor( '[table id=' + table_id + ' /]' );
30
- }
31
- return false;
32
- });
33
-
34
- return false;
35
- }
36
-
37
- });
1
+ jQuery(document).ready(function(c){var d=c("#ed_toolbar");if(d){var b=document.createElement("input");b.type="button";b.value=WP_Table_Reloaded_Admin.str_EditorButtonCaption;b.className="ed_button";b.title=WP_Table_Reloaded_Admin.str_EditorButtonCaption;b.id="ed_button_wp_table_reloaded";d.append(b);c("#ed_button_wp_table_reloaded").click(a)}function a(){var f="WP-Table Reloaded";var e=WP_Table_Reloaded_Admin.str_EditorButtonAjaxURL;tb_show(f,e,false);c("#TB_ajaxContent").width("auto").height("94.5%").click(function(h){var g=c(h.target);if(g.is("a.send_table_to_editor")){var i=g.attr("title");send_to_editor("[table id="+i+" /]")}return false});return false}});
admin/admin-script.dev.js ADDED
@@ -0,0 +1,249 @@
1
+ jQuery(document).ready( function( $ ) {
2
+
3
+ // WP_Table_Reloaded_Admin object will contain all localized strings
4
+
5
+ // jQuery's original toggleClass needs jQuery 1.3, which is only available since 1.3
6
+ // which is only available since WP 2.8, that's why we copy the function here to maintain
7
+ // backward compatibility
8
+ jQuery.each({
9
+ TBtoggleClass: function( classNames, state ) {
10
+ if( typeof state !== "boolean" )
11
+ state = !jQuery.className.has( this, classNames );
12
+ jQuery.className[ state ? "add" : "remove" ]( this, classNames );
13
+ }
14
+ }, function(name, fn){
15
+ jQuery.fn[ name ] = function() {
16
+ return this.each( fn, arguments );
17
+ };
18
+ });
19
+
20
+ // function to toggle textarea background color according to state of checkboxes
21
+ // uses TBtoggleClass instead of toggleClass, see above
22
+ var cb_id, cb_class;
23
+ $( '#table_contents tbody :checkbox' ).change( function() {
24
+ $( '#table_contents tbody :checkbox' ).each( function() {
25
+ cb_id = $(this).attr('id');
26
+ cb_class = ( -1 != cb_id.search(/row/) ) ? 'row-hidden' : 'column-hidden';
27
+ $( '#table_contents .' + cb_id ).TBtoggleClass( cb_class, $(this).attr('checked') );
28
+ } );
29
+ })
30
+ .change();
31
+
32
+ // functions to make focussed textareas bigger
33
+ // commented code is for handling all textareas in same row or same column
34
+ // var ta_idx, tas;
35
+ $( '#table_contents textarea' ).focus( function() {
36
+ $( '#table_contents .focus' ).removeClass('focus');
37
+ $(this).parents('tr').find('textarea').addClass('focus');
38
+ //tas = $(this).parents('tr').find('textarea');
39
+ //ta_idx = $( tas ).index( this ) + 2; // 2 is from: 1: <th> infront, 1: 1-based-index
40
+ //$( '#table_contents tr :nth-child(' + ta_idx + ') textarea' ).add( tas ).addClass('focus');
41
+ } );
42
+ //.blur( function() {
43
+ // $(this).parents('tr').find('textarea').removeClass('focus');
44
+ //tas = $(this).parents('tr').find('textarea');
45
+ //ta_idx = $( tas ).index( this ) + 2; // 2 is from: 1: <th> infront, 1: 1-based-index
46
+ //$( '#table_contents tr :nth-child(' + ta_idx + ') textarea' ).add( tas ).removeClass('focus');
47
+ //} );
48
+
49
+ // old code that makes textareas grow depending on content
50
+ /*
51
+ $("#table_contents textarea").keypress(function () {
52
+ var currentTextsize = $(this).val().split('\n').length;
53
+
54
+ if ( 0 < currentTextsize ) {
55
+ $(this).attr('rows', currentTextsize);
56
+ }
57
+ }).keypress();
58
+ */
59
+
60
+ // show export delimiter selectbox only if export format is csv
61
+ $( '#export_format' ).change( function () {
62
+ if ( 'csv' == $(this).val() )
63
+ $('.tr-export-delimiter').css('display','table-row');
64
+ else
65
+ $('.tr-export-delimiter').css('display','none');
66
+ })
67
+ .change();
68
+
69
+ // confirm change of table ID
70
+ var table_id = $( '.wp-table-reloaded-table-information #table_id' ).val();
71
+ $( '.wp-table-reloaded-table-information #table_id' ).change( function () {
72
+ if ( table_id != $(this).val() ) {
73
+ if ( confirm( WP_Table_Reloaded_Admin.str_ChangeTableID ) )
74
+ table_id = $(this).val();
75
+ else
76
+ $(this).val( table_id );
77
+ }
78
+ } );
79
+
80
+ // show select box for table to replace only if needed
81
+ $( '.tr-import-addreplace input' ).click( function () {
82
+ if( 'replace' == $( '.tr-import-addreplace input:checked' ).val() )
83
+ $( '.tr-import-addreplace-table' ).css('display','table-row');
84
+ else
85
+ $( '.tr-import-addreplace-table' ).css('display','none');
86
+ } );
87
+ $( '.tr-import-addreplace input:checked' ).click();
88
+
89
+ // show only checked import fields depending on radio button
90
+ $( '.tr-import-from input' ).click( function () {
91
+ $('.tr-import-file-upload').css('display','none');
92
+ $('.tr-import-url').css('display','none');
93
+ $('.tr-import-form-field').css('display','none');
94
+ $('.tr-import-server').css('display','none');
95
+
96
+ $( '.tr-import-' + $( '.tr-import-from input:checked' ).val() ).css('display','table-row');
97
+ } );
98
+ $('.tr-import-from input:checked').click();
99
+
100
+ // enable/disable custom css textarea according to state of checkbox
101
+ $( '#options_use_custom_css' ).change( function () {
102
+ if( $(this).attr('checked') )
103
+ $( '#options_custom_css' ).removeAttr("disabled");
104
+ else
105
+ $( '#options_custom_css' ).attr("disabled", true);
106
+ } );
107
+
108
+ // enable/disable Extended Tablesorter checkbox according to state of checkbox
109
+ $( '#options_enable_tablesorter' ).change( function () {
110
+ if( $(this).attr('checked') )
111
+ $( '#options_use_tablesorter_extended' ).removeAttr("disabled");
112
+ else
113
+ $( '#options_use_tablesorter_extended' ).attr("disabled", true);
114
+ } );
115
+
116
+ // enable/disable "use tableheadline" according to state of checkbox
117
+ $( '#table_options_first_row_th' ).change( function () {
118
+ if( $(this).attr('checked') && $( '#tablesorter_enabled' ).val() ) {
119
+ $( '#table_options_use_tablesorter' ).removeAttr("disabled");
120
+ } else {
121
+ $( '#table_options_use_tablesorter' ).attr("disabled", true);
122
+ }
123
+ } );
124
+
125
+ // confirm uninstall setting
126
+ $( '#options_uninstall_upon_deactivation').click( function () {
127
+ if( $(this).attr('checked') )
128
+ return confirm( WP_Table_Reloaded_Admin.str_UninstallCheckboxActivation );
129
+ } );
130
+
131
+
132
+ // insert link functions
133
+ var insert_html = '';
134
+ function add_html() {
135
+ var current_content = $(this).val();
136
+ $(this).val( current_content + insert_html );
137
+ $( '#table_contents textarea' ).unbind( 'click', add_html );
138
+ }
139
+
140
+ $( '#a-insert-link' ).click( function () {
141
+ var link_url = prompt( WP_Table_Reloaded_Admin.str_DataManipulationLinkInsertURL + ':', 'http://' );
142
+ if ( link_url ) {
143
+ var link_text = prompt( WP_Table_Reloaded_Admin.str_DataManipulationLinkInsertText + ':', WP_Table_Reloaded_Admin.str_DataManipulationLinkInsertText );
144
+ if ( link_text ) {
145
+ insert_html = '<a href="' + link_url + '">' + link_text + '</a>';
146
+ if ( confirm( WP_Table_Reloaded_Admin.str_DataManipulationLinkInsertExplain + '\n\n' + insert_html ) ) {
147
+ $("#table_contents textarea").bind('click', add_html);
148
+ }
149
+ }
150
+ }
151
+ return false;
152
+ } );
153
+
154
+ // insert image functions
155
+ function call_media_library_thickbox() {
156
+ edCanvas = this;
157
+ $( '#table_contents textarea' ).unbind( 'click', call_media_library_thickbox );
158
+ var link = $( '#a-insert-image' );
159
+ tb_show( link.attr('title'), link.attr('href'), link.attr('rel') );
160
+ $(this).blur();
161
+ }
162
+
163
+ function add_image() {
164
+ $(this).unbind( 'click' ); // this unbind is for WP 2.8, where our script is added before thickbox.js
165
+ $(this).bind('click', add_image);
166
+ if ( true == confirm( WP_Table_Reloaded_Admin.str_DataManipulationImageInsertThickbox ) )
167
+ $("#table_contents textarea").bind( 'click', call_media_library_thickbox );
168
+ }
169
+ $( '#a-insert-image' ).unbind( 'click' ).bind('click', add_image); // this unbind is for WP < 2.8, where our script is added after thickbox.js
170
+
171
+ // not all characters allowed for name of Custom Data Field
172
+ $( '#insert_custom_field_name' ).keyup( function () {
173
+ $(this).val( $(this).val().toLowerCase().replace(/[^a-z0-9_-]/g, '') );
174
+ } );
175
+
176
+ // remove/add title on focus/blur
177
+ $( '.focus-blur-change' ).focus( function () {
178
+ if ( $(this).attr('title') == $(this).val() )
179
+ $(this).val( '' );
180
+ } )
181
+ .blur( function () {
182
+ if ( '' == $(this).val() )
183
+ $(this).val( $(this).attr('title') );
184
+ } );
185
+
186
+ $( '#table_custom_fields textarea' ).focus( function() {
187
+ $( '#table_custom_fields .focus' ).removeClass('focus');
188
+ $(this).addClass('focus');
189
+ } );
190
+
191
+ // confirmation of certain actions
192
+ $( 'input.bulk_copy_tables' ).click( function () {
193
+ return confirm( WP_Table_Reloaded_Admin.str_BulkCopyTablesLink );
194
+ } );
195
+
196
+ $( 'input.bulk_delete_tables' ).click( function () {
197
+ return confirm( WP_Table_Reloaded_Admin.str_BulkDeleteTablesLink );
198
+ } );
199
+
200
+ $( 'input.bulk_wp_table_import_tables' ).click( function () {
201
+ return confirm( WP_Table_Reloaded_Admin.str_BulkImportwpTableTablesLink );
202
+ } );
203
+
204
+ $( 'a.copy_table_link' ).click( function () {
205
+ return confirm( WP_Table_Reloaded_Admin.str_CopyTableLink );
206
+ } );
207
+
208
+ /*
209
+ // moved to inline script, because of using wpList script
210
+ $( 'a.delete_table_link' ).click( function () {
211
+ return confirm( WP_Table_Reloaded_Admin.str_DeleteTableLink );
212
+ } );
213
+ */
214
+
215
+ $(' a.delete_row_link' ).click( function () {
216
+ return confirm( WP_Table_Reloaded_Admin.str_DeleteRowLink );
217
+ } );
218
+
219
+ $( 'a.delete_column_link' ).click( function () {
220
+ return confirm( WP_Table_Reloaded_Admin.str_DeleteColumnLink );
221
+ } );
222
+
223
+ $( 'a.import_wptable_link' ).click( function () {
224
+ return confirm( WP_Table_Reloaded_Admin.str_ImportwpTableLink );
225
+ } );
226
+
227
+ $( 'a.uninstall_plugin_link' ).click( function () {
228
+ if ( confirm( WP_Table_Reloaded_Admin.str_UninstallPluginLink_1 ) )
229
+ return confirm( WP_Table_Reloaded_Admin.str_UninstallPluginLink_2 );
230
+ else
231
+ return false;
232
+ } );
233
+
234
+ $( 'a.cf_shortcode_link' ).click( function () {
235
+ var dummy = prompt( WP_Table_Reloaded_Admin.str_CFShortcodeMessage, $(this).attr('title') );
236
+ return false;
237
+ } );
238
+
239
+ $( 'a.table_shortcode_link' ).click( function () {
240
+ var dummy = prompt( WP_Table_Reloaded_Admin.str_TableShortcodeMessage, $(this).attr('title') );
241
+ return false;
242
+ } );
243
+
244
+ // toggling of boxes
245
+ $( '.postbox h3, .postbox .handlediv' ).click( function() {
246
+ $( $(this).parent().get(0) ).toggleClass('closed');
247
+ } );
248
+
249
+ } );
admin/admin-script.js CHANGED
@@ -1,161 +1 @@
1
- jQuery(document).ready(function($){
2
-
3
- // WP_Table_Reloaded_Admin object will contain all localized strings
4
-
5
- $("#export_format").change(function () {
6
- if ( 'csv' == $(this).val() )
7
- $(".tr-export-delimiter").css('display','table-row');
8
- else
9
- $(".tr-export-delimiter").css('display','none');
10
- })
11
- .change();
12
-
13
- var table_id = $(".wp-table-reloaded-options #table_id").val();
14
- $(".wp-table-reloaded-options #table_id").change(function () {
15
- if ( table_id != $(this).val() ) {
16
- if ( confirm( WP_Table_Reloaded_Admin.str_ChangeTableID ) )
17
- table_id = $(this).val();
18
- else
19
- $(this).val( table_id );
20
- }
21
- });
22
-
23
- $(".tr-import-addreplace input").click(function () {
24
- $('.tr-import-addreplace-table').css('display','none');
25
-
26
- if( 'replace' == $('.tr-import-addreplace input:checked').val() ) {
27
- $('.tr-import-addreplace-table').css('display','table-row');
28
- }
29
- });
30
- $('.tr-import-addreplace input:checked').click();
31
-
32
- $(".tr-import-from input").click(function () {
33
- $('.tr-import-file').css('display','none');
34
- $('.tr-import-url').css('display','none');
35
- $('.tr-import-field').css('display','none');
36
- $('.tr-import-server').css('display','none');
37
-
38
- if( 'file-upload' == $('.tr-import-from input:checked').val() ) {
39
- $('.tr-import-file').css('display','table-row');
40
- } else if( 'url' == $('.tr-import-from input:checked').val() ) {
41
- $('.tr-import-url').css('display','table-row');
42
- } else if( 'form-field' == $('.tr-import-from input:checked').val() ) {
43
- $('.tr-import-field').css('display','table-row');
44
- } else if( 'server' == $('.tr-import-from input:checked').val() ) {
45
- $('.tr-import-server').css('display','table-row');
46
- }
47
- });
48
- $('.tr-import-from input:checked').click();
49
-
50
- $("#options_use_custom_css input").click(function () {
51
- if( $('#options_use_custom_css input:checked').val() ) {
52
- $('#options_custom_css').removeAttr("disabled");
53
- } else {
54
- $('#options_custom_css').attr("disabled", true);
55
- }
56
- return true;
57
- });
58
-
59
- $("#options_use_tableheadline input").click(function () {
60
- if( $('#options_use_tableheadline input:checked').val() && $('#tablesorter_enabled').val() ) {
61
- $('#options_use_tablesorter input').removeAttr("disabled");
62
- } else {
63
- $('#options_use_tablesorter input').attr("disabled", true);
64
- }
65
- return true;
66
- });
67
-
68
- $('.postbox h3, .postbox .handlediv').click( function() {
69
- $($(this).parent().get(0)).toggleClass('closed');
70
- } );
71
-
72
- $("#options_uninstall input").click(function () {
73
- if( $('#options_uninstall input:checked').val() ) {
74
- return confirm( WP_Table_Reloaded_Admin.str_UninstallCheckboxActivation );
75
- }
76
- });
77
-
78
- /*
79
- $("#table_contents textarea").keypress(function () {
80
- var currentTextsize = $(this).val().split('\n').length;
81
-
82
- if ( 0 < currentTextsize ) {
83
- $(this).attr('rows', currentTextsize);
84
- }
85
- }).keypress();
86
- */
87
-
88
- var insert_html = '';
89
-
90
- function add_html() {
91
- var old_value = $(this).val();
92
- var new_value = old_value + insert_html;
93
- $(this).val( new_value );
94
- $("#table_contents textarea").unbind('click', add_html);
95
- }
96
-
97
- $("#a-insert-link").click(function () {
98
- var link_url = prompt( WP_Table_Reloaded_Admin.str_DataManipulationLinkInsertURL + ':', 'http://' );
99
- if ( link_url ) {
100
- var link_text = prompt( WP_Table_Reloaded_Admin.str_DataManipulationLinkInsertText + ':', WP_Table_Reloaded_Admin.str_DataManipulationLinkInsertText );
101
- if ( link_text ) {
102
- insert_html = '<a href="' + link_url + '">' + link_text + '</a>';
103
- if ( confirm( WP_Table_Reloaded_Admin.str_DataManipulationLinkInsertExplain + '\n\n' + insert_html ) ) {
104
- $("#table_contents textarea").bind('click', add_html);
105
- }
106
- }
107
- }
108
- return false;
109
- });
110
-
111
- $("#a-insert-image").click(function () {
112
- var image_url = prompt( WP_Table_Reloaded_Admin.str_DataManipulationImageInsertURL + ':', 'http://' );
113
- if ( image_url ) {
114
- var image_alt = prompt( WP_Table_Reloaded_Admin.str_DataManipulationImageInsertAlt + ':', '' );
115
- // if ( image_alt ) { // won't check for alt, because there are cases where an empty one makes sense
116
- insert_html = '<img src="' + image_url + '" alt="' + image_alt + '" />';
117
- if ( true == confirm( WP_Table_Reloaded_Admin.str_DataManipulationImageInsertExplain + '\n\n' + insert_html ) ) {
118
- $("#table_contents textarea").bind('click', add_html);
119
- }
120
- // }
121
- }
122
- return false;
123
- });
124
-
125
- $("input.bulk_copy_tables").click(function () {
126
- return confirm( WP_Table_Reloaded_Admin.str_BulkCopyTablesLink );
127
- });
128
-
129
- $("input.bulk_delete_tables").click(function () {
130
- return confirm( WP_Table_Reloaded_Admin.str_BulkDeleteTablesLink );
131
- });
132
-
133
- $("input.bulk_wp_table_import_tables").click(function () {
134
- return confirm( WP_Table_Reloaded_Admin.str_BulkImportwpTableTablesLink );
135
- });
136
-
137
- $("a.copy_table_link").click(function () {
138
- return confirm( WP_Table_Reloaded_Admin.str_CopyTableLink );
139
- });
140
-
141
- $("a.delete_table_link").click(function () {
142
- return confirm( WP_Table_Reloaded_Admin.str_DeleteTableLink );
143
- });
144
-
145
- $("a.delete_row_link").click(function () {
146
- return confirm( WP_Table_Reloaded_Admin.str_DeleteRowLink );
147
- });
148
-
149
- $("a.delete_column_link").click(function () {
150
- return confirm( WP_Table_Reloaded_Admin.str_DeleteColumnLink );
151
- });
152
-
153
- $("a.import_wptable_link").click(function () {
154
- return confirm( WP_Table_Reloaded_Admin.str_ImportwpTableLink );
155
- });
156
-
157
- $("a.uninstall_plugin_link").click(function () {
158
- if ( confirm( WP_Table_Reloaded_Admin.str_UninstallPluginLink_1 ) ) { return confirm( WP_Table_Reloaded_Admin.str_UninstallPluginLink_2 ); } else { return false; }
159
- });
160
-
161
- });
1
+ jQuery(document).ready(function(f){jQuery.each({TBtoggleClass:function(j,i){if(typeof i!=="boolean"){i=!jQuery.className.has(this,j)}jQuery.className[i?"add":"remove"](this,j)}},function(i,j){jQuery.fn[i]=function(){return this.each(j,arguments)}});var e,a;f("#table_contents tbody :checkbox").change(function(){f("#table_contents tbody :checkbox").each(function(){e=f(this).attr("id");a=(-1!=e.search(/row/))?"row-hidden":"column-hidden";f("#table_contents ."+e).TBtoggleClass(a,f(this).attr("checked"))})}).change();f("#table_contents textarea").focus(function(){f("#table_contents .focus").removeClass("focus");f(this).parents("tr").find("textarea").addClass("focus")});f("#export_format").change(function(){if("csv"==f(this).val()){f(".tr-export-delimiter").css("display","table-row")}else{f(".tr-export-delimiter").css("display","none")}}).change();var h=f(".wp-table-reloaded-table-information #table_id").val();f(".wp-table-reloaded-table-information #table_id").change(function(){if(h!=f(this).val()){if(confirm(WP_Table_Reloaded_Admin.str_ChangeTableID)){h=f(this).val()}else{f(this).val(h)}}});f(".tr-import-addreplace input").click(function(){if("replace"==f(".tr-import-addreplace input:checked").val()){f(".tr-import-addreplace-table").css("display","table-row")}else{f(".tr-import-addreplace-table").css("display","none")}});f(".tr-import-addreplace input:checked").click();f(".tr-import-from input").click(function(){f(".tr-import-file-upload").css("display","none");f(".tr-import-url").css("display","none");f(".tr-import-form-field").css("display","none");f(".tr-import-server").css("display","none");f(".tr-import-"+f(".tr-import-from input:checked").val()).css("display","table-row")});f(".tr-import-from input:checked").click();f("#options_use_custom_css").change(function(){if(f(this).attr("checked")){f("#options_custom_css").removeAttr("disabled")}else{f("#options_custom_css").attr("disabled",true)}});f("#options_enable_tablesorter").change(function(){if(f(this).attr("checked")){f("#options_use_tablesorter_extended").removeAttr("disabled")}else{f("#options_use_tablesorter_extended").attr("disabled",true)}});f("#table_options_first_row_th").change(function(){if(f(this).attr("checked")&&f("#tablesorter_enabled").val()){f("#table_options_use_tablesorter").removeAttr("disabled")}else{f("#table_options_use_tablesorter").attr("disabled",true)}});f("#options_uninstall_upon_deactivation").click(function(){if(f(this).attr("checked")){return confirm(WP_Table_Reloaded_Admin.str_UninstallCheckboxActivation)}});var b="";function d(){var i=f(this).val();f(this).val(i+b);f("#table_contents textarea").unbind("click",d)}f("#a-insert-link").click(function(){var j=prompt(WP_Table_Reloaded_Admin.str_DataManipulationLinkInsertURL+":","http://");if(j){var i=prompt(WP_Table_Reloaded_Admin.str_DataManipulationLinkInsertText+":",WP_Table_Reloaded_Admin.str_DataManipulationLinkInsertText);if(i){b='<a href="'+j+'">'+i+"</a>";if(confirm(WP_Table_Reloaded_Admin.str_DataManipulationLinkInsertExplain+"\n\n"+b)){f("#table_contents textarea").bind("click",d)}}}return false});function g(){edCanvas=this;f("#table_contents textarea").unbind("click",g);var i=f("#a-insert-image");tb_show(i.attr("title"),i.attr("href"),i.attr("rel"));f(this).blur()}function c(){f(this).unbind("click");f(this).bind("click",c);if(true==confirm(WP_Table_Reloaded_Admin.str_DataManipulationImageInsertThickbox)){f("#table_contents textarea").bind("click",g)}}f("#a-insert-image").unbind("click").bind("click",c);f("#insert_custom_field_name").keyup(function(){f(this).val(f(this).val().toLowerCase().replace(/[^a-z0-9_-]/g,""))});f(".focus-blur-change").focus(function(){if(f(this).attr("title")==f(this).val()){f(this).val("")}}).blur(function(){if(""==f(this).val()){f(this).val(f(this).attr("title"))}});f("#table_custom_fields textarea").focus(function(){f("#table_custom_fields .focus").removeClass("focus");f(this).addClass("focus")});f("input.bulk_copy_tables").click(function(){return confirm(WP_Table_Reloaded_Admin.str_BulkCopyTablesLink)});f("input.bulk_delete_tables").click(function(){return confirm(WP_Table_Reloaded_Admin.str_BulkDeleteTablesLink)});f("input.bulk_wp_table_import_tables").click(function(){return confirm(WP_Table_Reloaded_Admin.str_BulkImportwpTableTablesLink)});f("a.copy_table_link").click(function(){return confirm(WP_Table_Reloaded_Admin.str_CopyTableLink)});f(" a.delete_row_link").click(function(){return confirm(WP_Table_Reloaded_Admin.str_DeleteRowLink)});f("a.delete_column_link").click(function(){return confirm(WP_Table_Reloaded_Admin.str_DeleteColumnLink)});f("a.import_wptable_link").click(function(){return confirm(WP_Table_Reloaded_Admin.str_ImportwpTableLink)});f("a.uninstall_plugin_link").click(function(){if(confirm(WP_Table_Reloaded_Admin.str_UninstallPluginLink_1)){return confirm(WP_Table_Reloaded_Admin.str_UninstallPluginLink_2)}else{return false}});f("a.cf_shortcode_link").click(function(){var i=prompt(WP_Table_Reloaded_Admin.str_CFShortcodeMessage,f(this).attr("title"));return false});f("a.table_shortcode_link").click(function(){var i=prompt(WP_Table_Reloaded_Admin.str_TableShortcodeMessage,f(this).attr("title"));return false});f(".postbox h3, .postbox .handlediv").click(function(){f(f(this).parent().get(0)).toggleClass("closed")})});
admin/admin-style.css CHANGED
@@ -1,59 +1 @@
1
- /******************************************
2
- * This CSS file belongs to the Admin part *
3
- * of WP-Table Reloaded 1.3! PLEASE DO NOT *
4
- * make any changes here! Thank you! *
5
- ******************************************/
6
-
7
- /* OWN PLUGIN STYLES */
8
-
9
- table.wp-table-reloaded-options td {
10
- padding: 5px 0px 5px 0px;
11
- }
12
-
13
- table.wp-table-reloaded-options th {
14
- font-weight: normal;
15
- text-align: left;
16
- padding: 5px 10px 5px 0px;
17
- vertical-align: middle;
18
- }
19
-
20
- table.wp-table-reloaded-data-manipulation { width:100%; }
21
-
22
- .widefat td {
23
- white-space:nowrap;
24
- vertical-align: baseline!important;
25
- }
26
-
27
- table#table_contents td, table#table_contents th{
28
- white-space:nowrap;
29
- vertical-align:middle!important;
30
- }
31
-
32
- table#table_contents input[type=text] {
33
- width:100%;
34
- }
35
-
36
- .hide_link, .expand_link {
37
- position: absolute;
38
- right: 10px;
39
- font-weight: normal;
40
- cursor: pointer;
41
- padding: 0px!important;
42
- }
43
-
44
- .postbox h3.hndle {
45
- cursor: pointer!important;
46
- }
47
-
48
- div.postbox .expand_link { display: none; }
49
- div.closed .expand_link { display: inline!important; }
50
- div.closed .hide_link { display: none; }
51
-
52
- /* OVERRIDE EXISTING WP STYLES */
53
-
54
- /* overwrite 980px max-width in WP < 2.7 */
55
- div.wrap { max-width: 100%!important; }
56
-
57
- .widefat tbody th.check-column {
58
- padding: 0!important;
59
- }
1
+ #wp-table-reloaded-list .table-id{font-size:12px;}#wp-table-reloaded-list .header{cursor:pointer;white-space:nowrap;}#wp-table-reloaded-list .header span{background-repeat:no-repeat;background-position:center;background-image:url('../img/bg.gif');margin-right:-5px;}#wp-table-reloaded-list .headerSortUp span{background-image:url('../img/asc.gif');}#wp-table-reloaded-list .headerSortDown span{background-image:url('../img/desc.gif');}#wp-table-reloaded-list .check-column{padding-right:7px!important;}#wp-table-reloaded-list .even{background-color:#F9F9F9;}textarea.row-hidden,textarea.column-hidden{background-color:#FFE0E0;}textarea.focus{height:84px;}.wp-table-reloaded-table-information td{padding:5px 0 5px 0;width:90%;}.wp-table-reloaded-newtable td{padding:5px 0 5px 0;width:85%;}.wp-table-reloaded-table-information th{font-weight:normal;text-align:left;padding:5px 10px 5px 0;vertical-align:middle;width:10%;min-width:130px;}.wp-table-reloaded-newtable,.wp-table-reloaded-table-information,.wp-table-reloaded-table-information input,.wp-table-reloaded-table-information textarea{width:100%;}.wp-table-reloaded-options td{padding:5px 0 5px 0;}.wp-table-reloaded-options th{font-weight:normal;text-align:left;padding:5px 10px 5px 0;vertical-align:middle;}.wp-table-reloaded-data-manipulation{width:100%;}.wp-table-reloaded-data-manipulation td{padding-top:7px!important;padding-bottom:7px!important;}.widefat td{vertical-align:baseline!important;}#table_custom_fields td{vertical-align:middle!important;}#table_contents td{white-space:nowrap;vertical-align:middle!important;}#table_contents th{white-space:nowrap;vertical-align:middle!important;text-align:center;}#table_contents textarea{min-width:180px;width:100%;}#table_contents .hide-columns .check-column{padding-left:7px;width:auto;}.no-wrap{white-space:nowrap;}.hide_link,.expand_link{position:absolute;right:10px;font-weight:normal;cursor:pointer;padding:0!important;}.postbox h3.hndle{cursor:pointer!important;}div.postbox .expand_link{display:none;}div.closed .expand_link{display:inline!important;}div.closed .hide_link{display:none;}div.wrap{max-width:100%!important;}#TB_ajaxContent{width:auto!important;height:94.5%!important;}#TB_ajaxContent .wrap{margin:0 7px 0 5px;}#TB_ajaxContent .wp-table-reloaded{background-color:#CDCDCD;width:100%;}#TB_ajaxContent .wp-table-reloaded th{border:1px solid #FFF;padding:4px;}#TB_ajaxContent .wp-table-reloaded td{padding:4px;background-color:#FFF;vertical-align:top;}#TB_ajaxContent .wp-table-reloaded .even td{background-color:#FFF;}#TB_ajaxContent .wp-table-reloaded .odd td{background-color:#F0F0F6;}
admin/admin-style.dev.css ADDED
@@ -0,0 +1,177 @@
1
+ /******************************************
2
+ * This CSS file belongs to the Admin part *
3
+ * of WP-Table Reloaded 1.4! PLEASE DO NOT *
4
+ * make any changes here! Thank you! *
5
+ ******************************************/
6
+
7
+ #wp-table-reloaded-list .table-id {
8
+ font-size:12px;
9
+ }
10
+
11
+ #wp-table-reloaded-list .header {
12
+ cursor:pointer;
13
+ white-space:nowrap;
14
+ }
15
+
16
+ #wp-table-reloaded-list .header span {
17
+ background-repeat:no-repeat;
18
+ background-position:center;
19
+ background-image:url( '../img/bg.gif' );
20
+ margin-right:-5px;
21
+ }
22
+
23
+ #wp-table-reloaded-list .headerSortUp span {
24
+ background-image:url( '../img/asc.gif' );
25
+ }
26
+ #wp-table-reloaded-list .headerSortDown span {
27
+ background-image:url( '../img/desc.gif' );
28
+ }
29
+
30
+ #wp-table-reloaded-list .check-column {
31
+ padding-right:7px!important;
32
+ }
33
+
34
+ #wp-table-reloaded-list .even { /* = alternate*/
35
+ background-color:#F9F9F9;
36
+ }
37
+
38
+ textarea.row-hidden, textarea.column-hidden {
39
+ background-color:#FFE0E0;
40
+ }
41
+
42
+ textarea.focus {
43
+ height:84px;
44
+ }
45
+
46
+ .wp-table-reloaded-table-information td {
47
+ padding:5px 0px 5px 0px;
48
+ width:90%;
49
+ }
50
+
51
+
52
+ .wp-table-reloaded-newtable td {
53
+ padding:5px 0px 5px 0px;
54
+ width:85%;
55
+ }
56
+
57
+ .wp-table-reloaded-table-information th {
58
+ font-weight:normal;
59
+ text-align:left;
60
+ padding:5px 10px 5px 0px;
61
+ vertical-align:middle;
62
+ width:10%;
63
+ min-width:130px;
64
+ }
65
+
66
+ .wp-table-reloaded-newtable, .wp-table-reloaded-table-information, .wp-table-reloaded-table-information input, .wp-table-reloaded-table-information textarea {
67
+ width:100%;
68
+ }
69
+
70
+ .wp-table-reloaded-options td {
71
+ padding:5px 0px 5px 0px;
72
+ }
73
+
74
+ .wp-table-reloaded-options th {
75
+ font-weight:normal;
76
+ text-align:left;
77
+ padding:5px 10px 5px 0px;
78
+ vertical-align:middle;
79
+ }
80
+
81
+ .wp-table-reloaded-data-manipulation { width:100%; }
82
+
83
+ .wp-table-reloaded-data-manipulation td {
84
+ padding-top:7px!important;
85
+ padding-bottom:7px!important;
86
+ }
87
+
88
+ .widefat td {
89
+ vertical-align:baseline!important;
90
+ }
91
+
92
+ #table_custom_fields td {
93
+ vertical-align:middle!important;
94
+ }
95
+
96
+ #table_contents td {
97
+ white-space:nowrap;
98
+ vertical-align:middle!important;
99
+ }
100
+
101
+ #table_contents th {
102
+ white-space:nowrap;
103
+ vertical-align:middle!important;
104
+ text-align:center;
105
+ }
106
+
107
+ #table_contents textarea {
108
+ min-width:180px;
109
+ width:100%;
110
+ }
111
+
112
+ #table_contents .hide-columns .check-column {
113
+ padding-left:7px;
114
+ width:auto;
115
+ }
116
+
117
+ .no-wrap {
118
+ white-space:nowrap;
119
+ }
120
+
121
+ .hide_link, .expand_link {
122
+ position:absolute;
123
+ right:10px;
124
+ font-weight:normal;
125
+ cursor:pointer;
126
+ padding:0px!important;
127
+ }
128
+
129
+ .postbox h3.hndle {
130
+ cursor:pointer!important;
131
+ }
132
+
133
+ div.postbox .expand_link { display: none; }
134
+ div.closed .expand_link { display: inline!important; }
135
+ div.closed .hide_link { display: none; }
136
+
137
+ /* OVERRIDE EXISTING WordPress STYLES */
138
+
139
+ /* overwrite 980px max-width in WP < 2.7 */
140
+ div.wrap { max-width:100%!important; }
141
+
142
+ /* table styles for the table preview */
143
+
144
+ /* Inner content div of thickbox needs to grow with outer div */
145
+ #TB_ajaxContent {
146
+ width:auto!important;
147
+ height:94.5%!important;
148
+ }
149
+
150
+ #TB_ajaxContent .wrap {
151
+ margin:0 7px 0 5px;
152
+ }
153
+
154
+ #TB_ajaxContent .wp-table-reloaded {
155
+ background-color:#CDCDCD;
156
+ width:100%;
157
+ }
158
+
159
+ /* Styles for the tablehead (<th>) (if enabled) */
160
+ #TB_ajaxContent .wp-table-reloaded th {
161
+ border:1px solid #FFF;
162
+ padding:4px;
163
+ }
164
+
165
+ #TB_ajaxContent .wp-table-reloaded td {
166
+ padding:4px;
167
+ background-color:#FFF;
168
+ vertical-align:top;
169
+ }
170
+
171
+ /* Styles for alternating row colors (if enabled) */
172
+ #TB_ajaxContent .wp-table-reloaded .even td {
173
+ background-color:#FFF;
174
+ }
175
+ #TB_ajaxContent .wp-table-reloaded .odd td {
176
+ background-color:#F0F0F6;
177
+ }
admin/index.php ADDED
@@ -0,0 +1,3 @@
1
+ <?php
2
+ // Silence is golden.
3
+ ?>
img/index.php ADDED
@@ -0,0 +1,3 @@
1
+ <?php
2
+ // Silence is golden.
3
+ ?>
index.php ADDED
@@ -0,0 +1,3 @@
1
+ <?php
2
+ // Silence is golden.
3
+ ?>
js/index.php ADDED
@@ -0,0 +1,3 @@
1
+ <?php
2
+ // Silence is golden.
3
+ ?>
js/jquery.tablesorter.extended.js ADDED
@@ -0,0 +1,988 @@
1
+ /*
2
+ *
3
+ * TableSorter 2.0 - Client-side table sorting with ease!
4
+ * Version 2.0.5d (update)
5
+ * @requires jQuery v1.2.3
6
+ *
7
+ * Copyright (c) 2007 Christian Bach
8
+ * Examples and docs at: http://tablesorter.com
9
+ * Dual licensed under the MIT and GPL licenses:
10
+ * http://www.opensource.org/licenses/mit-license.php
11
+ * http://www.gnu.org/licenses/gpl.html
12
+ *
13
+ */
14
+ /**
15
+ *
16
+ * @description Create a sortable table with multi-column sorting capabilitys
17
+ *
18
+ * @example $('table').tablesorter();
19
+ * @desc Create a simple tablesorter interface.
20
+ *
21
+ * @example $('table').tablesorter({ sortList:[[0,0],[1,0]] });
22
+ * @desc Create a tablesorter interface and sort on the first and secound column in ascending order.
23
+ *
24
+ * @example $('table').tablesorter({ headers: { 0: { sorter: false}, 1: {sorter: false} } } });
25
+ * @desc Create a tablesorter interface and disableing the first and secound column headers.
26
+ *
27
+ * @example $('table').tablesorter({ headers: { 0: {sorter: "digit"}, 1: {sorter: "currency"} } });
28
+ * @desc Create a tablesorter interface and set a column parser for the first and secound column.
29
+ *
30
+ *
31
+ * @param Object settings An object literal containing key/value pairs to provide optional settings.
32
+ *
33
+ * @option String cssHeader (optional) A string of the class name to be appended to sortable tr elements in the thead of the table.
34
+ * Default value: "header"
35
+ *
36
+ * @option String cssAsc (optional) A string of the class name to be appended to sortable tr elements in the thead on a ascending sort.
37
+ * Default value: "headerSortUp"
38
+ *
39
+ * @option String cssDesc (optional) A string of the class name to be appended to sortable tr elements in the thead on a descending sort.
40
+ * Default value: "headerSortDown"
41
+ *
42
+ * @option String sortInitialOrder (optional) A string of the inital sorting order can be asc or desc.
43
+ * Default value: "asc"
44
+ *
45
+ * @option String sortMultisortKey (optional) A string of the multi-column sort key.
46
+ * Default value: "shiftKey"
47
+ *
48
+ * @option String textExtraction (optional) A string of the text-extraction method to use.
49
+ * For complex html structures inside td cell set this option to "complex",
50
+ * on large tables the complex option can be slow.
51
+ * Default value: "simple"
52
+ *
53
+ * @option Object headers (optional) An array containing the forces sorting rules.
54
+ * This option let's you specify a default sorting rule.
55
+ * Default value: null
56
+ *
57
+ * @option Array sortList (optional) An array containing the forces sorting rules.
58
+ * This option let's you specify a default sorting rule.
59
+ * Default value: null
60
+ *
61
+ * @option Array sortForce (optional) An array containing forced sorting rules.
62
+ * This option let's you specify a default sorting rule, which is prepended to user-selected rules.
63
+ * Default value: null
64
+ *
65
+ * @option Array sortAppend (optional) An array containing forced sorting rules.
66
+ * This option let's you specify a default sorting rule, which is appended to user-selected rules.
67
+ * Default value: null
68
+ *
69
+ * @option Boolean widthFixed (optional) Boolean flag indicating if tablesorter should apply fixed widths to the table columns.
70
+ * This is usefull when using the pager companion plugin.
71
+ * This options requires the dimension jquery plugin.
72
+ * Default value: false
73
+ *
74
+ * @option Boolean cancelSelection (optional) Boolean flag indicating if tablesorter should cancel selection of the table headers text.
75
+ * Default value: true
76
+ *
77
+ * @option Boolean locale (optional) A locale String indicating which date format and decimal point to use.
78
+ * Default value: us
79
+ *
80
+ * @option Boolean debug (optional) Boolean flag indicating if tablesorter should display debuging information usefull for development.
81
+ *
82
+ * @option Boolean useUI (optional) Boolean flag indicating if tablesorter use the ui theme classes.
83
+ * Default value: false
84
+ * @type jQuery
85
+ *
86
+ * @name tablesorter
87
+ *
88
+ * @cat Plugins/Tablesorter
89
+ *
90
+ * @author Christian Bach/christian.bach@polyester.se
91
+ */
92
+
93
+ (function($) {
94
+ $.extend({
95
+ tablesorter: new function() {
96
+
97
+ var parsers = [], widgets = [];
98
+
99
+ this.defaults = {
100
+ cssHeader: "header",
101
+ cssAsc: "headerSortUp",
102
+ cssDesc: "headerSortDown",
103
+ cssChildRow: "expand-child",
104
+ cssUI: {widget: "ui-widget ui-widget-content ui-corner-all", header: "ui-widget-header ui-corner-all", hover: "ui-state-hover", icon: "ui-icon", iconBoth: "ui-icon-arrowthick-2-n-s", iconDesc: "ui-icon-arrowthick-1-n", iconAsc: "ui-icon-arrowthick-1-s" },
105
+ sortInitialOrder: "asc",
106
+ sortMultiSortKey: "shiftKey",
107
+ sortForce: null,
108
+ sortAppend: null,
109
+ textExtraction: "simple",
110
+ parsers: {},
111
+ widgets: [],
112
+ widgetZebra: {css: ["even","odd"]},
113
+ headers: {},
114
+ widthFixed: false,
115
+ cancelSelection: true,
116
+ sortList: [],
117
+ headerList: [],
118
+ locale: "us",
119
+ format:{us: {decimal: '.', date: '/'}, en: {decimal: '.', date: '/'}, eu: {decimal: ',', date: '.'}, de: {decimal: ',', date: '.'}},
120
+ onRenderHeader: null,
121
+ selectorHeaders: 'thead th',
122
+ useUI: false,
123
+ debug: false
124
+ };
125
+
126
+ /* debuging utils */
127
+ function benchmark(s,d) {
128
+ log(s + "," + (new Date().getTime() - d.getTime()) + "ms");
129
+ }
130
+
131
+ this.benchmark = benchmark;
132
+
133
+ function log(s) {
134
+ if (typeof console != "undefined" && typeof console.debug != "undefined") {
135
+ console.log(s);
136
+ } else {
137
+ alert(s);
138
+ }
139
+ }
140
+
141
+ /* parsers utils */
142
+ function buildParserCache(table,$headers) {
143
+
144
+ if(table.config.debug) { var parsersDebug = ""; }
145
+
146
+ var rows = table.tBodies[0].rows;
147
+
148
+ if(table.tBodies[0].rows[0]) {
149
+
150
+ var list = [], cells = rows[0].cells, l = cells.length;
151
+
152
+ for (var i=0;i < l; i++) {
153
+ var p = false;
154
+
155
+ if($.metadata && ($($headers[i]).metadata() && $($headers[i]).metadata().sorter) ) {
156
+
157
+ p = getParserById($($headers[i]).metadata().sorter);
158
+
159
+ } else if((table.config.headers[i] && table.config.headers[i].sorter)) {
160
+
161
+ p = getParserById(table.config.headers[i].sorter);
162
+ }
163
+ if(!p) {
164
+ p = detectParserForColumn(table,cells[i]);
165
+ }
166
+
167
+ if(table.config.debug) { parsersDebug += "column:" + i + " parser:" +p.id + "\n"; }
168
+
169
+ list.push(p);
170
+ }
171
+ }
172
+
173
+ if(table.config.debug) { log(parsersDebug); }
174
+
175
+ return list;
176
+ };
177
+
178
+ function detectParserForColumn(table,node) {
179
+ var l = parsers.length;
180
+ for(var i=1; i < l; i++) {
181
+ if(parsers[i].is($.trim(getElementText(table.config,node)),table,node)) {
182
+ return parsers[i];
183
+ }
184
+ }
185
+ // 0 is always the generic parser (text)
186
+ return parsers[0];
187
+ }
188
+
189
+ function getParserById(name) {
190
+ var l = parsers.length;
191
+ for(var i=0; i < l; i++) {
192
+ if(parsers[i].id.toLowerCase() == name.toLowerCase()) {
193
+ return parsers[i];
194
+ }
195
+ }
196
+ return false;
197
+ }
198
+
199
+ /* utils */
200
+ function buildCache(table) {
201
+
202
+ if(table.config.debug) { var cacheTime = new Date(); }
203
+
204
+
205
+ var totalRows = (table.tBodies[0] && table.tBodies[0].rows.length) || 0,
206
+ totalCells = (table.tBodies[0].rows[0] && table.tBodies[0].rows[0].cells.length) || 0,
207
+ parsers = table.config.parsers,
208
+ cache = {row: [], normalized: []};
209
+
210
+ for (var i=0;i < totalRows; ++i) {
211
+
212
+ /** Add the table data to main data array */
213
+ var c = $(table.tBodies[0].rows[i]), cols = [];
214
+
215
+ // if this is a child row, add it to the last row's children and continue to the next row
216
+ if( c.hasClass(table.config.cssChildRow) ){
217
+ cache.row[cache.row.length-1] = cache.row[cache.row.length-1].add(c);
218
+ // go to the next for loop
219
+ continue;
220
+ }
221
+
222
+ cache.row.push(c);
223
+
224
+ for(var j=0; j < totalCells; ++j) {
225
+ cols.push(parsers[j].format(getElementText(table.config,c[0].cells[j]),table,c[0].cells[j]));
226
+ }
227
+
228
+ cols.push(cache.normalized.length); // add position for rowCache
229
+ cache.normalized.push(cols);
230
+ cols = null;
231
+ };
232
+
233
+ if(table.config.debug) { benchmark("Building cache for " + totalRows + " rows:", cacheTime); }
234
+
235
+ return cache;
236
+ };
237
+
238
+ function getElementText(config,node) {
239
+
240
+ if(!node) return "";
241
+
242
+ var t = "";
243
+
244
+ if(config.textExtraction == "simple") {
245
+ if(node.childNodes[0] && node.childNodes[0].hasChildNodes()) {
246
+ t = node.childNodes[0].innerHTML;
247
+ } else {
248
+ t = node.innerHTML;
249
+ }
250
+ } else {
251
+ if(typeof(config.textExtraction) == "function") {
252
+ t = config.textExtraction(node);
253
+ } else {
254
+ t = $(node).text();
255
+ }
256
+ }
257
+ return t;
258
+ }
259
+
260
+ function appendToTable(table,cache) {
261
+
262
+ if(table.config.debug) {var appendTime = new Date();}
263
+
264
+ var c = cache,
265
+ r = c.row,
266
+ n= c.normalized,
267
+ totalRows = n.length,
268
+ checkCell = (n[0].length-1),
269
+ tableBody = $(table.tBodies[0]),
270
+ rows = [];
271
+
272
+ for (var i=0;i < totalRows; i++) {
273
+ var pos = n[i][checkCell];
274
+ rows.push(r[pos]);
275
+ if(!table.config.appender) {
276
+
277
+ var o = r[pos];
278
+ var l = o.length;
279
+ for(var j=0; j < l; j++) {
280
+ tableBody[0].appendChild(o[j]);
281
+ }
282
+
283
+ //tableBody.append(r[n[i][checkCell]]);
284
+ }
285
+ }
286
+
287
+ if(table.config.appender) {
288
+
289
+ table.config.appender(table,rows);
290
+ }
291
+
292
+ rows = null;
293
+
294
+ if(table.config.debug) { benchmark("Rebuilt table:", appendTime); }
295
+
296
+ //apply table widgets
297
+ applyWidget(table);
298
+
299
+ // trigger sortend
300
+ setTimeout(function() {
301
+ $(table).trigger("sortEnd");
302
+ },0);
303
+
304
+ };
305
+
306
+ function buildHeaders(table) {
307
+
308
+ if(table.config.debug) { var time = new Date(); }
309
+
310
+ var config = table.config;
311
+ var meta = ($.metadata) ? true : false; //, tableHeadersRows = [];
312
+
313
+ //for(var i = 0; i < table.tHead.rows.length; i++) { tableHeadersRows[i]=0; };
314
+
315
+ $tableHeaders = $(config.selectorHeaders,table).each(function(index) {
316
+
317
+ this.column = index;
318
+ this.order = formatSortingOrder(config.sortInitialOrder);
319
+ this.count = this.order;
320
+
321
+ if(checkHeaderMetadata(this) || checkHeaderOptions(table,index)) this.sortDisabled = true;
322
+
323
+ if(!this.sortDisabled) {
324
+ if (config.useUI) {
325
+ // add span element
326
+ $(this).prepend('<span></span>').children("span").addClass(config.cssUI.icon);
327
+ $(this).hover(function () {$(this).addClass(config.cssUI.hover);}, function () {$(this).removeClass(config.cssUI.hover);});
328
+ }
329
+ else {
330
+ if( config.onRenderHeader ) config.onRenderHeader.apply(this);
331
+ }
332
+ }
333
+
334
+ // add cell to headerList
335
+ config.headerList[index]= this;
336
+ });
337
+
338
+ if(table.config.debug) { benchmark("Built headers:", time); log($tableHeaders); }
339
+
340
+ return $tableHeaders;
341
+
342
+ };
343
+
344
+ function setupCss(table, $headers) {
345
+ var c = table.config;
346
+
347
+ if(c.useUI) {
348
+ $(table).parent("div:first").addClass(c.cssUI["widget"]);
349
+ $headers.addClass(c.cssUI.header);
350
+ return [c.cssUI.iconDesc,c.cssUI.iconAsc,c.cssUI.iconBoth];
351
+
352
+ }
353
+ else {
354
+ $headers.addClass(c.cssHeader);
355
+ return [c.cssDesc,c.cssAsc];
356
+ }
357
+ }
358
+
359
+ function checkCellColSpan(table, rows, row) {
360
+ var arr = [], r = table.tHead.rows, c = r[row].cells;
361
+
362
+ for(var i=0; i < c.length; i++) {
363
+ var cell = c[i];
364
+
365
+ if ( cell.colSpan > 1) {
366
+ arr = arr.concat(checkCellColSpan(table, headerArr,row++));
367
+ } else {
368
+ if(table.tHead.length == 1 || (cell.rowSpan > 1 || !r[row+1])) {
369
+ arr.push(cell);
370
+ }
371
+ //headerArr[row] = (i+row);
372
+ }
373
+ }
374
+ return arr;
375
+ };
376
+
377
+ function checkHeaderMetadata(cell) {
378
+ if(($.metadata) && ($(cell).metadata().sorter === false)) { return true; };
379
+ return false;
380
+ }
381
+
382
+ function checkHeaderOptions(table,i) {
383
+ if((table.config.headers[i]) && (table.config.headers[i].sorter === false)) { return true; };
384
+ return false;
385
+ }
386
+
387
+ function applyWidget(table) {
388
+ var c = table.config.widgets;
389
+ var l = c.length;
390
+ for(var i=0; i < l; i++) {
391
+
392
+ getWidgetById(c[i]).format(table);
393
+ }
394
+
395
+ }
396
+
397
+ function getWidgetById(name) {
398
+ var l = widgets.length;
399
+ for(var i=0; i < l; i++) {
400
+ if(widgets[i].id.toLowerCase() == name.toLowerCase() ) {
401
+ return widgets[i];
402
+ }
403
+ }
404
+ };
405
+
406
+ function formatSortingOrder(v) {
407
+ if(typeof(v) != "Number") {
408
+ return (v.toLowerCase() == "desc") ? 1 : 0;
409
+ } else {
410
+ return (v == 1) ? 1 : 0;
411
+ }
412
+ }
413
+
414
+ function isValueInArray(v, a) {
415
+ var l = a.length;
416
+ for(var i=0; i < l; i++) {
417
+ if(a[i][0] == v) {
418
+ return true;
419
+ }
420
+ }
421
+ return false;
422
+ }
423
+
424
+ function setHeadersCss(table,$headers, list, css) {
425
+ var c = table.config;
426
+ // remove all header information
427
+ if(c.useUI) {
428
+ $headers.children("span").removeClass(css[0]).removeClass(css[1]).addClass(css[2]);
429
+ } else {
430
+ $headers.removeClass(css[0]).removeClass(css[1]);
431
+ }
432
+
433
+ var h = [];
434
+ $headers.each(function(offset) {
435
+ if(!this.sortDisabled) {
436
+ h[this.column] = $(this);
437
+ }
438
+ });
439
+
440
+ var l = list.length;
441
+ for(var i=0; i < l; i++) {
442
+ if (c.useUI) {
443
+ h[list[i][0]].children("span").removeClass(css[2]).addClass(css[list[i][1]]);
444
+ } else {
445
+ h[list[i][0]].addClass(css[list[i][1]]);
446
+ }
447
+ }
448
+ }
449
+
450
+ function fixColumnWidth(table,$headers) {
451
+ var c = table.config;
452
+ if(c.widthFixed) {
453
+ var colgroup = $('<colgroup>');
454
+ $("tr:first td",table.tBodies[0]).each(function() {
455
+ colgroup.append($('<col>').css('width',$(this).width()));
456
+ });
457
+ $(table).prepend(colgroup);
458
+ };
459
+ }
460
+
461
+ function updateHeaderSortCount(table,sortList) {
462
+ var c = table.config, l = sortList.length;
463
+ for(var i=0; i < l; i++) {
464
+ var s = sortList[i], o = c.headerList[s[0]];
465
+ o.count = s[1];
466
+ o.count++;
467
+ }
468
+ }
469
+
470
+ /* sorting methods */
471
+ function multisort(table,sortList,cache) {
472
+
473
+ if(table.config.debug) { var sortTime = new Date(); }
474
+
475
+ var dynamicExp = "var sortWrapper = function(a,b) {", l = sortList.length;
476
+
477
+ // TODO: inline functions.
478
+ for(var i=0; i < l; i++) {
479
+
480
+ var c = sortList[i][0];
481
+ var order = sortList[i][1];
482
+ //var s = (getCachedSortType(table.config.parsers,c) == "text") ? ((order == 0) ? "sortText" : "sortTextDesc") : ((order == 0) ? "sortNumeric" : "sortNumericDesc");
483
+ //var s = (table.config.parsers[c].type == "text") ? ((order == 0) ? makeSortText(c) : makeSortTextDesc(c)) : ((order == 0) ? makeSortNumeric(c) : makeSortNumericDesc(c));
484
+ 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));
485
+ var e = "e" + i;
486
+
487
+ dynamicExp += "var " + e + " = " + s; // + "(a[" + c + "],b[" + c + "]); ";
488
+ dynamicExp += "if(" + e + ") { return " + e + "; } ";
489
+ dynamicExp += "else { ";
490
+
491
+ }
492
+
493
+ // if value is the same keep orignal order
494
+ var orgOrderCol = cache.normalized[0].length - 1;
495
+ dynamicExp += "return a[" + orgOrderCol + "]-b[" + orgOrderCol + "];";
496
+
497
+ for(var i=0; i < l; i++) {
498
+ dynamicExp += "}; ";
499
+ }
500
+
501
+ dynamicExp += "return 0; ";
502
+ dynamicExp += "}; ";
503
+
504
+ if(table.config.debug) { benchmark("Evaling expression:" + dynamicExp, new Date()); }
505
+
506
+ eval(dynamicExp);
507
+
508
+ cache.normalized.sort(sortWrapper);
509
+
510
+ if(table.config.debug) { benchmark("Sorting on " + sortList.toString() + " and dir " + order+ " time:", sortTime); }
511
+
512
+ return cache;
513
+ };
514
+
515
+ function makeSortFunction(type, direction, index) {
516
+ var a = "a[" + index + "]", b = "b[" + index + "]";
517
+ if (type == 'text' && direction == 'asc') {
518
+ return "(" + a + " == " + b + " ? 0 : (" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : (" + a + " < " + b + ") ? -1 : 1 )));";
519
+ } else if (type == 'text' && direction == 'desc') {
520
+ return "(" + a + " == " + b + " ? 0 : (" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : (" + b + " < " + a + ") ? -1 : 1 )));";
521
+ } else if (type == 'numeric' && direction == 'asc') {
522
+ return "(" + a + " === null && " + b + " === null) ? 0 :(" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : " + a + " - " + b + "));";
523
+ } else if (type == 'numeric' && direction == 'desc') {
524
+ return "(" + a + " === null && " + b + " === null) ? 0 :(" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : " + b + " - " + a + "));";
525
+ }
526
+ };
527
+
528
+ function makeSortText(i) {
529
+ return "((a[" + i + "] < b[" + i + "]) ? -1 : ((a[" + i + "] > b[" + i + "]) ? 1 : 0));";
530
+ };
531
+
532
+ function makeSortTextDesc(i) {
533
+ return "((b[" + i + "] < a[" + i + "]) ? -1 : ((b[" + i + "] > a[" + i + "]) ? 1 : 0));";
534
+ };
535
+
536
+ function makeSortNumeric(i) {
537
+ return "a[" + i + "]-b[" + i + "];";
538
+ };
539
+
540
+ function makeSortNumericDesc(i) {
541
+ return "b[" + i + "]-a[" + i + "];";
542
+ };
543
+
544
+
545
+ function sortText(a,b) {
546
+ return ((a < b) ? -1 : ((a > b) ? 1 : 0));
547
+ };
548
+
549
+ function sortTextDesc(a,b) {
550
+ return ((b < a) ? -1 : ((b > a) ? 1 : 0));
551
+ };
552
+
553
+ function sortNumeric(a,b) {
554
+ return a-b;
555
+ };
556
+
557
+ function sortNumericDesc(a,b) {
558
+ return b-a;
559
+ };
560
+
561
+ function getCachedSortType(parsers,i) {
562
+ return parsers[i].type;
563
+ };
564
+
565
+ /* public methods */
566
+ this.construct = function(settings) {
567
+
568
+ return this.each(function() {
569
+
570
+ if(!this.tHead || !this.tBodies) return;
571
+
572
+ var $this, $document,$headers, cache, config, shiftDown = 0, sortOrder;
573
+
574
+ this.config = {};
575
+
576
+ config = $.extend(this.config, $.tablesorter.defaults, settings);
577
+
578
+ // store common expression for speed
579
+ $this = $(this);
580
+
581
+ // save the settings where they read
582
+ $.data(this, "tablesorter", config);
583
+
584
+ // build headers
585
+ $headers = buildHeaders(this);
586
+
587
+ // try to auto detect column type, and store in tables config
588
+ this.config.parsers = buildParserCache(this,$headers);
589
+
590
+ // build the cache for the tbody cells
591
+ cache = buildCache(this);
592
+
593
+ // get class names and setup UI if needed
594
+ var sortCSS = setupCss(this, $headers);
595
+
596
+ // fixate columns if the users supplies the fixedWidth option
597
+ fixColumnWidth(this);
598
+
599
+ // apply event handling to headers
600
+ // this is to big, perhaps break it out?
601
+ $headers.click(function(e) {
602
+
603
+ var totalRows = ($this[0].tBodies[0] && $this[0].tBodies[0].rows.length) || 0;
604
+
605
+ if(!this.sortDisabled && totalRows > 0) {
606
+
607
+ // Only call sortStart if sorting is enabled.
608
+ $this.trigger("sortStart");
609
+
610
+ // store exp, for speed
611
+ var $cell = $(this);
612
+
613
+ // get current column index
614
+ var i = this.column;
615
+
616
+ // get current column sort order
617
+ this.order = this.count++ % 2;
618
+
619
+ // user only whants to sort on one column
620
+ if(!e[config.sortMultiSortKey]) {
621
+
622
+ // flush the sort list
623
+ config.sortList = [];
624
+
625
+ if(config.sortForce != null) {
626
+ var a = config.sortForce;
627
+ for(var j=0; j < a.length; j++) {
628
+ if(a[j][0] != i) {
629
+ config.sortList.push(a[j]);
630
+ }
631
+ }
632
+ }
633
+
634
+ // add column to sort list
635
+ config.sortList.push([i,this.order]);
636
+
637
+ // multi column sorting
638
+ } else {
639
+ // the user has clicked on an all ready sortet column.
640
+ if(isValueInArray(i,config.sortList)) {
641
+
642
+ // revers the sorting direction for all tables.
643
+ for(var j=0; j < config.sortList.length; j++) {
644
+ var s = config.sortList[j], o = config.headerList[s[0]];
645
+ if(s[0] == i) {
646
+ o.count = s[1];
647
+ o.count++;
648
+ s[1] = o.count % 2;
649
+ }
650
+ }
651
+ } else {
652
+ // add column to sort list array
653
+ config.sortList.push([i,this.order]);
654
+ }
655
+ };
656
+ setTimeout(function() {
657
+ //set css for headers
658
+ setHeadersCss($this[0],$headers,config.sortList,sortCSS);
659
+ appendToTable($this[0],multisort($this[0],config.sortList,cache));
660
+ },1);
661
+ // stop normal event by returning false
662
+ return false;
663
+ }
664
+ // cancel selection
665
+ }).mousedown(function() {
666
+ if(config.cancelSelection) {
667
+ this.onselectstart = function() {return false;};
668
+ return false;
669
+ }
670
+ });
671
+
672
+ // apply easy methods that trigger binded events
673
+ $this.bind("update",function() {
674
+ var me = this;
675
+ setTimeout(function() {
676
+ // rebuild parsers.
677
+ me.config.parsers = buildParserCache(me,$headers);
678
+ // rebuild the cache map
679
+ cache = buildCache(me);
680
+ },1);
681
+ }).bind("updateCell",function(e,cell) {
682
+ var config = this.config;
683
+ // get position from the dom.
684
+ var pos = [(cell.parentNode.rowIndex - 1),cell.cellIndex];
685
+ // update cache
686
+ cache.normalized[pos[0]][pos[1]] = config.parsers[pos[1]].format(getElementText(config,cell),cell);
687
+
688
+ }).bind("sorton",function(e,list) {
689
+
690
+ $(this).trigger("sortStart");
691
+
692
+ config.sortList = list;
693
+
694
+ // update and store the sortlist
695
+ var sortList = config.sortList;
696
+
697
+ // update header count index
698
+ updateHeaderSortCount(this,sortList);
699
+
700
+ //set css for headers
701
+ setHeadersCss(this,$headers,sortList,sortCSS);
702
+
703
+ // sort the table and append it to the dom
704
+ appendToTable(this,multisort(this,sortList,cache));
705
+
706
+ }).bind("appendCache",function() {
707
+
708
+ appendToTable(this,cache);
709
+
710
+ }).bind("applyWidgetId",function(e,id) {
711
+
712
+ getWidgetById(id).format(this);
713
+
714
+ }).bind("applyWidgets",function() {
715
+ // apply widgets
716
+ applyWidget(this);
717
+ });
718
+
719
+ if($.metadata && ($(this).metadata() && $(this).metadata().sortlist)) {
720
+ config.sortList = $(this).metadata().sortlist;
721
+ }
722
+ // if user has supplied a sort list to constructor.
723
+ if(config.sortList.length > 0) {
724
+ $this.trigger("sorton",[config.sortList]);
725
+ }
726
+ else {
727
+ // apply widgets only if there is no sort list in constructor
728
+ applyWidget(this);
729
+ }
730
+ });
731
+ };
732
+
733
+ this.addParser = function(parser) {
734
+ var l = parsers.length, a = true;
735
+ for(var i=0; i < l; i++) {
736
+ if(parsers[i].id.toLowerCase() == parser.id.toLowerCase()) {
737
+ a = false;
738
+ }
739
+ }
740
+ if(a) { parsers.push(parser); };
741
+ };
742
+
743
+ this.addWidget = function(widget) {
744
+ widgets.push(widget);
745
+ };
746
+
747
+ this.formatDate = function(s,config) {
748
+ if (config.locale != "us") {
749
+ var datePoint = '\\'+config.format[config.locale]["date"];
750
+ s = s.replace(new RegExp('[\\-'+datePoint+']', 'g'), config.format["us"]["date"]);
751
+ }
752
+ return s;
753
+ };
754
+ this.formatDecimal = function(s,config) {
755
+ if (config.locale != "us") {
756
+ s = s.replace(config.format[config.locale]["decimal"], config.format["us"]["decimal"]);
757
+ }
758
+ return s;
759
+ };
760
+ this.formatFloat = function(s) {
761
+ var i = parseFloat(s);
762
+ return (isNaN(i)) ? 0 : i;
763
+ };
764
+ this.formatInt = function(s) {
765
+ var i = parseInt(s);
766
+ return (isNaN(i)) ? 0 : i;
767
+ };
768
+
769
+ this.isDigit = function(s,config) {
770
+ var decimalPoint = '\\' + config.format[config.locale]["decimal"];
771
+ var exp = '/(^[+]?0(' + decimalPoint +'0+)?$)|(^([-+]?[0-9]*)$)|(^([-+]?((0?[0-9]*)' + decimalPoint +'(0*[0-9]*)))$)|(^[-+]?[0-9]*' + decimalPoint +'0+$)/';
772
+ return RegExp(exp).test($.trim(s));
773
+ };
774
+
775
+ this.clearTableBody = function(table) {
776
+ if($.browser.msie) {
777
+ function empty() {
778
+ while ( this.firstChild ) this.removeChild( this.firstChild );
779
+ }
780
+ empty.apply(table.tBodies[0]);
781
+ } else {
782
+ table.tBodies[0].innerHTML = "";
783
+ }
784
+ };
785
+ }
786
+ });
787
+
788
+ // extend plugin scope
789
+ $.fn.extend({
790
+ tablesorter: $.tablesorter.construct
791
+ });
792
+
793
+ // make shortcut
794
+ var ts = $.tablesorter;
795
+
796
+ // add default parsers
797
+ ts.addParser({
798
+ id: "text",
799
+ is: function(s) {
800
+ return true;
801
+ },
802
+ format: function(s) {
803
+ return $.trim(s.toLowerCase());
804
+ },
805
+ type: "text"
806
+ });
807
+
808
+ ts.addParser({
809
+ id: "digit",
810
+ is: function(s,table) {
811
+ var c = table.config;
812
+ return $.tablesorter.isDigit(s,c);
813
+ },
814
+ format: function(s,table) {
815
+ var c = table.config;
816
+ s = $.tablesorter.formatDecimal(s,c);
817
+ return $.tablesorter.formatFloat(s);
818
+ },
819
+ type: "numeric"
820
+ });
821
+
822
+ ts.addParser({
823
+ id: "currency",
824
+ is: function(s) {
825
+ return /^[£$€?.,]/.test(s);
826
+ },
827
+ format: function(s,table) {
828
+ var c = table.config;
829
+ s = $.tablesorter.formatDecimal(s,c);
830
+ return $.tablesorter.formatFloat(s.replace(new RegExp(/[£$€]/g),""));
831
+ },
832
+ type: "numeric"
833
+ });
834
+
835
+ ts.addParser({
836
+ id: "ipAddress",
837
+ is: function(s) {
838
+ return /^\d{2,3}[\.]\d{1,3}[\.]\d{1,3}[\.]\d{1,3}#x2F;.test(s);
839
+ },
840
+ format: function(s) {
841
+ var a = s.split("."), r = "", l = a.length;
842
+ for(var i = 0; i < l; i++) {
843
+ var item = a[i];
844
+ if(item.length == 2) {
845
+ r += "0" + item;
846
+ } else {
847
+ r += item;
848
+ }
849
+ }
850
+ return $.tablesorter.formatFloat(r);
851
+ },
852
+ type: "numeric"
853
+ });
854
+
855
+ ts.addParser({
856
+ id: "url",
857
+ is: function(s) {
858
+ return /^(https?|ftp|file):\/\/#x2F;.test(s);
859
+ },
860
+ format: function(s) {
861
+ return jQuery.trim(s.replace(new RegExp(/(https?|ftp|file):\/\//),''));
862
+ },
863
+ type: "text"
864
+ });
865
+
866
+ ts.addParser({
867
+ id: "isoDate",
868
+ is: function(s) {
869
+ return /^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}#x2F;.test(s);
870
+ },
871
+ format: function(s) {
872
+ return $.tablesorter.formatFloat((s != "") ? new Date(s.replace(new RegExp(/-/g),"/")).getTime() : "0");
873
+ },
874
+ type: "numeric"
875
+ });
876
+
877
+ ts.addParser({
878
+ id: "percent",
879
+ is: function(s) {
880
+ return /\%#x2F;.test($.trim(s));
881
+ },
882
+ format: function(s,table) {
883
+ var c = table.config;
884
+ s = $.tablesorter.formatDecimal(s,c);
885
+ return $.tablesorter.formatFloat(s.replace(new RegExp(/%/g),""));
886
+ },
887
+ type: "numeric"
888
+ });
889
+
890
+ ts.addParser({
891
+ id: "usLongDate",
892
+ is: function(s) {
893
+ 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)))#x2F;));
894
+ },
895
+ format: function(s) {
896
+ return $.tablesorter.formatFloat(new Date(s).getTime());
897
+ },
898
+ type: "numeric"
899
+ });
900
+
901
+ ts.addParser({
902
+ id: "mediumDate",
903
+ is: function(s,table) {
904
+ var c = table.config;
905
+ var datePoint = '\\' + c.format[c.locale]["date"];
906
+ var expStr = '\\d{1,2}[\\-'+datePoint+']\\d{1,2}[\\-'+datePoint+']\\d{4}';
907
+ return RegExp(expStr).test(s);
908
+ },
909
+ format: function(s,table) {
910
+ var c = table.config;
911
+ s = $.tablesorter.formatDate(s,c);
912
+ if(c.locale == "us") {
913
+ // reformat the string in ISO format
914
+ s = s.replace(/(\d{1,2})[\/](\d{1,2})[\/](\d{4})/, "$3/$1/$2");
915
+ } else if(c.locale == "en" || c.locale == "de" || c.locale == "eu") {
916
+ //reformat the string in ISO format
917
+ s = s.replace(/(\d{1,2})[\/](\d{1,2})[\/](\d{4})/, "$3/$2/$1");
918
+ }
919
+ return $.tablesorter.formatFloat((s != "") ? new Date(s).getTime() : 0);
920
+ },
921
+ type: "numeric"
922
+ });
923
+
924
+ ts.addParser({
925
+ id: "shortDate",
926
+ is: function(s,table) {
927
+ var c = table.config;
928
+ var datePoint = '\\'+c.format[c.locale]["date"];
929
+ var expStr = '\\d{1,2}[\\-'+datePoint+']\\d{1,2}[\\-'+datePoint+']\\d{2}';
930
+ return RegExp(expStr).test(s);
931
+ },
932
+ format: function(s,table) {
933
+ var c = table.config;
934
+ s = $.tablesorter.formatDate(s,c);
935
+ if(c.locale == "us") {
936
+ // reformat the string in non-ISO format
937
+ s = s.replace(/(\d{1,2})[\/](\d{1,2})[\/](\d{2})/, "$1/$2/$3");
938
+ } else if(c.locale == "en" || c.locale == "de" || c.locale == "eu") {
939
+ //reformat the string in non-ISO format
940
+ s = s.replace(/(\d{1,2})[\/](\d{1,2})[\/](\d{2})/, "$2/$1/$3");
941
+ }
942
+ return $.tablesorter.formatFloat((s != "") ? new Date(s).getTime() : 0);
943
+ },
944
+ type: "numeric"
945
+ });
946
+
947
+
948
+ ts.addParser({
949
+ id: "time",
950
+ is: function(s) {
951
+ return /^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))#x2F;.test(s);
952
+ },
953
+ format: function(s) {
954
+ return $.tablesorter.formatFloat(new Date("2000/01/01 " + s).getTime());
955
+ },
956
+ type: "numeric"
957
+ });
958
+
959
+ ts.addParser({
960
+ id: "metadata",
961
+ is: function(s) {
962
+ return false;
963
+ },
964
+ format: function(s,table,cell) {
965
+ var c = table.config, p = (!c.parserMetadataName) ? 'sortValue' : c.parserMetadataName;
966
+ return $(cell).metadata()[p];
967
+ },
968
+ type: "numeric"
969
+ });
970
+
971
+ // add default widgets
972
+ ts.addWidget({
973
+ id: "zebra",
974
+ format: function(table) {
975
+ if(table.config.debug) { var time = new Date(); }
976
+ var $tr, row = -1, odd;
977
+ // loop through the visible rows
978
+ $("tr:visible",table.tBodies[0]).each(function (i){
979
+ $tr = $(this);
980
+ // style children rows the same way the parent row was styled
981
+ if( !$tr.hasClass(table.config.cssChildRow) ) row++;
982
+ odd = (row%2 == 0);
983
+ $tr.removeClass(table.config.widgetZebra.css[odd?0:1]).addClass(table.config.widgetZebra.css[odd?1:0]);
984
+ });
985
+ if(table.config.debug) { $.tablesorter.benchmark("Applying Zebra widget", time); }
986
+ }
987
+ });
988
+ })(jQuery);
languages/index.php ADDED
@@ -0,0 +1,3 @@
1
+ <?php
2
+ // Silence is golden.
3
+ ?>
languages/wp-table-reloaded-cs_CZ.mo CHANGED
Binary file
languages/wp-table-reloaded-cs_CZ.po CHANGED
@@ -1,8 +1,8 @@
1
msgid ""
2
msgstr ""
3
- "Project-Id-Version: WP-Table Reloaded CZ (1.3)\n"
4
"Report-Msgid-Bugs-To: http://wordpress.org/tag/wp-table-reloaded\n"
5
- "POT-Creation-Date: 2009-06-09 09:55+0000\n"
6
"PO-Revision-Date: \n"
7
"Last-Translator: Separatista <pavelevap@separatista.net>\n"
8
"Language-Team: Separatista <pavelevap@separatista.net>\n"
@@ -50,933 +50,1269 @@ msgstr ". (tečka)"
50
msgid "| (pipe)"
51
msgstr "| (svislá čára)"
52
53
- #: wp-table-reloaded-admin.php:152
54
#, php-format
55
msgid "Table \"%s\" added successfully."
56
msgstr "Tabulka \"%s\" byla úspěšně vytvořena."
57
58
- #: wp-table-reloaded-admin.php:180
59
#, php-format
60
msgid "Table edited successfully. This Table now has the ID %s. You'll need to adjust existing shortcodes accordingly."
61
msgstr "Tabulka byla úspěšně aktualizována. Tato tabulka má nyní ID %s. Budete si podle toho muset upravit již existující zkrácené zápisy v příspěvcích."
62
63
- #: wp-table-reloaded-admin.php:182
64
#, php-format
65
msgid "The ID could not be changed from %s to %s, because there already is a Table with that ID."
66
msgstr "ID tabulky nemohlo být změněno z %s na %s, protože tabulka s tímto ID již existuje."
67
68
- #: wp-table-reloaded-admin.php:185
69
msgid "Table edited successfully."
70
msgstr "Tabulka byla úspěšně aktualizována."
71
72
- #: wp-table-reloaded-admin.php:208
73
msgid "Rows swapped successfully."
74
msgstr "Řádky byly úspěšně prohozeny."
75
76
- #: wp-table-reloaded-admin.php:227
77
msgid "Columns swapped successfully."
78
msgstr "Sloupce byly úspěšně prohozeny."
79
80
- #: wp-table-reloaded-admin.php:245
81
msgid "Table sorted successfully."
82
msgstr "Hodnoty v tabulce byly úspěšně seřazeny."
83
84
- #: wp-table-reloaded-admin.php:258
85
msgid "Row added successfully."
86
msgid_plural "Rows added successfully."
87
msgstr[0] "Řádek byl úspěšně přidán."
88
msgstr[1] "Řádky byly úspěšně přidány."
89
msgstr[2] "Řádky byly úspěšně přidány."
90
91
- #: wp-table-reloaded-admin.php:270
92
msgid "Column added successfully."
93
msgid_plural "Columns added successfully."
94
msgstr[0] "Sloupec byl úspěšně smazán."
95
msgstr[1] "Sloupce byly úspěšně přidány."
96
msgstr[2] "Sloupce byly úspěšně přidány."
97
98
- #: wp-table-reloaded-admin.php:305
99
- #: wp-table-reloaded-admin.php:352
100
msgid "Copy of"
101
msgstr "Kopie -"
102
103
- #: wp-table-reloaded-admin.php:309
104
msgid "Table copied successfully."
105
msgid_plural "Tables copied successfully."
106
msgstr[0] "Tabulka byla úspěšně zkopírována."
107
msgstr[1] "Tabulky byly úspěšně zkopírovány."
108
msgstr[2] "Tabulky byly úspěšně zkopírovány."
109
110
- #: wp-table-reloaded-admin.php:315
111
msgid "Table deleted successfully."
112
msgid_plural "Tables deleted successfully."
113
msgstr[0] "Tabulka byla úspěšně smazána."
114
msgstr[1] "Tabulky byly úspěšně smazány."
115
msgstr[2] "Tabulky byly úspěšně smazány."
116
117
- #: wp-table-reloaded-admin.php:328
118
- #: wp-table-reloaded-admin.php:511
119
- #: wp-table-reloaded-admin.php:538
120
msgid "Table imported successfully."
121
msgid_plural "Tables imported successfully."
122
msgstr[0] "Tabulka byla úspěšně importována."
123
msgstr[1] "Tabulky byly úspěšně importovány."
124
msgstr[2] "Tabulky byly úspěšně importovány."
125
126
- #: wp-table-reloaded-admin.php:335
127
msgid "You did not select any tables!"
128
msgstr "Nevybrali jste žádnou tabulku!"
129
130
- #: wp-table-reloaded-admin.php:357
131
#, php-format
132
msgid "Table \"%s\" copied successfully."
133
msgstr "Tabulka \"%s\" byla úspěšně zkopírována."
134
135
- #: wp-table-reloaded-admin.php:373
136
#, php-format
137
msgid "Table \"%s\" deleted successfully."
138
msgstr "Tabulka \"%s\" byla úspěšně smazána."
139
140
- #: wp-table-reloaded-admin.php:383
141
msgid "Row deleted successfully."
142
msgstr "Řádek byl úspěšně smazán."
143
144
- #: wp-table-reloaded-admin.php:396
145
msgid "Column deleted successfully."
146
msgstr "Sloupec byl úspěšně smazán."
147
148
- #: wp-table-reloaded-admin.php:401
149
msgid "Delete failed."
150
msgstr "Při mazání došlo k chybě."
151
152
- #: wp-table-reloaded-admin.php:426
153
msgid "Row inserted successfully."
154
msgstr "Řádek byl úspěšně vložen."
155
156
- #: wp-table-reloaded-admin.php:435
157
msgid "Column inserted successfully."
158
msgstr "Sloupec byl úspěšně vložen."
159
160
- #: wp-table-reloaded-admin.php:438
161
msgid "Insert failed."
162
msgstr "Při vkládání došlo k chybě."
163
164
- #: wp-table-reloaded-admin.php:466
165
- #: wp-table-reloaded-admin.php:475
166
- #: wp-table-reloaded-admin.php:485
167
msgid "Imported Table"
168
msgstr "Importovaná tabulka"
169
170
- #: wp-table-reloaded-admin.php:467
171
- #: wp-table-reloaded-admin.php:486
172
#, php-format
173
msgid "from %s"
174
msgstr "z %s"
175
176
- #: wp-table-reloaded-admin.php:476
177
msgid "via form"
178
msgstr "pomocí formuláře"
179
180
- #: wp-table-reloaded-admin.php:495
181
- #: wp-table-reloaded-admin.php:520
182
msgid "Table could not be imported."
183
msgstr "Tabulka nemohla být importována."
184
185
- #: wp-table-reloaded-admin.php:507
186
#, php-format
187
msgid "Table %s (%s) replaced successfully."
188
msgstr "Tabulka %s (%s) byla úspěšně nahrazena."
189
190
- #: wp-table-reloaded-admin.php:565
191
#, php-format
192
msgid "Table \"%s\" exported successfully."
193
msgstr "Tabulka \"%s\" byla úspěšně exportována."
194
195
- #: wp-table-reloaded-admin.php:593
196
msgid "Options saved successfully."
197
msgstr "Nastavení bylo úspěšně uloženo."
198
199
#. #-#-#-#-# plugin.pot (PACKAGE VERSION) #-#-#-#-#
200
#. Plugin Name of an extension
201
- #: wp-table-reloaded-admin.php:611
202
msgid "WP-Table Reloaded"
203
- msgstr "WP-Table Reloaded"
204
205
- #: wp-table-reloaded-admin.php:612
206
msgid "Plugin deactivated successfully."
207
msgstr "Plugin byl úspěšně deaktivován."
208
209
- #: wp-table-reloaded-admin.php:613
210
msgid "All tables, data and options were deleted. You may now remove the plugin's subfolder from your WordPress plugin folder."
211
msgstr "Všechny tabulky, jejich data a nastavení byly smazány. Nyní můžete smazat i samotnou složku pluginu, která se nachází ve Vašem adresáři s pluginy Wordpressu."
212
213
- #: wp-table-reloaded-admin.php:629
214
- #: wp-table-reloaded-admin.php:689
215
msgid "List of Tables"
216
msgstr "Správa tabulek"
217
218
- #: wp-table-reloaded-admin.php:631
219
- #: wp-table-reloaded-admin.php:692
220
msgid "This is a list of all available tables."
221
msgstr "Zde vidíte přehled všech dosud vytvořených tabulek."
222
223
- #: wp-table-reloaded-admin.php:631
224
msgid "You may insert a table into a post or page here."
225
msgstr "Můžete vybranou tabulku vložit přímo do příspěvku nebo stránky."
226
227
- #: wp-table-reloaded-admin.php:632
228
msgid "Click the \"Insert\" link after the desired table and the corresponding shortcode will be inserted into the editor (<strong>[table id=&lt;the_table_ID&gt; /]</strong>)."
229
msgstr "Vyberte si tabulku a klikněte na odkaz \"Vložit\", čímž bude odpovídající zkrácený zápis (<strong>[table id=&lt;the_table_ID&gt; /]</strong>) automaticky vložen."
230
231
- #: wp-table-reloaded-admin.php:640
232
- #: wp-table-reloaded-admin.php:704
233
- #: wp-table-reloaded-admin.php:1135
234
msgid "ID"
235
msgstr "ID"
236
237
- #: wp-table-reloaded-admin.php:641
238
- #: wp-table-reloaded-admin.php:705
239
- #: wp-table-reloaded-admin.php:773
240
- #: wp-table-reloaded-admin.php:826
241
- #: wp-table-reloaded-admin.php:1136
242
msgid "Table Name"
243
msgstr "Název tabulky"
244
245
- #: wp-table-reloaded-admin.php:642
246
- #: wp-table-reloaded-admin.php:706
247
- #: wp-table-reloaded-admin.php:777
248
- #: wp-table-reloaded-admin.php:830
249
- #: wp-table-reloaded-admin.php:1137
250
msgid "Description"
251
msgstr "Stručný popis"
252
253
- #: wp-table-reloaded-admin.php:643
254
- #: wp-table-reloaded-admin.php:707
255
- #: wp-table-reloaded-admin.php:1138
256
msgid "Action"
257
msgstr "Akce"
258
259
- #: wp-table-reloaded-admin.php:663
260
msgid "Insert"
261
msgstr "Vložit"
262
263
- #: wp-table-reloaded-admin.php:672