diff --git a/assets/calendar.png b/assets/calendar.png new file mode 100644 index 000000000..1c1baf7c3 Binary files /dev/null and b/assets/calendar.png differ diff --git a/css/admin-dashboard-rtl.css b/css/admin-dashboard-rtl.css index 13e1a270d..6fb41686b 100644 --- a/css/admin-dashboard-rtl.css +++ b/css/admin-dashboard-rtl.css @@ -1,5 +1,4 @@ .welcome-panel-column .dashicons { - /* font-size: 30px; */ color: #606a73; font-size: 23px; margin-left: 5px; @@ -236,7 +235,6 @@ padding: 0; background: #f3f3f3; min-width: 70vw; - /* max-width: 1040px; */ border-radius: 0; max-height: 85vh; overflow: hidden; @@ -247,7 +245,6 @@ margin: 0; max-height: 75vh; overflow-y: auto; - /* padding-bottom: 59px; */ } #model-wizard .qsm-popup__header { @@ -296,86 +293,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; @@ -625,7 +542,6 @@ } #quiz_settings_wrapper tr { - /*display: inline-block;*/ width: 100%; } @@ -807,6 +723,8 @@ h2.hndle.ui-sortable-handle { background: #ffffff60; padding: 20px; position: relative; + display: flex; + flex-wrap: wrap; } #model-wizard .qsm-new-menu-elements .input-group .qsm-tooltips-icon { @@ -858,10 +776,6 @@ h2.hndle.ui-sortable-handle { margin-bottom: 10px; } -#model-wizard .featured_image { - display: none; -} - #model-wizard .empty-market-place { position: absolute; top: 45%; @@ -1078,22 +992,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%; @@ -1103,11 +1001,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 4c340c76f..8a63f0953 100644 --- a/css/admin-dashboard.css +++ b/css/admin-dashboard.css @@ -1,5 +1,4 @@ .welcome-panel-column .dashicons { - /* font-size: 30px; */ color: #606a73; font-size: 23px; margin-right: 5px; @@ -250,7 +249,6 @@ ul.popuar-addon-ul::after { padding: 0; background: #f3f3f3; min-width: 70vw; - /* max-width: 1040px; */ border-radius: 0; max-height: 85vh; overflow: hidden; @@ -261,7 +259,6 @@ ul.popuar-addon-ul::after { margin: 0; max-height: 75vh; overflow-y: auto; - /* padding-bottom: 59px; */ } #model-wizard .qsm-popup__header { @@ -303,86 +300,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; @@ -624,7 +541,6 @@ ul.popuar-addon-ul::after { } #quiz_settings_wrapper tr { - /*display: inline-block;*/ width: 100%; } @@ -806,6 +722,8 @@ h2.hndle.ui-sortable-handle { background: #ffffff60; padding: 20px; position: relative; + display: flex; + flex-wrap: wrap; } #model-wizard .qsm-new-menu-elements .input-group .qsm-tooltips-icon { @@ -820,7 +738,6 @@ h2.hndle.ui-sortable-handle { } #model-wizard .qsm-new-menu-elements .input-group>label { - /* color: #888; */ display: inline-block; font-size: 16px; margin-bottom: 5px; @@ -857,10 +774,6 @@ h2.hndle.ui-sortable-handle { margin-bottom: 10px; } -#model-wizard .featured_image { - display: none; -} - #model-wizard .empty-market-place { position: absolute; top: 45%; @@ -1119,22 +1032,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%; @@ -1144,11 +1041,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/common-rtl.css b/css/common-rtl.css index 5fac1da2a..bc06400b6 100644 --- a/css/common-rtl.css +++ b/css/common-rtl.css @@ -119,6 +119,7 @@ body .qsm-popup .qsm-popup__btn { padding-bottom: 10px; } +body #modal-3.qsm-popup .qsm-popup__content, body .qsm-popup__content { text-align: center; } @@ -137,6 +138,7 @@ body .qsm-popup__content>p.qsm-time-up-text { footer.qsm-popup__footer { text-align: center; + padding: 10px; } footer.qsm-popup__footer button.qsm-popup-secondary-button { @@ -403,4 +405,12 @@ div .qsm-results-page .qmn_image_option { -webkit-transition: background .25s ease-out; -moz-transition: background .25s ease-out; transition: background .25s ease-out; +} +.qsm-result-page-warning { + color: #842029; + background-color: #f8d7da; + border-color: #f5c2c7; + padding: 1rem; + border-radius: 0.25rem; + margin-bottom: 1rem; } \ No newline at end of file diff --git a/css/common.css b/css/common.css index 0cbe075d3..73f0ba971 100644 --- a/css/common.css +++ b/css/common.css @@ -214,6 +214,7 @@ body .qsm-popup .qsm-popup__btn { padding-top: 10px; padding-bottom: 10px; } +body #modal-3.qsm-popup .qsm-popup__content, body .qsm-popup__content { text-align: center; } @@ -229,6 +230,7 @@ body .qsm-popup__content > p.qsm-time-up-text { } footer.qsm-popup__footer { text-align: center; + padding: 10px; } footer.qsm-popup__footer button.qsm-popup-secondary-button { background-color: #808080 !important; @@ -626,4 +628,12 @@ body .ui-tooltip.ui-widget-content { -webkit-transition: background .25s ease-out; -moz-transition: background .25s ease-out; transition: background .25s ease-out; +} +.qsm-result-page-warning { + color: #842029; + background-color: #f8d7da; + border-color: #f5c2c7; + padding: 1rem; + border-radius: 0.25rem; + margin-bottom: 1rem; } \ No newline at end of file diff --git a/css/qsm-admin.css b/css/qsm-admin.css index 45fcead14..3819022c2 100644 --- a/css/qsm-admin.css +++ b/css/qsm-admin.css @@ -1,8 +1,4 @@ /******************** Quizzes/Surveys Page *********************/ -/*.qsm-quizes-page .widefat td { - font-size: 16px !important; -} -*/ @-moz-keyframes qsm-spinner-loader { 0% { -moz-transform: rotate(0deg); @@ -799,6 +795,7 @@ ul.changelog li.update div.two:before { flex-direction: row; flex-wrap: wrap; align-items: stretch; + border-bottom: 1px solid #cecece; } .qsm-sub-text-tab-menu { display: inline-block; @@ -852,7 +849,8 @@ ul.changelog li.update div.two:before { box-sizing: border-box; border-left: 1px solid #dfd4d4; } -.quiz_text_tab_content .right-bar .quiz_style_tab_content .form-table th { +.quiz_text_tab_content .right-bar .quiz_style_tab_content .form-table th, +.quiz_style_tab_content .form-table th { width: 250px; } .quiz_text_tab_content .left-bar ul { @@ -891,10 +889,6 @@ ul.changelog li.update div.two:before { display: inline-block; box-sizing: border-box; } -.qsm_tab_content .subsubsub li { - border-left: 2px solid #aaa; - padding: 0 5px; -} .qsm_tab_content .subsubsub li:first-child { border-left: 0; padding-left: 0; @@ -902,7 +896,7 @@ ul.changelog li.update div.two:before { .qsm_tab_content .subsubsub li a { font-size: 14px; line-height: 1.2; - padding: 0; + padding: 10px; } .qsm_tab_content a:hover, .qsm_tab_content a:focus { @@ -910,6 +904,9 @@ ul.changelog li.update div.two:before { text-decoration: none; box-shadow: none; } +.qsm_tab_content .subsubsub li a.current{ + border-bottom: 3px solid #00BEE9; +} /* Popup */ .qsm-popup { font-family: -apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, arial, sans-serif; @@ -1183,11 +1180,11 @@ h3.addon_category_name { .qsm_tab_content input[name="question_limit_key[]"] { max-width: 150px; min-width: 150px; -} +} .qsm_tab_content .question_limit_category { max-width: 200px; min-width: 200px; -} +} .qsm_tab_content textarea { background: #ffffff none repeat scroll 0 0; border: 1px solid #dddddd; @@ -1290,8 +1287,6 @@ div#modal-6 label { .qsm-no-quiz-wrapper .dashicons.dashicons-format-chat { font-size: 200px; display: block; - /* line-height: 200px; - */ width: auto; height: auto; } @@ -1320,11 +1315,10 @@ span.qsm-ph_text { display: inline-block; } tr .qsm-opt-desc { - color: #666; - font-style: italic; - font-size: 14px; - margin-top: 5px; - display: block; + color: #646970; + margin-top: 5px; + display: block; + font-size: 14px; } .form-table .send_email .qsm-opt-tr, .form-table .send_email td { padding-top: 0; @@ -1487,7 +1481,6 @@ td.scheduled_time_start { } .qsm-text-label-wrapper>h2 { font-size: 24px; - /*border-bottom: 1px solid #ccc;*/ padding-bottom: 10px; line-height: normal; } @@ -2994,7 +2987,7 @@ input#duplicate_questions { display: flex; flex-direction: row; justify-content: space-between; - flex-wrap: wrap; + flex-wrap: wrap; align-items: center; background: #ffffff; border-top: 1px solid #DADADA; @@ -3004,7 +2997,7 @@ input#duplicate_questions { } .option-page-result-page-tab-footer .result-tab-footer-buttons { display: flex; - flex-direction: row; + flex-direction: row; } .option-page-result-page-tab-footer .footer-bar-notice { display: flex; diff --git a/js/qsm-admin.js b/js/qsm-admin.js index b1459ba50..3e0578e9f 100644 --- a/js/qsm-admin.js +++ b/js/qsm-admin.js @@ -192,13 +192,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 { + $.post(ajaxurl, { result_id: result_id, action: action, nonce: wpApiSettings.nonce }, + function (response) { + if (response.success) { $this.parents('li').slideUp(); $this.parents('li').remove(); + } else { + alert(qsm_admin_messages.error_delete_result); } } ); @@ -220,37 +220,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) { @@ -875,38 +846,7 @@ if(current_id == 'qsm_variable_text'){ jQuery(".current_variable")[0].click();} 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'); @@ -1137,14 +1077,6 @@ if(current_id == 'qsm_variable_text'){ jQuery(".current_variable")[0].click();} $(document).find('#select_themes .theme-actions').remove(); - $(document).on('click', '#new_quiz_button', function () { - $('#quiz_settings').find('.qsm-opt-desc').each(function () { - if ($(this)) { - desc = $(this); - desc.parents('.input-group').find('label:first-child').append(desc); - } - }) - }); } }(jQuery)); @@ -1170,12 +1102,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); @@ -1193,10 +1125,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) { + success: function (response) { + if (response.success) { $('.multiple-category-notice').hide(); } } @@ -1446,7 +1379,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 { @@ -1524,6 +1457,7 @@ var QSMContact; }) .done(function (results) { if (results.status) { + jQuery(document).trigger('qsm_after_save_email'); QSMAdmin.displayAlert(qsm_admin_messages.emails_saved, 'success'); } else { QSMAdmin.displayAlert(qsm_admin_messages.emails_save_error + ' ' + qsm_admin_messages.try_again, 'error'); @@ -3257,6 +3191,7 @@ var import_button; var new_category_data = { action: 'save_new_category', name: new_category, + nonce: qsmQuestionSettings.saveNonce, parent: parent_category }; $('#modal-9-content .info').html(''); diff --git a/js/qsm-quiz.js b/js/qsm-quiz.js index 591a54aee..e5bfae2fc 100644 --- a/js/qsm-quiz.js +++ b/js/qsm-quiz.js @@ -25,6 +25,7 @@ var qsmTimerInterval = []; let quizID = parseInt(quiz.quiz_id); if ( null == localStorage.getItem('mlw_quiz_start_date' + quizID) ) { localStorage.setItem('mlw_quiz_start_date' + quizID, qmn_ajax_object.start_date); + localStorage.setItem('mlw_time_consumed_quiz' + quizID, 1); } jQuery.ajax({ url: qmn_ajax_object.ajaxurl, @@ -129,14 +130,17 @@ var qsmTimerInterval = []; var seconds = 0; // Calculates starting time. + var timerTotal = parseFloat(qmn_quiz_data[quizID].timer_limit) * 60; var timerStarted = localStorage.getItem('mlw_started_quiz' + quizID); - var timerRemaning = localStorage.getItem('mlw_time_quiz' + quizID); + var timerConsumed = parseInt(localStorage.getItem('mlw_time_consumed_quiz' + quizID)); + var timerRemaning = timerTotal - timerConsumed; if ('yes' == timerStarted && 0 < timerRemaning) { seconds = parseInt(timerRemaning); } else { seconds = parseFloat(qmn_quiz_data[quizID].timer_limit) * 60; } qmn_quiz_data[quizID].timerRemaning = seconds; + qmn_quiz_data[quizID].timerConsumed = timerConsumed; //hidden timer jQuery(".hiddentimer").html(seconds); @@ -159,10 +163,12 @@ var qsmTimerInterval = []; */ timer: function (quizID) { qmn_quiz_data[quizID].timerRemaning -= 1; + qmn_quiz_data[quizID].timerConsumed += 1; if (0 > qmn_quiz_data[quizID].timerRemaning) { qmn_quiz_data[quizID].timerRemaning = 0; } var secondsRemaining = qmn_quiz_data[quizID].timerRemaning; + var secondsConsumed = qmn_quiz_data[quizID].timerConsumed; var display = QSM.secondsToTimer(secondsRemaining); var systemTime = new Date().getTime() / 1000; systemTime = Math.round(systemTime); @@ -171,6 +177,7 @@ var qsmTimerInterval = []; return false; } // Sets our local storage values for the timer being started and current timer value. + localStorage.setItem('mlw_time_consumed_quiz' + quizID, secondsConsumed ); localStorage.setItem('mlw_time_quiz' + quizID, secondsRemaining); localStorage.setItem('mlw_started_quiz' + quizID, "yes"); @@ -231,6 +238,7 @@ var qsmTimerInterval = []; endTimer: function (quizID) { localStorage.setItem('mlw_time_quiz' + quizID, 'completed'); localStorage.setItem('mlw_started_quiz' + quizID, 'no'); + localStorage.removeItem('mlw_time_consumed_quiz' + quizID); document.title = qsmTitleText; if (typeof qmn_quiz_data[quizID].timerInterval != 'undefined') { clearInterval(qmn_quiz_data[quizID].timerInterval); @@ -382,8 +390,9 @@ var qsmTimerInterval = []; // Calculates starting time. let timerStarted = localStorage.getItem('mlw_started_quiz' + quizID); - let timerRemaning = localStorage.getItem('mlw_time_quiz' + quizID); + let timerConsumed = parseInt(localStorage.getItem('mlw_time_consumed_quiz' + quizID)); let seconds = parseFloat(qmn_quiz_data[quizID].timer_limit) * 60; + let timerRemaning = seconds - timerConsumed; if ('yes' == timerStarted && 0 < timerRemaning) { seconds = parseInt(timerRemaning); } @@ -1234,7 +1243,7 @@ function qmnNextSlide(pagination, go_to_top, quiz_form_id) { if (qmn_quiz_data[quiz_id].contact_info_location == 1) { $container.find(".qsm-submit-btn").hide(); $container.find(".mlw_next").show(); - } + } } $container.find('.qsm-auto-page-row.qsm-apc-' + page_number).show(); $container.find('.slide_number_hidden').val(parseInt(slide_number) + 1); @@ -1838,9 +1847,9 @@ function qsm_submit_quiz_if_answer_wrong(question_id, value, $this, $quizForm, a } function qsm_question_quick_result_js(question_id, answer, answer_type = '', show_correct_info = '',quiz_id='') { - + if (typeof encryptedData[quiz_id] !== 'undefined') { - + let decryptedBytes = CryptoJS.AES.decrypt(encryptedData[quiz_id], encryptionKey[quiz_id]); let decryptedData = decryptedBytes.toString(CryptoJS.enc.Utf8); let decrypt = JSON.parse(decryptedData); diff --git a/mlw_quizmaster2.php b/mlw_quizmaster2.php index f0b958e11..e67e1c8c0 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.18 + * Version: 8.1.19 * 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.18'; + public $version = '8.1.19'; /** * QSM Alert Manager Object @@ -361,6 +361,7 @@ public function qsm_admin_scripts_style( $hook ) { wp_enqueue_script( 'jquery-ui-tabs' ); wp_enqueue_script( 'jquery-effects-blind' ); wp_enqueue_script( 'jquery-effects-explode' ); + wp_enqueue_media(); break; default: wp_enqueue_editor(); 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 .= ''; - } else { - $recommended_addon_str .= __( 'No addons are found!', 'quiz-master-next' ); - } - echo wp_kses_post( $recommended_addon_str ); - exit; -} -add_action( 'wp_ajax_qsm_wizard_template_quiz_options', 'qsm_wizard_template_quiz_options' ); - /** * @since 7.0 * @param str $widget_id diff --git a/php/admin/admin-results-page.php b/php/admin/admin-results-page.php index 3fda0d296..79056ad39 100644 --- a/php/admin/admin-results-page.php +++ b/php/admin/admin-results-page.php @@ -297,6 +297,7 @@ function qsm_results_overview_tab_content() { if ( isset( $_POST["results-screen_option_nonce"] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST["results-screen_option_nonce"] ) ), 'results_screen_option' ) ) { $results_screen_option['page_url'] = isset( $_POST['page_url'] ) ? sanitize_text_field( wp_unslash( $_POST['page_url'] ) ) : "0"; $results_screen_option['page_name'] = isset( $_POST['page_name'] ) ? sanitize_text_field( wp_unslash( $_POST['page_name'] ) ) : "0"; + $results_screen_option['view_result_page'] = isset( $_POST['view_result_page'] ) ? sanitize_text_field( wp_unslash( $_POST['view_result_page'] ) ) : "0"; $results_screen_option['business'] = isset( $_POST['business'] ) ? sanitize_text_field( wp_unslash( $_POST['business'] ) ) : "0"; $results_screen_option['phone'] = isset( $_POST['phone'] ) ? sanitize_text_field( wp_unslash( $_POST['phone'] ) ) : "0"; $results_screen_option['ip_address'] = isset( $_POST['ip_address'] ) ? sanitize_text_field( wp_unslash( $_POST['ip_address'] ) ) : "0"; @@ -307,15 +308,15 @@ function qsm_results_overview_tab_content() { } else { $results_screen_option = get_user_meta( $user_id, 'results_screen_option', true ); $results_screen_option = ! empty( $results_screen_option ) ? $results_screen_option : ''; - if ( empty( $results_screen_option ) ) { - $results_screen_option = array( - 'page_url' => '0', - 'page_name' => '0', - 'business' => '1', - 'phone' => '1', - 'ip_address' => '1', - ); - } + $default_results_screen_option = array( + 'page_url' => '0', + 'view_result_page' => '0', + 'page_name' => '0', + 'business' => '1', + 'phone' => '1', + 'ip_address' => '1', + ); + $results_screen_option = wp_parse_args( $results_screen_option, $default_results_screen_option ); if ( ! isset( $results_screen_option['start_date'] ) ) { $results_screen_option['start_date'] = "0"; } @@ -332,18 +333,19 @@ function qsm_results_overview_tab_content() { wp_nonce_field( 'bulk_delete', 'bulk_delete_nonce' ); $th_elements = apply_filters( 'mlw_qmn_admin_results_page_headings', array( - 'score' => __( 'Score', 'quiz-master-next' ), - 'time_complete' => __( 'Time To Complete', 'quiz-master-next' ), - 'name' => __( 'Name', 'quiz-master-next' ), - 'business' => __( 'Business', 'quiz-master-next' ), - 'email' => __( 'Email', 'quiz-master-next' ), - 'phone' => __( 'Phone', 'quiz-master-next' ), - 'user' => __( 'User', 'quiz-master-next' ), - 'start_date' => __( 'Start Date', 'quiz-master-next' ), - 'time_taken' => __( 'End Date', 'quiz-master-next' ), - 'ip' => __( 'IP Address', 'quiz-master-next' ), - 'page_name' => __( 'Page Name', 'quiz-master-next' ), - 'page_url' => __( 'Page URL', 'quiz-master-next' ), + 'score' => __( 'Score', 'quiz-master-next' ), + 'time_complete' => __( 'Time To Complete', 'quiz-master-next' ), + 'name' => __( 'Name', 'quiz-master-next' ), + 'business' => __( 'Business', 'quiz-master-next' ), + 'email' => __( 'Email', 'quiz-master-next' ), + 'phone' => __( 'Phone', 'quiz-master-next' ), + 'user' => __( 'User', 'quiz-master-next' ), + 'start_date' => __( 'Start Date', 'quiz-master-next' ), + 'time_taken' => __( 'End Date', 'quiz-master-next' ), + 'ip' => __( 'IP Address', 'quiz-master-next' ), + 'page_name' => __( 'Page Name', 'quiz-master-next' ), + 'page_url' => __( 'Page URL', 'quiz-master-next' ), + 'view_result_page' => __( 'Result Page', 'quiz-master-next'), ) ); $values = $quiz_infos = []; @@ -374,6 +376,9 @@ function qsm_results_overview_tab_content() { if ( "0" === $results_screen_option['time_taken'] ) { $values['time_taken']['style'] = $display_none; } + if ( "0" === $results_screen_option['view_result_page'] ) { + $values['view_result_page']['style'] = $display_none; + } if ( ! class_exists( 'QSM_Proctoring_Quiz' ) ) { $proctor_class = "qsm-quiz-proctor-addon"; }else { @@ -480,8 +485,13 @@ function qsm_results_overview_tab_content() { } $values['page_url']['content'][] = '' . esc_html( $quiz_page_url ) . ''; } + if ( isset( $values['view_result_page']) ) { + $quiz_page_url = $mlw_quiz_info->page_url; + $unique_id = $mlw_quiz_info->unique_id; + $values['view_result_page']['content'][] = '' . esc_html__( 'View', 'quiz-master-next' ) . ''; + } foreach ( $values as $k => $v ) { - if ( ! in_array( $k, [ 'score', 'time_complete', 'name', 'business', 'email', 'phone', 'user', 'time_taken', 'ip', 'page_name', 'page_url' ], true ) ) { + if ( ! in_array( $k, [ 'score', 'time_complete', 'name', 'business', 'email', 'phone', 'user', 'time_taken', 'ip', 'page_name', 'page_url', 'view_result_page' ], true ) ) { $content = apply_filters( 'mlw_qmn_admin_results_page_column_content', '', $mlw_quiz_info, $k ); if ( isset( $values[ $k ] ) && ! empty( $content ) ) { $values[ $k ]['content'][] = $content; @@ -558,6 +568,10 @@ function qsm_results_overview_tab_content() { /> +