diff --git a/css/admin-dashboard-rtl.css b/css/admin-dashboard-rtl.css index ecd3beddb..108e401e0 100644 --- a/css/admin-dashboard-rtl.css +++ b/css/admin-dashboard-rtl.css @@ -296,86 +296,6 @@ display: inline-block; } -#model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner { - width: 31%; - margin-left: 2%; - float: right; - border: 1px solid #dfd4d4; - height: 210px; - text-align: center; - margin-bottom: 2%; - position: relative; - cursor: pointer; - box-sizing: border-box; -} - -#model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner:hover, -#model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner.selected-quiz-template { - border-color: #1e8cbe; - -webkit-box-shadow: 2px -1px 13px -1px rgba(30, 140, 190, 1); - -moz-box-shadow: 2px -1px 13px -1px rgba(30, 140, 190, 1); - box-shadow: 2px -1px 13px -1px rgba(30, 140, 190, 1); - transition: 0.2s all; - -ms-transition: 0.2s all; - -o-transition: 0.2s all; - -webkit-transition: 0.2s all; -} - -#model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner:nth-child(3n + 3) { - width: 33%; - margin-left: 0%; -} - -#model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner .template-center-vertical { - /*position: absolute; - top: 50%; - left: 50%; - -ms-transform: translate(-50%, -50%); - transform: translate(-50%, -50%); */ - margin-top: 21px; - height: 96px; -} - -#model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner:first-child .template-center-vertical { - height: auto; - position: absolute; - top: 50%; - right: 50%; - -ms-transform: translate(50%, -50%); - transform: translate(50%, -50%); - margin-top: 0; -} - -#model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner .dashicons { - font-size: 75px; - color: #9ea3a8; - display: inline-block; - height: auto; - width: auto; -} - -#model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner p.start_scratch { - font-size: 14px; - text-transform: uppercase; - letter-spacing: 1px; - color: #9ea3a8; -} - -#model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner h3 { - margin: 0; - padding: 10px; - border-top: 1px solid #dfd4d4; - font-size: 15px; - position: absolute; - width: 100%; - box-sizing: border-box; - bottom: 0; -} - -#model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner.inner-json { - background: #fff; -} - #model-wizard .qsm-popup__footer { text-align: left; background: #fff; @@ -1079,22 +999,6 @@ h2.hndle.ui-sortable-handle { } } -@media (min-width: 768px) and (max-width: 991px) { - #model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner { - width: 48%; - } - - #model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner:nth-child(2n + 2) { - margin-left: 0; - width: 50%; - } - - #model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner:nth-child(3n + 3) { - margin-left: 2%; - width: 48%; - } -} - @media screen and (max-width: 767px) { #model-wizard .qsm-popup__container { width: 90%; @@ -1104,11 +1008,6 @@ h2.hndle.ui-sortable-handle { width: 100%; } - #model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner:nth-child(2n + 2), - #model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner { - width: 100% !important; - } - #model-wizard .qsm-wizard-setting-section { width: 100%; height: auto !important; diff --git a/css/admin-dashboard.css b/css/admin-dashboard.css index 212fc195c..1467e104f 100644 --- a/css/admin-dashboard.css +++ b/css/admin-dashboard.css @@ -303,86 +303,6 @@ ul.popuar-addon-ul::after { display: inline-block; } -#model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner { - width: 31%; - margin-right: 2%; - float: left; - border: 1px solid #dfd4d4; - height: 210px; - text-align: center; - margin-bottom: 2%; - position: relative; - cursor: pointer; - box-sizing: border-box; -} - -#model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner:hover, -#model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner.selected-quiz-template { - border-color: #1e8cbe; - -webkit-box-shadow: -2px -1px 13px -1px rgba(30, 140, 190, 1); - -moz-box-shadow: -2px -1px 13px -1px rgba(30, 140, 190, 1); - box-shadow: -2px -1px 13px -1px rgba(30, 140, 190, 1); - transition: 0.2s all; - -ms-transition: 0.2s all; - -o-transition: 0.2s all; - -webkit-transition: 0.2s all; -} - -#model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner:nth-child(3n + 3) { - width: 33%; - margin-right: 0%; -} - -#model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner .template-center-vertical { - /*position: absolute; - top: 50%; - left: 50%; - -ms-transform: translate(-50%, -50%); - transform: translate(-50%, -50%); */ - margin-top: 21px; - height: 96px; -} - -#model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner:first-child .template-center-vertical { - height: auto; - position: absolute; - top: 50%; - left: 50%; - -ms-transform: translate(-50%, -50%); - transform: translate(-50%, -50%); - margin-top: 0; -} - -#model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner .dashicons { - font-size: 75px; - color: #9ea3a8; - display: inline-block; - height: auto; - width: auto; -} - -#model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner p.start_scratch { - font-size: 14px; - text-transform: uppercase; - letter-spacing: 1px; - color: #9ea3a8; -} - -#model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner h3 { - margin: 0; - padding: 10px; - border-top: 1px solid #dfd4d4; - font-size: 15px; - position: absolute; - width: 100%; - box-sizing: border-box; - bottom: 0; -} - -#model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner.inner-json { - background: #fff; -} - #model-wizard .qsm-popup__footer { text-align: right; background: #fff; @@ -1120,22 +1040,6 @@ h2.hndle.ui-sortable-handle { } } -@media (min-width: 768px) and (max-width: 991px) { - #model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner { - width: 48%; - } - - #model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner:nth-child(2n + 2) { - margin-right: 0; - width: 50%; - } - - #model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner:nth-child(3n + 3) { - margin-right: 2%; - width: 48%; - } -} - @media screen and (max-width: 767px) { #model-wizard .qsm-popup__container { width: 90%; @@ -1145,11 +1049,6 @@ h2.hndle.ui-sortable-handle { width: 100%; } - #model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner:nth-child(2n + 2), - #model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner { - width: 100% !important; - } - #model-wizard .qsm-wizard-setting-section { width: 100%; height: auto !important; diff --git a/js/qsm-admin.js b/js/qsm-admin.js index 5203ca12e..9201a78ab 100644 --- a/js/qsm-admin.js +++ b/js/qsm-admin.js @@ -203,13 +203,13 @@ var QSMAdmin; if (confirm(qsm_admin_messages.confirm_message)) { var action = 'qsm_dashboard_delete_result'; var result_id = jQuery(this).data('result_id'); - $.post(ajaxurl, { result_id: result_id, action: action }, - function (data) { - if (data == 'failed') { - alert(qsm_admin_messages.error_delete_result); - } else { - $this.parents('li').slideUp(); + $.post(ajaxurl, { result_id: result_id, action: action, nonce: wpApiSettings.nonce }, + function (response) { + if (response.success) { $this.parents('li').remove(); + $this.parents('li').slideUp(); + } else { + alert(qsm_admin_messages.error_delete_result); } } ); @@ -231,37 +231,8 @@ var QSMAdmin; heightStyle: "content" }); jQuery('#accordion h3.ui-accordion-header').next().slideDown(); - jQuery('.template-list .template-list-inner:first-child').trigger('click'); } }); - //Get quiz options - jQuery('.template-list-inner').click(function () { - var action = 'qsm_wizard_template_quiz_options'; - var settings = jQuery(this).data('settings'); - var addons = jQuery(this).data('addons'); - jQuery('.template-list .template-list-inner').removeClass('selected-quiz-template'); - jQuery(this).addClass('selected-quiz-template'); - jQuery('#quiz_settings_wrapper').html('').html('
'); - jQuery('#recomm_addons_wrapper').html('').html(''); - $.post(ajaxurl, { settings: settings, addons: addons, action: action }, - function (data) { - var diff_html = data.split('====='); - jQuery('#quiz_settings_wrapper').html(''); - jQuery('#quiz_settings_wrapper').html(diff_html[0]); - jQuery('#recomm_addons_wrapper').html(''); - jQuery('#recomm_addons_wrapper').html(diff_html[1]); - jQuery("#accordion").accordion(); - jQuery('#accordion h3.ui-accordion-header').next().slideDown(); - $('#quiz_settings_wrapper select').each(function () { - var name = $(this).attr('name'); - var value = $(this).val(); - if ($('.' + name + '_' + value).length > 0) { - $('.' + name + '_' + value).show(); - } - }); - } - ); - }); //Dismiss the welcome panel jQuery('.qsm-welcome-panel-dismiss').click(function (e) { @@ -932,41 +903,9 @@ if(current_id == 'qsm_variable_text'){ jQuery(".current_variable")[0].click();} heightStyle: "content" }); jQuery('#accordion h3.ui-accordion-header').next().slideDown(); - jQuery('.template-list .template-list-inner:first-child').trigger('click'); } }); - //Get quiz options - $('.template-list-inner').click(function () { - var action = 'qsm_wizard_template_quiz_options'; - var settings = $(this).data('settings'); - var addons = $(this).data('addons'); - $('.template-list .template-list-inner').removeClass('selected-quiz-template'); - $(this).addClass('selected-quiz-template'); - $('#quiz_settings_wrapper').html('').html(''); - $('#recomm_addons_wrapper').html('').html(''); - $.post(ajaxurl, { - settings: settings, - addons: addons, - action: action - }, - function (data) { - var diff_html = data.split('====='); - $('#quiz_settings_wrapper').html(''); - $('#quiz_settings_wrapper').html(diff_html[0]); - $('#recomm_addons_wrapper').html(''); - $('#recomm_addons_wrapper').html(diff_html[1]); - $("#accordion").accordion(); - $('#accordion h3.ui-accordion-header').next().slideDown(); - $('#quiz_settings_wrapper select').each(function () { - var name = $(this).attr('name'); - var value = $(this).val(); - if ($('.' + name + '_' + value).length > 0) { - $('.' + name + '_' + value).show(); - } - }); - } - ); - }); + $('#show_import_export_popup').on('click', function (event) { event.preventDefault(); MicroModal.show('modal-export-import'); @@ -1222,12 +1161,12 @@ if(current_id == 'qsm_variable_text'){ jQuery(".current_variable")[0].click();} url: ajaxurl, data: { action: 'enable_multiple_categories', - value: 'enable' + value: 'enable', + nonce: wpApiSettings.nonce }, - success: function (r) { - response = JSON.parse(r); + success: function (response) { clearInterval(category_interval); - if (response.status) { + if (response.success) { $('.category-action').parents('.multiple-category-notice').removeClass('notice-info').addClass('notice-success').html('' + qsm_admin_messages.update_db_success + '
'); } else { $('.category-action').parents('.multiple-category-notice').removeClass('notice-info').addClass('notice-error').html(qsm_admin_messages.error + '! ' + qsm_admin_messages.try_again); @@ -1245,10 +1184,11 @@ if(current_id == 'qsm_variable_text'){ jQuery(".current_variable")[0].click();} url: ajaxurl, data: { action: 'enable_multiple_categories', - value: 'cancel' + value: 'cancel', + nonce: wpApiSettings.nonce }, success: function (status) { - if (status) { + if (response.success) { $('.multiple-category-notice').hide(); } } @@ -1498,7 +1438,7 @@ var QSMContact; $(document).on('change', '.show-disabled-fields', function (event) { event.preventDefault(); var is_show = $(this).prop('checked'); - jQuery.post(ajaxurl, { action: 'qsm_show_disabled_contact_fields', show: is_show }); + jQuery.post(ajaxurl, { action: 'qsm_show_disabled_contact_fields', show: is_show, 'nonce': qsmContactObject.saveNonce, 'quiz_id': qsmContactObject.quizID }); if (is_show) { $('.contact-form-field').removeClass('hidden-field'); } else { @@ -3309,6 +3249,8 @@ var import_button; var new_category_data = { action: 'save_new_category', name: new_category, + quiz_id: qsmQuestionSettings.quizID, + nonce: qsmQuestionSettings.saveNonce, parent: parent_category }; $('#modal-9-content .info').html(''); diff --git a/php/admin/admin-dashboard.php b/php/admin/admin-dashboard.php index c8b52e634..53dd064c3 100644 --- a/php/admin/admin-dashboard.php +++ b/php/admin/admin-dashboard.php @@ -277,55 +277,6 @@ function qsm_generate_dashboard_page() { qsm_create_new_quiz_wizard(); } -/** - * @since 7.0 - * @global Obj $mlwQuizMasterNext - * Generate the post settings and required plugin in popup - */ -function qsm_wizard_template_quiz_options() { - global $mlwQuizMasterNext; - $settings = isset( $_POST['settings'] ) ? qsm_sanitize_rec_array( wp_unslash( $_POST['settings'] ) ) : array(); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized - $addons = isset( $_POST['addons'] ) ? qsm_sanitize_rec_array( wp_unslash( $_POST['addons'] ) ) : array(); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized - $all_settings = $mlwQuizMasterNext->quiz_settings->load_setting_fields( 'quiz_options' ); - $recommended_addon_str = ''; - if ( $settings ) { - foreach ( $settings as $key => $single_setting ) { - $key = array_search( $key, array_column( $all_settings, 'id' ), true ); - $field = $all_settings[ $key ]; - $field['label'] = $single_setting['option_name']; - $field['default'] = $single_setting['value']; - QSM_Fields::generate_field( $field, $single_setting['value'] ); - } - } else { - esc_html_e( 'No settings are found!', 'quiz-master-next' ); - } - echo '====='; - if ( $addons ) { - $recommended_addon_str .= '