| @@ -43,19 +43,13 @@ | ||
| 43 | 43 | $Visualizer_Pro->_addEditor( $this->chart->ID ); |
| 44 | 44 | if ( method_exists( $Visualizer_Pro, '_addFilterWizard' ) ) { |
| 45 | 45 | $Visualizer_Pro->_addFilterWizard( $this->chart->ID ); |
| 46 | 46 | } |
| 47 | - } else { | |
| 48 | - Visualizer_Render_Layout::show( 'faux-editor' ); | |
| 49 | 47 | } |
| 50 | - | |
| 51 | - $this->add_additional_content(); | |
| 52 | - | |
| 53 | 48 | // Added by Ash/Upwork |
| 54 | 49 | echo '<div id="canvas">'; |
| 55 | 50 | echo '<img src="', VISUALIZER_ABSURL, 'images/ajax-loader.gif" class="loader">'; |
| 56 | 51 | echo '</div>'; |
| 57 | - echo $this->custom_css; | |
| 58 | 52 | } |
| 59 | 53 | |
| 60 | 54 | /** |
| 61 | 55 | * Renders sidebar content. |
| @@ -69,17 +63,12 @@ | ||
| 69 | 63 | array( |
| 70 | 64 | 'action' => Visualizer_Plugin::ACTION_UPLOAD_DATA, |
| 71 | 65 | 'nonce' => wp_create_nonce(), |
| 72 | 66 | 'chart' => $this->chart->ID, |
| 73 | - ), | |
| 74 | - admin_url( 'admin-ajax.php' ) | |
| 67 | + ), admin_url( 'admin-ajax.php' ) | |
| 75 | 68 | ); |
| 76 | - | |
| 77 | - // this will allow us to open the correct source tab by default. | |
| 78 | - $source_of_chart = strtolower( get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_SOURCE, true ) ); | |
| 79 | - $type = get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_CHART_TYPE, true ); | |
| 80 | 69 | ?> |
| 81 | - <span id="visualizer-chart-id" data-id="<?php echo $this->chart->ID; ?>" data-chart-source="<?php echo $source_of_chart; ?>" data-chart-type="<?php echo $type; ?>"></span> | |
| 70 | + <span id="visualizer-chart-id" data-id="<?php echo $this->chart->ID; ?>"></span> | |
| 82 | 71 | <iframe id="thehole" name="thehole"></iframe> |
| 83 | 72 | <ul class="viz-group-wrapper full-height"> |
| 84 | 73 | <li class="viz-group viz-group-category open" id="vz-chart-source"> |
| 85 | 74 | <div class="viz-group-header"> |
| @@ -86,9 +75,9 @@ | ||
| 86 | 75 | <h2 class="viz-group-title viz-main-group"><?php _e( 'Chart Data', 'visualizer' ); ?></h2> |
| 87 | 76 | </div> |
| 88 | 77 | <ul class="viz-group-content"> |
| 89 | 78 | <ul class="viz-group-wrapper"> |
| 90 | - <li class="viz-group visualizer_source_csv"> | |
| 79 | + <li class="viz-group"> | |
| 91 | 80 | <h2 class="viz-group-title viz-sub-group visualizer-src-tab"><?php _e( 'Import data from file', 'visualizer' ); ?></h2> |
| 92 | 81 | <div class="viz-group-content"> |
| 93 | 82 | <p class="viz-group-description"><?php esc_html_e( 'Select and upload your data CSV file here. The first row of the CSV file should contain the column headings. The second one should contain series type (string, number, boolean, date, datetime, timeofday).', 'visualizer' ); ?></p> |
| 94 | 83 | <p class="viz-group-description"><?php echo sprintf( __( 'If you are unsure about how to format your data CSV then please take a look at this sample: %1$s %2$s%3$s', 'visualizer' ), '<a href="' . VISUALIZER_ABSURL . 'samples/' . $this->type . '.csv" target="_blank">', $this->type, '.csv</a>' ); ?></p> |
| @@ -102,9 +91,9 @@ | ||
| 102 | 91 | value="<?php _e( 'Import', 'visualizer' ); ?>"> |
| 103 | 92 | </form> |
| 104 | 93 | </div> |
| 105 | 94 | </li> |
| 106 | - <li class="viz-group visualizer-import-url visualizer_source_csv_remote"> | |
| 95 | + <li class="viz-group visualizer-import-url"> | |
| 107 | 96 | <h2 class="viz-group-title viz-sub-group visualizer-src-tab"><?php _e( 'Import data from URL', 'visualizer' ); ?></h2> |
| 108 | 97 | <ul class="viz-group-content"> |
| 109 | 98 | <li class="viz-subsection"> |
| 110 | 99 | <span class="viz-section-title"><?php _e( 'One time import', 'visualizer' ); ?></span> |
| @@ -145,15 +134,13 @@ | ||
| 145 | 134 | <select name="vz-import-time" id="vz-import-time" |
| 146 | 135 | class="visualizer-select"> |
| 147 | 136 | <?php |
| 148 | 137 | $hours = get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_CHART_SCHEDULE, true ); |
| 149 | - $schedules = apply_filters( | |
| 150 | - 'visualizer_chart_schedules', array( | |
| 151 | - '1' => __( 'Each hour', 'visualizer' ), | |
| 152 | - '12' => __( 'Each 12 hours', 'visualizer' ), | |
| 153 | - '24' => __( 'Each day', 'visualizer' ), | |
| 154 | - '72' => __( 'Each 3 days', 'visualizer' ), | |
| 155 | - ) | |
| 138 | + $schedules = array( | |
| 139 | + '1' => __( 'Each hour', 'visualizer' ), | |
| 140 | + '12' => __( 'Each 12 hours', 'visualizer' ), | |
| 141 | + '24' => __( 'Each day', 'visualizer' ), | |
| 142 | + '36' => __( 'Each 3 days', 'visualizer' ), | |
| 156 | 143 | ); |
| 157 | 144 | foreach ( $schedules as $num => $name ) { |
| 158 | 145 | $extra = $num == $hours ? 'selected' : ''; |
| 159 | 146 | ?> |
| @@ -171,9 +158,9 @@ | ||
| 171 | 158 | </div> |
| 172 | 159 | </li> |
| 173 | 160 | </ul> |
| 174 | 161 | </li> |
| 175 | - <li class="viz-group <?php echo apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature' ); ?>"> | |
| 162 | + <li class="viz-group <?php echo apply_filters( 'visualizer_pro_upsell_class', '' ); ?> "> | |
| 176 | 163 | <h2 class="viz-group-title viz-sub-group" |
| 177 | 164 | data-current="chart"><?php _e( 'Import from other chart', 'visualizer' ); ?><span |
| 178 | 165 | class="dashicons dashicons-lock"></span></h2> |
| 179 | 166 | <div class="viz-group-content edit-data-content"> |
| @@ -185,10 +172,9 @@ | ||
| 185 | 172 | $fetch_link = add_query_arg( |
| 186 | 173 | array( |
| 187 | 174 | 'action' => ( VISUALIZER_PRO ) ? Visualizer_Pro::ACTION_FETCH_DATA : '', |
| 188 | 175 | 'nonce' => wp_create_nonce(), |
| 189 | - ), | |
| 190 | - admin_url( 'admin-ajax.php' ) | |
| 176 | + ), admin_url( 'admin-ajax.php' ) | |
| 191 | 177 | ); |
| 192 | 178 | $query_args_charts = array( |
| 193 | 179 | 'post_type' => Visualizer_Plugin::CPT_VISUALIZER, |
| 194 | 180 | 'posts_per_page' => 300, |
| @@ -219,9 +205,9 @@ | ||
| 219 | 205 | <h2 class="viz-group-title viz-sub-group"><?php _e( 'Import from WordPress', 'visualizer' ); ?><span |
| 220 | 206 | class="dashicons dashicons-lock"></span></h2> |
| 221 | 207 | <div class="viz-group-content edit-data-content"> |
| 222 | 208 | <div> |
| 223 | - <p class="viz-group-description"><?php _e( 'You can import data from WordPress here.', 'visualizer' ); ?></p> | |
| 209 | + <p class="viz-group-description"><?php _e( 'You can import here data from WordPress', 'visualizer' ); ?></p> | |
| 224 | 210 | <input type="button" id="filter-chart-button" class="button button-primary " |
| 225 | 211 | value="<?php _e( 'Create Filters', 'visualizer' ); ?>" data-current="chart" |
| 226 | 212 | data-t-filter="<?php _e( 'Show Chart', 'visualizer' ); ?>" |
| 227 | 213 | data-t-chart="<?php _e( 'Create Filters', 'visualizer' ); ?>"> |
| @@ -229,67 +215,11 @@ | ||
| 229 | 215 | </div> |
| 230 | 216 | </div> |
| 231 | 217 | </li> |
| 232 | 218 | |
| 233 | - <?php | |
| 234 | - $save_query = add_query_arg( | |
| 235 | - array( | |
| 236 | - 'action' => Visualizer_Plugin::ACTION_SAVE_DB_QUERY, | |
| 237 | - 'security' => wp_create_nonce( Visualizer_Plugin::ACTION_SAVE_DB_QUERY . Visualizer_Plugin::VERSION ), | |
| 238 | - 'chart' => $this->chart->ID, | |
| 239 | - ), admin_url( 'admin-ajax.php' ) | |
| 240 | - ); | |
| 241 | - ?> | |
| 242 | - <li class="viz-group visualizer_source_query <?php echo apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'db-query' ); ?>"> | |
| 243 | - <h2 class="viz-group-title viz-sub-group"><?php _e( 'Import from database', 'visualizer' ); ?><span | |
| 244 | - class="dashicons dashicons-lock"></span></h2> | |
| 245 | - <div class="viz-group-content edit-data-content"> | |
| 246 | - <div> | |
| 247 | - <p class="viz-group-description"><?php _e( 'You can import data from the database here.', 'visualizer' ); ?></p> | |
| 248 | - <form id="vz-db-wizard" action="<?php echo $save_query; ?>" method="post" target="thehole"> | |
| 249 | - <p class="viz-group-description"><?php _e( 'How often do you want to refresh the data from the database.', 'visualizer' ); ?></p> | |
| 250 | - <select name="refresh" id="vz-db-import-time" class="visualizer-select"> | |
| 251 | - <?php | |
| 252 | - $bttn_label = 'visualizer_source_query' === $source_of_chart ? __( 'Modify Query', 'visualizer' ) : __( 'Create Query', 'visualizer' ); | |
| 253 | - $hours = get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_DB_SCHEDULE, true ); | |
| 254 | - $schedules = apply_filters( | |
| 255 | - 'visualizer_schedules', array( | |
| 256 | - '0' => __( 'Live', 'visualizer' ), | |
| 257 | - '1' => __( 'Each hour', 'visualizer' ), | |
| 258 | - '12' => __( 'Each 12 hours', 'visualizer' ), | |
| 259 | - '24' => __( 'Each day', 'visualizer' ), | |
| 260 | - '72' => __( 'Each 3 days', 'visualizer' ), | |
| 261 | - ) | |
| 262 | - ); | |
| 263 | - foreach ( $schedules as $num => $name ) { | |
| 264 | - $extra = $num == $hours ? 'selected' : ''; | |
| 265 | - ?> | |
| 266 | - <option value="<?php echo $num; ?>" <?php echo $extra; ?>><?php echo $name; ?></option> | |
| 267 | - <?php | |
| 268 | - } | |
| 269 | - ?> | |
| 270 | - </select> | |
| 271 | - <input type="hidden" name="params" id="viz-db-wizard-params"> | |
| 272 | - | |
| 273 | - <input type="button" id="db-chart-button" class="button button-secondary " | |
| 274 | - value="<?php echo $bttn_label; ?>" data-current="chart" | |
| 275 | - data-t-filter="<?php _e( 'Show Chart', 'visualizer' ); ?>" | |
| 276 | - data-t-chart="<?php echo $bttn_label; ?>"> | |
| 277 | - <input type="button" id="db-chart-save-button" class="button button-primary " | |
| 278 | - value="<?php _e( 'Save Schedule', 'visualizer' ); ?>"> | |
| 279 | - <?php echo apply_filters( 'visualizer_pro_upsell', '', 'db-query' ); ?> | |
| 280 | - </form> | |
| 281 | - </div> | |
| 282 | - </div> | |
| 283 | - </li> | |
| 284 | - | |
| 285 | - <?php | |
| 286 | - // we will auto-open the manual data feature but only when pro is active and source is empty. | |
| 287 | - $pro_class = apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature' ); | |
| 288 | - ?> | |
| 289 | - <li class="viz-group <?php echo $pro_class; ?> <?php echo empty( $source_of_chart ) && empty( $pro_class ) ? 'open' : ''; ?> "> | |
| 219 | + <li class="viz-group <?php echo apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature' ); ?>"> | |
| 290 | 220 | <h2 class="viz-group-title viz-sub-group visualizer-editor-tab" |
| 291 | - data-current="chart"><?php _e( 'Manual Data', 'visualizer' ); ?><span | |
| 221 | + data-current="chart"><?php _e( 'Add data manually', 'visualizer' ); ?><span | |
| 292 | 222 | class="dashicons dashicons-lock"></span></h2> |
| 293 | 223 | <form id="editor-form" action="<?php echo $upload_link; ?>" method="post" target="thehole"> |
| 294 | 224 | <input type="hidden" id="chart-data" name="chart_data"> |
| 295 | 225 | <input type="hidden" id="chart-data-src" name="chart_data_src"> |
| @@ -319,13 +249,9 @@ | ||
| 319 | 249 | <ul class="viz-group-content"> |
| 320 | 250 | <form id="settings-form" action="<?php echo add_query_arg( 'nonce', wp_create_nonce() ); ?>" |
| 321 | 251 | method="post"> |
| 322 | 252 | <?php echo $this->sidebar; ?> |
| 323 | - <input type="hidden" name="save" value="1"> | |
| 324 | 253 | </form> |
| 325 | - <form id="cancel-form" action="<?php echo add_query_arg( 'nonce', wp_create_nonce() ); ?>" method="post"> | |
| 326 | - <input type="hidden" name="cancel" value="1"> | |
| 327 | - </form> | |
| 328 | 254 | </ul> |
| 329 | 255 | </li> |
| 330 | 256 | |
| 331 | 257 | <?php $this->getPermissionsLink( $this->chart->ID ); ?> |
| @@ -348,9 +274,9 @@ | ||
| 348 | 274 | foreach ( $permissions as $k => $v ) { |
| 349 | 275 | $this->$k = $v; |
| 350 | 276 | } |
| 351 | 277 | } |
| 352 | - ?> | |
| 278 | +?> | |
| 353 | 279 | <li class="viz-group viz-group-category bottom-fixed sidebar-footer-link" id="vz-chart-permissions"> |
| 354 | 280 | <h2><span class="dashicons dashicons-admin-users"></span><?php _e( 'Permissions', 'visualizer' ); ?></h2> |
| 355 | 281 | <div class="viz-group-header"> |
| 356 | 282 | <button class="customize-section-back" tabindex="0"></button> |
| @@ -362,18 +288,17 @@ | ||
| 362 | 288 | echo add_query_arg( |
| 363 | 289 | array( |
| 364 | 290 | 'nonce' => wp_create_nonce(), |
| 365 | 291 | 'tab' => 'permissions', |
| 366 | - ), | |
| 367 | - remove_query_arg( 'tab', $_SERVER['REQUEST_URI'] ) | |
| 292 | + ), remove_query_arg( 'tab', $_SERVER['REQUEST_URI'] ) | |
| 368 | 293 | ); |
| 369 | - ?> | |
| 294 | +?> | |
| 370 | 295 | " method="post"> |
| 371 | 296 | <?php $this->permissionsSidebar(); ?> |
| 372 | 297 | </form> |
| 373 | 298 | </ul> |
| 374 | 299 | </li> |
| 375 | - <?php | |
| 300 | +<?php | |
| 376 | 301 | } |
| 377 | 302 | |
| 378 | 303 | /** |
| 379 | 304 | * Generates the permissions form. |
| @@ -380,17 +305,11 @@ | ||
| 380 | 305 | * |
| 381 | 306 | * @access private |
| 382 | 307 | */ |
| 383 | 308 | private function permissionsSidebar() { |
| 384 | - // ignore for unit tests because Travis throws the error "Indirect modification of overloaded property Visualizer_Render_Page_Data::$permissions has no effect". | |
| 385 | - if ( defined( 'WP_TESTS_DOMAIN' ) ) { | |
| 386 | - return; | |
| 387 | - } | |
| 388 | 309 | Visualizer_Render_Sidebar::_renderGroupStart( |
| 389 | 310 | esc_html__( 'Who can see this chart?', 'visualizer' ) . '<span |
| 390 | - class="dashicons dashicons-lock"></span>', | |
| 391 | - '', | |
| 392 | - apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'chart-permissions' ) | |
| 311 | + class="dashicons dashicons-lock"></span>', '', apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'chart-permissions' ) | |
| 393 | 312 | ); |
| 394 | 313 | Visualizer_Render_Sidebar::_renderSectionStart(); |
| 395 | 314 | Visualizer_Render_Sidebar::_renderSectionDescription( esc_html__( 'Select who can view the chart on the front-end.', 'visualizer' ) ); |
| 396 | 315 | |
| @@ -430,11 +349,9 @@ | ||
| 430 | 349 | Visualizer_Render_Sidebar::_renderGroupEnd(); |
| 431 | 350 | |
| 432 | 351 | Visualizer_Render_Sidebar::_renderGroupStart( |
| 433 | 352 | esc_html__( 'Who can edit this chart?', 'visualizer' ) . '<span |
| 434 | - class="dashicons dashicons-lock"></span>', | |
| 435 | - '', | |
| 436 | - apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'chart-permissions' ) | |
| 353 | + class="dashicons dashicons-lock"></span>', '', apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'chart-permissions' ) | |
| 437 | 354 | ); |
| 438 | 355 | Visualizer_Render_Sidebar::_renderSectionStart(); |
| 439 | 356 | Visualizer_Render_Sidebar::_renderSectionDescription( esc_html__( 'Select who can edit the chart on the front-end.', 'visualizer' ) ); |
| 440 | 357 | |
| @@ -483,34 +400,16 @@ | ||
| 483 | 400 | * |
| 484 | 401 | * @access protected |
| 485 | 402 | */ |
| 486 | 403 | protected function _renderToolbar() { |
| 487 | - // don't show back button at all. | |
| 488 | - // 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. | |
| 489 | - if ( ! VISUALIZER_SKIP_CHART_TYPE_PAGE ) { | |
| 490 | - echo '<div class="toolbar-div">'; | |
| 491 | - echo '<a class="button button-large" href="', add_query_arg( 'tab', 'types' ), '">'; | |
| 492 | - esc_html_e( 'Back', 'visualizer' ); | |
| 493 | - echo '</a>'; | |
| 494 | - echo '</div>'; | |
| 495 | - } | |
| 404 | + // changed by Ash/Upwork | |
| 405 | + echo '<div class="toolbar-div">'; | |
| 406 | + echo '<a class="button button-large" href="', add_query_arg( 'tab', 'types' ), '">'; | |
| 407 | + esc_html_e( 'Back', 'visualizer' ); | |
| 408 | + echo '</a>'; | |
| 409 | + echo '</div>'; | |
| 496 | 410 | echo '<input type="submit" id="settings-button" class="button button-primary button-large push-right" value="', $this->button, '">'; |
| 497 | - if ( isset( $this->cancel_button ) ) { | |
| 498 | - echo '<input type="submit" id="cancel-button" class="button button-secondary button-large push-left" value="', $this->cancel_button, '">'; | |
| 499 | - } | |
| 500 | - } | |
| 411 | + echo '</div>'; | |
| 501 | 412 | |
| 502 | - /** | |
| 503 | - * Renders the additional content. | |
| 504 | - * | |
| 505 | - * @access private | |
| 506 | - */ | |
| 507 | - private function add_additional_content() { | |
| 508 | - $source = strtolower( get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_SOURCE, true ) ); | |
| 509 | - $query = ''; | |
| 510 | - if ( 'visualizer_source_query' === $source ) { | |
| 511 | - $query = get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_DB_QUERY, true ); | |
| 512 | - } | |
| 513 | - Visualizer_Render_Layout::show( 'db-query', $query ); | |
| 514 | 413 | } |
| 515 | 414 | |
| 516 | 415 | } |