diff --git a/css/qsm-admin.css b/css/qsm-admin.css index 9fcc38099..a0fd17d8d 100644 --- a/css/qsm-admin.css +++ b/css/qsm-admin.css @@ -3350,8 +3350,7 @@ body .qsm_tab_content .qsm-small-input-field input[type="text"] { padding-top: 4px; } fieldset#enable_quick_correct_answer_info { - margin-left: 25px; - margin-top: 4px; + margin-top: 8px; } .qsm-mb-1, .qsm_tab_content fieldset{ margin-bottom: .25rem; @@ -3454,4 +3453,12 @@ input#preferred-date-format-custom { #qmn-failed-submission-table-message { padding-right: 38px; position: relative; +} +#toplevel_page_qsm_dashboard li:nth-last-child(3) a:after { + border-bottom: 1px solid hsla(0, 0%, 100%, .2); + display: block; + float: left; + margin: 13px -15px 8px; + content: ""; + width: calc(100% + 26px); } \ No newline at end of file diff --git a/js/qsm-admin.js b/js/qsm-admin.js index cc167da4a..ec54a71e3 100644 --- a/js/qsm-admin.js +++ b/js/qsm-admin.js @@ -160,17 +160,6 @@ var QSMAdmin; jQuery('.category_selection_random').parents("tr").hide(); } }); - show_hide_show_correct_answer(); - $(document).on('change', '#enable_quick_result_mc-1', function (event) { - show_hide_show_correct_answer(); - }); - function show_hide_show_correct_answer() { - if (jQuery('#enable_quick_result_mc-1:checked').length > 0) { - jQuery('#enable_quick_correct_answer_info').css('opacity', '1'); - } else { - jQuery('#enable_quick_correct_answer_info').css('opacity', '0.5'); - } - } jQuery(document).on('change', '#preferred-date-format-custom', function() { let customValue = jQuery(this).val(); jQuery('#preferred_date_format label.qsm-option-label:last input[type="radio"]').val(customValue); diff --git a/js/qsm-quiz.js b/js/qsm-quiz.js index d68eea773..2ee4fecd9 100644 --- a/js/qsm-quiz.js +++ b/js/qsm-quiz.js @@ -310,34 +310,7 @@ var qsmTimerInterval = []; if ('1' == qmn_quiz_data[quizID].progress_bar) { jQuery(document).trigger('qsm_init_progressbar_before', [quizID, qmn_quiz_data]); $('#quizForm' + quizID).find('.qsm-progress-bar').show(); - qmn_quiz_data[quizID].bar = new ProgressBar.Line('#quizForm' + quizID + ' .qsm-progress-bar', { - strokeWidth: 2, - easing: 'easeInOut', - duration: 1400, - color: '#3498db', - trailColor: '#eee', - trailWidth: 1, - svgStyle: { width: '100%', height: '100%' }, - text: { - style: { - // color: '#999', - position: 'absolute', - padding: 0, - margin: 0, - top: 0, - right: '10px', - 'font-size': '13px', - 'font-weight': 'bold', - transform: null - }, - autoStyleContainer: false - }, - from: { color: '#3498db' }, - to: { color: '#ED6A5A' }, - step: function (state, bar) { - //bar.setText(Math.round(bar.value() * 100) + ' %'); - } - }); + qmn_quiz_data[quizID].bar = createQSMProgressBar(quizID, '#quizForm' + quizID + ' .qsm-progress-bar'); jQuery(document).trigger('qsm_init_progressbar_after', [quizID, qmn_quiz_data]); } QSM.goToPage(quizID, 1); @@ -444,6 +417,10 @@ var qsmTimerInterval = []; } var animate_value = current_page / total_page_length; if (animate_value <= 1) { + if (!qmn_quiz_data[quizID].bar) { + jQuery( '#quizForm' + quizID + ' .qsm-progress-bar svg' ).remove(); + qmn_quiz_data[quizID].bar = createQSMProgressBar(quizID, '#quizForm' + quizID + ' .qsm-progress-bar'); + } qmn_quiz_data[quizID].bar.animate(animate_value); var old_text = jQuery('#quizForm' + quizID).find('.progressbar-text').text().replace(' %', ''); var new_text = Math.round(animate_value * 100); @@ -628,6 +605,33 @@ function isUrlValid(url) { return /^(http|https|ftp):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/i.test(url); } +/** + * Create QSM progress bar + * @returns + */ +function createQSMProgressBar(quizID, elementID) { + return new ProgressBar.Line(elementID, { + strokeWidth: 2, + easing: 'easeInOut', + duration: 1400, + color: '#3498db', + trailColor: '#eee', + trailWidth: 1, + svgStyle: { width: '100%', height: '100%' }, + text: { + style: { + 'position': 'absolute', + 'right': '10px', + 'font-size': '13px', + 'font-weight': 'bold' + }, + autoStyleContainer: false + }, + from: { color: '#3498db' }, + to: { color: '#ED6A5A' } + }); +} + /** * Limit multiple response based on question limit * @returns @@ -1300,33 +1304,7 @@ function qmnInitPagination(quiz_id) { if ('1' == qmn_quiz_data[quiz_id].progress_bar) { jQuery(document).trigger('qsm_init_progressbar_before', [quiz_id, qmn_quiz_data]); jQuery('#quizForm' + quiz_id).closest('.qmn_quiz_container').find('.qsm-progress-bar').show(); - qmn_quiz_data[quiz_id].bar = new ProgressBar.Line('#qsm_progress_bar_' + quiz_id, { - strokeWidth: 2, - easing: 'easeInOut', - duration: 500, - color: '#3498db', - trailColor: '#eee', - trailWidth: 1, - svgStyle: { width: '100%', height: '100%' }, - text: { - style: { - // color: '#999', - position: 'absolute', - padding: 0, - margin: 0, - top: 0, - right: '10px', - 'font-size': '13px', - 'font-weight': 'bold', - transform: null - }, - autoStyleContainer: false - }, - from: { color: '#3498db' }, - to: { color: '#ED6A5A' }, - step: function (state, bar) { - } - }); + qmn_quiz_data[quiz_id].bar = createQSMProgressBar(quiz_id, '#qsm_progress_bar_' + quiz_id); jQuery(document).trigger('qsm_init_progressbar_after', [quiz_id, qmn_quiz_data]); } @@ -1508,6 +1486,12 @@ jQuery(function () { let question_id = $i_this.attr('name').split('question')[1]; if (qmn_quiz_data[quizID].enable_quick_result_mc == 1) { qsm_show_inline_result(quizID, question_id, value, $this, 'radio', $i_this) + } else if (qmn_quiz_data[quizID].enable_quick_correct_answer_info != 0) { + let data = qsm_question_quick_result_js(question_id, value, 'radio', qmn_quiz_data[quizID].enable_quick_correct_answer_info, quizID); + $this.find('.quick-question-res-p, .qsm-inline-correct-info').remove(); + if (0 < value.length && data.success != '') { + $this.append('
' + qsm_check_shortcode(data.message) + '
'); + } } jQuery(document).trigger('qsm_after_select_answer', [quizID, question_id, value, $this, 'radio']); if (qmn_quiz_data[quizID].end_quiz_if_wrong > 0 && !jQuery(this).parents('.qsm-quiz-container').find('.mlw_next:visible').length ) { @@ -1521,10 +1505,24 @@ jQuery(function () { let question_id = $i_this.attr('name').split('question')[1]; let value = $i_this.val(); let $this = $i_this.parents('.quiz_section'); + let sendValue; + if (typeof value === 'string') { + sendValue = value.trim(); + } else if (value.length) { + sendValue = value[value.length - 1]; + } else { + sendValue = ''; + } clearTimeout(qsm_inline_result_timer); qsm_inline_result_timer = setTimeout(() => { if (qmn_quiz_data[quizID].enable_quick_result_mc == 1) { - qsm_show_inline_result(quizID, question_id, value, $this, 'input', $i_this, $this.find('.qmn_fill_blank').index($i_this)); + qsm_show_inline_result(quizID, question_id, sendValue, $this, 'input', $i_this, $this.find('.qmn_fill_blank').index($i_this)); + } else if (qmn_quiz_data[quizID].enable_quick_correct_answer_info != 0) { + let data = qsm_question_quick_result_js(question_id, sendValue, 'input', qmn_quiz_data[quizID].enable_quick_correct_answer_info, quizID); + $this.find('.quick-question-res-p, .qsm-inline-correct-info').remove(); + if (0 < value.length && data.success != '') { + $this.append('
' + qsm_check_shortcode(data.message) + '
'); + } } jQuery(document).trigger('qsm_after_select_answer', [quizID, question_id, value, $this, 'input', $this.find('.qmn_fill_blank').index($i_this)]); }, 2000); @@ -1555,6 +1553,12 @@ jQuery(function () { } if (qmn_quiz_data[quizID].enable_quick_result_mc == 1) { qsm_show_inline_result(quizID, question_id, checkedValues, $this, 'checkbox', $i_this) + }else if (qmn_quiz_data[quizID].enable_quick_correct_answer_info != 0) { + let data = qsm_question_quick_result_js(question_id, checkedValues, 'checkbox', qmn_quiz_data[quizID].enable_quick_correct_answer_info,quizID); + $this.find('.quick-question-res-p, .qsm-inline-correct-info').remove(); + if ( 0 < checkedValues.length && data.success != '') { + $this.append('
' + qsm_check_shortcode(data.message) + '
'); + } } jQuery(document).trigger('qsm_after_select_answer', [quizID, question_id, checkedValues, $this, 'checkbox']); }); diff --git a/mlw_quizmaster2.php b/mlw_quizmaster2.php index 119c0e66d..06d4730f6 100644 --- a/mlw_quizmaster2.php +++ b/mlw_quizmaster2.php @@ -2,7 +2,7 @@ /** * Plugin Name: Quiz And Survey Master * Description: Easily and quickly add quizzes and surveys to your website. - * Version: 9.1.1 + * Version: 9.1.2 * Author: ExpressTech * Author URI: https://quizandsurveymaster.com/ * Plugin URI: https://expresstech.io/ @@ -43,7 +43,7 @@ class MLWQuizMasterNext { * @var string * @since 4.0.0 */ - public $version = '9.1.1'; + public $version = '9.1.2'; /** * QSM Alert Manager Object @@ -485,15 +485,14 @@ public function qsm_admin_scripts_style( $hook ) { $qsm_variables_name = array(); foreach ( $qsm_variables as $key => $value ) { // Iterate over each key of the nested object - if( is_array( $value ) && !empty($value)) { - + if ( is_array( $value ) && ! empty($value) ) { + foreach ( $value as $nestedKey => $nestedValue ) { // Add the nested key to the array $qsm_variables_name[] = $nestedKey; - } + } } - - } +} $qsm_admin_messages = array( 'error' => __('Error', 'quiz-master-next'), 'success' => __('Success', 'quiz-master-next'), @@ -746,6 +745,9 @@ public function setup_admin_menu() { if ( $enabled && 'cancelled' !== $enabled ) { $qsm_taxonomy_menu_hook = add_submenu_page( 'qsm_dashboard', __( 'Question Categories', 'quiz-master-next' ), __( 'Question Categories', 'quiz-master-next' ), 'edit_posts', 'edit-tags.php?taxonomy=qsm_category' ); } + if ( ! class_exists( 'QSM_Advanced_Assessment' ) ) { + add_submenu_page( 'qsm_dashboard', __( 'Answer Labels', 'quiz-master-next' ), __( 'Answer Labels', 'quiz-master-next' ), 'manage_options', 'qsm-answer-label', 'qsm_advanced_assessment_quiz_page_content', 3 ); + } add_submenu_page( 'options.php', __( 'Settings', 'quiz-master-next' ), __( 'Settings', 'quiz-master-next' ), 'edit_posts', 'mlw_quiz_options', 'qsm_generate_quiz_options' ); add_submenu_page( 'qsm_dashboard', __( 'Results', 'quiz-master-next' ), __( 'Results', 'quiz-master-next' ), 'moderate_comments', 'mlw_quiz_results', 'qsm_generate_admin_results_page' ); @@ -753,7 +755,7 @@ public function setup_admin_menu() { if ( ! empty( $settings['enable_qsm_log'] ) && $settings['enable_qsm_log'] ) { add_submenu_page( 'qsm_dashboard', __( 'Failed Submission', 'quiz-master-next' ), __( 'Failed Submission', 'quiz-master-next' ), 'moderate_comments', 'qsm-quiz-failed-submission', array( $this, 'admin_failed_submission_page' ) ); } - // Failed DB Query. + // Failed DB Query if ( ! empty( $settings['enable_qsm_log'] ) && $settings['enable_qsm_log'] && $this->get_failed_alter_table_queries() ) { add_submenu_page( 'qsm_dashboard', __( 'Failed DB Queries', 'quiz-master-next' ), __( 'Failed Database Queries', 'quiz-master-next' ), 'moderate_comments', 'qsm-database-failed-queries', array( $this, 'qsm_database_failed_queries' ) ); } @@ -761,12 +763,10 @@ public function setup_admin_menu() { add_submenu_page( 'qsm_dashboard', __( 'Settings', 'quiz-master-next' ), __( 'Settings', 'quiz-master-next' ), 'manage_options', 'qmn_global_settings', array( 'QMNGlobalSettingsPage', 'display_page' ) ); add_submenu_page( 'qsm_dashboard', __( 'Tools', 'quiz-master-next' ), __( 'Tools', 'quiz-master-next' ), 'manage_options', 'qsm_quiz_tools', 'qsm_generate_quiz_tools' ); add_submenu_page( 'qsm_dashboard', __( 'Stats', 'quiz-master-next' ), __( 'Stats', 'quiz-master-next' ), 'moderate_comments', 'qmn_stats', 'qmn_generate_stats_page' ); - add_submenu_page( 'qsm_dashboard', __( 'Addon Settings', 'quiz-master-next' ), '' . __( 'Addons', 'quiz-master-next' ) . '', 'moderate_comments', 'qmn_addons', 'qmn_addons_page' ); - add_submenu_page( 'qsm_dashboard', __( 'Get a Free Addon', 'quiz-master-next' ), '' . esc_html__( 'Get a Free Addon!', 'quiz-master-next' ) . '', 'moderate_comments', 'qsm-free-addon', 'qsm_display_optin_page' ); add_submenu_page( 'qsm_dashboard', __( 'About', 'quiz-master-next' ), __( 'About', 'quiz-master-next' ), 'moderate_comments', 'qsm_quiz_about', 'qsm_generate_about_page' ); - if ( ! class_exists( 'QSM_Advanced_Assessment' ) ) { - add_submenu_page( 'qsm_dashboard', __( 'Answer Labels', 'quiz-master-next' ), __( 'Answer Labels', 'quiz-master-next' ), 'manage_options', 'qsm-answer-label', 'qsm_advanced_assessment_quiz_page_content', 3 ); - } + + add_submenu_page( 'qsm_dashboard', __( 'Extensions Settings', 'quiz-master-next' ), '' . __( 'Extensions', 'quiz-master-next' ) . '', 'moderate_comments', 'qmn_addons', 'qmn_addons_page', 34 ); + add_submenu_page( 'qsm_dashboard', __( 'Free Add-ons', 'quiz-master-next' ), '' . esc_html__( 'Free Add-ons', 'quiz-master-next' ) . '', 'moderate_comments', 'qsm-free-addon', 'qsm_display_optin_page', 90 ); // Register screen option for dashboard page add_action( 'screen_settings', 'qsm_dashboard_screen_options', 10, 2 ); } diff --git a/php/admin/addons-page.php b/php/admin/addons-page.php index 7a62f4073..6c055261d 100644 --- a/php/admin/addons-page.php +++ b/php/admin/addons-page.php @@ -211,7 +211,7 @@ function qsm_display_optin_page() { ?>
-

+

diff --git a/php/admin/functions.php b/php/admin/functions.php index 1707df49b..e481c107b 100644 --- a/php/admin/functions.php +++ b/php/admin/functions.php @@ -1437,6 +1437,11 @@ function qsm_quiz_theme_settings( $type, $label, $name, $value, $default_value, + + + + +