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

Commit

Permalink
Browse files Browse the repository at this point in the history
Login improvements
If just one director is defined in directors.ini, pre-select it at login.
  • Loading branch information
fbergkemper committed Aug 25, 2015
1 parent 1dfe3e6 commit 5a09907
Show file tree
Hide file tree
Showing 13 changed files with 151 additions and 596 deletions.
4 changes: 1 addition & 3 deletions module/Application/view/layout/error.phtml
Expand Up @@ -32,7 +32,7 @@ echo $this->doctype();

<head>
<meta charset="utf-8">
<?php echo $this->headTitle('Bareos')->setSeparator(' - ')->setAutoEscape(false) ?>
<?php echo $this->headTitle('Bareos','PREPEND')->setSeparator(' - ')->setAutoEscape(false) ?>

<?php echo $this->headMeta()
->appendName('viewport', 'width=device-width, initial-scale=1.0')
Expand All @@ -42,9 +42,7 @@ echo $this->doctype();
<!-- Styles -->
<?php echo $this->headLink(array('rel' => 'shortcut icon', 'type' => 'image/vnd.microsoft.icon', 'href' => $this->basePath() . '/img/favicon.ico'))
->prependStylesheet($this->basePath() . '/css/style.css')
->prependStylesheet($this->basePath() . '/css/bootstrap-theme.min.css')
->prependStylesheet($this->basePath() . '/css/bootstrap.min.css')
->prependStylesheet($this->basePath() . '/css/jquery.jqplot.min.css')
?>

<!-- Scripts -->
Expand Down
13 changes: 3 additions & 10 deletions module/Application/view/layout/install.phtml
Expand Up @@ -32,7 +32,7 @@ echo $this->doctype();

<head>
<meta charset="utf-8">
<?php echo $this->headTitle('Bareos')->setSeparator(' - ')->setAutoEscape(false) ?>
<?php echo $this->headTitle('Bareos','PREPEND')->setSeparator(' - ')->setAutoEscape(false) ?>

<?php echo $this->headMeta()
->appendName('viewport', 'width=device-width, initial-scale=1.0')
Expand All @@ -42,20 +42,13 @@ echo $this->doctype();
<!-- Styles -->
<?php echo $this->headLink(array('rel' => 'shortcut icon', 'type' => 'image/vnd.microsoft.icon', 'href' => $this->basePath() . '/img/favicon.ico'))
->prependStylesheet($this->basePath() . '/css/style.css')
->prependStylesheet($this->basePath() . '/css/bootstrap-theme.min.css')
->prependStylesheet($this->basePath() . '/css/bootstrap.min.css')
->prependStylesheet($this->basePath() . '/css/jquery.jqplot.min.css')
?>

<!-- Scripts -->
<?php echo $this->headScript()
->prependFile($this->basePath() . '/js/bootstrap.min.js')
->prependFile($this->basePath() . '/js/excanvas.min.js')
->prependFile($this->basePath() . '/js/jqplot.pieRenderer.min.js')
->prependFile($this->basePath() . '/js/jqplot.barRenderer.min.js')
->prependFile($this->basePath() . '/js/jqplot.categoryAxisRenderer.min.js')
->prependFile($this->basePath() . '/js/jqplot.pointLabels.min.js')
->prependFile($this->basePath() . '/js/jquery.jqplot.min.js')
->prependFile($this->basePath() . '/js/jquery.min.js')
->prependFile($this->basePath() . '/js/respond.min.js', 'text/javascript', array('conditional' => 'lt IE 9',))
->prependFile($this->basePath() . '/js/html5shiv.js', 'text/javascript', array('conditional' => 'lt IE 9',));
Expand All @@ -64,13 +57,13 @@ echo $this->doctype();
</head>

<body>

<div class="container">

<?php echo $this->content; ?>

<hr />

<footer>
<p class="text-muted">&copy; 2013 - <?php echo date('Y') ?> <a href="http://www.bareos.com/" target="_blank">Bareos GmbH &amp; Co. KG</a>, GNU Affero General Public License Version 3</p>
</footer>
Expand Down
11 changes: 5 additions & 6 deletions module/Application/view/layout/layout.phtml
Expand Up @@ -3,9 +3,9 @@
/**
*
* bareos-webui - Bareos Web-Frontend
*
*
* @link https://github.com/bareos/bareos-webui for the canonical source repository
* @copyright Copyright (c) 2013-2014 Bareos GmbH & Co. KG (http://www.bareos.org/)
* @copyright Copyright (c) 2013-2015 Bareos GmbH & Co. KG (http://www.bareos.org/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
* @author Frank Bergkemper
*
Expand All @@ -24,15 +24,15 @@
*
*/

echo $this->doctype();
echo $this->doctype();

?>

<html lang="en">

<head>
<meta charset="utf-8">
<?php echo $this->headTitle('Bareos')->setSeparator(' - ')->setAutoEscape(false) ?>
<?php echo $this->headTitle('Bareos','PREPEND')->setSeparator(' - ')->setAutoEscape(false) ?>

