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/qsm-admin.css b/css/qsm-admin.css index 45fcead14..f24be67b8 100644 --- a/css/qsm-admin.css +++ b/css/qsm-admin.css @@ -799,6 +799,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; @@ -891,10 +892,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 +899,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 +907,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 +1183,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; @@ -1335,8 +1335,15 @@ tr .qsm-opt-desc { #quiz_settings_wrapper .qsm-opt-desc { display: none !important; } -.form-table td fieldset label { +body:not(.qsm_page_qmn_global_settings) .form-table td fieldset label { margin-right: 20px !important; + width: 100%; +} +#correct_answer_logic { + padding-bottom: 10px; +} +.qsm-font-light { + font-weight: 300; } .form-table .qsm-opt-tr { position: relative; @@ -2994,7 +3001,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 +3011,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; @@ -3179,7 +3186,8 @@ input#duplicate_questions { top: 10px; } } -.mlw_quiz_options .qsm_tab_content input[name="end_quiz_if_wrong"]#end_quiz_if_wrong, #end_quiz_if_wrong { +body .qsm_tab_content .qsm-small-input-field input[type="number"], +body .qsm_tab_content .qsm-small-input-field input[type="text"] { min-width: 65px; width: 65px; box-shadow: 0 0 0 transparent; @@ -3188,3 +3196,23 @@ input#duplicate_questions { background-color: #fff; color: #2c3338; } +.qsm_tab_content input[type=text].qsm-date-picker { + background: url(../assets/calendar.png) no-repeat right 10px center; + background-size: 14px; + padding: 3px 10px; + min-width: 100px; + background-color: #fff; +} +.qsm-quiz-dates fieldset#scheduled_time_start, .qsm-quiz-dates fieldset#scheduled_time_end { + display: inline-block; +} +.qsm-image-field { + display: flex; +} +.qsm-image-field span { + padding-top: 4px; +} +fieldset#enable_quick_correct_answer_info { + margin-left: 25px; + margin-top: 4px; +} \ No newline at end of file diff --git a/js/qsm-admin.js b/js/qsm-admin.js index b1459ba50..2e6e4e521 100644 --- a/js/qsm-admin.js +++ b/js/qsm-admin.js @@ -63,11 +63,13 @@ var QSMAdmin; jQuery(".add-more-link").hide(); } if (jQuery('#limit_category_checkbox-1:checked').length > 0) { - jQuery('.qsm_tab_content input[name="question_per_category"],.qsm_tab_content .category_selection_random').parents("tr").hide(); + jQuery('#question_per_category').hide(); + jQuery('.category_selection_random').parents("tr").hide(); jQuery('div.select-category-question-limit-maindiv').parents("tr").show(); } else { jQuery('div.select-category-question-limit-maindiv').parents("tr").hide(); - jQuery('.qsm_tab_content input[name="question_per_category"],.qsm_tab_content .category_selection_random .qsm_tab_content .category_selection_random').parents("tr").show(); + jQuery('.category_selection_random').parents("tr").show(); + jQuery('#question_per_category').show(); } $('.qsm-tab').on('click', function (event) { event.preventDefault(); @@ -150,13 +152,31 @@ var QSMAdmin; $(document).on('change', '#limit_category_checkbox-1', function (event) { event.preventDefault(); if (jQuery('#limit_category_checkbox-1:checked').length > 0) { - jQuery('.qsm_tab_content input[name="question_per_category"],.qsm_tab_content .category_selection_random').parents("tr").hide(); + jQuery('#question_per_category').hide(); jQuery('div.select-category-question-limit-maindiv').parents("tr").show(); + jQuery('.category_selection_random').parents("tr").hide(); } else { jQuery('div.select-category-question-limit-maindiv').parents("tr").hide(); - jQuery('.qsm_tab_content input[name="question_per_category"],.qsm_tab_content .category_selection_random').parents("tr").show(); + jQuery('#question_per_category').show(); + jQuery('.category_selection_random').parents("tr").show(); } }); + 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); + }); + jQuery(document).on('click','.add-more-category', function () { let original = jQuery('div.select-category-question-limit-maindiv'); let lastChild = original.children().last(); @@ -359,22 +379,42 @@ var QSMAdmin; e.preventDefault(); MicroModal.show('show-all-variable'); }); - if ( "" != jQuery('#scheduled_time_end').val() ) { - jQuery('.not_allow_after_expired_time label').css('opacity', '1'); + if ( "" != jQuery('#scheduled_time_end-input').val() ) { + jQuery('#not_allow_after_expired_time label').css('opacity', '1'); jQuery('#not_allow_after_expired_time-1').attr('disabled', false); } else { - jQuery('.not_allow_after_expired_time label').css('opacity', '0.7'); + jQuery('#not_allow_after_expired_time label').css('opacity', '0.7'); jQuery('#not_allow_after_expired_time-1').attr('disabled', true); } - jQuery(document).on('change', '#scheduled_time_end', function () { + jQuery(document).on('change', '#scheduled_time_end-input', function () { if ( "" != jQuery(this).val() ) { - jQuery('.not_allow_after_expired_time label').css('opacity', '1'); + jQuery('#not_allow_after_expired_time label').css('opacity', '1'); jQuery('#not_allow_after_expired_time-1').attr('disabled', false); } else { - jQuery('.not_allow_after_expired_time label').css('opacity', '0.7'); + jQuery('#not_allow_after_expired_time label').css('opacity', '0.7'); jQuery('#not_allow_after_expired_time-1').attr('disabled', true); } }); + if ( 0 != jQuery('#question_from_total-input').val() ) { + jQuery('#limit_category_checkbox label').css('opacity', '1'); + jQuery('#limit_category_checkbox-1').attr('disabled', false); + jQuery('#question_per_category').show(); + } else { + jQuery('#limit_category_checkbox label').css('opacity', '0.7'); + jQuery('#limit_category_checkbox-1').attr('disabled', true); + jQuery('#question_per_category').hide(); + } + jQuery(document).on('change', '#question_from_total-input', function () { + if ( 0 != jQuery(this).val() ) { + jQuery('#limit_category_checkbox label').css('opacity', '1'); + jQuery('#limit_category_checkbox-1').attr('disabled', false); + jQuery('#question_per_category').show(); + } else { + jQuery('#limit_category_checkbox label').css('opacity', '0.7'); + jQuery('#limit_category_checkbox-1').attr('disabled', true); + jQuery('#question_per_category').hide(); + } + }); //Hide/show tr based on selection $('.qsm_tab_content .qsm-opt-tr select').each(function () { var name = $(this).attr('name'); @@ -384,38 +424,38 @@ var QSMAdmin; } }); $(document).on('change', '.qsm_tab_content select:not(.question_limit_category,.qsm-woo-result-related-products, .qsm-woo-email-related-products), #quiz_settings_wrapper select:not(.question_limit_category)', function () { - var name = $(this).attr('name'); var value = $(this).val(); - $('.qsm_hidden_tr').hide(); - if ($('.' + name + '_' + value).length > 0) { - hide_show_quiz_options(value); - } + hide_show_quiz_options(value); }); // form_type (0, 1, 2). function hide_show_quiz_options(form_type) { if (0 == form_type) { - $('.qsm_tab_content input[name="system"], .qsm_tab_content input[name="score_roundoff"], .qsm_tab_content input[name="correct_answer_logic"]').parents('tr').show(); + $('#score_roundoff').parents('tr').show(); + $('#correct_answer_logic').show(); } else { - $('.qsm_tab_content input[name="score_roundoff"], .qsm_tab_content input[name="correct_answer_logic"]').parents('tr').hide(); + $('#score_roundoff').parents('tr').hide(); + $('#correct_answer_logic').hide(); } } $(document).on('click', '.qsm_tab_content input[name="system"]', function () { - var name = $(this).attr('name'); var value = $(this).val(); - $('.qsm_hidden_tr_gradingsystem').hide(); + $('#correct_answer_logic, #score_roundoff').hide(); if (value == 0 || value == 3) { - $('.qsm_hidden_tr_gradingsystem').show(); + $('#correct_answer_logic, #score_roundoff').show(); } }); $(document).ready(function () { var system_option = $("input[type=radio][name='system']:checked").val(); - $('.qsm_hidden_tr_gradingsystem').hide(); + $('#correct_answer_logic, #score_roundoff').hide(); if (system_option == 0 || system_option == 3) { - $('.qsm_hidden_tr_gradingsystem').show(); + $('#correct_answer_logic, #score_roundoff').show(); + } + hide_show_quiz_options($("input[name='form_type']:checked").val()); + if (jQuery('.qsm-date-picker').length) { + jQuery('.qsm-date-picker').datetimepicker({ format: 'm/d/Y H:i', step: 1}); } - hide_show_quiz_options($("select[name='form_type']").find(":selected").val()); }); if ($('.qsm-text-label-wrapper').length > 0) { var element_position = $('.qsm-text-label-wrapper').offset().top; @@ -509,6 +549,24 @@ var QSMAdmin; }).open(); }); + $(document).on('click', '.qsm-image-btn', function (e) { + let button = $(this); + e.preventDefault(); + custom_uploader = wp.media({ + title: qsm_admin_messages.set_feature_img, + library: { + type: 'image' + }, + button: { + text: qsm_admin_messages.use_img // button label text + }, + multiple: false + }).on('select', function () { // it also has "open" and "close" events + let attachment = custom_uploader.state().get('selection').first().toJSON(); + button.prev('.qsm-image-input').val(attachment.url); + }).open(); + }); + // opens media library o set background image for quiz $(document).on('click', '.set_background_image', function (e) { let button = $(this); diff --git a/mlw_quizmaster2.php b/mlw_quizmaster2.php index 7616b755f..a55fcf1f8 100644 --- a/mlw_quizmaster2.php +++ b/mlw_quizmaster2.php @@ -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/quiz-options-page.php b/php/admin/quiz-options-page.php index 491018de3..2755ba359 100644 --- a/php/admin/quiz-options-page.php +++ b/php/admin/quiz-options-page.php @@ -338,7 +338,7 @@ function qsm_generate_quiz_options() { function qsm_quiz_options_notice_template() { ?> -