WordPress.org

Plugin Directory

Changeset 598765


Ignore:
Timestamp:
09/13/12 21:40:55 (20 months ago)
Author:
TobiasBg
Message:

Update to a new alpha version 0.5-alpha. Use at your own risk!

Location:
tablepress/trunk
Files:
2 added
36 edited

Legend:

Unmodified
Added
Removed
  • tablepress/trunk/admin/codemirror.css

    r589540 r598765  
    174174 
    175175/* CodeMirror Styling for TablePress page/customizations compared to original CSS in this file */ 
     176#option-custom-css, 
     177#tablepress-page .CodeMirror { 
     178    font-family: Consolas, Monaco, monospace; 
     179    font-size: 12px; 
     180    line-height: inherit; 
     181    margin-bottom: 6px; 
     182} 
     183#option-custom-css { 
     184    width: 98%; 
     185    height: 102px; 
     186    margin: 1px; 
     187} 
    176188#tablepress-page .CodeMirror-scroll { 
    177189    background-color: #ffffff; 
     
    183195    cursor: text; 
    184196    width: 98%; 
     197    height: 100px; 
    185198    margin: 1px; 
    186199} 
     200#tablepress-page .CodeMirror-lines { 
     201    padding: 3px; 
     202} 
     203#tablepress-page .CodeMirror-scroll.disabled { 
     204    background-color: #eeeeee; 
     205    height: 100px !important; 
     206} 
     207#option-custom-css:focus, 
    187208#tablepress-page .CodeMirror-focused { 
    188     border-color: #bbbbbb; 
    189 } 
    190 #tablepress-page .CodeMirror-scroll { 
    191     height: 100px; 
    192 } 
    193 #option-custom-css, 
     209    border-color: #a1a1a1; 
     210    -webkit-box-shadow: 1px 1px 2px rgba(0,0,0,0.1); 
     211    box-shadow: 1px 1px 2px rgba(0,0,0,0.1); 
     212} 
    194213#tablepress-page .large .CodeMirror-scroll { 
    195     height: 250px; 
    196 } 
     214    height: 300px; 
     215} 
  • tablepress/trunk/admin/codemirror.min.css

    r589540 r598765  
    1 .CodeMirror{line-height:1em;font-family:monospace;position:relative;overflow:hidden}.CodeMirror-scroll{overflow:auto;height:300px;position:relative;outline:0}.CodeMirror-scrollbar{position:absolute;right:0;top:0;overflow-x:hidden;overflow-y:scroll;z-index:5}.CodeMirror-scrollbar-inner{width:1px}.CodeMirror-scrollbar.cm-sb-overlap{position:absolute;z-index:1;float:none;right:0;min-width:12px}.CodeMirror-scrollbar.cm-sb-nonoverlap{min-width:12px}.CodeMirror-scrollbar.cm-sb-ie7{min-width:18px}.CodeMirror-gutter{position:absolute;left:0;top:0;z-index:10;background-color:#f7f7f7;border-right:1px solid #eee;min-width:2em;height:100%}.CodeMirror-gutter-text{color:#aaa;text-align:right;padding:.4em .2em .4em .4em;white-space:pre!important;cursor:default}.CodeMirror-lines{padding:.4em;white-space:pre;cursor:text}.CodeMirror pre{-moz-border-radius:0;-webkit-border-radius:0;-o-border-radius:0;border-radius:0;border-width:0;margin:0;padding:0;background:transparent;font-family:inherit;font-size:inherit;padding:0;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit}.CodeMirror-wrap pre{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-wrap .CodeMirror-scroll{overflow-x:hidden}.CodeMirror textarea{outline:none!important}.CodeMirror pre.CodeMirror-cursor{z-index:10;position:absolute;visibility:hidden;border-left:1px solid black;border-right:0;width:0}.cm-keymap-fat-cursor pre.CodeMirror-cursor{width:auto;border:0;background:transparent;background:rgba(0,200,0,.4);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#6600c800,endColorstr=#4c00c800)}.cm-keymap-fat-cursor pre.CodeMirror-cursor:not(#nonsense_id){filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.CodeMirror-focused pre.CodeMirror-cursor{visibility:visible}div.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused div.CodeMirror-selected{background:#d7d4f0}.CodeMirror-searching{background:#ffa;background:rgba(255,255,0,.4)}.cm-s-default span.cm-keyword{color:#708}.cm-s-default span.cm-atom{color:#219}.cm-s-default span.cm-number{color:#164}.cm-s-default span.cm-def{color:#00f}.cm-s-default span.cm-variable{color:black}.cm-s-default span.cm-variable-2{color:#05a}.cm-s-default span.cm-variable-3{color:#085}.cm-s-default span.cm-property{color:black}.cm-s-default span.cm-operator{color:black}.cm-s-default span.cm-comment{color:#a50}.cm-s-default span.cm-string{color:#a11}.cm-s-default span.cm-string-2{color:#f50}.cm-s-default span.cm-meta{color:#555}.cm-s-default span.cm-error{color:#f00}.cm-s-default span.cm-qualifier{color:#555}.cm-s-default span.cm-builtin{color:#30a}.cm-s-default span.cm-bracket{color:#cc7}.cm-s-default span.cm-tag{color:#170}.cm-s-default span.cm-attribute{color:#00c}.cm-s-default span.cm-header{color:blue}.cm-s-default span.cm-quote{color:#090}.cm-s-default span.cm-hr{color:#999}.cm-s-default span.cm-link{color:#00c}span.cm-header,span.cm-strong{font-weight:bold}span.cm-em{font-style:italic}span.cm-emstrong{font-style:italic;font-weight:bold}span.cm-link{text-decoration:underline}span.cm-invalidchar{color:#f00}div.CodeMirror span.CodeMirror-matchingbracket{color:#0f0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#f22}@media print{.CodeMirror pre.CodeMirror-cursor{visibility:hidden}}#tablepress-page .CodeMirror-scroll{background-color:#fff;border-color:#dfdfdf;-webkit-border-radius:3px;border-radius:3px;border-width:1px;border-style:solid;cursor:text;width:98%;margin:1px}#tablepress-page .CodeMirror-focused{border-color:#bbb}#tablepress-page .CodeMirror-scroll{height:100px}#option-custom-css,#tablepress-page .large .CodeMirror-scroll{height:250px} 
     1.CodeMirror{line-height:1em;font-family:monospace;position:relative;overflow:hidden}.CodeMirror-scroll{overflow:auto;height:300px;position:relative;outline:0}.CodeMirror-scrollbar{position:absolute;right:0;top:0;overflow-x:hidden;overflow-y:scroll;z-index:5}.CodeMirror-scrollbar-inner{width:1px}.CodeMirror-scrollbar.cm-sb-overlap{position:absolute;z-index:1;float:none;right:0;min-width:12px}.CodeMirror-scrollbar.cm-sb-nonoverlap{min-width:12px}.CodeMirror-scrollbar.cm-sb-ie7{min-width:18px}.CodeMirror-gutter{position:absolute;left:0;top:0;z-index:10;background-color:#f7f7f7;border-right:1px solid #eee;min-width:2em;height:100%}.CodeMirror-gutter-text{color:#aaa;text-align:right;padding:.4em .2em .4em .4em;white-space:pre!important;cursor:default}.CodeMirror-lines{padding:.4em;white-space:pre;cursor:text}.CodeMirror pre{-moz-border-radius:0;-webkit-border-radius:0;-o-border-radius:0;border-radius:0;border-width:0;margin:0;padding:0;background:transparent;font-family:inherit;font-size:inherit;padding:0;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit}.CodeMirror-wrap pre{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-wrap .CodeMirror-scroll{overflow-x:hidden}.CodeMirror textarea{outline:none!important}.CodeMirror pre.CodeMirror-cursor{z-index:10;position:absolute;visibility:hidden;border-left:1px solid black;border-right:0;width:0}.cm-keymap-fat-cursor pre.CodeMirror-cursor{width:auto;border:0;background:transparent;background:rgba(0,200,0,.4);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#6600c800,endColorstr=#4c00c800)}.cm-keymap-fat-cursor pre.CodeMirror-cursor:not(#nonsense_id){filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.CodeMirror-focused pre.CodeMirror-cursor{visibility:visible}div.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused div.CodeMirror-selected{background:#d7d4f0}.CodeMirror-searching{background:#ffa;background:rgba(255,255,0,.4)}.cm-s-default span.cm-keyword{color:#708}.cm-s-default span.cm-atom{color:#219}.cm-s-default span.cm-number{color:#164}.cm-s-default span.cm-def{color:#00f}.cm-s-default span.cm-variable{color:black}.cm-s-default span.cm-variable-2{color:#05a}.cm-s-default span.cm-variable-3{color:#085}.cm-s-default span.cm-property{color:black}.cm-s-default span.cm-operator{color:black}.cm-s-default span.cm-comment{color:#a50}.cm-s-default span.cm-string{color:#a11}.cm-s-default span.cm-string-2{color:#f50}.cm-s-default span.cm-meta{color:#555}.cm-s-default span.cm-error{color:#f00}.cm-s-default span.cm-qualifier{color:#555}.cm-s-default span.cm-builtin{color:#30a}.cm-s-default span.cm-bracket{color:#cc7}.cm-s-default span.cm-tag{color:#170}.cm-s-default span.cm-attribute{color:#00c}.cm-s-default span.cm-header{color:blue}.cm-s-default span.cm-quote{color:#090}.cm-s-default span.cm-hr{color:#999}.cm-s-default span.cm-link{color:#00c}span.cm-header,span.cm-strong{font-weight:bold}span.cm-em{font-style:italic}span.cm-emstrong{font-style:italic;font-weight:bold}span.cm-link{text-decoration:underline}span.cm-invalidchar{color:#f00}div.CodeMirror span.CodeMirror-matchingbracket{color:#0f0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#f22}@media print{.CodeMirror pre.CodeMirror-cursor{visibility:hidden}}#option-custom-css,#tablepress-page .CodeMirror{font-family:Consolas,Monaco,monospace;font-size:12px;line-height:inherit;margin-bottom:6px}#option-custom-css{width:98%;height:102px;margin:1px}#tablepress-page .CodeMirror-scroll{background-color:#fff;border-color:#dfdfdf;-webkit-border-radius:3px;border-radius:3px;border-width:1px;border-style:solid;cursor:text;width:98%;height:100px;margin:1px}#tablepress-page .CodeMirror-lines{padding:3px}#tablepress-page .CodeMirror-scroll.disabled{background-color:#eee;height:100px!important}#option-custom-css:focus,#tablepress-page .CodeMirror-focused{border-color:#a1a1a1;-webkit-box-shadow:1px 1px 2px rgba(0,0,0,0.1);box-shadow:1px 1px 2px rgba(0,0,0,0.1)}#tablepress-page .large .CodeMirror-scroll{height:300px} 
  • tablepress/trunk/admin/common.css

    r589540 r598765  
    116116    padding: 0; 
    117117    font-weight: bold; 
     118    -webkit-box-shadow: none; 
     119    box-shadow: none; 
    118120} 
    119121#tablepress-page .table-shortcode { 
  • tablepress/trunk/admin/common.js

    r589540 r598765  
    7373     * @since 1.0.0 
    7474     */ 
    75     $( '#tablepress-page' ) 
    76     .on( 'blur', '.numbers-only, .form-field-numbers-only input', function( event ) { 
     75    $( '#tablepress-page' ).on( 'blur', '.numbers-only, .form-field-numbers-only input', function( event ) { 
    7776        var $input = $(this); 
    7877        $input.val( $input.val().replace( /[^0-9]/g, '' ) ); 
     
    8483     * @since 1.0.0 
    8584     */ 
    86     $( '#tablepress-page' ) 
    87     .on( 'click', '.delete-link', function() { 
     85    $( '#tablepress-page' ).on( 'click', '.delete-link', function() { 
    8886        if ( ! confirm( tablepress_common.ays_delete_single_table ) ) 
    8987            return false; 
     
    9896     * @since 1.0.0 
    9997     */ 
    100     $( '#tablepress-page' ) 
    101     .on( 'click', '.table-shortcode', function() { 
     98    $( '#tablepress-page' ).on( 'click', '.table-shortcode', function() { 
    10299        $(this).focus().select(); 
    103100    } ); 
    104101 
    105  
    106     /** 
    107      * "Custom CSS" textarea grows on focus, once 
    108      * 
    109      * @since 1.0.0 
    110      */ 
    111     $( '#tablepress-page' ).find( '.CodeMirror' ).one( 'click', function() { 
    112         $(this).addClass( 'large' ); 
    113     } ); 
    114  
    115102} ); 
  • tablepress/trunk/admin/common.min.css

    r589540 r598765  
    1 #icon-tablepress{background-image:url('tablepress-icon.png')}@media only screen and (-webkit-min-device-pixel-ratio:1.5){#icon-tablepress{background-image:url('tablepress-icon-2x.png');background-size:36px 36px}}#icon-tablepress_options_invisible{display:none}#tablepress-page div.updated,#tablepress-page div.error{margin:10px 0 0}#tablepress-nav .separator{margin:6px}#tablepress-nav .nav-tab{color:#21759b}#tablepress-nav .nav-tab:hover{color:#d54e21}#tablepress-nav .nav-tab-active{padding-bottom:5px;text-shadow:1px 1px 1px #fff;color:#333}#tablepress-nav .nav-tab-active:hover{color:#464646}#tablepress_add-add-table div.inside{margin:6px;padding:0}#tablepress_add-add-table .form-wrap{max-width:500px}#tablepress_add-add-table .form-field{margin:0;padding:5px}#tablepress_add-add-table .form-field-small{float:left;width:150px;margin-right:20px}.js #tablepress-page .placeholder-active{color:#bbb}.tablepress-all-tables thead .column-table_id{width:50px}.tablepress-all-tables thead .column-table_name{width:30%}.tablepress-all-tables thead .column-table_author{width:12%}.tablepress-all-tables thead .column-table_last_modified{width:15%}.tablepress-all-tables tbody .column-table_id{font-weight:bold}.tablenav #bulk-action-top,.tablenav #bulk-action-bottom{width:130px}#tablepress-page .subtitle{float:left;padding-left:0}#tablepress-page textarea{outline:0}#tablepress-page .table-shortcode-inline{background:transparent;border:0;color:#333;width:90px;margin:0;padding:0;font-weight:bold}#tablepress-page .table-shortcode{cursor:text}.no-js .postbox:hover .handlediv{background-image:none!important;cursor:auto}.no-js .postbox .hndle{cursor:auto;color:#464646}#tables-export{width:100%}#tablepress-page form :invalid,#tablepress-page form .invalid{border-color:#c00!important}.tablepress-postbox-table{border-spacing:0;width:800px}.tablepress-postbox-table .column-1{width:175px}.tablepress-postbox-table .column-2{width:625px}.tablepress-postbox-table th{text-align:left;font-weight:normal}.tablepress-postbox-table .top-align{vertical-align:top;padding-top:7px}.tablepress-postbox-table th,.tablepress-postbox-table td{padding:6px 6px 2px 2px;border-spacing:0;word-wrap:break-word}.tablepress-postbox-table .top-border th,.tablepress-postbox-table .top-border td{padding:6px 6px 2px 2px;border-top:1px solid #fff}.tablepress-postbox-table .bottom-border th,.tablepress-postbox-table .bottom-border td{padding:2px 6px 6px 2px;border-bottom:1px solid #dfdfdf}.tablepress-postbox-table .no-border th,.tablepress-postbox-table .no-border td{padding:2px 6px 2px 2px}.tablepress-postbox-table .top-border.bottom-border th,.tablepress-postbox-table .top-border.bottom-border td{padding:6px 6px 6px 2px}.tablepress-postbox-table .top-align{vertical-align:top;padding-top:7px}.tablepress-postbox-table .top-border .top-align{padding-top:7px}.tablepress-postbox-table .bottom-border .top-align{padding-top:4px}#tablepress_export-export-form .column-2 label,#tablepress_import-import-form .column-2 label{vertical-align:top}#tables-import-url,#tables-import-server{margin-bottom:4px}#tablepress_import-import-form .column-2 input[type="radio"]{margin-left:5px} 
     1#icon-tablepress{background-image:url('tablepress-icon.png')}@media only screen and (-webkit-min-device-pixel-ratio:1.5){#icon-tablepress{background-image:url('tablepress-icon-2x.png');background-size:36px 36px}}#icon-tablepress_options_invisible{display:none}#tablepress-page div.updated,#tablepress-page div.error{margin:10px 0 0}#tablepress-nav .separator{margin:6px}#tablepress-nav .nav-tab{color:#21759b}#tablepress-nav .nav-tab:hover{color:#d54e21}#tablepress-nav .nav-tab-active{padding-bottom:5px;text-shadow:1px 1px 1px #fff;color:#333}#tablepress-nav .nav-tab-active:hover{color:#464646}#tablepress_add-add-table div.inside{margin:6px;padding:0}#tablepress_add-add-table .form-wrap{max-width:500px}#tablepress_add-add-table .form-field{margin:0;padding:5px}#tablepress_add-add-table .form-field-small{float:left;width:150px;margin-right:20px}.js #tablepress-page .placeholder-active{color:#bbb}.tablepress-all-tables thead .column-table_id{width:50px}.tablepress-all-tables thead .column-table_name{width:30%}.tablepress-all-tables thead .column-table_author{width:12%}.tablepress-all-tables thead .column-table_last_modified{width:15%}.tablepress-all-tables tbody .column-table_id{font-weight:bold}.tablenav #bulk-action-top,.tablenav #bulk-action-bottom{width:130px}#tablepress-page .subtitle{float:left;padding-left:0}#tablepress-page textarea{outline:0}#tablepress-page .table-shortcode-inline{background:transparent;border:0;color:#333;width:90px;margin:0;padding:0;font-weight:bold;-webkit-box-shadow:none;box-shadow:none}#tablepress-page .table-shortcode{cursor:text}.no-js .postbox:hover .handlediv{background-image:none!important;cursor:auto}.no-js .postbox .hndle{cursor:auto;color:#464646}#tables-export{width:100%}#tablepress-page form :invalid,#tablepress-page form .invalid{border-color:#c00!important}.tablepress-postbox-table{border-spacing:0;width:800px}.tablepress-postbox-table .column-1{width:175px}.tablepress-postbox-table .column-2{width:625px}.tablepress-postbox-table th{text-align:left;font-weight:normal}.tablepress-postbox-table .top-align{vertical-align:top;padding-top:7px}.tablepress-postbox-table th,.tablepress-postbox-table td{padding:6px 6px 2px 2px;border-spacing:0;word-wrap:break-word}.tablepress-postbox-table .top-border th,.tablepress-postbox-table .top-border td{padding:6px 6px 2px 2px;border-top:1px solid #fff}.tablepress-postbox-table .bottom-border th,.tablepress-postbox-table .bottom-border td{padding:2px 6px 6px 2px;border-bottom:1px solid #dfdfdf}.tablepress-postbox-table .no-border th,.tablepress-postbox-table .no-border td{padding:2px 6px 2px 2px}.tablepress-postbox-table .top-border.bottom-border th,.tablepress-postbox-table .top-border.bottom-border td{padding:6px 6px 6px 2px}.tablepress-postbox-table .top-align{vertical-align:top;padding-top:7px}.tablepress-postbox-table .top-border .top-align{padding-top:7px}.tablepress-postbox-table .bottom-border .top-align{padding-top:4px}#tablepress_export-export-form .column-2 label,#tablepress_import-import-form .column-2 label{vertical-align:top}#tables-import-url,#tables-import-server{margin-bottom:4px}#tablepress_import-import-form .column-2 input[type="radio"]{margin-left:5px} 
  • tablepress/trunk/admin/common.min.js

    r589540 r598765  
    11jQuery(document).ready(function(a){postboxes.add_postbox_toggles(pagenow);a("#tablepress-page").on("click",".ajax-link",function(){var b=this,c=b.className.replace(/^.*ajax-link /,"");a.get(ajaxurl,b.href.split("?")["1"],function(d){if("1"==d)switch(c){case "hide_message":a(b).closest("div").remove()}});return!1});a("#tablepress-page").on("focus",".placeholder",function(){this.value==this.defaultValue&&(this.value="",a(this).removeClass("placeholder-active"))}).on("blur",".placeholder",function(){""== 
    2 this.value&&(this.value=this.defaultValue,a(this).addClass("placeholder-active"))});a("#tablepress-page").on("blur",".numbers-only, .form-field-numbers-only input",function(){var b=a(this);b.val(b.val().replace(/[^0-9]/g,""))});a("#tablepress-page").on("click",".delete-link",function(){if(!confirm(tablepress_common.ays_delete_single_table))return!1;"undefined"!=typeof tp&&(tp.made_changes=!1)});a("#tablepress-page").on("click",".table-shortcode",function(){a(this).focus().select()});a("#tablepress-page").find(".CodeMirror").one("click", 
    3 function(){a(this).addClass("large")})}); 
     2this.value&&(this.value=this.defaultValue,a(this).addClass("placeholder-active"))});a("#tablepress-page").on("blur",".numbers-only, .form-field-numbers-only input",function(){var b=a(this);b.val(b.val().replace(/[^0-9]/g,""))});a("#tablepress-page").on("click",".delete-link",function(){if(!confirm(tablepress_common.ays_delete_single_table))return!1;"undefined"!=typeof tp&&(tp.made_changes=!1)});a("#tablepress-page").on("click",".table-shortcode",function(){a(this).focus().select()})}); 
  • tablepress/trunk/admin/edit.css

    r589540 r598765  
    147147#edit-form-body .head-row, 
    148148#edit-form-body .foot-row { 
    149     background-color: #c0dddd; 
     149    background-color: #d9edf7; 
    150150} 
    151151 
     
    188188    width: 50%; 
    189189} 
    190  
    191 /* adjust size of a.button-secondary to input.button-secondary */ 
    192 #tablepress-page a.button-secondary { 
    193     padding: 3px 8px; 
    194     display: inline-block; 
    195     margin: 1px; 
    196     line-height: 13px; 
    197 } 
  • tablepress/trunk/admin/edit.js

    r589540 r598765  
    4141            }, 
    4242            change_id: function( /* event */ ) { 
     43                // empty table IDs are not allowed 
    4344                if ( '' === $.trim( $( '#table-new-id' ).val() ) ) { 
    4445                    alert( tablepress_strings.table_id_not_empty ); 
     46                    $( '#table-new-id' ).val( tp.table.new_id ).focus().select(); 
     47                    return; 
     48                } 
     49                // the '0' table ID is not allowed 
     50                if ( '0' === $.trim( $( '#table-new-id' ).val() ) ) { 
     51                    alert( tablepress_strings.table_id_not_zero ); 
    4552                    $( '#table-new-id' ).val( tp.table.new_id ).focus().select(); 
    4653                    return; 
     
    363370                        if (yD) { 
    364371                            if ( xD < yD ) return -1; 
    365                             else if ( xD > yD ) return 1; 
     372                            else if ( xD > yD ) return 1; 
    366373                        } 
    367374                        // natural sorting through split numeric strings and default strings 
     
    987994                    '#span-add-rowspan':    function() { tp.content.span.add( '#rowspan#' ); }, 
    988995                    '#span-add-colspan':    function() { tp.content.span.add( '#colspan#' ); }, 
    989                     '.show-preview-button': tp.table.preview.trigger, 
    990                     '.save-changes-button': tp.save_changes.trigger, 
     996                    '.show-preview-button': tp.table.preview.trigger, 
     997                    '.save-changes-button': tp.save_changes.trigger, 
    991998                    '.show-help-box':       function() { 
    992999                        $(this).next().wpdialog( { 
  • tablepress/trunk/admin/edit.min.css

    r589540 r598765  
    1 body.wait *{cursor:wait!important}.hidden-container{display:none}.hidden-help-box-container p{margin:6px}#TB_HideSelect{z-index:301099}#TB_overlay{z-index:301100}#TB_window{z-index:301102}#TB_load{z-index:301103}#table-preview-iframe{width:100%;height:100%;margin:0;border:0}#advanced-editor{padding:0 3px 3px}#advanced-editor .submitbox{padding:6px 6px 0;font-size:11px;overflow:auto;height:28px}#advanced-editor-confirm{float:right}#advanced-editor-cancel{line-height:25px}.animation-saving,.animation-preview{display:inline-block;background:url(../../../../wp-admin/images/wpspin_light.gif);height:16px;width:16px;margin:4px 0 0 5px;vertical-align:top}#tablepress-page div.save-changes-success,#tablepress-page div.save-changes-error,#tablepress-page div.preview-error{margin:0 0 15px}#edit-form-body td{padding:2px 2px 2px 0;height:32px}#edit-form-body .focus td{height:60px}#edit-form-body .odd{background-color:#eee}#edit-form-body textarea{display:block;width:150px;height:100%}#edit-form-body textarea:focus{border-color:#000}#edit-form-body input[type="checkbox"]{margin-right:3px}#edit-form-foot input[type="checkbox"]{margin-top:6px}#edit-form{border-collapse:collapse}#edit-form .move-handle{display:block;margin:auto;width:16px;height:16px;cursor:move;text-align:center;font-weight:bold}.no-js #edit-form .move-handle{cursor:auto}#edit-form-body .move-handle{margin:auto 3px;min-width:16px;width:auto}#edit-form .move-hover{position:absolute;z-index:1000;height:26px}#edit-form .focus .move-hover{height:54px}#edit-form-body .head-row,#edit-form-body .foot-row{background-color:#c0dddd}#edit-form-head th{height:16px;vertical-align:top}#edit-form-head .sort-control{display:none;float:right;width:12px;height:12px;cursor:pointer;margin:2px 3px 0 0}.js #edit-form-head .head:hover .sort-control{display:block}.js #edit-form-head .ui-sortable-helper:hover .sort-control{display:none}#edit-form-head .sort-asc{background:url(img/sort-asc.gif) no-repeat center center}#edit-form-head .sort-desc{background:url(img/sort-desc.gif) no-repeat center center}#edit-form .row-hidden td,#edit-form .row-hidden textarea,#edit-form .column-hidden,#edit-form .column-hidden textarea{background-color:#ffe0e0}#tablepress_edit-table-manipulation td{width:50%}#tablepress-page a.button-secondary{padding:3px 8px;display:inline-block;margin:1px;line-height:13px} 
     1body.wait *{cursor:wait!important}.hidden-container{display:none}.hidden-help-box-container p{margin:6px}#TB_HideSelect{z-index:301099}#TB_overlay{z-index:301100}#TB_window{z-index:301102}#TB_load{z-index:301103}#table-preview-iframe{width:100%;height:100%;margin:0;border:0}#advanced-editor{padding:0 3px 3px}#advanced-editor .submitbox{padding:6px 6px 0;font-size:11px;overflow:auto;height:28px}#advanced-editor-confirm{float:right}#advanced-editor-cancel{line-height:25px}.animation-saving,.animation-preview{display:inline-block;background:url(../../../../wp-admin/images/wpspin_light.gif);height:16px;width:16px;margin:4px 0 0 5px;vertical-align:top}#tablepress-page div.save-changes-success,#tablepress-page div.save-changes-error,#tablepress-page div.preview-error{margin:0 0 15px}#edit-form-body td{padding:2px 2px 2px 0;height:32px}#edit-form-body .focus td{height:60px}#edit-form-body .odd{background-color:#eee}#edit-form-body textarea{display:block;width:150px;height:100%}#edit-form-body textarea:focus{border-color:#000}#edit-form-body input[type="checkbox"]{margin-right:3px}#edit-form-foot input[type="checkbox"]{margin-top:6px}#edit-form{border-collapse:collapse}#edit-form .move-handle{display:block;margin:auto;width:16px;height:16px;cursor:move;text-align:center;font-weight:bold}.no-js #edit-form .move-handle{cursor:auto}#edit-form-body .move-handle{margin:auto 3px;min-width:16px;width:auto}#edit-form .move-hover{position:absolute;z-index:1000;height:26px}#edit-form .focus .move-hover{height:54px}#edit-form-body .head-row,#edit-form-body .foot-row{background-color:#d9edf7}#edit-form-head th{height:16px;vertical-align:top}#edit-form-head .sort-control{display:none;float:right;width:12px;height:12px;cursor:pointer;margin:2px 3px 0 0}.js #edit-form-head .head:hover .sort-control{display:block}.js #edit-form-head .ui-sortable-helper:hover .sort-control{display:none}#edit-form-head .sort-asc{background:url(img/sort-asc.gif) no-repeat center center}#edit-form-head .sort-desc{background:url(img/sort-desc.gif) no-repeat center center}#edit-form .row-hidden td,#edit-form .row-hidden textarea,#edit-form .column-hidden,#edit-form .column-hidden textarea{background-color:#ffe0e0}#tablepress_edit-table-manipulation td{width:50%} 
  • tablepress/trunk/admin/edit.min.js

    r589540 r598765  
    11jQuery(document).ready(function(a){window.tp={made_changes:!1,table:{id:a("#table-id").val(),new_id:a("#table-new-id").val(),rows:a("#number-rows").val(),columns:a("#number-columns").val(),head:a("#option-table-head").prop("checked"),foot:a("#option-table-foot").prop("checked"),no_data_columns_pre:2,no_data_columns_post:1,body_cells_pre:'<tr><td><span class="move-handle"></span></td><td><input type="checkbox" /><input type="hidden" class="visibility" name="table[visibility][rows][]" value="1" /></td>', 
    22body_cells_post:'<td><span class="move-handle"></span></td></tr>',body_cell:'<td><textarea rows="1"></textarea></td>',head_cell:'<th class="head"><span class="sort-control sort-desc" title="'+tablepress_strings.sort_desc+'"></span><span class="sort-control sort-asc" title="'+tablepress_strings.sort_asc+'"></span><span class="move-handle"></span></th>',foot_cell:'<th><input type="checkbox" /><input type="hidden" class="visibility" name="table[visibility][columns][]" value="1" /></th>',set_table_changed:function(){tp.made_changes= 
    3 !0},unset_table_changed:function(){tp.made_changes=!1;a("#edit-form-body").one("change","textarea",tp.table.set_table_changed);a("#tablepress_edit-table-information, #tablepress_edit-table-options, #tablepress_edit-datatables-features").one("change","input, textarea, select",tp.table.set_table_changed)},change_id:function(){""===a.trim(a("#table-new-id").val())?(alert(tablepress_strings.table_id_not_empty),a("#table-new-id").val(tp.table.new_id).focus().select()):this.value!=tp.table.new_id&&(confirm(tablepress_strings.ays_change_table_id)? 
    4 (tp.table.new_id=this.value,a(".table-shortcode").val("["+tablepress_options.shortcode+" id="+tp.table.new_id+" /]").click(),tp.table.set_table_changed()):a(this).val(tp.table.new_id))},change_table_head:function(){tp.table.head=a(this).prop("checked");a("#option-use-datatables").prop("disabled",!tp.table.head).change();a("#notice-datatables-head-row").toggle(!tp.table.head);tp.rows.stripe()},change_table_foot:function(){tp.table.foot=a(this).prop("checked");tp.rows.stripe()},change_datatables:function(){var b= 
    5 a("#option-use-datatables"),c=!(b.prop("checked")&&!b.prop("disabled"));b.closest("tbody").find("input").not(b).prop("disabled",c);tp.table.change_datatables_pagination()},change_datatables_pagination:function(){var b=a("#option-datatables-paginate"),b=b.prop("checked")&&!b.prop("disabled");a("#option-datatables-lengthchange").prop("disabled",!b);a("#option-datatables-paginate_entries").prop("disabled",!b)},prepare_ajax_request:function(b,c){var d=a("#edit-form-body"),e=[],f,h={rows:tp.table.rows, 
    6 columns:tp.table.columns,hidden_rows:0,hidden_columns:0},g={rows:[],columns:[]};d.children().each(function(b,c){e[b]=a(c).find("textarea").map(function(){return a(this).val()}).get()});e=JSON.stringify(e);f={table_head:tp.table.head,table_foot:tp.table.foot,alternating_row_colors:a("#option-alternating-row-colors").prop("checked"),row_hover:a("#option-row-hover").prop("checked"),print_name:a("#option-print-name").val(),print_description:a("#option-print-description").val(),extra_css_classes:a("#option-extra-css-classes").val(), 
    7 use_datatables:a("#option-use-datatables").prop("checked"),datatables_sort:a("#option-datatables-sort").prop("checked"),datatables_filter:a("#option-datatables-filter").prop("checked"),datatables_paginate:a("#option-datatables-paginate").prop("checked"),datatables_lengthchange:a("#option-datatables-lengthchange").prop("checked"),datatables_paginate_entries:a("#option-datatables-paginate_entries").val(),datatables_info:a("#option-datatables-info").prop("checked"),datatables_scrollX:a("#option-datatables-scrollX").prop("checked"), 
    8 datatables_custom_commands:a("#option-datatables-custom-commands").val()};f=JSON.stringify(f);g.rows=d.find('input[type="hidden"]').map(function(){if("1"==a(this).val())return 1;h.hidden_rows+=1;return 0}).get();g.columns=a("#edit-form-foot").find('input[type="hidden"]').map(function(){if("1"==a(this).val())return 1;h.hidden_columns+=1;return 0}).get();g=JSON.stringify(g);return{action:b,_ajax_nonce:a(c).val(),tablepress:{id:tp.table.id,new_id:tp.table.new_id,name:a("#table-name").val(),description:a("#table-description").val(), 
    9 number:h,data:e,options:f,visibility:g}}},preview:{trigger:function(){if(!tp.made_changes)return tp.table.preview.show(a(this).attr("href")+"&TB_iframe=true"),!1;a(this).closest("p").append('<span class="animation-preview" title="'+tablepress_strings.preparing_preview+'"/>');a("body").addClass("wait");a("#table-preview").empty();a.post(ajaxurl,tp.table.prepare_ajax_request("tablepress_preview_table","#nonce-preview-table"),function(){},"json").success(tp.table.preview.ajax_success).error(tp.table.preview.ajax_error); 
    10 return!1},ajax_success:function(a,c){"undefined"==typeof c||"success"!=c?tp.table.preview.error("AJAX call successful, but unclear status."):"undefined"==typeof a||null==a||"-1"==a||"undefined"==typeof a.success||!0!==a.success?tp.table.preview.error("AJAX call successful, but unclear data."):tp.table.preview.success(a)},ajax_error:function(a,c,d){tp.table.preview.error("AJAX call failed: "+c+" - "+d)},success:function(b){a("#table-preview").empty();a('<iframe id="table-preview-iframe" />').load(function(){var c= 
    11 a(this).contents();c.find("head").append(b.head_html);c.find("body").append(b.body_html)}).appendTo("#table-preview");a(".animation-preview").remove();a("body").removeClass("wait");tp.table.preview.show("#TB_inline?inlineId=preview-container")},error:function(b){a(".animation-preview").closest("p").after('<div class="preview-error error"><p><strong>'+tablepress_strings.preview_error+": "+b+"</strong></p></div>");a(".animation-preview").remove();a(".preview-error").delay(6E3).fadeOut(2E3,function(){a(this).remove()}); 
    12 a("body").removeClass("wait")},show:function(b){var c=a(window).width()-120,d=a(window).height()-120;a("body.admin-bar").length&&(d-=28);tb_show(a(".show-preview-button").first().text(),b+"&height="+d+"&width="+c,!1)}}},rows:{create:function(b){var c,d,e,f="";for(c=0;c<b;c++){f+=tp.table.body_cells_pre;for(d=0;d<tp.table.columns;d++)f+=tp.table.body_cell;f+=tp.table.body_cells_post}e=a("#edit-form-foot").find(".column-hidden").map(function(){return a(this).index()}).get();return a(f).each(function(b, 
    13 c){a(c).children().filter(function(a){return-1!=jQuery.inArray(a,e)}).addClass("column-hidden")})},append:function(){var b=a("#rows-append-number").val();/^[1-9][0-9]{0,4}$/.test(b)?(a("#edit-form-body").append(tp.rows.create(b)),tp.rows.stripe(),tp.reindex()):(alert(tablepress_strings.append_num_rows_invalid),a("#rows-append-number").focus().select())},insert:function(b){b=a("#edit-form-body").find("input:checked").prop("checked",b.shiftKey).closest("tr");0===b.length?alert(tablepress_strings.no_rows_selected): 
    14 (b.before(tp.rows.create(1)),tp.rows.stripe(),tp.reindex())},hide:function(b){b=a("#edit-form-body").find("input:checked").prop("checked",b.shiftKey).closest("tr");0===b.length?alert(tablepress_strings.no_rows_selected):(b.addClass("row-hidden").find(".visibility").val("0"),tp.rows.stripe(),tp.table.set_table_changed())},unhide:function(b){b=a("#edit-form-body").find("input:checked").prop("checked",b.shiftKey).closest("tr");0===b.length?alert(tablepress_strings.no_rows_selected):(b.removeClass("row-hidden").find(".visibility").val("1"), 
    15 tp.rows.stripe(),tp.table.set_table_changed())},remove:function(){var b,c=a("#edit-form-body").find("input:checked").closest("tr");0===c.length?alert(tablepress_strings.no_rows_selected):tp.table.rows==c.length?alert(tablepress_strings.no_remove_all_rows):(b=1==c.length?tablepress_strings.ays_remove_rows_singular:tablepress_strings.ays_remove_rows_plural,confirm(b)&&(c.remove(),tp.rows.stripe(),tp.reindex()))},move:{start:function(b,c){a(c.placeholder).removeClass("row-hidden").css("visibility","visible").html('<td colspan="'+ 
    16 (tp.table.columns+tp.table.no_data_columns_pre+tp.table.no_data_columns_post)+'"><div/></td>');a(c.helper).removeClass("odd head-row foot-row")},change:function(a,c){tp.rows.stripe(c.helper)},stop:function(){tp.rows.stripe()}},sort:function(){var b=a(this).parent().index(),c=a(this).hasClass("sort-asc")?1:-1,d=a("#edit-form-body"),e=d.find(".head-row").prevAll().andSelf(),f=d.find(".foot-row").nextAll().andSelf(),h=d.children().not(e).not(f).get(),g=function(a,b){var c=/(^-?[0-9]+(\.?[0-9]*)[df]?e?[0-9]?$|^0x[0-9a-f]+$|[0-9]+)/gi, 
    17 d=/(^[ ]*|[ ]*$)/g,e=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,f=/^0x[0-9a-f]+$/i,h=/^0/,g=a.toString().replace(d,"")||"",i=b.toString().replace(d,"")||"",d=g.replace(c,"\x00$1\x00").replace(/\0$/,"").replace(/^\0/,"").split("\x00"),c=i.replace(c,"\x00$1\x00").replace(/\0$/,"").replace(/^\0/,"").split("\x00"),g=parseInt(g.match(f))||1!=d.length&&g.match(e)&&Date.parse(g);if(e=parseInt(i.match(f))||g&&i.match(e)&&Date.parse(i)|| 
    18 null){if(g<e)return-1;if(g>e)return 1}e=0;for(f=Math.max(d.length,c.length);e<f;e++){oFxNcL=!(d[e]||"").match(h)&&parseFloat(d[e])||d[e]||0;oFyNcL=!(c[e]||"").match(h)&&parseFloat(c[e])||c[e]||0;if(isNaN(oFxNcL)!==isNaN(oFyNcL))return isNaN(oFxNcL)?1:-1;typeof oFxNcL!==typeof oFyNcL&&(oFxNcL+="",oFyNcL+="");if(oFxNcL<oFyNcL)return-1;if(oFxNcL>oFyNcL)return 1}return 0};a.each(h,function(c,d){d.sort_key=a(d).children().eq(b).find("textarea").val().toUpperCase()});h.sort(function(a,b){return c*g(a.sort_key, 
    19 b.sort_key)});a.each(h,function(a,b){b.sort_key=null});d.append(e);d.append(h);d.append(f);tp.rows.stripe();tp.reindex()},stripe:function(b){"undefined"==typeof b&&(b=null);var b=a(b),c=a("#edit-form-body").children().removeClass("odd head-row foot-row").not(b);c.filter(":even").addClass("odd");c=c.not(".row-hidden");b.hasClass("row-hidden")&&(c=c.not(".ui-sortable-placeholder"));tp.table.head&&c.first().addClass("head-row");tp.table.foot&&c.last().addClass("foot-row")}},columns:{append:function(){var b, 
    20 c=a("#columns-append-number").val(),d=new_head_cells=new_foot_cells="";if(/^[1-9][0-9]{0,4}$/.test(c)){for(b=0;b<c;b++)d+=tp.table.body_cell,new_head_cells+=tp.table.head_cell,new_foot_cells+=tp.table.foot_cell;a("#edit-form-body").children().each(function(b,c){a(c).children().slice(-tp.table.no_data_columns_post).before(d)});a("#edit-form-head").children().slice(-tp.table.no_data_columns_post).before(new_head_cells);a("#edit-form-foot").children().slice(-tp.table.no_data_columns_post).before(new_foot_cells); 
    21 tp.reindex()}else alert(tablepress_strings.append_num_columns_invalid),a("#columns-append-number").focus().select()},insert:function(b){var c,b=a("#edit-form-foot").find("input:checked").prop("checked",b.shiftKey).closest("th");0===b.length?alert(tablepress_strings.no_columns_selected):(c=b.map(function(){return a(this).index()}).get(),a("#edit-form-body").children().each(function(b,e){a(e).children().filter(function(a){return-1!=jQuery.inArray(a,c)}).before(tp.table.body_cell)}),a("#edit-form-head").children().filter(function(a){return-1!= 
    22 jQuery.inArray(a,c)}).before(tp.table.head_cell),b.before(tp.table.foot_cell),tp.reindex())},hide:function(b){var c,b=a("#edit-form-foot").find("input:checked").prop("checked",b.shiftKey).closest("th");0===b.length?alert(tablepress_strings.no_columns_selected):(c=b.map(function(){return a(this).index()}).get(),a("#edit-form-body").children().add("#edit-form-head").each(function(b,e){a(e).children().filter(function(a){return-1!=jQuery.inArray(a,c)}).addClass("column-hidden")}),b.addClass("column-hidden").find(".visibility").val("0"), 
    23 tp.table.set_table_changed())},unhide:function(b){var c,b=a("#edit-form-foot").find("input:checked").prop("checked",b.shiftKey).closest("th");0===b.length?alert(tablepress_strings.no_columns_selected):(c=b.map(function(){return a(this).index()}).get(),a("#edit-form-body").children().add("#edit-form-head").each(function(b,e){a(e).children().filter(function(a){return-1!=jQuery.inArray(a,c)}).removeClass("column-hidden")}),b.removeClass("column-hidden").find(".visibility").val("1"),tp.table.set_table_changed())}, 
    24 remove:function(){var b,c,d=a("#edit-form-foot").find("input:checked").closest("th");0===d.length?alert(tablepress_strings.no_columns_selected):tp.table.columns==d.length?alert(tablepress_strings.no_remove_all_columns):(c=1==d.length?tablepress_strings.ays_remove_columns_singular:tablepress_strings.ays_remove_columns_plural,confirm(c)&&(b=d.map(function(){return a(this).index()}).get(),a("#edit-form-body").children().add("#edit-form-head").each(function(c,d){a(d).children().filter(function(a){return-1!= 
    25 jQuery.inArray(a,b)}).remove()}),d.remove(),tp.reindex()))},move:{source_idx:-1,target_idx:-1,$rows:null,$row_children:null,$cell:null,$cells:null,$placeholder:null,$helper:null,start:function(b,c){var d=a(c.item);tp.columns.move.source_idx=d.index();tp.columns.move.$rows=a("#edit-form-body").children().add("#edit-form-foot");tp.columns.move.$cells=tp.columns.move.$rows.find(":nth-child("+(tp.columns.move.source_idx+1)+")").each(function(){tp.columns.move.$cell=a(this);a('<td class="move-placeholder"><div/></td>').insertBefore(tp.columns.move.$cell); 
    26 tp.columns.move.$cell.insertAfter(tp.columns.move.$cell.nextAll().last()).clone().addClass("move-hover").insertAfter(tp.columns.move.$cell).find("textarea").val(tp.columns.move.$cell.find("textarea").val())}).hide();tp.columns.move.$helper=tp.columns.move.$rows.find(".move-hover");d=tp.columns.move.$helper.eq(1).width();tp.columns.move.$helper.eq(0).width(d);tp.columns.move.$placeholder=tp.columns.move.$rows.find(".move-placeholder");tp.columns.move.$placeholder.find("div").width(d)},change:function(b, 
    27 c){tp.columns.move.target_idx=a(c.placeholder).index();1==tp.columns.move.target_idx-tp.columns.move.source_idx?tp.columns.move.target_idx+=1:tp.columns.move.target_idx==tp.columns.move.source_idx&&(tp.columns.move.target_idx-=1);tp.columns.move.$placeholder.each(function(){tp.columns.move.$cell=a(this);tp.columns.move.$cell.insertBefore(tp.columns.move.$cell.parent().children().eq(tp.columns.move.target_idx))});tp.columns.move.target_idx>tp.columns.move.source_idx&&(tp.columns.move.target_idx-=1); 
    28 tp.columns.move.source_idx=tp.columns.move.target_idx},sort:function(a,c){tp.columns.move.$helper.css("left",c.position.left)},stop:function(){tp.columns.move.$helper.remove();tp.columns.move.$cells.each(function(){tp.columns.move.$cell=a(this);tp.columns.move.$cell.insertBefore(tp.columns.move.$cell.parent().find(".move-placeholder"))}).show();tp.columns.move.$placeholder.remove();tp.columns.move.source_idx=tp.columns.move.target_idx=-1;tp.columns.move.$rows=tp.columns.move.$row_children=tp.columns.move.$cell= 
    29 tp.columns.move.$cells=tp.columns.move.$placeholder=tp.columns.move.$helper=null;tp.reindex()}},number_to_letter:function(a){for(var c="";0<a;)c=String.fromCharCode(65+(a-1)%26)+c,a=Math.floor((a-1)/26);return c}},cells:{$focus:a(null),$textarea:null,autogrow:function(){tp.cells.$focus.removeClass("focus");tp.cells.$focus=a(this).closest("tr").addClass("focus")},advanced_editor:{keyopen:function(b){b.shiftKey&&(b=a("#advanced-editor-content"),tp.cells.advanced_editor.thickbox_size(),tp.cells.$textarea= 
    30 a(this).blur(),b.val(tp.cells.$textarea.val()),a("#advanced-editor").wpdialog("open"),b.get(0).selectionStart=b.get(0).selectionEnd=b.val().length,b.focus())},buttonopen:function(){if(confirm(tablepress_strings.advanced_editor_open))a("#edit-form-body").one("click","textarea",function(){var b=a("#advanced-editor-content");tp.cells.advanced_editor.thickbox_size();tp.cells.$textarea=a(this).blur();b.val(tp.cells.$textarea.val());a("#advanced-editor").wpdialog("open");b.get(0).selectionStart=b.get(0).selectionEnd= 
    31 b.val().length;b.focus()})},save:function(){var b=a("#advanced-editor-content").blur().val();tp.cells.$textarea.val()!=b&&(tp.cells.$textarea.val(b),tp.cells.$textarea.get(0).selectionStart=tp.cells.$textarea.get(0).selectionEnd=tp.cells.$textarea.val().length,tp.table.set_table_changed());tp.cells.$textarea.focus();tp.cells.advanced_editor.close()},close:function(){a("#advanced-editor").wpdialog("close");return!1},thickbox_size:function(){var b=a("#advanced-editor-content-add_media"),c=b.attr("href"), 
    32 d=a(window).width(),d=720<d?720:d,e=a(window).height();a("body.admin-bar").length&&(e-=28);c=c.replace(/&width=[0-9]+/g,"").replace(/&height=[0-9]+/g,"");b.attr("href",c+("&width="+(d-80)+"&height="+(e-85)))}},checkboxes:{last_clicked:{"#edit-form-body":!1,"#edit-form-foot":!1},multi_select:function(b){if("undefined"==b.shiftKey)return!0;if(b.shiftKey){if(!tp.cells.checkboxes.last_clicked[b.data.parent])return!0;var c=a(b.data.parent).find(":checkbox"),d=c.index(tp.cells.checkboxes.last_clicked[b.data.parent]), 
    33 e=c.index(this);d!=e&&c.slice(Math.min(d,e),Math.max(d,e)).prop("checked",a(this).prop("checked"))}tp.cells.checkboxes.last_clicked[b.data.parent]=this;return!0}}},content:{link:{add:function(){if(confirm(tablepress_strings.link_add))a("#edit-form-body").one("mousedown","textarea",function(){wpActiveEditor=this.id;a(window).one("mouseup",function(){wpLink.open();tp.table.set_table_changed()})})}},image:{add:function(){if(confirm(tablepress_strings.image_add))a("#edit-form-body").one("click","textarea", 
    34 function(){wpActiveEditor=this.id;this.selectionStart=this.selectionEnd=this.value.length;var b=a("#image-add"),c=a(window).width(),c=720<c?720:c,d=a(window).height();a("body.admin-bar").length&&(d-=28);tb_show(b.text(),b.attr("href")+"&TB_iframe=true&height="+(d-85)+"&width="+(c-80),!1);a(this).blur()});return!1}},span:{add:function(b){if(confirm(tablepress_strings.span_add))a("#edit-form-body").one("click","textarea",function(){var c=a(this),d=c.parent().index(),e=c.closest("tr").index();if("#rowspan#"== 
    35 b){if(0==e){alert(tablepress_strings.no_rowspan_first_row);return}if(tp.table.head&&1==e){alert(tablepress_strings.no_rowspan_table_head);return}if(tp.table.foot&&tp.table.rows-1==e){alert(tablepress_strings.no_rowspan_table_foot);return}}else if("#colspan#"==b&&tp.table.no_data_columns_pre==d){alert(tablepress_strings.no_colspan_first_col);return}c.val(b);tp.table.set_table_changed()})}}},check:{table_id:function(b){37==b.which||39==b.which||(b=a(this),b.val(b.val().replace(/[^0-9a-zA-Z-_]/g,"")))}, 
    36 changes_saved:function(){if(tp.made_changes)return tablepress_strings.unsaved_changes_unload}},reindex:function(){var b,c=a("#edit-form-body").children(),d,e={};tp.table.rows=c.length;tp.table.columns=0<tp.table.rows?c.first().children().length-tp.table.no_data_columns_pre-tp.table.no_data_columns_post:0;c.each(function(c,h){b=a(h);b.find("textarea").val(function(b,c){return""==c||"="!=c.charAt(0)?c:c.replace(/([A-Z]+[0-9]+)(?::([A-Z]+[0-9]+))?/g,function(b,c,f){e.hasOwnProperty(c)||(d=a("#cell-"+ 
     3!0},unset_table_changed:function(){tp.made_changes=!1;a("#edit-form-body").one("change","textarea",tp.table.set_table_changed);a("#tablepress_edit-table-information, #tablepress_edit-table-options, #tablepress_edit-datatables-features").one("change","input, textarea, select",tp.table.set_table_changed)},change_id:function(){""===a.trim(a("#table-new-id").val())?(alert(tablepress_strings.table_id_not_empty),a("#table-new-id").val(tp.table.new_id).focus().select()):"0"===a.trim(a("#table-new-id").val())? 
     4(alert(tablepress_strings.table_id_not_zero),a("#table-new-id").val(tp.table.new_id).focus().select()):this.value!=tp.table.new_id&&(confirm(tablepress_strings.ays_change_table_id)?(tp.table.new_id=this.value,a(".table-shortcode").val("["+tablepress_options.shortcode+" id="+tp.table.new_id+" /]").click(),tp.table.set_table_changed()):a(this).val(tp.table.new_id))},change_table_head:function(){tp.table.head=a(this).prop("checked");a("#option-use-datatables").prop("disabled",!tp.table.head).change(); 
     5a("#notice-datatables-head-row").toggle(!tp.table.head);tp.rows.stripe()},change_table_foot:function(){tp.table.foot=a(this).prop("checked");tp.rows.stripe()},change_datatables:function(){var b=a("#option-use-datatables"),c=!(b.prop("checked")&&!b.prop("disabled"));b.closest("tbody").find("input").not(b).prop("disabled",c);tp.table.change_datatables_pagination()},change_datatables_pagination:function(){var b=a("#option-datatables-paginate"),b=b.prop("checked")&&!b.prop("disabled");a("#option-datatables-lengthchange").prop("disabled", 
     6!b);a("#option-datatables-paginate_entries").prop("disabled",!b)},prepare_ajax_request:function(b,c){var d=a("#edit-form-body"),e=[],f,h={rows:tp.table.rows,columns:tp.table.columns,hidden_rows:0,hidden_columns:0},g={rows:[],columns:[]};d.children().each(function(b,c){e[b]=a(c).find("textarea").map(function(){return a(this).val()}).get()});e=JSON.stringify(e);f={table_head:tp.table.head,table_foot:tp.table.foot,alternating_row_colors:a("#option-alternating-row-colors").prop("checked"),row_hover:a("#option-row-hover").prop("checked"), 
     7print_name:a("#option-print-name").val(),print_description:a("#option-print-description").val(),extra_css_classes:a("#option-extra-css-classes").val(),use_datatables:a("#option-use-datatables").prop("checked"),datatables_sort:a("#option-datatables-sort").prop("checked"),datatables_filter:a("#option-datatables-filter").prop("checked"),datatables_paginate:a("#option-datatables-paginate").prop("checked"),datatables_lengthchange:a("#option-datatables-lengthchange").prop("checked"),datatables_paginate_entries:a("#option-datatables-paginate_entries").val(), 
     8datatables_info:a("#option-datatables-info").prop("checked"),datatables_scrollX:a("#option-datatables-scrollX").prop("checked"),datatables_custom_commands:a("#option-datatables-custom-commands").val()};f=JSON.stringify(f);g.rows=d.find('input[type="hidden"]').map(function(){if("1"==a(this).val())return 1;h.hidden_rows+=1;return 0}).get();g.columns=a("#edit-form-foot").find('input[type="hidden"]').map(function(){if("1"==a(this).val())return 1;h.hidden_columns+=1;return 0}).get();g=JSON.stringify(g); 
     9return{action:b,_ajax_nonce:a(c).val(),tablepress:{id:tp.table.id,new_id:tp.table.new_id,name:a("#table-name").val(),description:a("#table-description").val(),number:h,data:e,options:f,visibility:g}}},preview:{trigger:function(){if(!tp.made_changes)return tp.table.preview.show(a(this).attr("href")+"&TB_iframe=true"),!1;a(this).closest("p").append('<span class="animation-preview" title="'+tablepress_strings.preparing_preview+'"/>');a("body").addClass("wait");a("#table-preview").empty();a.post(ajaxurl, 
     10tp.table.prepare_ajax_request("tablepress_preview_table","#nonce-preview-table"),function(){},"json").success(tp.table.preview.ajax_success).error(tp.table.preview.ajax_error);return!1},ajax_success:function(a,c){"undefined"==typeof c||"success"!=c?tp.table.preview.error("AJAX call successful, but unclear status."):"undefined"==typeof a||null==a||"-1"==a||"undefined"==typeof a.success||!0!==a.success?tp.table.preview.error("AJAX call successful, but unclear data."):tp.table.preview.success(a)},ajax_error:function(a, 
     11c,d){tp.table.preview.error("AJAX call failed: "+c+" - "+d)},success:function(b){a("#table-preview").empty();a('<iframe id="table-preview-iframe" />').load(function(){var c=a(this).contents();c.find("head").append(b.head_html);c.find("body").append(b.body_html)}).appendTo("#table-preview");a(".animation-preview").remove();a("body").removeClass("wait");tp.table.preview.show("#TB_inline?inlineId=preview-container")},error:function(b){a(".animation-preview").closest("p").after('<div class="preview-error error"><p><strong>'+ 
     12tablepress_strings.preview_error+": "+b+"</strong></p></div>");a(".animation-preview").remove();a(".preview-error").delay(6E3).fadeOut(2E3,function(){a(this).remove()});a("body").removeClass("wait")},show:function(b){var c=a(window).width()-120,d=a(window).height()-120;a("body.admin-bar").length&&(d-=28);tb_show(a(".show-preview-button").first().text(),b+"&height="+d+"&width="+c,!1)}}},rows:{create:function(b){var c,d,e,f="";for(c=0;c<b;c++){f+=tp.table.body_cells_pre;for(d=0;d<tp.table.columns;d++)f+= 
     13tp.table.body_cell;f+=tp.table.body_cells_post}e=a("#edit-form-foot").find(".column-hidden").map(function(){return a(this).index()}).get();return a(f).each(function(b,c){a(c).children().filter(function(a){return-1!=jQuery.inArray(a,e)}).addClass("column-hidden")})},append:function(){var b=a("#rows-append-number").val();/^[1-9][0-9]{0,4}$/.test(b)?(a("#edit-form-body").append(tp.rows.create(b)),tp.rows.stripe(),tp.reindex()):(alert(tablepress_strings.append_num_rows_invalid),a("#rows-append-number").focus().select())}, 
     14insert:function(b){b=a("#edit-form-body").find("input:checked").prop("checked",b.shiftKey).closest("tr");0===b.length?alert(tablepress_strings.no_rows_selected):(b.before(tp.rows.create(1)),tp.rows.stripe(),tp.reindex())},hide:function(b){b=a("#edit-form-body").find("input:checked").prop("checked",b.shiftKey).closest("tr");0===b.length?alert(tablepress_strings.no_rows_selected):(b.addClass("row-hidden").find(".visibility").val("0"),tp.rows.stripe(),tp.table.set_table_changed())},unhide:function(b){b= 
     15a("#edit-form-body").find("input:checked").prop("checked",b.shiftKey).closest("tr");0===b.length?alert(tablepress_strings.no_rows_selected):(b.removeClass("row-hidden").find(".visibility").val("1"),tp.rows.stripe(),tp.table.set_table_changed())},remove:function(){var b,c=a("#edit-form-body").find("input:checked").closest("tr");0===c.length?alert(tablepress_strings.no_rows_selected):tp.table.rows==c.length?alert(tablepress_strings.no_remove_all_rows):(b=1==c.length?tablepress_strings.ays_remove_rows_singular: 
     16tablepress_strings.ays_remove_rows_plural,confirm(b)&&(c.remove(),tp.rows.stripe(),tp.reindex()))},move:{start:function(b,c){a(c.placeholder).removeClass("row-hidden").css("visibility","visible").html('<td colspan="'+(tp.table.columns+tp.table.no_data_columns_pre+tp.table.no_data_columns_post)+'"><div/></td>');a(c.helper).removeClass("odd head-row foot-row")},change:function(a,c){tp.rows.stripe(c.helper)},stop:function(){tp.rows.stripe()}},sort:function(){var b=a(this).parent().index(),c=a(this).hasClass("sort-asc")? 
     171:-1,d=a("#edit-form-body"),e=d.find(".head-row").prevAll().andSelf(),f=d.find(".foot-row").nextAll().andSelf(),h=d.children().not(e).not(f).get(),g=function(a,b){var c=/(^-?[0-9]+(\.?[0-9]*)[df]?e?[0-9]?$|^0x[0-9a-f]+$|[0-9]+)/gi,d=/(^[ ]*|[ ]*$)/g,e=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,f=/^0x[0-9a-f]+$/i,h=/^0/,g=a.toString().replace(d,"")||"",i=b.toString().replace(d,"")||"",d=g.replace(c,"\x00$1\x00").replace(/\0$/,"").replace(/^\0/, 
     18"").split("\x00"),c=i.replace(c,"\x00$1\x00").replace(/\0$/,"").replace(/^\0/,"").split("\x00"),g=parseInt(g.match(f))||1!=d.length&&g.match(e)&&Date.parse(g);if(e=parseInt(i.match(f))||g&&i.match(e)&&Date.parse(i)||null){if(g<e)return-1;if(g>e)return 1}e=0;for(f=Math.max(d.length,c.length);e<f;e++){oFxNcL=!(d[e]||"").match(h)&&parseFloat(d[e])||d[e]||0;oFyNcL=!(c[e]||"").match(h)&&parseFloat(c[e])||c[e]||0;if(isNaN(oFxNcL)!==isNaN(oFyNcL))return isNaN(oFxNcL)?1:-1;typeof oFxNcL!==typeof oFyNcL&& 
     19(oFxNcL+="",oFyNcL+="");if(oFxNcL<oFyNcL)return-1;if(oFxNcL>oFyNcL)return 1}return 0};a.each(h,function(c,d){d.sort_key=a(d).children().eq(b).find("textarea").val().toUpperCase()});h.sort(function(a,b){return c*g(a.sort_key,b.sort_key)});a.each(h,function(a,b){b.sort_key=null});d.append(e);d.append(h);d.append(f);tp.rows.stripe();tp.reindex()},stripe:function(b){"undefined"==typeof b&&(b=null);var b=a(b),c=a("#edit-form-body").children().removeClass("odd head-row foot-row").not(b);c.filter(":even").addClass("odd"); 
     20c=c.not(".row-hidden");b.hasClass("row-hidden")&&(c=c.not(".ui-sortable-placeholder"));tp.table.head&&c.first().addClass("head-row");tp.table.foot&&c.last().addClass("foot-row")}},columns:{append:function(){var b,c=a("#columns-append-number").val(),d=new_head_cells=new_foot_cells="";if(/^[1-9][0-9]{0,4}$/.test(c)){for(b=0;b<c;b++)d+=tp.table.body_cell,new_head_cells+=tp.table.head_cell,new_foot_cells+=tp.table.foot_cell;a("#edit-form-body").children().each(function(b,c){a(c).children().slice(-tp.table.no_data_columns_post).before(d)}); 
     21a("#edit-form-head").children().slice(-tp.table.no_data_columns_post).before(new_head_cells);a("#edit-form-foot").children().slice(-tp.table.no_data_columns_post).before(new_foot_cells);tp.reindex()}else alert(tablepress_strings.append_num_columns_invalid),a("#columns-append-number").focus().select()},insert:function(b){var c,b=a("#edit-form-foot").find("input:checked").prop("checked",b.shiftKey).closest("th");0===b.length?alert(tablepress_strings.no_columns_selected):(c=b.map(function(){return a(this).index()}).get(), 
     22a("#edit-form-body").children().each(function(b,e){a(e).children().filter(function(a){return-1!=jQuery.inArray(a,c)}).before(tp.table.body_cell)}),a("#edit-form-head").children().filter(function(a){return-1!=jQuery.inArray(a,c)}).before(tp.table.head_cell),b.before(tp.table.foot_cell),tp.reindex())},hide:function(b){var c,b=a("#edit-form-foot").find("input:checked").prop("checked",b.shiftKey).closest("th");0===b.length?alert(tablepress_strings.no_columns_selected):(c=b.map(function(){return a(this).index()}).get(), 
     23a("#edit-form-body").children().add("#edit-form-head").each(function(b,e){a(e).children().filter(function(a){return-1!=jQuery.inArray(a,c)}).addClass("column-hidden")}),b.addClass("column-hidden").find(".visibility").val("0"),tp.table.set_table_changed())},unhide:function(b){var c,b=a("#edit-form-foot").find("input:checked").prop("checked",b.shiftKey).closest("th");0===b.length?alert(tablepress_strings.no_columns_selected):(c=b.map(function(){return a(this).index()}).get(),a("#edit-form-body").children().add("#edit-form-head").each(function(b, 
     24e){a(e).children().filter(function(a){return-1!=jQuery.inArray(a,c)}).removeClass("column-hidden")}),b.removeClass("column-hidden").find(".visibility").val("1"),tp.table.set_table_changed())},remove:function(){var b,c,d=a("#edit-form-foot").find("input:checked").closest("th");0===d.length?alert(tablepress_strings.no_columns_selected):tp.table.columns==d.length?alert(tablepress_strings.no_remove_all_columns):(c=1==d.length?tablepress_strings.ays_remove_columns_singular:tablepress_strings.ays_remove_columns_plural, 
     25confirm(c)&&(b=d.map(function(){return a(this).index()}).get(),a("#edit-form-body").children().add("#edit-form-head").each(function(c,d){a(d).children().filter(function(a){return-1!=jQuery.inArray(a,b)}).remove()}),d.remove(),tp.reindex()))},move:{source_idx:-1,target_idx:-1,$rows:null,$row_children:null,$cell:null,$cells:null,$placeholder:null,$helper:null,start:function(b,c){var d=a(c.item);tp.columns.move.source_idx=d.index();tp.columns.move.$rows=a("#edit-form-body").children().add("#edit-form-foot"); 
     26tp.columns.move.$cells=tp.columns.move.$rows.find(":nth-child("+(tp.columns.move.source_idx+1)+")").each(function(){tp.columns.move.$cell=a(this);a('<td class="move-placeholder"><div/></td>').insertBefore(tp.columns.move.$cell);tp.columns.move.$cell.insertAfter(tp.columns.move.$cell.nextAll().last()).clone().addClass("move-hover").insertAfter(tp.columns.move.$cell).find("textarea").val(tp.columns.move.$cell.find("textarea").val())}).hide();tp.columns.move.$helper=tp.columns.move.$rows.find(".move-hover"); 
     27d=tp.columns.move.$helper.eq(1).width();tp.columns.move.$helper.eq(0).width(d);tp.columns.move.$placeholder=tp.columns.move.$rows.find(".move-placeholder");tp.columns.move.$placeholder.find("div").width(d)},change:function(b,c){tp.columns.move.target_idx=a(c.placeholder).index();1==tp.columns.move.target_idx-tp.columns.move.source_idx?tp.columns.move.target_idx+=1:tp.columns.move.target_idx==tp.columns.move.source_idx&&(tp.columns.move.target_idx-=1);tp.columns.move.$placeholder.each(function(){tp.columns.move.$cell= 
     28a(this);tp.columns.move.$cell.insertBefore(tp.columns.move.$cell.parent().children().eq(tp.columns.move.target_idx))});tp.columns.move.target_idx>tp.columns.move.source_idx&&(tp.columns.move.target_idx-=1);tp.columns.move.source_idx=tp.columns.move.target_idx},sort:function(a,c){tp.columns.move.$helper.css("left",c.position.left)},stop:function(){tp.columns.move.$helper.remove();tp.columns.move.$cells.each(function(){tp.columns.move.$cell=a(this);tp.columns.move.$cell.insertBefore(tp.columns.move.$cell.parent().find(".move-placeholder"))}).show(); 
     29tp.columns.move.$placeholder.remove();tp.columns.move.source_idx=tp.columns.move.target_idx=-1;tp.columns.move.$rows=tp.columns.move.$row_children=tp.columns.move.$cell=tp.columns.move.$cells=tp.columns.move.$placeholder=tp.columns.move.$helper=null;tp.reindex()}},number_to_letter:function(a){for(var c="";0<a;)c=String.fromCharCode(65+(a-1)%26)+c,a=Math.floor((a-1)/26);return c}},cells:{$focus:a(null),$textarea:null,autogrow:function(){tp.cells.$focus.removeClass("focus");tp.cells.$focus=a(this).closest("tr").addClass("focus")}, 
     30advanced_editor:{keyopen:function(b){b.shiftKey&&(b=a("#advanced-editor-content"),tp.cells.advanced_editor.thickbox_size(),tp.cells.$textarea=a(this).blur(),b.val(tp.cells.$textarea.val()),a("#advanced-editor").wpdialog("open"),b.get(0).selectionStart=b.get(0).selectionEnd=b.val().length,b.focus())},buttonopen:function(){if(confirm(tablepress_strings.advanced_editor_open))a("#edit-form-body").one("click","textarea",function(){var b=a("#advanced-editor-content");tp.cells.advanced_editor.thickbox_size(); 
     31tp.cells.$textarea=a(this).blur();b.val(tp.cells.$textarea.val());a("#advanced-editor").wpdialog("open");b.get(0).selectionStart=b.get(0).selectionEnd=b.val().length;b.focus()})},save:function(){var b=a("#advanced-editor-content").blur().val();tp.cells.$textarea.val()!=b&&(tp.cells.$textarea.val(b),tp.cells.$textarea.get(0).selectionStart=tp.cells.$textarea.get(0).selectionEnd=tp.cells.$textarea.val().length,tp.table.set_table_changed());tp.cells.$textarea.focus();tp.cells.advanced_editor.close()}, 
     32close:function(){a("#advanced-editor").wpdialog("close");return!1},thickbox_size:function(){var b=a("#advanced-editor-content-add_media"),c=b.attr("href"),d=a(window).width(),d=720<d?720:d,e=a(window).height();a("body.admin-bar").length&&(e-=28);c=c.replace(/&width=[0-9]+/g,"").replace(/&height=[0-9]+/g,"");b.attr("href",c+("&width="+(d-80)+"&height="+(e-85)))}},checkboxes:{last_clicked:{"#edit-form-body":!1,"#edit-form-foot":!1},multi_select:function(b){if("undefined"==b.shiftKey)return!0;if(b.shiftKey){if(!tp.cells.checkboxes.last_clicked[b.data.parent])return!0; 
     33var c=a(b.data.parent).find(":checkbox"),d=c.index(tp.cells.checkboxes.last_clicked[b.data.parent]),e=c.index(this);d!=e&&c.slice(Math.min(d,e),Math.max(d,e)).prop("checked",a(this).prop("checked"))}tp.cells.checkboxes.last_clicked[b.data.parent]=this;return!0}}},content:{link:{add:function(){if(confirm(tablepress_strings.link_add))a("#edit-form-body").one("mousedown","textarea",function(){wpActiveEditor=this.id;a(window).one("mouseup",function(){wpLink.open();tp.table.set_table_changed()})})}},image:{add:function(){if(confirm(tablepress_strings.image_add))a("#edit-form-body").one("click", 
     34"textarea",function(){wpActiveEditor=this.id;this.selectionStart=this.selectionEnd=this.value.length;var b=a("#image-add"),c=a(window).width(),c=720<c?720:c,d=a(window).height();a("body.admin-bar").length&&(d-=28);tb_show(b.text(),b.attr("href")+"&TB_iframe=true&height="+(d-85)+"&width="+(c-80),!1);a(this).blur()});return!1}},span:{add:function(b){if(confirm(tablepress_strings.span_add))a("#edit-form-body").one("click","textarea",function(){var c=a(this),d=c.parent().index(),e=c.closest("tr").index(); 
     35if("#rowspan#"==b){if(0==e){alert(tablepress_strings.no_rowspan_first_row);return}if(tp.table.head&&1==e){alert(tablepress_strings.no_rowspan_table_head);return}if(tp.table.foot&&tp.table.rows-1==e){alert(tablepress_strings.no_rowspan_table_foot);return}}else if("#colspan#"==b&&tp.table.no_data_columns_pre==d){alert(tablepress_strings.no_colspan_first_col);return}c.val(b);tp.table.set_table_changed()})}}},check:{table_id:function(b){37==b.which||39==b.which||(b=a(this),b.val(b.val().replace(/[^0-9a-zA-Z-_]/g, 
     36"")))},changes_saved:function(){if(tp.made_changes)return tablepress_strings.unsaved_changes_unload}},reindex:function(){var b,c=a("#edit-form-body").children(),d,e={};tp.table.rows=c.length;tp.table.columns=0<tp.table.rows?c.first().children().length-tp.table.no_data_columns_pre-tp.table.no_data_columns_post:0;c.each(function(c,h){b=a(h);b.find("textarea").val(function(b,c){return""==c||"="!=c.charAt(0)?c:c.replace(/([A-Z]+[0-9]+)(?::([A-Z]+[0-9]+))?/g,function(b,c,f){e.hasOwnProperty(c)||(d=a("#cell-"+ 
    3737c),e[c]=d.length?tp.columns.number_to_letter(d.parent().index()-tp.table.no_data_columns_pre+1)+(d.closest("tr").index()+1):c);b=e[c];"undefined"!=typeof f&&(e.hasOwnProperty(f)||(d=a("#cell-"+f),e[f]=d.length?tp.columns.number_to_letter(d.parent().index()-tp.table.no_data_columns_pre+1)+(d.closest("tr").index()+1):f),b+=":"+e[f]);return b})}).attr("name",function(a){return"table[data]["+c+"]["+a+"]"});b.find(".move-handle").html(c+1)}).each(function(b,c){a(c).find("textarea").attr("id",function(a){return"cell-"+ 
    3838tp.columns.number_to_letter(a+1)+(b+1)})});a("#edit-form-head").find(".move-handle").html(function(a){return tp.columns.number_to_letter(a+1)});a("#number-rows").val(tp.table.rows);a("#number-columns").val(tp.table.columns);tp.table.set_table_changed()},save_changes:{trigger:function(b){/[^A-Za-z0-9- _]/.test(a("#option-extra-css-classes").val())?(alert(tablepress_strings.extra_css_classes_invalid),a("#option-extra-css-classes").focus().select()):b.shiftKey?(tp.made_changes=!1,a("#tablepress-page").find("form").submit()): 
  • tablepress/trunk/admin/import.js

    r589540 r598765  
    6262    } 
    6363 
    64  
    6564    /** 
    6665     * Check, whether inputs are valid 
     
    6867     * @since 1.0.0 
    6968     */ 
    70     $( '#tablepress-page' ).find( 'form' ).on( 'submit', function( /* event */ ) { 
     69    $( '#tablepress-page' ).find( 'form' ).on( 'submit.tablepress', function( /* event */ ) { 
    7170        var import_source = $( '#row-import-source' ).find( 'input:checked' ).val(), 
    7271            selected_import_source_field = $( '#tables-import-' + import_source ).get(0), 
     
    10099    } ); 
    101100 
     101    /** 
     102     * Remove form validation check if "Import from WP-Table Reloaded" button is clicked 
     103     * 
     104     * @since 1.0.0 
     105     */ 
     106    $( '#tablepress-page' ).find( '#submit_wp_table_reloaded_import' ).on( 'click', function() { 
     107        $( '#tablepress-page' ).find( 'form' ).off( 'submit.tablepress' ); 
     108    } ); 
     109 
    102110} ); 
  • tablepress/trunk/admin/import.min.js

    r589540 r598765  
    11jQuery(document).ready(function(a){function d(){var c=a(this).val(),b,d="";b=c.lastIndexOf("\\");-1!=b?c.substr(b+1):(b=c.lastIndexOf("/"),-1!=b&&c.substr(b+1));b=c.lastIndexOf(".");-1!=b&&(d=c.substr(b+1).toLowerCase());a("#tables-import-format").val(d)}a("#row-import-add_replace").on("change","input",function(){a("#tables-import-replace-table").prop("disabled","replace"!=a(this).val())}).find("input:checked").change();a("#row-import-source").on("change","input",function(){a("#row-import-source-file-upload, #row-import-source-url, #row-import-source-server, #row-import-source-form-field").hide(); 
    2 a("#row-import-source-"+a(this).val()).show()}).find("input:checked").change();a("#tables-import-file-upload").on("change",d);a("#tables-import-url, #tables-import-server").on("blur",d);a("#tablepress-page").find("form").on("submit",function(){var c=a("#row-import-source").find("input:checked").val(),c=a("#tables-import-"+c).get(0),b=!0;c.defaultValue==c.value&&(a(c).addClass("invalid").one("change",function(){a(this).removeClass("invalid")}).focus().select(),b=!1);"replace"==a("#row-import-add_replace").find("input:checked").val()&& 
    3 ""==a("#tables-import-replace-table").val()&&(a("#row-import-add_replace").one("change","input",function(){a("#tables-import-replace-table").removeClass("invalid")}),a("#tables-import-replace-table").addClass("invalid").one("change",function(){a(this).removeClass("invalid")}).focus().select(),b=!1);if(!b)return!1})}); 
     2a("#row-import-source-"+a(this).val()).show()}).find("input:checked").change();a("#tables-import-file-upload").on("change",d);a("#tables-import-url, #tables-import-server").on("blur",d);a("#tablepress-page").find("form").on("submit.tablepress",function(){var c=a("#row-import-source").find("input:checked").val(),c=a("#tables-import-"+c).get(0),b=!0;c.defaultValue==c.value&&(a(c).addClass("invalid").one("change",function(){a(this).removeClass("invalid")}).focus().select(),b=!1);"replace"==a("#row-import-add_replace").find("input:checked").val()&& 
     3""==a("#tables-import-replace-table").val()&&(a("#row-import-add_replace").one("change","input",function(){a("#tables-import-replace-table").removeClass("invalid")}),a("#tables-import-replace-table").addClass("invalid").one("change",function(){a(this).removeClass("invalid")}).focus().select(),b=!1);if(!b)return!1});a("#tablepress-page").find("#submit_wp_table_reloaded_import").on("click",function(){a("#tablepress-page").find("form").off("submit.tablepress")})}); 
  • tablepress/trunk/admin/quicktags-button.js

    r589540 r598765  
    3838        'tablepress_quicktags_button',      // ID 
    3939        tablepress_editor_button.caption,   // button caption 
    40         tablepress_open_shortcode_thickbox, // click callback 
     40        tablepress_open_shortcode_thickbox, // click callback 
    4141        false,                              // unused 
    4242        false,                              // access key 
  • tablepress/trunk/classes/class-admin-page-helper.php

    r589540 r598765  
    8080    } 
    8181 
     82    /** 
     83     * Print the JavaScript code for a WP feature pointer 
     84     * 
     85     * @since 1.0.0 
     86     * 
     87     * @param string $pointer_id The pointer ID. 
     88     * @param string $selector The HTML elements, on which the pointer should be attached. 
     89     * @param array $args Arguments to be passed to the pointer JS (see wp-pointer.js). 
     90     */ 
     91    public function print_wp_pointer_js( $pointer_id, $selector, $args ) { 
     92        if ( empty( $pointer_id ) || empty( $selector ) || empty( $args ) || empty( $args['content'] ) ) 
     93            return; 
     94        ?> 
     95        <script type="text/javascript"> 
     96        (function($){ 
     97            var options = <?php echo json_encode( $args ); ?>, setup; 
     98 
     99            if ( ! options ) 
     100                return; 
     101 
     102            options = $.extend( options, { 
     103                close: function() { 
     104                    $.post( ajaxurl, { 
     105                        pointer: '<?php echo $pointer_id; ?>', 
     106                        action: 'dismiss-wp-pointer' 
     107                    }); 
     108                } 
     109            }); 
     110 
     111            setup = function() { 
     112                $('<?php echo $selector; ?>').pointer( options ).pointer('open'); 
     113            }; 
     114 
     115            if ( options.position && options.position.defer_loading ) 
     116                $(window).bind( 'load.wp-pointers', setup ); 
     117            else 
     118                $(document).ready( setup ); 
     119        })( jQuery ); 
     120        </script> 
     121        <?php 
     122    } 
     123 
    82124} // class TablePress_Admin_Page 
  • tablepress/trunk/classes/class-controller.php

    r589540 r598765  
    100100                    'message_plugin_update' => true 
    101101                ) ); 
    102                 $this->model_table->merge_table_options_defaults(); 
    103102            } 
    104103 
    105104            $this->model_options->update( array( 
    106105                'message_plugin_update_content' => $this->model_options->plugin_update_message( $this->model_options->get( 'prev_tablepress_version' ), TablePress::version, get_locale() ) 
     106            ) ); 
     107        } 
     108 
     109        // Maybe update the table scheme in each existing table, independently from updating the plugin options 
     110        if ( $this->model_options->get( 'table_scheme_db_version' ) < TablePress::table_scheme_version ) { 
     111            $this->model_table->merge_table_options_defaults(); 
     112            $this->model_options->update( array( 
     113                'table_scheme_db_version' => TablePress::table_scheme_version 
    107114            ) ); 
    108115        } 
  • tablepress/trunk/classes/class-import.php

    r589540 r598765  
    260260        // array_map wants arrays as additional parameters (so we create one with the max_columns to pad to and one with the value to use (empty string) 
    261261        $max_columns_array = array_fill( 1, $rows, $max_columns ); 
    262         $pad_values_array =  array_fill( 1, $rows, '' ); 
     262        $pad_values_array = array_fill( 1, $rows, '' ); 
    263263        return array_map( 'array_pad', $array, $max_columns_array, $pad_values_array ); 
    264264    } 
  • tablepress/trunk/classes/class-render.php

    r589540 r598765  
    217217        // remove hidden rows and re-index 
    218218        foreach ( $hidden_rows as $row_idx ) { 
    219             if ( isset( $this->table['data'][$row_idx] ) ) 
    220                 unset( $this->table['data'][$row_idx] ); 
     219            unset( $this->table['data'][$row_idx] ); 
    221220        } 
    222221        $this->table['data'] = array_merge( $this->table['data'] ); 
     
    224223        foreach ( $this->table['data'] as $row_idx => $row ) { 
    225224            foreach ( $hidden_columns as $col_idx ) { 
    226                 if ( isset( $row[$col_idx] ) ) 
    227                     unset( $row[$col_idx] ); 
     225                unset( $row[$col_idx] ); 
    228226            } 
    229227            $this->table['data'][$row_idx] = array_merge( $row ); 
  • tablepress/trunk/classes/class-tablepress.php

    r589540 r598765  
    2222     * TablePress version 
    2323     * 
     24     * Increases whenever a new plugin version is released 
     25     * 
    2426     * @since 1.0.0 
    2527     * 
    2628     * @const string 
    2729     */ 
    28     const version = '0.4-alpha'; 
    29  
    30     /** 
    31      * TablePress "data scheme" version 
     30    const version = '0.5-alpha'; 
     31 
     32    /** 
     33     * TablePress internal plugin version ("options scheme" version) 
     34     * 
     35     * Increases whenever the scheme for the plugin options changes, or on a plugin update 
    3236     * 
    3337     * @since 1.0.0 
     
    3539     * @const int 
    3640     */ 
    37     const db_version = 5; 
     41    const db_version = 8; 
     42 
     43    /** 
     44     * TablePress "table scheme" (data format structure) version 
     45     * 
     46     * Increases whenever the scheme for a $table changes, 
     47     * used to be able to update plugin options and table scheme independently 
     48     * 
     49     * @since 1.0.0 
     50     * 
     51     * @const int 
     52     */ 
     53    const table_scheme_version = 1; 
    3854 
    3955    /** 
     
    7894        if ( ( 'wp-login.php' === basename( $_SERVER['SCRIPT_FILENAME'] ) ) // Login screen 
    7995                || ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) 
    80                 || ( defined( 'APP_REQUEST' ) && APP_REQUEST ) 
    8196                || ( defined( 'DOING_CRON' ) && DOING_CRON ) ) { 
    8297            return; 
  • tablepress/trunk/classes/class-view.php

    r589540 r598765  
    8484     */ 
    8585    protected $has_meta_boxes = false; 
     86 
     87    /** 
     88     * List of WP feature pointers for this view 
     89     * 
     90     * @since 1.0.0 
     91     * 
     92     * @var array 
     93     */ 
     94    protected $wp_pointers = array(); 
    8695 
    8796    /** 
     
    158167        ) ); 
    159168        $this->admin_page->add_admin_footer_text(); 
     169 
     170        // Initialize WP feature pointers for TablePress 
     171        $this->_init_wp_pointers(); 
    160172 
    161173        // necessary fields for all views 
     
    385397        $caption = isset( $data['submit_button_caption'] ) ? $data['submit_button_caption'] : __( 'Save Changes', 'tablepress' ); 
    386398        ?> 
    387         <p class="submit"><input type="submit" value="<?php echo esc_attr( $caption ); ?>" class="button-primary" name="submit" /></p> 
     399        <p class="submit"><input type="submit" value="<?php echo esc_attr( $caption ); ?>" class="button button-primary" name="submit" /></p> 
    388400        <?php 
    389401    } 
     
    416428    } 
    417429 
     430    /** 
     431     * Initialize the WP feature pointers for TablePress 
     432     * 
     433     * @since 1.0.0 
     434     */ 
     435    protected function _init_wp_pointers() { 
     436        // Check if there are WP pointers for this view 
     437        if ( empty( $this->wp_pointers ) ) 
     438            return; 
     439 
     440        // Get dismissed pointers 
     441        $dismissed = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) ); 
     442 
     443        $got_pointers = false; 
     444        foreach ( array_diff( $this->wp_pointers, $dismissed ) as $pointer ) { 
     445            // Bind pointer print function 
     446            add_action( "admin_footer-{$GLOBALS['hook_suffix']}", array( &$this, 'wp_pointer_' . $pointer ) ); 
     447            $got_pointers = true; 
     448        } 
     449 
     450        if ( ! $got_pointers ) 
     451            return; 
     452 
     453        // Add pointers script and style to queue 
     454        wp_enqueue_style( 'wp-pointer' ); 
     455        wp_enqueue_script( 'wp-pointer' ); 
     456    } 
     457 
    418458} // class TablePress_View 
  • tablepress/trunk/controllers/controller-admin.php

    r589540 r598765  
    312312                    break; 
    313313                } 
     314                $data['frontend_options']['use_default_css'] = $this->model_options->get( 'use_default_css' ); 
     315                $data['frontend_options']['use_custom_css'] = $this->model_options->get( 'use_custom_css' ); 
    314316                $data['frontend_options']['use_custom_css_file'] = $this->model_options->get( 'use_custom_css_file' ); 
    315317                $data['frontend_options']['custom_css'] = $this->model_options->load_custom_css_from_file(); 
     
    734736                $new_options['plugin_language'] = $posted_options['plugin_language']; 
    735737        } 
    736         // Checkbox 
    737         $new_options['use_custom_css_file'] = ( isset( $posted_options['use_custom_css_file'] ) && 'true' === $posted_options['use_custom_css_file'] ); 
     738        // Checkboxes 
     739        foreach ( array( 'use_default_css', 'use_custom_css', 'use_custom_css_file' ) as $checkbox ) { 
     740            $new_options[ $checkbox ] = ( isset( $posted_options[ $checkbox ] ) && 'true' === $posted_options[ $checkbox ] ); 
     741        } 
    738742        if ( isset( $posted_options['custom_css'] ) ) { 
    739743            if ( 1 === preg_match( '#<style.*?>(.*?)</style>#is', $posted_options['custom_css'], $matches ) ) 
     
    855859 
    856860    /** 
    857      * 
     861     * Import data from either an existing source or WP-Table Reloaded 
    858862     * 
    859863     * @since 1.0.0 
     
    867871            $import = stripslashes_deep( $_POST['import'] ); 
    868872 
     873        // Determine if this is a regular import or an import from WP-Table Reloaded 
     874        if ( isset( $_POST['submit_wp_table_reloaded_import'] ) ) 
     875            $this->_handle_post_action_import_wp_table_reloaded( $import ); 
     876        else 
     877            $this->_handle_post_action_import_regular( $import ); 
     878    } 
     879 
     880    /** 
     881     * Import data from existing source (Upload, URL, Server, Direct input) 
     882     * 
     883     * @since 1.0.0 
     884     * 
     885     * @param array $import Submitted form data 
     886     */ 
     887    protected function _handle_post_action_import_regular( $import ) { 
    869888        if ( ! isset( $import['add_replace'] ) ) 
    870889            $import['add_replace'] = 'add'; 
     
    940959            if ( ! isset( $import_data['data'] ) ) 
    941960                $import_data['data'] = file_get_contents( $import_data['file_location'] ); 
    942             if ( false == $import_data['data'] ) 
     961            if ( false === $import_data['data'] ) 
    943962                TablePress::redirect( array( 'action' => 'import', 'message' => 'error_import' ) ); 
    944963 
     
    951970                @unlink( $import_data['file_location'] ); 
    952971 
    953             if ( false == $table_id ) 
     972            if ( false === $table_id ) 
    954973                TablePress::redirect( array( 'action' => 'import', 'message' => 'error_import_data' ) ); 
    955974            else 
     
    979998                $replace_id = ( 'replace' == $import['add_replace'] ) ? false : false; // @TODO: Find a way to extract the replace ID from the filename, maybe? 
    980999                $table_id = $this->_import_table( $import['format'], $data, $name, $description, $replace_id ); 
    981                 if ( false == $table_id ) 
     1000                if ( false === $table_id ) 
    9821001                    continue; 
    9831002                else 
     
    9971016        } 
    9981017 
     1018    } 
     1019 
     1020    /** 
     1021     * Import data from WP-Table Reloaded 
     1022     * 
     1023     * @since 1.0.0 
     1024     * 
     1025     * @param array $import Submitted form data 
     1026     */ 
     1027    protected function _handle_post_action_import_wp_table_reloaded( $import ) { 
     1028        if ( false === get_option( 'wp_table_reloaded_options', false ) || false === get_option( 'wp_table_reloaded_tables', false ) ) 
     1029            TablePress::redirect( array( 'action' => 'import', 'message' => 'error_wp_table_reloaded_not_installed' ) ); 
     1030 
     1031        // Handle checkbox selections 
     1032        $import_tables = ( isset( $import['wp_table_reloaded']['tables'] ) && 'true' === $import['wp_table_reloaded']['tables'] ); 
     1033        $import_css = ( isset( $import['wp_table_reloaded']['css'] ) && 'true' === $import['wp_table_reloaded']['css'] ); 
     1034 
     1035        if ( ! $import_tables && ! $import_css ) 
     1036            TablePress::redirect( array( 'action' => 'import', 'message' => 'error_wp_table_reloaded_nothing_selected' ) ); 
     1037 
     1038        // Import WP-Table Reloaded tables 
     1039        $imported_tables = $imported_other_id_tables = $not_imported_tables = array(); 
     1040        if ( $import_tables ) { 
     1041            $wp_table_reloaded_tables_list = get_option( 'wp_table_reloaded_tables', false ); 
     1042            foreach ( $wp_table_reloaded_tables_list as $wptr_table_id => $table_option_name ) { 
     1043                $wptr_table = get_option( $table_option_name, false ); 
     1044                if ( false === $wptr_table ) { 
     1045                    $not_imported_tables[] = $wptr_table_id; 
     1046                    continue; 
     1047                } 
     1048                // Perform sanity checks of imported table 
     1049                if ( ! isset( $wptr_table['name'] ) 
     1050                    || ! isset( $wptr_table['description'] ) 
     1051                    || empty( $wptr_table['data'] ) 
     1052                    || empty( $wptr_table['options'] ) ) { 
     1053                    $not_imported_tables[] = $wptr_table_id; 
     1054                    continue; 
     1055                } 
     1056 
     1057                // Table was loaded, import the data, table options, and visibility 
     1058                // Create a new table array with information from the imported table 
     1059                $new_table = array( 
     1060                    'name' => $wptr_table['name'], 
     1061                    'description' => $wptr_table['description'], 
     1062                    'data' => $wptr_table['data'], 
     1063                    'options' => array(), 
     1064                    'visibility' => array( 
     1065                        'rows' => array_fill( 0, count( $wptr_table['data'] ), 1 ), 
     1066                        'columns' => array_fill( 0, count( $wptr_table['data'][0] ), 1 ) 
     1067                    ) 
     1068                ); 
     1069                if ( isset( $wptr_table['last_modified'] ) ) 
     1070                    $new_table['last_modified'] = $wptr_table['last_modified']; 
     1071                if ( isset( $wptr_table['last_editor_id'] ) ) 
     1072                    $new_table['author'] = $wptr_table['last_editor_id']; 
     1073                if ( isset( $wptr_table['options']['last_editor_id'] ) ) 
     1074                    $new_table['options']['last_editor'] = $wptr_table['last_editor_id']; 
     1075                if ( isset( $wptr_table['options']['first_row_th'] ) ) 
     1076                    $new_table['options']['table_head'] = $wptr_table['options']['first_row_th']; 
     1077                if ( isset( $wptr_table['options']['table_footer'] ) ) 
     1078                    $new_table['options']['table_foot'] = $wptr_table['options']['table_footer']; 
     1079                if ( isset( $wptr_table['options']['print_name'] ) && isset( $wptr_table['options']['print_name_position'] ) ) 
     1080                    $new_table['options']['print_name'] = ( false === $wptr_table['options']['print_name'] ) ? 'no' : $wptr_table['options']['print_name_position']; 
     1081                if ( isset( $wptr_table['options']['print_description'] ) && isset( $wptr_table['options']['print_description_position'] ) ) 
     1082                    $new_table['options']['print_description'] = ( false === $wptr_table['options']['print_description'] ) ? 'no' : $wptr_table['options']['print_description_position']; 
     1083                if ( isset( $wptr_table['options']['custom_css_class'] ) ) 
     1084                    $new_table['options']['extra_css_classes'] = $wptr_table['options']['custom_css_class']; 
     1085                // array key is the same in both plugins for the following options 
     1086                foreach ( array( 'alternating_row_colors', 'row_hover', 
     1087                    'use_datatables', 'datatables_sort',  'datatables_filter', 'datatables_paginate', 
     1088                    'datatables_lengthchange', 'datatables_paginate_entries', 'datatables_info' 
     1089                    ) as $_option ) { 
     1090                    if ( isset( $wptr_table['options'][ $_option ] ) ) 
     1091                        $new_table['options'][ $_option ] = $wptr_table['options'][ $_option ]; 
     1092                } 
     1093                if ( isset( $wptr_table['options']['datatables_customcommands'] ) ) 
     1094                    $new_table['options']['datatables_custom_commands'] = $wptr_table['options']['datatables_customcommands']; 
     1095                // not imported: $wptr_table['options']['datatables_tabletools'] 
     1096                // not imported: $wptr_table['options']['cache_table_output'] 
     1097                // not imported: $wptr_table['custom_fields'] 
     1098 
     1099                // Fix visibility: WP-Table Reloaded uses 0 and 1 the other way around 
     1100                foreach ( array_keys( $wptr_table['visibility']['rows'], true ) as $row_idx ) { 
     1101                    $new_table['visibility']['rows'][ $row_idx ] = 0; 
     1102                } 
     1103                foreach ( array_keys( $wptr_table['visibility']['columns'], true ) as $column_idx ) { 
     1104                    $new_table['visibility']['columns'][ $column_idx ] = 0; 
     1105                } 
     1106 
     1107                // Merge this data into an empty table template 
     1108                $table = $this->model_table->prepare_table( $this->model_table->get_table_template(), $new_table, false ); 
     1109                if ( false === $table ) { 
     1110                    $not_imported_tables[] = $wptr_table_id; 
     1111                    continue; 
     1112                } 
     1113 
     1114                // Add the new table (and get its first ID) 
     1115                $tp_table_id = $this->model_table->add( $table ); 
     1116                if ( false === $tp_table_id ) { 
     1117                    $not_imported_tables[] = $wptr_table_id; 
     1118                    continue; 
     1119                } 
     1120 
     1121                // Change table ID to the ID the table had in WP-Table Reloaded (except if that ID is already taken) 
     1122                $id_changed = $this->model_table->change_table_id( $tp_table_id, $wptr_table_id ); 
     1123                if ( ! $id_changed ) { 
     1124                    $imported_other_id_tables[] = $wptr_table_id; 
     1125                    continue; 
     1126                } 
     1127 
     1128                $imported_tables[] = $wptr_table_id; 
     1129            } 
     1130        } 
     1131 
     1132        // Import WP-Table Reloaded CSS settings 
     1133        $imported_css = false; 
     1134        if ( $import_css ) { 
     1135            $wp_table_reloaded_options = get_option( 'wp_table_reloaded_options', false ); 
     1136            if ( false !== $wp_table_reloaded_options && is_array( $wp_table_reloaded_options ) ) { 
     1137                $imported_options = array(); 
     1138                if ( isset( $wp_table_reloaded_options['use_default_css'] ) ) 
     1139                    $imported_options['use_default_css'] = (bool)$wp_table_reloaded_options['use_default_css']; 
     1140                if ( isset( $wp_table_reloaded_options['use_custom_css'] ) ) 
     1141                    $imported_options['use_custom_css'] = (bool)$wp_table_reloaded_options['use_custom_css']; 
     1142                if ( isset( $wp_table_reloaded_options['use_custom_css'] ) ) { 
     1143                    $imported_options['custom_css'] = stripslashes( $wp_table_reloaded_options['custom_css'] ); 
     1144                    $imported_options['custom_css'] = str_replace( '#wp-table-reloaded-id-', '#tablepress-', $imported_options['custom_css'] ); 
     1145                    $imported_options['custom_css'] = str_replace( '-no-1', '', $imported_options['custom_css'] ); 
     1146                    $imported_options['custom_css'] = str_replace( '.wp-table-reloaded-id-', '.tablepress-id-', $imported_options['custom_css'] ); 
     1147                    $imported_options['custom_css'] = str_replace( '.wp-table-reloaded', '.tablepress', $imported_options['custom_css'] ); 
     1148                } 
     1149 
     1150                /* 
     1151                    // @TODO: 
     1152                    // Maybe save it to file as well 
     1153                    $update_custom_css_file = false; 
     1154                    if ( $this->model_options->get( 'use_custom_css_file' ) 
     1155                    && $imported_options['custom_css'] !== $this->model_options->load_custom_css_from_file() ) { // only write to file, if CSS really changed 
     1156                        $update_custom_css_file = true; 
     1157                        // Set to false again. As it was set here, it will be set true again, if file saving succeeds 
     1158                        $imported_options['use_custom_css_file'] = false; 
     1159                    } 
     1160                */ 
     1161 
     1162                // Save gathered imported options 
     1163                if ( ! empty( $imported_options ) ) 
     1164                    $this->model_options->update( $imported_options ); 
     1165 
     1166                // @TODO: Necessary if saving to file above is used 
     1167                // if ( $update_custom_css_file ) 
     1168                //  TablePress::redirect( array( 'action' => 'options', 'item' => 'save_custom_css' ), true ); 
     1169 
     1170                $imported_css = true; 
     1171            } 
     1172        } 
     1173 
     1174        // @TODO: Better handling of the different cases of imported/imported-without-ID-change/not-imported tables 
     1175        if ( count( $imported_tables ) > 1 ) 
     1176            TablePress::redirect( array( 'action' => 'list', 'message' => 'success_import_wp_table_reloaded' ) ); 
     1177        elseif ( 1 == count( $imported_tables ) ) 
     1178            TablePress::redirect( array( 'action' => 'edit', 'table_id' => $imported_tables[0], 'message' => 'success_import_wp_table_reloaded' ) ); 
     1179        elseif ( $imported_css ) 
     1180            TablePress::redirect( array( 'action' => 'options', 'message' => 'success_import_wp_table_reloaded' ) ); 
     1181        else 
     1182            TablePress::redirect( array( 'action' => 'import', 'message' => 'error_import_wp_table_reloaded' ) ); 
    9991183    } 
    10001184 
  • tablepress/trunk/controllers/controller-frontend.php

    r589540 r598765  
    3939 
    4040        // enqueue CSS files 
    41         // if ( $this->options['use_default_css'] || $this->options['use_custom_css'] ) 
     41        if ( $this->model_options->get( 'use_default_css' ) || $this->model_options->get( 'use_custom_css' ) ) 
    4242            add_action( 'wp_enqueue_scripts', array( &$this, 'enqueue_css' ) ); 
    4343 
     
    8282     */ 
    8383    public function enqueue_css() { 
    84         // @TODO: Add check for whether default CSS is desired at all 
    85         $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; 
    86         $default_css_url = plugins_url( "css/default{$suffix}.css", TABLEPRESS__FILE__ ); 
    87         $default_css_url = apply_filters( 'tablepress_default_css_url', $default_css_url ); 
    88         wp_enqueue_style( 'tablepress-default', $default_css_url, array(), TablePress::version ); 
    89  
    90         // @TODO: Add check for whether "Custom CSS" is desired at all 
    91         $use_custom_css_from_option = true; 
    92         if ( $this->model_options->get( 'use_custom_css_file' ) ) { 
    93             // fall back to "Custom CSS" in options, if it could not be retrieved from file 
    94             $custom_css_file_contents = $this->model_options->load_custom_css_from_file(); 
    95             if ( ! empty( $custom_css_file_contents ) ) { 
    96                 $use_custom_css_from_option = false; 
    97                 $custom_css_url = content_url( 'tablepress-custom.css' ); 
    98                 $custom_css_url = apply_filters( 'tablepress_custom_css_url', $custom_css_url ); 
    99                 $custom_css_dependencies = array( 'tablepress-default' ); // if default CSS is desired, but also handled internally 
    100                 $custom_css_version = $this->model_options->get( 'custom_css_version' ); 
    101                 $custom_css_version = apply_filters( 'tablepress_custom_css_version', $custom_css_version ); 
    102                 wp_enqueue_style( 'tablepress-custom', $custom_css_url, $custom_css_dependencies, $custom_css_version ); 
    103             } 
    104         } 
    105  
    106         if ( $use_custom_css_from_option ) { 
    107             // get "Custom CSS" from options 
    108             $custom_css = trim( $this->model_options->get( 'custom_css' ) ); 
    109             $custom_css = apply_filters( 'tablepress_custom_css', $custom_css ); 
    110             if ( ! empty( $custom_css ) ) 
    111                 wp_add_inline_style( 'tablepress-default', $custom_css ); // handle of the file to which the <style> shall be appended 
     84        // add "Default CSS" 
     85        if ( $this->model_options->get( 'use_default_css' ) ) { 
     86            $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; 
     87            $default_css_url = plugins_url( "css/default{$suffix}.css", TABLEPRESS__FILE__ ); 
     88            $default_css_url = apply_filters( 'tablepress_default_css_url', $default_css_url ); 
     89            wp_enqueue_style( 'tablepress-default', $default_css_url, array(), TablePress::version ); 
     90        } 
     91 
     92        // add "Custom CSS" 
     93        if ( $this->model_options->get( 'use_custom_css' ) ) { 
     94            $print_custom_css_inline = true; // will be overwritten if file is used 
     95            if ( $this->model_options->get( 'use_custom_css_file' ) ) { 
     96                // fall back to "Custom CSS" in options, if it could not be retrieved from file 
     97                $custom_css_file_contents = $this->model_options->load_custom_css_from_file(); 
     98                if ( ! empty( $custom_css_file_contents ) ) { 
     99                    $print_custom_css_inline = false; 
     100                    $custom_css_url = content_url( 'tablepress-custom.css' ); 
     101                    $custom_css_url = apply_filters( 'tablepress_custom_css_url', $custom_css_url ); 
     102                    $custom_css_dependencies = array(); 
     103                    if ( $this->model_options->get( 'use_default_css' ) ) 
     104                        $custom_css_dependencies[] = 'tablepress-default'; // if default CSS is desired, but also handled internally 
     105                    $custom_css_version = apply_filters( 'tablepress_custom_css_version', $this->model_options->get( 'custom_css_version' ) ); 
     106                    wp_enqueue_style( 'tablepress-custom', $custom_css_url, $custom_css_dependencies, $custom_css_version ); 
     107                } 
     108            } 
     109 
     110            if ( $print_custom_css_inline ) { 
     111                // get "Custom CSS" from options 
     112                $custom_css = trim( $this->model_options->get( 'custom_css' ) ); 
     113                $custom_css = apply_filters( 'tablepress_custom_css', $custom_css ); 
     114                if ( ! empty( $custom_css ) ) { 
     115                    // wp_add_inline_style() requires a loaded CSS file, so we have to work around that if "Default CSS" is disabled 
     116                    if ( $this->model_options->get( 'use_default_css' ) ) 
     117                        wp_add_inline_style( 'tablepress-default', $custom_css ); // handle of the file to which the <style> shall be appended 
     118                    else 
     119                        add_action( 'wp_head', create_function( '$a', 'echo "<style type=\'text/css\'>\n' . $custom_css . '\n</style>\n";' ), 8 ); // priority 8 to hook in right after WP_Styles has been processed 
     120                } 
     121            } 
    112122        } 
    113123    } 
     
    118128     * @since 1.0.0 
    119129     */ 
    120     public function enqueue_datatables() { 
     130    protected function _enqueue_datatables() { 
    121131        $js_file = 'js/jquery.datatables.min.js'; 
    122132        $js_url = plugins_url( $js_file, TABLEPRESS__FILE__ ); 
     
    300310            $js_options = apply_filters( 'tablepress_table_js_options', $js_options, $table_id, $render_options ); 
    301311            $this->shown_tables[$table_id]['instances'][ $render_options['html_id'] ] = $js_options; 
    302             $this->enqueue_datatables(); 
     312            $this->_enqueue_datatables(); 
    303313        } 
    304314 
     
    478488     * @return string Eventually extended SQL "WHERE" clause, to also find posts/pages with Shortcodes in them 
    479489     */ 
    480     function posts_search_filter( $search_sql ) { 
     490    public function posts_search_filter( $search_sql ) { 
    481491        if ( ! is_search() ) 
    482492            return $search_sql; 
     
    499509            // remove hidden rows and re-index 
    500510            foreach ( $hidden_rows as $row_idx ) { 
    501                 if ( isset( $table['data'][$row_idx] ) ) 
    502                     unset( $table['data'][$row_idx] ); 
     511                unset( $table['data'][$row_idx] ); 
    503512            } 
    504513            $table['data'] = array_merge( $table['data'] ); 
     
    506515            foreach ( $table['data'] as $row_idx => $row ) { 
    507516                foreach ( $hidden_columns as $col_idx ) { 
    508                     if ( isset( $row[$col_idx] ) ) 
    509                         unset( $row[$col_idx] ); 
     517                    unset( $row[$col_idx] ); 
    510518                } 
    511519                $table['data'][$row_idx] = array_merge( $row ); 
  • tablepress/trunk/css/default.css

    r589540 r598765  
    2222    text-align: left; 
    2323    width: 100%; 
     24    margin-bottom: 1em; 
    2425} 
    2526 
     
    6667.dataTables_wrapper .tablepress { 
    6768    clear: both; 
     69    margin: 0 !important; 
    6870} 
    6971 
     
    8385    clear: both; 
    8486    float: left; 
     87    margin-top: 4px; 
    8588} 
    8689 
     
    8992    float: right; 
    9093    text-align: right; 
     94    margin-top: 4px; 
    9195} 
    9296/* Two button pagination - previous/next */ 
     
    225229.dataTables_wrapper label select { 
    226230    display: inline; 
     231    margin: 2px; 
    227232} 
    228233 
  • tablepress/trunk/css/default.min.css

    r589540 r598765  
    1 .tablepress-table-description{clear:both;display:block}.tablepress{border-collapse:collapse;border-spacing:0;text-align:left;width:100%}.tablepress th,.tablepress td{padding:8px}.tablepress th{font-weight:bold}.tablepress tbody tr,.tablepress tfoot tr{border-top:1px solid #ddd}.tablepress tbody tr:first-child{border-top:0}.tablepress thead tr{border-bottom:1px solid #ddd}.tablepress thead tr,.tablepress tfoot tr{background-color:#d9edf7}.tablepress tbody tr.odd{background-color:#f9f9f9}.tablepress tbody tr.even{background-color:#fff}.tablepress .row-hover tr:hover{background-color:#f3f3f3}.dataTables_wrapper{position:relative;clear:both;*zoom:1;margin-bottom:1em}.dataTables_wrapper .tablepress{clear:both}.dataTables_length{float:left}.dataTables_filter{float:right;text-align:right}.dataTables_info{clear:both;float:left}.dataTables_paginate{float:right;text-align:right}.paginate_disabled_previous,.paginate_enabled_previous,.paginate_disabled_next,.paginate_enabled_next{float:left;cursor:pointer;*cursor:hand;color:#111!important}.paginate_disabled_previous:hover,.paginate_enabled_previous:hover,.paginate_disabled_next:hover,.paginate_enabled_next:hover{text-decoration:none!important}.paginate_disabled_previous:active,.paginate_enabled_previous:active,.paginate_disabled_next:active,.paginate_enabled_next:active{outline:0}.paginate_disabled_previous,.paginate_disabled_next{color:#666!important}.paginate_disabled_previous,.paginate_enabled_previous{padding-left:23px}.paginate_disabled_next,.paginate_enabled_next{padding-right:23px;margin-left:10px}.paginate_enabled_previous{background:url('../img/back_enabled.png') no-repeat center left}.paginate_enabled_previous:hover{background:url('../img/back_enabled_hover.png') no-repeat center left}.paginate_disabled_previous{background:url('../img/back_disabled.png') no-repeat center left}.paginate_enabled_next{background:url('../img/forward_enabled.png') no-repeat center right}.paginate_enabled_next:hover{background:url('../img/forward_enabled_hover.png') no-repeat center right}.paginate_disabled_next{background:url('../img/forward_disabled.png') no-repeat center right}.paging_full_numbers{height:22px;line-height:22px}.paging_full_numbers a:active{outline:0}.paging_full_numbers a:hover{text-decoration:none}.paging_full_numbers a.paginate_button,.paging_full_numbers a.paginate_active{border:1px solid #aaa;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;padding:2px 5px;margin:0 3px;cursor:pointer;*cursor:hand;color:#333!important}.paging_full_numbers a.paginate_button{background-color:#ddd}.paging_full_numbers a.paginate_button:hover{background-color:#ccc;text-decoration:none!important}.paging_full_numbers a.paginate_active{background-color:#99b3ff}.dataTables_processing{display:none}.dataTables_scroll{clear:both}.dataTables_scrollBody{*margin-top:-1px;-webkit-overflow-scrolling:touch}.dataTables_wrapper .sorting,.dataTables_wrapper .sorting_asc,.dataTables_wrapper .sorting_desc{padding:8px 18px 8px 8px;cursor:pointer;*cursor:hand}.dataTables_wrapper .sorting{background:url('../img/both.gif') no-repeat center right}.dataTables_wrapper .sorting:hover{background-color:#049cdb}.dataTables_wrapper .sorting_asc{background:#049cdb url('../img/asc.gif') no-repeat center right}.dataTables_wrapper .sorting_desc{background:#049cdb url('../img/desc.gif') no-repeat center right}.dataTables_wrapper .sorting_asc_disabled{background:url('../img/sort_asc_disabled.png') no-repeat center right}.dataTables_wrapper .sorting_desc_disabled{background:url('../img/sort_desc_disabled.png') no-repeat center right}.dataTables_wrapper th:active{outline:0}.dataTables_wrapper:after{content:".";display:block;clear:both;visibility:hidden;line-height:0;height:0}html[xmlns] .dataTables_wrapper{display:block}* html .dataTables_wrapper{height:1%}.dataTables_wrapper label input,.dataTables_wrapper label select{display:inline}.tablepress-rtl{direction:rtl;text-align:right}.dataTables_wrapper .tablepress-rtl .sorting,.dataTables_wrapper .tablepress-rtl .sorting_asc,.dataTables_wrapper .tablepress-rtl .sorting_desc{background-position:left!important;padding:8px 8px 8px 18px} 
     1.tablepress-table-description{clear:both;display:block}.tablepress{border-collapse:collapse;border-spacing:0;text-align:left;width:100%;margin-bottom:1em}.tablepress th,.tablepress td{padding:8px}.tablepress th{font-weight:bold}.tablepress tbody tr,.tablepress tfoot tr{border-top:1px solid #ddd}.tablepress tbody tr:first-child{border-top:0}.tablepress thead tr{border-bottom:1px solid #ddd}.tablepress thead tr,.tablepress tfoot tr{background-color:#d9edf7}.tablepress tbody tr.odd{background-color:#f9f9f9}.tablepress tbody tr.even{background-color:#fff}.tablepress .row-hover tr:hover{background-color:#f3f3f3}.dataTables_wrapper{position:relative;clear:both;*zoom:1;margin-bottom:1em}.dataTables_wrapper .tablepress{clear:both;margin:0!important}.dataTables_length{float:left}.dataTables_filter{float:right;text-align:right}.dataTables_info{clear:both;float:left;margin-top:4px}.dataTables_paginate{float:right;text-align:right;margin-top:4px}.paginate_disabled_previous,.paginate_enabled_previous,.paginate_disabled_next,.paginate_enabled_next{float:left;cursor:pointer;*cursor:hand;color:#111!important}.paginate_disabled_previous:hover,.paginate_enabled_previous:hover,.paginate_disabled_next:hover,.paginate_enabled_next:hover{text-decoration:none!important}.paginate_disabled_previous:active,.paginate_enabled_previous:active,.paginate_disabled_next:active,.paginate_enabled_next:active{outline:0}.paginate_disabled_previous,.paginate_disabled_next{color:#666!important}.paginate_disabled_previous,.paginate_enabled_previous{padding-left:23px}.paginate_disabled_next,.paginate_enabled_next{padding-right:23px;margin-left:10px}.paginate_enabled_previous{background:url('../img/back_enabled.png') no-repeat center left}.paginate_enabled_previous:hover{background:url('../img/back_enabled_hover.png') no-repeat center left}.paginate_disabled_previous{background:url('../img/back_disabled.png') no-repeat center left}.paginate_enabled_next{background:url('../img/forward_enabled.png') no-repeat center right}.paginate_enabled_next:hover{background:url('../img/forward_enabled_hover.png') no-repeat center right}.paginate_disabled_next{background:url('../img/forward_disabled.png') no-repeat center right}.paging_full_numbers{height:22px;line-height:22px}.paging_full_numbers a:active{outline:0}.paging_full_numbers a:hover{text-decoration:none}.paging_full_numbers a.paginate_button,.paging_full_numbers a.paginate_active{border:1px solid #aaa;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;padding:2px 5px;margin:0 3px;cursor:pointer;*cursor:hand;color:#333!important}.paging_full_numbers a.paginate_button{background-color:#ddd}.paging_full_numbers a.paginate_button:hover{background-color:#ccc;text-decoration:none!important}.paging_full_numbers a.paginate_active{background-color:#99b3ff}.dataTables_processing{display:none}.dataTables_scroll{clear:both}.dataTables_scrollBody{*margin-top:-1px;-webkit-overflow-scrolling:touch}.dataTables_wrapper .sorting,.dataTables_wrapper .sorting_asc,.dataTables_wrapper .sorting_desc{padding:8px 18px 8px 8px;cursor:pointer;*cursor:hand}.dataTables_wrapper .sorting{background:url('../img/both.gif') no-repeat center right}.dataTables_wrapper .sorting:hover{background-color:#049cdb}.dataTables_wrapper .sorting_asc{background:#049cdb url('../img/asc.gif') no-repeat center right}.dataTables_wrapper .sorting_desc{background:#049cdb url('../img/desc.gif') no-repeat center right}.dataTables_wrapper .sorting_asc_disabled{background:url('../img/sort_asc_disabled.png') no-repeat center right}.dataTables_wrapper .sorting_desc_disabled{background:url('../img/sort_desc_disabled.png') no-repeat center right}.dataTables_wrapper th:active{outline:0}.dataTables_wrapper:after{content:".";display:block;clear:both;visibility:hidden;line-height:0;height:0}html[xmlns] .dataTables_wrapper{display:block}* html .dataTables_wrapper{height:1%}.dataTables_wrapper label input,.dataTables_wrapper label select{display:inline;margin:2px}.tablepress-rtl{direction:rtl;text-align:right}.dataTables_wrapper .tablepress-rtl .sorting,.dataTables_wrapper .tablepress-rtl .sorting_asc,.dataTables_wrapper .tablepress-rtl .sorting_desc{background-position:left!important;padding:8px 8px 8px 18px} 
  • tablepress/trunk/models/model-options.php

    r589540 r598765  
    3030    protected $default_plugin_options = array( 
    3131        'plugin_options_db_version' => 0, 
     32        'table_scheme_db_version' => 0, 
    3233        'prev_tablepress_version' => '0', 
    3334        'tablepress_version' => TablePress::version, 
     
    3637        'message_plugin_update_content' => '', 
    3738        'message_donation_nag' => true, 
     39        'use_default_css' => true, 
     40        'use_custom_css' => true, 
     41        'use_custom_css_file' => true, 
    3842        'custom_css' => '', 
    39         'use_custom_css_file' => true, 
    4043        'custom_css_version' => 0 
    4144    ); 
     
    279282            TablePress::redirect( array( 'action' => 'options', 'message' => 'success_save_error_custom_css' ) ); 
    280283        global $wp_filesystem; 
     284 
     285        // WP_CONTENT_DIR and (FTP-)Content-Dir can be different (e.g. if FTP working dir is /) 
     286        // We need to account for that by replacing the path difference in the filename 
     287        $path_difference = str_replace( $wp_filesystem->wp_content_dir(), '', trailingslashit( WP_CONTENT_DIR ) ); 
     288        if ( '' != $path_difference ) 
     289            $filename = str_replace( $path_difference, '', $filename ); 
     290 
    281291        $custom_css = $this->get( 'custom_css' ); 
    282292        $result = $wp_filesystem->put_contents( $filename, $custom_css, FS_CHMOD_FILE ); 
  • tablepress/trunk/models/model-post.php

    r589540 r598765  
    235235        $value = addslashes( $value ); // WP expects a slashed value... 
    236236        $success = add_post_meta( $post_id, $field, $value, true ); // true means unique 
     237        $success = ( false === $success ) ? false : true; // make sure that $success is a boolean, as add_post_meta() returns an ID or false 
    237238        return $success; 
    238239    } 
  • tablepress/trunk/models/model-table.php

    r589540 r598765  
    168168 
    169169        $post_id = $this->_get_post_id( $table_id ); 
    170         if ( 0 === $post_id ) 
     170        if ( false === $post_id ) 
    171171            return false; 
    172172 
     
    195195 
    196196        $table_ids = array_keys( $table_post ); 
     197        $table_ids = array_map( 'strval', $table_ids ); // convert table IDs to strings 
    197198        $post_ids = array_values( $table_post ); 
    198199 
     
    213214     * 
    214215     * @param array $table Table (needs to have $table['id']!) 
    215      * @return mixed False on error, int table ID on success 
     216     * @return mixed False on error, string table ID on success 
    216217     */ 
    217218    public function save( $table ) { 
     
    220221 
    221222        $post_id = $this->_get_post_id( $table['id'] ); 
    222         if ( 0 === $post_id ) 
     223        if ( false === $post_id ) 
    223224            return false; 
    224225 
     
    251252     * 
    252253     * @param array $table Table ($table['id'] is not necessary) 
    253      * @return mixed False on error, int table ID of the new table on success 
     254     * @return mixed False on error, string table ID of the new table on success 
    254255     */ 
    255256    public function add( $table ) { 
     
    281282     * 
    282283     * @param string $table_id ID of the table to be copied 
    283      * @return mixed False on error, int table ID of the new table on success 
     284     * @return mixed False on error, string table ID of the new table on success 
    284285     */ 
    285286    public function copy( $table_id ) { 
     
    314315            return false; 
    315316 
    316         $post_id = $this->_get_post_id( $table_id ); 
     317        $post_id = $this->_get_post_id( $table_id ); // no !false check necessary, as this is covered by table_exists() check above 
    317318        $deleted = $this->model_post->delete( $post_id ); // Post Meta fields will be deleted automatically by that function 
    318319 
     
    383384     * 
    384385     * @param string $table_id Table ID 
    385      * @return int Post ID on success, int 0 on error 
     386     * @return int Post ID on success, false on error 
    386387     */ 
    387388    protected function _get_post_id( $table_id ) { 
    388         $post_id = 0; 
    389389        $table_post = $this->tables->get( 'table_post' ); 
    390390        if ( isset( $table_post[ $table_id ] ) ) 
    391             $post_id = $table_post[ $table_id ]; 
    392         return $post_id; 
     391            return $table_post[ $table_id ]; 
     392        else 
     393            return false; 
    393394    } 
    394395 
     
    403404    protected function _update_post_id( $table_id, $post_id ) { 
    404405        $tables = $this->tables->get(); 
    405  
    406406        $tables['table_post'][ $table_id ] = $post_id; 
    407  
    408407        uksort( $tables['table_post'], 'strnatcasecmp' ); 
    409408        $this->tables->update( $tables ); 
     
    419418    protected function _remove_post_id( $table_id ) { 
    420419        $tables = $this->tables->get(); 
    421  
    422         if ( isset( $tables['table_post'][ $table_id ] ) ) 
    423             unset( $tables['table_post'][ $table_id ] ); 
    424  
     420        unset( $tables['table_post'][ $table_id ] ); 
    425421        $this->tables->update( $tables ); 
    426422    } 
     
    431427     * @since 1.0.0 
    432428     * 
    433      * @param int $old_id Old table ID 
    434      * @param int $new_id New table ID 
     429     * @param string $old_id Old table ID 
     430     * @param string $new_id New table ID 
    435431     * @return bool True on success, false on error 
    436432     */ 
    437433    public function change_table_id( $old_id, $new_id ) { 
    438434        $post_id = $this->_get_post_id( $old_id ); 
    439         if ( 0 === $post_id ) 
    440             return false; 
    441  
    442         // Check new ID for correct format (letters, numbers, -, and _ only) 
    443         if ( 0 !== preg_match( '/[^a-zA-Z0-9_-]/', $new_id ) ) 
     435        if ( false === $post_id ) 
     436            return false; 
     437 
     438        // Check new ID for correct format (string from letters, numbers, -, and _ only, except the '0' string) 
     439        if ( empty( $new_id ) || 0 !== preg_match( '/[^a-zA-Z0-9_-]/', $new_id ) ) 
    444440            return false; 
    445441 
     
    504500                'datatables_scrollX' => true, 
    505501                'datatables_custom_commands' => '' 
    506                 //'datatables_tabletools' => false, 
    507                 //'cache_table_output' => true??? 
     502                //'datatables_tabletools' => false 
    508503            ), 
    509504            'visibility' => array( 
     
    602597        $table['options']['last_editor'] = get_current_user_id(); 
    603598        // Table Options 
    604         if ( isset( $new_table['options'] ) ) { 
    605             // specials check for certain options -> need to be unset, so that they are not merged in the next step 
    606             if ( isset( $new_table['options']['extra_css_classes'] ) ) { 
    607                 $table['options']['extra_css_classes'] = preg_replace( '/[^a-zA-Z0-9_ -]/', '', $new_table['options']['extra_css_classes'] ); 
    608                 unset( $new_table['options']['extra_css_classes'] ); 
     599        if ( isset( $new_table['options'] ) ) { // is for example not set for newly added tables 
     600            // specials check for certain options 
     601            if ( isset( $new_table['options']['extra_css_classes'] ) ) 
     602                $new_table['options']['extra_css_classes'] = preg_replace( '/[^a-zA-Z0-9_ -]/', '', $new_table['options']['extra_css_classes'] ); 
     603            if ( isset( $new_table['options']['datatables_paginate_entries'] ) ) { 
     604                $new_table['options']['datatables_paginate_entries'] = intval( $new_table['options']['datatables_paginate_entries'] ); 
     605                if ( $new_table['options']['datatables_paginate_entries'] < 1 ) 
     606                    $new_table['options']['datatables_paginate_entries'] = 10; // default value 
    609607            } 
    610             // merge remaining new options 
     608            // merge new options 
    611609            $table['options'] = array_merge( $table['options'], $new_table['options'] ); 
    612610        } 
    613611        // Table Visibility 
    614         $table['visibility']['rows'] = array_map( 'intval', $new_table['visibility']['rows'] ); 
    615         $table['visibility']['columns'] = array_map( 'intval', $new_table['visibility']['columns'] ); 
     612        $table['visibility']['rows'] = $new_table['visibility']['rows']; 
     613        $table['visibility']['columns'] = $new_table['visibility']['columns']; 
    616614 
    617615        return $table; 
     
    716714    /** 
    717715     * Merge existing Table Options with default Table Options, 
    718      * remove (no longer) existing options, e.g. after a plugin update, 
     716     * remove (no longer) existing options, after a table scheme change, 
    719717     * for all tables 
    720718     * 
  • tablepress/trunk/readme.txt

    r589540 r598765  
    33Donate link: http://tablepress.org/donate/ 
    44Tags: html,table,data,editor,csv,excel,import,export 
    5 Requires at least: 3.4.1 
     5Requires at least: 3.4.2 
    66Tested up to: 3.5 
    77License: GPLv2 
     
    5959= Requirements? = 
    6060 
    61 In short: WordPress 3.4.1 or higher, while the latest version of WordPress is always recommended. 
     61In short: WordPress 3.4.2 or higher, while the latest version of WordPress is always recommended. 
    6262 
    6363= Languages and Localization? = 
     
    102102You may use it free of charge for any purpose. 
    103103I kindly ask you for link somewhere on your website to http://tablepress.org/. This is not required! 
    104 I'm also happy about [donations](http://tablepress.org/donate/) or something from [my wishlist](http://tobias.baethge.com/wishlist/)! Thanks! 
     104I'm also happy about [donations](http://tablepress.org/donate/) or something from [my wishlist](http://tablepress.org/wishlist/)! Thanks! 
    105105 
    106106== Changelog == 
  • tablepress/trunk/tablepress.php

    r589540 r598765  
    1212Plugin URI: http://tablepress.org/ 
    1313Description: TablePress enables you to create and manage tables in your posts and pages, without having to write HTML code, and it adds valuable functions for your visitors. 
    14 Version: 0.4-alpha 
     14Version: 0.5-alpha 
    1515Author: Tobias Bäthge 
    1616Author URI: http://tobias.baethge.com/ 
    17 Author eMail: wordpress@tobias.baethge.com 
     17Author email: wordpress@tobias.baethge.com 
    1818Text Domain: tablepress 
    1919Domain Path: /i18n 
  • tablepress/trunk/views/view-about.php

    r589540 r598765  
    119119            <?php _e( 'You are using the following versions of the software.', 'tablepress' ); ?> <strong><?php _e( 'Please provide this information in bug reports and support requests.', 'tablepress' ); ?></strong><br /> 
    120120            <br />&middot; Website: <?php echo site_url(); ?> 
     121            <br />&middot; TablePress: <?php echo TablePress::version; ?> 
    121122            <br />&middot; TablePress (DB): <?php echo TablePress::db_version; ?> 
    122             <br />&middot; TablePress (Script): <?php echo TablePress::version; ?> 
     123            <br />&middot; TablePress table scheme: <?php echo TablePress::table_scheme_version; ?> 
    123124            <br />&middot; <?php _e( 'Plugin installed', 'tablepress' ); ?>: <?php echo date( 'Y/m/d H:i:s', $data['first_activation'] ); ?> 
    124125            <br />&middot; WordPress: <?php echo $GLOBALS['wp_version']; ?> 
  • tablepress/trunk/views/view-edit.php

    r589540 r598765  
    8282                'saving_changes' => 'Speichere Änderungen...', 
    8383                'table_id_not_empty' => __( 'The Table ID field can not be empty. Please enter a Table ID!', 'tablepress' ), 
     84                'table_id_not_zero' => __( 'The Table ID &quot;0&quot; is not supported. Please enter a different Table ID!', 'tablepress' ), 
    8485                'ays_change_table_id' => 'Willst du die Tabellen-ID wirklich ändern? Alle Shortcodes für diese Tabelle müssen angepasst werden!', 
    8586                'extra_css_classes_invalid' => __( 'The entered value in the field &quot;Extra CSS classes&quot; is invalid.', 'tablepress' ), 
     
    279280    <tr class="bottom-border"> 
    280281        <td> 
    281             <input type="button" class="button-secondary" id="link-add" value="<?php _e( 'Insert Link', 'tablepress' ); ?>" /> 
    282             <a href="<?php echo $media_library_url; ?>" class="button-secondary" id="image-add"><?php _e( 'Insert Image', 'tablepress' ); ?></a> 
    283             <input type="button" class="button-secondary" id="advanced-editor-open" value="<?php _e( 'Advanced Editor', 'tablepress' ); ?>" /> 
     282            <input type="button" class="button button-small" id="link-add" value="<?php _e( 'Insert Link', 'tablepress' ); ?>" /> 
     283            <a href="<?php echo $media_library_url; ?>" class="button button-small" id="image-add"><?php _e( 'Insert Image', 'tablepress' ); ?></a> 
     284            <input type="button" class="button button-small" id="advanced-editor-open" value="<?php _e( 'Advanced Editor', 'tablepress' ); ?>" /> 
    284285        </td> 
    285286        <td> 
    286287            <?php _e( 'Combine cells', 'tablepress' ); ?>:&nbsp; 
    287             <input type="button" class="button-secondary" id="span-add-rowspan" value="<?php _e( 'in a column (rowspan)', 'tablepress' ); ?>" /> 
    288             <input type="button" class="button-secondary" id="span-add-colspan" value="<?php _e( 'in a row (colspan)', 'tablepress' ); ?>" /> 
    289             <input type="button" class="button-secondary show-help-box" value="<?php _e( '?', 'tablepress' ); ?>" title="<?php _e( 'Help on combining cells' ); ?>" /> 
     288            <input type="button" class="button button-small" id="span-add-rowspan" value="<?php _e( 'in a column (rowspan)', 'tablepress' ); ?>" /> 
     289            <input type="button" class="button button-small" id="span-add-colspan" value="<?php _e( 'in a row (colspan)', 'tablepress' ); ?>" /> 
     290            <input type="button" class="button button-small show-help-box" value="<?php _e( '?', 'tablepress' ); ?>" title="<?php _e( 'Help on combining cells' ); ?>" /> 
    290291            <div class="hidden-container hidden-help-box-container"><?php 
    291292                echo '<p>' . __( 'Table cells can span across more than one column or row.', 'tablepress' ) . '</p>'; 
     
    302303        <td> 
    303304            <?php _e( 'Selected rows', 'tablepress' ); ?>:&nbsp; 
    304             <input type="button" class="button-secondary" id="rows-hide" value="<?php _e( 'Hide', 'tablepress' ); ?>" /> 
    305             <input type="button" class="button-secondary" id="rows-unhide" value="<?php _e( 'Show', 'tablepress' ); ?>" /> 
     305            <input type="button" class="button button-small" id="rows-hide" value="<?php _e( 'Hide', 'tablepress' ); ?>" /> 
     306            <input type="button" class="button button-small" id="rows-unhide" value="<?php _e( 'Show', 'tablepress' ); ?>" /> 
    306307        </td> 
    307308        <td> 
    308309            <?php _e( 'Selected columns', 'tablepress' ); ?>:&nbsp; 
    309             <input type="button" class="button-secondary" id="columns-hide" value="<?php _e( 'Hide', 'tablepress' ); ?>" /> 
    310             <input type="button" class="button-secondary" id="columns-unhide" value="<?php _e( 'Show', 'tablepress' ); ?>" /> 
     310            <input type="button" class="button button-small" id="columns-hide" value="<?php _e( 'Hide', 'tablepress' ); ?>" /> 
     311            <input type="button" class="button button-small" id="columns-unhide" value="<?php _e( 'Show', 'tablepress' ); ?>" /> 
    311312        </td> 
    312313    </tr> 
     
    314315        <td> 
    315316            <?php _e( 'Selected rows', 'tablepress' ); ?>:&nbsp; 
    316             <input type="button" class="button-secondary" id="rows-insert" value="<?php _e( 'Insert', 'tablepress' ); ?>" /> 
    317             <input type="button" class="button-secondary" id="rows-remove" value="<?php _e( 'Delete', 'tablepress' ); ?>" /> 
     317            <input type="button" class="button button-small" id="rows-insert" value="<?php _e( 'Insert', 'tablepress' ); ?>" /> 
     318            <input type="button" class="button button-small" id="rows-remove" value="<?php _e( 'Delete', 'tablepress' ); ?>" /> 
    318319        </td> 
    319320        <td> 
    320321            <?php _e( 'Selected columns', 'tablepress' ); ?>:&nbsp; 
    321             <input type="button" class="button-secondary" id="columns-insert" value="<?php _e( 'Insert', 'tablepress' ); ?>" /> 
    322             <input type="button" class="button-secondary" id="columns-remove" value="<?php _e( 'Delete', 'tablepress' ); ?>" /> 
    323         </td> 
    324     </tr> 
    325     <tr class="top-border"> 
    326         <td> 
    327             <?php printf( __( 'Add %s row(s)', 'tablepress' ), '<input type="number" id="rows-append-number" class="small-text numbers-only" title="' . __( 'This field must contain a positive number.', 'tablepress' ) . '" value="1" min="1" max="99999" maxlength="5" required />' ); ?>&nbsp;<input type="button" class="button-secondary" id="rows-append" value="<?php _e( 'Add', 'tablepress' ); ?>" /> 
    328         </td> 
    329         <td> 
    330             <?php printf( __( 'Add %s column(s)', 'tablepress' ), '<input type="number" id="columns-append-number" class="small-text numbers-only" title="' . __( 'This field must contain a positive number.', 'tablepress' ) . '" value="1" min="1" max="99999" maxlength="5" required />' ); ?>&nbsp;<input type="button" class="button-secondary" id="columns-append" value="<?php _e( 'Add', 'tablepress' ); ?>" /> 
     322            <input type="button" class="button button-small" id="columns-insert" value="<?php _e( 'Insert', 'tablepress' ); ?>" /> 
     323            <input type="button" class="button button-small" id="columns-remove" value="<?php _e( 'Delete', 'tablepress' ); ?>" /> 
     324        </td> 
     325    </tr> 
     326    <tr class="top-border"> 
     327        <td> 
     328            <?php printf( __( 'Add %s row(s)', 'tablepress' ), '<input type="number" id="rows-append-number" class="small-text numbers-only" title="' . __( 'This field must contain a positive number.', 'tablepress' ) . '" value="1" min="1" max="99999" maxlength="5" required />' ); ?>&nbsp;<input type="button" class="button button-small" id="rows-append" value="<?php _e( 'Add', 'tablepress' ); ?>" /> 
     329        </td> 
     330        <td> 
     331            <?php printf( __( 'Add %s column(s)', 'tablepress' ), '<input type="number" id="columns-append-number" class="small-text numbers-only" title="' . __( 'This field must contain a positive number.', 'tablepress' ) . '" value="1" min="1" max="99999" maxlength="5" required />' ); ?>&nbsp;<input type="button" class="button button-small" id="columns-append" value="<?php _e( 'Add', 'tablepress' ); ?>" /> 
    331332        </td> 
    332333    </tr> 
     
    345346        ?> 
    346347            <p class="submit"> 
    347                 <a href="<?php echo $preview_url; ?>" class="button-secondary show-preview-button" target="_blank"><?php _e( 'Preview', 'tablepress' ); ?></a> 
    348                 <input type="button" class="button-primary save-changes-button hide-if-no-js" value="<?php _e( 'Save Changes', 'tablepress' ); ?>" /> 
    349                 <input type="submit" class="button-primary hide-if-js" value="<?php _e( 'Save Changes', 'tablepress' ); ?>" /> 
     348                <a href="<?php echo $preview_url; ?>" class="button show-preview-button" target="_blank"><?php _e( 'Preview', 'tablepress' ); ?></a> 
     349                <input type="button" class="button button-primary save-changes-button hide-if-no-js" value="<?php _e( 'Save Changes', 'tablepress' ); ?>" /> 
     350                <input type="submit" class="button button-primary hide-if-js" value="<?php _e( 'Save Changes', 'tablepress' ); ?>" /> 
    350351            </p> 
    351352        <?php 
     
    361362            <p class="submit"> 
    362363                <?php _e( 'Other Actions' ); ?>:&nbsp; 
    363                 <a href="<?php echo TablePress::url( array( 'action' => 'delete_table', 'item' => $data['table']['id'], 'return' => 'edit', 'return_item' => $data['table']['id'] ), true, 'admin-post.php' ); ?>" class="button-secondary delete-link"><?php _e( 'Delete Table', 'tablepress' ); ?></a> 
    364                 <a href="<?php echo TablePress::url( array( 'action' => 'export', 'table_id' => $data['table']['id'] ) ); ?>" class="button-secondary"><?php _e( 'Export Table', 'tablepress' ); ?></a> 
     364                <a href="<?php echo TablePress::url( array( 'action' => 'delete_table', 'item' => $data['table']['id'], 'return' => 'edit', 'return_item' => $data['table']['id'] ), true, 'admin-post.php' ); ?>" class="button delete-link"><?php _e( 'Delete Table', 'tablepress' ); ?></a> 
     365                <a href="<?php echo TablePress::url( array( 'action' => 'export', 'table_id' => $data['table']['id'] ) ); ?>" class="button"><?php _e( 'Export Table', 'tablepress' ); ?></a> 
    365366            </p> 
    366367        <?php 
     
    387388    <div class="submitbox"> 
    388389        <a href="#" class="submitdelete" id="advanced-editor-cancel"><?php _e( 'Cancel', 'tablepress' ); ?></a> 
    389         <input type="button" class="button-primary" id="advanced-editor-confirm" value="<?php _e( 'OK', 'tablepress' ); ?>" /> 
     390        <input type="button" class="button button-primary" id="advanced-editor-confirm" value="<?php _e( 'OK', 'tablepress' ); ?>" /> 
    390391    </div> 
    391392    </div> 
  • tablepress/trunk/views/view-editor_button_thickbox.php

    r589540 r598765  
    182182        parent::__construct( array( 
    183183            'singular'  => 'tablepress-table',              // singular name of the listed records 
    184             'plural'    => 'tablepress-editor-button-list', // plural name of the listed records 
     184            'plural'    => 'tablepress-editor-button-list', // plural name of the listed records 
    185185            'ajax'      => false                            // does this list table support AJAX? 
    186186        ) ); 
     
    299299     */ 
    300300    protected function column_table_action( $item ) { 
    301         return '<input type="button" class="insert-shortcode button-secondary" title="[' . TablePress::$shortcode . ' id=' . esc_attr( $item['id'] ) . ' /]" value="' . __( 'Insert Shortcode', 'tablepress' ) . '" />'; 
     301        return '<input type="button" class="insert-shortcode button button-small" title="[' . TablePress::$shortcode . ' id=' . esc_attr( $item['id'] ) . ' /]" value="' . __( 'Insert Shortcode', 'tablepress' ) . '" />'; 
    302302    } 
    303303 
     
    416416            'total_items' => $total_items,                  // total number of records/items 
    417417            'per_page' => $per_page,                        // number of items per page 
    418             'total_pages' => ceil( $total_items/$per_page ) // total number of pages 
     418            'total_pages' => ceil( $total_items/$per_page ) // total number of pages 
    419419        ) ); 
    420420    } 
  • tablepress/trunk/views/view-export.php

    r558089 r598765  
    153153        ?> 
    154154            <input type="checkbox" id="tables-export-zip-file" name="export[zip_file]" value="true" /> 
    155             <label for="tables-export-zip-file"><?php _e( 'Create a ZIP archive.', 'tablepress' ); ?></label> 
    156             <span id="tables-export-zip-file-description" class="description hide-if-js"><?php _e( '(Mandatory if more than one table is selected.)', 'tablepress' ); ?></span> 
     155            <label for="tables-export-zip-file"><?php _e( 'Create a ZIP archive.', 'tablepress' ); ?> <span id="tables-export-zip-file-description" class="description hide-if-js"><?php _e( '(Mandatory if more than one table is selected.)', 'tablepress' ); ?></span></label> 
    157156        <?php 
    158157            } else { 
  • tablepress/trunk/views/view-import.php

    r558089 r598765  
    4545        $this->add_text_box( 'head', array( &$this, 'textbox_head' ), 'normal' ); 
    4646        $this->add_meta_box( 'import-form', __( 'Import Tables', 'tablepress' ), array( &$this, 'postbox_import_form' ), 'normal' ); 
    47         $this->data['submit_button_caption'] = __( 'Import', 'tablepress' ); 
    48         $this->add_text_box( 'submit', array( &$this, 'textbox_submit_button' ), 'additional' ); 
    49         if ( $data['wp_table_reloaded_installed'] ) { 
     47        if ( $data['wp_table_reloaded_installed'] ) 
    5048            $this->add_meta_box( 'import-wp-table-reloaded', __( 'Import from WP-Table Reloaded', 'tablepress' ), array( &$this, 'postbox_wp_table_reloaded_import' ), 'additional' ); 
    51             $this->add_text_box( 'submit', array( &$this, 'textbox_submit_button' ), 'submit' ); 
    52         } 
    5349    } 
    5450 
     
    143139        </td> 
    144140    </tr> 
    145     <tr id="row-import-replace-table"> 
     141    <tr id="row-import-replace-table" class="bottom-border"> 
    146142        <th class="column-1" scope="row"><label for="tables-import-replace-table"><?php _e( 'Table to replace', 'tablepress' ); ?>:</label></th> 
    147143        <td class="column-2"> 
     
    160156        </td> 
    161157    </tr> 
     158    <tr class="top-border"> 
     159        <th class="column-1" scope="row"></th> 
     160        <td class="column-2"><input type="submit" value="<?php echo esc_attr__( 'Import', 'tablepress' ); ?>" class="button button-primary" name="submit" /></td> 
     161    </tr> 
    162162</tbody> 
    163163</table> 
     
    172172    public function postbox_wp_table_reloaded_import( $data, $box ) { 
    173173        ?> 
    174         <p><?php _e( 'Import from WP-Table Reloaded', 'tablepress' ); ?></p> 
     174<p><?php _e( 'Import from WP-Table Reloaded', 'tablepress' ); ?></p> 
     175<table class="tablepress-postbox-table fixed"> 
     176<tbody> 
     177    <tr class="no-border"> 
     178        <th class="column-1" scope="row"><?php _e( 'Tables', 'tablepress' ); ?>:</th> 
     179        <td class="column-2"><label for="import-wp-table-reloaded-tables"> <input type="checkbox" id="import-wp-table-reloaded-tables" name="import[wp_table_reloaded][tables]" value="true" checked="checked" /> <?php _e( 'Import all tables and their settings from WP-Table Reloaded.', 'tablepress' ); ?> <?php _e( '<span class="description">(recommended)</span>', 'tablepress' ); ?></label></td> 
     180    </tr> 
     181    <tr class="bottom-border"> 
     182        <th class="column-1" scope="row"><?php _e( 'Styling', 'tablepress' ); ?>:</th> 
     183        <td class="column-2"><label for="import-wp-table-reloaded-css"> <input type="checkbox" id="import-wp-table-reloaded-css" name="import[wp_table_reloaded][css]" value="true" checked="checked" /> <?php _e( 'Try to automatically convert the "Custom CSS" code from the "Plugin Options" screen of WP-Table Reloaded.', 'tablepress' ); ?></label></td> 
     184    </tr> 
     185    <tr class="top-border"> 
     186        <th class="column-1" scope="row"></th> 
     187        <td class="column-2"><input type="submit" value="<?php echo esc_attr__( 'Import from WP-Table Reloaded', 'tablepress' ); ?>" class="button" id="submit_wp_table_reloaded_import" name="submit_wp_table_reloaded_import" /></td> 
     188    </tr> 
     189</tbody> 
     190</table> 
    175191        <?php 
    176192    } 
  • tablepress/trunk/views/view-list.php

    r589540 r598765  
    3131 
    3232    /** 
     33     * List of WP feature pointers for this view 
     34     * 
     35     * @since 1.0.0 
     36     * 
     37     * @var array 
     38     */ 
     39    // protected $wp_pointers = array( 'tp100_navbar' ); // @TODO: Temporarily disabled 
     40 
     41    /** 
    3342     * Set up the view with data and do things that are specific for this view 
    3443     * 
     
    5665        if ( $data['messages']['wp_table_reloaded_warning'] ) 
    5766            $this->add_header_message( 
    58                 sprintf( __( '<strong><em>Attention!</em></strong><br />You have activated the plugin WP-Table Reloaded, which can not be used together with TablePress.<br />Please follow the <a href="%s" title"Migration Guide from WP-Table Reloaded to TablePress">migration guide</a> and then deactivate WP-Table Reloaded!', 'tablepress' ), 'http://tablepress.org/migration-from-wp-table-reloaded/' ), 
     67                '<strong><em>' . __( 'Attention!', 'tablepress' ) . '</em></strong><br />' 
     68                . __( 'You have activated the plugin WP-Table Reloaded, which can not be used together with TablePress.', 'tablepress' ) . '<br />' 
     69                . sprintf( __( 'Please follow the <a href="%s" title"Migration Guide from WP-Table Reloaded to TablePress">migration guide</a> and then deactivate WP-Table Reloaded!', 'tablepress' ), 'http://tablepress.org/migration-from-wp-table-reloaded/' ) . '<br />' 
     70                . '<a href="' . TablePress::url( array( 'action' => 'import' ) ) . '" class="button button-primary" title="' . __( 'Import your tables from WP-Table Reloaded', 'tablepress' ) . '" style="color:#ffffff;margin-top:5px;">' . __( 'Import your tables from WP-Table Reloaded', 'tablepress' ) . '</a>', 
    5971                'error' 
    6072            ); 
     
    6375            $this->add_header_message( 
    6476                '<img alt="' . __( 'Tobias Bäthge, developer of TablePress', 'tablepress' ) . '" src="https://secure.gravatar.com/avatar/50f1cff2e27a1f522b18ce229c057bc5?s=94" height="94" width="94" style="float:left;margin-right:10px;" />' . 
    65                 __( 'Hi, my name is Tobias, I\'m the developer of the TablePress plugin.', 'tablepress' ) . '<br /><br />' . 
    66                 __( 'Thanks for using it! You\'ve installed TablePress over a month ago.', 'tablepress' ) . ' ' . 
    67                 sprintf( _n( 'If everything works and you are satisfied with the results of managing your %s table, isn\'t that worth a coffee or two?', 'If everything works and you are satisfied with the results of managing your %s tables, isn\'t that worth a coffee or two?', $data['table_count'], 'tablepress' ), $data['table_count'] ) . '<br/>' . 
    68                 sprintf( __( '<a href="%s">Donations</a> help me to continue user support and development of this <em>free</em> software &mdash; things for which I spend countless hours of my free time! Thank you very much!', 'tablepress' ), 'http://tablepress.org/donate/' ) . '<br/><br />' . 
    69                 __( 'Sincerly, Tobias', 'tablepress' ) . '<br /><br />' . 
    70                 sprintf( '<a href="%s" target="_blank"><strong>%s</strong></a>', 'http://tablepress.org/donate/', __( 'Sure, I\'ll buy you a coffee and support TablePress!', 'tablepress' ) ) . '&nbsp;&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;&nbsp;&nbsp;' . 
     77                __( 'Hi, my name is Tobias, I\'m the developer of the TablePress plugin.', 'tablepress' ) . '<br /><br />' . 
     78                __( 'Thanks for using it! You\'ve installed TablePress over a month ago.', 'tablepress' ) . ' ' . 
     79                sprintf( _n( 'If everything works and you are satisfied with the results of managing your %s table, isn\'t that worth a coffee or two?', 'If everything works and you are satisfied with the results of managing your %s tables, isn\'t that worth a coffee or two?', $data['table_count'], 'tablepress' ), $data['table_count'] ) . '<br/>' . 
     80                sprintf( __( '<a href="%s">Donations</a> help me to continue user support and development of this <em>free</em> software &mdash; things for which I spend countless hours of my free time! Thank you very much!', 'tablepress' ), 'http://tablepress.org/donate/' ) . '<br/><br />' . 
     81                __( 'Sincerly, Tobias', 'tablepress' ) . '<br /><br />' . 
     82                sprintf( '<a href="%s" target="_blank"><strong>%s</strong></a>', 'http://tablepress.org/donate/', __( 'Sure, I\'ll buy you a coffee and support TablePress!', 'tablepress' ) ) . '&nbsp;&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;&nbsp;&nbsp;' . 
    7183                $this->ajax_link( array( 'action' => 'hide_message', 'item' => 'donation_nag', 'return' => 'list' ) , __( 'I already donated.', 'tablepress' ) ) . '&nbsp;&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;&nbsp;&nbsp;' . 
    7284                $this->ajax_link( array( 'action' => 'hide_message', 'item' => 'donation_nag', 'return' => 'list' ) , __( 'No, thanks. Don\'t ask again.', 'tablepress' ) ) 
     
    7486 
    7587        if ( $data['messages']['show_plugin_update'] ) { 
    76             $message = '<strong><em>Thank you for updating to TablePress ' . TablePress::version . ' (revision ' . TablePress::db_version . ')!</em></strong><br />'; 
     88            $message = '<strong><em>Thank you for updating to TablePress ' . TablePress::version . '!</em></strong><br />'; 
    7789            if ( ! empty( $data['messages']['plugin_update_message'] ) ) 
    7890                $message .= $data['messages']['plugin_update_message'] . '<br /><br />'; 
     
    212224    } 
    213225 
     226    /** 
     227     * Set the content for the WP feature pointer about the TablePress nav bar 
     228     * 
     229     * @since 1.0.0 
     230     */ 
     231    public function wp_pointer_tp100_navbar() { 
     232        $content  = '<h3>' . __( 'TablePress Feature: Navigation', 'tablepress' ) . '</h3>'; 
     233        $content .= '<p>' .  __( 'Add a new table to get started!', 'tablepress' ) . '</p>'; 
     234 
     235        $this->admin_page->print_wp_pointer_js( 'tp100_navbar', '#tablepress-nav', array( 
     236            'content'  => $content, 
     237            'position' => array( 'edge' => 'top', 'align' => 'left', 'offset' => '250 0' ), 
     238        ) ); 
     239    } 
     240 
    214241} // class TablePress_List_View 
    215242 
     
    242269        parent::__construct( array( 
    243270            'singular'  => 'tablepress-table',      // singular name of the listed records 
    244             'plural'    => 'tablepress-all-tables', // plural name of the listed records 
     271            'plural'    => 'tablepress-all-tables', // plural name of the listed records 
    245272            'ajax'      => false                    // does this list table support AJAX? 
    246273        ) ); 
     
    461488        } 
    462489        echo "</select>\n"; 
    463         echo '<input type="submit" name="" id="doaction' . $two . '" class="button-secondary action" value="' . __( 'Apply', 'tablepress' ) . '" />' . "\n"; 
     490        echo '<input type="submit" name="" id="doaction' . $two . '" class="button action" value="' . __( 'Apply', 'tablepress' ) . '" />' . "\n"; 
    464491    } 
    465492 
     
    593620            'total_items' => $total_items,                  // total number of records/items 
    594621            'per_page' => $per_page,                        // number of items per page 
    595             'total_pages' => ceil( $total_items/$per_page ) // total number of pages 
     622            'total_pages' => ceil( $total_items/$per_page ) // total number of pages 
    596623        ) ); 
    597624    } 
  • tablepress/trunk/views/view-options.php

    r558089 r598765  
    2222 
    2323    /** 
     24     * List of WP feature pointers for this view 
     25     * 
     26     * @since 1.0.0 
     27     * 
     28     * @var array 
     29     */ 
     30    // protected $wp_pointers = array( 'tp100_custom_css' ); // @TODO: Temporarily disabled 
     31 
     32    /** 
    2433     * Set up the view with data and do things that are specific for this view 
    2534     * 
     
    3544        $this->admin_page->enqueue_script( 'codemirror' ); 
    3645        $this->admin_page->enqueue_script( 'codemirror-css', array( 'tablepress-codemirror' ) ); 
    37         add_action( "admin_footer-{$GLOBALS['hook_suffix']}", array( &$this, 'print_codemirror_js' ) ); 
     46        $this->admin_page->enqueue_script( 'options', array( 'jquery', 'tablepress-codemirror', 'tablepress-codemirror-css' ) ); 
    3847 
    3948        $action_messages = array( 
     
    4958        $this->add_text_box( 'head', array( &$this, 'textbox_head' ), 'normal' ); 
    5059        $this->add_meta_box( 'frontend-options', __( 'Frontend Options', 'tablepress' ), array( &$this, 'postbox_frontend_options' ), 'normal' ); 
    51         $this->add_meta_box( 'backend-options', __( 'Backend Options', 'tablepress' ), array( &$this, 'postbox_backend_options' ), 'normal' ); 
     60        // $this->add_meta_box( 'backend-options', __( 'Backend Options', 'tablepress' ), array( &$this, 'postbox_backend_options' ), 'normal' ); // @TODO: Commented out as backend options are not yet used 
    5261        $this->add_meta_box( 'user-options', __( 'User Options', 'tablepress' ), array( &$this, 'postbox_user_options' ), 'normal' ); 
    53         $this->data['submit_button_caption'] = __( 'Save Options', 'tablepress' ); 
     62        $this->data['submit_button_caption'] = __( 'Save Changes', 'tablepress' ); 
    5463        $this->add_text_box( 'submit', array( &$this, 'textbox_submit_button' ), 'submit' ); 
    55     } 
    56  
    57     /** 
    58      * Print the JavaScript code to invoke CodeMirror on the "Custom CSS" textarea (in the admin footer) 
    59      * 
    60      * @since 1.0.0 
    61      */ 
    62     public function print_codemirror_js() { 
    63         echo <<<JS 
    64 <script type="text/javascript"> 
    65 CodeMirror.fromTextArea( document.getElementById( 'option-custom-css' ), { 
    66     mode: 'css', 
    67     indentUnit: 2, 
    68     tabSize: 2, 
    69     indentWithTabs: true 
    70 } ); 
    71 </script> 
    72 JS; 
    7364    } 
    7465 
     
    9384<table class="tablepress-postbox-table fixed"> 
    9485<tbody> 
     86    <tr class="bottom-border"> 
     87        <th class="column-1" scope="row"><?php _e( 'Default CSS', 'tablepress' ); ?>:</th> 
     88        <td class="column-2"><label for="option-use-default-css"><input type="checkbox" id="option-use-default-css" name="options[use_default_css]" value="true"<?php checked( $data['frontend_options']['use_default_css'] ); ?> /> <?php _e( 'Load the default table styling.', 'tablepress' ); ?> <?php _e( '<span class="description">(recommended)</span>', 'tablepress' ); ?></label> 
     89        </td> 
     90    </tr> 
     91    <tr class="top-border"> 
     92        <th class="column-1" scope="row"><?php _e( 'Custom CSS', 'tablepress' ); ?>:</th> 
     93        <td class="column-2"><label for="option-use-custom-css"><input type="checkbox" id="option-use-custom-css" name="options[use_custom_css]" value="true"<?php checked( $data['frontend_options']['use_custom_css'] ); ?> /> <?php _e( 'Load these "Custom CSS" commands to influence the table styling:', 'tablepress' ); ?></label> 
     94        </td> 
     95    </tr> 
    9596    <tr> 
    96         <th class="column-1" scope="row"><label for="option-use-custom-css-file"><?php _e( 'Custom CSS file', 'tablepress' ); ?>:</label></th> 
    97         <td class="column-2"><input type="checkbox" id="option-use-custom-css-file" name="options[use_custom_css_file]" value="true"<?php checked( $data['frontend_options']['use_custom_css_file'] ); ?> /> 
     97        <th class="column-1" scope="row"></th> 
     98        <td class="column-2"> 
     99            <textarea name="options[custom_css]" id="option-custom-css" class="large-text" rows="8"><?php echo esc_textarea( $data['frontend_options']['custom_css'] ); ?></textarea> 
     100            <p class="description"><?php 
     101                _e( sprintf( '"Custom CSS" (<a href="%s">Cascading Style Sheets</a>) can be used to change the styling or layout of a table.', 'http://www.htmldog.com/guides/cssbeginner/' ), 'tablepress' ); 
     102                echo ' '; 
     103                _e( sprintf( 'You can get styling examples from the <a href="%s">FAQ</a>.', 'http://tablepress.org/faq/' ), 'tablepress' ); 
     104                echo ' '; 
     105                _e( sprintf( 'Information on available CSS selectors can be found in the <a href="%s">documentation</a>.', 'http://tablepress.org/documentation/' ), 'tablepress' ); 
     106            ?></p> 
     107            <label for="option-use-custom-css-file"><input type="checkbox" id="option-use-custom-css-file" name="options[use_custom_css_file]" value="true"<?php checked( $data['frontend_options']['use_custom_css_file'] ); ?> /> <?php _e( 'Use a file for storing and loading the "Custom CSS" code.', 'tablepress' ); ?> <?php _e( '<span class="description">(recommended)</span>', 'tablepress' ); ?></label><br /> 
    98108        <?php 
    99109            echo content_url( 'tablepress-custom.css' ); 
     
    102112        ?> 
    103113        </td> 
    104     </tr> 
    105     <tr> 
    106         <th class="column-1 top-align" scope="row"><label for="option-custom-css"><?php _e( 'Custom CSS', 'tablepress' ); ?>:</label></th> 
    107         <td class="column-2"><textarea name="options[custom_css]" id="option-custom-css" class="large-text" rows="8"><?php echo esc_textarea( $data['frontend_options']['custom_css'] ); ?></textarea></td> 
    108114    </tr> 
    109115</tbody> 
     
    196202    } 
    197203 
     204    /** 
     205     * Set the content for the WP feature pointer about the TablePress nav bar 
     206     * 
     207     * @since 1.0.0 
     208     */ 
     209    public function wp_pointer_tp100_custom_css() { 
     210        $content  = '<h3>' . __( 'TablePress Feature: Custom CSS', 'tablepress' ) . '</h3>'; 
     211        $content .= '<p>' .  __( 'This is the "Custom CSS" textarea where CSS code for table styling should be entered.', 'tablepress' ) . '</p>'; 
     212 
     213        $this->admin_page->print_wp_pointer_js( 'tp100_custom_css', '.CodeMirror', array( 
     214            'content'  => $content, 
     215            'position' => array( 'edge' => 'right', 'align' => 'center', 'offset' => '-16 0', 'defer_loading' => true ), 
     216        ) ); 
     217    } 
     218 
    198219} // class TablePress_Options_View 
  • tablepress/trunk/views/view-options_custom_css.php

    r578853 r598765  
    130130            <?php _e( 'Your &quot;Custom CSS&quot; will then be loaded inline.', 'tablepress' ); ?> 
    131131        </p><p> 
    132             <a href="<?php echo TablePress::url( array( 'action' => 'options', 'message' => 'success_save_error_custom_css' ) ); ?>" class="button-secondary"><?php _e( 'Proceed without saving &quot;Custom CSS&quot; to a file', 'tablepress' ); ?></a> 
     132            <a href="<?php echo TablePress::url( array( 'action' => 'options', 'message' => 'success_save_error_custom_css' ) ); ?>" class="button"><?php _e( 'Proceed without saving &quot;Custom CSS&quot; to a file', 'tablepress' ); ?></a> 
    133133        </p> 
    134134        <?php 
Note: See TracChangeset for help on using the changeset viewer.