<?php echo $this->headMeta()
->appendName('viewport', 'width=device-width, initial-scale=1.0')
Expand All @@ -42,8 +42,7 @@ echo $this->doctype();
<!-- Styles -->
<?php echo $this->headLink(array('rel' => 'shortcut icon', 'type' => 'image/vnd.microsoft.icon', 'href' => $this->basePath() . '/img/favicon.ico'))
->prependStylesheet($this->basePath() . '/css/style.css')
->prependStylesheet($this->basePath() . '/css/bootstrap-theme.min.css')
->prependStylesheet($this->basePath() . '/css/bootstrap.min.css')
->prependStylesheet($this->basePath() . '/css/bootstrap.min.css')
->prependStylesheet($this->basePath() . '/css/jquery.jqplot.min.css')
?>

Expand Down
21 changes: 4 additions & 17 deletions module/Application/view/layout/login.phtml
Expand Up @@ -32,7 +32,7 @@ echo $this->doctype();

<head>
<meta charset="utf-8">
<?php echo $this->headTitle('Bareos')->setSeparator(' - ')->setAutoEscape(false) ?>
<?php echo $this->headTitle('Bareos','PREPEND')->setSeparator(' - ')->setAutoEscape(false) ?>

<?php echo $this->headMeta()
->appendName('viewport', 'width=device-width, initial-scale=1.0')
Expand All @@ -42,20 +42,13 @@ echo $this->doctype();
<!-- Styles -->
<?php echo $this->headLink(array('rel' => 'shortcut icon', 'type' => 'image/vnd.microsoft.icon', 'href' => $this->basePath() . '/img/favicon.ico'))
->prependStylesheet($this->basePath() . '/css/style.css')
->prependStylesheet($this->basePath() . '/css/bootstrap-theme.min.css')
->prependStylesheet($this->basePath() . '/css/bootstrap.min.css')
->prependStylesheet($this->basePath() . '/css/jquery.jqplot.min.css')
?>

<!-- Scripts -->
<?php echo $this->headScript()
->prependFile($this->basePath() . '/js/bootstrap.min.js')
->prependFile($this->basePath() . '/js/excanvas.min.js')
->prependFile($this->basePath() . '/js/jqplot.pieRenderer.min.js')
->prependFile($this->basePath() . '/js/jqplot.barRenderer.min.js')
->prependFile($this->basePath() . '/js/jqplot.categoryAxisRenderer.min.js')
->prependFile($this->basePath() . '/js/jqplot.pointLabels.min.js')
->prependFile($this->basePath() . '/js/jquery.jqplot.min.js')
->prependFile($this->basePath() . '/js/jquery.min.js')
->prependFile($this->basePath() . '/js/respond.min.js', 'text/javascript', array('conditional' => 'lt IE 9',))
->prependFile($this->basePath() . '/js/html5shiv.js', 'text/javascript', array('conditional' => 'lt IE 9',));
Expand All @@ -66,15 +59,9 @@ echo $this->doctype();
<body>

<div class="container text-center">

<img src="<?php echo $this->basePath() . '/img/bareos-logo-small.png'; ?>" />

<?php echo $this->content; ?>

<footer>
<p class="text-muted">&copy; 2013 - <?php echo date('Y') ?> <a href="http://www.bareos.com/" target="_blank">Bareos GmbH &amp; Co. KG</a>,<br />GNU Affero General Public License Version 3</p>
</footer>

<img src="<?php echo $this->basePath() . '/img/bareos.png'; ?>" />
<br /><br /><br />
<?php echo $this->content; ?>
</div>

<?php echo $this->inlineScript() ?>
Expand Down
1 change: 0 additions & 1 deletion module/Auth/src/Auth/Controller/AuthController.php
Expand Up @@ -53,7 +53,6 @@ public function loginAction()
$config = $this->getServiceLocator()->get('Config');

$form = new LoginForm($config['directors']);
$form->get('submit')->setValue('Login');

$request = $this->getRequest();

