Navigation Menu

Skip to content
This repository has been archived by the owner on Mar 19, 2021. It is now read-only.

Commit

Permalink
Restore: Replace alert message with a modal
Browse files Browse the repository at this point in the history
In case there are no backups available for a client,
a modal will be displayed now instead of an alert
message.
  • Loading branch information
fbergkemper committed May 24, 2017
1 parent b32494d commit fa12a0d
Showing 1 changed file with 29 additions and 6 deletions.
35 changes: 29 additions & 6 deletions module/Restore/view/restore/restore/index.phtml
Expand Up @@ -30,12 +30,25 @@ $this->headTitle($title);

<?php if($this->acl_alert) : echo $this->ACLAlert($this->required_commands); elseif(!$this->acl_alert) : ?>

<?php
if(isset($this->errors) && !empty($this->errors)) {
echo '<div class="alert alert-danger" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<strong>Error: </strong>'.$this->errors.'</div>';
}
?>
<!-- modal-001 start -->
<div id="modal-001" class="modal fade modal-001" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
<div class="modal-dialog modal-md">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel"><?php echo $this->translate("Failed to retrieve data from Bareos director"); ?></h4>
</div>
<div class="modal-body">
<p><?php echo $this->translate("Error message received:"); ?></p>
<p class="text-danger"><?php echo $this->errors; ?></p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal"><?php echo $this->translate("Close"); ?></button>
</div>
</div>
</div>
</div>
<!-- modal-001 end -->

<?php if(isset($this->result)) : ?>

Expand Down Expand Up @@ -321,6 +334,16 @@ $this->headTitle($title);
window.location.href = window.location.pathname + '?' + updateRestoreParams('limit', this.value);
});

$(document).ready(function(){

var errors = '<?php echo str_replace(array("\n","\r"), "", $this->errors); ?>';

if(errors != null) {
$("#modal-001").modal();
}

});

</script>

<?php endif; ?>
Expand Down

0 comments on commit fa12a0d

Please sign in to comment.