Navigation Menu

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

Commit

Permalink
update check: topnavbar alert msg
Browse files Browse the repository at this point in the history
Displays an alert in topnavbar in case the update data
could not be retrieved.
  • Loading branch information
fbergkemper committed Sep 30, 2016
1 parent 48ad9b2 commit d4ee341
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
14 changes: 10 additions & 4 deletions module/Application/src/Application/View/Helper/UpdateAlert.php
Expand Up @@ -32,11 +32,17 @@ class UpdateAlert extends AbstractHelper
protected $value;
protected $result;

public function __invoke($value)
public function __invoke($a=null,$b=null)
{
if($value) {
$this->result = '<a data-toggle="tooltip" data-placement="bottom" href="http://download.bareos.com/" target="_blank"title="Updates available"><span class="glyphicon glyphicon-exclamation-sign text-danger" aria-hidden="true"></span></a>';
return $this->result;
if($a) {
if($b) {
$this->result = '<a data-toggle="tooltip" data-placement="bottom" href="http://download.bareos.com/" target="_blank"title="Updates available"><span class="glyphicon glyphicon-exclamation-sign text-danger" aria-hidden="true"></span></a>';
return $this->result;
}
}
else {
$this->result = '<a data-toggle="tooltip" data-placement="bottom" href="http://download.bareos.com/" target="_blank"title="Update informaton could not be retrieved"><span class="glyphicon glyphicon-exclamation-sign text-danger" aria-hidden="true"></span></a>';
return $this->result;
}
}
}
2 changes: 1 addition & 1 deletion module/Application/view/layout/layout.phtml
Expand Up @@ -81,7 +81,7 @@ echo $this->doctype();
<?php echo $this->navigation('navigation')->menu()->setMinDepth(0)->setMaxDepth(0)->setUlClass('nav navbar-nav'); ?>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<?php echo $this->UpdateAlert($_SESSION['bareos']['dird-update-available']); ?>
<?php echo $this->UpdateAlert($_SESSION['bareos']['product-updates-status'],$_SESSION['bareos']['dird-update-available']); ?>
</li>
<li class="dropdown">
<a href="#"><span class="glyphicon glyphicon-th"></span>&nbsp;<?php echo $_SESSION['bareos']['director']; ?></a>
Expand Down
7 changes: 6 additions & 1 deletion module/Auth/src/Auth/Controller/AuthController.php
Expand Up @@ -86,7 +86,8 @@ public function loginAction()
$_SESSION['bareos']['product-updates'] = $bareos_updates;
$_SESSION['bareos']['dird-update-available'] = false;

if(isset($bareos_updates) && $bareos_updates != NULL) {
if(isset($bareos_updates) && $bareos_updates != false) {
$_SESSION['bareos']['product-updates-status'] = true;
$updates = json_decode($bareos_updates, true);

try {
Expand Down Expand Up @@ -126,6 +127,10 @@ public function loginAction()
}
}
}
else {
// updates could not be retrieved by ajax call
$_SESSION['bareos']['product-updates-status'] = false;
}

// Get the config.
$configuration = $this->getServiceLocator()->get('configuration');
Expand Down

0 comments on commit d4ee341

Please sign in to comment.