Expand Down
55 changes: 39 additions & 16 deletions module/Auth/src/Auth/Form/LoginForm.php
Expand Up @@ -31,24 +31,47 @@ class LoginForm extends Form
{

protected $config;
protected $directors;

public function __construct($config=null, $name=null)
{

$this->config = $config;
$this->directors = $this->getDirectors();

parent::__construct('login');

$this->add(array(
'name' => 'director',
'type' => 'select',
'options' => array(
'label' => 'Director',
'empty_option' => 'Please choose a director',
'value_options' => $this->getDirectors(),
),
)
);
if(count($this->directors) == 1) {
$this->add(array(
'name' => 'director',
'type' => 'select',
'options' => array(
'label' => 'Director',
'empty_option' => 'Please choose a director',
'value_options' => $this->directors,
),
'attributes' => array(
'id' => 'director',
'value' => key($this->directors)
)
)
);
}
else {
$this->add(array(
'name' => 'director',
'type' => 'select',
'options' => array(
'label' => 'Director',
'empty_option' => 'Please choose a director',
'value_options' => $this->directors,
),
'attributes' => array(
'id' => 'director',
)
)
);
}

$this->add(array(
'name' => 'consolename',
Expand Down Expand Up @@ -76,13 +99,13 @@ public function __construct($config=null, $name=null)

$this->add(array(
'name' => 'submit',
'type' => 'submit',
'attributes' => array(
'value' => 'submit',
'id' => 'submit',
),
'type' => 'submit',
'attributes' => array(
'value' => 'Login',
'id' => 'submit',
),
)
);
);

}

Expand Down
116 changes: 98 additions & 18 deletions module/Auth/view/auth/auth/login.phtml
Expand Up @@ -5,7 +5,7 @@
* bareos-webui - Bareos Web-Frontend
*
* @link https://github.com/bareos/bareos-webui for the canonical source repository
* @copyright Copyright (c) 2013-2014 Bareos GmbH & Co. KG (http://www.bareos.org/)
* @copyright Copyright (c) 2013-2015 Bareos GmbH & Co. KG (http://www.bareos.org/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
* @author Frank Bergkemper
*
Expand All @@ -29,29 +29,109 @@ $this->headTitle($title);

?>

<div class="centered text-centered">
<div class="row">
<div class="col-md-4 col-centered text-centered">
<div class="form-group">

<?php
<!-- Left space -->
<div class="col-md-4">
</div>

$form->prepare();
<!-- Login form -->
<div class="col-md-4">

echo $this->form()->openTag($form);
echo $this->formRow($form->get('director')->setAttribute('class','form-control'));
echo $this->formRow($form->get('consolename')->setAttribute('class','form-control'));
echo $this->formRow($form->get('password')->setAttribute('class','form-control'));
echo $this->formSubmit($form->get('submit')->setAttribute('class','btn btn-primary'));
echo $this->form()->closeTag();
<div class="panel panel-default">
<div class="panel-body">
<div class="container-fluid">

if(isset($this->err_msg)) {
echo "<br /><p class='text-danger bg-danger'>" . $this->err_msg ."</p>";
}
<?php
$form->prepare();
echo $this->form()->openTag($form);
?>

?>
<div class="row centered text-centered">
<div class="col">
<div class="form-group">

<?php
if($this->formElementErrors($form->get('director'))) {
echo '<div class="input-group has-error">';
}
else {
echo '<div class="input-group">';
}
echo '<div class="input-group-addon"><span class="glyphicon glyphicon-log-in" aria-hidden="true"></span></div>';
echo $this->formSelect($form->get('director')->setAttribute('class','form-control'));
echo '</div>';
?>

</div>
</div>
</div>

<div class="row centered text-centered">
<div class="col">
<div class="form-group">

<?php
if($this->formElementErrors($form->get('consolename'))) {
echo '<div class="input-group has-error">';
}
else {
echo '<div class="input-group">';
}
echo '<div class="input-group-addon"><span class="glyphicon glyphicon-user" aria-hidden="true"></span></div>';
echo $this->formInput($form->get('consolename')->setAttribute('class','form-control'));
echo '</div>';
?>

</div>
</div>
</div>

<div class="row centered text-centered">
<div class="col">
<div class="form-group">

<?php
if($this->formElementErrors($form->get('password'))) {
echo '<div class="input-group has-error">';
}
else {
echo '<div class="input-group">';
}
echo '<div class="input-group-addon"><span class="glyphicon glyphicon-lock" aria-hidden="true"></span></div>';
echo $this->formInput($form->get('password')->setAttribute('class','form-control'));
echo '</div>';
?>

</div>
</div>
</div>

<div class="row centered text-centered">
<div class="col">
<div class="form-group">

<?php
echo $this->formSubmit($form->get('submit')->setAttribute('class','btn btn-primary'));
?>

</div>
</div>
</div>

<?php
echo $this->form()->closeTag();
?>

</div>
</div>
</div>

</div>

<!-- Right space -->
<div class="col-md-4">
</div>
</div>
</div>

</diV>

2 changes: 1 addition & 1 deletion module/Job/view/job/job/run.phtml
Expand Up @@ -58,7 +58,7 @@ $this->headTitle($title);
<tr>
<td><?php echo $this->escapeHtml($job['name']); ?></td>
<td class="text-center">
<a href="<?php echo $this->url('job',array('action'=>'queue'),array('query' => array('job' => $job['name']))); ?>" class="btn btn-default btn-sm" role="button"><?php echo $this->translate('Run now'); ?></a></td>
<a href="<?php echo $this->url('job',array('action'=>'queue'),array('query' => array('job' => $job['name']))); ?>" class="btn btn-primary btn-sm" role="button"><?php echo $this->translate('Run now'); ?></a></td>
</tr>
<?php endforeach; ?>

Expand Down

0 comments on commit 5a09907

Please sign in to comment.