diff --git a/css/common.css b/css/common.css index 22b6680c7..0cbe075d3 100644 --- a/css/common.css +++ b/css/common.css @@ -294,12 +294,19 @@ footer.qsm-popup__footer button.qsm-popup-secondary-button:hover { color: red; display: block; } - +.quiz_section .mlw-file-upload-error-msg.mlw-file-upload-success-msg { + color: green; + display: block; +} .quiz_section .remove-uploaded-file { color: red; - border: 1px solid red; - width: 31px; - padding: 5px 5px 0px 5px; + display: inline-block; + cursor: pointer; + margin-top: 5px; +} +.quiz_section .loading-uploaded-file { + width: 20px; + margin-bottom: -5px; } /** diff --git a/js/qsm-admin.js b/js/qsm-admin.js index 8a46d48e8..57dc5209c 100644 --- a/js/qsm-admin.js +++ b/js/qsm-admin.js @@ -2246,7 +2246,8 @@ var import_button; question_id: answer['question_id'], answerType: answer['answerType'], form_type: qsmQuestionSettings.form_type, - quiz_system: qsmQuestionSettings.quiz_system + quiz_system: qsmQuestionSettings.quiz_system, + question_type: questionType, }; if (answer['answerType'] == 'image') { ansTemp = { @@ -2258,7 +2259,8 @@ var import_button; question_id: answer['question_id'], answerType: answer['answerType'], form_type: qsmQuestionSettings.form_type, - quiz_system: qsmQuestionSettings.quiz_system + quiz_system: qsmQuestionSettings.quiz_system, + question_type: questionType }; } jQuery(document).trigger('qsm_new_answer_template', [ansTemp, answer, questionType]); diff --git a/js/qsm-quiz.js b/js/qsm-quiz.js index 2781a93c7..c916ee201 100644 --- a/js/qsm-quiz.js +++ b/js/qsm-quiz.js @@ -1693,6 +1693,7 @@ jQuery(function () { $this.parent('.quiz_section').find('.mlw_file_upload_hidden_path').val(obj.file_path); $this.parent('.quiz_section').find('.mlw_file_upload_media_id').val(obj.media_id); $this.parent('.quiz_section').find('.mlw-file-upload-error-msg').hide(); + $this.parent('.quiz_section').find('.mlw-file-upload-error-msg').addClass('mlw-file-upload-success-msg').text(obj.message); $this.parent('.quiz_section').find('.mlw-file-upload-error-msg').show(); } else { $this.parent('.quiz_section').find('.mlw-file-upload-error-msg').removeClass('mlw-file-upload-success-msg'); diff --git a/mlw_quizmaster2.php b/mlw_quizmaster2.php index f60ae2dd3..8b8dfae21 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: 8.1.15 + * Version: 8.1.16 * 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 = '8.1.15'; + public $version = '8.1.16'; /** * QSM Alert Manager Object diff --git a/php/admin/options-page-questions-tab.php b/php/admin/options-page-questions-tab.php index d25500c19..b46e4c3ae 100644 --- a/php/admin/options-page-questions-tab.php +++ b/php/admin/options-page-questions-tab.php @@ -124,14 +124,6 @@ function qsm_options_questions_tab_content() { pluginHelper->get_section_setting( 'quiz_options', 'randomness_order' ); - if ( 0 != $randomness ) { - ?> -
-

-
- pluginHelper->get_questions_ids( $quiz_id ); if ( ! empty( $question_ids ) ) { diff --git a/php/classes/class-qmn-quiz-manager.php b/php/classes/class-qmn-quiz-manager.php index 0a5aa6c11..f234e3edd 100644 --- a/php/classes/class-qmn-quiz-manager.php +++ b/php/classes/class-qmn-quiz-manager.php @@ -180,9 +180,33 @@ public function qsm_upload_image_fd_question() { echo wp_json_encode( $json ); } } else { - $json['type'] = 'error'; - $json['message'] = __( 'Incorrect File Type uploaded. Please upload the allowed file type!', 'quiz-master-next' ); - echo wp_json_encode( $json ); + if ( ! empty ($file_upload_type) ) { + $filestype = explode(',', $file_upload_type); + foreach ( $filestype as $file ) { + if ( strpos($file, '/') !== false ) { + $filetypes = explode('/', $file); + if ( ! empty($filetypes[0]) && 'application' == $filetypes[0] ) { + $filetypes_allowed[] = 'pdf'; + } else { + $filetypes_allowed[] = $filetypes[0]; + } + }else { + $filetypes_allowed[] = $file; + } + } + if ( count($filetypes_allowed) > 1 ) { + $files_allowed = implode(',', $filetypes_allowed); + } else { + $files_allowed = $filetypes_allowed[0]; // Just take the single element + } + $json['type'] = 'error'; + $json['message'] = __('File Upload Unsuccessful! (Please upload ', 'quiz-master-next') . $files_allowed . __(' file type)', 'quiz-master-next'); + echo wp_json_encode( $json ); + } else { + $json['type'] = 'error'; + $json['message'] = __( 'File Upload Unsuccessful! (Please select file type)', 'quiz-master-next' ); + echo wp_json_encode( $json ); + } } exit; } @@ -914,7 +938,7 @@ public function display_quiz( $options, $quiz_data, $question_amount, $shortcode // If deprecated pagination setting is not used, use new system... $pages = $mlwQuizMasterNext->pluginHelper->get_quiz_setting( 'pages', array() ); - if ( 0 == $options->randomness_order && 0 == $options->question_from_total && 0 == $options->pagination && is_countable($pages) && 0 !== count( $pages ) ) { + if ( 0 == $options->question_from_total && 0 == $options->pagination && is_countable($pages) && 0 !== count( $pages ) ) { $this->display_pages( $options, $quiz_data ); } else { // ... else, use older system. @@ -971,6 +995,23 @@ public function display_pages( $options, $quiz_data ) { $contact_fields = QSM_Contact_Manager::load_fields(); $animation_effect = isset( $options->quiz_animation ) && '' !== $options->quiz_animation ? ' animated ' . $options->quiz_animation : ''; $enable_pagination_quiz = isset( $options->enable_pagination_quiz ) && 1 == $options->enable_pagination_quiz ? true : false; + if ( ( 1 == $options->randomness_order || 2 == $options->randomness_order ) && is_array( $pages ) ) { + $pages = QMNPluginHelper::qsm_shuffle_assoc( $pages ); + $question_list_array = array(); + foreach ( $pages as &$question_ids ) { + shuffle( $question_ids ); + $question_list_array = array_merge($question_list_array, $question_ids); + } + $question_list_str = implode( ',', $question_list_array ); + ?> + + disable_first_page ) && ( ! empty( $options->message_before ) || ( 0 == $options->contact_info_location && $contact_fields ) ) ) { $qmn_json_data['first_page'] = true; $message_before = $mlwQuizMasterNext->pluginHelper->qsm_language_support( htmlspecialchars_decode( $options->message_before, ENT_QUOTES ), "quiz_message_before-{$options->quiz_id}" ); @@ -1268,19 +1309,13 @@ public function display_questions( $qmn_quiz_options, $qmn_quiz_questions, $qmn_ $current_page_number = 1; foreach ( $qmn_quiz_questions as $mlw_question ) { if ( 0 != $pagination_option ) { - if ( 1 == $pagination_option ) { + if ( 1 == $pagination_option || 1 == $pages_count % $pagination_option || 1 == $pages_count ) { ?> -