WIP: Backup upload

This commit is contained in:
Jose Gonzalez 2021-02-08 16:33:54 +01:00
parent c828ca2061
commit 2521b32f13
5 changed files with 80 additions and 9 deletions

View File

@ -259,6 +259,7 @@ echo '</form>';
echo '<h3 class="error invisible" id="message"> </h3>'; echo '<h3 class="error invisible" id="message"> </h3>';
ui_require_javascript_file('massive_operations');
ui_require_jquery_file('form'); ui_require_jquery_file('form');
ui_require_jquery_file('pandora.controls'); ui_require_jquery_file('pandora.controls');
?> ?>
@ -276,7 +277,7 @@ $(document).ready (function () {
get_parameters_count + post_parameters_count; get_parameters_count + post_parameters_count;
if (count_parameters > limit_parameters_massive) { if (count_parameters > limit_parameters_massive) {
alert("<?php echo __('Unsucessful sending the data, please contact with your administrator or make with less elements.'); ?>"); showMassiveOperationMessage();
return false; return false;
} }
}); });

View File

@ -1185,6 +1185,7 @@ $table->data['edit1'][1] = '<table width="100%">';
// Hack to translate text "none" in PHP to javascript // Hack to translate text "none" in PHP to javascript
echo '<span id ="none_text" style="display: none;">'.__('None').'</span>'; echo '<span id ="none_text" style="display: none;">'.__('None').'</span>';
echo '<span id ="select_agent_first_text" style="display: none;">'.__('Please, select an agent first').'</span>'; echo '<span id ="select_agent_first_text" style="display: none;">'.__('Please, select an agent first').'</span>';
ui_require_javascript_file('massive_operations');
ui_require_jquery_file('pandora.controls'); ui_require_jquery_file('pandora.controls');
if ($selection_mode == 'modules') { if ($selection_mode == 'modules') {
@ -1213,7 +1214,7 @@ $(document).ready (function () {
get_parameters_count + post_parameters_count; get_parameters_count + post_parameters_count;
if (count_parameters > limit_parameters_massive) { if (count_parameters > limit_parameters_massive) {
alert("<?php echo __('Unsucessful sending the data, please contact with your administrator or make with less elements.'); ?>"); showMassiveOperationMessage('<?php echo __('Unsucessful sending the data, please contact with your administrator or make with less elements.'); ?>');
return false; return false;
} }
}); });

View File

@ -316,11 +316,15 @@ $submit_template_enabled = get_parameter('id_alert_template_enabled');
$submit_template_not_standby = get_parameter('id_alert_template_not_standby'); $submit_template_not_standby = get_parameter('id_alert_template_not_standby');
$submit_template_standby = get_parameter('id_alert_template_standby'); $submit_template_standby = get_parameter('id_alert_template_standby');
$submit_add = get_parameter('crtbutton'); $submit_add = get_parameter('crtbutton');
// Waiting spinner.
echo '<div id="loading" display="none">'; ui_print_spinner(__('Loading'));
echo html_print_image('images/wait.gif', true, ['border' => '0']).'<br />'; // Modal for show messages.
echo '<strong>'.__('Please wait...').'</strong>'; html_print_div(
echo '</div>'; [
'id' => 'massive_modal',
'content' => '',
]
);
?> ?>
<script language="javascript" type="text/javascript"> <script language="javascript" type="text/javascript">
@ -338,12 +342,12 @@ echo '</div>';
confirm_status = confirm_status =
confirm("<?php echo __('Are you sure?'); ?>"); confirm("<?php echo __('Are you sure?'); ?>");
if (confirm_status) if (confirm_status)
$("#loading").css("display", ""); showSpinner();
else else
return false; return false;
}); });
$("#loading").css("display", "none"); hideSpinner();
}); });
</script> </script>

View File

@ -6273,3 +6273,55 @@ function ui_print_reveal_password(string $name, bool $return=false)
echo $output; echo $output;
} }
/**
* Generate a spinner box for waiting times
*
* @param string $text Text for show in spinner. English Loading for default.
* @param boolean $return If true, return the string with the formed element.
*
* @return string
*/
function ui_print_spinner(string $text='Loading', bool $return=false)
{
$output = '';
$output .= '<center>';
$output .= html_print_div(
[
'id' => 'loading_spinner',
'class' => 'white_box invisible',
'content' => '<span style="font-size:25px;">'.$text.'...</span>'.html_print_image(
'images/spinner.gif',
true,
[
'border' => '0',
'width' => '25px',
'heigth' => '25px',
]
),
],
true
);
$output .= '</center>';
$output .= '
<script type="text/javascript">
function hideSpinner() {
document.getElementById("loading_spinner").classList.add("invisible");
}
function showSpinner() {
document.getElementById("loading_spinner").classList.remove("invisible");
}
</script>
';
if ($return === true) {
return $output;
} else {
echo $output;
}
}

View File

@ -792,6 +792,7 @@ p.center {
cursor: help; cursor: help;
} }
/* Legacy spinner */
#loading { #loading {
position: fixed; position: fixed;
width: 200px; width: 200px;
@ -802,6 +803,18 @@ p.center {
padding: 20px; padding: 20px;
} }
/* New standard spinner */
#loading_spinner {
position: fixed;
margin-left: 30%;
text-align: center;
top: 50%;
background-color: #fff;
border: 2px solid #82b92e;
box-shadow: 2px 2px 2px #9dbba1;
padding: 20px;
}
.tactical_set legend { .tactical_set legend {
text-align: left; text-align: left;
color: #3f3f3f; color: #3f3f3f;