Skip to content

Commit

Permalink
Merge pull request #2112 from QuizandSurveyMaster/dev
Browse files Browse the repository at this point in the history
Release 8.1.0
  • Loading branch information
etvarun authored Feb 27, 2023
2 parents 1bb299f + 833833f commit 2cb7f59
Show file tree
Hide file tree
Showing 24 changed files with 206 additions and 96 deletions.
16 changes: 10 additions & 6 deletions css/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ body .qsm-popup__btn-primary {
border-radius: 0;
height: 20px;
}
.question-type-polar-s .ui-widget-content .ui-slider-handle {
.question-type-polar-s .ui-widget-content .ui-slider-handle {
background: rgb(119, 113, 113);
height: 32px;
border-color: rgb(119, 113, 113);
Expand All @@ -194,9 +194,6 @@ body .qsm-popup__btn-primary {
.qsm-deselect-answer {
float: right;
}
.qsm-popup__close {
text-decoration: none !important;
}
.qsm-popup__btn-primary {
margin-right: 30px;
}
Expand Down Expand Up @@ -273,6 +270,9 @@ footer.qsm-popup__footer button.qsm-popup-secondary-button:hover {
display: block;
margin-bottom: 10px;
}
.qsm-quiz-container .quiz_section .qsm-align-fill-in-blanks:not(.qsm_remove_bold) {
display: inline-block;
}
.quiz_section iframe {
width: 100% !important;
min-height: 315px !important;
Expand Down Expand Up @@ -428,6 +428,10 @@ body .qsm-results-page .mlw_qmn_question .qmn_image_option:before {
display: inline-block;
cursor: pointer;
}
.qsm-quiz-form .mlw_answer_open_text,
.qsm-quiz-form .mlw_answer_number{
margin-bottom: 10px;
}
@media screen and (max-width: 767px) {
.question-type-polar-s .left-polar-title,
.question-type-polar-s .slider-main-wrapper,
Expand Down Expand Up @@ -547,8 +551,8 @@ body .ui-tooltip.ui-widget-content {
border-bottom: 1px solid #808080;
padding-bottom: 25px;
}
.qmn_btn,
.qsm-quiz-container.qmn_quiz_container .qmn_btn,
.qmn_btn,
.qsm-quiz-container.qmn_quiz_container .qmn_btn,
.qsm-quiz-container.qmn_quiz_container .btn {
position: relative;
display: inline-block;
Expand Down
10 changes: 2 additions & 8 deletions css/qsm-admin-question.css
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
min-width: 45%;
padding: 8px 15px;
}
.page-footer a.button .dashicons,
.page-footer a.button .dashicons,
.new-answer-button a#new-answer-button .dashicons {
line-height: 32px;
}
Expand All @@ -134,13 +134,7 @@
text-decoration: none;
}
.page-header-buttons {
display: flex;
width: 100%;
justify-content: space-around;
align-content: center;
align-items: center;
flex-wrap: wrap;
flex-direction: row;
text-align: right;
}
.question, .question-bank-question {
box-sizing: border-box;
Expand Down
15 changes: 15 additions & 0 deletions css/qsm-admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -2293,6 +2293,7 @@ input#question_search::-webkit-search-cancel-button {
align-items: center;
flex-wrap: nowrap;
flex-direction: row;
max-width: calc(100% - 275px);
}
.qsm-quiz-nav-bar .qsm-quiz-heading .qsm_quiz_title {
padding: 0;
Expand Down Expand Up @@ -3007,3 +3008,17 @@ input#duplicate_questions {
font-size: 10px;
}
}
@media screen and (max-width: 767px) {
.qsm-quiz-nav-bar .qsm-quiz-heading{
max-width: 100%;
}
.qsm-quiz-nav-bar .qsm-quiz-top-nav-links{
justify-content: flex-end;
width: 100%;
}
.mlw_quiz_options .button-primary{
padding: 0px 5px;
font-size: 12px;
min-height: 35px;
}
}
4 changes: 3 additions & 1 deletion js/qsm-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -1454,6 +1454,7 @@ var QSMContact;
'operator': operator,
'value': value
}));
jQuery(document).trigger('qsm_after_add_email_condition', [$email, category, criteria, operator, value]);
},
newCondition: function ($email) {
QSMAdminEmails.addCondition($email, '', 'score', 'equal', 0);
Expand Down Expand Up @@ -1758,7 +1759,7 @@ var import_button;
//Create Default pages and one question.
if (qsmQuestionSettings.pages.length == 0 && QSMQuestion.questions.length == 0) {
$('.new-page-button').trigger('click');
$('.questions .new-question-button').trigger('click');
$('.questions .new-question-button:eq("1")').trigger('click');
}
QSMQuestion.countTotal();
},
Expand Down Expand Up @@ -3264,6 +3265,7 @@ var import_button;
'operator': operator,
'value': value
}));
jQuery(document).trigger('qsm_after_add_result_condition', [$page, category, criteria, operator, value]);
},
newCondition: function ($page) {
QSMAdminResults.addCondition($page, '', 'score', 'equal', 0);
Expand Down
86 changes: 53 additions & 33 deletions js/qsm-quiz.js
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ function qmnValidation(element, quiz_form_id) {
var error_messages = qmn_quiz_data[quiz_id].error_messages;
qmnResetError(quiz_form_id);
jQuery(element).each(function () {
if ( jQuery(this).attr('class') && jQuery(this).is(':visible') ) {
if ( jQuery(this).attr('class') && ( jQuery(this).is(':visible') || ( jQuery(this).attr('class').indexOf('mlwRequiredPolar') > -1 && jQuery(this).parent().is(':visible') ) ) ) {
if (jQuery(this).attr('class').indexOf('mlwEmail') !== -1 && this.value !== "") {
// Remove any trailing and preceeding space.
var x = jQuery.trim(this.value);
Expand Down Expand Up @@ -1453,42 +1453,62 @@ jQuery(function () {
});
});

jQuery(document).on('change', '.qmn_radio_answers input', function (e) {
jQuery(document).on('change', '.qmn_radio_answers input' , function (e) {
var quizID = jQuery(this).parents('.qsm-quiz-container').find('.qmn_quiz_id').val();
if (qmn_quiz_data[quizID].enable_quick_result_mc == 1) {
var question_id = jQuery(this).attr('name').split('question')[1],
value = jQuery(this).val(),
$this = jQuery(this).parents('.quiz_section');
jQuery.ajax({
type: 'POST',
url: qmn_ajax_object.ajaxurl,
data: {
action: "qsm_get_question_quick_result",
question_id: question_id,
answer: value,
show_correct_info: qmn_quiz_data[quizID].enable_quick_correct_answer_info
},
success: function (response) {
var data = jQuery.parseJSON(response);
$this.find('.quick-question-res-p').remove();
$this.find('.qsm-inline-correct-info').remove();
if (data.success == 'correct') {
$this.append('<div style="color: green" class="quick-question-res-p">' + qmn_quiz_data[quizID].quick_result_correct_answer_text + '</div>')
$this.append('<div class="qsm-inline-correct-info">' + data.message + '</div>');
} else if (data.success == 'incorrect') {
$this.append('<div style="color: red" class="quick-question-res-p">' + qmn_quiz_data[quizID].quick_result_wrong_answer_text + '</div>')
$this.append('<div class="qsm-inline-correct-info">' + data.message + '</div>');
}
if (1 != qmn_quiz_data[quizID].disable_mathjax) {
MathJax.typesetPromise();
}
},
error: function (errorThrown) {
alert(errorThrown);
}
});
let question_id = jQuery(this).attr('name').split('question')[1],
value = jQuery(this).val(),
$this = jQuery(this).parents('.quiz_section');
qsm_show_inline_result(quizID, question_id, value, $this, 'radio')
}
});
let qsm_inline_result_timer;
jQuery(document).on('keyup', '.mlw_answer_open_text, .mlw_answer_number', function (e) {
let $i_this = jQuery(this);
let quizID = jQuery(this).parents('.qsm-quiz-container').find('.qmn_quiz_id').val();
if (qmn_quiz_data[quizID].enable_quick_result_mc == 1) {
clearTimeout(qsm_inline_result_timer);
qsm_inline_result_timer = setTimeout(() => {
let question_id = $i_this.attr('name').split('question')[1],
value = $i_this.val(),
$this = $i_this.parents('.quiz_section');
qsm_show_inline_result(quizID, question_id, value, $this, 'input');
}, 2000);
}
});

//inline result status function
function qsm_show_inline_result(quizID, question_id, value, $this, answer_type) {
jQuery.ajax({
type: 'POST',
url: qmn_ajax_object.ajaxurl,
data: {
action: "qsm_get_question_quick_result",
question_id: question_id,
answer: value,
answer_type: answer_type,
show_correct_info: qmn_quiz_data[quizID].enable_quick_correct_answer_info
},
success: function (response) {
var data = jQuery.parseJSON(response);
$this.find('.quick-question-res-p').remove();
$this.find('.qsm-inline-correct-info').remove();
if (data.success == 'correct') {
$this.append('<div style="color: green" class="quick-question-res-p">' + qmn_quiz_data[quizID].quick_result_correct_answer_text + '</div>')
$this.append('<div class="qsm-inline-correct-info">' + data.message + '</div>');
} else if (data.success == 'incorrect') {
$this.append('<div style="color: red" class="quick-question-res-p">' + qmn_quiz_data[quizID].quick_result_wrong_answer_text + '</div>')
$this.append('<div class="qsm-inline-correct-info">' + data.message + '</div>');
}
if (1 != qmn_quiz_data[quizID].disable_mathjax) {
MathJax.typesetPromise();
}
},
error: function (errorThrown) {
alert(errorThrown);
}
});
}

// Autocomplete off
jQuery('.qsm-quiz-container').find('.qmn_quiz_id').each(function () {
Expand Down
6 changes: 3 additions & 3 deletions mlw_quizmaster2.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Plugin Name: Quiz And Survey Master
* Description: Easily and quickly add quizzes and surveys to your website.
* Version: 8.0.10
* Version: 8.1.0
* Author: ExpressTech
* Author URI: https://quizandsurveymaster.com/
* Plugin URI: https://expresstech.io/
Expand Down Expand Up @@ -43,7 +43,7 @@ class MLWQuizMasterNext {
* @var string
* @since 4.0.0
*/
public $version = '8.0.10';
public $version = '8.1.0';

/**
* QSM Alert Manager Object
Expand Down Expand Up @@ -277,7 +277,7 @@ public function qsm_admin_scripts_style( $hook ) {
wp_enqueue_style( 'qsm_admin_style_rtl', plugins_url( 'css/qsm-admin-rtl.css', __FILE__ ), array(), $this->version );
}
// dashboard and quiz list pages
if ( 'toplevel_page_qsm_dashboard' === $hook || ('edit.php' == $hook && isset( $_REQUEST['post_type'] ) && 'qsm_quiz' == $_REQUEST['post_type']) ) {
if ( 'toplevel_page_qsm_dashboard' === $hook || 'qsm_page_qmn_addons' === $hook || ('edit.php' == $hook && isset( $_REQUEST['post_type'] ) && 'qsm_quiz' == $_REQUEST['post_type']) ) {
wp_enqueue_script( 'micromodal_script', plugins_url( 'js/micromodal.min.js', __FILE__ ), array( 'jquery', 'qsm_admin_js' ), $this->version, true );
wp_enqueue_media();
wp_enqueue_style( 'qsm_admin_dashboard_css', QSM_PLUGIN_CSS_URL . '/admin-dashboard.css', array(), $this->version );
Expand Down
2 changes: 1 addition & 1 deletion php/admin/admin-dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ function qsm_dashboard_popular_addon( $widget_id ) {
?>
<div id="<?php echo esc_attr( $widget_id ); ?>" class="postbox <?php qsm_check_close_hidden_box( $widget_id ); ?>">
<button type="button" class="handlediv" aria-expanded="true">
<span class="screen-reader-text"><?php echo __( 'Toggle panel', 'quiz-master-next' ); ?>:
<span class="screen-reader-text"><?php esc_html_e( 'Toggle panel', 'quiz-master-next' ); ?>:
<?php esc_html_e( 'Most Popular Extensions', 'quiz-master-next' ); ?></span>
<span class="toggle-indicator" aria-hidden="true"></span>
</button>
Expand Down
5 changes: 3 additions & 2 deletions php/admin/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,8 @@ function qsm_add_author_column_in_db() {
* Transfer all quiz post to new cpt 'qsm_quiz'
*/
function qsm_change_the_post_type() {
if ( 1 !== intval( get_option( 'qsm_change_the_post_type', '' ) ) ) {
$all_plugins = get_plugins();
if ( empty( $all_plugins['sensei-lms/sensei-lms.php'] ) && 1 !== intval( get_option( 'qsm_change_the_post_type', '' ) ) ) {
$post_arr = array(
'post_type' => 'quiz',
'posts_per_page' => -1,
Expand Down Expand Up @@ -796,7 +797,7 @@ class="qsm-opt-desc"><?php esc_html_e( 'Enter a name for this Quiz.', 'quiz-mast
</span>
</a>
<a class="addon-get-link" href="<?php echo esc_url( $link ); ?>" target="_blank" rel="noopener">
<?php echo __( 'View Details', 'quiz-master-next' ); ?>
<?php esc_html_e( 'View Details', 'quiz-master-next' ); ?>
</a>
</div>
<?php
Expand Down
21 changes: 11 additions & 10 deletions php/admin/options-page-email-tab.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,16 +203,17 @@ function qsm_options_emails_tab_template() {
<div class="email-condition">
<button class="delete-condition-button"><span class="dashicons dashicons-trash"></span></button>
<select class="email-condition-category">
<option value="" <# if (data.category == '') { #>selected<# } #>><?php esc_html_e( 'Quiz', 'quiz-master-next' ); ?></option>
<option value="" disabled><?php esc_html_e( '---Select Category---', 'quiz-master-next' ); ?></option>
<?php if ( ! empty( $categories ) ) { ?>
<?php foreach ( $categories as $cat ) { ?>
<option value="<?php echo esc_attr( $cat[0] ); ?>" <# if (data.category == '<?php echo esc_attr( $cat[0] ); ?>') { #>selected<# } #>><?php echo esc_attr( $cat[0] ); ?></option>
<?php } ?>
<?php } else { ?>
<option value="" disabled><?php esc_html_e( 'No Categories Available', 'quiz-master-next' ); ?></option>
<?php } ?>
</select>
<option value="" <# if (data.category == '') { #>selected<# } #>><?php esc_html_e( 'Quiz', 'quiz-master-next' ); ?></option>
<option value="" disabled><?php esc_html_e( '---Select Category---', 'quiz-master-next' ); ?></option>
<?php if ( ! empty( $categories ) ) { ?>
<?php foreach ( $categories as $cat ) { ?>
<option value="<?php echo esc_attr( $cat[0] ); ?>" <# if (data.category == '<?php echo esc_attr( $cat[0] ); ?>') { #>selected<# } #>><?php echo esc_attr( $cat[0] ); ?></option>
<?php } ?>
<?php } else { ?>
<option value="" disabled><?php esc_html_e( 'No Categories Available', 'quiz-master-next' ); ?></option>
<?php } ?>
<?php do_action( 'qsm_email_page_condition_category' ); ?>
</select>
<select class="email-condition-criteria">
<option value="points" <# if (data.criteria == 'points') { #>selected<# } #>><?php esc_html_e( 'Total points earned', 'quiz-master-next' ); ?></option>
<option value="score" <# if (data.criteria == 'score') { #>selected<# } #>><?php esc_html_e( 'Correct score percentage', 'quiz-master-next' ); ?></option>
Expand Down
10 changes: 7 additions & 3 deletions php/admin/options-page-questions-tab.php
Original file line number Diff line number Diff line change
Expand Up @@ -1102,12 +1102,16 @@ function qsm_options_questions_tab_template() {
<div class="page page-new" data-page-id="{{data.id }}">
<div class="page-header">
<div><span class="dashicons dashicons-move"></span> <span class="page-number"></span></div>
<div><a href="javascript:void(0)" class="edit-page-button" title="Edit Page"><span class="dashicons dashicons-admin-generic"></span></a></div>
<div>
<a href="javascript:void(0)" class="edit-page-button" title="Edit Page"><span class="dashicons dashicons-admin-generic"></span></a>
<a href="javascript:void(0)" class="add-question-bank-button button button-primary"><?php esc_html_e( 'Import', 'quiz-master-next' ); ?></a>
<a href="javascript:void(0)" class="new-question-button button button-primary"><?php esc_html_e( 'Add Question', 'quiz-master-next' ); ?></a>
</div>
</div>
<div class="page-footer">
<div class="page-header-buttons">
<a href="javascript:void(0)" class="add-question-bank-button qsm-dashed-btn"><span class="dashicons dashicons-plus"></span> <?php esc_html_e( 'Add Question From Question Bank', 'quiz-master-next' ); ?></a>
<a href="javascript:void(0)" class="new-question-button qsm-dashed-btn"><span class="dashicons dashicons-plus"></span> <?php esc_html_e( 'Create New Question', 'quiz-master-next' ); ?></a>
<a href="javascript:void(0)" class="add-question-bank-button button button-primary"><?php esc_html_e( 'Import', 'quiz-master-next' ); ?></a>
<a href="javascript:void(0)" class="new-question-button button button-primary"><?php esc_html_e( 'Add Question', 'quiz-master-next' ); ?></a>
</div>
</div>
</div>
Expand Down
9 changes: 5 additions & 4 deletions php/admin/options-page-results-page-tab.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,25 +120,25 @@ function qsm_options_results_tab_content() {
$upgrade_link = qsm_get_plugin_link('extra-template-variables');
$classname = "qsm-upgrade-popup-variable";
$qsm_badge = "<a href =".$upgrade_link." target='_blank' class='qsm-upgrade-popup-badge'>".esc_html__( 'PRO', 'quiz-master-next' )."</a>";

}
if ( ( ! class_exists( 'Mlw_Qmn_Al_Widget' ) ) && ( 'Advanced Leaderboard' == $category_name ) ) {
$upgrade_link = qsm_get_plugin_link('downloads/advanced-leaderboard/');
$classname = "qsm-upgrade-popup-variable";
$qsm_badge = "<a href =".$upgrade_link." target='_blank' class='qsm-upgrade-popup-badge'>".esc_html__( 'PRO', 'quiz-master-next' )."</a>";

}
if ( ( ! class_exists( 'QSM_Exporting' ) ) && ( 'Export Results' == $category_name) ) {
$upgrade_link = qsm_get_plugin_link('downloads/export-results/');
$classname = "qsm-upgrade-popup-variable";
$qsm_badge = "<a href =".$upgrade_link." target='_blank' class='qsm-upgrade-popup-badge'>".esc_html__( 'PRO', 'quiz-master-next' )."</a>";

}
if ( ( ! class_exists( 'QSM_Analysis' ) ) && ( 'Analysis' == $category_name ) ) {
$upgrade_link = qsm_get_plugin_link('downloads/results-analysis/');
$classname = "qsm-upgrade-popup-variable";
$qsm_badge = "<a href =".$upgrade_link." target='_blank' class='qsm-upgrade-popup-badge'>".esc_html__( 'PRO', 'quiz-master-next' )."</a>";

}
?>
<div><h2 class="qsm-upgrade-popup-category-name"><?php echo esc_attr( $category_name );?></h2><?php echo wp_kses_post( $qsm_badge ) ; ?></div>
Expand Down Expand Up @@ -237,6 +237,7 @@ function qsm_options_results_tab_template(){
<?php } else { ?>
<option value="" disabled><?php esc_html_e( 'No Categories Available', 'quiz-master-next' ); ?></option>
<?php } ?>
<?php do_action( 'qsm_results_page_condition_category' ); ?>
</select>

<select class="results-page-condition-criteria">
Expand Down
3 changes: 3 additions & 0 deletions php/admin/quiz-options-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@ function qsm_generate_quiz_options() {
</div>
<?php
}
if ( class_exists( 'QSM_Export_Import' ) ) {
?><a class="button button-primary" href="<?php echo esc_url( admin_url() . 'admin.php?page=qmn_addons&tab=export-and-import' ); ?>" style="float: right;" target="_blank" rel="noopener"><?php esc_html_e( 'Import & Export', 'quiz-master-next' ); ?></a><?php
}
?>
</nav>
<div class="qsm_tab_content">
Expand Down
Loading

0 comments on commit 2cb7f59

Please sign in to comment.