Improve code and fix issue with modal

This commit is contained in:
José González 2021-05-25 16:19:41 +02:00
parent 1dcb9570ef
commit a36718c724

View File

@ -755,43 +755,47 @@ function newsletter_wiz_modal(
); );
// Avoid to show default email. // Avoid to show default email.
if ($email == 'admin@example.com') { if ($email === 'admin@example.com') {
$email = ''; $email = '';
} }
$output .= '<div id="newsletter_wizard" title="'; $modalContent = html_print_div(
$output .= __('Do you want to be up to date?'); [
$output .= '" class="invisible">'; 'class' => 'register_update_manager',
$output .= '<div class="register_update_manager">'; 'content' => html_print_image(
$output .= html_print_image('images/pandora_circle_big.png', true); 'images/pandora_circle_big.png',
$output .= '</div>'; true
),
$output .= '<div class="newsletter_div">'; ],
$output .= __( true
'Subscribe to our newsletter',
$product_name
); );
$output .= '</div>';
$output .= '<div class="license_text both">'; $modalContent .= html_print_div(
$output .= '<p>Stay up to date with updates, upgrades and promotions by subscribing to our newsletter.</p>'; [
$output .= '<p>'; 'class' => 'newsletter_div',
$output .= __( 'content' => __('Subscribe to our newsletter'),
],
true
);
$modalContent .= html_print_div(
[
'class' => 'license_text both',
'content' => sprintf(
'<p>%s</p><p>%s</p>',
__('Stay up to date with updates, upgrades and promotions by subscribing to our newsletter.'),
__(
'By subscribing to the newsletter, you accept that your email will be transferred to a database owned by %s. These data will be used only to provide you with information about %s and will not be given to third parties. You can unsubscribe from this database at any time from the newsletter subscription options.', 'By subscribing to the newsletter, you accept that your email will be transferred to a database owned by %s. These data will be used only to provide you with information about %s and will not be given to third parties. You can unsubscribe from this database at any time from the newsletter subscription options.',
$product_name, $product_name,
$product_name $product_name
)
),
],
true
); );
$output .= '</p>'; // Email Input case.
$emailInputCase = '<span id="label-email-newsletter">'.__('Email').' </span>'.html_print_input_text_extended(
$output .= '</div>';
// Show regiter to newsletter state.
$show_newsletter = ($display_newsletter !== true) ? 'inline-block' : 'none';
$output .= '<div class="mrgn_lft_4em">';
$output .= '<div id="box_newsletter">';
$output .= '<span id="label-email-newsletter">'.__('Email').' </span>';
$output .= html_print_input_text_extended(
'email-newsletter', 'email-newsletter',
$email, $email,
'text-email-newsletter', 'text-email-newsletter',
@ -800,52 +804,110 @@ function newsletter_wiz_modal(
255, 255,
false, false,
'', '',
['style' => 'display:'.$show_newsletter.'; width: 200px;'], ['style' => 'display: inline-block; width: 200px;'],
true true
); );
$output .= '</div><br /><br />';
$output .= '<div class="submit_buttons_container">'; // Generate the submit buttons.
$output .= '<div class="left">'; // Cancel Button.
$output .= html_print_submit_button( $submitButtons = html_print_div(
[
'class' => 'left',
'content' => html_print_submit_button(
__('Cancel'), __('Cancel'),
'cancel_newsletter', 'cancel_newsletter',
false, false,
'class="ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel w100px"', 'class="ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel w100px"',
true true
),
],
true
); );
$output .= '</div>';
$output .= '<div class="right">'; // OK Button.
$output .= html_print_submit_button( $submitButtons .= html_print_div(
[
'class' => 'right',
'content' => html_print_submit_button(
__('OK!'), __('OK!'),
'newsletter', 'newsletter',
false, false,
'class="ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next w100px"', 'class="ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next w100px"',
true true
),
],
true
); );
$output .= '</div>';
$output .= '</div>';
$output .= '<div id="both"></div>'; $submitButtonsCase = html_print_div(
$output .= '<br/>'; [
$output .= '</div>'; 'class' => 'submit_buttons_container',
$output .= '</div>'; 'content' => $submitButtons,
],
true
);
$modalContent .= html_print_div(
[
'class' => 'mrgn_lft_4em',
'content' => html_print_div(
[
'id' => 'box_newsletter',
'content' => $emailInputCase.$submitButtonsCase.'<div id="both"></div><br />',
],
true
),
],
true
);
$output .= html_print_div(
[
'id' => 'newsletter_wizard',
'style' => 'display: none;',
'title' => __('Do you want to be up to date?'),
'content' => $modalContent,
],
true
);
// Verification modal. // Verification modal.
$output .= '<div id="news_ensure_cancel" title="Confirmation Required" class="invisible">'; $verificationContent = html_print_div(
$output .= '<div class="font_12_20">'; [
$output .= __('Are you sure you don\'t want to subscribe?'); 'class' => 'font_12_20',
$output .= '<p>'; 'content' => __('Are you sure you don\'t want to subscribe?').'<p>'.__('You will miss all news about amazing features and fixes!').'</p>',
$output .= __('You will miss all news about amazing features and fixes!'); ],
$output .= '</p>'; true
$output .= '</div>'; );
$output .= '</div>';
$output .= html_print_div(
[
'id' => 'news_ensure_cancel',
'style' => 'display: none;',
'title' => 'Confirmation Required',
'content' => $verificationContent,
],
true
);
// Results modal. // Results modal.
$output .= '<div id="news_result" title="Subscription process result" class="invisible">'; $resultsContent = html_print_div(
$output .= '<div id="news_result_content" class="font_12_20">'; [
$output .= '</div>'; 'id' => 'news_result_content',
$output .= '</div>'; 'class' => 'font_12_20',
],
true
);
$output .= html_print_div(
[
'id' => 'news_result',
'style' => 'display: none;',
'title' => 'Subscription process result',
'content' => $resultsContent,
],
true
);
ob_start(); ob_start();
?> ?>