Skip to content

Commit 55f9023

Browse files
UX Changes to chart settings
1 parent d9c3dc4 commit 55f9023

File tree

5 files changed

+573
-581
lines changed

5 files changed

+573
-581
lines changed

classes/Visualizer/Module/Chart.php

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ public function renderChartPages() {
534534
wp_register_style( 'visualizer-chosen', VISUALIZER_ABSURL . 'css/lib/chosen.min.css', array(), Visualizer_Plugin::VERSION );
535535

536536
wp_register_style( 'visualizer-frame', VISUALIZER_ABSURL . 'css/frame.css', array( 'visualizer-chosen' ), Visualizer_Plugin::VERSION );
537-
wp_register_script( 'visualizer-frame', VISUALIZER_ABSURL . 'js/frame.js', array( 'visualizer-chosen', 'jquery-ui-accordion' ), Visualizer_Plugin::VERSION, true );
537+
wp_register_script( 'visualizer-frame', VISUALIZER_ABSURL . 'js/frame.js', array( 'visualizer-chosen', 'jquery-ui-accordion', 'jquery-ui-tabs' ), Visualizer_Plugin::VERSION, true );
538538
wp_register_script( 'visualizer-customization', $this->get_user_customization_js(), array(), null, true );
539539
wp_register_script(
540540
'visualizer-render',
@@ -575,6 +575,7 @@ public function renderChartPages() {
575575
// if the cancel button is clicked.
576576
$this->undoRevisions( $chart_id, true );
577577
} elseif ( isset( $_POST['save'] ) && 1 === intval( $_POST['save'] ) ) {
578+
$this->handlePermissions();
578579
// if the save button is clicked.
579580
$this->undoRevisions( $chart_id, false );
580581
} else {
@@ -591,7 +592,7 @@ public function renderChartPages() {
591592
$this->_handleTypesPage();
592593
break;
593594
default:
594-
do_action( 'visualizer_pro_handle_tab', $tab, $this->_chart );
595+
// this should never happen.
595596
break;
596597
}
597598
defined( 'WP_TESTS_DOMAIN' ) ? wp_die() : exit();
@@ -652,13 +653,31 @@ private function loadCodeEditorAssets( $chart_id ) {
652653
return $table_col_mapping;
653654
}
654655

656+
/**
657+
* Handle permissions from the new conslidated settings sidebar.
658+
*/
659+
private function handlePermissions() {
660+
if ( ! Visualizer_Module::is_pro() ) {
661+
return;
662+
}
663+
664+
// we will not support old free and new pro.
665+
// handling new free and old pro.
666+
if ( has_action( 'visualizer_pro_handle_tab' ) ) {
667+
do_action( 'visualizer_pro_handle_tab', 'permissions', $this->_chart );
668+
} else {
669+
do_action( 'visualizer_handle_permissions', $this->_chart );
670+
}
671+
}
672+
655673
/**
656674
* Handle data and settings page
657675
*/
658676
private function _handleDataAndSettingsPage() {
659677
if ( isset( $_POST['map_api_key'] ) ) {
660678
update_option( 'visualizer-map-api-key', $_POST['map_api_key'] );
661679
}
680+
662681
if ( $_SERVER['REQUEST_METHOD'] === 'POST' && isset( $_GET['nonce'] ) && wp_verify_nonce( $_GET['nonce'] ) ) {
663682
if ( $this->_chart->post_status === 'auto-draft' ) {
664683
$this->_chart->post_status = 'publish';
@@ -691,7 +710,6 @@ private function _handleDataAndSettingsPage() {
691710
$render = new Visualizer_Render_Page_Send();
692711
$render->text = sprintf( '[visualizer id="%d"]', $this->_chart->ID );
693712
wp_iframe( array( $render, 'render' ) );
694-
695713
return;
696714
}
697715
$data = $this->_getChartArray();

0 commit comments

Comments
 (0)