| @@ -1,5 +1,6 @@ | ||
| 1 | 1 | <?php |
| 2 | + | |
| 2 | 3 | // +----------------------------------------------------------------------+ |
| 3 | 4 | // | Copyright 2013 Madpixels (email : [email protected]) | |
| 4 | 5 | // +----------------------------------------------------------------------+ |
| 5 | 6 | // | This program is free software; you can redistribute it and/or modify | |
| @@ -17,8 +18,9 @@ | ||
| 17 | 18 | // | MA 02110-1301 USA | |
| 18 | 19 | // +----------------------------------------------------------------------+ |
| 19 | 20 | // | Author: Eugene Manuilov <[email protected]> | |
| 20 | 21 | // +----------------------------------------------------------------------+ |
| 22 | + | |
| 21 | 23 | /** |
| 22 | 24 | * Renders chart data setup page. |
| 23 | 25 | * |
| 24 | 26 | * @category Visualizer |
| @@ -36,39 +38,11 @@ | ||
| 36 | 38 | * |
| 37 | 39 | * @access protected |
| 38 | 40 | */ |
| 39 | 41 | protected function _renderContent() { |
| 40 | - // Added by Ash/Upwork | |
| 41 | - if ( Visualizer_Module::can_show_feature( 'simple-editor' ) ) { | |
| 42 | - Visualizer_Render_Layout::show( 'simple-editor-screen', $this->chart->ID ); | |
| 43 | - } | |
| 44 | - | |
| 45 | - if ( Visualizer_Module::is_pro() ) { | |
| 46 | - do_action( 'visualizer_add_editor_etc', $this->chart->ID ); | |
| 47 | - | |
| 48 | - if ( Visualizer_Module::is_pro() && Visualizer_Module::is_pro_older_than( '1.9.0' ) ) { | |
| 49 | - global $Visualizer_Pro; | |
| 50 | - $Visualizer_Pro->_addEditor( $this->chart->ID ); | |
| 51 | - if ( method_exists( $Visualizer_Pro, '_addFilterWizard' ) ) { | |
| 52 | - $Visualizer_Pro->_addFilterWizard( $this->chart->ID ); | |
| 53 | - } | |
| 54 | - } | |
| 55 | - } | |
| 56 | - | |
| 57 | - $this->add_additional_content(); | |
| 58 | - | |
| 59 | - // Added by Ash/Upwork | |
| 60 | - if ( Visualizer_Module::is_pro() ) { | |
| 61 | - echo '<div id="chart_wrapper_canvas">'; | |
| 62 | - echo '<div id="control_wrapper_canvas"></div>'; | |
| 63 | - } | |
| 64 | 42 | echo '<div id="canvas">'; |
| 65 | - echo '<img src="', VISUALIZER_ABSURL, 'images/ajax-loader.gif" class="loader">'; | |
| 43 | + echo '<img src="', VISUALIZER_ABSURL, 'images/ajax-loader.gif" class="loader">'; | |
| 66 | 44 | echo '</div>'; |
| 67 | - if ( Visualizer_Module::is_pro() ) { | |
| 68 | - echo '</div>'; | |
| 69 | - } | |
| 70 | - echo $this->custom_css; | |
| 71 | 45 | } |
| 72 | 46 | |
| 73 | 47 | /** |
| 74 | 48 | * Renders sidebar content. |
| @@ -77,30 +51,32 @@ | ||
| 77 | 51 | * |
| 78 | 52 | * @access protected |
| 79 | 53 | */ |
| 80 | 54 | protected function _renderSidebarContent() { |
| 81 | - ?> | |
| 82 | - <div id="viz-tabs"> | |
| 83 | - <ul> | |
| 84 | - <li><a href="#viz-tab-basic-content" id="viz-tab-basic"><?php _e( 'Source', 'visualizer' ); ?></a></li> | |
| 85 | - <li><a href="#viz-tab-advanced-content" id="viz-tab-advanced"><?php _e( 'Settings', 'visualizer' ); ?></a></li> | |
| 86 | - <li><a href="#viz-tab-help-content" id="viz-tab-help"><?php _e( 'Help', 'visualizer' ); ?></a></li> | |
| 87 | - </ul> | |
| 88 | - <div id="viz-tab-basic-content"><?php Visualizer_Render_Layout::show( 'tab-basic', $this->chart->ID ); ?></div> | |
| 89 | - <div id="viz-tab-advanced-content"><?php Visualizer_Render_Layout::show( 'tab-advanced', $this->chart->ID, $this->sidebar ); ?></div> | |
| 90 | - <div id="viz-tab-help-content"><?php Visualizer_Render_Layout::show( 'tab-help', $this->chart->ID ); ?></div> | |
| 91 | - </div> | |
| 55 | + $upload_link = add_query_arg( array( | |
| 56 | + 'action' => Visualizer_Plugin::ACTION_UPLOAD_DATA, | |
| 57 | + 'nonce' => Visualizer_Security::createNonce(), | |
| 58 | + 'chart' => $this->chart->ID, | |
| 59 | + ), admin_url( 'admin-ajax.php' ) ); | |
| 92 | 60 | |
| 93 | - <li class="viz-group bottom-fixed" id="vz-chart-copyright"> | |
| 94 | - Hate it? Love it? <a href="https://wordpress.org/support/plugin/visualizer/reviews/#new-post" target="_blank">Rate it!</a> | |
| 95 | - <br/> | |
| 96 | - Visualizer © | |
| 97 | - <?php | |
| 98 | - // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date, WordPress.DateTime.CurrentTimeTimestamp.Requested | |
| 99 | - echo date( 'Y', current_time( 'timestamp' ) ); | |
| 100 | - ?> | |
| 101 | - </li> | |
| 102 | - <?php | |
| 61 | + echo '<li class="group">'; | |
| 62 | + echo '<h3 class="group-title">', esc_html__( 'Upload CSV file', Visualizer_Plugin::NAME ), '</h3>'; | |
| 63 | + echo '<div class="group-content">'; | |
| 64 | + echo '<p class="group-description">'; | |
| 65 | + esc_html_e( "Select and upload your data CSV file here. The first row of the CSV file should contain the column headings. If you are unsure about how to format your data CSV then please take a look at this sample:", Visualizer_Plugin::NAME ); | |
| 66 | + echo ' <a href="', VISUALIZER_ABSURL, 'samples/', $this->type, '.csv">', $this->type, '.csv</a>'; | |
| 67 | + echo '</p>'; | |
| 68 | + echo '<div>'; | |
| 69 | + echo '<iframe id="thehole" name="thehole"></iframe>'; | |
| 70 | + echo '<form id="csv-form" action="', $upload_link, '" method="post" target="thehole" enctype="multipart/form-data">'; | |
| 71 | + echo '<div class="button button-primary file-wrapper">'; | |
| 72 | + echo '<input type="file" name="data" id="csv-file" class="file">'; | |
| 73 | + esc_attr_e( 'Upload CSV file', Visualizer_Plugin::NAME ); | |
| 74 | + echo '</div>'; | |
| 75 | + echo '</form>'; | |
| 76 | + echo '</div>'; | |
| 77 | + echo '</div>'; | |
| 78 | + echo '</li>'; | |
| 103 | 79 | } |
| 104 | 80 | |
| 105 | 81 | /** |
| 106 | 82 | * Renders toolbar content. |
| @@ -109,35 +85,13 @@ | ||
| 109 | 85 | * |
| 110 | 86 | * @access protected |
| 111 | 87 | */ |
| 112 | 88 | protected function _renderToolbar() { |
| 113 | - // don't show back button at all. | |
| 114 | - // NOTE: We can't be selective on the post_status here because when a new chart reaches the settings screen, its status changes to publish. | |
| 115 | - if ( ! VISUALIZER_SKIP_CHART_TYPE_PAGE ) { | |
| 116 | - echo '<div class="toolbar-div">'; | |
| 117 | - echo '<a class="button button-large" href="', esc_url( add_query_arg( 'tab', 'types' ) ), '">'; | |
| 118 | - esc_html_e( 'Back', 'visualizer' ); | |
| 119 | - echo '</a>'; | |
| 120 | - echo '</div>'; | |
| 121 | - } | |
| 122 | - echo '<input type="submit" id="settings-button" class="button button-primary button-large push-right" value="', $this->button, '">'; | |
| 123 | - if ( isset( $this->cancel_button ) ) { | |
| 124 | - echo '<input type="submit" id="cancel-button" class="button button-secondary button-large push-right" value="', $this->cancel_button, '">'; | |
| 125 | - } | |
| 89 | + echo '<a class="button button-large" href="', add_query_arg( 'tab', false ), '">'; | |
| 90 | + esc_html_e( 'Back', Visualizer_Plugin::NAME ); | |
| 91 | + echo '</a>'; | |
| 92 | + echo '<a class="button button-large button-primary push-right" href="', add_query_arg( 'tab', 'settings' ), '">'; | |
| 93 | + esc_html_e( 'Next', Visualizer_Plugin::NAME ); | |
| 94 | + echo '</a>'; | |
| 126 | 95 | } |
| 127 | 96 | |
| 128 | - /** | |
| 129 | - * Renders the additional content. | |
| 130 | - * | |
| 131 | - * @access private | |
| 132 | - */ | |
| 133 | - private function add_additional_content() { | |
| 134 | - $source = strtolower( get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_SOURCE, true ) ); | |
| 135 | - $query = ''; | |
| 136 | - if ( 'visualizer_source_query' === $source ) { | |
| 137 | - $query = get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_DB_QUERY, true ); | |
| 138 | - } | |
| 139 | - Visualizer_Render_Layout::show( 'db-query', $query, $this->chart->ID ); | |
| 140 | - Visualizer_Render_Layout::show( 'json-screen', $this->chart->ID ); | |
| 141 | - } | |
| 142 | - | |
| 143 | -} | |
| 97 | +} | |