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

Commit

Permalink
Restore: Fix modals
Browse files Browse the repository at this point in the history
  • Loading branch information
fbergkemper committed May 31, 2017
1 parent 1715023 commit 862d079
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 19 deletions.
8 changes: 7 additions & 1 deletion module/Restore/src/Restore/Controller/RestoreController.php
Expand Up @@ -88,6 +88,7 @@ public function indexAction()

$this->setRestoreParams();
$errors = null;
$result = null;

if($this->restore_params['client'] == null) {
try {
Expand Down Expand Up @@ -201,7 +202,10 @@ public function indexAction()
$this->bsock->disconnect();

return new ViewModel(array(
'result' => $result
'restore_params' => $this->restore_params,
'form' => $form,
'result' => $result,
'errors' => $errors
));

}
Expand All @@ -212,6 +216,7 @@ public function indexAction()
return new ViewModel(array(
'restore_params' => $this->restore_params,
'form' => $form,
'result' => $result,
'errors' => $errors
));

Expand All @@ -225,6 +230,7 @@ public function indexAction()
return new ViewModel(array(
'restore_params' => $this->restore_params,
'form' => $form,
'result' => $result,
'errors' => $errors
));

Expand Down
48 changes: 30 additions & 18 deletions module/Restore/view/restore/restore/index.phtml
Expand Up @@ -31,16 +31,16 @@ $this->headTitle($title);
<?php if($this->acl_alert) : echo $this->ACLAlert($this->required_commands); elseif(!$this->acl_alert) : ?>

<!-- modal-001 start -->
<div id="modal-001" class="modal fade modal-001" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
<div id="modal-001" class="modal fade modal-001" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel1">
<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>
<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>
Expand All @@ -50,19 +50,26 @@ $this->headTitle($title);
</div>
<!-- modal-001 end -->

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

<div class="row">
<div class="col-md-12">
<pre>
<code>
<?php echo $this->result; ?>
</code>
</pre>
</div>
</div>

<?php elseif(!isset($this->result)) : ?>
<!-- modal-002 start -->
<div id="modal-002" class="modal fade modal-002" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel2">
<div class="modal-dialog modal-lg">
<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("Director message"); ?></h4>
</div>
<div class="modal-body">
<pre><code>
<?php echo $this->result; ?>
</code></pre>
</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-002 end -->

<div class="panel panel-default">
<div class="panel-heading">
Expand Down Expand Up @@ -338,13 +345,18 @@ $this->headTitle($title);

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

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

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

if(result.length > 0) {
$("#modal-002").modal();
}

});

</script>

<?php endif; ?>
<?php endif; ?>

0 comments on commit 862d079

Please sign in to comment.