Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/bareos/bareos-webui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco van Wieringen <marco.van.wieringen@bareos.com>2015-11-18 21:59:36 +0300
committerMarco van Wieringen <marco.van.wieringen@bareos.com>2015-11-19 20:09:31 +0300
commitb4bd8e2068076070f6523cb5e63f9c3271fa5ec7 (patch)
tree22ebece1b81db8b4949cfdfcc74346828c529539
parentcf0f92fee4b612a3f8cc6cdd9450d07cc61f918e (diff)
Tweak layout.
Convert <8spaces> and <tab>==> <3spaces> Remove trailing spaces Use some switches instead of long set of ifs in JS
-rw-r--r--config/application.config.php126
-rw-r--r--config/autoload/global.php244
-rw-r--r--init_autoloader.php44
-rw-r--r--module/Application/Module.php236
-rw-r--r--module/Application/config/module.config.php284
-rw-r--r--module/Application/src/Application/Controller/IndexController.php2
-rw-r--r--module/Application/src/Application/Controller/Plugin/SessionTimeoutPlugin.php28
-rw-r--r--module/Application/src/Application/View/Helper/Bytes.php36
-rw-r--r--module/Application/src/Application/View/Helper/Date.php62
-rw-r--r--module/Application/src/Application/View/Helper/Expiration.php52
-rw-r--r--module/Application/src/Application/View/Helper/HumanReadableTimeperiod.php162
-rw-r--r--module/Application/src/Application/View/Helper/JobDuration.php8
-rw-r--r--module/Application/src/Application/View/Helper/JobLevel.php42
-rw-r--r--module/Application/src/Application/View/Helper/JobStatus.php241
-rw-r--r--module/Application/src/Application/View/Helper/JobType.php96
-rw-r--r--module/Application/src/Application/View/Helper/Retention.php8
-rw-r--r--module/Application/src/Application/View/Helper/StatusGlyphicons.php34
-rw-r--r--module/Application/view/error/404.phtml60
-rw-r--r--module/Application/view/error/index.phtml40
-rw-r--r--module/Application/view/layout/error.phtml46
-rw-r--r--module/Application/view/layout/install.phtml68
-rw-r--r--module/Application/view/layout/json.phtml2
-rw-r--r--module/Application/view/layout/layout.phtml146
-rw-r--r--module/Application/view/layout/login.phtml56
-rw-r--r--module/Application/view/partial/paginator.phtml104
-rw-r--r--module/Auth/Module.php32
-rw-r--r--module/Auth/config/module.config.php56
-rw-r--r--module/Auth/src/Auth/Controller/AuthController.php136
-rw-r--r--module/Auth/src/Auth/Form/LoginForm.php182
-rw-r--r--module/Auth/src/Auth/Model/Auth.php138
-rw-r--r--module/Auth/view/auth/auth/login.phtml176
-rw-r--r--module/Client/Module.php60
-rw-r--r--module/Client/config/module.config.php66
-rw-r--r--module/Client/src/Client/Controller/ClientController.php154
-rw-r--r--module/Client/src/Client/Model/ClientModel.php114
-rw-r--r--module/Client/view/client/client/details.phtml346
-rw-r--r--module/Client/view/client/client/index.phtml102
-rw-r--r--module/Dashboard/Module.php60
-rw-r--r--module/Dashboard/config/module.config.php66
-rw-r--r--module/Dashboard/src/Dashboard/Controller/DashboardController.php154
-rw-r--r--module/Dashboard/src/Dashboard/Model/DashboardModel.php68
-rw-r--r--module/Dashboard/view/dashboard/dashboard/index.phtml164
-rw-r--r--module/Director/Module.php60
-rw-r--r--module/Director/config/module.config.php70
-rw-r--r--module/Director/src/Director/Controller/DirectorController.php138
-rw-r--r--module/Director/src/Director/Model/Director.php4
-rw-r--r--module/Director/src/Director/Model/DirectorModel.php96
-rw-r--r--module/Director/view/director/director/index.phtml12
-rw-r--r--module/Director/view/director/director/messages.phtml10
-rw-r--r--module/Director/view/director/director/schedule.phtml10
-rw-r--r--module/Director/view/director/director/schedulerstatus.phtml10
-rw-r--r--module/Director/view/director/director/version.phtml10
-rw-r--r--module/Fileset/Module.php56
-rw-r--r--module/Fileset/config/module.config.php68
-rw-r--r--module/Fileset/src/Fileset/Controller/FilesetController.php152
-rw-r--r--module/Fileset/src/Fileset/Model/Fileset.php28
-rw-r--r--module/Fileset/src/Fileset/Model/FilesetModel.php68
-rw-r--r--module/Fileset/view/fileset/fileset/details.phtml104
-rw-r--r--module/Fileset/view/fileset/fileset/index.phtml84
-rw-r--r--module/Job/Module.php56
-rw-r--r--module/Job/config/module.config.php66
-rw-r--r--module/Job/src/Job/Controller/JobController.php424
-rw-r--r--module/Job/src/Job/Form/JobForm.php104
-rw-r--r--module/Job/src/Job/Model/JobModel.php292
-rw-r--r--module/Job/view/job/job/cancel.phtml2
-rw-r--r--module/Job/view/job/job/details.phtml820
-rw-r--r--module/Job/view/job/job/index.phtml805
-rw-r--r--module/Job/view/job/job/rerun.phtml2
-rw-r--r--module/Job/view/job/job/run.phtml92
-rw-r--r--module/Job/view/job/job/running.phtml532
-rw-r--r--module/Job/view/job/job/successful.phtml663
-rw-r--r--module/Job/view/job/job/timeline.phtml14
-rw-r--r--module/Job/view/job/job/unsuccessful.phtml559
-rw-r--r--module/Job/view/job/job/waiting.phtml516
-rw-r--r--module/Media/Module.php60
-rw-r--r--module/Media/config/module.config.php66
-rw-r--r--module/Media/src/Media/Controller/MediaController.php146
-rw-r--r--module/Media/src/Media/Model/MediaModel.php68
-rw-r--r--module/Media/view/media/media/details.phtml84
-rw-r--r--module/Media/view/media/media/index.phtml426
-rw-r--r--module/Pool/Module.php60
-rw-r--r--module/Pool/config/module.config.php68
-rw-r--r--module/Pool/src/Pool/Controller/PoolController.php162
-rw-r--r--module/Pool/src/Pool/Model/PoolModel.php94
-rw-r--r--module/Pool/view/pool/pool/details.phtml614
-rw-r--r--module/Pool/view/pool/pool/index.phtml160
-rw-r--r--module/Restore/Module.php62
-rw-r--r--module/Restore/config/module.config.php68
-rw-r--r--module/Restore/src/Restore/Controller/RestoreController.php722
-rw-r--r--module/Restore/src/Restore/Form/RestoreForm.php1090
-rw-r--r--module/Restore/src/Restore/Model/Restore.php420
-rw-r--r--module/Restore/src/Restore/Model/RestoreModel.php354
-rw-r--r--module/Restore/view/restore/restore/filebrowser.phtml4
-rw-r--r--module/Restore/view/restore/restore/index.phtml416
-rw-r--r--module/Storage/Module.php56
-rw-r--r--module/Storage/config/module.config.php66
-rw-r--r--module/Storage/src/Storage/Controller/StorageController.php136
-rw-r--r--module/Storage/src/Storage/Model/StorageModel.php50
-rw-r--r--module/Storage/view/storage/storage/details.phtml2
-rw-r--r--module/Storage/view/storage/storage/index.phtml92
-rw-r--r--public/index.php6
-rw-r--r--tests/Bootstrap.php176
-rw-r--r--tests/ClientTest/Controller/IndexControllerTest.php34
-rw-r--r--tests/ClientTest/Model/ClientTableTest.php40
-rw-r--r--tests/DashboardTest/Controller/IndexControllerTest.php40
-rw-r--r--tests/DirectorTest/Controller/IndexControllerTest.php40
-rw-r--r--tests/FileTest/Controller/IndexControllerTest.php38
-rw-r--r--tests/FileTest/Model/FileTableTest.php40
-rw-r--r--tests/FilesetTest/Controller/IndexControllerTest.php38
-rw-r--r--tests/FilesetTest/Model/FilesetTableTest.php40
-rw-r--r--tests/JobTest/Controller/IndexControllerTest.php42
-rw-r--r--tests/JobTest/Model/JobTableTest.php46
-rw-r--r--tests/LogTest/Controller/IndexControllerTest.php38
-rw-r--r--tests/LogTest/Model/LogTableTest.php36
-rw-r--r--tests/MediaTest/Controller/IndexControllerTest.php40
-rw-r--r--tests/MediaTest/Model/MediaTableTest.php38
-rw-r--r--tests/PoolTest/Controller/IndexControllerTest.php34
-rw-r--r--tests/PoolTest/Model/PoolTableTest.php38
-rw-r--r--tests/RestoreTest/Controller/IndexControllerTest.php40
-rw-r--r--tests/StorageTest/Controller/IndexControllerTest.php42
-rw-r--r--tests/StorageTest/Model/StorageTableTest.php36
-rw-r--r--vendor/Bareos/library/Bareos/BSock/BareosBSock.php1830
-rw-r--r--vendor/Bareos/library/Bareos/BSock/BareosBSockAbstractServiceFactory.php108
-rw-r--r--vendor/Bareos/library/Bareos/BSock/BareosBSockInterface.php80
-rw-r--r--vendor/Bareos/library/Bareos/BSock/BareosBSockServiceFactory.php28
-rw-r--r--vendor/Bareos/library/Bareos/BSock/BareosBase64.php136
126 files changed, 9438 insertions, 9440 deletions
diff --git a/config/application.config.php b/config/application.config.php
index dcf2e9d..288d17b 100644
--- a/config/application.config.php
+++ b/config/application.config.php
@@ -27,24 +27,24 @@ $env = getenv('APPLICATION_ENV') ?: 'production';
// Use the $env value to dtermine which module to load
$modules = array(
- 'Application',
- 'Dashboard',
- 'Director',
- 'Fileset',
- 'Pool',
- 'Media',
- 'Storage',
- 'Client',
- 'Job',
- 'Restore',
- 'Auth',
+ 'Application',
+ 'Dashboard',
+ 'Director',
+ 'Fileset',
+ 'Pool',
+ 'Media',
+ 'Storage',
+ 'Client',
+ 'Job',
+ 'Restore',
+ 'Auth',
);
if($env == 'development') {
- //$modules[] = 'ZendDeveloperTools'; // you may comment only this line out if ZendDeveloperTools are not installed e.g.
- error_reporting(E_ALL);
- ini_set("display_errors", 1);
+ //$modules[] = 'ZendDeveloperTools'; // you may comment only this line out if ZendDeveloperTools are not installed e.g.
+ error_reporting(E_ALL);
+ ini_set("display_errors", 1);
}
return array(
@@ -53,60 +53,60 @@ return array(
// These are various options for the listeners attached to the ModuleManager
'module_listener_options' => array(
- // This should be an array of paths in which modules reside.
- // If a string key is provided, the listener will consider that a module
- // namespace, the value of that key the specific path to that module's
- // Module class.
- 'module_paths' => array(
- './module',
- './vendor',
- ),
-
- // An array of paths from which to glob configuration files after
- // modules are loaded. These effectively override configuration
- // provided by modules themselves. Paths may use GLOB_BRACE notation.
- 'config_glob_paths' => array(
- 'config/autoload/{,*.}{global,local}.php',
- ),
-
- // Whether or not to enable a configuration cache.
- // If enabled, the merged configuration will be cached and used in
- // subsequent requests.
- //'config_cache_enabled' => $booleanValue,
- //'config_cache_enabled' => ($env == 'production'),
-
- // The key used to create the configuration cache file name.
- //'config_cache_key' => $stringKey,
- //'config_cache_key' => 'app_config',
-
- // Whether or not to enable a module class map cache.
- // If enabled, creates a module class map cache which will be used
- // by in future requests, to reduce the autoloading process.
- //'module_map_cache_enabled' => $booleanValue,
- //'module_map_cache_enabled' => ($env == 'production'),
-
- // The key used to create the class map cache file name.
- //'module_map_cache_key' => $stringKey,
- //'module_map_cache_key' => 'module_map',
-
- // The path in which to cache merged configuration.
- //'cache_dir' => $stringPath,
- //'cache_dir' => 'data/config/',
-
- // Whether or not to enable modules dependency checking.
- // Enabled by default, prevents usage of modules that depend on other modules
- // that weren't loaded.
- // 'check_dependencies' => true,
- //'check_dependencies' => ($env != 'production'),
+ // This should be an array of paths in which modules reside.
+ // If a string key is provided, the listener will consider that a module
+ // namespace, the value of that key the specific path to that module's
+ // Module class.
+ 'module_paths' => array(
+ './module',
+ './vendor',
+ ),
+
+ // An array of paths from which to glob configuration files after
+ // modules are loaded. These effectively override configuration
+ // provided by modules themselves. Paths may use GLOB_BRACE notation.
+ 'config_glob_paths' => array(
+ 'config/autoload/{,*.}{global,local}.php',
+ ),
+
+ // Whether or not to enable a configuration cache.
+ // If enabled, the merged configuration will be cached and used in
+ // subsequent requests.
+ //'config_cache_enabled' => $booleanValue,
+ //'config_cache_enabled' => ($env == 'production'),
+
+ // The key used to create the configuration cache file name.
+ //'config_cache_key' => $stringKey,
+ //'config_cache_key' => 'app_config',
+
+ // Whether or not to enable a module class map cache.
+ // If enabled, creates a module class map cache which will be used
+ // by in future requests, to reduce the autoloading process.
+ //'module_map_cache_enabled' => $booleanValue,
+ //'module_map_cache_enabled' => ($env == 'production'),
+
+ // The key used to create the class map cache file name.
+ //'module_map_cache_key' => $stringKey,
+ //'module_map_cache_key' => 'module_map',
+
+ // The path in which to cache merged configuration.
+ //'cache_dir' => $stringPath,
+ //'cache_dir' => 'data/config/',
+
+ // Whether or not to enable modules dependency checking.
+ // Enabled by default, prevents usage of modules that depend on other modules
+ // that weren't loaded.
+ // 'check_dependencies' => true,
+ //'check_dependencies' => ($env != 'production'),
),
// Used to create an own service manager. May contain one or more child arrays.
//'service_listener_options' => array(
// array(
- // 'service_manager' => $stringServiceManagerName,
- // 'config_key' => $stringConfigKey,
- // 'interface' => $stringOptionalInterface,
- // 'method' => $stringRequiredMethodName,
+ // 'service_manager' => $stringServiceManagerName,
+ // 'config_key' => $stringConfigKey,
+ // 'interface' => $stringOptionalInterface,
+ // 'method' => $stringRequiredMethodName,
// ),
// )
diff --git a/config/autoload/global.php b/config/autoload/global.php
index e7ec48d..1a343af 100644
--- a/config/autoload/global.php
+++ b/config/autoload/global.php
@@ -40,139 +40,139 @@ $file = "/etc/bareos-webui/directors.ini";
$config = null;
if(!file_exists($file)) {
- echo "Error: Missing configuration file ".$file.".";
- exit();
+ echo "Error: Missing configuration file ".$file.".";
+ exit();
}
else {
- $config = parse_ini_file($file, true, INI_SCANNER_NORMAL);
+ $config = parse_ini_file($file, true, INI_SCANNER_NORMAL);
}
function read_dir_config($config, $file)
{
- $arr = array();
-
- foreach($config as $instance) {
-
- if(array_key_exists('enabled', $instance) && isset($instance['enabled']) && strtolower($instance['enabled']) == "yes") {
-
- if(array_key_exists('diraddress', $instance) && isset($instance['diraddress'])) {
- $arr[key($config)] = array();
- $arr[key($config)]['host'] = $instance['diraddress'];
- }
- else {
- echo "Error: Missing parameter 'diraddress' in ".$file.", section ".key($config).".";
- exit();
- }
-
- if(array_key_exists('dirport', $instance) && isset($instance['dirport'])) {
- $arr[key($config)]['port'] = $instance['dirport'];
- }
- else {
- $arr[key($config)]['port'] = 9101;
- }
-
- if(array_key_exists('tls_verify_peer', $instance) && isset($instance['tls_verify_peer'])) {
- $arr[key($config)]['tls_verify_peer'] = $instance['tls_verify_peer'];
- }
- else {
- $arr[key($config)]['tls_verify_peer'] = false;
- }
-
- if(array_key_exists('server_can_do_tls', $instance) && isset($instance['server_can_do_tls'])) {
- $arr[key($config)]['server_can_do_tls'] = $instance['server_can_do_tls'];
- }
- else {
- }
-
- if(array_key_exists('server_requires_tls', $instance) && isset($instance['server_requires_tls'])) {
- $arr[key($config)]['server_requires_tls'] = $instance['server_requires_tls'];
- }
- else {
- $arr[key($config)]['server_requires_tls'] = false;
- }
-
- if(array_key_exists('client_can_do_tls', $instance) && isset($instance['client_can_do_tls'])) {
- $arr[key($config)]['client_can_do_tls'] = $instance['client_can_do_tls'];
- }
- else {
- $arr[key($config)]['client_can_do_tls'] = false;
- }
-
- if(array_key_exists('client_requires_tls', $instance) && isset($instance['client_requires_tls'])) {
- $arr[key($config)]['client_requires_tls'] = $instance['client_requires_tls'];
- }
- else {
- $arr[key($config)]['client_requires_tls'] = false;
- }
-
- if(array_key_exists('ca_file', $instance) && isset($instance['ca_file'])) {
- $arr[key($config)]['ca_file'] = $instance['ca_file'];
- }
- else {
- $arr[key($config)]['ca_file'] = "";
- }
-
- if(array_key_exists('cert_file', $instance) && isset($instance['cert_file'])) {
- $arr[key($config)]['cert_file'] = $instance['cert_file'];
- }
- else {
- $arr[key($config)]['cert_file'] = "";
- }
-
- if(array_key_exists('cert_file_passphrase', $instance) && isset($instance['cert_file_passphrase'])) {
- $arr[key($config)]['cert_file_passphrase'] = $instance['cert_file_passphrase'];
- }
- else {
- $arr[key($config)]['cert_file_passphrase'] = "";
- }
-
- if(array_key_exists('allowed_cns', $instance) && isset($instance['allowed_cns'])) {
- $arr[key($config)]['allowed_cns'] = $instance['allowed_cns'];
- }
- else {
- $arr[key($config)]['allowed_cns'] = "";
- }
-
- }
-
- next($config);
-
- }
-
- return $arr;
+ $arr = array();
+
+ foreach($config as $instance) {
+
+ if(array_key_exists('enabled', $instance) && isset($instance['enabled']) && strtolower($instance['enabled']) == "yes") {
+
+ if(array_key_exists('diraddress', $instance) && isset($instance['diraddress'])) {
+ $arr[key($config)] = array();
+ $arr[key($config)]['host'] = $instance['diraddress'];
+ }
+ else {
+ echo "Error: Missing parameter 'diraddress' in ".$file.", section ".key($config).".";
+ exit();
+ }
+
+ if(array_key_exists('dirport', $instance) && isset($instance['dirport'])) {
+ $arr[key($config)]['port'] = $instance['dirport'];
+ }
+ else {
+ $arr[key($config)]['port'] = 9101;
+ }
+
+ if(array_key_exists('tls_verify_peer', $instance) && isset($instance['tls_verify_peer'])) {
+ $arr[key($config)]['tls_verify_peer'] = $instance['tls_verify_peer'];
+ }
+ else {
+ $arr[key($config)]['tls_verify_peer'] = false;
+ }
+
+ if(array_key_exists('server_can_do_tls', $instance) && isset($instance['server_can_do_tls'])) {
+ $arr[key($config)]['server_can_do_tls'] = $instance['server_can_do_tls'];
+ }
+ else {
+ }
+
+ if(array_key_exists('server_requires_tls', $instance) && isset($instance['server_requires_tls'])) {
+ $arr[key($config)]['server_requires_tls'] = $instance['server_requires_tls'];
+ }
+ else {
+ $arr[key($config)]['server_requires_tls'] = false;
+ }
+
+ if(array_key_exists('client_can_do_tls', $instance) && isset($instance['client_can_do_tls'])) {
+ $arr[key($config)]['client_can_do_tls'] = $instance['client_can_do_tls'];
+ }
+ else {
+ $arr[key($config)]['client_can_do_tls'] = false;
+ }
+
+ if(array_key_exists('client_requires_tls', $instance) && isset($instance['client_requires_tls'])) {
+ $arr[key($config)]['client_requires_tls'] = $instance['client_requires_tls'];
+ }
+ else {
+ $arr[key($config)]['client_requires_tls'] = false;
+ }
+
+ if(array_key_exists('ca_file', $instance) && isset($instance['ca_file'])) {
+ $arr[key($config)]['ca_file'] = $instance['ca_file'];
+ }
+ else {
+ $arr[key($config)]['ca_file'] = "";
+ }
+
+ if(array_key_exists('cert_file', $instance) && isset($instance['cert_file'])) {
+ $arr[key($config)]['cert_file'] = $instance['cert_file'];
+ }
+ else {
+ $arr[key($config)]['cert_file'] = "";
+ }
+
+ if(array_key_exists('cert_file_passphrase', $instance) && isset($instance['cert_file_passphrase'])) {
+ $arr[key($config)]['cert_file_passphrase'] = $instance['cert_file_passphrase'];
+ }
+ else {
+ $arr[key($config)]['cert_file_passphrase'] = "";
+ }
+
+ if(array_key_exists('allowed_cns', $instance) && isset($instance['allowed_cns'])) {
+ $arr[key($config)]['allowed_cns'] = $instance['allowed_cns'];
+ }
+ else {
+ $arr[key($config)]['allowed_cns'] = "";
+ }
+
+ }
+
+ next($config);
+
+ }
+
+ return $arr;
}
return array(
- 'directors' => read_dir_config($config, $file),
- 'service_manager' => array(
- 'factories' => array(
- 'Zend\Db\Adapter\Adapter' => 'Zend\Db\Adapter\AdapterServiceFactory',
- ),
- 'abstract_factories' => array(
- // to allow other adapters to be called by $sm->get('adaptername')
- 'Zend\Db\Adapter\AdapterAbstractServiceFactory',
- ),
- ),
- 'session' => array(
- 'config' => array(
- 'class' => 'Zend\Session\Config\SessionConfig',
- 'options' => array(
- 'name' => 'bareos',
- 'use_cookies' => true,
- 'cookie_lifetime' => '3600',
- 'gc_maxlifetime' => '3600',
- 'cache_expire' => 3600,
- 'remember_me_seconds' => 3600,
- 'use_cookies' => true
- ),
- ),
- 'storage' => 'Zend\Session\Storage\SessionArrayStorage',
- 'validators' => array(
- 'Zend\Session\Validator\RemoteAddr',
- 'Zend\Session\Validator\HttpUserAgent',
- ),
+ 'directors' => read_dir_config($config, $file),
+ 'service_manager' => array(
+ 'factories' => array(
+ 'Zend\Db\Adapter\Adapter' => 'Zend\Db\Adapter\AdapterServiceFactory',
+ ),
+ 'abstract_factories' => array(
+ // to allow other adapters to be called by $sm->get('adaptername')
+ 'Zend\Db\Adapter\AdapterAbstractServiceFactory',
+ ),
+ ),
+ 'session' => array(
+ 'config' => array(
+ 'class' => 'Zend\Session\Config\SessionConfig',
+ 'options' => array(
+ 'name' => 'bareos',
+ 'use_cookies' => true,
+ 'cookie_lifetime' => '3600',
+ 'gc_maxlifetime' => '3600',
+ 'cache_expire' => 3600,
+ 'remember_me_seconds' => 3600,
+ 'use_cookies' => true
+ ),
+ ),
+ 'storage' => 'Zend\Session\Storage\SessionArrayStorage',
+ 'validators' => array(
+ 'Zend\Session\Validator\RemoteAddr',
+ 'Zend\Session\Validator\HttpUserAgent',
+ ),
),
);
diff --git a/init_autoloader.php b/init_autoloader.php
index 4d8d7ad..236f4af 100644
--- a/init_autoloader.php
+++ b/init_autoloader.php
@@ -33,38 +33,38 @@ if (is_dir('vendor/ZF2/library')) {
if ($zf2Path) {
if (isset($loader)) {
- $loader->add('Zend', $zf2Path);
+ $loader->add('Zend', $zf2Path);
} else {
- include $zf2Path . '/Zend/Loader/AutoloaderFactory.php';
- Zend\Loader\AutoloaderFactory::factory(array(
- 'Zend\Loader\StandardAutoloader' => array(
- 'autoregister_zf' => true
- )
- ));
+ include $zf2Path . '/Zend/Loader/AutoloaderFactory.php';
+ Zend\Loader\AutoloaderFactory::factory(array(
+ 'Zend\Loader\StandardAutoloader' => array(
+ 'autoregister_zf' => true
+ )
+ ));
}
} else {
// Zend Framework available in normal include path? Use it.
if( stream_resolve_include_path("Zend/Loader/AutoloaderFactory.php") ) {
- include 'Zend/Loader/AutoloaderFactory.php';
- Zend\Loader\AutoloaderFactory::factory(array(
- 'Zend\Loader\StandardAutoloader' => array(
- 'autoregister_zf' => true
- )
- ));
+ include 'Zend/Loader/AutoloaderFactory.php';
+ Zend\Loader\AutoloaderFactory::factory(array(
+ 'Zend\Loader\StandardAutoloader' => array(
+ 'autoregister_zf' => true
+ )
+ ));
}
}
try {
- if (!class_exists('Zend\Loader\AutoloaderFactory')) {
- throw new RuntimeException('
- Unable to load Zend Framework 2.<br /><br />
- Please install Zend Framework 2 package from your distribution repository.<br />
- If Zend Framework 2 is already installed, please set the include_path in your php.ini or<br />
- define a ZF2_PATH environment variable in your apache configuration file and do not forget<br />
- to restart your apache webserver.<br />');
- }
+ if (!class_exists('Zend\Loader\AutoloaderFactory')) {
+ throw new RuntimeException('
+ Unable to load Zend Framework 2.<br /><br />
+ Please install Zend Framework 2 package from your distribution repository.<br />
+ If Zend Framework 2 is already installed, please set the include_path in your php.ini or<br />
+ define a ZF2_PATH environment variable in your apache configuration file and do not forget<br />
+ to restart your apache webserver.<br />');
+ }
}
catch(Exception $e) {
- print $e->getMessage();
+ print $e->getMessage();
}
diff --git a/module/Application/Module.php b/module/Application/Module.php
index a3db5a3..ff5604d 100644
--- a/module/Application/Module.php
+++ b/module/Application/Module.php
@@ -18,133 +18,133 @@ use Bareos\BSock\BareosBsock;
class Module
{
- public function onBootstrap(MvcEvent $e)
- {
- $eventManager = $e->getApplication()->getEventManager();
- $moduleRouteListener = new ModuleRouteListener();
- $moduleRouteListener->attach($eventManager);
- $this->initSession($e);
- }
-
- public function getConfig()
- {
- return include __DIR__ . '/config/module.config.php';
- }
-
- public function getAutoloaderConfig()
- {
- return array(
- 'Zend\Loader\ClassMapAutoloader' => array(
- 'application' => __DIR__ . '/autoload_classmap.php',
- ),
- 'Zend\Loader\StandardAutoloader' => array(
- 'namespaces' => array(
- __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
- 'Bareos' => __DIR__ .'/../../vendor/Bareos/library/Bareos',
- ),
- ),
- );
- }
-
- public function initSession($e)
- {
- $session = $e->getApplication()->getServiceManager()->get('Zend\Session\SessionManager');
- $session->start();
-
- $container = new Container('bareos');
-
- if(!isset($container->init)) {
-
- $serviceManager = $e->getApplication()->getServiceManager();
- $request = $serviceManager->get('Request');
-
- $session->regenerateId(true);
- $container->init = 1;
- $container->remoteAddr = $request->getServer()->get('REMOTE_ADDR');
- $container->httpUserAgent = $request->getServer()->get('HTTP_USER_AGENT');
- $container->username = "";
- $container->authenticated = false;
-
- $config = $serviceManager->get('Config');
-
- if(!isset($config['session'])) {
- return;
- }
-
- $sessionConfig = $config['session'];
-
- if(isset($sessionConfig['validators'])) {
- $chain = $session->getValidatorChain();
- foreach($sessionConfig['validators'] as $validator) {
- switch ($validator) {
- case 'Zend\Session\Validator\HttpUserAgent':
- $validator = new $validator($container->httpUserAgent);
- break;
- case 'Zend\Session\Validator\RemoteAddr':
- $validator = new $validator($container->remoteAddr);
- break;
- default:
- $validator = new $validator();
- }
- $chain->attach('session.validate', array($validator, 'isValid'));
- }
- }
-
- }
-
- }
-
- public function getServiceConfig()
- {
- return array(
- 'factories' => array(
- 'Zend\Session\SessionManager' => function ($sm) {
-
- $config = $sm->get('config');
-
- if (isset($config['session'])) {
-
- $session = $config['session'];
-
- $sessionConfig = null;
-
- if(isset($session['config'])) {
- $class = isset($session['config']['class']) ? $session['config']['class'] : 'Zend\Session\Config\SessionConfig';
- $options = isset($session['config']['options']) ? $session['config']['options'] : array();
- $sessionConfig = new $class();
- $sessionConfig->setOptions($options);
- }
-
- $sessionStorage = null;
-
- if (isset($session['storage'])) {
- $class = $session['storage'];
- $sessionStorage = new $class();
- }
+ public function onBootstrap(MvcEvent $e)
+ {
+ $eventManager = $e->getApplication()->getEventManager();
+ $moduleRouteListener = new ModuleRouteListener();
+ $moduleRouteListener->attach($eventManager);
+ $this->initSession($e);
+ }
+
+ public function getConfig()
+ {
+ return include __DIR__ . '/config/module.config.php';
+ }
+
+ public function getAutoloaderConfig()
+ {
+ return array(
+ 'Zend\Loader\ClassMapAutoloader' => array(
+ 'application' => __DIR__ . '/autoload_classmap.php',
+ ),
+ 'Zend\Loader\StandardAutoloader' => array(
+ 'namespaces' => array(
+ __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
+ 'Bareos' => __DIR__ .'/../../vendor/Bareos/library/Bareos',
+ ),
+ ),
+ );
+ }
+
+ public function initSession($e)
+ {
+ $session = $e->getApplication()->getServiceManager()->get('Zend\Session\SessionManager');
+ $session->start();
+
+ $container = new Container('bareos');
+
+ if(!isset($container->init)) {
+
+ $serviceManager = $e->getApplication()->getServiceManager();
+ $request = $serviceManager->get('Request');
+
+ $session->regenerateId(true);
+ $container->init = 1;
+ $container->remoteAddr = $request->getServer()->get('REMOTE_ADDR');
+ $container->httpUserAgent = $request->getServer()->get('HTTP_USER_AGENT');
+ $container->username = "";
+ $container->authenticated = false;
+
+ $config = $serviceManager->get('Config');
+
+ if(!isset($config['session'])) {
+ return;
+ }
+
+ $sessionConfig = $config['session'];
+
+ if(isset($sessionConfig['validators'])) {
+ $chain = $session->getValidatorChain();
+ foreach($sessionConfig['validators'] as $validator) {
+ switch ($validator) {
+ case 'Zend\Session\Validator\HttpUserAgent':
+ $validator = new $validator($container->httpUserAgent);
+ break;
+ case 'Zend\Session\Validator\RemoteAddr':
+ $validator = new $validator($container->remoteAddr);
+ break;
+ default:
+ $validator = new $validator();
+ }
+ $chain->attach('session.validate', array($validator, 'isValid'));
+ }
+ }
+
+ }
+
+ }
+
+ public function getServiceConfig()
+ {
+ return array(
+ 'factories' => array(
+ 'Zend\Session\SessionManager' => function ($sm) {
+
+ $config = $sm->get('config');
+
+ if (isset($config['session'])) {
+
+ $session = $config['session'];
+
+ $sessionConfig = null;
+
+ if(isset($session['config'])) {
+ $class = isset($session['config']['class']) ? $session['config']['class'] : 'Zend\Session\Config\SessionConfig';
+ $options = isset($session['config']['options']) ? $session['config']['options'] : array();
+ $sessionConfig = new $class();
+ $sessionConfig->setOptions($options);
+ }
+
+ $sessionStorage = null;
+
+ if (isset($session['storage'])) {
+ $class = $session['storage'];
+ $sessionStorage = new $class();
+ }
- $sessionSaveHandler = null;
+ $sessionSaveHandler = null;
- if (isset($session['save_handler'])) {
- // class should be fetched from service manager since it will require constructor arguments
- $sessionSaveHandler = $sm->get($session['save_handler']);
- }
+ if (isset($session['save_handler'])) {
+ // class should be fetched from service manager since it will require constructor arguments
+ $sessionSaveHandler = $sm->get($session['save_handler']);
+ }
- $sessionManager = new SessionManager($sessionConfig, $sessionStorage, $sessionSaveHandler);
+ $sessionManager = new SessionManager($sessionConfig, $sessionStorage, $sessionSaveHandler);
- } else {
- $sessionManager = new SessionManager();
- }
+ } else {
+ $sessionManager = new SessionManager();
+ }
- Container::setDefaultManager($sessionManager);
+ Container::setDefaultManager($sessionManager);
- return $sessionManager;
+ return $sessionManager;
- },
+ },
- ),
+ ),
- );
+ );
- }
+ }
}
diff --git a/module/Application/config/module.config.php b/module/Application/config/module.config.php
index ae0c2b7..32ae59f 100644
--- a/module/Application/config/module.config.php
+++ b/module/Application/config/module.config.php
@@ -9,163 +9,163 @@
return array(
'router' => array(
- 'routes' => array(
- 'home' => array(
- 'type' => 'Zend\Mvc\Router\Http\Literal',
- 'options' => array(
- 'route' => '/',
- 'defaults' => array(
- 'controller' => 'Auth\Controller\Auth',
- 'action' => 'login',
- ),
- ),
- ),
- // The following is a route to simplify getting started creating
- // new controllers and actions without needing to create a new
- // module. Simply drop new controllers in, and you can access them
- // using the path /application/:controller/:action
- 'application' => array(
- 'type' => 'Literal',
- 'options' => array(
- 'route' => '/application',
- 'defaults' => array(
- '__NAMESPACE__' => 'Application\Controller',
- 'controller' => 'Index',
- 'action' => 'index',
- ),
- ),
- 'may_terminate' => true,
- 'child_routes' => array(
- 'default' => array(
- 'type' => 'Segment',
- 'options' => array(
- 'route' => '/[:controller[/:action]]',
- 'constraints' => array(
- 'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
- 'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
- ),
- 'defaults' => array(
- ),
- ),
- ),
- ),
- ),
- ),
+ 'routes' => array(
+ 'home' => array(
+ 'type' => 'Zend\Mvc\Router\Http\Literal',
+ 'options' => array(
+ 'route' => '/',
+ 'defaults' => array(
+ 'controller' => 'Auth\Controller\Auth',
+ 'action' => 'login',
+ ),
+ ),
+ ),
+ // The following is a route to simplify getting started creating
+ // new controllers and actions without needing to create a new
+ // module. Simply drop new controllers in, and you can access them
+ // using the path /application/:controller/:action
+ 'application' => array(
+ 'type' => 'Literal',
+ 'options' => array(
+ 'route' => '/application',
+ 'defaults' => array(
+ '__NAMESPACE__' => 'Application\Controller',
+ 'controller' => 'Index',
+ 'action' => 'index',
+ ),
+ ),
+ 'may_terminate' => true,
+ 'child_routes' => array(
+ 'default' => array(
+ 'type' => 'Segment',
+ 'options' => array(
+ 'route' => '/[:controller[/:action]]',
+ 'constraints' => array(
+ 'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
+ 'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
+ ),
+ 'defaults' => array(
+ ),
+ ),
+ ),
+ ),
+ ),
+ ),
),
'service_manager' => array(
- 'abstract_factories' => array(
- 'Zend\Cache\Service\StorageCacheAbstractServiceFactory',
- 'Zend\Log\LoggerAbstractServiceFactory',
- ),
- 'services' => array(
- ),
- 'shared' => array(
- ),
- 'factories' => array(
- 'translator' => 'Zend\I18n\Translator\TranslatorServiceFactory',
- 'navigation' => 'Zend\Navigation\Service\DefaultNavigationFactory',
- 'director' => 'Bareos\BSock\BareosBSockServiceFactory',
- ),
- 'aliases' => array(
- //'translator' => 'MvcTranslator',
- ),
- 'invokables' => array(
- ),
+ 'abstract_factories' => array(
+ 'Zend\Cache\Service\StorageCacheAbstractServiceFactory',
+ 'Zend\Log\LoggerAbstractServiceFactory',
+ ),
+ 'services' => array(
+ ),
+ 'shared' => array(
+ ),
+ 'factories' => array(
+ 'translator' => 'Zend\I18n\Translator\TranslatorServiceFactory',
+ 'navigation' => 'Zend\Navigation\Service\DefaultNavigationFactory',
+ 'director' => 'Bareos\BSock\BareosBSockServiceFactory',
+ ),
+ 'aliases' => array(
+ //'translator' => 'MvcTranslator',
+ ),
+ 'invokables' => array(
+ ),
),
'translator' => array(
- 'locale' => 'en_US',
- 'translation_file_patterns' => array(
- array(
- 'type' => 'gettext',
- 'base_dir' => __DIR__ . '/../language',
- 'pattern' => '%s.mo',
- ),
- ),
+ 'locale' => 'en_US',
+ 'translation_file_patterns' => array(
+ array(
+ 'type' => 'gettext',
+ 'base_dir' => __DIR__ . '/../language',
+ 'pattern' => '%s.mo',
+ ),
+ ),
),
'controllers' => array(
- 'invokables' => array(
- 'Application\Controller\Index' => 'Application\Controller\IndexController',
- ),
+ 'invokables' => array(
+ 'Application\Controller\Index' => 'Application\Controller\IndexController',
+ ),
),
'view_helpers' => array(
- 'invokables' => array (
- 'printDate' => 'Application\View\Helper\Date',
- 'printJobStatus' => 'Application\View\Helper\JobStatus',
- 'printJobLevel' => 'Application\View\Helper\JobLevel',
- 'printJobType' => 'Application\View\Helper\JobType',
- 'printJobDuration' => 'Application\View\Helper\JobDuration',
- 'printBytes' => 'Application\View\Helper\Bytes',
- 'printRetention' => 'Application\View\Helper\Retention',
- 'printHumanReadableTimeperiod' => 'Application\View\Helper\HumanReadableTimeperiod',
- 'printExpiration' => 'Application\View\Helper\Expiration',
- 'printStatusGlyphicons' => 'Application\View\Helper\StatusGlyphicons',
- ),
+ 'invokables' => array (
+ 'printDate' => 'Application\View\Helper\Date',
+ 'printJobStatus' => 'Application\View\Helper\JobStatus',
+ 'printJobLevel' => 'Application\View\Helper\JobLevel',
+ 'printJobType' => 'Application\View\Helper\JobType',
+ 'printJobDuration' => 'Application\View\Helper\JobDuration',
+ 'printBytes' => 'Application\View\Helper\Bytes',
+ 'printRetention' => 'Application\View\Helper\Retention',
+ 'printHumanReadableTimeperiod' => 'Application\View\Helper\HumanReadableTimeperiod',
+ 'printExpiration' => 'Application\View\Helper\Expiration',
+ 'printStatusGlyphicons' => 'Application\View\Helper\StatusGlyphicons',
+ ),
),
'view_manager' => array(
- 'display_not_found_reason' => true,
- 'display_exceptions' => true,
- 'doctype' => 'HTML5',
- 'not_found_template' => 'error/404',
- 'exception_template' => 'error/index',
- 'template_map' => array(
- 'layout/layout' => __DIR__ . '/../view/layout/layout.phtml',
- 'application/index/index' => __DIR__ . '/../view/application/index/index.phtml',
- 'error/404' => __DIR__ . '/../view/error/404.phtml',
- 'error/index' => __DIR__ . '/../view/error/index.phtml',
- ),
- 'template_path_stack' => array(
- __DIR__ . '/../view',
- ),
- 'strategies' => array(
- 'ViewJsonStrategy',
- ),
+ 'display_not_found_reason' => true,
+ 'display_exceptions' => true,
+ 'doctype' => 'HTML5',
+ 'not_found_template' => 'error/404',
+ 'exception_template' => 'error/index',
+ 'template_map' => array(
+ 'layout/layout' => __DIR__ . '/../view/layout/layout.phtml',
+ 'application/index/index' => __DIR__ . '/../view/application/index/index.phtml',
+ 'error/404' => __DIR__ . '/../view/error/404.phtml',
+ 'error/index' => __DIR__ . '/../view/error/index.phtml',
+ ),
+ 'template_path_stack' => array(
+ __DIR__ . '/../view',
+ ),
+ 'strategies' => array(
+ 'ViewJsonStrategy',
+ ),
),
// Placeholder for console routes
'console' => array(
- 'router' => array(
- 'routes' => array(
- ),
- ),
+ 'router' => array(
+ 'routes' => array(
+ ),
+ ),
),
'navigation' => array(
- 'default' => array(
- array(
- 'label' => 'Dashboard',
- 'route' => 'dashboard',
- ),
- array(
- 'label' => 'Director',
- 'route' => 'director',
- ),
- array(
- 'label' => 'Filesets',
- 'route' => 'fileset',
- ),
- array(
- 'label' => 'Pools',
- 'route' => 'pool',
- ),
- array(
- 'label' => 'Volumes',
- 'route' => 'media',
- ),
- array(
- 'label' => 'Storages',
- 'route' => 'storage',
- ),
- array(
- 'label' => 'Clients',
- 'route' => 'client',
- ),
- array(
- 'label' => 'Jobs',
- 'route' => 'job',
- ),
- array(
- 'label' => 'Restore',
- 'route' => 'restore',
- ),
- ),
+ 'default' => array(
+ array(
+ 'label' => 'Dashboard',
+ 'route' => 'dashboard',
+ ),
+ array(
+ 'label' => 'Director',
+ 'route' => 'director',
+ ),
+ array(
+ 'label' => 'Filesets',
+ 'route' => 'fileset',
+ ),
+ array(
+ 'label' => 'Pools',
+ 'route' => 'pool',
+ ),
+ array(
+ 'label' => 'Volumes',
+ 'route' => 'media',
+ ),
+ array(
+ 'label' => 'Storages',
+ 'route' => 'storage',
+ ),
+ array(
+ 'label' => 'Clients',
+ 'route' => 'client',
+ ),
+ array(
+ 'label' => 'Jobs',
+ 'route' => 'job',
+ ),
+ array(
+ 'label' => 'Restore',
+ 'route' => 'restore',
+ ),
+ ),
),
);
diff --git a/module/Application/src/Application/Controller/IndexController.php b/module/Application/src/Application/Controller/IndexController.php
index 9cf0260..3bb4b20 100644
--- a/module/Application/src/Application/Controller/IndexController.php
+++ b/module/Application/src/Application/Controller/IndexController.php
@@ -17,7 +17,7 @@ class IndexController extends AbstractActionController
public function indexAction()
{
- return new ViewModel();
+ return new ViewModel();
}
diff --git a/module/Application/src/Application/Controller/Plugin/SessionTimeoutPlugin.php b/module/Application/src/Application/Controller/Plugin/SessionTimeoutPlugin.php
index 8d78503..fa27b8a 100644
--- a/module/Application/src/Application/Controller/Plugin/SessionTimeoutPlugin.php
+++ b/module/Application/src/Application/Controller/Plugin/SessionTimeoutPlugin.php
@@ -7,20 +7,20 @@ use Zend\Mvc\Controller\Plugin\AbstractPlugin;
class SessionTimeoutPlugin extends AbstractPlugin
{
- public function timeout()
- {
- // preparation for setting timeout via config file:
- $this->getController()->getServiceLocator()->get('config');
- $timeout = 600;
+ public function timeout()
+ {
+ // preparation for setting timeout via config file:
+ $this->getController()->getServiceLocator()->get('config');
+ $timeout = 600;
- if($_SESSION['bareos']['idletime'] + $timeout > time()) {
- $_SESSION['bareos']['idletime'] = time();
- return true;
- }
- else {
- session_destroy();
- return false;
- }
- }
+ if($_SESSION['bareos']['idletime'] + $timeout > time()) {
+ $_SESSION['bareos']['idletime'] = time();
+ return true;
+ }
+ else {
+ session_destroy();
+ return false;
+ }
+ }
}
diff --git a/module/Application/src/Application/View/Helper/Bytes.php b/module/Application/src/Application/View/Helper/Bytes.php
index 165c22b..d283615 100644
--- a/module/Application/src/Application/View/Helper/Bytes.php
+++ b/module/Application/src/Application/View/Helper/Bytes.php
@@ -3,7 +3,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/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
@@ -28,32 +28,32 @@ namespace Application\View\Helper;
use Zend\View\Helper\AbstractHelper;
/**
- *
+ *
*/
class Bytes extends AbstractHelper
{
- protected $bsize;
+ protected $bsize;
- /**
- * @method
- * @return string
- */
- public function __invoke($bytes)
- {
+ /**
+ * @method
+ * @return string
+ */
+ public function __invoke($bytes)
+ {
- $units = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB');
- $this->bsize = "0.00 B";
+ $units = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB');
+ $this->bsize = "0.00 B";
- if($bytes > 0)
- {
- $result = log($bytes) / log(1000);
- $this->bsize = round(pow(1000, $result - ($tmp = floor($result))), 2)." ".$units[$tmp];
- }
+ if($bytes > 0)
+ {
+ $result = log($bytes) / log(1000);
+ $this->bsize = round(pow(1000, $result - ($tmp = floor($result))), 2)." ".$units[$tmp];
+ }
- return $this->bsize;
+ return $this->bsize;
- }
+ }
}
diff --git a/module/Application/src/Application/View/Helper/Date.php b/module/Application/src/Application/View/Helper/Date.php
index 9e57820..3c178d6 100644
--- a/module/Application/src/Application/View/Helper/Date.php
+++ b/module/Application/src/Application/View/Helper/Date.php
@@ -3,7 +3,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/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
@@ -35,35 +35,35 @@ class Date extends AbstractHelper
public function __invoke($dateString, $mode = 'iso8601')
{
- if ($dateString == '0000-00-00 00:00:00' || $dateString == '') {
- return '-';
- }
-
- switch ($mode) {
- case 'full':
- $dateType = IntlDateFormatter::FULL;
- $timeType = IntlDateFormatter::FULL;
- break;
- case 'long':
- $dateType = IntlDateFormatter::LONG;
- $timeType = IntlDateFormatter::LONG;
- break;
- case 'short':
- $dateType = IntlDateFormatter::SHORT;
- $timeType = IntlDateFormatter::SHORT;
- break;
- case 'medium':
- $dateType = IntlDateFormatter::MEDIUM;
- $timeType = IntlDateFormatter::MEDIUM;
- break;
- default:
- case 'iso8601':
- return $dateString;
- }
-
- $dateTime = new DateTime($dateString);
-
- return $this->getView()->dateFormat($dateTime, $dateType, $timeType);
+ if ($dateString == '0000-00-00 00:00:00' || $dateString == '') {
+ return '-';
+ }
+
+ switch ($mode) {
+ case 'full':
+ $dateType = IntlDateFormatter::FULL;
+ $timeType = IntlDateFormatter::FULL;
+ break;
+ case 'long':
+ $dateType = IntlDateFormatter::LONG;
+ $timeType = IntlDateFormatter::LONG;
+ break;
+ case 'short':
+ $dateType = IntlDateFormatter::SHORT;
+ $timeType = IntlDateFormatter::SHORT;
+ break;
+ case 'medium':
+ $dateType = IntlDateFormatter::MEDIUM;
+ $timeType = IntlDateFormatter::MEDIUM;
+ break;
+ default:
+ case 'iso8601':
+ return $dateString;
+ }
+
+ $dateTime = new DateTime($dateString);
+
+ return $this->getView()->dateFormat($dateTime, $dateType, $timeType);
}
-
+
}
diff --git a/module/Application/src/Application/View/Helper/Expiration.php b/module/Application/src/Application/View/Helper/Expiration.php
index 8503ded..0964586 100644
--- a/module/Application/src/Application/View/Helper/Expiration.php
+++ b/module/Application/src/Application/View/Helper/Expiration.php
@@ -3,7 +3,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/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
@@ -44,35 +44,35 @@ class Expiration extends AbstractHelper
public function __invoke($retention, $lastwritten, $volstatus)
{
- if($volstatus == "Used" || $volstatus == "Full") {
+ if($volstatus == "Used" || $volstatus == "Full") {
- if(empty($lastwritten)) {
- return $this->result = "-";
- }
- else {
+ if(empty($lastwritten)) {
+ return $this->result = "-";
+ }
+ else {
- $this->result = "-";
- $lw = explode(" ", $lastwritten);
- $t1 = explode("-", $lw[0]);
- $t2 = explode("-", date("Y-m-d", time("NOW")));
- $d1 = mktime(0, 0, 0, (int)$t1[1],(int)$t1[2],(int)$t1[0]);
- $d2 = mktime(0, 0, 0, (int)$t2[1],(int)$t2[2],(int)$t2[0]);
- $interval = ($d2 - $d1) / (3600 * 24);
- $retention = round(($retention / 60 / 60 / 24 ), 2, PHP_ROUND_HALF_EVEN);
- $this->result = round(($retention - $interval), 2, PHP_ROUND_HALF_EVEN);
+ $this->result = "-";
+ $lw = explode(" ", $lastwritten);
+ $t1 = explode("-", $lw[0]);
+ $t2 = explode("-", date("Y-m-d", time("NOW")));
+ $d1 = mktime(0, 0, 0, (int)$t1[1],(int)$t1[2],(int)$t1[0]);
+ $d2 = mktime(0, 0, 0, (int)$t2[1],(int)$t2[2],(int)$t2[0]);
+ $interval = ($d2 - $d1) / (3600 * 24);
+ $retention = round(($retention / 60 / 60 / 24 ), 2, PHP_ROUND_HALF_EVEN);
+ $this->result = round(($retention - $interval), 2, PHP_ROUND_HALF_EVEN);
- if($this->result <= 0) {
- return $this->result = "<span class='label label-danger'>expired</span>";
- }
- elseif($this->result > 0) {
- return "<span class='label label-warning'>expires in " . $this->result . " days</span>";
- }
+ if($this->result <= 0) {
+ return $this->result = "<span class='label label-danger'>expired</span>";
+ }
+ elseif($this->result > 0) {
+ return "<span class='label label-warning'>expires in " . $this->result . " days</span>";
+ }
- }
- }
- else {
- return $this->result = round(($retention / 60 / 60 / 24 ), 2, PHP_ROUND_HALF_EVEN) . " days";
- }
+ }
+ }
+ else {
+ return $this->result = round(($retention / 60 / 60 / 24 ), 2, PHP_ROUND_HALF_EVEN) . " days";
+ }
}
diff --git a/module/Application/src/Application/View/Helper/HumanReadableTimeperiod.php b/module/Application/src/Application/View/Helper/HumanReadableTimeperiod.php
index b77642e..00fdba8 100644
--- a/module/Application/src/Application/View/Helper/HumanReadableTimeperiod.php
+++ b/module/Application/src/Application/View/Helper/HumanReadableTimeperiod.php
@@ -45,87 +45,87 @@ class HumanReadableTimeperiod extends AbstractHelper
public function __invoke($time, $format="short")
{
- if($time == "0000-00-00 00:00:00" || empty($time)) {
- return $this->result = "never";
- }
- else {
-
- $this->result = "-";
- $dateTime = date_create($time);
- $timestamp = date_format($dateTime, 'U');
- $seconds = time() - $timestamp;
-
- if($format == "short") {
-
- $units = array(
- 'y' => $seconds / 31556926 % 12,
- 'w' => $seconds / 604800 % 52,
- 'd' => $seconds / 86400 % 7,
- 'h' => $seconds / 3600 % 24,
- 'm' => $seconds / 60 % 60,
- 's' => $seconds % 60
- );
-
- foreach($units as $key => $value) {
- if($value > 0) {
- $res[] = $value . $key;
- }
- }
-
- $this->result = join(' ', $res) . " ago";
-
- }
- elseif($format == "long") {
-
- $units = array(
- 'Year(s)' => $seconds / 31556926 % 12,
- 'Week(s)' => $seconds / 604800 % 52,
- 'Day(s)' => $seconds / 86400 % 7,
- 'Hour(s)' => $seconds / 3600 % 24,
- 'Minute(s)' => $seconds / 60 % 60,
- 'Second(s)' => $seconds % 60
- );
-
- foreach($units as $key => $value) {
- if($value > 0) {
- $res[] = $value . $key;
- }
- }
-
- $this->result = join(' ', $res) . " ago";
-
- }
- elseif($format == "fuzzy") {
-
- $t1 = explode("-", $time);
- $t2 = explode("-", date("Y-m-d", time("NOW")));
-
- $d1 = mktime(0, 0, 0, (int)$t1[1],(int)$t1[2],(int)$t1[0]);
- $d2 = mktime(0, 0, 0, (int)$t2[1],(int)$t2[2],(int)$t2[0]);
-
- $interval = ($d2 - $d1) / (3600 * 24);
-
- if($interval < 1) {
- return $this->result = "today";
- }
- elseif($interval <= 31 && $interval >= 1) {
- $interval = round($interval, 0, PHP_ROUND_HALF_UP);
- $this->result = "about " . $interval . " day(s) ago";
- }
- elseif($interval >= 31 && $interval <= 365) {
- $interval = round($interval / 31, 0, PHP_ROUND_HALF_UP);
- $this->result = "about " . $interval . " month ago";
- }
- elseif($interval > 365) {
- $interval = round($interval / 365, 1, PHP_ROUND_HALF_UP);
- $this->result = "about " . $interval . " year(s) ago";
- }
-
- }
-
- return $this->result;
-
- }
+ if($time == "0000-00-00 00:00:00" || empty($time)) {
+ return $this->result = "never";
+ }
+ else {
+
+ $this->result = "-";
+ $dateTime = date_create($time);
+ $timestamp = date_format($dateTime, 'U');
+ $seconds = time() - $timestamp;
+
+ if($format == "short") {
+
+ $units = array(
+ 'y' => $seconds / 31556926 % 12,
+ 'w' => $seconds / 604800 % 52,
+ 'd' => $seconds / 86400 % 7,
+ 'h' => $seconds / 3600 % 24,
+ 'm' => $seconds / 60 % 60,
+ 's' => $seconds % 60
+ );
+
+ foreach($units as $key => $value) {
+ if($value > 0) {
+ $res[] = $value . $key;
+ }
+ }
+
+ $this->result = join(' ', $res) . " ago";
+
+ }
+ elseif($format == "long") {
+
+ $units = array(
+ 'Year(s)' => $seconds / 31556926 % 12,
+ 'Week(s)' => $seconds / 604800 % 52,
+ 'Day(s)' => $seconds / 86400 % 7,
+ 'Hour(s)' => $seconds / 3600 % 24,
+ 'Minute(s)' => $seconds / 60 % 60,
+ 'Second(s)' => $seconds % 60
+ );
+
+ foreach($units as $key => $value) {
+ if($value > 0) {
+ $res[] = $value . $key;
+ }
+ }
+
+ $this->result = join(' ', $res) . " ago";
+
+ }
+ elseif($format == "fuzzy") {
+
+ $t1 = explode("-", $time);
+ $t2 = explode("-", date("Y-m-d", time("NOW")));
+
+ $d1 = mktime(0, 0, 0, (int)$t1[1],(int)$t1[2],(int)$t1[0]);
+ $d2 = mktime(0, 0, 0, (int)$t2[1],(int)$t2[2],(int)$t2[0]);
+
+ $interval = ($d2 - $d1) / (3600 * 24);
+
+ if($interval < 1) {
+ return $this->result = "today";
+ }
+ elseif($interval <= 31 && $interval >= 1) {
+ $interval = round($interval, 0, PHP_ROUND_HALF_UP);
+ $this->result = "about " . $interval . " day(s) ago";
+ }
+ elseif($interval >= 31 && $interval <= 365) {
+ $interval = round($interval / 31, 0, PHP_ROUND_HALF_UP);
+ $this->result = "about " . $interval . " month ago";
+ }
+ elseif($interval > 365) {
+ $interval = round($interval / 365, 1, PHP_ROUND_HALF_UP);
+ $this->result = "about " . $interval . " year(s) ago";
+ }
+
+ }
+
+ return $this->result;
+
+ }
}
diff --git a/module/Application/src/Application/View/Helper/JobDuration.php b/module/Application/src/Application/View/Helper/JobDuration.php
index 89459df..6faadea 100644
--- a/module/Application/src/Application/View/Helper/JobDuration.php
+++ b/module/Application/src/Application/View/Helper/JobDuration.php
@@ -29,8 +29,8 @@ use Zend\View\Helper\AbstractHelper;
class JobDuration extends AbstractHelper
{
- public function __invoke($duration)
- {
- return $duration;
- }
+ public function __invoke($duration)
+ {
+ return $duration;
+ }
}
diff --git a/module/Application/src/Application/View/Helper/JobLevel.php b/module/Application/src/Application/View/Helper/JobLevel.php
index 787d7f7..8632f4a 100644
--- a/module/Application/src/Application/View/Helper/JobLevel.php
+++ b/module/Application/src/Application/View/Helper/JobLevel.php
@@ -3,7 +3,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/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
@@ -22,7 +22,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-
+
namespace Application\View\Helper;
use Zend\View\Helper\AbstractHelper;
@@ -31,23 +31,23 @@ class JobLevel extends AbstractHelper
{
public function __invoke($jobLevel)
{
- switch($jobLevel)
- {
- case 'I':
- $output = "Incremental";
- break;
- case 'D':
- $output = "Differential";
- break;
- case 'F':
- $output = "Full";
- break;
- default:
- $output = $jobLevel;
- break;
- }
-
- return $output;
-
+ switch($jobLevel)
+ {
+ case 'I':
+ $output = "Incremental";
+ break;
+ case 'D':
+ $output = "Differential";
+ break;
+ case 'F':
+ $output = "Full";
+ break;
+ default:
+ $output = $jobLevel;
+ break;
+ }
+
+ return $output;
+
}
-} \ No newline at end of file
+}
diff --git a/module/Application/src/Application/View/Helper/JobStatus.php b/module/Application/src/Application/View/Helper/JobStatus.php
index 9760b3a..57705bb 100644
--- a/module/Application/src/Application/View/Helper/JobStatus.php
+++ b/module/Application/src/Application/View/Helper/JobStatus.php
@@ -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/)
+ *
+ * @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/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
*
* This program is free software: you can redistribute it and/or modify
@@ -22,131 +22,130 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-
+
namespace Application\View\Helper;
use Zend\View\Helper\AbstractHelper;
class JobStatus extends AbstractHelper
{
+ public function __invoke($jobStatus)
+ {
+
+ switch($jobStatus)
+ {
+ // Non-fatal error
+ case 'e':
+ $output = '<span class="label label-danger">Failure</span>';
+ break;
+ // Terminated with errors
+ case 'E':
+ $output = '<span class="label label-danger">Failure</span>';
+ break;
+ // Fatal error
+ case 'f':
+ $output = '<span class="label label-danger">Failure</span>';
+ break;
+ // Terminated successful
+ case 'T':
+ $output = '<span class="label label-success">Success</span>';
+ break;
+ // Running
+ case 'R':
+ $output = '<span class="label label-info">Running</span>';
+ break;
+ // Created no yet running
+ case 'C':
+ $output = '<span class="label label-default">Queued</span>';
+ break;
+ // Blocked
+ case 'B':
+ $output = '<span class="label label-warning">Blocked</span>';
+ break;
+ // Verify found differences
+ case 'D':
+ $output = '<span class="label label-warning">Verify found differences</span>';
+ break;
+ // Canceled by user
+ case 'A':
+ $output = '<span class="label label-warning">Canceled</span>';
+ break;
+ // Waiting for client
+ case 'F':
+ $output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting for storage daemon
+ case 'S':
+ $output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting for new media
+ case 'm':
+ $output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting for media mount
+ case 'M':
+ $output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting for storage resource
+ case 's':
+ $output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting for job resource
+ case 'j':
+ $output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting for client resource
+ case 'c':
+ $output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting on maximum jobs
+ case 'd':
+ $output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting on starttime
+ case 't':
+ $output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting on higher priority jobs
+ case 'p':
+ $output = '<span class="label label-default">Waiting</span>';
+ break;
+ // SD despooling attributes
+ case 'a':
+ $output = '<span class="label label-info">SD despooling attributes</span>';
+ break;
+ // Doing batch insert file records
+ case 'i':
+ $output = '<span class="label label-info">Doing batch insert file records</span>';
+ break;
+ // Incomplete
+ case 'I':
+ $output = '<span class="label label-primary">Incomplete</span>';
+ break;
+ // Committing data
+ case 'L':
+ $output = '<span class="label label-info">Committing data</span>';
+ break;
+ // Terminated with warnings
+ case 'W':
+ $output = '<span class="label label-warning">Warning</span>';
+ break;
+ // Doing data despooling
+ case 'l':
+ $output = '<span class="label label-info">Doing data despooling</span>';
+ break;
+ // Queued waiting for device
+ case 'q':
+ $output = '<span class="label label-default">Queued waiting for device</span>';
+ break;
+ // Default
+ default:
+ $output = '<span class="label label-primary">' . $jobStatus . '</span>';
+ break;
+ }
- public function __invoke($jobStatus)
- {
+ return $output;
- switch($jobStatus)
- {
- // Non-fatal error
- case 'e':
- $output = '<span class="label label-danger">Failure</span>';
- break;
- // Terminated with errors
- case 'E':
- $output = '<span class="label label-danger">Failure</span>';
- break;
- // Fatal error
- case 'f':
- $output = '<span class="label label-danger">Failure</span>';
- break;
- // Terminated successful
- case 'T':
- $output = '<span class="label label-success">Success</span>';
- break;
- // Running
- case 'R':
- $output = '<span class="label label-info">Running</span>';
- break;
- // Created no yet running
- case 'C':
- $output = '<span class="label label-default">Queued</span>';
- break;
- // Blocked
- case 'B':
- $output = '<span class="label label-warning">Blocked</span>';
- break;
- // Verify found differences
- case 'D':
- $output = '<span class="label label-warning">Verify found differences</span>';
- break;
- // Canceled by user
- case 'A':
- $output = '<span class="label label-warning">Canceled</span>';
- break;
- // Waiting for client
- case 'F':
- $output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting for storage daemon
- case 'S':
- $output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting for new media
- case 'm':
- $output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting for media mount
- case 'M':
- $output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting for storage resource
- case 's':
- $output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting for job resource
- case 'j':
- $output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting for client resource
- case 'c':
- $output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting on maximum jobs
- case 'd':
- $output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting on starttime
- case 't':
- $output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting on higher priority jobs
- case 'p':
- $output = '<span class="label label-default">Waiting</span>';
- break;
- // SD despooling attributes
- case 'a':
- $output = '<span class="label label-info">SD despooling attributes</span>';
- break;
- // Doing batch insert file records
- case 'i':
- $output = '<span class="label label-info">Doing batch insert file records</span>';
- break;
- // Incomplete
- case 'I':
- $output = '<span class="label label-primary">Incomplete</span>';
- break;
- // Committing data
- case 'L':
- $output = '<span class="label label-info">Committing data</span>';
- break;
- // Terminated with warnings
- case 'W':
- $output = '<span class="label label-warning">Warning</span>';
- break;
- // Doing data despooling
- case 'l':
- $output = '<span class="label label-info">Doing data despooling</span>';
- break;
- // Queued waiting for device
- case 'q':
- $output = '<span class="label label-default">Queued waiting for device</span>';
- break;
- // Default
- default:
- $output = '<span class="label label-primary">' . $jobStatus . '</span>';
- break;
- }
-
- return $output;
-
- }
+ }
}
diff --git a/module/Application/src/Application/View/Helper/JobType.php b/module/Application/src/Application/View/Helper/JobType.php
index 6cd5a3d..eab1ac8 100644
--- a/module/Application/src/Application/View/Helper/JobType.php
+++ b/module/Application/src/Application/View/Helper/JobType.php
@@ -3,7 +3,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/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
@@ -29,52 +29,52 @@ use Zend\View\Helper\AbstractHelper;
class JobType extends AbstractHelper
{
- public function __invoke($jobType)
- {
- switch($jobType)
- {
- case 'B':
- $output = "Backup";
- break;
- case 'M':
- $output = "Migrated";
- break;
- case 'V':
- $output = "Verify";
- break;
- case 'R':
- $output = "Restore";
- break;
- case 'U':
- $output = "Console program";
- break;
- case 'I':
- $output = "Internal system job";
- break;
- case 'D':
- $output = "Admin";
- break;
- case 'A':
- $output = "Archive";
- break;
- case 'C':
- $output = "Copy of a Job";
- break;
- case 'c':
- $output = "Copy Job";
- break;
- case 'g':
- $output = "Migration Job";
- break;
- case 'S':
- $output = "Scan";
- break;
- default:
- $output = $jobType;
- break;
- }
-
- return $output;
-
+ public function __invoke($jobType)
+ {
+ switch($jobType)
+ {
+ case 'B':
+ $output = "Backup";
+ break;
+ case 'M':
+ $output = "Migrated";
+ break;
+ case 'V':
+ $output = "Verify";
+ break;
+ case 'R':
+ $output = "Restore";
+ break;
+ case 'U':
+ $output = "Console program";
+ break;
+ case 'I':
+ $output = "Internal system job";
+ break;
+ case 'D':
+ $output = "Admin";
+ break;
+ case 'A':
+ $output = "Archive";
+ break;
+ case 'C':
+ $output = "Copy of a Job";
+ break;
+ case 'c':
+ $output = "Copy Job";
+ break;
+ case 'g':
+ $output = "Migration Job";
+ break;
+ case 'S':
+ $output = "Scan";
+ break;
+ default:
+ $output = $jobType;
+ break;
+ }
+
+ return $output;
+
}
}
diff --git a/module/Application/src/Application/View/Helper/Retention.php b/module/Application/src/Application/View/Helper/Retention.php
index eb8f56c..89ad34a 100644
--- a/module/Application/src/Application/View/Helper/Retention.php
+++ b/module/Application/src/Application/View/Helper/Retention.php
@@ -3,7 +3,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/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
@@ -34,8 +34,8 @@ class Retention extends AbstractHelper
public function __invoke($retention)
{
- $this->retention = (int) $retention;
- $this->retention = round(($this->retention / 60 / 60 / 24 ), 2, PHP_ROUND_HALF_EVEN);
- return $this->retention;
+ $this->retention = (int) $retention;
+ $this->retention = round(($this->retention / 60 / 60 / 24 ), 2, PHP_ROUND_HALF_EVEN);
+ return $this->retention;
}
}
diff --git a/module/Application/src/Application/View/Helper/StatusGlyphicons.php b/module/Application/src/Application/View/Helper/StatusGlyphicons.php
index ccdfd62..6563f19 100644
--- a/module/Application/src/Application/View/Helper/StatusGlyphicons.php
+++ b/module/Application/src/Application/View/Helper/StatusGlyphicons.php
@@ -3,7 +3,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/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
@@ -22,7 +22,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-
+
namespace Application\View\Helper;
use Zend\View\Helper\AbstractHelper;
@@ -32,20 +32,20 @@ class StatusGlyphicons extends AbstractHelper
public function __invoke($status)
{
- switch($status)
- {
- case '0':
- $output = '<div class="text-success"><span class="glyphicon glyphicon-ok"></span></div>';
- break;
- case '-1':
- $output = '<div class="text-danger"><span class="glyphicon glyphicon-remove"></span></div>';
- break;
- default:
- $output = $status;
- break;
- }
-
- return $output;
-
+ switch($status)
+ {
+ case '0':
+ $output = '<div class="text-success"><span class="glyphicon glyphicon-ok"></span></div>';
+ break;
+ case '-1':
+ $output = '<div class="text-danger"><span class="glyphicon glyphicon-remove"></span></div>';
+ break;
+ default:
+ $output = $status;
+ break;
+ }
+
+ return $output;
+
}
}
diff --git a/module/Application/view/error/404.phtml b/module/Application/view/error/404.phtml
index aa63a90..917b726 100644
--- a/module/Application/view/error/404.phtml
+++ b/module/Application/view/error/404.phtml
@@ -9,20 +9,20 @@
$reasonMessage= '';
switch ($this->reason) {
case 'error-controller-cannot-dispatch':
- $reasonMessage = $this->translate('The requested controller was unable to dispatch the request.');
- break;
+ $reasonMessage = $this->translate('The requested controller was unable to dispatch the request.');
+ break;
case 'error-controller-not-found':
- $reasonMessage = $this->translate('The requested controller could not be mapped to an existing controller class.');
- break;
+ $reasonMessage = $this->translate('The requested controller could not be mapped to an existing controller class.');
+ break;
case 'error-controller-invalid':
- $reasonMessage = $this->translate('The requested controller was not dispatchable.');
- break;
+ $reasonMessage = $this->translate('The requested controller was not dispatchable.');
+ break;
case 'error-router-no-match':
- $reasonMessage = $this->translate('The requested URL could not be matched by routing.');
- break;
+ $reasonMessage = $this->translate('The requested URL could not be matched by routing.');
+ break;
default:
- $reasonMessage = $this->translate('We cannot determine at this time why a 404 was generated.');
- break;
+ $reasonMessage = $this->translate('We cannot determine at this time why a 404 was generated.');
+ break;
}
?>
@@ -57,15 +57,15 @@ if (isset($this->controller_class)
<dl>
<dt><?php echo $this->translate('File') ?>:</dt>
<dd>
- <pre class="prettyprint linenums"><?php echo $this->exception->getFile() ?>:<?php echo $this->exception->getLine() ?></pre>
+ <pre class="prettyprint linenums"><?php echo $this->exception->getFile() ?>:<?php echo $this->exception->getLine() ?></pre>
</dd>
<dt><?php echo $this->translate('Message') ?>:</dt>
<dd>
- <pre class="prettyprint linenums"><?php echo $this->exception->getMessage() ?></pre>
+ <pre class="prettyprint linenums"><?php echo $this->exception->getMessage() ?></pre>
</dd>
<dt><?php echo $this->translate('Stack trace') ?>:</dt>
<dd>
- <pre class="prettyprint linenums"><?php echo $this->exception->getTraceAsString() ?></pre>
+ <pre class="prettyprint linenums"><?php echo $this->exception->getTraceAsString() ?></pre>
</dd>
</dl>
<?php
@@ -77,25 +77,25 @@ if (isset($this->controller_class)
<ul class="unstyled">
<?php while($e) : ?>
<li>
- <h3><?php echo get_class($e); ?></h3>
- <dl>
- <dt><?php echo $this->translate('File') ?>:</dt>
- <dd>
- <pre class="prettyprint linenums"><?php echo $e->getFile() ?>:<?php echo $e->getLine() ?></pre>
- </dd>
- <dt><?php echo $this->translate('Message') ?>:</dt>
- <dd>
- <pre class="prettyprint linenums"><?php echo $e->getMessage() ?></pre>
- </dd>
- <dt><?php echo $this->translate('Stack trace') ?>:</dt>
- <dd>
- <pre class="prettyprint linenums"><?php echo $e->getTraceAsString() ?></pre>
- </dd>
- </dl>
+ <h3><?php echo get_class($e); ?></h3>
+ <dl>
+ <dt><?php echo $this->translate('File') ?>:</dt>
+ <dd>
+ <pre class="prettyprint linenums"><?php echo $e->getFile() ?>:<?php echo $e->getLine() ?></pre>
+ </dd>
+ <dt><?php echo $this->translate('Message') ?>:</dt>
+ <dd>
+ <pre class="prettyprint linenums"><?php echo $e->getMessage() ?></pre>
+ </dd>
+ <dt><?php echo $this->translate('Stack trace') ?>:</dt>
+ <dd>
+ <pre class="prettyprint linenums"><?php echo $e->getTraceAsString() ?></pre>
+ </dd>
+ </dl>
</li>
<?php
- $e = $e->getPrevious();
- endwhile;
+ $e = $e->getPrevious();
+ endwhile;
?>
</ul>
<?php endif; ?>
diff --git a/module/Application/view/error/index.phtml b/module/Application/view/error/index.phtml
index 6f7fdb5..f2b1860 100644
--- a/module/Application/view/error/index.phtml
+++ b/module/Application/view/error/index.phtml
@@ -13,15 +13,15 @@
<dl>
<dt><?php echo $this->translate('File') ?>:</dt>
<dd>
- <pre class="prettyprint linenums"><?php echo $this->exception->getFile() ?>:<?php echo $this->exception->getLine() ?></pre>
+ <pre class="prettyprint linenums"><?php echo $this->exception->getFile() ?>:<?php echo $this->exception->getLine() ?></pre>
</dd>
<dt><?php echo $this->translate('Message') ?>:</dt>
<dd>
- <pre class="prettyprint linenums"><?php echo $this->exception->getMessage() ?></pre>
+ <pre class="prettyprint linenums"><?php echo $this->exception->getMessage() ?></pre>
</dd>
<dt><?php echo $this->translate('Stack trace') ?>:</dt>
<dd>
- <pre class="prettyprint linenums"><?php echo $this->exception->getTraceAsString() ?></pre>
+ <pre class="prettyprint linenums"><?php echo $this->exception->getTraceAsString() ?></pre>
</dd>
</dl>
<?php
@@ -33,25 +33,25 @@
<ul class="unstyled">
<?php while($e) : ?>
<li>
- <h3><?php echo get_class($e); ?></h3>
- <dl>
- <dt><?php echo $this->translate('File') ?>:</dt>
- <dd>
- <pre class="prettyprint linenums"><?php echo $e->getFile() ?>:<?php echo $e->getLine() ?></pre>
- </dd>
- <dt><?php echo $this->translate('Message') ?>:</dt>
- <dd>
- <pre class="prettyprint linenums"><?php echo $e->getMessage() ?></pre>
- </dd>
- <dt><?php echo $this->translate('Stack trace') ?>:</dt>
- <dd>
- <pre class="prettyprint linenums"><?php echo $e->getTraceAsString() ?></pre>
- </dd>
- </dl>
+ <h3><?php echo get_class($e); ?></h3>
+ <dl>
+ <dt><?php echo $this->translate('File') ?>:</dt>
+ <dd>
+ <pre class="prettyprint linenums"><?php echo $e->getFile() ?>:<?php echo $e->getLine() ?></pre>
+ </dd>
+ <dt><?php echo $this->translate('Message') ?>:</dt>
+ <dd>
+ <pre class="prettyprint linenums"><?php echo $e->getMessage() ?></pre>
+ </dd>
+ <dt><?php echo $this->translate('Stack trace') ?>:</dt>
+ <dd>
+ <pre class="prettyprint linenums"><?php echo $e->getTraceAsString() ?></pre>
+ </dd>
+ </dl>
</li>
<?php
- $e = $e->getPrevious();
- endwhile;
+ $e = $e->getPrevious();
+ endwhile;
?>
</ul>
<?php endif; ?>
diff --git a/module/Application/view/layout/error.phtml b/module/Application/view/layout/error.phtml
index e0d760a..84cf9df 100644
--- a/module/Application/view/layout/error.phtml
+++ b/module/Application/view/layout/error.phtml
@@ -31,39 +31,39 @@ echo $this->doctype();
<html lang="en">
<head>
- <meta charset="utf-8">
- <?php echo $this->headTitle('Bareos','PREPEND')->setSeparator(' - ')->setAutoEscape(false) ?>
+ <meta charset="utf-8">
+ <?php echo $this->headTitle('Bareos','PREPEND')->setSeparator(' - ')->setAutoEscape(false) ?>
- <?php echo $this->headMeta()
- ->appendName('viewport', 'width=device-width, initial-scale=1.0')
- ->appendHttpEquiv('X-UA-Compatible', 'IE=edge')
- ?>
+ <?php echo $this->headMeta()
+ ->appendName('viewport', 'width=device-width, initial-scale=1.0')
+ ->appendHttpEquiv('X-UA-Compatible', 'IE=edge')
+ ?>
- <!-- 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.min.css')
- ?>
+ <!-- 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.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/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',));
- ?>
+ <!-- Scripts -->
+ <?php echo $this->headScript()
+ ->prependFile($this->basePath() . '/js/bootstrap.min.js')
+ ->prependFile($this->basePath() . '/js/excanvas.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',));
+ ?>
</head>
<body>
- <div class="container">
- <?php echo $this->content; ?>
- </div>
+ <div class="container">
+ <?php echo $this->content; ?>
+ </div>
<?php echo $this->inlineScript() ?>
- </body>
+ </body>
</html>
diff --git a/module/Application/view/layout/install.phtml b/module/Application/view/layout/install.phtml
index 1ce5ca7..9d3fc7d 100644
--- a/module/Application/view/layout/install.phtml
+++ b/module/Application/view/layout/install.phtml
@@ -1,9 +1,9 @@
-<?php
+<?php
/**
*
* 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/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
@@ -24,55 +24,55 @@
*
*/
-echo $this->doctype();
+echo $this->doctype();
?>
<html lang="en">
<head>
- <meta charset="utf-8">
- <?php echo $this->headTitle('Bareos','PREPEND')->setSeparator(' - ')->setAutoEscape(false) ?>
-
- <?php echo $this->headMeta()
- ->appendName('viewport', 'width=device-width, initial-scale=1.0')
- ->appendHttpEquiv('X-UA-Compatible', 'IE=edge')
- ?>
-
- <!-- 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.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/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',));
- ?>
+ <meta charset="utf-8">
+ <?php echo $this->headTitle('Bareos','PREPEND')->setSeparator(' - ')->setAutoEscape(false) ?>
+
+ <?php echo $this->headMeta()
+ ->appendName('viewport', 'width=device-width, initial-scale=1.0')
+ ->appendHttpEquiv('X-UA-Compatible', 'IE=edge')
+ ?>
+
+ <!-- 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.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/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',));
+ ?>
</head>
<body>
- <div class="container">
+ <div class="container">
- <?php echo $this->content; ?>
+ <?php echo $this->content; ?>
- <hr />
+ <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>
+ <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>
- </div>
+ </div>
- <?php echo $this->inlineScript() ?>
+ <?php echo $this->inlineScript() ?>
- </body>
+ </body>
</html>
diff --git a/module/Application/view/layout/json.phtml b/module/Application/view/layout/json.phtml
index b2c3ce0..f78d687 100644
--- a/module/Application/view/layout/json.phtml
+++ b/module/Application/view/layout/json.phtml
@@ -1,3 +1,3 @@
<?php
- echo $this->content;
+ echo $this->content;
?>
diff --git a/module/Application/view/layout/layout.phtml b/module/Application/view/layout/layout.phtml
index c5baa83..ccbe356 100644
--- a/module/Application/view/layout/layout.phtml
+++ b/module/Application/view/layout/layout.phtml
@@ -1,4 +1,4 @@
-<?php
+<?php
/**
*
@@ -31,83 +31,83 @@ echo $this->doctype();
<html lang="en">
<head>
- <meta charset="utf-8">
- <?php echo $this->headTitle($_SESSION['bareos']['director'],'APPEND')->setSeparator(' | ')->setAutoEscape(false) ?>
-
- <?php echo $this->headMeta()
- ->appendName('viewport', 'width=device-width, initial-scale=1.0')
- ->appendHttpEquiv('X-UA-Compatible', 'IE=edge')
- ?>
-
- <!-- 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-select.min.css')
- ->prependStylesheet($this->basePath() . '/css/bootstrap.min.css')
- ?>
-
- <!-- Scripts -->
- <?php echo $this->headScript()
- ->prependFile($this->basePath() . '/js/bootstrap.min.js')
- ->prependFile($this->basePath() . '/js/bootstrap-select.min.js')
- ->prependFile($this->basePath() . '/js/excanvas.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',));
- ?>
+ <meta charset="utf-8">
+ <?php echo $this->headTitle($_SESSION['bareos']['director'],'APPEND')->setSeparator(' | ')->setAutoEscape(false) ?>
+
+ <?php echo $this->headMeta()
+ ->appendName('viewport', 'width=device-width, initial-scale=1.0')
+ ->appendHttpEquiv('X-UA-Compatible', 'IE=edge')
+ ?>
+
+ <!-- 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-select.min.css')
+ ->prependStylesheet($this->basePath() . '/css/bootstrap.min.css')
+ ?>
+
+ <!-- Scripts -->
+ <?php echo $this->headScript()
+ ->prependFile($this->basePath() . '/js/bootstrap.min.js')
+ ->prependFile($this->basePath() . '/js/bootstrap-select.min.js')
+ ->prependFile($this->basePath() . '/js/excanvas.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',));
+ ?>
</head>
<body>
- <nav class="navbar navbar-default navbar-fixed-top" role="navigation">
- <div class="container">
- <div class="navbar-header">
- <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
- <span class="sr-only">Toggle navigation</span>
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
- </button>
- <a href="http://www.bareos.org/" target="_blank"><img src="<?php echo $this->basePath('img/bareos-logo-small.png') ?>" alt="Bareos" /></a>&nbsp;
- </div>
- <div class="collapse navbar-collapse">
- <?php echo $this->navigation('navigation')->menu()->setMinDepth(0)->setMaxDepth(0)->setUlClass('nav navbar-nav'); ?>
- <ul class="nav navbar-nav navbar-right">
- <li class="dropdown">
- <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
- <span class="glyphicon glyphicon-user" aria-hidden="true"></span>
- &nbsp;<?php echo $_SESSION['bareos']['username']; ?> <span class="caret"></span>
- </a>
- <ul class="dropdown-menu" role="menu">
- <li><a href="<?php echo $this->url('auth', array('action' => 'logout')); ?>">Logout</a></li>
- </ul>
- </li>
- </ul>
- </div>
- </div>
- </nav>
-
- <div class="container">
- <?php echo $this->content; ?>
- </div>
-
- <footer class="footer">
- <div class="container">
- <div class="row">
- <div class="col-md-8">
- <p class="text-muted">Bareos WebUI Version 15.2.1 &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>
- </div>
- <div class="col-md-4 text-right">
- <p class="text-muted"><?php echo "Director: " . $_SESSION['bareos']['director']; ?></p>
- </div>
- </div>
- </div>
- </footer>
-
- <?php echo $this->inlineScript() ?>
-
- </body>
+ <nav class="navbar navbar-default navbar-fixed-top" role="navigation">
+ <div class="container">
+ <div class="navbar-header">
+ <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
+ <span class="sr-only">Toggle navigation</span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ </button>
+ <a href="http://www.bareos.org/" target="_blank"><img src="<?php echo $this->basePath('img/bareos-logo-small.png') ?>" alt="Bareos" /></a>&nbsp;
+ </div>
+ <div class="collapse navbar-collapse">
+ <?php echo $this->navigation('navigation')->menu()->setMinDepth(0)->setMaxDepth(0)->setUlClass('nav navbar-nav'); ?>
+ <ul class="nav navbar-nav navbar-right">
+ <li class="dropdown">
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
+ <span class="glyphicon glyphicon-user" aria-hidden="true"></span>
+ &nbsp;<?php echo $_SESSION['bareos']['username']; ?> <span class="caret"></span>
+ </a>
+ <ul class="dropdown-menu" role="menu">
+ <li><a href="<?php echo $this->url('auth', array('action' => 'logout')); ?>">Logout</a></li>
+ </ul>
+ </li>
+ </ul>
+ </div>
+ </div>
+ </nav>
+
+ <div class="container">
+ <?php echo $this->content; ?>
+ </div>
+
+ <footer class="footer">
+ <div class="container">
+ <div class="row">
+ <div class="col-md-8">
+ <p class="text-muted">Bareos WebUI Version 15.2.1 &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>
+ </div>
+ <div class="col-md-4 text-right">
+ <p class="text-muted"><?php echo "Director: " . $_SESSION['bareos']['director']; ?></p>
+ </div>
+ </div>
+ </div>
+ </footer>
+
+ <?php echo $this->inlineScript() ?>
+
+ </body>
</html>
diff --git a/module/Application/view/layout/login.phtml b/module/Application/view/layout/login.phtml
index 7a68a04..63a4e3e 100644
--- a/module/Application/view/layout/login.phtml
+++ b/module/Application/view/layout/login.phtml
@@ -31,44 +31,44 @@ echo $this->doctype();
<html lang="en">
<head>
- <meta charset="utf-8">
- <?php echo $this->headTitle('Bareos','PREPEND')->setSeparator(' - ')->setAutoEscape(false) ?>
+ <meta charset="utf-8">
+ <?php echo $this->headTitle('Bareos','PREPEND')->setSeparator(' - ')->setAutoEscape(false) ?>
- <?php echo $this->headMeta()
- ->appendName('viewport', 'width=device-width, initial-scale=1.0')
- ->appendHttpEquiv('X-UA-Compatible', 'IE=edge')
- ?>
+ <?php echo $this->headMeta()
+ ->appendName('viewport', 'width=device-width, initial-scale=1.0')
+ ->appendHttpEquiv('X-UA-Compatible', 'IE=edge')
+ ?>
- <!-- 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-select.min.css')
- ->prependStylesheet($this->basePath() . '/css/bootstrap.min.css')
- ?>
+ <!-- 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-select.min.css')
+ ->prependStylesheet($this->basePath() . '/css/bootstrap.min.css')
+ ?>
- <!-- Scripts -->
- <?php echo $this->headScript()
- ->prependFile($this->basePath() . '/js/bootstrap.min.js')
- ->prependFile($this->basePath() . '/js/bootstrap-select.min.js')
- ->prependFile($this->basePath() . '/js/excanvas.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',));
- ?>
+ <!-- Scripts -->
+ <?php echo $this->headScript()
+ ->prependFile($this->basePath() . '/js/bootstrap.min.js')
+ ->prependFile($this->basePath() . '/js/bootstrap-select.min.js')
+ ->prependFile($this->basePath() . '/js/excanvas.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',));
+ ?>
</head>
<body>
- <div class="container text-center">
- <img src="<?php echo $this->basePath() . '/img/bareos.png'; ?>" />
- <br /><br /><br />
- <?php echo $this->content; ?>
- </div>
+ <div class="container text-center">
+ <img src="<?php echo $this->basePath() . '/img/bareos.png'; ?>" />
+ <br /><br /><br />
+ <?php echo $this->content; ?>
+ </div>
- <?php echo $this->inlineScript() ?>
+ <?php echo $this->inlineScript() ?>
- </body>
+ </body>
</html>
diff --git a/module/Application/view/partial/paginator.phtml b/module/Application/view/partial/paginator.phtml
index e06f162..9c7ddee 100644
--- a/module/Application/view/partial/paginator.phtml
+++ b/module/Application/view/partial/paginator.phtml
@@ -2,58 +2,58 @@
<div>
- <ul class="pagination">
-
- <!-- previous page link -->
- <?php if(isset($this->previous)): ?>
- <li>
- <a href="<?php echo $this->url($this->route, array(), null, true); ?>?page=<?php echo $this->previous; ?>"><span aria-hidden="true">&laquo;</span></a>
- </li>
- <?php else: ?>
- <li class="disabled">
- <a href="#"><span aria-hidden="true">&laquo;</span></a>
- </li>
- <?php endif; ?>
-
- <!-- first page link -->
- <?php if(isset($this->first)): ?>
- <li>
- <a href="<?php echo $this->url($this->route, array(), null, true); ?>?page=<?php echo $this->first; ?>">first</a>
- </li>
- <?php endif; ?>
-
- <!-- numbered page links -->
- <?php foreach($this->pagesInRange as $page): ?>
- <?php if($page != $this->current): ?>
- <li>
- <a href="<?php echo $this->url($this->route, array(), null, true); ?>?page=<?php echo $page; ?>"><?php echo $page; ?></a>
- </li>
- <?php else: ?>
- <li class="active">
- <a href="#"><?php echo $page; ?></a>
- </li>
- <?php endif; ?>
- <?php endforeach; ?>
-
- <!-- last page link -->
- <?php if(isset($this->last)): ?>
- <li>
- <a href="<?php echo $this->url($this->route, array(), null, true); ?>?page=<?php echo $this->last; ?>">last</a>
- </li>
- <?php endif; ?>
-
- <!-- next page link -->
- <?php if(isset($this->next)): ?>
- <li>
- <a href="<?php echo $this->url($this->route, array(), null, true); ?>?page=<?php echo $this->next; ?>"><span aria-hidden="true">&raquo;</span></a>
- </li>
- <?php else: ?>
- <li class="disabled">
- <a href="#"><span aria-hidden="true">&raquo;</span></a>
- </li>
- <?php endif; ?>
-
- </ul>
+ <ul class="pagination">
+
+ <!-- previous page link -->
+ <?php if(isset($this->previous)): ?>
+ <li>
+ <a href="<?php echo $this->url($this->route, array(), null, true); ?>?page=<?php echo $this->previous; ?>"><span aria-hidden="true">&laquo;</span></a>
+ </li>
+ <?php else: ?>
+ <li class="disabled">
+ <a href="#"><span aria-hidden="true">&laquo;</span></a>
+ </li>
+ <?php endif; ?>
+
+ <!-- first page link -->
+ <?php if(isset($this->first)): ?>
+ <li>
+ <a href="<?php echo $this->url($this->route, array(), null, true); ?>?page=<?php echo $this->first; ?>">first</a>
+ </li>
+ <?php endif; ?>
+
+ <!-- numbered page links -->
+ <?php foreach($this->pagesInRange as $page): ?>
+ <?php if($page != $this->current): ?>
+ <li>
+ <a href="<?php echo $this->url($this->route, array(), null, true); ?>?page=<?php echo $page; ?>"><?php echo $page; ?></a>
+ </li>
+ <?php else: ?>
+ <li class="active">
+ <a href="#"><?php echo $page; ?></a>
+ </li>
+ <?php endif; ?>
+ <?php endforeach; ?>
+
+ <!-- last page link -->
+ <?php if(isset($this->last)): ?>
+ <li>
+ <a href="<?php echo $this->url($this->route, array(), null, true); ?>?page=<?php echo $this->last; ?>">last</a>
+ </li>
+ <?php endif; ?>
+
+ <!-- next page link -->
+ <?php if(isset($this->next)): ?>
+ <li>
+ <a href="<?php echo $this->url($this->route, array(), null, true); ?>?page=<?php echo $this->next; ?>"><span aria-hidden="true">&raquo;</span></a>
+ </li>
+ <?php else: ?>
+ <li class="disabled">
+ <a href="#"><span aria-hidden="true">&raquo;</span></a>
+ </li>
+ <?php endif; ?>
+
+ </ul>
</div>
diff --git a/module/Auth/Module.php b/module/Auth/Module.php
index e31752c..b01bdd3 100644
--- a/module/Auth/Module.php
+++ b/module/Auth/Module.php
@@ -28,23 +28,23 @@ namespace Auth;
class Module
{
- public function getAutoloaderConfig()
- {
- return array(
- 'Zend\Loader\ClassMapAutoloader' => array(
- __DIR__ . '/autoload_classmap.php',
- ),
- 'Zend\Loader\StandardAutoloader' => array(
- 'namespaces' => array(
- __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
- ),
- ),
+ public function getAutoloaderConfig()
+ {
+ return array(
+ 'Zend\Loader\ClassMapAutoloader' => array(
+ __DIR__ . '/autoload_classmap.php',
+ ),
+ 'Zend\Loader\StandardAutoloader' => array(
+ 'namespaces' => array(
+ __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
+ ),
+ ),
);
- }
+ }
- public function getConfig()
- {
- return include __DIR__ . '/config/module.config.php';
- }
+ public function getConfig()
+ {
+ return include __DIR__ . '/config/module.config.php';
+ }
}
diff --git a/module/Auth/config/module.config.php b/module/Auth/config/module.config.php
index db2a4e9..0e01fa6 100644
--- a/module/Auth/config/module.config.php
+++ b/module/Auth/config/module.config.php
@@ -25,35 +25,35 @@
return array(
- 'controllers' => array(
- 'invokables' => array(
- 'Auth\Controller\Auth' => 'Auth\Controller\AuthController',
- ),
- ),
+ 'controllers' => array(
+ 'invokables' => array(
+ 'Auth\Controller\Auth' => 'Auth\Controller\AuthController',
+ ),
+ ),
- 'router' => array(
- 'routes' => array(
- 'auth' => array(
- 'type' => 'segment',
- 'options' => array(
- 'route' => '/auth[/][:action][/:id]',
- 'constraints' => array(
- 'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
- 'id' => '[0-9]+',
- ),
- 'defaults' => array(
- 'controller' => 'Auth\Controller\Auth',
- 'action' => 'index',
- ),
- ),
- ),
- ),
- ),
+ 'router' => array(
+ 'routes' => array(
+ 'auth' => array(
+ 'type' => 'segment',
+ 'options' => array(
+ 'route' => '/auth[/][:action][/:id]',
+ 'constraints' => array(
+ 'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
+ 'id' => '[0-9]+',
+ ),
+ 'defaults' => array(
+ 'controller' => 'Auth\Controller\Auth',
+ 'action' => 'index',
+ ),
+ ),
+ ),
+ ),
+ ),
- 'view_manager' => array(
- 'template_path_stack' => array(
- 'auth' => __DIR__ . '/../view',
- ),
- ),
+ 'view_manager' => array(
+ 'template_path_stack' => array(
+ 'auth' => __DIR__ . '/../view',
+ ),
+ ),
);
diff --git a/module/Auth/src/Auth/Controller/AuthController.php b/module/Auth/src/Auth/Controller/AuthController.php
index 15db6bb..01a389d 100644
--- a/module/Auth/src/Auth/Controller/AuthController.php
+++ b/module/Auth/src/Auth/Controller/AuthController.php
@@ -34,102 +34,102 @@ use Zend\Session\Container;
class AuthController extends AbstractActionController
{
- protected $director;
+ protected $director;
- public function indexAction()
- {
- return new ViewModel();
- }
+ public function indexAction()
+ {
+ return new ViewModel();
+ }
- public function loginAction()
- {
+ public function loginAction()
+ {
- if(isset($_SESSION['bareos']['authenticated']) && $_SESSION['bareos']['authenticated']) {
- return $this->redirect()->toRoute('dashboard', array('action' => 'index'));
- }
+ if(isset($_SESSION['bareos']['authenticated']) && $_SESSION['bareos']['authenticated']) {
+ return $this->redirect()->toRoute('dashboard', array('action' => 'index'));
+ }
- $this->layout('layout/login');
+ $this->layout('layout/login');
- $config = $this->getServiceLocator()->get('Config');
+ $config = $this->getServiceLocator()->get('Config');
- $form = new LoginForm($config['directors']);
+ $form = new LoginForm($config['directors']);
- $request = $this->getRequest();
+ $request = $this->getRequest();
- if($request->isPost()) {
+ if($request->isPost()) {
- $auth = new Auth();
- $form->setInputFilter($auth->getInputFilter());
- $form->setData($request->getPost());
+ $auth = new Auth();
+ $form->setInputFilter($auth->getInputFilter());
+ $form->setData($request->getPost());
- if($form->isValid()) {
+ if($form->isValid()) {
- $director = $form->getInputFilter()->getValue('director');
- $username = $form->getInputFilter()->getValue('consolename');
- $password = $form->getInputFilter()->getValue('password');
+ $director = $form->getInputFilter()->getValue('director');
+ $username = $form->getInputFilter()->getValue('consolename');
+ $password = $form->getInputFilter()->getValue('password');
- $config = $this->getServiceLocator()->get('Config');
- $this->director = $this->getServiceLocator()->get('director');
- $this->director->set_config($config['directors'][$director]);
- $this->director->set_user_credentials($username, $password);
+ $config = $this->getServiceLocator()->get('Config');
+ $this->director = $this->getServiceLocator()->get('director');
+ $this->director->set_config($config['directors'][$director]);
+ $this->director->set_user_credentials($username, $password);
- if($this->director->auth($username, $password)) {
+ if($this->director->auth($username, $password)) {
- $_SESSION['bareos']['director'] = $director;
- $_SESSION['bareos']['username'] = $username;
- $_SESSION['bareos']['password'] = $password;
- $_SESSION['bareos']['authenticated'] = true;
- $_SESSION['bareos']['idletime'] = time();
+ $_SESSION['bareos']['director'] = $director;
+ $_SESSION['bareos']['username'] = $username;
+ $_SESSION['bareos']['password'] = $password;
+ $_SESSION['bareos']['authenticated'] = true;
+ $_SESSION['bareos']['idletime'] = time();
- return $this->redirect()->toRoute('dashboard', array('action' => 'index'));
+ return $this->redirect()->toRoute('dashboard', array('action' => 'index'));
- } else {
+ } else {
- session_destroy();
- $err_msg = "Sorry, can not authenticate. Wrong username and/or password.";
+ session_destroy();
+ $err_msg = "Sorry, can not authenticate. Wrong username and/or password.";
- return new ViewModel(
- array(
- 'form' => $form,
- 'err_msg' => $err_msg,
- )
- );
+ return new ViewModel(
+ array(
+ 'form' => $form,
+ 'err_msg' => $err_msg,
+ )
+ );
- }
+ }
- } else {
+ } else {
- // given credentials in login form could not be validated in this case
- $err_msg = "Please provide a director, username and password.";
+ // given credentials in login form could not be validated in this case
+ $err_msg = "Please provide a director, username and password.";
- session_destroy();
+ session_destroy();
- return new ViewModel(
- array(
- 'form' => $form,
- 'err_msg' => $err_msg,
- )
- );
+ return new ViewModel(
+ array(
+ 'form' => $form,
+ 'err_msg' => $err_msg,
+ )
+ );
- }
+ }
- }
+ }
- return new ViewModel(
- array(
- 'form' => $form,
- )
- );
+ return new ViewModel(
+ array(
+ 'form' => $form,
+ )
+ );
- }
+ }
- public function logoutAction()
- {
- // todo - ask user if he's really wants to log out!
+ public function logoutAction()
+ {
+ // todo - ask user if he's really wants to log out!
- unset($_SESSION['bareos']);
- session_destroy();
- return $this->redirect()->toRoute('auth', array('action' => 'login'));
- }
+ unset($_SESSION['bareos']);
+ session_destroy();
+ return $this->redirect()->toRoute('auth', array('action' => 'login'));
+ }
}
diff --git a/module/Auth/src/Auth/Form/LoginForm.php b/module/Auth/src/Auth/Form/LoginForm.php
index b87f0c5..acfd854 100644
--- a/module/Auth/src/Auth/Form/LoginForm.php
+++ b/module/Auth/src/Auth/Form/LoginForm.php
@@ -30,96 +30,96 @@ use Zend\Form\Form;
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');
-
- 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',
- 'type' => 'text',
- 'options' => array(
- 'label' => 'Username',
- ),
- 'attributes' => array(
- 'placeholder' => 'Username',
- ),
- )
- );
-
- $this->add(array(
- 'name' => 'password',
- 'type' => 'password',
- 'options' => array(
- 'label' => 'Password',
- ),
- 'attributes' => array(
- 'placeholder' => 'Password',
- ),
- )
- );
-
- $this->add(array(
- 'name' => 'submit',
- 'type' => 'submit',
- 'attributes' => array(
- 'value' => 'Login',
- 'id' => 'submit',
- ),
- )
- );
-
- }
-
-
- public function getDirectors()
- {
- $selectData = array();
-
- foreach($this->config as $dird) {
- $selectData[key($this->config)] = key($this->config);
- next($this->config);
- }
-
- return $selectData;
- }
+ protected $config;
+ protected $directors;
+
+ public function __construct($config=null, $name=null)
+ {
+
+ $this->config = $config;
+ $this->directors = $this->getDirectors();
+
+ parent::__construct('login');
+
+ 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',
+ 'type' => 'text',
+ 'options' => array(
+ 'label' => 'Username',
+ ),
+ 'attributes' => array(
+ 'placeholder' => 'Username',
+ ),
+ )
+ );
+
+ $this->add(array(
+ 'name' => 'password',
+ 'type' => 'password',
+ 'options' => array(
+ 'label' => 'Password',
+ ),
+ 'attributes' => array(
+ 'placeholder' => 'Password',
+ ),
+ )
+ );
+
+ $this->add(array(
+ 'name' => 'submit',
+ 'type' => 'submit',
+ 'attributes' => array(
+ 'value' => 'Login',
+ 'id' => 'submit',
+ ),
+ )
+ );
+
+ }
+
+
+ public function getDirectors()
+ {
+ $selectData = array();
+
+ foreach($this->config as $dird) {
+ $selectData[key($this->config)] = key($this->config);
+ next($this->config);
+ }
+
+ return $selectData;
+ }
}
diff --git a/module/Auth/src/Auth/Model/Auth.php b/module/Auth/src/Auth/Model/Auth.php
index 6f756cd..9ae7433 100644
--- a/module/Auth/src/Auth/Model/Auth.php
+++ b/module/Auth/src/Auth/Model/Auth.php
@@ -9,74 +9,74 @@ use Zend\InputFilter\InputFilterInterface;
class Auth implements InputFilterAwareInterface
{
- public $director;
- public $consolename;
- public $password;
-
- protected $inputFilter;
-
- public function setInputFilter(InputFilterInterface $inputFilter)
- {
- throw new \Exception("setInputFilter() not used");
- }
-
- public function getInputFilter()
- {
- if (!$this->inputFilter) {
-
- $inputFilter = new InputFilter();
-
- $inputFilter->add(array(
- 'name' => 'director',
- 'required' => true,
- 'filters' => array(
- array('name' => 'StripTags'),
- array('name' => 'StringTrim'),
- ),
- 'validators' => array(),
- ));
-
- $inputFilter->add(array(
- 'name' => 'consolename',
- 'required' => true,
- 'filters' => array(
- array('name' => 'StripTags'),
- array('name' => 'StringTrim'),
- ),
- 'validators' => array(
- array(
- 'name' => 'StringLength',
- 'options' => array(
- 'encoding' => 'UTF-8',
- 'min' => 1,
- 'max' => 64,
- ),
- ),
- ),
- ));
-
- $inputFilter->add(array(
- 'name' => 'password',
- 'required' => true,
- 'filters' => array(),
- 'validators' => array(
- array(
- 'name' => 'StringLength',
- 'options' => array(
- 'encoding' => 'UTF-8',
- 'min' => 1,
- 'max' => 64,
- ),
- ),
- ),
- ));
-
- $this->inputFilter = $inputFilter;
-
- }
-
- return $this->inputFilter;
-
- }
+ public $director;
+ public $consolename;
+ public $password;
+
+ protected $inputFilter;
+
+ public function setInputFilter(InputFilterInterface $inputFilter)
+ {
+ throw new \Exception("setInputFilter() not used");
+ }
+
+ public function getInputFilter()
+ {
+ if (!$this->inputFilter) {
+
+ $inputFilter = new InputFilter();
+
+ $inputFilter->add(array(
+ 'name' => 'director',
+ 'required' => true,
+ 'filters' => array(
+ array('name' => 'StripTags'),
+ array('name' => 'StringTrim'),
+ ),
+ 'validators' => array(),
+ ));
+
+ $inputFilter->add(array(
+ 'name' => 'consolename',
+ 'required' => true,
+ 'filters' => array(
+ array('name' => 'StripTags'),
+ array('name' => 'StringTrim'),
+ ),
+ 'validators' => array(
+ array(
+ 'name' => 'StringLength',
+ 'options' => array(
+ 'encoding' => 'UTF-8',
+ 'min' => 1,
+ 'max' => 64,
+ ),
+ ),
+ ),
+ ));
+
+ $inputFilter->add(array(
+ 'name' => 'password',
+ 'required' => true,
+ 'filters' => array(),
+ 'validators' => array(
+ array(
+ 'name' => 'StringLength',
+ 'options' => array(
+ 'encoding' => 'UTF-8',
+ 'min' => 1,
+ 'max' => 64,
+ ),
+ ),
+ ),
+ ));
+
+ $this->inputFilter = $inputFilter;
+
+ }
+
+ return $this->inputFilter;
+
+ }
}
diff --git a/module/Auth/view/auth/auth/login.phtml b/module/Auth/view/auth/auth/login.phtml
index 9ebd675..e3b0414 100644
--- a/module/Auth/view/auth/auth/login.phtml
+++ b/module/Auth/view/auth/auth/login.phtml
@@ -38,94 +38,94 @@ $this->headTitle($title);
<!-- Login form -->
<div class="col-md-4">
- <div class="panel panel-default">
- <div class="panel-body">
- <div class="container-fluid">
-
- <?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 selectpicker'));
- 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 class="panel panel-default">
+ <div class="panel-body">
+ <div class="container-fluid">
+
+ <?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 selectpicker'));
+ 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>
diff --git a/module/Client/Module.php b/module/Client/Module.php
index eab858c..a2726e7 100644
--- a/module/Client/Module.php
+++ b/module/Client/Module.php
@@ -8,36 +8,36 @@ use Client\Model\ClientModel;
class Module
{
- public function getAutoloaderConfig()
- {
- return array(
- 'Zend\Loader\ClassMapAutoloader' => array(
- __DIR__ . '/autoload_classmap.php',
- ),
- 'Zend\Loader\StandardAutoloader' => array(
- 'namespaces' => array(
- __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
- ),
- ),
- );
- }
-
- public function getConfig()
- {
- return include __DIR__ . '/config/module.config.php';
- }
-
- public function getServiceConfig()
- {
- return array(
- 'factories' => array(
- 'Client\Model\ClientModel' => function() {
- $model = new ClientModel();
- return $model;
- }
- )
- );
- }
+ public function getAutoloaderConfig()
+ {
+ return array(
+ 'Zend\Loader\ClassMapAutoloader' => array(
+ __DIR__ . '/autoload_classmap.php',
+ ),
+ 'Zend\Loader\StandardAutoloader' => array(
+ 'namespaces' => array(
+ __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
+ ),
+ ),
+ );
+ }
+
+ public function getConfig()
+ {
+ return include __DIR__ . '/config/module.config.php';
+ }
+
+ public function getServiceConfig()
+ {
+ return array(
+ 'factories' => array(
+ 'Client\Model\ClientModel' => function() {
+ $model = new ClientModel();
+ return $model;
+ }
+ )
+ );
+ }
}
diff --git a/module/Client/config/module.config.php b/module/Client/config/module.config.php
index d399a95..829cad0 100644
--- a/module/Client/config/module.config.php
+++ b/module/Client/config/module.config.php
@@ -25,39 +25,39 @@
return array(
- 'controllers' => array(
- 'invokables' => array(
- 'Client\Controller\Client' => 'Client\Controller\ClientController',
- ),
- ),
- 'controller_plugins' => array(
- 'invokables' => array(
- 'SessionTimeoutPlugin' => 'Application\Controller\Plugin\SessionTimeoutPlugin',
- ),
- ),
- 'router' => array(
- 'routes' => array(
- 'client' => array(
- 'type' => 'segment',
- 'options' => array(
- 'route' => '/client[/][:action][/][:id]',
- 'constraints' => array(
- 'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
- 'id' => '[a-zA-Z][a-zA-Z0-9_-]*',
- ),
- 'defaults' => array(
- 'controller' => 'Client\Controller\Client',
- 'action' => 'index',
- ),
- ),
- ),
- ),
- ),
+ 'controllers' => array(
+ 'invokables' => array(
+ 'Client\Controller\Client' => 'Client\Controller\ClientController',
+ ),
+ ),
+ 'controller_plugins' => array(
+ 'invokables' => array(
+ 'SessionTimeoutPlugin' => 'Application\Controller\Plugin\SessionTimeoutPlugin',
+ ),
+ ),
+ 'router' => array(
+ 'routes' => array(
+ 'client' => array(
+ 'type' => 'segment',
+ 'options' => array(
+ 'route' => '/client[/][:action][/][:id]',
+ 'constraints' => array(
+ 'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
+ 'id' => '[a-zA-Z][a-zA-Z0-9_-]*',
+ ),
+ 'defaults' => array(
+ 'controller' => 'Client\Controller\Client',
+ 'action' => 'index',
+ ),
+ ),
+ ),
+ ),
+ ),
- 'view_manager' => array(
- 'template_path_stack' => array(
- 'client' => __DIR__ . '/../view',
- ),
- ),
+ 'view_manager' => array(
+ 'template_path_stack' => array(
+ 'client' => __DIR__ . '/../view',
+ ),
+ ),
);
diff --git a/module/Client/src/Client/Controller/ClientController.php b/module/Client/src/Client/Controller/ClientController.php
index a81ee3f..8e81663 100644
--- a/module/Client/src/Client/Controller/ClientController.php
+++ b/module/Client/src/Client/Controller/ClientController.php
@@ -32,82 +32,82 @@ use Zend\Json\Json;
class ClientController extends AbstractActionController
{
- protected $clientModel;
-
- public function indexAction()
- {
- if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
-
- $clients = $this->getClientModel()->getClients();
-
- return new ViewModel(
- array(
- 'clients' => $clients,
- )
- );
- }
- else {
- return $this->redirect()->toRoute('auth', array('action' => 'login'));
- }
- }
-
- public function detailsAction()
- {
- if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
-
- return new ViewModel(
- array(
- 'client' => $this->params()->fromRoute('id')
- )
- );
-
- }
- else {
- return $this->redirect()->toRoute('auth', array('action' => 'login'));
- }
- }
-
- public function getDataAction()
- {
- if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
-
- $data = $this->params()->fromQuery('data');
- $client = $this->params()->fromQuery('client');
-
- if($data == "all") {
- $result = $this->getClientModel()->getClients();
- }
- elseif($data == "details" && isset($client)) {
- $result = $this->getClientModel()->getClient($client);
- }
- elseif($data == "backups" && isset($client)) {
- $result = $this->getClientModel()->getClientBackups($client, null, 'desc');
- }
- else {
- $result = null;
- }
-
- $response = $this->getResponse();
- $response->getHeaders()->addHeaderLine('Content-Type', 'application/json');
-
- if(isset($result)) {
- $response->setContent(JSON::encode($result));
- }
-
- return $response;
- }
- else {
- return $this->redirect()->toRoute('auth', array('action' => 'login'));
- }
- }
-
- public function getClientModel()
- {
- if(!$this->clientModel) {
- $sm = $this->getServiceLocator();
- $this->clientModel = $sm->get('Client\Model\ClientModel');
- }
- return $this->clientModel;
- }
+ protected $clientModel;
+
+ public function indexAction()
+ {
+ if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
+
+ $clients = $this->getClientModel()->getClients();
+
+ return new ViewModel(
+ array(
+ 'clients' => $clients,
+ )
+ );
+ }
+ else {
+ return $this->redirect()->toRoute('auth', array('action' => 'login'));
+ }
+ }
+
+ public function detailsAction()
+ {
+ if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
+
+ return new ViewModel(
+ array(
+ 'client' => $this->params()->fromRoute('id')
+ )
+ );
+
+ }
+ else {
+ return $this->redirect()->toRoute('auth', array('action' => 'login'));
+ }
+ }
+
+ public function getDataAction()
+ {
+ if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
+
+ $data = $this->params()->fromQuery('data');
+ $client = $this->params()->fromQuery('client');
+
+ if($data == "all") {
+ $result = $this->getClientModel()->getClients();
+ }
+ elseif($data == "details" && isset($client)) {
+ $result = $this->getClientModel()->getClient($client);
+ }
+ elseif($data == "backups" && isset($client)) {
+ $result = $this->getClientModel()->getClientBackups($client, null, 'desc');
+ }
+ else {
+ $result = null;
+ }
+
+ $response = $this->getResponse();
+ $response->getHeaders()->addHeaderLine('Content-Type', 'application/json');
+
+ if(isset($result)) {
+ $response->setContent(JSON::encode($result));
+ }
+
+ return $response;
+ }
+ else {
+ return $this->redirect()->toRoute('auth', array('action' => 'login'));
+ }
+ }
+
+ public function getClientModel()
+ {
+ if(!$this->clientModel) {
+ $sm = $this->getServiceLocator();
+ $this->clientModel = $sm->get('Client\Model\ClientModel');
+ }
+ return $this->clientModel;
+ }
}
diff --git a/module/Client/src/Client/Model/ClientModel.php b/module/Client/src/Client/Model/ClientModel.php
index 42eb306..2bdad08 100644
--- a/module/Client/src/Client/Model/ClientModel.php
+++ b/module/Client/src/Client/Model/ClientModel.php
@@ -30,68 +30,68 @@ use Zend\ServiceManager\ServiceLocatorInterface;
class ClientModel implements ServiceLocatorAwareInterface
{
- protected $serviceLocator;
- protected $director;
+ protected $serviceLocator;
+ protected $director;
- public function __construct()
- {
- }
+ public function __construct()
+ {
+ }
- public function setServiceLocator(ServiceLocatorInterface $serviceLocator)
- {
- $this->serviceLocator = $serviceLocator;
- }
+ public function setServiceLocator(ServiceLocatorInterface $serviceLocator)
+ {
+ $this->serviceLocator = $serviceLocator;
+ }
- public function getServiceLocator()
- {
- return $this->serviceLocator;
- }
+ public function getServiceLocator()
+ {
+ return $this->serviceLocator;
+ }
- public function getClients()
- {
- $cmd = 'llist clients';
- $this->director = $this->getServiceLocator()->get('director');
- $result = $this->director->send_command($cmd, 2, null);
- $clients = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
- return $clients['result']['clients'];
- }
+ public function getClients()
+ {
+ $cmd = 'llist clients';
+ $this->director = $this->getServiceLocator()->get('director');
+ $result = $this->director->send_command($cmd, 2, null);
+ $clients = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
+ return $clients['result']['clients'];
+ }
- public function getClient($client=null)
- {
- if(isset($client)) {
- $cmd = 'llist client="'.$client.'"';
- $this->director = $this->getServiceLocator()->get('director');
- $result = $this->director->send_command($cmd, 2, null);
- $client = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
- return $client['result']['clients'];
- }
- else {
- return false;
- }
- }
+ public function getClient($client=null)
+ {
+ if(isset($client)) {
+ $cmd = 'llist client="'.$client.'"';
+ $this->director = $this->getServiceLocator()->get('director');
+ $result = $this->director->send_command($cmd, 2, null);
+ $client = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
+ return $client['result']['clients'];
+ }
+ else {
+ return false;
+ }
+ }
- public function getClientBackups($client=null, $limit=null, $order=null)
- {
- if(isset($client)) {
- if(isset($limit, $order)) {
- $cmd = 'llist backups client="'.$client.'" limit='.$limit.' order='.$order.'';
- }
- else {
- $cmd = 'llist backups client="'.$client.'"';
- }
- $this->director = $this->getServiceLocator()->get('director');
- $result = $this->director->send_command($cmd, 2, null);
- if(preg_match("/Select/", $result)) {
- return null;
- }
- else {
- $backups = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
- return $backups['result']['backups'];
- }
- }
- else {
- return false;
- }
- }
+ public function getClientBackups($client=null, $limit=null, $order=null)
+ {
+ if(isset($client)) {
+ if(isset($limit, $order)) {
+ $cmd = 'llist backups client="'.$client.'" limit='.$limit.' order='.$order.'';
+ }
+ else {
+ $cmd = 'llist backups client="'.$client.'"';
+ }
+ $this->director = $this->getServiceLocator()->get('director');
+ $result = $this->director->send_command($cmd, 2, null);
+ if(preg_match("/Select/", $result)) {
+ return null;
+ }
+ else {
+ $backups = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
+ return $backups['result']['backups'];
+ }
+ }
+ else {
+ return false;
+ }
+ }
}
diff --git a/module/Client/view/client/client/details.phtml b/module/Client/view/client/client/details.phtml
index 4e5a8c8..c3f589b 100644
--- a/module/Client/view/client/client/details.phtml
+++ b/module/Client/view/client/client/details.phtml
@@ -41,12 +41,12 @@ $this->headTitle($title);
<table class="table table-hover" id="tab-client">
<thead class="bg-primary">
- <th><?php echo $this->translate("Name"); ?></th>
- <th><?php echo $this->translate("Version"); ?></th>
- <th><?php echo $this->translate("Autoprune"); ?></th>
- <th><?php echo $this->translate("Fileretention"); ?></th>
- <th><?php echo $this->translate("Jobretention"); ?></th>
- <th><?php echo $this->translate("Actions"); ?></th>
+ <th><?php echo $this->translate("Name"); ?></th>
+ <th><?php echo $this->translate("Version"); ?></th>
+ <th><?php echo $this->translate("Autoprune"); ?></th>
+ <th><?php echo $this->translate("Fileretention"); ?></th>
+ <th><?php echo $this->translate("Jobretention"); ?></th>
+ <th><?php echo $this->translate("Actions"); ?></th>
</thead>
</table>
@@ -67,12 +67,12 @@ $this->headTitle($title);
<table class="table table-hover" id="tab-backups">
<thead class="bg-primary">
- <th><?php echo $this->translate("Job"); ?></th>
- <th><?php echo $this->translate("Timestamp"); ?></th>
- <th><?php echo $this->translate("Fileset"); ?></th>
- <th><?php echo $this->translate("Level"); ?></th>
- <th><?php echo $this->translate("Files"); ?></th>
- <th><?php echo $this->translate("Bytes"); ?></th>
+ <th><?php echo $this->translate("Job"); ?></th>
+ <th><?php echo $this->translate("Timestamp"); ?></th>
+ <th><?php echo $this->translate("Fileset"); ?></th>
+ <th><?php echo $this->translate("Level"); ?></th>
+ <th><?php echo $this->translate("Files"); ?></th>
+ <th><?php echo $this->translate("Bytes"); ?></th>
</thead>
</table>
@@ -91,169 +91,169 @@ $this->headTitle($title);
$(document).ready(function() {
- $('#tab-client').DataTable( {
- "ajax": {
- "url": "<?php echo $this->url('client', array('action' => 'getData'), null) . '?data=details&client='.$this->client; ?>",
- "dataSrc": ""
- },
- "columns" : [
- {
- "className": "client-name",
- "data": "name"
- },
- {
- "className": "client-uname",
- "data": "uname"
- },
- {
- "className": "client-autoprune",
- "data": "autoprune"
- },
- {
- "className": "client-fileretention",
- "data": "fileretention"
- },
- {
- "className": "client-jobretention",
- "data": "jobretention"
- },
- {
- "className": "client-actions",
- "data": null
- }
- ],
- "paging": false,
- "ordering": false,
- "info": false,
- "pagingType": "full_numbers",
- "stateSave": true,
- "bFilter": false,
- "columnDefs": [
- {
- "targets": 2,
- "data": "autoprune",
- "render": function(data, type, full, meta) {
- if(data == 1) {
- var a = '<span class="label label-success">enabled</span>';
- }
- else {
- var a = '<span class="label label-danger">disabled</span>';
- }
- return a;
- }
- },
- {
- "targets": 3,
- "data": "fileretention",
- "render": function(data, type, full, meta) {
- return Math.floor((data % 31536000) / 86400) + " days";
- }
- },
- {
- "targets": 4,
- "data": "fileretention",
- "render": function(data, type, full, meta) {
- return Math.floor((data % 31536000) / 86400) + " days";
- }
- },
- {
- "targets": -1,
- "data": "name",
- "render": function(data, type, full, meta) {
- return '<a href="<?php echo $this->basePath() . '/restore/index?type=client&client='; ?>'+data.name+'"><button type="button" class="btn btn-default btn-xs" id="btn-1" data-toggle="tooltip" data-placement="top" title="Restore"><span class="glyphicon glyphicon-import"></span></button></a>';
- }
- }
- ]
- } );
+ $('#tab-client').DataTable( {
+ "ajax": {
+ "url": "<?php echo $this->url('client', array('action' => 'getData'), null) . '?data=details&client='.$this->client; ?>",
+ "dataSrc": ""
+ },
+ "columns" : [
+ {
+ "className": "client-name",
+ "data": "name"
+ },
+ {
+ "className": "client-uname",
+ "data": "uname"
+ },
+ {
+ "className": "client-autoprune",
+ "data": "autoprune"
+ },
+ {
+ "className": "client-fileretention",
+ "data": "fileretention"
+ },
+ {
+ "className": "client-jobretention",
+ "data": "jobretention"
+ },
+ {
+ "className": "client-actions",
+ "data": null
+ }
+ ],
+ "paging": false,
+ "ordering": false,
+ "info": false,
+ "pagingType": "full_numbers",
+ "stateSave": true,
+ "bFilter": false,
+ "columnDefs": [
+ {
+ "targets": 2,
+ "data": "autoprune",
+ "render": function(data, type, full, meta) {
+ if(data == 1) {
+ var a = '<span class="label label-success">enabled</span>';
+ }
+ else {
+ var a = '<span class="label label-danger">disabled</span>';
+ }
+ return a;
+ }
+ },
+ {
+ "targets": 3,
+ "data": "fileretention",
+ "render": function(data, type, full, meta) {
+ return Math.floor((data % 31536000) / 86400) + " days";
+ }
+ },
+ {
+ "targets": 4,
+ "data": "fileretention",
+ "render": function(data, type, full, meta) {
+ return Math.floor((data % 31536000) / 86400) + " days";
+ }
+ },
+ {
+ "targets": -1,
+ "data": "name",
+ "render": function(data, type, full, meta) {
+ return '<a href="<?php echo $this->basePath() . '/restore/index?type=client&client='; ?>'+data.name+'"><button type="button" class="btn btn-default btn-xs" id="btn-1" data-toggle="tooltip" data-placement="top" title="Restore"><span class="glyphicon glyphicon-import"></span></button></a>';
+ }
+ }
+ ]
+ } );
- $('#tab-backups').DataTable( {
- "ajax": {
- "url": "<?php echo $this->url('client', array('action' => 'getData'), null) . '?data=backups&client='.$this->client; ?>",
- "dataSrc": ""
- },
- "columns" : [
- {
- "className": "backup-jobid",
- "orderable": true,
- "data": "jobid"
- },
- {
- "className": "backup-starttime",
- "orderable": true,
- "data": "starttime"
- },
- {
- "className": "backup-fileset",
- "orderable": true,
- "data": "fileset",
- },
- {
- "className": "backup-level",
- "orderable": true,
- "data": "level",
- },
- {
- "className": "backup-jobfiles",
- "orderable": true,
- "data": "jobfiles",
- },
- {
- "className": "backup-jobbytes",
- "orderable": true,
- "data": "jobbytes"
- }
- ],
- "paging": true,
- "ordering": true,
- "info": true,
- "pagingType": "full_numbers",
- "stateSave": true,
- "columnDefs": [
- {
- "targets": 0,
- "data": "jobid",
- "render": function(data, type, full, meta) {
- return '<a href="<?php echo $this->basePath() . '/job/details/'; ?>'+data+'">'+data+'</a>';
- }
- },
- {
- "targets": 3,
- "data": "level",
- "render": function(data, type, full, meta) {
- switch(data) {
- case "I":
- var level = 'Incremental';
- break;
- case "D":
- var level = 'Differential';
- break;
- case "F":
- var level = 'Full';
- break;
- default:
- var level = "";
- break;
- }
- return level;
- }
- },
- {
- "targets": 5,
- "data": "jobbytes",
- "render": function(data, type, full, meta) {
- if(data == 0) return "0.00 B";
- var k = 1000;
- var units = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB"];
- var i = Math.floor(Math.log(data) / Math.log(k));
- return parseFloat((data / Math.pow(k, i)).toFixed(2)) + " " + units[i];
- }
- }
- ]
- } );
+ $('#tab-backups').DataTable( {
+ "ajax": {
+ "url": "<?php echo $this->url('client', array('action' => 'getData'), null) . '?data=backups&client='.$this->client; ?>",
+ "dataSrc": ""
+ },
+ "columns" : [
+ {
+ "className": "backup-jobid",
+ "orderable": true,
+ "data": "jobid"
+ },
+ {
+ "className": "backup-starttime",
+ "orderable": true,
+ "data": "starttime"
+ },
+ {
+ "className": "backup-fileset",
+ "orderable": true,
+ "data": "fileset",
+ },
+ {
+ "className": "backup-level",
+ "orderable": true,
+ "data": "level",
+ },
+ {
+ "className": "backup-jobfiles",
+ "orderable": true,
+ "data": "jobfiles",
+ },
+ {
+ "className": "backup-jobbytes",
+ "orderable": true,
+ "data": "jobbytes"
+ }
+ ],
+ "paging": true,
+ "ordering": true,
+ "info": true,
+ "pagingType": "full_numbers",
+ "stateSave": true,
+ "columnDefs": [
+ {
+ "targets": 0,
+ "data": "jobid",
+ "render": function(data, type, full, meta) {
+ return '<a href="<?php echo $this->basePath() . '/job/details/'; ?>'+data+'">'+data+'</a>';
+ }
+ },
+ {
+ "targets": 3,
+ "data": "level",
+ "render": function(data, type, full, meta) {
+ switch(data) {
+ case "I":
+ var level = 'Incremental';
+ break;
+ case "D":
+ var level = 'Differential';
+ break;
+ case "F":
+ var level = 'Full';
+ break;
+ default:
+ var level = "";
+ break;
+ }
+ return level;
+ }
+ },
+ {
+ "targets": 5,
+ "data": "jobbytes",
+ "render": function(data, type, full, meta) {
+ if(data == 0) return "0.00 B";
+ var k = 1000;
+ var units = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB"];
+ var i = Math.floor(Math.log(data) / Math.log(k));
+ return parseFloat((data / Math.pow(k, i)).toFixed(2)) + " " + units[i];
+ }
+ }
+ ]
+ } );
- $('#tab-client tbody').on('mouseover', '#btn-1', function () {
- $('[data-toggle="tooltip"]').tooltip();
- } );
+ $('#tab-client tbody').on('mouseover', '#btn-1', function () {
+ $('[data-toggle="tooltip"]').tooltip();
+ } );
} );
diff --git a/module/Client/view/client/client/index.phtml b/module/Client/view/client/client/index.phtml
index bc0c44d..5c193ce 100644
--- a/module/Client/view/client/client/index.phtml
+++ b/module/Client/view/client/client/index.phtml
@@ -42,9 +42,9 @@ $this->headTitle($title);
<table class="table table-hover" id="clients">
<thead class="bg-primary">
- <th><?php echo $this->translate("Name"); ?></th>
- <th><?php echo $this->translate("Version"); ?></th>
- <th><?php echo $this->translate("Actions"); ?></th>
+ <th><?php echo $this->translate("Name"); ?></th>
+ <th><?php echo $this->translate("Version"); ?></th>
+ <th><?php echo $this->translate("Actions"); ?></th>
</thead>
</table>
@@ -64,54 +64,54 @@ $this->headTitle($title);
$(document).ready(function() {
- var table= $('#clients').DataTable( {
- "ajax": {
- "url": "<?php echo $this->url('client', array('action' => 'getData'), null) . '?data=all'; ?>",
- "dataSrc": ""
- },
- "columns" : [
- {
- "className": "client-name",
- "orderable": true,
- "data": "name"
- },
- {
- "className": "client-uname",
- "orderable": true,
- "data": "uname"
- },
- {
- "className": "actions",
- "orderable": false,
- "data": null
- }
- ],
- "paging": true,
- "ordering": true,
- "info": true,
- "pagingType": "full_numbers",
- "stateSave": true,
- "columnDefs": [
- {
- "targets": 0,
- "data": "name",
- "render": function(data, type, full, meta) {
- return '<a href="<?php echo $this->basePath() . '/client/details/'; ?>'+data+'">'+data+'</a>';
- }
- },
- {
- "targets": -1,
- "data": "name",
- "render": function(data, type, full, meta) {
- return '<a href="<?php echo $this->basePath() . '/restore/index?type=client&client='; ?>'+data.name+'"><button type="button" class="btn btn-default btn-xs" id="btn-1" data-toggle="tooltip" data-placement="top" title="Restore"><span class="glyphicon glyphicon-import"></span></button></a>';
- }
- }
- ]
- } );
-
- $('#clients tbody').on('mouseover', '#btn-1', function () {
- $('[data-toggle="tooltip"]').tooltip();
- })
+ var table= $('#clients').DataTable( {
+ "ajax": {
+ "url": "<?php echo $this->url('client', array('action' => 'getData'), null) . '?data=all'; ?>",
+ "dataSrc": ""
+ },
+ "columns" : [
+ {
+ "className": "client-name",
+ "orderable": true,
+ "data": "name"
+ },
+ {
+ "className": "client-uname",
+ "orderable": true,
+ "data": "uname"
+ },
+ {
+ "className": "actions",
+ "orderable": false,
+ "data": null
+ }
+ ],
+ "paging": true,
+ "ordering": true,
+ "info": true,
+ "pagingType": "full_numbers",
+ "stateSave": true,
+ "columnDefs": [
+ {
+ "targets": 0,
+ "data": "name",
+ "render": function(data, type, full, meta) {
+ return '<a href="<?php echo $this->basePath() . '/client/details/'; ?>'+data+'">'+data+'</a>';
+ }
+ },
+ {
+ "targets": -1,
+ "data": "name",
+ "render": function(data, type, full, meta) {
+ return '<a href="<?php echo $this->basePath() . '/restore/index?type=client&client='; ?>'+data.name+'"><button type="button" class="btn btn-default btn-xs" id="btn-1" data-toggle="tooltip" data-placement="top" title="Restore"><span class="glyphicon glyphicon-import"></span></button></a>';
+ }
+ }
+ ]
+ } );
+
+ $('#clients tbody').on('mouseover', '#btn-1', function () {
+ $('[data-toggle="tooltip"]').tooltip();
+ })
} );
diff --git a/module/Dashboard/Module.php b/module/Dashboard/Module.php
index 1ccc8f5..2a3b654 100644
--- a/module/Dashboard/Module.php
+++ b/module/Dashboard/Module.php
@@ -8,36 +8,36 @@ use Dashboard\Model\DashboardModel;
class Module
{
- public function getAutoloaderConfig()
- {
- return array(
- 'Zend\Loader\ClassMapAutoloader' => array(
- __DIR__ . '/autoload_classmap.php',
- ),
- 'Zend\Loader\StandardAutoloader' => array(
- 'namespaces' => array(
- __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
- ),
- ),
- );
- }
-
- public function getConfig()
- {
- return include __DIR__ . '/config/module.config.php';
- }
-
- public function getServiceConfig()
- {
- return array(
- 'factories' => array(
- 'Dashboard\Model\DashboardModel' => function() {
- $model = new DashboardModel();
- return $model;
- },
- ),
- );
- }
+ public function getAutoloaderConfig()
+ {
+ return array(
+ 'Zend\Loader\ClassMapAutoloader' => array(
+ __DIR__ . '/autoload_classmap.php',
+ ),
+ 'Zend\Loader\StandardAutoloader' => array(
+ 'namespaces' => array(
+ __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
+ ),
+ ),
+ );
+ }
+
+ public function getConfig()
+ {
+ return include __DIR__ . '/config/module.config.php';
+ }
+
+ public function getServiceConfig()
+ {
+ return array(
+ 'factories' => array(
+ 'Dashboard\Model\DashboardModel' => function() {
+ $model = new DashboardModel();
+ return $model;
+ },
+ ),
+ );
+ }
}
diff --git a/module/Dashboard/config/module.config.php b/module/Dashboard/config/module.config.php
index abe0be8..8fcb762 100644
--- a/module/Dashboard/config/module.config.php
+++ b/module/Dashboard/config/module.config.php
@@ -25,39 +25,39 @@
return array(
- 'controllers' => array(
- 'invokables' => array(
- 'Dashboard\Controller\Dashboard' => 'Dashboard\Controller\DashboardController',
- ),
- ),
- 'controller_plugins' => array(
- 'invokables' => array(
- 'SessionTimeoutPlugin' => 'Application\Controller\Plugin\SessionTimeoutPlugin',
- ),
- ),
- 'router' => array(
- 'routes' => array(
- 'dashboard' => array(
- 'type' => 'segment',
- 'options' => array(
- 'route' => '/dashboard[/][:action][/:id]',
- 'constraints' => array(
- 'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
- 'id' => '[0-9]+',
- ),
- 'defaults' => array(
- 'controller' => 'Dashboard\Controller\Dashboard',
- 'action' => 'index',
- ),
- ),
- ),
- ),
- ),
+ 'controllers' => array(
+ 'invokables' => array(
+ 'Dashboard\Controller\Dashboard' => 'Dashboard\Controller\DashboardController',
+ ),
+ ),
+ 'controller_plugins' => array(
+ 'invokables' => array(
+ 'SessionTimeoutPlugin' => 'Application\Controller\Plugin\SessionTimeoutPlugin',
+ ),
+ ),
+ 'router' => array(
+ 'routes' => array(
+ 'dashboard' => array(
+ 'type' => 'segment',
+ 'options' => array(
+ 'route' => '/dashboard[/][:action][/:id]',
+ 'constraints' => array(
+ 'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
+ 'id' => '[0-9]+',
+ ),
+ 'defaults' => array(
+ 'controller' => 'Dashboard\Controller\Dashboard',
+ 'action' => 'index',
+ ),
+ ),
+ ),
+ ),
+ ),
- 'view_manager' => array(
- 'template_path_stack' => array(
- 'dashboard' => __DIR__ . '/../view',
- ),
- ),
+ 'view_manager' => array(
+ 'template_path_stack' => array(
+ 'dashboard' => __DIR__ . '/../view',
+ ),
+ ),
);
diff --git a/module/Dashboard/src/Dashboard/Controller/DashboardController.php b/module/Dashboard/src/Dashboard/Controller/DashboardController.php
index 8d789d4..def3997 100644
--- a/module/Dashboard/src/Dashboard/Controller/DashboardController.php
+++ b/module/Dashboard/src/Dashboard/Controller/DashboardController.php
@@ -30,86 +30,86 @@ use Zend\View\Model\ViewModel;
class DashboardController extends AbstractActionController
{
- protected $dashboardModel;
+ protected $dashboardModel;
- public function indexAction()
- {
- if($_SESSION['bareos']['authenticated'] && $this->SessionTimeoutPlugin()->timeout()) {
+ public function indexAction()
+ {
+ if($_SESSION['bareos']['authenticated'] && $this->SessionTimeoutPlugin()->timeout()) {
- return new ViewModel(
- array(
- 'runningJobs' => $this->getJobs("running", 1, null),
- 'waitingJobs' => $this->getJobs("waiting", 1, null),
- 'successfulJobs' => $this->getJobs("successful", 1, null),
- 'unsuccessfulJobs' => $this->getJobs("unsuccessful", 1, null),
- )
- );
- }
- else {
- return $this->redirect()->toRoute('auth', array('action' => 'login'));
- }
- }
+ return new ViewModel(
+ array(
+ 'runningJobs' => $this->getJobs("running", 1, null),
+ 'waitingJobs' => $this->getJobs("waiting", 1, null),
+ 'successfulJobs' => $this->getJobs("successful", 1, null),
+ 'unsuccessfulJobs' => $this->getJobs("unsuccessful", 1, null),
+ )
+ );
+ }
+ else {
+ return $this->redirect()->toRoute('auth', array('action' => 'login'));
+ }
+ }
- private function getJobs($status=null, $days=1, $hours=null)
- {
- if($status != null) {
- if($status == "running") {
- $jobs_R = $this->getDashboardModel()->getJobs('R', $days, $hours);
- $jobs_l = $this->getDashboardModel()->getJobs('l', $days, $hours);
- $num = count($jobs_R) + count($jobs_l);
- return $num;
- }
- elseif($status == "waiting") {
- $jobs_F = $this->getDashboardModel()->getJobs('F', $days, $hours);
- $jobs_S = $this->getDashboardModel()->getJobs('S', $days, $hours);
- $jobs_s = $this->getDashboardModel()->getJobs('s', $days, $hours);
- $jobs_m = $this->getDashboardModel()->getJobs('m', $days, $hours);
- $jobs_M = $this->getDashboardModel()->getJobs('M', $days, $hours);
- $jobs_j = $this->getDashboardModel()->getJobs('j', $days, $hours);
- $jobs_c = $this->getDashboardModel()->getJobs('c', $days, $hours);
- $jobs_C = $this->getDashboardModel()->getJobs('C', $days, $hours);
- $jobs_d = $this->getDashboardModel()->getJobs('d', $days, $hours);
- $jobs_t = $this->getDashboardModel()->getJobs('t', $days, $hours);
- $jobs_p = $this->getDashboardModel()->getJobs('p', $days, $hours);
- $jobs_q = $this->getDashboardModel()->getJobs('q', $days, $hours);
- $num = count($jobs_F) + count($jobs_S) +
- count($jobs_s) + count($jobs_m) +
- count($jobs_M) + count($jobs_j) +
- count($jobs_c) + count($jobs_C) +
- count($jobs_d) + count($jobs_t) +
- count($jobs_p) + count($jobs_q);
- return $num;
- }
- elseif($status == "successful") {
- $jobs_T = $this->getDashboardModel()->getJobs('T', $days, $hours);
- $jobs_W = $this->getDashboardModel()->getJobs('W', $days, $hours);
- $num = count($jobs_T) + count($jobs_W);
- return $num;
- }
- elseif($status == "unsuccessful") {
- $jobs_A = $this->getDashboardModel()->getJobs('A', $days, $hours);
- $jobs_E = $this->getDashboardModel()->getJobs('E', $days, $hours);
- $jobs_e = $this->getDashboardModel()->getJobs('e', $days, $hours);
- $jobs_f = $this->getDashboardModel()->getJobs('f', $days, $hours);
- $num = count($jobs_A) + count($jobs_E) + count($jobs_e) + count($jobs_f);
- return $num;
- }
- else {
- return null;
- }
- }
- else {
- return null;
- }
- }
+ private function getJobs($status=null, $days=1, $hours=null)
+ {
+ if($status != null) {
+ if($status == "running") {
+ $jobs_R = $this->getDashboardModel()->getJobs('R', $days, $hours);
+ $jobs_l = $this->getDashboardModel()->getJobs('l', $days, $hours);
+ $num = count($jobs_R) + count($jobs_l);
+ return $num;
+ }
+ elseif($status == "waiting") {
+ $jobs_F = $this->getDashboardModel()->getJobs('F', $days, $hours);
+ $jobs_S = $this->getDashboardModel()->getJobs('S', $days, $hours);
+ $jobs_s = $this->getDashboardModel()->getJobs('s', $days, $hours);
+ $jobs_m = $this->getDashboardModel()->getJobs('m', $days, $hours);
+ $jobs_M = $this->getDashboardModel()->getJobs('M', $days, $hours);
+ $jobs_j = $this->getDashboardModel()->getJobs('j', $days, $hours);
+ $jobs_c = $this->getDashboardModel()->getJobs('c', $days, $hours);
+ $jobs_C = $this->getDashboardModel()->getJobs('C', $days, $hours);
+ $jobs_d = $this->getDashboardModel()->getJobs('d', $days, $hours);
+ $jobs_t = $this->getDashboardModel()->getJobs('t', $days, $hours);
+ $jobs_p = $this->getDashboardModel()->getJobs('p', $days, $hours);
+ $jobs_q = $this->getDashboardModel()->getJobs('q', $days, $hours);
+ $num = count($jobs_F) + count($jobs_S) +
+ count($jobs_s) + count($jobs_m) +
+ count($jobs_M) + count($jobs_j) +
+ count($jobs_c) + count($jobs_C) +
+ count($jobs_d) + count($jobs_t) +
+ count($jobs_p) + count($jobs_q);
+ return $num;
+ }
+ elseif($status == "successful") {
+ $jobs_T = $this->getDashboardModel()->getJobs('T', $days, $hours);
+ $jobs_W = $this->getDashboardModel()->getJobs('W', $days, $hours);
+ $num = count($jobs_T) + count($jobs_W);
+ return $num;
+ }
+ elseif($status == "unsuccessful") {
+ $jobs_A = $this->getDashboardModel()->getJobs('A', $days, $hours);
+ $jobs_E = $this->getDashboardModel()->getJobs('E', $days, $hours);
+ $jobs_e = $this->getDashboardModel()->getJobs('e', $days, $hours);
+ $jobs_f = $this->getDashboardModel()->getJobs('f', $days, $hours);
+ $num = count($jobs_A) + count($jobs_E) + count($jobs_e) + count($jobs_f);
+ return $num;
+ }
+ else {
+ return null;
+ }
+ }
+ else {
+ return null;
+ }
+ }
- public function getDashboardModel()
- {
- if(!$this->dashboardModel) {
- $sm = $this->getServiceLocator();
- $this->dashboardModel = $sm->get('Dashboard\Model\DashboardModel');
- }
- return $this->dashboardModel;
- }
+ public function getDashboardModel()
+ {
+ if(!$this->dashboardModel) {
+ $sm = $this->getServiceLocator();
+ $this->dashboardModel = $sm->get('Dashboard\Model\DashboardModel');
+ }
+ return $this->dashboardModel;
+ }
}
diff --git a/module/Dashboard/src/Dashboard/Model/DashboardModel.php b/module/Dashboard/src/Dashboard/Model/DashboardModel.php
index 1aadb44..33f2f67 100644
--- a/module/Dashboard/src/Dashboard/Model/DashboardModel.php
+++ b/module/Dashboard/src/Dashboard/Model/DashboardModel.php
@@ -30,43 +30,43 @@ use Zend\ServiceManager\ServiceLocatorInterface;
class DashboardModel implements ServiceLocatorAwareInterface
{
- protected $serviceLocator;
- protected $director;
+ protected $serviceLocator;
+ protected $director;
- public function __construct()
- {
- }
+ public function __construct()
+ {
+ }
- public function setServiceLocator(ServiceLocatorInterface $serviceLocator)
- {
- $this->serviceLocator = $serviceLocator;
- }
+ public function setServiceLocator(ServiceLocatorInterface $serviceLocator)
+ {
+ $this->serviceLocator = $serviceLocator;
+ }
- public function getServiceLocator()
- {
- return $this->serviceLocator;
- }
+ public function getServiceLocator()
+ {
+ return $this->serviceLocator;
+ }
- public function getJobs($status=null, $days=null, $hours=null)
- {
- if(isset($status)) {
- $this->director = $this->getServiceLocator()->get('director');
- if(isset($days)) {
- $cmd = 'llist jobs jobstatus='.$status.' days='.$days.'';
- }
- elseif(isset($hours)) {
- $cmd = 'llist jobs jobstatus='.$status.' hours='.$hours.'';
- }
- else {
- $cmd = 'llist jobs jobstatus='.$status.'';
- }
- $result = $this->director->send_command($cmd, 2, null);
- $jobs = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
- return $jobs['result']['jobs'];
- }
- else {
- return false;
- }
- }
+ public function getJobs($status=null, $days=null, $hours=null)
+ {
+ if(isset($status)) {
+ $this->director = $this->getServiceLocator()->get('director');
+ if(isset($days)) {
+ $cmd = 'llist jobs jobstatus='.$status.' days='.$days.'';
+ }
+ elseif(isset($hours)) {
+ $cmd = 'llist jobs jobstatus='.$status.' hours='.$hours.'';
+ }
+ else {
+ $cmd = 'llist jobs jobstatus='.$status.'';
+ }
+ $result = $this->director->send_command($cmd, 2, null);
+ $jobs = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
+ return $jobs['result']['jobs'];
+ }
+ else {
+ return false;
+ }
+ }
}
diff --git a/module/Dashboard/view/dashboard/dashboard/index.phtml b/module/Dashboard/view/dashboard/dashboard/index.phtml
index cfee487..95faac7 100644
--- a/module/Dashboard/view/dashboard/dashboard/index.phtml
+++ b/module/Dashboard/view/dashboard/dashboard/index.phtml
@@ -35,43 +35,43 @@ $this->headTitle($title);
<div class="panel panel-default">
- <div class="panel-heading">
- <h3 class="panel-title">
- <span class="glyphicon glyphicon-stats"></span>
- <?php echo $this->translate('Jobs during the past 24 hours') ?>
- </h3>
- </div>
-
- <div class="panel-body">
-
- <div class="col-md-4">
-
- <table class="table">
- <tr>
- <td><a href="<?php echo $this->url('job', array('action' => 'index'), array('query' => array('period' => '1', 'status' => 'running'))); ?>"><?php echo $this->translate("Running"); ?></a></td>
- <td><a href="<?php echo $this->url('job', array('action' => 'index'), array('query' => array('period' => '1', 'status' => 'running'))); ?>"><?php echo $this->runningJobs; ?></a></td>
- </tr>
- <tr>
- <td><a href="<?php echo $this->url('job', array('action' => 'index'), array('query' => array('period' => '1', 'status' => 'waiting'))); ?>"><?php echo $this->translate("Waiting"); ?></a></td>
- <td><a href="<?php echo $this->url('job', array('action' => 'index'), array('query' => array('period' => '1', 'status' => 'waiting'))); ?>"><?php echo $this->waitingJobs; ?></a></td>
- </tr>
- <tr>
- <td><a href="<?php echo $this->url('job', array('action' => 'index'), array('query' => array('period' => '1', 'status' => 'successful'))); ?>"><?php echo $this->translate("Successful"); ?></a></td>
- <td><a href="<?php echo $this->url('job', array('action' => 'index'), array('query' => array('period' => '1', 'status' => 'successful'))); ?>"><?php echo $this->successfulJobs; ?></a></td>
- </tr>
- <tr>
- <td><a href="<?php echo $this->url('job', array('action' => 'index'), array('query' => array('period' => '1', 'status' => 'unsuccessful'))); ?>"><?php echo $this->translate("Unsuccessful"); ?></a></td>
- <td><a href="<?php echo $this->url('job', array('action' => 'index'), array('query' => array('period' => '1', 'status' => 'unsuccessful'))); ?>"><?php echo $this->unsuccessfulJobs; ?></a></td>
- </tr>
- </table>
-
- </div>
-
- <div class="col-md-4">
- <div id="chart1" style="width:450px; height:300px;"></div>
- </div>
-
- </div>
+ <div class="panel-heading">
+ <h3 class="panel-title">
+ <span class="glyphicon glyphicon-stats"></span>
+ <?php echo $this->translate('Jobs during the past 24 hours') ?>
+ </h3>
+ </div>
+
+ <div class="panel-body">
+
+ <div class="col-md-4">
+
+ <table class="table">
+ <tr>
+ <td><a href="<?php echo $this->url('job', array('action' => 'index'), array('query' => array('period' => '1', 'status' => 'running'))); ?>"><?php echo $this->translate("Running"); ?></a></td>
+ <td><a href="<?php echo $this->url('job', array('action' => 'index'), array('query' => array('period' => '1', 'status' => 'running'))); ?>"><?php echo $this->runningJobs; ?></a></td>
+ </tr>
+ <tr>
+ <td><a href="<?php echo $this->url('job', array('action' => 'index'), array('query' => array('period' => '1', 'status' => 'waiting'))); ?>"><?php echo $this->translate("Waiting"); ?></a></td>
+ <td><a href="<?php echo $this->url('job', array('action' => 'index'), array('query' => array('period' => '1', 'status' => 'waiting'))); ?>"><?php echo $this->waitingJobs; ?></a></td>
+ </tr>
+ <tr>
+ <td><a href="<?php echo $this->url('job', array('action' => 'index'), array('query' => array('period' => '1', 'status' => 'successful'))); ?>"><?php echo $this->translate("Successful"); ?></a></td>
+ <td><a href="<?php echo $this->url('job', array('action' => 'index'), array('query' => array('period' => '1', 'status' => 'successful'))); ?>"><?php echo $this->successfulJobs; ?></a></td>
+ </tr>
+ <tr>
+ <td><a href="<?php echo $this->url('job', array('action' => 'index'), array('query' => array('period' => '1', 'status' => 'unsuccessful'))); ?>"><?php echo $this->translate("Unsuccessful"); ?></a></td>
+ <td><a href="<?php echo $this->url('job', array('action' => 'index'), array('query' => array('period' => '1', 'status' => 'unsuccessful'))); ?>"><?php echo $this->unsuccessfulJobs; ?></a></td>
+ </tr>
+ </table>
+
+ </div>
+
+ <div class="col-md-4">
+ <div id="chart1" style="width:450px; height:300px;"></div>
+ </div>
+
+ </div>
</div>
@@ -97,51 +97,51 @@ Heads up! You are now able to <a href="<?php echo $this->url('restore', array())
<script type="text/javascript">
- function chart1() {
-
- var data = [
- ['Running', <?php echo $this->runningJobs; ?>],
- ['Waiting', <?php echo $this->waitingJobs; ?>],
- ['Successful', <?php echo $this->successfulJobs; ?>],
- ['Unsuccessful', <?php echo $this->unsuccessfulJobs; ?>]
- ];
-
- var plot1 = jQuery.jqplot(
- 'chart1',
- [data],
- {
- seriesColors: [ "#5bc0de", "#cccccc", "#5cb85c", "#d9534f" ],
- seriesDefaults: {
- renderer: jQuery.jqplot.PieRenderer,
- rendererOptions: {
- fill: true,
- sliceMargin: 5,
- lineWidth: 3,
- showDataLabels: true
- },
- shadow: true,
- },
- legend:{
- show: true,
- location: 'se',
- xoffset: 1,
- yoffset: 1,
- },
- grid: {
- drawGridLines: true,
- borderColor: 'transparent',
- shadowColor: 'transparent',
- }
- }
- );
-
- }
-
- $(document).ready(
- function(){
- chart1();
- }
- );
+ function chart1() {
+
+ var data = [
+ ['Running', <?php echo $this->runningJobs; ?>],
+ ['Waiting', <?php echo $this->waitingJobs; ?>],
+ ['Successful', <?php echo $this->successfulJobs; ?>],
+ ['Unsuccessful', <?php echo $this->unsuccessfulJobs; ?>]
+ ];
+
+ var plot1 = jQuery.jqplot(
+ 'chart1',
+ [data],
+ {
+ seriesColors: [ "#5bc0de", "#cccccc", "#5cb85c", "#d9534f" ],
+ seriesDefaults: {
+ renderer: jQuery.jqplot.PieRenderer,
+ rendererOptions: {
+ fill: true,
+ sliceMargin: 5,
+ lineWidth: 3,
+ showDataLabels: true
+ },
+ shadow: true,
+ },
+ legend:{
+ show: true,
+ location: 'se',
+ xoffset: 1,
+ yoffset: 1,
+ },
+ grid: {
+ drawGridLines: true,
+ borderColor: 'transparent',
+ shadowColor: 'transparent',
+ }
+ }
+ );
+
+ }
+
+ $(document).ready(
+ function(){
+ chart1();
+ }
+ );
</script>
diff --git a/module/Director/Module.php b/module/Director/Module.php
index 76c421c..2b5748e 100644
--- a/module/Director/Module.php
+++ b/module/Director/Module.php
@@ -8,36 +8,36 @@ use Director\Model\DirectorModel;
class Module
{
- public function getAutoloaderConfig()
- {
- return array(
- 'Zend\Loader\ClassMapAutoloader' => array(
- __DIR__ . '/autoload_classmap.php',
- ),
- 'Zend\Loader\StandardAutoloader' => array(
- 'namespaces' => array(
- __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
- ),
- ),
- );
- }
-
- public function getConfig()
- {
- return include __DIR__ . '/config/module.config.php';
- }
-
- public function getServiceConfig()
- {
- return array(
- 'factories' => array(
- 'Director\Model\DirectorModel' => function() {
- $model = new DirectorModel();
- return $model;
- }
- )
- );
- }
+ public function getAutoloaderConfig()
+ {
+ return array(
+ 'Zend\Loader\ClassMapAutoloader' => array(
+ __DIR__ . '/autoload_classmap.php',
+ ),
+ 'Zend\Loader\StandardAutoloader' => array(
+ 'namespaces' => array(
+ __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
+ ),
+ ),
+ );
+ }
+
+ public function getConfig()
+ {
+ return include __DIR__ . '/config/module.config.php';
+ }
+
+ public function getServiceConfig()
+ {
+ return array(
+ 'factories' => array(
+ 'Director\Model\DirectorModel' => function() {
+ $model = new DirectorModel();
+ return $model;
+ }
+ )
+ );
+ }
}
diff --git a/module/Director/config/module.config.php b/module/Director/config/module.config.php
index 90eae5c..0288502 100644
--- a/module/Director/config/module.config.php
+++ b/module/Director/config/module.config.php
@@ -3,7 +3,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/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
@@ -25,39 +25,39 @@
return array(
- 'controllers' => array(
- 'invokables' => array(
- 'Director\Controller\Director' => 'Director\Controller\DirectorController',
- ),
- ),
- 'controller_plugins' => array(
- 'invokables' => array(
- 'SessionTimeoutPlugin' => 'Application\Controller\Plugin\SessionTimeoutPlugin',
- ),
- ),
- 'router' => array(
- 'routes' => array(
- 'director' => array(
- 'type' => 'segment',
- 'options' => array(
- 'route' => '/director[/][:action][/:id]',
- 'constraints' => array(
- 'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
- 'id' => '[0-9]+',
- ),
- 'defaults' => array(
- 'controller' => 'Director\Controller\Director',
- 'action' => 'index',
- ),
- ),
- ),
- ),
- ),
-
- 'view_manager' => array(
- 'template_path_stack' => array(
- 'director' => __DIR__ . '/../view',
- ),
- ),
+ 'controllers' => array(
+ 'invokables' => array(
+ 'Director\Controller\Director' => 'Director\Controller\DirectorController',
+ ),
+ ),
+ 'controller_plugins' => array(
+ 'invokables' => array(
+ 'SessionTimeoutPlugin' => 'Application\Controller\Plugin\SessionTimeoutPlugin',
+ ),
+ ),
+ 'router' => array(
+ 'routes' => array(
+ 'director' => array(
+ 'type' => 'segment',
+ 'options' => array(
+ 'route' => '/director[/][:action][/:id]',
+ 'constraints' => array(
+ 'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
+ 'id' => '[0-9]+',
+ ),
+ 'defaults' => array(
+ 'controller' => 'Director\Controller\Director',
+ 'action' => 'index',
+ ),
+ ),
+ ),
+ ),
+ ),
+
+ 'view_manager' => array(
+ 'template_path_stack' => array(
+ 'director' => __DIR__ . '/../view',
+ ),
+ ),
);
diff --git a/module/Director/src/Director/Controller/DirectorController.php b/module/Director/src/Director/Controller/DirectorController.php
index 2d03603..234e400 100644
--- a/module/Director/src/Director/Controller/DirectorController.php
+++ b/module/Director/src/Director/Controller/DirectorController.php
@@ -31,79 +31,79 @@ use Zend\View\Model\ViewModel;
class DirectorController extends AbstractActionController
{
- protected $directorModel;
+ protected $directorModel;
- public function indexAction()
- {
- if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
- return new ViewModel(array(
- 'directorOutput' => $this->getDirectorModel()->getDirectorStatus()
- )
- );
- }
- else {
- return $this->redirect()->toRoute('auth', array('action' => 'login'));
- }
- }
+ public function indexAction()
+ {
+ if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
+ return new ViewModel(array(
+ 'directorOutput' => $this->getDirectorModel()->getDirectorStatus()
+ )
+ );
+ }
+ else {
+ return $this->redirect()->toRoute('auth', array('action' => 'login'));
+ }
+ }
- public function messagesAction()
- {
- if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
- return new ViewModel(array(
- 'directorOutput' => $this->getDirectorModel()->getDirectorMessages()
- )
- );
- }
- else {
- return $this->redirect()->toRoute('auth', array('action' => 'login'));
- }
- }
+ public function messagesAction()
+ {
+ if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
+ return new ViewModel(array(
+ 'directorOutput' => $this->getDirectorModel()->getDirectorMessages()
+ )
+ );
+ }
+ else {
+ return $this->redirect()->toRoute('auth', array('action' => 'login'));
+ }
+ }
- public function scheduleAction()
- {
- if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
- return new ViewModel(array(
- 'directorOutput' => $this->getDirectorModel()->getDirectorSchedules()
- )
- );
- }
- else {
- return $this->redirect()->toRoute('auth', array('action' => 'login'));
- }
- }
+ public function scheduleAction()
+ {
+ if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
+ return new ViewModel(array(
+ 'directorOutput' => $this->getDirectorModel()->getDirectorSchedules()
+ )
+ );
+ }
+ else {
+ return $this->redirect()->toRoute('auth', array('action' => 'login'));
+ }
+ }
- public function schedulerstatusAction()
- {
- if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
- return new ViewModel(array(
- 'directorOutput' => $this->getDirectorModel()->getDirectorSchedulerStatus()
- )
- );
- }
- else {
- return $this->redirect()->toRoute('auth', array('action' => 'login'));
- }
- }
+ public function schedulerstatusAction()
+ {
+ if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
+ return new ViewModel(array(
+ 'directorOutput' => $this->getDirectorModel()->getDirectorSchedulerStatus()
+ )
+ );
+ }
+ else {
+ return $this->redirect()->toRoute('auth', array('action' => 'login'));
+ }
+ }
- public function versionAction()
- {
- if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
- return new ViewModel(array(
- 'directorOutput' => $this->getDirectorModel()->getDirectorVersion()
- )
- );
- }
- else {
- return $this->redirect()->toRoute('auth', array('action' => 'login'));
- }
- }
+ public function versionAction()
+ {
+ if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
+ return new ViewModel(array(
+ 'directorOutput' => $this->getDirectorModel()->getDirectorVersion()
+ )
+ );
+ }
+ else {
+ return $this->redirect()->toRoute('auth', array('action' => 'login'));
+ }
+ }
- public function getDirectorModel()
- {
- if(!$this->directorModel) {
- $sm = $this->getServiceLocator();
- $this->directorModel = $sm->get('Director\Model\DirectorModel');
- }
- return $this->directorModel;
- }
+ public function getDirectorModel()
+ {
+ if(!$this->directorModel) {
+ $sm = $this->getServiceLocator();
+ $this->directorModel = $sm->get('Director\Model\DirectorModel');
+ }
+ return $this->directorModel;
+ }
}
diff --git a/module/Director/src/Director/Model/Director.php b/module/Director/src/Director/Model/Director.php
index d8e4b40..3429dd1 100644
--- a/module/Director/src/Director/Model/Director.php
+++ b/module/Director/src/Director/Model/Director.php
@@ -3,7 +3,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/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
@@ -25,7 +25,7 @@
namespace Director\Model;
-class Director
+class Director
{
diff --git a/module/Director/src/Director/Model/DirectorModel.php b/module/Director/src/Director/Model/DirectorModel.php
index 095475e..5612a38 100644
--- a/module/Director/src/Director/Model/DirectorModel.php
+++ b/module/Director/src/Director/Model/DirectorModel.php
@@ -30,60 +30,60 @@ use Zend\ServiceManager\ServiceLocatorInterface;
class DirectorModel implements ServiceLocatorAwareInterface
{
- protected $serviceLocator;
- protected $director;
+ protected $serviceLocator;
+ protected $director;
- public function __construct()
- {
- }
+ public function __construct()
+ {
+ }
- public function setServiceLocator(ServiceLocatorInterface $serviceLocator)
- {
- $this->serviceLocator = $serviceLocator;
- }
+ public function setServiceLocator(ServiceLocatorInterface $serviceLocator)
+ {
+ $this->serviceLocator = $serviceLocator;
+ }
- public function getServiceLocator()
- {
- return $this->serviceLocator;
- }
+ public function getServiceLocator()
+ {
+ return $this->serviceLocator;
+ }
- public function getDirectorStatus()
- {
- $cmd = 'status director';
- $this->director = $this->getServiceLocator()->get('director');
- $result = $this->director->send_command($cmd, 0, null);
- return $result;
- }
+ public function getDirectorStatus()
+ {
+ $cmd = 'status director';
+ $this->director = $this->getServiceLocator()->get('director');
+ $result = $this->director->send_command($cmd, 0, null);
+ return $result;
+ }
- public function getDirectorMessages()
- {
- $cmd = 'messages';
- $this->director = $this->getServiceLocator()->get('director');
- $result = $this->director->send_command($cmd, 0, null);
- return $result;
- }
+ public function getDirectorMessages()
+ {
+ $cmd = 'messages';
+ $this->director = $this->getServiceLocator()->get('director');
+ $result = $this->director->send_command($cmd, 0, null);
+ return $result;
+ }
- public function getDirectorSchedules()
- {
- $cmd = 'show schedule';
- $this->director = $this->getServiceLocator()->get('director');
- $result = $this->director->send_command($cmd, 0, null);
- return $result;
- }
+ public function getDirectorSchedules()
+ {
+ $cmd = 'show schedule';
+ $this->director = $this->getServiceLocator()->get('director');
+ $result = $this->director->send_command($cmd, 0, null);
+ return $result;
+ }
- public function getDirectorSchedulerStatus()
- {
- $cmd = 'status scheduler';
- $this->director = $this->getServiceLocator()->get('director');
- $result = $this->director->send_command($cmd, 0, null);
- return $result;
- }
+ public function getDirectorSchedulerStatus()
+ {
+ $cmd = 'status scheduler';
+ $this->director = $this->getServiceLocator()->get('director');
+ $result = $this->director->send_command($cmd, 0, null);
+ return $result;
+ }
- public function getDirectorVersion()
- {
- $cmd = 'version';
- $this->director = $this->getServiceLocator()->get('director');
- $result = $this->director->send_command($cmd, 0, null);
- return $result;
- }
+ public function getDirectorVersion()
+ {
+ $cmd = 'version';
+ $this->director = $this->getServiceLocator()->get('director');
+ $result = $this->director->send_command($cmd, 0, null);
+ return $result;
+ }
}
diff --git a/module/Director/view/director/director/index.phtml b/module/Director/view/director/director/index.phtml
index b07e778..eea8b00 100644
--- a/module/Director/view/director/director/index.phtml
+++ b/module/Director/view/director/director/index.phtml
@@ -3,7 +3,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/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
@@ -30,11 +30,11 @@ $this->headTitle($title);
?>
<ul class="nav nav-tabs">
- <li class="active"><a href="<?php echo $this->url('director', array('action'=>'index')); ?>"><?php echo $this->translate('Status'); ?></a></li>
- <li><a href="<?php echo $this->url('director', array('action'=>'messages')); ?>"><?php echo $this->translate('Messages'); ?></a></li>
- <li><a href="<?php echo $this->url('director', array('action'=>'schedule')); ?>"><?php echo $this->translate('Schedule'); ?></a></li>
- <li><a href="<?php echo $this->url('director', array('action'=>'schedulerstatus')); ?>"><?php echo $this->translate('Scheduler status'); ?></a></li>
- <li><a href="<?php echo $this->url('director', array('action'=>'version')); ?>"><?php echo $this->translate('Version'); ?></a></li>
+ <li class="active"><a href="<?php echo $this->url('director', array('action'=>'index')); ?>"><?php echo $this->translate('Status'); ?></a></li>
+ <li><a href="<?php echo $this->url('director', array('action'=>'messages')); ?>"><?php echo $this->translate('Messages'); ?></a></li>
+ <li><a href="<?php echo $this->url('director', array('action'=>'schedule')); ?>"><?php echo $this->translate('Schedule'); ?></a></li>
+ <li><a href="<?php echo $this->url('director', array('action'=>'schedulerstatus')); ?>"><?php echo $this->translate('Scheduler status'); ?></a></li>
+ <li><a href="<?php echo $this->url('director', array('action'=>'version')); ?>"><?php echo $this->translate('Version'); ?></a></li>
</ul>
<br />
diff --git a/module/Director/view/director/director/messages.phtml b/module/Director/view/director/director/messages.phtml
index 0b6e5ad..c1b16a0 100644
--- a/module/Director/view/director/director/messages.phtml
+++ b/module/Director/view/director/director/messages.phtml
@@ -29,11 +29,11 @@ $this->headTitle($title);
?>
<ul class="nav nav-tabs">
- <li><a href="<?php echo $this->url('director', array('action'=>'index')); ?>"><?php echo $this->translate('Status'); ?></a></li>
- <li class="active"><a href="<?php echo $this->url('director', array('action'=>'messages')); ?>"><?php echo $this->translate('Messages'); ?></a></li>
- <li><a href="<?php echo $this->url('director', array('action'=>'schedule')); ?>"><?php echo $this->translate('Schedule'); ?></a></li>
- <li><a href="<?php echo $this->url('director', array('action'=>'schedulerstatus')); ?>"><?php echo $this->translate('Scheduler status'); ?></a></li>
- <li><a href="<?php echo $this->url('director', array('action'=>'version')); ?>"><?php echo $this->translate('Version'); ?></a></li>
+ <li><a href="<?php echo $this->url('director', array('action'=>'index')); ?>"><?php echo $this->translate('Status'); ?></a></li>
+ <li class="active"><a href="<?php echo $this->url('director', array('action'=>'messages')); ?>"><?php echo $this->translate('Messages'); ?></a></li>
+ <li><a href="<?php echo $this->url('director', array('action'=>'schedule')); ?>"><?php echo $this->translate('Schedule'); ?></a></li>
+ <li><a href="<?php echo $this->url('director', array('action'=>'schedulerstatus')); ?>"><?php echo $this->translate('Scheduler status'); ?></a></li>
+ <li><a href="<?php echo $this->url('director', array('action'=>'version')); ?>"><?php echo $this->translate('Version'); ?></a></li>
</ul>
<br />
diff --git a/module/Director/view/director/director/schedule.phtml b/module/Director/view/director/director/schedule.phtml
index ca92dbc..93249e4 100644
--- a/module/Director/view/director/director/schedule.phtml
+++ b/module/Director/view/director/director/schedule.phtml
@@ -29,11 +29,11 @@ $this->headTitle($title);
?>
<ul class="nav nav-tabs">
- <li><a href="<?php echo $this->url('director', array('action'=>'index')); ?>"><?php echo $this->translate('Status'); ?></a></li>
- <li><a href="<?php echo $this->url('director', array('action'=>'messages')); ?>"><?php echo $this->translate('Messages'); ?></a></li>
- <li class="active"><a href="<?php echo $this->url('director', array('action'=>'schedule')); ?>"><?php echo $this->translate('Schedule'); ?></a></li>
- <li><a href="<?php echo $this->url('director', array('action'=>'schedulerstatus')); ?>"><?php echo $this->translate('Scheduler status'); ?></a></li>
- <li><a href="<?php echo $this->url('director', array('action'=>'version')); ?>"><?php echo $this->translate('Version'); ?></a></li>
+ <li><a href="<?php echo $this->url('director', array('action'=>'index')); ?>"><?php echo $this->translate('Status'); ?></a></li>
+ <li><a href="<?php echo $this->url('director', array('action'=>'messages')); ?>"><?php echo $this->translate('Messages'); ?></a></li>
+ <li class="active"><a href="<?php echo $this->url('director', array('action'=>'schedule')); ?>"><?php echo $this->translate('Schedule'); ?></a></li>
+ <li><a href="<?php echo $this->url('director', array('action'=>'schedulerstatus')); ?>"><?php echo $this->translate('Scheduler status'); ?></a></li>
+ <li><a href="<?php echo $this->url('director', array('action'=>'version')); ?>"><?php echo $this->translate('Version'); ?></a></li>
</ul>
<br />
diff --git a/module/Director/view/director/director/schedulerstatus.phtml b/module/Director/view/director/director/schedulerstatus.phtml
index 56bda05..35697ae 100644
--- a/module/Director/view/director/director/schedulerstatus.phtml
+++ b/module/Director/view/director/director/schedulerstatus.phtml
@@ -29,11 +29,11 @@ $this->headTitle($title);
?>
<ul class="nav nav-tabs">
- <li><a href="<?php echo $this->url('director', array('action'=>'index')); ?>"><?php echo $this->translate('Status'); ?></a></li>
- <li><a href="<?php echo $this->url('director', array('action'=>'messages')); ?>"><?php echo $this->translate('Messages'); ?></a></li>
- <li><a href="<?php echo $this->url('director', array('action'=>'schedule')); ?>"><?php echo $this->translate('Schedule'); ?></a></li>
- <li class="active"><a href="<?php echo $this->url('director', array('action'=>'schedulerstatus')); ?>"><?php echo $this->translate('Scheduler status'); ?></a></li>
- <li><a href="<?php echo $this->url('director', array('action'=>'version')); ?>"><?php echo $this->translate('Version'); ?></a></li>
+ <li><a href="<?php echo $this->url('director', array('action'=>'index')); ?>"><?php echo $this->translate('Status'); ?></a></li>
+ <li><a href="<?php echo $this->url('director', array('action'=>'messages')); ?>"><?php echo $this->translate('Messages'); ?></a></li>
+ <li><a href="<?php echo $this->url('director', array('action'=>'schedule')); ?>"><?php echo $this->translate('Schedule'); ?></a></li>
+ <li class="active"><a href="<?php echo $this->url('director', array('action'=>'schedulerstatus')); ?>"><?php echo $this->translate('Scheduler status'); ?></a></li>
+ <li><a href="<?php echo $this->url('director', array('action'=>'version')); ?>"><?php echo $this->translate('Version'); ?></a></li>
</ul>
<br />
diff --git a/module/Director/view/director/director/version.phtml b/module/Director/view/director/director/version.phtml
index 3e6a84d..e455bbf 100644
--- a/module/Director/view/director/director/version.phtml
+++ b/module/Director/view/director/director/version.phtml
@@ -29,11 +29,11 @@ $this->headTitle($title);
?>
<ul class="nav nav-tabs">
- <li><a href="<?php echo $this->url('director', array('action'=>'index')); ?>"><?php echo $this->translate('Status'); ?></a></li>
- <li><a href="<?php echo $this->url('director', array('action'=>'messages')); ?>"><?php echo $this->translate('Messages'); ?></a></li>
- <li><a href="<?php echo $this->url('director', array('action'=>'schedule')); ?>"><?php echo $this->translate('Schedule'); ?></a></li>
- <li><a href="<?php echo $this->url('director', array('action'=>'schedulerstatus')); ?>"><?php echo $this->translate('Scheduler status'); ?></a></li>
- <li class="active"><a href="<?php echo $this->url('director', array('action'=>'version')); ?>"><?php echo $this->translate('Version'); ?></a></li>
+ <li><a href="<?php echo $this->url('director', array('action'=>'index')); ?>"><?php echo $this->translate('Status'); ?></a></li>
+ <li><a href="<?php echo $this->url('director', array('action'=>'messages')); ?>"><?php echo $this->translate('Messages'); ?></a></li>
+ <li><a href="<?php echo $this->url('director', array('action'=>'schedule')); ?>"><?php echo $this->translate('Schedule'); ?></a></li>
+ <li><a href="<?php echo $this->url('director', array('action'=>'schedulerstatus')); ?>"><?php echo $this->translate('Scheduler status'); ?></a></li>
+ <li class="active"><a href="<?php echo $this->url('director', array('action'=>'version')); ?>"><?php echo $this->translate('Version'); ?></a></li>
</ul>
<br />
diff --git a/module/Fileset/Module.php b/module/Fileset/Module.php
index 402e024..c4aec4f 100644
--- a/module/Fileset/Module.php
+++ b/module/Fileset/Module.php
@@ -8,35 +8,35 @@ use Fileset\Model\FilesetModel;
class Module
{
- public function getAutoloaderConfig()
- {
- return array(
- 'Zend\Loader\ClassMapAutoloader' => array(
- __DIR__ . '/autoload_classmap.php',
- ),
- 'Zend\Loader\StandardAutoloader' => array(
- 'namespaces' => array(
- __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
- ),
- ),
- );
- }
+ public function getAutoloaderConfig()
+ {
+ return array(
+ 'Zend\Loader\ClassMapAutoloader' => array(
+ __DIR__ . '/autoload_classmap.php',
+ ),
+ 'Zend\Loader\StandardAutoloader' => array(
+ 'namespaces' => array(
+ __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
+ ),
+ ),
+ );
+ }
- public function getConfig()
- {
- return include __DIR__ . '/config/module.config.php';
- }
+ public function getConfig()
+ {
+ return include __DIR__ . '/config/module.config.php';
+ }
- public function getServiceConfig()
- {
- return array(
- 'factories' => array(
- 'Fileset\Model\FilesetModel' => function() {
- $model = new FilesetModel();
- return $model;
- }
- )
- );
- }
+ public function getServiceConfig()
+ {
+ return array(
+ 'factories' => array(
+ 'Fileset\Model\FilesetModel' => function() {
+ $model = new FilesetModel();
+ return $model;
+ }
+ )
+ );
+ }
}
diff --git a/module/Fileset/config/module.config.php b/module/Fileset/config/module.config.php
index 5fcabe0..a672077 100644
--- a/module/Fileset/config/module.config.php
+++ b/module/Fileset/config/module.config.php
@@ -3,7 +3,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/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
@@ -25,40 +25,40 @@
return array(
- 'controllers' => array(
- 'invokables' => array(
- 'Fileset\Controller\Fileset' => 'Fileset\Controller\FilesetController',
- ),
- ),
- 'controller_plugins' => array(
- 'invokables' => array(
- 'SessionTimeoutPlugin' => 'Application\Controller\Plugin\SessionTimeoutPlugin',
- ),
- ),
- 'router' => array(
- 'routes' => array(
- 'fileset' => array(
- 'type' => 'segment',
- 'options' => array(
- 'route' => '/fileset[/][:action][/][:id]',
- 'constraints' => array(
- 'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
- 'id' => '[0-9]+',
- ),
- 'defaults' => array(
- 'controller' => 'Fileset\Controller\Fileset',
- 'action' => 'index',
- ),
- ),
+ 'controllers' => array(
+ 'invokables' => array(
+ 'Fileset\Controller\Fileset' => 'Fileset\Controller\FilesetController',
+ ),
+ ),
+ 'controller_plugins' => array(
+ 'invokables' => array(
+ 'SessionTimeoutPlugin' => 'Application\Controller\Plugin\SessionTimeoutPlugin',
+ ),
+ ),
+ 'router' => array(
+ 'routes' => array(
+ 'fileset' => array(
+ 'type' => 'segment',
+ 'options' => array(
+ 'route' => '/fileset[/][:action][/][:id]',
+ 'constraints' => array(
+ 'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
+ 'id' => '[0-9]+',
+ ),
+ 'defaults' => array(
+ 'controller' => 'Fileset\Controller\Fileset',
+ 'action' => 'index',
+ ),
+ ),
- ),
- ),
- ),
+ ),
+ ),
+ ),
- 'view_manager' => array(
- 'template_path_stack' => array(
- 'fileset' => __DIR__ . '/../view',
- ),
- ),
+ 'view_manager' => array(
+ 'template_path_stack' => array(
+ 'fileset' => __DIR__ . '/../view',
+ ),
+ ),
);
diff --git a/module/Fileset/src/Fileset/Controller/FilesetController.php b/module/Fileset/src/Fileset/Controller/FilesetController.php
index 99f90ed..b6722ab 100644
--- a/module/Fileset/src/Fileset/Controller/FilesetController.php
+++ b/module/Fileset/src/Fileset/Controller/FilesetController.php
@@ -32,82 +32,82 @@ use Zend\Json\Json;
class FilesetController extends AbstractActionController
{
- protected $filesetModel;
-
- public function indexAction()
- {
- if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
-
- $filesets = $this->getFilesetModel()->getFilesets();
-
- return new ViewModel(
- array(
- 'filesets' => $filesets,
- )
- );
- }
- else {
- return $this->redirect()->toRoute('auth', array('action' => 'login'));
- }
- }
-
- public function detailsAction()
- {
- if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
-
- $filesetid = $this->params()->fromRoute('id', 0);
- $fileset = $this->getFilesetModel()->getFileset($filesetid);
-
- return new ViewModel(
- array(
- 'fileset' => $fileset
- )
- );
- }
- else {
- return $this->redirect()->toRoute('auth', array('action' => 'login'));
- }
- }
-
- public function getDataAction()
- {
- if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
-
- $data = $this->params()->fromQuery('data');
- $fileset = $this->params()->fromQuery('fileset');
-
- if($data == "all") {
- $result = $this->getFilesetModel()->getFilesets();
- }
- elseif($data == "details" && isset($fileset)) {
- $result = $this->getFilesetModel()->getFileset($fileset);
- }
- else {
- $result = null;
- }
-
- $response = $this->getResponse();
- $response->getHeaders()->addHeaderLine('Content-Type', 'application/json');
-
- if(isset($result)) {
- $response->setContent(JSON::encode($result));
- }
-
- return $response;
- }
- else {
- return $this->redirect()->toRoute('auth', array('action' => 'login'));
- }
- }
-
- public function getFilesetModel()
- {
- if(!$this->filesetModel) {
- $sm = $this->getServiceLocator();
- $this->filesetModel = $sm->get('Fileset\Model\FilesetModel');
- }
- return $this->filesetModel;
- }
+ protected $filesetModel;
+
+ public function indexAction()
+ {
+ if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
+
+ $filesets = $this->getFilesetModel()->getFilesets();
+
+ return new ViewModel(
+ array(
+ 'filesets' => $filesets,
+ )
+ );
+ }
+ else {
+ return $this->redirect()->toRoute('auth', array('action' => 'login'));
+ }
+ }
+
+ public function detailsAction()
+ {
+ if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
+
+ $filesetid = $this->params()->fromRoute('id', 0);
+ $fileset = $this->getFilesetModel()->getFileset($filesetid);
+
+ return new ViewModel(
+ array(
+ 'fileset' => $fileset
+ )
+ );
+ }
+ else {
+ return $this->redirect()->toRoute('auth', array('action' => 'login'));
+ }
+ }
+
+ public function getDataAction()
+ {
+ if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
+
+ $data = $this->params()->fromQuery('data');
+ $fileset = $this->params()->fromQuery('fileset');
+
+ if($data == "all") {
+ $result = $this->getFilesetModel()->getFilesets();
+ }
+ elseif($data == "details" && isset($fileset)) {
+ $result = $this->getFilesetModel()->getFileset($fileset);
+ }
+ else {
+ $result = null;
+ }
+
+ $response = $this->getResponse();
+ $response->getHeaders()->addHeaderLine('Content-Type', 'application/json');
+
+ if(isset($result)) {
+ $response->setContent(JSON::encode($result));
+ }
+
+ return $response;
+ }
+ else {
+ return $this->redirect()->toRoute('auth', array('action' => 'login'));
+ }
+ }
+
+ public function getFilesetModel()
+ {
+ if(!$this->filesetModel) {
+ $sm = $this->getServiceLocator();
+ $this->filesetModel = $sm->get('Fileset\Model\FilesetModel');
+ }
+ return $this->filesetModel;
+ }
}
diff --git a/module/Fileset/src/Fileset/Model/Fileset.php b/module/Fileset/src/Fileset/Model/Fileset.php
index 5478e52..8923e67 100644
--- a/module/Fileset/src/Fileset/Model/Fileset.php
+++ b/module/Fileset/src/Fileset/Model/Fileset.php
@@ -3,7 +3,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/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
@@ -25,23 +25,23 @@
namespace Fileset\Model;
-class Fileset
+class Fileset
{
- public $filesetid;
- public $fileset;
- public $md5;
- public $createtime;
+ public $filesetid;
+ public $fileset;
+ public $md5;
+ public $createtime;
- public function exchangeArray($data)
- {
- $data = array_change_key_case($data, CASE_LOWER);
+ public function exchangeArray($data)
+ {
+ $data = array_change_key_case($data, CASE_LOWER);
- $this->filesetid = (!empty($data['filesetid'])) ? $data['filesetid'] : null;
- $this->fileset = (!empty($data['fileset'])) ? $data['fileset'] : null;
- $this->md5 = (!empty($data['md5'])) ? $data['md5'] : null;
- $this->createtime = (!empty($data['createtime'])) ? $data['createtime'] : null;
- }
+ $this->filesetid = (!empty($data['filesetid'])) ? $data['filesetid'] : null;
+ $this->fileset = (!empty($data['fileset'])) ? $data['fileset'] : null;
+ $this->md5 = (!empty($data['md5'])) ? $data['md5'] : null;
+ $this->createtime = (!empty($data['createtime'])) ? $data['createtime'] : null;
+ }
}
diff --git a/module/Fileset/src/Fileset/Model/FilesetModel.php b/module/Fileset/src/Fileset/Model/FilesetModel.php
index 202cea1..2ddb94c 100644
--- a/module/Fileset/src/Fileset/Model/FilesetModel.php
+++ b/module/Fileset/src/Fileset/Model/FilesetModel.php
@@ -30,43 +30,43 @@ use Zend\ServiceManager\ServiceLocatorInterface;
class FilesetModel implements ServiceLocatorAwareInterface
{
- protected $serviceLocator;
- protected $director;
+ protected $serviceLocator;
+ protected $director;
- public function __construct()
- {
- }
+ public function __construct()
+ {
+ }
- public function setServiceLocator(ServiceLocatorInterface $serviceLocator)
- {
- $this->serviceLocator = $serviceLocator;
- }
+ public function setServiceLocator(ServiceLocatorInterface $serviceLocator)
+ {
+ $this->serviceLocator = $serviceLocator;
+ }
- public function getServiceLocator()
- {
- return $this->serviceLocator;
- }
+ public function getServiceLocator()
+ {
+ return $this->serviceLocator;
+ }
- public function getFilesets()
- {
- $cmd = 'list filesets';
- $this->director = $this->getServiceLocator()->get('director');
- $result = $this->director->send_command($cmd, 2, null);
- $filesets = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
- return $filesets['result']['filesets'];
- }
+ public function getFilesets()
+ {
+ $cmd = 'list filesets';
+ $this->director = $this->getServiceLocator()->get('director');
+ $result = $this->director->send_command($cmd, 2, null);
+ $filesets = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
+ return $filesets['result']['filesets'];
+ }
- public function getFileset($id)
- {
- if(isset($id)) {
- $cmd = 'llist fileset filesetid='.$id.'';
- $this->director = $this->getServiceLocator()->get('director');
- $result = $this->director->send_command($cmd, 2, null);
- $fileset = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
- return $fileset['result']['filesets'];
- }
- else {
- return false;
- }
- }
+ public function getFileset($id)
+ {
+ if(isset($id)) {
+ $cmd = 'llist fileset filesetid='.$id.'';
+ $this->director = $this->getServiceLocator()->get('director');
+ $result = $this->director->send_command($cmd, 2, null);
+ $fileset = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
+ return $fileset['result']['filesets'];
+ }
+ else {
+ return false;
+ }
+ }
}
diff --git a/module/Fileset/view/fileset/fileset/details.phtml b/module/Fileset/view/fileset/fileset/details.phtml
index 92f1f93..c03a770 100644
--- a/module/Fileset/view/fileset/fileset/details.phtml
+++ b/module/Fileset/view/fileset/fileset/details.phtml
@@ -42,10 +42,10 @@ $this->headTitle($title);
<table class="table table-hover" id="fileset">
<thead class="bg-primary">
- <th>Id</th>
- <th>Name</th>
- <th>MD5 checksum</th>
- <th>Creation time</th>
+ <th>Id</th>
+ <th>Name</th>
+ <th>MD5 checksum</th>
+ <th>Creation time</th>
</thead>
</table>
@@ -69,53 +69,53 @@ $this->headTitle($title);
<script>
- var tab_fileset = $('#fileset').DataTable( {
- "ajax": {
- "url": "<?php echo $this->url('fileset', array('action' => 'getData'), null) . '?data=details&fileset='.$this->fileset[0]['filesetid']; ?>",
- "dataSrc": ""
- },
- "columns": [
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null }
- ],
- "paging": false,
- "ordering": false,
- "info": false,
- "pagingType": "full_numbers",
- "stateSave": true,
- "bFilter": false,
- "columnDefs": [
- {
- "targets": 0,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.filesetid;
- }
- },
- {
- "targets": 1,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.fileset;
- }
- },
- {
- "targets": 2,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.md5;
- }
- },
- {
- "targets": 3,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.createtime;
- }
- }
- ]
- } );
+ var tab_fileset = $('#fileset').DataTable( {
+ "ajax": {
+ "url": "<?php echo $this->url('fileset', array('action' => 'getData'), null) . '?data=details&fileset='.$this->fileset[0]['filesetid']; ?>",
+ "dataSrc": ""
+ },
+ "columns": [
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null }
+ ],
+ "paging": false,
+ "ordering": false,
+ "info": false,
+ "pagingType": "full_numbers",
+ "stateSave": true,
+ "bFilter": false,
+ "columnDefs": [
+ {
+ "targets": 0,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.filesetid;
+ }
+ },
+ {
+ "targets": 1,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.fileset;
+ }
+ },
+ {
+ "targets": 2,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.md5;
+ }
+ },
+ {
+ "targets": 3,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.createtime;
+ }
+ }
+ ]
+ } );
</Script>
diff --git a/module/Fileset/view/fileset/fileset/index.phtml b/module/Fileset/view/fileset/fileset/index.phtml
index e346207..9a2f370 100644
--- a/module/Fileset/view/fileset/fileset/index.phtml
+++ b/module/Fileset/view/fileset/fileset/index.phtml
@@ -42,9 +42,9 @@ $this->headTitle($title);
<table class="table table-hover" id="filesets">
<thead class="bg-primary">
- <th><?php echo $this->translate("Id"); ?></th>
- <th><?php echo $this->translate("Name"); ?></th>
- <th><?php echo $this->translate("Creation time"); ?></th>
+ <th><?php echo $this->translate("Id"); ?></th>
+ <th><?php echo $this->translate("Name"); ?></th>
+ <th><?php echo $this->translate("Creation time"); ?></th>
</thead>
</table>
@@ -62,44 +62,44 @@ $this->headTitle($title);
<script>
- var tab_filesets = $('#filesets').DataTable( {
- "ajax": {
- "url": "<?php echo $this->url('fileset', array('action' => 'getData'), null) . '?data=all'; ?>",
- "dataSrc": ""
- },
- "columns": [
- { "data": null },
- { "data": null },
- { "data": null },
- ],
- "paging": true,
- "ordering": true,
- "info": true,
- "pagingType": "full_numbers",
- "stateSave": true,
- "columnDefs": [
- {
- "targets": 0,
- "data": null,
- "render": function(data, type, full, meta) {
- return '<a href="<?php echo $this->basePath() . '/fileset/details/'; ?>'+data.filesetid+'">'+data.filesetid+'</a>';
- }
- },
- {
- "targets": 1,
- "data": null,
- "render": function(data, type, full, meta) {
- return '<a href="<?php echo $this->basePath() . '/fileset/details/'; ?>'+data.filesetid+'">'+data.fileset+'</a>';
- }
- },
- {
- "targets": 2,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.createtime;
- }
- }
- ]
- } );
+ var tab_filesets = $('#filesets').DataTable( {
+ "ajax": {
+ "url": "<?php echo $this->url('fileset', array('action' => 'getData'), null) . '?data=all'; ?>",
+ "dataSrc": ""
+ },
+ "columns": [
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ ],
+ "paging": true,
+ "ordering": true,
+ "info": true,
+ "pagingType": "full_numbers",
+ "stateSave": true,
+ "columnDefs": [
+ {
+ "targets": 0,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return '<a href="<?php echo $this->basePath() . '/fileset/details/'; ?>'+data.filesetid+'">'+data.filesetid+'</a>';
+ }
+ },
+ {
+ "targets": 1,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return '<a href="<?php echo $this->basePath() . '/fileset/details/'; ?>'+data.filesetid+'">'+data.fileset+'</a>';
+ }
+ },
+ {
+ "targets": 2,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.createtime;
+ }
+ }
+ ]
+ } );
</script>
diff --git a/module/Job/Module.php b/module/Job/Module.php
index aa79f09..fcfa056 100644
--- a/module/Job/Module.php
+++ b/module/Job/Module.php
@@ -8,35 +8,35 @@ use Job\Model\JobModel;
class Module
{
- public function getAutoloaderConfig()
- {
- return array(
- 'Zend\Loader\ClassMapAutoloader' => array(
- __DIR__ . '/autoload_classmap.php',
- ),
- 'Zend\Loader\StandardAutoloader' => array(
- 'namespaces' => array(
- __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
- ),
- ),
- );
- }
+ public function getAutoloaderConfig()
+ {
+ return array(
+ 'Zend\Loader\ClassMapAutoloader' => array(
+ __DIR__ . '/autoload_classmap.php',
+ ),
+ 'Zend\Loader\StandardAutoloader' => array(
+ 'namespaces' => array(
+ __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
+ ),
+ ),
+ );
+ }
- public function getConfig()
- {
- return include __DIR__ . '/config/module.config.php';
- }
+ public function getConfig()
+ {
+ return include __DIR__ . '/config/module.config.php';
+ }
- public function getServiceConfig()
- {
- return array(
- 'factories' => array(
- 'Job\Model\JobModel' => function() {
- $model = new JobModel();
- return $model;
- }
- )
- );
- }
+ public function getServiceConfig()
+ {
+ return array(
+ 'factories' => array(
+ 'Job\Model\JobModel' => function() {
+ $model = new JobModel();
+ return $model;
+ }
+ )
+ );
+ }
}
diff --git a/module/Job/config/module.config.php b/module/Job/config/module.config.php
index 1361d03..21e99b0 100644
--- a/module/Job/config/module.config.php
+++ b/module/Job/config/module.config.php
@@ -25,40 +25,40 @@
return array(
- 'controllers' => array(
- 'invokables' => array(
- 'Job\Controller\Job' => 'Job\Controller\JobController',
- ),
- ),
- 'controller_plugins' => array(
- 'invokables' => array(
- 'SessionTimeoutPlugin' => 'Application\Controller\Plugin\SessionTimeoutPlugin',
- ),
- ),
- 'router' => array(
- 'routes' => array(
- 'job' => array(
- 'type' => 'segment',
- 'options' => array(
- 'route' => '/job[/][:action][/][:id]',
- 'constraints' => array(
- 'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
- 'id' => '[0-9]+',
- ),
- 'defaults' => array(
- 'controller' => 'Job\Controller\Job',
- 'action' => 'index',
- ),
- ),
- ),
- ),
- ),
+ 'controllers' => array(
+ 'invokables' => array(
+ 'Job\Controller\Job' => 'Job\Controller\JobController',
+ ),
+ ),
+ 'controller_plugins' => array(
+ 'invokables' => array(
+ 'SessionTimeoutPlugin' => 'Application\Controller\Plugin\SessionTimeoutPlugin',
+ ),
+ ),
+ 'router' => array(
+ 'routes' => array(
+ 'job' => array(
+ 'type' => 'segment',
+ 'options' => array(
+ 'route' => '/job[/][:action][/][:id]',
+ 'constraints' => array(
+ 'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
+ 'id' => '[0-9]+',
+ ),
+ 'defaults' => array(
+ 'controller' => 'Job\Controller\Job',
+ 'action' => 'index',
+ ),
+ ),
+ ),
+ ),
+ ),
- 'view_manager' => array(
- 'template_path_stack' => array(
- 'job' => __DIR__ . '/../view',
- ),
- ),
+ 'view_manager' => array(
+ 'template_path_stack' => array(
+ 'job' => __DIR__ . '/../view',
+ ),
+ ),
);
diff --git a/module/Job/src/Job/Controller/JobController.php b/module/Job/src/Job/Controller/JobController.php
index cd9681b..2f6f302 100644
--- a/module/Job/src/Job/Controller/JobController.php
+++ b/module/Job/src/Job/Controller/JobController.php
@@ -34,242 +34,242 @@ use Job\Form\JobForm;
class JobController extends AbstractActionController
{
- protected $jobModel;
+ protected $jobModel;
- public function indexAction()
- {
- if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
+ public function indexAction()
+ {
+ if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
- $status = "all";
- $period = 7;
+ $status = "all";
+ $period = 7;
- $period = $this->params()->fromQuery('period') ? $this->params()->fromQuery('period') : '7';
- $status = $this->params()->fromQuery('status') ? $this->params()->fromQUery('status') : 'all';
+ $period = $this->params()->fromQuery('period') ? $this->params()->fromQuery('period') : '7';
+ $status = $this->params()->fromQuery('status') ? $this->params()->fromQUery('status') : 'all';
- $form = new JobForm($period, $status);
+ $form = new JobForm($period, $status);
- return new ViewModel(
- array(
- 'form' => $form,
- 'status' => $status,
- 'period' => $period
- )
- );
- }
- else {
- return $this->redirect()->toRoute('auth', array('action' => 'login'));
- }
- }
+ return new ViewModel(
+ array(
+ 'form' => $form,
+ 'status' => $status,
+ 'period' => $period
+ )
+ );
+ }
+ else {
+ return $this->redirect()->toRoute('auth', array('action' => 'login'));
+ }
+ }
- public function detailsAction()
- {
- if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
+ public function detailsAction()
+ {
+ if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
- $jobid = (int) $this->params()->fromRoute('id', 0);
- $job = $this->getJobModel()->getJob($jobid);
- $joblog = $this->getJobModel()->getJobLog($jobid);
+ $jobid = (int) $this->params()->fromRoute('id', 0);
+ $job = $this->getJobModel()->getJob($jobid);
+ $joblog = $this->getJobModel()->getJobLog($jobid);
- return new ViewModel(array(
- 'job' => $job,
- 'joblog' => $joblog,
- 'jobid' => $jobid
- ));
- }
- else {
- return $this->redirect()->toRoute('auth', array('action' => 'login'));
- }
- }
+ return new ViewModel(array(
+ 'job' => $job,
+ 'joblog' => $joblog,
+ 'jobid' => $jobid
+ ));
+ }
+ else {
+ return $this->redirect()->toRoute('auth', array('action' => 'login'));
+ }
+ }
- public function runningAction()
- {
- if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
+ public function runningAction()
+ {
+ if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
- $jobs_R = $this->getJobModel()->getJobsByStatus('R', null, null);
- $jobs_l = $this->getJobModel()->getJobsByStatus('l', null, null);
+ $jobs_R = $this->getJobModel()->getJobsByStatus('R', null, null);
+ $jobs_l = $this->getJobModel()->getJobsByStatus('l', null, null);
- $jobs = array_merge($jobs_R, $jobs_l);
+ $jobs = array_merge($jobs_R, $jobs_l);
- return new ViewModel(
- array(
- 'jobs' => $jobs
- )
- );
- }
- else {
- return $this->redirect()->toRoute('auth', array('action' => 'login'));
- }
- }
+ return new ViewModel(
+ array(
+ 'jobs' => $jobs
+ )
+ );
+ }
+ else {
+ return $this->redirect()->toRoute('auth', array('action' => 'login'));
+ }
+ }
- public function waitingAction()
- {
- if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
- return new ViewModel();
- }
- else {
- return $this->redirect()->toRoute('auth', array('action' => 'login'));
- }
- }
+ public function waitingAction()
+ {
+ if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
+ return new ViewModel();
+ }
+ else {
+ return $this->redirect()->toRoute('auth', array('action' => 'login'));
+ }
+ }
- public function unsuccessfulAction()
- {
- if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
- return new ViewModel();
- }
- else {
- return $this->redirect()->toRoute('auth', array('action' => 'login'));
- }
- }
+ public function unsuccessfulAction()
+ {
+ if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
+ return new ViewModel();
+ }
+ else {
+ return $this->redirect()->toRoute('auth', array('action' => 'login'));
+ }
+ }
- public function successfulAction()
- {
- if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
- return new ViewModel();
- }
- else {
- return $this->redirect()->toRoute('auth', array('action' => 'login'));
- }
- }
+ public function successfulAction()
+ {
+ if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
+ return new ViewModel();
+ }
+ else {
+ return $this->redirect()->toRoute('auth', array('action' => 'login'));
+ }
+ }
- public function rerunAction()
- {
- if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
- $jobid = (int) $this->params()->fromRoute('id', 0);
- $result = $this->getJobModel()->rerunJob($jobid);
- return new ViewModel(
- array(
- 'bconsoleOutput' => $result,
- 'jobid' => $jobid,
- )
- );
- }
- else {
- return $this->redirect()->toRoute('auth', array('action' => 'login'));
- }
- }
+ public function rerunAction()
+ {
+ if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
+ $jobid = (int) $this->params()->fromRoute('id', 0);
+ $result = $this->getJobModel()->rerunJob($jobid);
+ return new ViewModel(
+ array(
+ 'bconsoleOutput' => $result,
+ 'jobid' => $jobid,
+ )
+ );
+ }
+ else {
+ return $this->redirect()->toRoute('auth', array('action' => 'login'));
+ }
+ }
- public function cancelAction()
- {
- if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
- $jobid = (int) $this->params()->fromRoute('id', 0);
- $result = $this->getJobModel()->cancelJob($jobid);
- return new ViewModel(
- array(
- 'bconsoleOutput' => $result
- )
- );
- }
- else {
- return $this->redirect()->toRoute('auth', array('action' => 'login'));
- }
- }
+ public function cancelAction()
+ {
+ if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
+ $jobid = (int) $this->params()->fromRoute('id', 0);
+ $result = $this->getJobModel()->cancelJob($jobid);
+ return new ViewModel(
+ array(
+ 'bconsoleOutput' => $result
+ )
+ );
+ }
+ else {
+ return $this->redirect()->toRoute('auth', array('action' => 'login'));
+ }
+ }
- public function runAction()
- {
- if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
- return new ViewModel();
- }
- else {
- return $this->redirect()->toRoute('auth', array('action' => 'login'));
- }
- }
+ public function runAction()
+ {
+ if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
+ return new ViewModel();
+ }
+ else {
+ return $this->redirect()->toRoute('auth', array('action' => 'login'));
+ }
+ }
- public function queueAction()
- {
- if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
- $jobname = $this->params()->fromQuery('job');
- $result = $this->getJobModel()->runJob($jobname);
- return new ViewModel(
- array(
- 'result' => $result
- )
- );
- }
- else {
- return $this->redirect()->toRoute('auth', array('action' => 'login'));
- }
- }
+ public function queueAction()
+ {
+ if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
+ $jobname = $this->params()->fromQuery('job');
+ $result = $this->getJobModel()->runJob($jobname);
+ return new ViewModel(
+ array(
+ 'result' => $result
+ )
+ );
+ }
+ else {
+ return $this->redirect()->toRoute('auth', array('action' => 'login'));
+ }
+ }
- public function getDataAction()
- {
- if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
+ public function getDataAction()
+ {
+ if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
- $data = $this->params()->fromQuery('data');
- $jobid = $this->params()->fromQuery('jobid');
- $status = $this->params()->fromQuery('status');
- $period = $this->params()->fromQuery('period');
+ $data = $this->params()->fromQuery('data');
+ $jobid = $this->params()->fromQuery('jobid');
+ $status = $this->params()->fromQuery('status');
+ $period = $this->params()->fromQuery('period');
- if($data == "jobs" && $status == "all") {
- $result = $this->getJobModel()->getJobs($status, $period);
- }
- elseif($data == "jobs" && $status == "successful") {
- $jobs_T = $this->getJobModel()->getJobsByStatus('T', $period, null); // Terminated
- $jobs_W = $this->getJobModel()->getJobsByStatus('W', $period, null); // Terminated with warnings
- $result = array_merge($jobs_T, $jobs_W);
- }
- elseif($data == "jobs" && $status == "unsuccessful") {
- $jobs_A = $this->getJobModel()->getJobsByStatus('A', $period, null); // Canceled jobs
- $jobs_E = $this->getJobModel()->getJobsByStatus('E', $period, null); //
- $jobs_e = $this->getJobModel()->getJobsByStatus('e', $period, null); //
- $jobs_f = $this->getJobModel()->getJobsByStatus('f', $period, null); //
- $result = array_merge($jobs_A, $jobs_E, $jobs_e, $jobs_f);
- }
- elseif($data == "jobs" && $status == "running") {
- $jobs_R = $this->getJobModel()->getJobsByStatus('R', $period, null);
- $jobs_l = $this->getJobModel()->getJobsByStatus('l', $period, null);
- $result = array_merge($jobs_R, $jobs_l);
- }
- elseif($data == "jobs" && $status == "waiting") {
- $jobs_F = $this->getJobModel()->getJobsByStatus('F', $period, null);
- $jobs_S = $this->getJobModel()->getJobsByStatus('S', $period, null);
- $jobs_m = $this->getJobModel()->getJobsByStatus('m', $period, null);
- $jobs_M = $this->getJobModel()->getJobsByStatus('M', $period, null);
- $jobs_s = $this->getJobModel()->getJobsByStatus('s', $period, null);
- $jobs_j = $this->getJobModel()->getJobsByStatus('j', $period, null);
- $jobs_c = $this->getJobModel()->getJobsByStatus('c', $period, null);
- $jobs_d = $this->getJobModel()->getJobsByStatus('d', $period, null);
- $jobs_t = $this->getJobModel()->getJobsByStatus('t', $period, null);
- $jobs_p = $this->getJobModel()->getJobsByStatus('p', $period, null);
- $jobs_q = $this->getJobModel()->getJobsByStatus('q', $period, null);
- $jobs_C = $this->getJobModel()->getJobsByStatus('C', $period, null);
- $result = array_merge(
- $jobs_F,$jobs_S,$jobs_m,$jobs_M,
- $jobs_s,$jobs_j,$jobs_c,$jobs_d,
- $jobs_t,$jobs_p,$jobs_q,$jobs_C
- );
- }
- elseif($data == "backupjobs") {
- $result = $this->getJobModel()->getBackupJobs();
- }
- elseif($data == "details") {
- $result = $this->getJobModel()->getJob($jobid);
- }
- elseif($data == "logs" && isset($jobid)) {
- $result = $this->getJobModel()->getJobLog($jobid);
- }
- else {
- $result = null;
- }
+ if($data == "jobs" && $status == "all") {
+ $result = $this->getJobModel()->getJobs($status, $period);
+ }
+ elseif($data == "jobs" && $status == "successful") {
+ $jobs_T = $this->getJobModel()->getJobsByStatus('T', $period, null); // Terminated
+ $jobs_W = $this->getJobModel()->getJobsByStatus('W', $period, null); // Terminated with warnings
+ $result = array_merge($jobs_T, $jobs_W);
+ }
+ elseif($data == "jobs" && $status == "unsuccessful") {
+ $jobs_A = $this->getJobModel()->getJobsByStatus('A', $period, null); // Canceled jobs
+ $jobs_E = $this->getJobModel()->getJobsByStatus('E', $period, null); //
+ $jobs_e = $this->getJobModel()->getJobsByStatus('e', $period, null); //
+ $jobs_f = $this->getJobModel()->getJobsByStatus('f', $period, null); //
+ $result = array_merge($jobs_A, $jobs_E, $jobs_e, $jobs_f);
+ }
+ elseif($data == "jobs" && $status == "running") {
+ $jobs_R = $this->getJobModel()->getJobsByStatus('R', $period, null);
+ $jobs_l = $this->getJobModel()->getJobsByStatus('l', $period, null);
+ $result = array_merge($jobs_R, $jobs_l);
+ }
+ elseif($data == "jobs" && $status == "waiting") {
+ $jobs_F = $this->getJobModel()->getJobsByStatus('F', $period, null);
+ $jobs_S = $this->getJobModel()->getJobsByStatus('S', $period, null);
+ $jobs_m = $this->getJobModel()->getJobsByStatus('m', $period, null);
+ $jobs_M = $this->getJobModel()->getJobsByStatus('M', $period, null);
+ $jobs_s = $this->getJobModel()->getJobsByStatus('s', $period, null);
+ $jobs_j = $this->getJobModel()->getJobsByStatus('j', $period, null);
+ $jobs_c = $this->getJobModel()->getJobsByStatus('c', $period, null);
+ $jobs_d = $this->getJobModel()->getJobsByStatus('d', $period, null);
+ $jobs_t = $this->getJobModel()->getJobsByStatus('t', $period, null);
+ $jobs_p = $this->getJobModel()->getJobsByStatus('p', $period, null);
+ $jobs_q = $this->getJobModel()->getJobsByStatus('q', $period, null);
+ $jobs_C = $this->getJobModel()->getJobsByStatus('C', $period, null);
+ $result = array_merge(
+ $jobs_F,$jobs_S,$jobs_m,$jobs_M,
+ $jobs_s,$jobs_j,$jobs_c,$jobs_d,
+ $jobs_t,$jobs_p,$jobs_q,$jobs_C
+ );
+ }
+ elseif($data == "backupjobs") {
+ $result = $this->getJobModel()->getBackupJobs();
+ }
+ elseif($data == "details") {
+ $result = $this->getJobModel()->getJob($jobid);
+ }
+ elseif($data == "logs" && isset($jobid)) {
+ $result = $this->getJobModel()->getJobLog($jobid);
+ }
+ else {
+ $result = null;
+ }
- $response = $this->getResponse();
- $response->getHeaders()->addHeaderLine('Content-Type', 'application/json');
+ $response = $this->getResponse();
+ $response->getHeaders()->addHeaderLine('Content-Type', 'application/json');
- if(isset($result)) {
- $response->setContent(JSON::encode($result));
- }
+ if(isset($result)) {
+ $response->setContent(JSON::encode($result));
+ }
- return $response;
- }
- else {
- return $this->redirect()->toRoute('auth', array('action' => 'login'));
- }
- }
+ return $response;
+ }
+ else {
+ return $this->redirect()->toRoute('auth', array('action' => 'login'));
+ }
+ }
- public function getJobModel()
- {
- if(!$this->jobModel) {
- $sm = $this->getServiceLocator();
- $this->jobModel = $sm->get('Job\Model\JobModel');
- }
- return $this->jobModel;
- }
+ public function getJobModel()
+ {
+ if(!$this->jobModel) {
+ $sm = $this->getServiceLocator();
+ $this->jobModel = $sm->get('Job\Model\JobModel');
+ }
+ return $this->jobModel;
+ }
}
diff --git a/module/Job/src/Job/Form/JobForm.php b/module/Job/src/Job/Form/JobForm.php
index 41106c4..cb905f2 100644
--- a/module/Job/src/Job/Form/JobForm.php
+++ b/module/Job/src/Job/Form/JobForm.php
@@ -31,63 +31,63 @@ use Zend\Form\Element;
class JobForm extends Form
{
- protected $period;
- protected $status;
+ protected $period;
+ protected $status;
- public function __construct($period=null, $status=null)
- {
- parent::__construct('job');
+ public function __construct($period=null, $status=null)
+ {
+ parent::__construct('job');
- $this->period = $period;
- $this->status = $status;
+ $this->period = $period;
+ $this->status = $status;
- if(isset($period)) {
- $this->add(array(
- 'name' => 'period',
- 'type' => 'select',
- 'options' => array(
- 'label' => 'Time period',
- 'value_options' => array(
- '1' => 'past 24 hours',
- '7' => 'last week',
- '31' => 'last month',
- '365' => 'last year',
- 'all' => 'all'
- )
- ),
- 'attributes' => array(
- 'class' => 'form-control selectpicker show-tick',
- 'data-size' => '5',
- 'id' => 'period',
- 'value' => $period
- )
- ));
- }
+ if(isset($period)) {
+ $this->add(array(
+ 'name' => 'period',
+ 'type' => 'select',
+ 'options' => array(
+ 'label' => 'Time period',
+ 'value_options' => array(
+ '1' => 'past 24 hours',
+ '7' => 'last week',
+ '31' => 'last month',
+ '365' => 'last year',
+ 'all' => 'all'
+ )
+ ),
+ 'attributes' => array(
+ 'class' => 'form-control selectpicker show-tick',
+ 'data-size' => '5',
+ 'id' => 'period',
+ 'value' => $period
+ )
+ ));
+ }
- if(isset($status)) {
- $this->add(array(
- 'name' => 'status',
- 'type' => 'select',
- 'options' => array(
- 'label' => 'Status',
- 'value_options' => array(
- 'all' => 'all',
- 'running' => 'running',
- 'waiting' => 'waiting',
- 'unsuccessful' => 'unsuccessful',
- 'successful' => 'successful'
- )
- ),
- 'attributes' => array(
- 'class' => 'form-control selectpicker show-tick',
- 'data-size' => '5',
- 'id' => 'status',
- 'value' => $status
- )
- ));
- }
+ if(isset($status)) {
+ $this->add(array(
+ 'name' => 'status',
+ 'type' => 'select',
+ 'options' => array(
+ 'label' => 'Status',
+ 'value_options' => array(
+ 'all' => 'all',
+ 'running' => 'running',
+ 'waiting' => 'waiting',
+ 'unsuccessful' => 'unsuccessful',
+ 'successful' => 'successful'
+ )
+ ),
+ 'attributes' => array(
+ 'class' => 'form-control selectpicker show-tick',
+ 'data-size' => '5',
+ 'id' => 'status',
+ 'value' => $status
+ )
+ ));
+ }
- }
+ }
}
diff --git a/module/Job/src/Job/Model/JobModel.php b/module/Job/src/Job/Model/JobModel.php
index 6a8808a..7f154fc 100644
--- a/module/Job/src/Job/Model/JobModel.php
+++ b/module/Job/src/Job/Model/JobModel.php
@@ -30,150 +30,150 @@ use Zend\ServiceManager\ServiceLocatorInterface;
class JobModel implements ServiceLocatorAwareInterface
{
- protected $serviceLocator;
- protected $director;
-
- public function __constructor()
- {
- }
-
- public function setServiceLocator(ServiceLocatorInterface $serviceLocator)
- {
- $this->serviceLocator = $serviceLocator;
- }
-
- public function getServiceLocator()
- {
- return $this->serviceLocator;
- }
-
- public function getJobs($status=null, $period=null)
- {
- if($period == "all") {
- $cmd = 'llist jobs';
- }
- else {
- $cmd = 'llist jobs days='.$period;
- }
-
- $this->director = $this->getServiceLocator()->get('director');
- $result = $this->director->send_command($cmd, 2, null);
- if(preg_match('/Failed to send result as json. Maybe result message to long?/', $result)) {
- //return false;
- $error = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
- return $error['result']['error'];
- }
- else {
- $jobs = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
- return $jobs['result']['jobs'];
- }
- }
-
- public function getJobsByStatus($status=null, $days=null, $hours=null)
- {
- if(isset($status)) {
- if(isset($days)) {
- if($days == "all") {
- $cmd = 'llist jobs jobstatus='.$status.'';
- }
- else {
- $cmd = 'llist jobs jobstatus='.$status.' days='.$days.'';
- }
- }
- elseif(isset($hours)) {
- if($hours == "all") {
- $cmd = 'llist jobs jobstatus='.$status.'';
- }
- else {
- $cmd = 'llist jobs jobstatus='.$status.' hours='.$hours.'';
- }
- }
- else {
- $cmd = 'llist jobs jobstatus='.$status.'';
- }
- $this->director = $this->getServiceLocator()->get('director');
- $result = $this->director->send_command($cmd, 2, null);
- $jobs = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
- return array_reverse($jobs['result']['jobs']);
- }
- else {
- return false;
- }
- }
-
- public function getJob($id=null)
- {
- if(isset($id)) {
- $cmd = 'llist jobid='.$id.'';
- $this->director = $this->getServiceLocator()->get('director');
- $result = $this->director->send_command($cmd, 2, null);
- $job = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
- return $job['result']['jobs'];
- }
- else {
- return false;
- }
- }
-
- public function getJobLog($id=null)
- {
- if(isset($id)) {
- $cmd = 'list joblog jobid='.$id.'';
- $this->director = $this->getServiceLocator()->get('director');
- $result = $this->director->send_command($cmd, 2, null);
- $log = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
- return $log['result']['joblog'];
- }
- else {
- return false;
- }
- }
-
- public function getBackupJobs()
- {
- $cmd = '.jobs type=B';
- $this->director = $this->getServiceLocator()->get('director');
- $result = $this->director->send_command($cmd, 2, null);
- $jobs = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
- return $jobs['result']['jobs'];
- }
-
- public function runJob($name=null)
- {
- if(isset($name)) {
- $cmd = 'run job="'.$name.'" yes';
- $this->director = $this->getServiceLocator()->get('director');
- $result = $this->director->send_command($cmd, 0, null);
- return $result;
- }
- else {
- return false;
- }
- }
-
- public function rerunJob($id=null)
- {
- if(isset($id)) {
- $cmd = 'rerun jobid='.$id.' yes';
- $this->director = $this->getServiceLocator()->get('director');
- $result = $this->director->send_command($cmd, 0, null);
- return $result;
- }
- else {
- return false;
- }
- }
-
- public function cancelJob($id=null)
- {
- if(isset($id)) {
- $cmd = 'cancel jobid='.$id.' yes';
- $this->director = $this->getServiceLocator()->get('director');
- $result = $this->director->send_command($cmd, 0, null);
- return $result;
- }
- else {
- return false;
- }
- }
+ protected $serviceLocator;
+ protected $director;
+
+ public function __constructor()
+ {
+ }
+
+ public function setServiceLocator(ServiceLocatorInterface $serviceLocator)
+ {
+ $this->serviceLocator = $serviceLocator;
+ }
+
+ public function getServiceLocator()
+ {
+ return $this->serviceLocator;
+ }
+
+ public function getJobs($status=null, $period=null)
+ {
+ if($period == "all") {
+ $cmd = 'llist jobs';
+ }
+ else {
+ $cmd = 'llist jobs days='.$period;
+ }
+
+ $this->director = $this->getServiceLocator()->get('director');
+ $result = $this->director->send_command($cmd, 2, null);
+ if(preg_match('/Failed to send result as json. Maybe result message to long?/', $result)) {
+ //return false;
+ $error = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
+ return $error['result']['error'];
+ }
+ else {
+ $jobs = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
+ return $jobs['result']['jobs'];
+ }
+ }
+
+ public function getJobsByStatus($status=null, $days=null, $hours=null)
+ {
+ if(isset($status)) {
+ if(isset($days)) {
+ if($days == "all") {
+ $cmd = 'llist jobs jobstatus='.$status.'';
+ }
+ else {
+ $cmd = 'llist jobs jobstatus='.$status.' days='.$days.'';
+ }
+ }
+ elseif(isset($hours)) {
+ if($hours == "all") {
+ $cmd = 'llist jobs jobstatus='.$status.'';
+ }
+ else {
+ $cmd = 'llist jobs jobstatus='.$status.' hours='.$hours.'';
+ }
+ }
+ else {
+ $cmd = 'llist jobs jobstatus='.$status.'';
+ }
+ $this->director = $this->getServiceLocator()->get('director');
+ $result = $this->director->send_command($cmd, 2, null);
+ $jobs = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
+ return array_reverse($jobs['result']['jobs']);
+ }
+ else {
+ return false;
+ }
+ }
+
+ public function getJob($id=null)
+ {
+ if(isset($id)) {
+ $cmd = 'llist jobid='.$id.'';
+ $this->director = $this->getServiceLocator()->get('director');
+ $result = $this->director->send_command($cmd, 2, null);
+ $job = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
+ return $job['result']['jobs'];
+ }
+ else {
+ return false;
+ }
+ }
+
+ public function getJobLog($id=null)
+ {
+ if(isset($id)) {
+ $cmd = 'list joblog jobid='.$id.'';
+ $this->director = $this->getServiceLocator()->get('director');
+ $result = $this->director->send_command($cmd, 2, null);
+ $log = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
+ return $log['result']['joblog'];
+ }
+ else {
+ return false;
+ }
+ }
+
+ public function getBackupJobs()
+ {
+ $cmd = '.jobs type=B';
+ $this->director = $this->getServiceLocator()->get('director');
+ $result = $this->director->send_command($cmd, 2, null);
+ $jobs = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
+ return $jobs['result']['jobs'];
+ }
+
+ public function runJob($name=null)
+ {
+ if(isset($name)) {
+ $cmd = 'run job="'.$name.'" yes';
+ $this->director = $this->getServiceLocator()->get('director');
+ $result = $this->director->send_command($cmd, 0, null);
+ return $result;
+ }
+ else {
+ return false;
+ }
+ }
+
+ public function rerunJob($id=null)
+ {
+ if(isset($id)) {
+ $cmd = 'rerun jobid='.$id.' yes';
+ $this->director = $this->getServiceLocator()->get('director');
+ $result = $this->director->send_command($cmd, 0, null);
+ return $result;
+ }
+ else {
+ return false;
+ }
+ }
+
+ public function cancelJob($id=null)
+ {
+ if(isset($id)) {
+ $cmd = 'cancel jobid='.$id.' yes';
+ $this->director = $this->getServiceLocator()->get('director');
+ $result = $this->director->send_command($cmd, 0, null);
+ return $result;
+ }
+ else {
+ return false;
+ }
+ }
}
diff --git a/module/Job/view/job/job/cancel.phtml b/module/Job/view/job/job/cancel.phtml
index 3098746..a8a13c1 100644
--- a/module/Job/view/job/job/cancel.phtml
+++ b/module/Job/view/job/job/cancel.phtml
@@ -3,7 +3,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/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
diff --git a/module/Job/view/job/job/details.phtml b/module/Job/view/job/job/details.phtml
index 910763b..c092873 100644
--- a/module/Job/view/job/job/details.phtml
+++ b/module/Job/view/job/job/details.phtml
@@ -4,10 +4,10 @@
*
* bareos-webui - Bareos Web-Frontend
*
- * @link https://github.com/bareos/bareos-webui for the canonical source repository
- * @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
+ * @link https://github.com/bareos/bareos-webui for the canonical source repository
+ * @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
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -45,13 +45,13 @@ $this->headTitle($title);
<table class="table table-hover" id="jobdetails1">
<thead class="bg-primary">
- <th>Job</th>
- <th>Name</th>
- <th>Client</th>
- <th>Fileset</th>
- <th>Type</th>
- <th>Level</th>
- <th>Pool</th>
+ <th>Job</th>
+ <th>Name</th>
+ <th>Client</th>
+ <th>Fileset</th>
+ <th>Type</th>
+ <th>Level</th>
+ <th>Pool</th>
</thead>
</table>
@@ -59,10 +59,10 @@ $this->headTitle($title);
<table class="table table-hover" id="jobdetails2">
<thead class="bg-primary">
- <th>Scheduled start</th>
- <th>Real start</th>
- <th>End</th>
- <th>Real end</th>
+ <th>Scheduled start</th>
+ <th>Real start</th>
+ <th>End</th>
+ <th>Real end</th>
</thead>
</table>
@@ -70,10 +70,10 @@ $this->headTitle($title);
<table class="table table-hover" id="jobdetails3">
<thead class="bg-primary">
- <th>Files</th>
- <th>Bytes</th>
- <th>Errors</th>
- <th>Status</th>
+ <th>Files</th>
+ <th>Bytes</th>
+ <th>Errors</th>
+ <th>Status</th>
</thead>
</table>
@@ -98,10 +98,10 @@ $this->headTitle($title);
<table class="table table-hover" id="joblog">
- <thead class="bg-primary">
- <th>Timestamp</th>
- <th>Message</th>
- </thead>
+ <thead class="bg-primary">
+ <th>Timestamp</th>
+ <th>Message</th>
+ </thead>
</table>
@@ -112,400 +112,398 @@ $this->headTitle($title);
<?php
- echo $this->headScript()->prependFile($this->basePath() . '/js/jquery.dataTables.min.js');
- echo $this->headScript()->prependFile($this->basePath() . '/js/dataTables.bootstrap.min.js');
- echo $this->headLink()->prependStylesheet($this->basePath() . '/css/dataTables.bootstrap.min.css');
+ echo $this->headScript()->prependFile($this->basePath() . '/js/jquery.dataTables.min.js');
+ echo $this->headScript()->prependFile($this->basePath() . '/js/dataTables.bootstrap.min.js');
+ echo $this->headLink()->prependStylesheet($this->basePath() . '/css/dataTables.bootstrap.min.css');
?>
<script>
$(document).ready(function() {
- var jobdetails1 = $('#jobdetails1').DataTable( {
- "ajax": {
- "url": "<?php echo $this->url('job', array('action' => 'getData'), null) . '?data=details&jobid='.$this->jobid; ?>",
- "dataSrc": ""
- },
- "columns": [
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null }
- ],
- "paging": false,
- "ordering": false,
- "info": false,
- "pagingType": "full_numbers",
- "stateSave": true,
- "bFilter": false,
- "columnDefs": [
- {
- "targets": 0,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.jobid;
- }
- },
- {
- "targets": 1,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.name;
- }
- },
- {
- "targets": 2,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.client;
- }
- },
- {
- "targets": 3,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.fileset;
- }
- },
- {
- "targets": 4,
- "data": null,
- "render": function(data, type, full, meta) {
- var output;
- switch(data.type) {
- case 'B':
- output = 'Backup';
- break;
- case 'M':
- output = 'Migrated';
- break;
- case 'V':
- output = 'Verify';
- break;
- case 'R':
- output = 'Restore';
- break;
- case 'U':
- output = 'Console program';
- break;
- case 'I':
- output = 'Internal system job';
- break;
- case 'D':
- output = 'Admin';
- break;
- case 'A':
- output = 'Archive';
- break;
- case 'C':
- output = 'Copy of a job';
- break;
- case 'c':
- output = 'Copy job';
- break;
- case 'g':
- output = 'Migration job';
- break;
- case 'S':
- output = 'Scan';
- break;
- default:
- output = data.type;
- break;
- }
- return output;
- }
- },
- {
- "targets": 5,
- "data": null,
- "render": function(data, type, full, meta) {
- if(data.level == "F") {
- return 'Full';
- }
- else if(data.level == "D") {
- return 'Differential';
- }
- else if(data.level == "I") {
- return 'Incremental';
- }
- else {
- return data.level;
- }
- }
- },
- {
- "targets": 6,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.poolname;
- }
- },
- ]
- } );
-
- var jobdetails2 = $('#jobdetails2').DataTable( {
- "ajax": {
- "url": "<?php echo $this->url('job', array('action' => 'getData'), null) . '?data=details&jobid='.$this->jobid; ?>",
- "dataSrc": ""
- },
- "columns": [
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null }
- ],
- "paging": false,
- "ordering": false,
- "info": false,
- "pagingType": "full_numbers",
- "stateSave": true,
- "bFilter": false,
- "columnDefs": [
- {
- "targets": 0,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.schedtime;
- }
- },
- {
- "targets": 1,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.starttime;
- }
- },
- {
- "targets": 2,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.endtime;
- }
- },
- {
- "targets": 3,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.realendtime;
- }
- }
- ]
- } );
-
- var jobdetails3 = $('#jobdetails3').DataTable( {
- "ajax": {
- "url": "<?php echo $this->url('job', array('action' => 'getData'), null) . '?data=details&jobid='.$this->jobid; ?>",
- "dataSrc": ""
- },
- "columns": [
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null }
- ],
- "paging": false,
- "ordering": false,
- "info": false,
- "pagingType": "full_numbers",
- "stateSave": true,
- "bFilter": false,
- "columnDefs": [
- {
- "targets": 0,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.jobfiles;
- }
- },
- {
- "targets": 1,
- "data": null,
- "render": function(data, type, full, meta) {
- if(data.jobbytes == 0) return "0.00 B";
- var k = 1000;
- var units = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB"];
- var i = Math.floor(Math.log(data.jobbytes) / Math.log(k));
- return parseFloat((data.jobbytes / Math.pow(k, i)).toFixed(2)) + " " + units[i];
- }
- },
- {
- "targets": 2,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.joberrors;
- }
- },
- {
- "targets": 3,
- "data": null,
- "render": function(data, type, full, meta) {
-
- var output;
-
- switch(data.jobstatus) {
- // Non-fatal error
- case 'e':
- output = '<span class="label label-danger">Failure</span>';
- break;
- // Terminated with errors
- case 'E':
- output = '<span class="label label-danger">Failure</span>';
- break;
- // Fatal error
- case 'f':
- output = '<span class="label label-danger">Failure</span>';
- break;
- // Terminated successful
- case 'T':
- output = '<span class="label label-success">Success</span>';
- break;
- // Running
- case 'R':
- output = '<span class="label label-info">Running</span>';
- break;
- // Created no yet running
- case 'C':
- output = '<span class="label label-default">Queued</span>';
- break;
- // Blocked
- case 'B':
- output = '<span class="label label-warning">Blocked</span>';
- break;
- // Verify found differences
- case 'D':
- output = '<span class="label label-warning">Verify found differences</span>';
- break;
- // Canceled by user
- case 'A':
- output = '<span class="label label-warning">Canceled</span>';
- break;
- // Waiting for client
- case 'F':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting for storage daemon
- case 'S':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting for new media
- case 'm':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting for media mount
- case 'M':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting for storage resource
- case 's':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting for job resource
- case 'j':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting for client resource
- case 'c':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting on maximum jobs
- case 'd':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting on starttime
- case 't':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting on higher priority jobs
- case 'p':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // SD despooling attributes
- case 'a':
- output = '<span class="label label-info">SD despooling attributes</span>';
- break;
- // Doing batch insert file records
- case 'i':
- output = '<span class="label label-info">Doing batch insert file records</span>';
- break;
- // Incomplete
- case 'I':
- output = '<span class="label label-primary">Incomplete</span>';
- break;
- // Committing data
- case 'L':
- output = '<span class="label label-info">Committing data</span>';
- break;
- // Terminated with warnings
- case 'W':
- output = '<span class="label label-warning">Warning</span>';
- break;
- // Doing data despooling
- case 'l':
- output = '<span class="label label-info">Doing data despooling</span>';
- break;
- // Queued waiting for device
- case 'q':
- output = '<span class="label label-default">Queued waiting for device</span>';
- break;
- // Default
- default:
- output = '<span class="label label-primary">' + data.jobStatus + '</span>';
- break;
- }
-
- return output;
- }
- }
- ]
- } );
-
- var joblog = $('#joblog').DataTable( {
- "ajax": {
- "url": "<?php echo $this->url('job', array('action' => 'getData'), null) . '?data=logs&jobid='.$this->jobid; ?>",
- "dataSrc": ""
- },
- "columns": [
- { "data": null },
- { "data": null }
- ],
- "paging": true,
- "ordering": true,
- "info": true,
- "pagingType": "full_numbers",
- "stateSave": true,
- "columnDefs": [
- {
- "targets": 0,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.time;
- }
- },
- {
- "targets": 1,
- "data": null,
- "render": function(data, type, full, meta) {
- var msg = (data.logtext).replace(/\n/g, "<br />");
- if(msg.search("Error") > 0) {
- return msg.replace(/Error/g, '<span class="bg-danger text-danger">Error</span>');
- }
- else if(msg.search("error") > 0) {
- return msg.replace(/error/g, '<span class="bg-danger text-danger">error</span>');
- }
- else if(msg.search("Warning") > 0) {
- return msg.replace(/Warning/g, '<span class="bg-warning text-warning">Warning</span>');
- }
- else {
- return msg;
- }
- }
- }
- ]
- } );
+ var jobdetails1 = $('#jobdetails1').DataTable( {
+ "ajax": {
+ "url": "<?php echo $this->url('job', array('action' => 'getData'), null) . '?data=details&jobid='.$this->jobid; ?>",
+ "dataSrc": ""
+ },
+ "columns": [
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null }
+ ],
+ "paging": false,
+ "ordering": false,
+ "info": false,
+ "pagingType": "full_numbers",
+ "stateSave": true,
+ "bFilter": false,
+ "columnDefs": [
+ {
+ "targets": 0,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.jobid;
+ }
+ },
+ {
+ "targets": 1,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.name;
+ }
+ },
+ {
+ "targets": 2,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.client;
+ }
+ },
+ {
+ "targets": 3,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.fileset;
+ }
+ },
+ {
+ "targets": 4,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ var output;
+ switch(data.type) {
+ case 'B':
+ output = 'Backup';
+ break;
+ case 'M':
+ output = 'Migrated';
+ break;
+ case 'V':
+ output = 'Verify';
+ break;
+ case 'R':
+ output = 'Restore';
+ break;
+ case 'U':
+ output = 'Console program';
+ break;
+ case 'I':
+ output = 'Internal system job';
+ break;
+ case 'D':
+ output = 'Admin';
+ break;
+ case 'A':
+ output = 'Archive';
+ break;
+ case 'C':
+ output = 'Copy of a job';
+ break;
+ case 'c':
+ output = 'Copy job';
+ break;
+ case 'g':
+ output = 'Migration job';
+ break;
+ case 'S':
+ output = 'Scan';
+ break;
+ default:
+ output = data.type;
+ break;
+ }
+ return output;
+ }
+ },
+ {
+ "targets": 5,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ switch(data.level) {
+ case 'F':
+ return 'Full';
+ case 'D':
+ return 'Differential';
+ case 'I':
+ return 'Incremental';
+ default:
+ return data.level;
+ }
+ }
+ },
+ {
+ "targets": 6,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.poolname;
+ }
+ },
+ ]
+ } );
+
+ var jobdetails2 = $('#jobdetails2').DataTable( {
+ "ajax": {
+ "url": "<?php echo $this->url('job', array('action' => 'getData'), null) . '?data=details&jobid='.$this->jobid; ?>",
+ "dataSrc": ""
+ },
+ "columns": [
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null }
+ ],
+ "paging": false,
+ "ordering": false,
+ "info": false,
+ "pagingType": "full_numbers",
+ "stateSave": true,
+ "bFilter": false,
+ "columnDefs": [
+ {
+ "targets": 0,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.schedtime;
+ }
+ },
+ {
+ "targets": 1,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.starttime;
+ }
+ },
+ {
+ "targets": 2,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.endtime;
+ }
+ },
+ {
+ "targets": 3,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.realendtime;
+ }
+ }
+ ]
+ } );
+
+ var jobdetails3 = $('#jobdetails3').DataTable( {
+ "ajax": {
+ "url": "<?php echo $this->url('job', array('action' => 'getData'), null) . '?data=details&jobid='.$this->jobid; ?>",
+ "dataSrc": ""
+ },
+ "columns": [
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null }
+ ],
+ "paging": false,
+ "ordering": false,
+ "info": false,
+ "pagingType": "full_numbers",
+ "stateSave": true,
+ "bFilter": false,
+ "columnDefs": [
+ {
+ "targets": 0,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.jobfiles;
+ }
+ },
+ {
+ "targets": 1,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ if(data.jobbytes == 0) return "0.00 B";
+ var k = 1000;
+ var units = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB"];
+ var i = Math.floor(Math.log(data.jobbytes) / Math.log(k));
+ return parseFloat((data.jobbytes / Math.pow(k, i)).toFixed(2)) + " " + units[i];
+ }
+ },
+ {
+ "targets": 2,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.joberrors;
+ }
+ },
+ {
+ "targets": 3,
+ "data": null,
+ "render": function(data, type, full, meta) {
+
+ var output;
+
+ switch(data.jobstatus) {
+ // Non-fatal error
+ case 'e':
+ output = '<span class="label label-danger">Failure</span>';
+ break;
+ // Terminated with errors
+ case 'E':
+ output = '<span class="label label-danger">Failure</span>';
+ break;
+ // Fatal error
+ case 'f':
+ output = '<span class="label label-danger">Failure</span>';
+ break;
+ // Terminated successful
+ case 'T':
+ output = '<span class="label label-success">Success</span>';
+ break;
+ // Running
+ case 'R':
+ output = '<span class="label label-info">Running</span>';
+ break;
+ // Created no yet running
+ case 'C':
+ output = '<span class="label label-default">Queued</span>';
+ break;
+ // Blocked
+ case 'B':
+ output = '<span class="label label-warning">Blocked</span>';
+ break;
+ // Verify found differences
+ case 'D':
+ output = '<span class="label label-warning">Verify found differences</span>';
+ break;
+ // Canceled by user
+ case 'A':
+ output = '<span class="label label-warning">Canceled</span>';
+ break;
+ // Waiting for client
+ case 'F':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting for storage daemon
+ case 'S':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting for new media
+ case 'm':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting for media mount
+ case 'M':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting for storage resource
+ case 's':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting for job resource
+ case 'j':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting for client resource
+ case 'c':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting on maximum jobs
+ case 'd':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting on starttime
+ case 't':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting on higher priority jobs
+ case 'p':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // SD despooling attributes
+ case 'a':
+ output = '<span class="label label-info">SD despooling attributes</span>';
+ break;
+ // Doing batch insert file records
+ case 'i':
+ output = '<span class="label label-info">Doing batch insert file records</span>';
+ break;
+ // Incomplete
+ case 'I':
+ output = '<span class="label label-primary">Incomplete</span>';
+ break;
+ // Committing data
+ case 'L':
+ output = '<span class="label label-info">Committing data</span>';
+ break;
+ // Terminated with warnings
+ case 'W':
+ output = '<span class="label label-warning">Warning</span>';
+ break;
+ // Doing data despooling
+ case 'l':
+ output = '<span class="label label-info">Doing data despooling</span>';
+ break;
+ // Queued waiting for device
+ case 'q':
+ output = '<span class="label label-default">Queued waiting for device</span>';
+ break;
+ // Default
+ default:
+ output = '<span class="label label-primary">' + data.jobStatus + '</span>';
+ break;
+ }
+
+ return output;
+ }
+ }
+ ]
+ } );
+
+ var joblog = $('#joblog').DataTable( {
+ "ajax": {
+ "url": "<?php echo $this->url('job', array('action' => 'getData'), null) . '?data=logs&jobid='.$this->jobid; ?>",
+ "dataSrc": ""
+ },
+ "columns": [
+ { "data": null },
+ { "data": null }
+ ],
+ "paging": true,
+ "ordering": true,
+ "info": true,
+ "pagingType": "full_numbers",
+ "stateSave": true,
+ "columnDefs": [
+ {
+ "targets": 0,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.time;
+ }
+ },
+ {
+ "targets": 1,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ var msg = (data.logtext).replace(/\n/g, "<br />");
+ if(msg.search("Error") > 0) {
+ return msg.replace(/Error/g, '<span class="bg-danger text-danger">Error</span>');
+ }
+ else if(msg.search("error") > 0) {
+ return msg.replace(/error/g, '<span class="bg-danger text-danger">error</span>');
+ }
+ else if(msg.search("Warning") > 0) {
+ return msg.replace(/Warning/g, '<span class="bg-warning text-warning">Warning</span>');
+ }
+ else {
+ return msg;
+ }
+ }
+ }
+ ]
+ } );
} );
diff --git a/module/Job/view/job/job/index.phtml b/module/Job/view/job/job/index.phtml
index 000a254..7ac8d80 100644
--- a/module/Job/view/job/job/index.phtml
+++ b/module/Job/view/job/job/index.phtml
@@ -30,8 +30,8 @@ $this->headTitle($title);
?>
<ul class="nav nav-tabs">
- <li class="active"><a href="<?php echo $this->url('job', array('action'=>'index')); ?>"><?php echo $this->translate('Overview'); ?></a></li>
- <li><a href="<?php echo $this->url('job', array('action'=>'run')); ?>"><?php echo $this->translate('Run'); ?></a></li>
+ <li class="active"><a href="<?php echo $this->url('job', array('action'=>'index')); ?>"><?php echo $this->translate('Overview'); ?></a></li>
+ <li><a href="<?php echo $this->url('job', array('action'=>'run')); ?>"><?php echo $this->translate('Run'); ?></a></li>
</ul>
<br />
@@ -39,11 +39,11 @@ $this->headTitle($title);
<div class="row">
<div class="col-md-3">
- <?php echo $this->formRow($form->get('period')); ?>
+ <?php echo $this->formRow($form->get('period')); ?>
</div>
<div class="col-md-3">
- <?php echo $this->formRow($form->get('status')); ?>
+ <?php echo $this->formRow($form->get('status')); ?>
</div>
</div>
@@ -65,18 +65,18 @@ $this->headTitle($title);
<table class="table table-hover" id="jobtable">
<thead class="bg-primary">
- <th></th>
- <th><?php echo $this->translate("Job"); ?></th>
- <th><?php echo $this->translate("Name"); ?></th>
- <th><?php echo $this->translate("Client"); ?></th>
- <th><?php echo $this->translate("Type"); ?></th>
- <th><?php echo $this->translate("Level"); ?></th>
- <th><?php echo $this->translate("Start"); ?></th>
- <th><?php echo $this->translate("End"); ?></th>
- <!--<th><?php echo $this->translate("Files"); ?></th>-->
- <!--<th><?php echo $this->translate("Bytes"); ?></th>-->
- <th><?php echo $this->translate("Status"); ?></th>
- <th><?php echo $this->translate("Actions"); ?></th>
+ <th></th>
+ <th><?php echo $this->translate("Job"); ?></th>
+ <th><?php echo $this->translate("Name"); ?></th>
+ <th><?php echo $this->translate("Client"); ?></th>
+ <th><?php echo $this->translate("Type"); ?></th>
+ <th><?php echo $this->translate("Level"); ?></th>
+ <th><?php echo $this->translate("Start"); ?></th>
+ <th><?php echo $this->translate("End"); ?></th>
+ <!--<th><?php echo $this->translate("Files"); ?></th>-->
+ <!--<th><?php echo $this->translate("Bytes"); ?></th>-->
+ <th><?php echo $this->translate("Status"); ?></th>
+ <th><?php echo $this->translate("Actions"); ?></th>
</thead>
</table>
@@ -96,17 +96,17 @@ $this->headTitle($title);
<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">Failed to retrieve data from Bareos director</h4>
+ <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">Failed to retrieve data from Bareos director</h4>
</div>
<div class="modal-body">
- <p>Please try to reduce the amount of data to display, e.g. reduce time period.</p>
- <p>Error message received from director:</p>
- <p class="text-danger">Failed to send result as json. Maybe result message to long?</p>
+ <p>Please try to reduce the amount of data to display, e.g. reduce time period.</p>
+ <p>Error message received from director:</p>
+ <p class="text-danger">Failed to send result as json. Maybe result message to long?</p>
</div>
<div class="modal-footer">
- <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
+ <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
@@ -133,401 +133,400 @@ tr.shown td.details-control:after {
function format( d ) {
- if(d.jobbytes == 0) {
- var b = "-";
- }
- else {
- var k = 1000;
- var units = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB"];
- var i = Math.floor(Math.log(d.jobbytes) / Math.log(k));
- var b = parseFloat((d.jobbytes / Math.pow(k, i)).toFixed(2)) + " " + units[i];
- }
-
- return '<table class="table table-bordered">'+
- '<tr>'+
- '<th>Files</th>'+
- '<td>'+ d.jobfiles +'</td>'+
- '</tr>'+
- '<tr>'+
- '<th>Bytes</th>'+
- '<td>'+ b +'</td>'+
- '</tr>'+
- '<tr>'+
- '<th>Errors</th>'+
- '<td>'+ d.joberrors +'</td>'+
- '</tr>'+
- '</table>';
+ if(d.jobbytes == 0) {
+ var b = "-";
+ }
+ else {
+ var k = 1000;
+ var units = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB"];
+ var i = Math.floor(Math.log(d.jobbytes) / Math.log(k));
+ var b = parseFloat((d.jobbytes / Math.pow(k, i)).toFixed(2)) + " " + units[i];
+ }
+
+ return '<table class="table table-bordered">'+
+ '<tr>'+
+ '<th>Files</th>'+
+ '<td>'+ d.jobfiles +'</td>'+
+ '</tr>'+
+ '<tr>'+
+ '<th>Bytes</th>'+
+ '<td>'+ b +'</td>'+
+ '</tr>'+
+ '<tr>'+
+ '<th>Errors</th>'+
+ '<td>'+ d.joberrors +'</td>'+
+ '</tr>'+
+ '</table>';
}
function updateQueryParams(k, v)
{
- var p = [];
- var params = [];
+ var p = [];
+ var params = [];
- p['status'] = '<?php echo $this->status; ?>';
- p['period'] = '<?php echo $this->period; ?>';
+ p['status'] = '<?php echo $this->status; ?>';
+ p['period'] = '<?php echo $this->period; ?>';
- if(k == 'status' && v == 'running') {
- p['period'] = 'all';
- }
- else if(k == 'status' && v == 'waiting') {
- p['period'] = 'all';
- }
+ if(k == 'status' && v == 'running') {
+ p['period'] = 'all';
+ }
+ else if(k == 'status' && v == 'waiting') {
+ p['period'] = 'all';
+ }
- p[k] = v;
+ p[k] = v;
- for(key in p) {
- params.push(key + "=" + p[key]);
- }
+ for(key in p) {
+ params.push(key + "=" + p[key]);
+ }
- return params.join('&');
+ return params.join('&');
}
$(document).ready(function() {
- var table = $('#jobtable').DataTable( {
- "ajax": {
- "url": "<?php echo $this->url('job', array('action' => 'getData'), null) . '?data=jobs&status='.$this->status.'&period='.$this->period; ?>",
- "dataSrc": ""
- },
- "columns": [
- {
- "className": 'details-control',
- "data": null,
- "orderable": false,
- "defaultContent": ''
- },
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null },
- //{ "data": null },
- //{ "data": null },
- { "data": null },
- {
- "orderable": false,
- "data": null
- }
- ],
- "paging": true,
- "ordering": true,
- "info": true,
- "pagingType": "full_numbers",
- "stateSave": true,
- "columnDefs": [
- {
- "targets": 1,
- "data": null,
- "render": function(data, type, full, meta) {
- return '<a href="<?php echo $this->basePath() . '/job/details/'; ?>'+data.jobid+'">'+data.jobid+'</a>';
- }
- },
- {
- "targets": 2,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.name;
- }
- },
- {
- "targets": 3,
- "data": null,
- "render": function(data, type, full, meta) {
- return '<a href="<?php echo $this->basePath() . '/client/details/'; ?>'+data.client+'">'+data.client+'</a>';
- }
- },
- {
- "targets": 4,
- "data": null,
- "render": function(data, type, full, meta) {
- var output;
- switch(data.type) {
- case 'B':
- output = 'Backup';
- break;
- case 'M':
- output = 'Migrated';
- break;
- case 'V':
- output = 'Verify';
- break;
- case 'R':
- output = 'Restore';
- break;
- case 'U':
- output = 'Console program';
- break;
- case 'I':
- output = 'Internal system job';
- break;
- case 'D':
- output = 'Admin';
- break;
- case 'A':
- output = 'Archive';
- break;
- case 'C':
- output = 'Copy of a job';
- break;
- case 'c':
- output = 'Copy job';
- break;
- case 'g':
- output = 'Migration job';
- break;
- case 'S':
- output = 'Scan';
- break;
- default:
- output = data.type;
- break;
- }
- return output;
- }
- },
- {
- "targets": 5,
- "data": null,
- "render": function(data, type, full, meta) {
- if(data.level == "F") {
- return 'Full';
- }
- else if(data.level == "D") {
- return 'Differential';
- }
- else if(data.level == "I") {
- return 'Incremental';
- }
- else {
- return data.level;
- }
- }
- },
- {
- "targets": 6,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.starttime;
- }
- },
- {
- "targets": 7,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.endtime;
- }
- },
- /*{
- "targets": 7,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.jobfiles;
- }
- },
- {
- "targets": 8,
- "data": null,
- "render": function(data, type, full, meta) {
- if(data.jobbytes == 0) return "0.00 B";
- var k = 1000;
- var units = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB"];
- var i = Math.floor(Math.log(data.jobbytes) / Math.log(k));
- return parseFloat((data.jobbytes / Math.pow(k, i)).toFixed(2)) + " " + units[i];
- }
- },*/
- {
- "targets": 8,
- "data": null,
- "render": function(data, type, full, meta) {
-
- var output;
-
- switch(data.jobstatus) {
-
- // Non-fatal error
- case 'e':
- output = '<span class="label label-danger">Failure</span>';
- break;
- // Terminated with errors
- case 'E':
- output = '<span class="label label-danger">Failure</span>';
- break;
- // Fatal error
- case 'f':
- output = '<span class="label label-danger">Failure</span>';
- break;
- // Terminated successful
- case 'T':
- output = '<span class="label label-success">Success</span>';
- break;
- // Running
- case 'R':
- output = '<span class="label label-info">Running</span>';
- break;
- // Created no yet running
- case 'C':
- output = '<span class="label label-default">Queued</span>';
- break;
- // Blocked
- case 'B':
- output = '<span class="label label-warning">Blocked</span>';
- break;
- // Verify found differences
- case 'D':
- output = '<span class="label label-warning">Verify found differences</span>';
- break;
- // Canceled by user
- case 'A':
- output = '<span class="label label-warning">Canceled</span>';
- break;
- // Waiting for client
- case 'F':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting for storage daemon
- case 'S':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting for new media
- case 'm':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting for media mount
- case 'M':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting for storage resource
- case 's':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting for job resource
- case 'j':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting for client resource
- case 'c':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting on maximum jobs
- case 'd':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting on starttime
- case 't':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting on higher priority jobs
- case 'p':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // SD despooling attributes
- case 'a':
- output = '<span class="label label-info">SD despooling attributes</span>';
- break;
- // Doing batch insert file records
- case 'i':
- output = '<span class="label label-info">Doing batch insert file records</span>';
- break;
- // Incomplete
- case 'I':
- output = '<span class="label label-primary">Incomplete</span>';
- break;
- // Committing data
- case 'L':
- output = '<span class="label label-info">Committing data</span>';
- break;
- // Terminated with warnings
- case 'W':
- output = '<span class="label label-warning">Warning</span>';
- break;
- // Doing data despooling
- case 'l':
- output = '<span class="label label-info">Doing data despooling</span>';
- break;
- // Queued waiting for device
- case 'q':
- output = '<span class="label label-default">Queued waiting for device</span>';
- break;
- // Default
- default:
- output = '<span class="label label-primary">' + data.jobStatus + '</span>';
- break;
- }
-
- return output;
- }
-
- },
- {
- "targets": 9,
- "data": null,
- "render": function(data, type, full, meta) {
- if(data.type == 'B') {
- if(data.jobstatus == 'T' || data.jobstatus == 'E' || data.jobstatus == 'e' || data.jobstatus == 'f' || data.jobstatus == 'A') {
- return '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath() . '/job/rerun/'; ?>'+data.jobid+'" title="Rerun" id="btn-1"><span class="glyphicon glyphicon-repeat"></span></a>';
- }
- else if(
- data.jobstatus == 'F' ||
- data.jobstatus == 'S' ||
- data.jobstatus == 'm' ||
- data.jobstatus == 'M' ||
- data.jobstatus == 's' ||
- data.jobstatus == 'j' ||
- data.jobstatus == 'c' ||
- data.jobstatus == 'd' ||
- data.jobstatus == 't' ||
- data.jobstatus == 'p' ||
- data.jobstatus == 'q' ||
- data.jobstatus == 'C' ||
- data.jobstatus == 'R' ||
- data.jobstatus == 'l'
- ) {
- return '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath() . '/job/cancel/'; ?>'+data.jobid+'" title="Cancel" id="btn-1"><span class="glyphicon glyphicon-trash"></span></a>';
- }
- }
- return '';
- }
- }
- ]
- } );
-
- $('#jobtable tbody').on('click', 'td.details-control', function () {
- var tr = $(this).closest('tr');
- var row = table.row( tr );
- if ( row.child.isShown() ) {
- // This row is already open - close it
- row.child.hide();
- tr.removeClass('shown');
- }
- else {
- // Open this row
- row.child( format(row.data()) ).show();
- tr.addClass('shown');
- }
- } );
-
- $('#jobtable tbody').on('mouseover', '#btn-1', function () {
- $('[data-toggle="tooltip"]').tooltip();
- });
-
- $('#period').change(function(event) {
- window.location.href = window.location.pathname + '?' + updateQueryParams('period', this.value);
- });
-
- $('#status').change(function(event) {
- window.location.href = window.location.pathname + '?' + updateQueryParams('status', this.value);
- });
-
- $.fn.dataTable.ext.errMode = 'throw';
-
- $('#jobtable').on('error.dt', function(e, settings, techNote, message) {
- $("#modal-001").modal();
- });
+ var table = $('#jobtable').DataTable( {
+ "ajax": {
+ "url": "<?php echo $this->url('job', array('action' => 'getData'), null) . '?data=jobs&status='.$this->status.'&period='.$this->period; ?>",
+ "dataSrc": ""
+ },
+ "columns": [
+ {
+ "className": 'details-control',
+ "data": null,
+ "orderable": false,
+ "defaultContent": ''
+ },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ //{ "data": null },
+ //{ "data": null },
+ { "data": null },
+ {
+ "orderable": false,
+ "data": null
+ }
+ ],
+ "paging": true,
+ "ordering": true,
+ "info": true,
+ "pagingType": "full_numbers",
+ "stateSave": true,
+ "columnDefs": [
+ {
+ "targets": 1,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return '<a href="<?php echo $this->basePath() . '/job/details/'; ?>'+data.jobid+'">'+data.jobid+'</a>';
+ }
+ },
+ {
+ "targets": 2,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.name;
+ }
+ },
+ {
+ "targets": 3,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return '<a href="<?php echo $this->basePath() . '/client/details/'; ?>'+data.client+'">'+data.client+'</a>';
+ }
+ },
+ {
+ "targets": 4,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ var output;
+ switch(data.type) {
+ case 'B':
+ output = 'Backup';
+ break;
+ case 'M':
+ output = 'Migrated';
+ break;
+ case 'V':
+ output = 'Verify';
+ break;
+ case 'R':
+ output = 'Restore';
+ break;
+ case 'U':
+ output = 'Console program';
+ break;
+ case 'I':
+ output = 'Internal system job';
+ break;
+ case 'D':
+ output = 'Admin';
+ break;
+ case 'A':
+ output = 'Archive';
+ break;
+ case 'C':
+ output = 'Copy of a job';
+ break;
+ case 'c':
+ output = 'Copy job';
+ break;
+ case 'g':
+ output = 'Migration job';
+ break;
+ case 'S':
+ output = 'Scan';
+ break;
+ default:
+ output = data.type;
+ break;
+ }
+ return output;
+ }
+ },
+ {
+ "targets": 5,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ switch(data.level) {
+ case 'F':
+ return 'Full';
+ case 'D':
+ return 'Differential';
+ case 'I':
+ return 'Incremental';
+ default:
+ return data.level;
+ }
+ }
+ },
+ {
+ "targets": 6,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.starttime;
+ }
+ },
+ {
+ "targets": 7,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.endtime;
+ }
+ },
+ /*{
+ "targets": 7,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.jobfiles;
+ }
+ },
+ {
+ "targets": 8,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ if(data.jobbytes == 0) return "0.00 B";
+ var k = 1000;
+ var units = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB"];
+ var i = Math.floor(Math.log(data.jobbytes) / Math.log(k));
+ return parseFloat((data.jobbytes / Math.pow(k, i)).toFixed(2)) + " " + units[i];
+ }
+ },*/
+ {
+ "targets": 8,
+ "data": null,
+ "render": function(data, type, full, meta) {
+
+ var output;
+
+ switch(data.jobstatus) {
+ // Non-fatal error
+ case 'e':
+ output = '<span class="label label-danger">Failure</span>';
+ break;
+ // Terminated with errors
+ case 'E':
+ output = '<span class="label label-danger">Failure</span>';
+ break;
+ // Fatal error
+ case 'f':
+ output = '<span class="label label-danger">Failure</span>';
+ break;
+ // Terminated successful
+ case 'T':
+ output = '<span class="label label-success">Success</span>';
+ break;
+ // Running
+ case 'R':
+ output = '<span class="label label-info">Running</span>';
+ break;
+ // Created no yet running
+ case 'C':
+ output = '<span class="label label-default">Queued</span>';
+ break;
+ // Blocked
+ case 'B':
+ output = '<span class="label label-warning">Blocked</span>';
+ break;
+ // Verify found differences
+ case 'D':
+ output = '<span class="label label-warning">Verify found differences</span>';
+ break;
+ // Canceled by user
+ case 'A':
+ output = '<span class="label label-warning">Canceled</span>';
+ break;
+ // Waiting for client
+ case 'F':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting for storage daemon
+ case 'S':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting for new media
+ case 'm':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting for media mount
+ case 'M':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting for storage resource
+ case 's':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting for job resource
+ case 'j':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting for client resource
+ case 'c':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting on maximum jobs
+ case 'd':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting on starttime
+ case 't':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting on higher priority jobs
+ case 'p':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // SD despooling attributes
+ case 'a':
+ output = '<span class="label label-info">SD despooling attributes</span>';
+ break;
+ // Doing batch insert file records
+ case 'i':
+ output = '<span class="label label-info">Doing batch insert file records</span>';
+ break;
+ // Incomplete
+ case 'I':
+ output = '<span class="label label-primary">Incomplete</span>';
+ break;
+ // Committing data
+ case 'L':
+ output = '<span class="label label-info">Committing data</span>';
+ break;
+ // Terminated with warnings
+ case 'W':
+ output = '<span class="label label-warning">Warning</span>';
+ break;
+ // Doing data despooling
+ case 'l':
+ output = '<span class="label label-info">Doing data despooling</span>';
+ break;
+ // Queued waiting for device
+ case 'q':
+ output = '<span class="label label-default">Queued waiting for device</span>';
+ break;
+ // Default
+ default:
+ output = '<span class="label label-primary">' + data.jobStatus + '</span>';
+ break;
+ }
+
+ return output;
+ }
+
+ },
+ {
+ "targets": 9,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ if(data.type == 'B') {
+ switch(data.jobstatus) {
+ case 'T':
+ case 'E':
+ case 'e':
+ case 'f':
+ case 'A':
+ return '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath() . '/job/rerun/'; ?>'+data.jobid+'" title="Rerun" id="btn-1"><span class="glyphicon glyphicon-repeat"></span></a>';
+ case 'F':
+ case 'S':
+ case 'm':
+ case 'M':
+ case 's':
+ case 'j':
+ case 'c':
+ case 'd':
+ case 't':
+ case 'p':
+ case 'q':
+ case 'C':
+ case 'R':
+ case 'l':
+ return '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath() . '/job/cancel/'; ?>'+data.jobid+'" title="Cancel" id="btn-1"><span class="glyphicon glyphicon-trash"></span></a>';
+ }
+ }
+ return '';
+ }
+ }
+ ]
+ } );
+
+ $('#jobtable tbody').on('click', 'td.details-control', function () {
+ var tr = $(this).closest('tr');
+ var row = table.row( tr );
+ if ( row.child.isShown() ) {
+ // This row is already open - close it
+ row.child.hide();
+ tr.removeClass('shown');
+ }
+ else {
+ // Open this row
+ row.child( format(row.data()) ).show();
+ tr.addClass('shown');
+ }
+ } );
+
+ $('#jobtable tbody').on('mouseover', '#btn-1', function () {
+ $('[data-toggle="tooltip"]').tooltip();
+ });
+
+ $('#period').change(function(event) {
+ window.location.href = window.location.pathname + '?' + updateQueryParams('period', this.value);
+ });
+
+ $('#status').change(function(event) {
+ window.location.href = window.location.pathname + '?' + updateQueryParams('status', this.value);
+ });
+
+ $.fn.dataTable.ext.errMode = 'throw';
+
+ $('#jobtable').on('error.dt', function(e, settings, techNote, message) {
+ $("#modal-001").modal();
+ });
} );
diff --git a/module/Job/view/job/job/rerun.phtml b/module/Job/view/job/job/rerun.phtml
index 1c7b78c..32ab404 100644
--- a/module/Job/view/job/job/rerun.phtml
+++ b/module/Job/view/job/job/rerun.phtml
@@ -3,7 +3,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/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
diff --git a/module/Job/view/job/job/run.phtml b/module/Job/view/job/job/run.phtml
index 022db31..f7b73a2 100644
--- a/module/Job/view/job/job/run.phtml
+++ b/module/Job/view/job/job/run.phtml
@@ -30,8 +30,8 @@ $this->headTitle($title);
?>
<ul class="nav nav-tabs">
- <li><a href="<?php echo $this->url('job', array('action'=>'index')); ?>"><?php echo $this->translate('Overview'); ?></a></li>
- <li class="active"><a href="<?php echo $this->url('job', array('action'=>'run')); ?>"><?php echo $this->translate('Run'); ?></a></li>
+ <li><a href="<?php echo $this->url('job', array('action'=>'index')); ?>"><?php echo $this->translate('Overview'); ?></a></li>
+ <li class="active"><a href="<?php echo $this->url('job', array('action'=>'run')); ?>"><?php echo $this->translate('Run'); ?></a></li>
</ul>
<br />
@@ -49,10 +49,10 @@ $this->headTitle($title);
<div class="panel-body">
<table class="table table-hover" id="backupjobs">
- <thead class="bg-primary">
- <th><?php echo $this->translate("Name"); ?></th>
- <th><?php echo $this->translate("Actions"); ?></th>
- </thead>
+ <thead class="bg-primary">
+ <th><?php echo $this->translate("Name"); ?></th>
+ <th><?php echo $this->translate("Actions"); ?></th>
+ </thead>
</table>
</div>
@@ -68,45 +68,45 @@ $this->headTitle($title);
<script>
- $('#backupjobs').DataTable( {
- "ajax": {
- "url": "<?php echo $this->url('job', array('action' => 'getData'), null) . '?data=backupjobs'; ?>",
- "dataSrc": ""
- },
- "columns" : [
- {
- "data": null
- },
- {
- "orderable": false,
- "data": null
- }
- ],
- "paging": true,
- "ordering": true,
- "info": true,
- "pagingType": "full_numbers",
- "stateSave": true,
- "columnDefs": [
- {
- "targets": 0,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.name;
- }
- },
- {
- "targets": 1,
- "data": null,
- "render": function(data, type, full, meta) {
- return '<a href="<?php echo $this->basePath() . '/job/queue?job='; ?>'+data.name+'"><button type="button" class="btn btn-default btn-xs" id="btn-1" data-toggle="tooltip" data-placement="top" title="Run"><span class="glyphicon glyphicon-play-circle"></span></button></a>';
- }
- }
- ]
- } );
-
- $('#backupjobs tbody').on('mouseover', '#btn-1', function () {
- $('[data-toggle="tooltip"]').tooltip();
- } );
+ $('#backupjobs').DataTable( {
+ "ajax": {
+ "url": "<?php echo $this->url('job', array('action' => 'getData'), null) . '?data=backupjobs'; ?>",
+ "dataSrc": ""
+ },
+ "columns" : [
+ {
+ "data": null
+ },
+ {
+ "orderable": false,
+ "data": null
+ }
+ ],
+ "paging": true,
+ "ordering": true,
+ "info": true,
+ "pagingType": "full_numbers",
+ "stateSave": true,
+ "columnDefs": [
+ {
+ "targets": 0,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.name;
+ }
+ },
+ {
+ "targets": 1,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return '<a href="<?php echo $this->basePath() . '/job/queue?job='; ?>'+data.name+'"><button type="button" class="btn btn-default btn-xs" id="btn-1" data-toggle="tooltip" data-placement="top" title="Run"><span class="glyphicon glyphicon-play-circle"></span></button></a>';
+ }
+ }
+ ]
+ } );
+
+ $('#backupjobs tbody').on('mouseover', '#btn-1', function () {
+ $('[data-toggle="tooltip"]').tooltip();
+ } );
</script>
diff --git a/module/Job/view/job/job/running.phtml b/module/Job/view/job/job/running.phtml
index e6fef42..e805fda 100644
--- a/module/Job/view/job/job/running.phtml
+++ b/module/Job/view/job/job/running.phtml
@@ -30,13 +30,13 @@ $this->headTitle($title);
?>
<ul class="nav nav-tabs">
- <li><a href="<?php echo $this->url('job', array('action'=>'index')); ?>"><?php echo $this->translate('History'); ?></a></li>
- <li class="active"><a href="<?php echo $this->url('job', array('action'=>'running')); ?>"><?php echo $this->translate('Running'); ?></a></li>
- <li><a href="<?php echo $this->url('job', array('action'=>'waiting')); ?>"><?php echo $this->translate('Waiting'); ?></a></li>
- <li><a href="<?php echo $this->url('job', array('action'=>'unsuccessful')); ?>"><?php echo $this->translate('Unsuccessful (past 24 hours)'); ?></a></li>
- <li><a href="<?php echo $this->url('job', array('action'=>'successful')); ?>"><?php echo $this->translate('Successful (past 24 hours)'); ?></a></li>
- <!-- <li><a href="<?php echo $this->url('job', array('action'=>'timeline')); ?>"><?php echo $this->translate('Timeline'); ?></a></li> -->
- <li><a href="<?php echo $this->url('job', array('action'=>'run')); ?>"><?php echo $this->translate('Run'); ?></a></li>
+ <li><a href="<?php echo $this->url('job', array('action'=>'index')); ?>"><?php echo $this->translate('History'); ?></a></li>
+ <li class="active"><a href="<?php echo $this->url('job', array('action'=>'running')); ?>"><?php echo $this->translate('Running'); ?></a></li>
+ <li><a href="<?php echo $this->url('job', array('action'=>'waiting')); ?>"><?php echo $this->translate('Waiting'); ?></a></li>
+ <li><a href="<?php echo $this->url('job', array('action'=>'unsuccessful')); ?>"><?php echo $this->translate('Unsuccessful (past 24 hours)'); ?></a></li>
+ <li><a href="<?php echo $this->url('job', array('action'=>'successful')); ?>"><?php echo $this->translate('Successful (past 24 hours)'); ?></a></li>
+ <!-- <li><a href="<?php echo $this->url('job', array('action'=>'timeline')); ?>"><?php echo $this->translate('Timeline'); ?></a></li> -->
+ <li><a href="<?php echo $this->url('job', array('action'=>'run')); ?>"><?php echo $this->translate('Run'); ?></a></li>
</ul>
<br />
@@ -56,14 +56,14 @@ $this->headTitle($title);
<table class="table table-hover" id="jobtable">
<thead class="bg-primary">
- <th><?php echo $this->translate("Job"); ?></th>
- <th><?php echo $this->translate("Name"); ?></th>
- <th><?php echo $this->translate("Client"); ?></th>
- <th><?php echo $this->translate("Type"); ?></th>
- <th><?php echo $this->translate("Level"); ?></th>
- <th><?php echo $this->translate("Start"); ?></th>
- <th><?php echo $this->translate("Status"); ?></th>
- <th><?php echo $this->translate("Actions"); ?></th>
+ <th><?php echo $this->translate("Job"); ?></th>
+ <th><?php echo $this->translate("Name"); ?></th>
+ <th><?php echo $this->translate("Client"); ?></th>
+ <th><?php echo $this->translate("Type"); ?></th>
+ <th><?php echo $this->translate("Level"); ?></th>
+ <th><?php echo $this->translate("Start"); ?></th>
+ <th><?php echo $this->translate("Status"); ?></th>
+ <th><?php echo $this->translate("Actions"); ?></th>
</thead>
</table>
@@ -83,264 +83,262 @@ $this->headTitle($title);
$(document).ready(function() {
- var table = $('#jobtable').DataTable( {
- "ajax": {
- "url": "<?php echo $this->url('job', array('action' => 'getData'), null) . '?data=running'; ?>",
- "dataSrc": ""
- },
- "columns": [
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null },
- {
- "orderable": false,
- "data": null
- }
- ],
- "paging": true,
- "ordering": true,
- "info": true,
- "pagingType": "full_numbers",
- "stateSave": true,
- "columnDefs": [
- {
- "targets": 0,
- "data": null,
- "render": function(data, type, full, meta) {
- return '<a href="<?php echo $this->basePath() . '/job/details/'; ?>'+data.jobid+'">'+data.jobid+'</a>';
- }
- },
- {
- "targets": 1,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.name;
- }
- },
- {
- "targets": 2,
- "data": null,
- "render": function(data, type, full, meta) {
- return '<a href="<?php echo $this->basePath() . '/client/details/'; ?>'+data.client+'">'+data.client+'</a>';
- }
- },
- {
- "targets": 3,
- "data": null,
- "render": function(data, type, full, meta) {
- var output;
- switch(data.type) {
- case 'B':
- output = 'Backup';
- break;
- case 'M':
- output = 'Migrated';
- break;
- case 'V':
- output = 'Verify';
- break;
- case 'R':
- output = 'Restore';
- break;
- case 'U':
- output = 'Console program';
- break;
- case 'I':
- output = 'Internal system job';
- break;
- case 'D':
- output = 'Admin';
- break;
- case 'A':
- output = 'Archive';
- break;
- case 'C':
- output = 'Copy of a job';
- break;
- case 'c':
- output = 'Copy job';
- break;
- case 'g':
- output = 'Migration job';
- break;
- case 'S':
- output = 'Scan';
- break;
- default:
- output = data.type;
- break;
- }
- return output;
- }
- },
- {
- "targets": 4,
- "data": null,
- "render": function(data, type, full, meta) {
- if(data.level == "F") {
- return 'Full';
- }
- else if(data.level == "D") {
- return 'Differential';
- }
- else if(data.level == "I") {
- return 'Incremental';
- }
- else {
- return data.level;
- }
- }
- },
- {
- "targets": 5,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.starttime;
- }
- },
- {
- "targets": 6,
- "data": null,
- "render": function(data, type, full, meta) {
+ var table = $('#jobtable').DataTable( {
+ "ajax": {
+ "url": "<?php echo $this->url('job', array('action' => 'getData'), null) . '?data=running'; ?>",
+ "dataSrc": ""
+ },
+ "columns": [
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ {
+ "orderable": false,
+ "data": null
+ }
+ ],
+ "paging": true,
+ "ordering": true,
+ "info": true,
+ "pagingType": "full_numbers",
+ "stateSave": true,
+ "columnDefs": [
+ {
+ "targets": 0,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return '<a href="<?php echo $this->basePath() . '/job/details/'; ?>'+data.jobid+'">'+data.jobid+'</a>';
+ }
+ },
+ {
+ "targets": 1,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.name;
+ }
+ },
+ {
+ "targets": 2,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return '<a href="<?php echo $this->basePath() . '/client/details/'; ?>'+data.client+'">'+data.client+'</a>';
+ }
+ },
+ {
+ "targets": 3,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ var output;
+ switch(data.type) {
+ case 'B':
+ output = 'Backup';
+ break;
+ case 'M':
+ output = 'Migrated';
+ break;
+ case 'V':
+ output = 'Verify';
+ break;
+ case 'R':
+ output = 'Restore';
+ break;
+ case 'U':
+ output = 'Console program';
+ break;
+ case 'I':
+ output = 'Internal system job';
+ break;
+ case 'D':
+ output = 'Admin';
+ break;
+ case 'A':
+ output = 'Archive';
+ break;
+ case 'C':
+ output = 'Copy of a job';
+ break;
+ case 'c':
+ output = 'Copy job';
+ break;
+ case 'g':
+ output = 'Migration job';
+ break;
+ case 'S':
+ output = 'Scan';
+ break;
+ default:
+ output = data.type;
+ break;
+ }
+ return output;
+ }
+ },
+ {
+ "targets": 4,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ switch(data.level) {
+ case 'F':
+ return 'Full';
+ case 'D':
+ return 'Differential';
+ case 'I':
+ return 'Incremental';
+ default:
+ return data.level;
+ }
+ }
+ },
+ {
+ "targets": 5,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.starttime;
+ }
+ },
+ {
+ "targets": 6,
+ "data": null,
+ "render": function(data, type, full, meta) {
- var output;
+ var output;
- switch(data.jobstatus) {
+ switch(data.jobstatus) {
- // Non-fatal error
- case 'e':
- output = '<span class="label label-danger">Failure</span>';
- break;
- // Terminated with errors
- case 'E':
- output = '<span class="label label-danger">Failure</span>';
- break;
- // Fatal error
- case 'f':
- output = '<span class="label label-danger">Failure</span>';
- break;
- // Terminated successful
- case 'T':
- output = '<span class="label label-success">Success</span>';
- break;
- // Running
- case 'R':
- output = '<span class="label label-info">Running</span>';
- break;
- // Created no yet running
- case 'C':
- output = '<span class="label label-default">Queued</span>';
- break;
- // Blocked
- case 'B':
- output = '<span class="label label-warning">Blocked</span>';
- break;
- // Verify found differences
- case 'D':
- output = '<span class="label label-warning">Verify found differences</span>';
- break;
- // Canceled by user
- case 'A':
- output = '<span class="label label-warning">Canceled</span>';
- break;
- // Waiting for client
- case 'F':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting for storage daemon
- case 'S':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting for new media
- case 'm':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting for media mount
- case 'M':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting for storage resource
- case 's':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting for job resource
- case 'j':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting for client resource
- case 'c':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting on maximum jobs
- case 'd':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting on starttime
- case 't':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting on higher priority jobs
- case 'p':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // SD despooling attributes
- case 'a':
- output = '<span class="label label-info">SD despooling attributes</span>';
- break;
- // Doing batch insert file records
- case 'i':
- output = '<span class="label label-info">Doing batch insert file records</span>';
- break;
- // Incomplete
- case 'I':
- output = '<span class="label label-primary">Incomplete</span>';
- break;
- // Committing data
- case 'L':
- output = '<span class="label label-info">Committing data</span>';
- break;
- // Terminated with warnings
- case 'W':
- output = '<span class="label label-warning">Warning</span>';
- break;
- // Doing data despooling
- case 'l':
- output = '<span class="label label-info">Doing data despooling</span>';
- break;
- // Queued waiting for device
- case 'q':
- output = '<span class="label label-default">Queued waiting for device</span>';
- break;
- // Default
- default:
- output = '<span class="label label-primary">' + data.jobStatus + '</span>';
- break;
- }
+ // Non-fatal error
+ case 'e':
+ output = '<span class="label label-danger">Failure</span>';
+ break;
+ // Terminated with errors
+ case 'E':
+ output = '<span class="label label-danger">Failure</span>';
+ break;
+ // Fatal error
+ case 'f':
+ output = '<span class="label label-danger">Failure</span>';
+ break;
+ // Terminated successful
+ case 'T':
+ output = '<span class="label label-success">Success</span>';
+ break;
+ // Running
+ case 'R':
+ output = '<span class="label label-info">Running</span>';
+ break;
+ // Created no yet running
+ case 'C':
+ output = '<span class="label label-default">Queued</span>';
+ break;
+ // Blocked
+ case 'B':
+ output = '<span class="label label-warning">Blocked</span>';
+ break;
+ // Verify found differences
+ case 'D':
+ output = '<span class="label label-warning">Verify found differences</span>';
+ break;
+ // Canceled by user
+ case 'A':
+ output = '<span class="label label-warning">Canceled</span>';
+ break;
+ // Waiting for client
+ case 'F':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting for storage daemon
+ case 'S':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting for new media
+ case 'm':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting for media mount
+ case 'M':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting for storage resource
+ case 's':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting for job resource
+ case 'j':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting for client resource
+ case 'c':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting on maximum jobs
+ case 'd':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting on starttime
+ case 't':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting on higher priority jobs
+ case 'p':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // SD despooling attributes
+ case 'a':
+ output = '<span class="label label-info">SD despooling attributes</span>';
+ break;
+ // Doing batch insert file records
+ case 'i':
+ output = '<span class="label label-info">Doing batch insert file records</span>';
+ break;
+ // Incomplete
+ case 'I':
+ output = '<span class="label label-primary">Incomplete</span>';
+ break;
+ // Committing data
+ case 'L':
+ output = '<span class="label label-info">Committing data</span>';
+ break;
+ // Terminated with warnings
+ case 'W':
+ output = '<span class="label label-warning">Warning</span>';
+ break;
+ // Doing data despooling
+ case 'l':
+ output = '<span class="label label-info">Doing data despooling</span>';
+ break;
+ // Queued waiting for device
+ case 'q':
+ output = '<span class="label label-default">Queued waiting for device</span>';
+ break;
+ // Default
+ default:
+ output = '<span class="label label-primary">' + data.jobStatus + '</span>';
+ break;
+ }
- return output;
- }
+ return output;
+ }
- },
- {
- "targets": 7,
- "data": null,
- "render": function(data, type, full, meta) {
- if(data.type == 'B') {
- return '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath() . '/job/cancel/'; ?>'+data.jobid+'" title="Cancel" id="btn-1"><span class="glyphicon glyphicon-trash"></span></a>';
- }
- return '';
- }
- }
- ]
- } );
+ },
+ {
+ "targets": 7,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ if(data.type == 'B') {
+ return '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath() . '/job/cancel/'; ?>'+data.jobid+'" title="Cancel" id="btn-1"><span class="glyphicon glyphicon-trash"></span></a>';
+ }
+ return '';
+ }
+ }
+ ]
+ } );
- $('#jobtable tbody').on('mouseover', '#btn-1', function () {
- $('[data-toggle="tooltip"]').tooltip();
- } );
+ $('#jobtable tbody').on('mouseover', '#btn-1', function () {
+ $('[data-toggle="tooltip"]').tooltip();
+ } );
} );
diff --git a/module/Job/view/job/job/successful.phtml b/module/Job/view/job/job/successful.phtml
index 32063e5..c37006a 100644
--- a/module/Job/view/job/job/successful.phtml
+++ b/module/Job/view/job/job/successful.phtml
@@ -30,13 +30,13 @@ $this->headTitle($title);
?>
<ul class="nav nav-tabs">
- <li><a href="<?php echo $this->url('job', array('action'=>'index')); ?>"><?php echo $this->translate('History'); ?></a></li>
- <li><a href="<?php echo $this->url('job', array('action'=>'running')); ?>"><?php echo $this->translate('Running'); ?></a></li>
- <li><a href="<?php echo $this->url('job', array('action'=>'waiting')); ?>"><?php echo $this->translate('Waiting'); ?></a></li>
- <li><a href="<?php echo $this->url('job', array('action'=>'unsuccessful')); ?>"><?php echo $this->translate('Unsuccessful (past 24 hours)'); ?></a></li>
- <li class="active"><a href="<?php echo $this->url('job', array('action'=>'successful')); ?>"><?php echo $this->translate('Successful (past 24 hours)'); ?></a></li>
- <!-- <li><a href="<?php echo $this->url('job', array('action'=>'timeline')); ?>"><?php echo $this->translate('Timeline'); ?></a></li> -->
- <li><a href="<?php echo $this->url('job', array('action'=>'run')); ?>"><?php echo $this->translate('Run'); ?></a></li>
+ <li><a href="<?php echo $this->url('job', array('action'=>'index')); ?>"><?php echo $this->translate('History'); ?></a></li>
+ <li><a href="<?php echo $this->url('job', array('action'=>'running')); ?>"><?php echo $this->translate('Running'); ?></a></li>
+ <li><a href="<?php echo $this->url('job', array('action'=>'waiting')); ?>"><?php echo $this->translate('Waiting'); ?></a></li>
+ <li><a href="<?php echo $this->url('job', array('action'=>'unsuccessful')); ?>"><?php echo $this->translate('Unsuccessful (past 24 hours)'); ?></a></li>
+ <li class="active"><a href="<?php echo $this->url('job', array('action'=>'successful')); ?>"><?php echo $this->translate('Successful (past 24 hours)'); ?></a></li>
+ <!-- <li><a href="<?php echo $this->url('job', array('action'=>'timeline')); ?>"><?php echo $this->translate('Timeline'); ?></a></li> -->
+ <li><a href="<?php echo $this->url('job', array('action'=>'run')); ?>"><?php echo $this->translate('Run'); ?></a></li>
</ul>
<br />
@@ -56,16 +56,16 @@ $this->headTitle($title);
<table class="table table-hover" id="jobtable">
<thead class="bg-primary">
- <th></th>
- <th><?php echo $this->translate("Job"); ?></th>
- <th><?php echo $this->translate("Name"); ?></th>
- <th><?php echo $this->translate("Client"); ?></th>
- <th><?php echo $this->translate("Type"); ?></th>
- <th><?php echo $this->translate("Level"); ?></th>
- <th><?php echo $this->translate("Start"); ?></th>
- <th><?php echo $this->translate("End"); ?></th>
- <th><?php echo $this->translate("Status"); ?></th>
- <th><?php echo $this->translate("Actions"); ?></th>
+ <th></th>
+ <th><?php echo $this->translate("Job"); ?></th>
+ <th><?php echo $this->translate("Name"); ?></th>
+ <th><?php echo $this->translate("Client"); ?></th>
+ <th><?php echo $this->translate("Type"); ?></th>
+ <th><?php echo $this->translate("Level"); ?></th>
+ <th><?php echo $this->translate("Start"); ?></th>
+ <th><?php echo $this->translate("End"); ?></th>
+ <th><?php echo $this->translate("Status"); ?></th>
+ <th><?php echo $this->translate("Actions"); ?></th>
</thead>
</table>
@@ -101,324 +101,327 @@ tr.shown td.details-control:after {
function format( d ) {
- if(d.jobbytes == 0) {
- var b = "-";
- }
- else {
- var k = 1000;
- var units = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB"];
- var i = Math.floor(Math.log(d.jobbytes) / Math.log(k));
- var b = parseFloat((d.jobbytes / Math.pow(k, i)).toFixed(2)) + " " + units[i];
- }
-
- return '<table class="table table-bordered">'+
- '<tr>'+
- '<th>Files</th>'+
- '<td>'+ d.jobfiles +'</td>'+
- '</tr>'+
- '<tr>'+
- '<th>Bytes</th>'+
- '<td>'+ b +'</td>'+
- '</tr>'+
- '<tr>'+
- '<th>Errors</th>'+
- '<td>'+ d.joberrors +'</td>'+
- '</tr>'+
- '</table>';
+ if(d.jobbytes == 0) {
+ var b = "-";
+ }
+ else {
+ var k = 1000;
+ var units = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB"];
+ var i = Math.floor(Math.log(d.jobbytes) / Math.log(k));
+ var b = parseFloat((d.jobbytes / Math.pow(k, i)).toFixed(2)) + " " + units[i];
+ }
+
+ return '<table class="table table-bordered">'+
+ '<tr>'+
+ '<th>Files</th>'+
+ '<td>'+ d.jobfiles +'</td>'+
+ '</tr>'+
+ '<tr>'+
+ '<th>Bytes</th>'+
+ '<td>'+ b +'</td>'+
+ '</tr>'+
+ '<tr>'+
+ '<th>Errors</th>'+
+ '<td>'+ d.joberrors +'</td>'+
+ '</tr>'+
+ '</table>';
}
$(document).ready(function() {
- var table = $('#jobtable').DataTable( {
- "ajax": {
- "url": "<?php echo $this->url('job', array('action' => 'getData'), null) . '?data=successful'; ?>",
- "dataSrc": ""
- },
- "columns": [
- {
- "className": 'details-control',
- "data": null,
- "orderable": false,
- "defaultContent": ''
- },
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null },
- {
- "orderable": false,
- "data": null
- }
- ],
- "paging": true,
- "ordering": true,
- "info": true,
- "pagingType": "full_numbers",
- "stateSave": true,
- "columnDefs": [
- {
- "targets": 1,
- "data": null,
- "render": function(data, type, full, meta) {
- return '<a href="<?php echo $this->basePath() . '/job/details/'; ?>'+data.jobid+'">'+data.jobid+'</a>';
- }
- },
- {
- "targets": 2,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.name;
- }
- },
- {
- "targets": 3,
- "data": null,
- "render": function(data, type, full, meta) {
- return '<a href="<?php echo $this->basePath() . '/client/details/'; ?>'+data.client+'">'+data.client+'</a>';
- }
- },
- {
- "targets": 4,
- "data": null,
- "render": function(data, type, full, meta) {
- var output;
- switch(data.type) {
- case 'B':
- output = 'Backup';
- break;
- case 'M':
- output = 'Migrated';
- break;
- case 'V':
- output = 'Verify';
- break;
- case 'R':
- output = 'Restore';
- break;
- case 'U':
- output = 'Console program';
- break;
- case 'I':
- output = 'Internal system job';
- break;
- case 'D':
- output = 'Admin';
- break;
- case 'A':
- output = 'Archive';
- break;
- case 'C':
- output = 'Copy of a job';
- break;
- case 'c':
- output = 'Copy job';
- break;
- case 'g':
- output = 'Migration job';
- break;
- case 'S':
- output = 'Scan';
- break;
- default:
- output = data.type;
- break;
- }
- return output;
- }
- },
- {
- "targets": 5,
- "data": null,
- "render": function(data, type, full, meta) {
- if(data.level == "F") {
- return 'Full';
- }
- else if(data.level == "D") {
- return 'Differential';
- }
- else if(data.level == "I") {
- return 'Incremental';
- }
- else {
- return data.level;
- }
- }
- },
- {
- "targets": 6,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.starttime;
- }
- },
- {
- "targets": 7,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.endtime;
- }
- },
- {
- "targets": 8,
- "data": null,
- "render": function(data, type, full, meta) {
-
- var output;
-
- switch(data.jobstatus) {
-
- // Non-fatal error
- case 'e':
- output = '<span class="label label-danger">Failure</span>';
- break;
- // Terminated with errors
- case 'E':
- output = '<span class="label label-danger">Failure</span>';
- break;
- // Fatal error
- case 'f':
- output = '<span class="label label-danger">Failure</span>';
- break;
- // Terminated successful
- case 'T':
- output = '<span class="label label-success">Success</span>';
- break;
- // Running
- case 'R':
- output = '<span class="label label-info">Running</span>';
- break;
- // Created no yet running
- case 'C':
- output = '<span class="label label-default">Queued</span>';
- break;
- // Blocked
- case 'B':
- output = '<span class="label label-warning">Blocked</span>';
- break;
- // Verify found differences
- case 'D':
- output = '<span class="label label-warning">Verify found differences</span>';
- break;
- // Canceled by user
- case 'A':
- output = '<span class="label label-warning">Canceled</span>';
- break;
- // Waiting for client
- case 'F':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting for storage daemon
- case 'S':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting for new media
- case 'm':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting for media mount
- case 'M':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting for storage resource
- case 's':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting for job resource
- case 'j':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting for client resource
- case 'c':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting on maximum jobs
- case 'd':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting on starttime
- case 't':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting on higher priority jobs
- case 'p':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // SD despooling attributes
- case 'a':
- output = '<span class="label label-info">SD despooling attributes</span>';
- break;
- // Doing batch insert file records
- case 'i':
- output = '<span class="label label-info">Doing batch insert file records</span>';
- break;
- // Incomplete
- case 'I':
- output = '<span class="label label-primary">Incomplete</span>';
- break;
- // Committing data
- case 'L':
- output = '<span class="label label-info">Committing data</span>';
- break;
- // Terminated with warnings
- case 'W':
- output = '<span class="label label-warning">Warning</span>';
- break;
- // Doing data despooling
- case 'l':
- output = '<span class="label label-info">Doing data despooling</span>';
- break;
- // Queued waiting for device
- case 'q':
- output = '<span class="label label-default">Queued waiting for device</span>';
- break;
- // Default
- default:
- output = '<span class="label label-primary">' + data.jobStatus + '</span>';
- break;
- }
-
- return output;
- }
-
- },
- {
- "targets": 9,
- "data": null,
- "render": function(data, type, full, meta) {
- if(data.type == 'B') {
- if(data.jobstatus == 'T' || data.jobstatus == 'E' || data.jobstatus == 'e' || data.jobstatus == 'f' || data.jobstatus == 'A') {
- return '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath() . '/job/rerun/'; ?>'+data.jobid+'" title="Rerun" id="btn-1"><span class="glyphicon glyphicon-repeat"></span></a>';
- }
- }
- return '';
- }
- }
- ]
- } );
-
- $('#jobtable tbody').on('click', 'td.details-control', function () {
- var tr = $(this).closest('tr');
- var row = table.row( tr );
- if ( row.child.isShown() ) {
- // This row is already open - close it
- row.child.hide();
- tr.removeClass('shown');
- }
- else {
- // Open this row
- row.child( format(row.data()) ).show();
- tr.addClass('shown');
- }
- } );
-
- $('#jobtable tbody').on('mouseover', '#btn-1', function () {
- $('[data-toggle="tooltip"]').tooltip();
- });
+ var table = $('#jobtable').DataTable( {
+ "ajax": {
+ "url": "<?php echo $this->url('job', array('action' => 'getData'), null) . '?data=successful'; ?>",
+ "dataSrc": ""
+ },
+ "columns": [
+ {
+ "className": 'details-control',
+ "data": null,
+ "orderable": false,
+ "defaultContent": ''
+ },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ {
+ "orderable": false,
+ "data": null
+ }
+ ],
+ "paging": true,
+ "ordering": true,
+ "info": true,
+ "pagingType": "full_numbers",
+ "stateSave": true,
+ "columnDefs": [
+ {
+ "targets": 1,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return '<a href="<?php echo $this->basePath() . '/job/details/'; ?>'+data.jobid+'">'+data.jobid+'</a>';
+ }
+ },
+ {
+ "targets": 2,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.name;
+ }
+ },
+ {
+ "targets": 3,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return '<a href="<?php echo $this->basePath() . '/client/details/'; ?>'+data.client+'">'+data.client+'</a>';
+ }
+ },
+ {
+ "targets": 4,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ var output;
+ switch(data.type) {
+ case 'B':
+ output = 'Backup';
+ break;
+ case 'M':
+ output = 'Migrated';
+ break;
+ case 'V':
+ output = 'Verify';
+ break;
+ case 'R':
+ output = 'Restore';
+ break;
+ case 'U':
+ output = 'Console program';
+ break;
+ case 'I':
+ output = 'Internal system job';
+ break;
+ case 'D':
+ output = 'Admin';
+ break;
+ case 'A':
+ output = 'Archive';
+ break;
+ case 'C':
+ output = 'Copy of a job';
+ break;
+ case 'c':
+ output = 'Copy job';
+ break;
+ case 'g':
+ output = 'Migration job';
+ break;
+ case 'S':
+ output = 'Scan';
+ break;
+ default:
+ output = data.type;
+ break;
+ }
+ return output;
+ }
+ },
+ {
+ "targets": 5,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ switch(data.level) {
+ case 'F':
+ return 'Full';
+ case 'D':
+ return 'Differential';
+ case 'I':
+ return 'Incremental';
+ default:
+ return data.level;
+ }
+ }
+ },
+ {
+ "targets": 6,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.starttime;
+ }
+ },
+ {
+ "targets": 7,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.endtime;
+ }
+ },
+ {
+ "targets": 8,
+ "data": null,
+ "render": function(data, type, full, meta) {
+
+ var output;
+
+ switch(data.jobstatus) {
+
+ // Non-fatal error
+ case 'e':
+ output = '<span class="label label-danger">Failure</span>';
+ break;
+ // Terminated with errors
+ case 'E':
+ output = '<span class="label label-danger">Failure</span>';
+ break;
+ // Fatal error
+ case 'f':
+ output = '<span class="label label-danger">Failure</span>';
+ break;
+ // Terminated successful
+ case 'T':
+ output = '<span class="label label-success">Success</span>';
+ break;
+ // Running
+ case 'R':
+ output = '<span class="label label-info">Running</span>';
+ break;
+ // Created no yet running
+ case 'C':
+ output = '<span class="label label-default">Queued</span>';
+ break;
+ // Blocked
+ case 'B':
+ output = '<span class="label label-warning">Blocked</span>';
+ break;
+ // Verify found differences
+ case 'D':
+ output = '<span class="label label-warning">Verify found differences</span>';
+ break;
+ // Canceled by user
+ case 'A':
+ output = '<span class="label label-warning">Canceled</span>';
+ break;
+ // Waiting for client
+ case 'F':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting for storage daemon
+ case 'S':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting for new media
+ case 'm':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting for media mount
+ case 'M':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting for storage resource
+ case 's':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting for job resource
+ case 'j':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting for client resource
+ case 'c':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting on maximum jobs
+ case 'd':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting on starttime
+ case 't':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting on higher priority jobs
+ case 'p':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // SD despooling attributes
+ case 'a':
+ output = '<span class="label label-info">SD despooling attributes</span>';
+ break;
+ // Doing batch insert file records
+ case 'i':
+ output = '<span class="label label-info">Doing batch insert file records</span>';
+ break;
+ // Incomplete
+ case 'I':
+ output = '<span class="label label-primary">Incomplete</span>';
+ break;
+ // Committing data
+ case 'L':
+ output = '<span class="label label-info">Committing data</span>';
+ break;
+ // Terminated with warnings
+ case 'W':
+ output = '<span class="label label-warning">Warning</span>';
+ break;
+ // Doing data despooling
+ case 'l':
+ output = '<span class="label label-info">Doing data despooling</span>';
+ break;
+ // Queued waiting for device
+ case 'q':
+ output = '<span class="label label-default">Queued waiting for device</span>';
+ break;
+ // Default
+ default:
+ output = '<span class="label label-primary">' + data.jobStatus + '</span>';
+ break;
+ }
+
+ return output;
+ }
+
+ },
+ {
+ "targets": 9,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ if(data.type == 'B') {
+ switch(data.jobstatus) {
+ case 'T':
+ case 'E':
+ case 'e':
+ case 'f':
+ case 'A':
+ return '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath() . '/job/rerun/'; ?>'+data.jobid+'" title="Rerun" id="btn-1"><span class="glyphicon glyphicon-repeat"></span></a>';
+ }
+ }
+ return '';
+ }
+ }
+ ]
+ } );
+
+ $('#jobtable tbody').on('click', 'td.details-control', function () {
+ var tr = $(this).closest('tr');
+ var row = table.row( tr );
+ if ( row.child.isShown() ) {
+ // This row is already open - close it
+ row.child.hide();
+ tr.removeClass('shown');
+ }
+ else {
+ // Open this row
+ row.child( format(row.data()) ).show();
+ tr.addClass('shown');
+ }
+ } );
+
+ $('#jobtable tbody').on('mouseover', '#btn-1', function () {
+ $('[data-toggle="tooltip"]').tooltip();
+ });
} );
diff --git a/module/Job/view/job/job/timeline.phtml b/module/Job/view/job/job/timeline.phtml
index af2e37d..e5a46f3 100644
--- a/module/Job/view/job/job/timeline.phtml
+++ b/module/Job/view/job/job/timeline.phtml
@@ -3,7 +3,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/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
@@ -33,12 +33,12 @@ $this->headTitle($title);
<hr />
<ul class="nav nav-tabs">
- <li><a href="<?php echo $this->url('job', array('action'=>'index')); ?>"><?php echo $this->translate('Overview'); ?></a></li>
- <li><a href="<?php echo $this->url('job', array('action'=>'running')); ?>"><?php echo $this->translate('Running'); ?></a></li>
- <li><a href="<?php echo $this->url('job', array('action'=>'waiting')); ?>"><?php echo $this->translate('Waiting'); ?></a></li>
- <li><a href="<?php echo $this->url('job', array('action'=>'unsuccessful')); ?>"><?php echo $this->translate('Unsuccessful'); ?></a></li>
- <li><a href="<?php echo $this->url('job', array('action'=>'successful')); ?>"><?php echo $this->translate('Successful'); ?></a></li>
- <li class="active"><a href="<?php echo $this->url('job', array('action'=>'timeline')); ?>"><?php echo $this->translate('Timeline'); ?></a></li>
+ <li><a href="<?php echo $this->url('job', array('action'=>'index')); ?>"><?php echo $this->translate('Overview'); ?></a></li>
+ <li><a href="<?php echo $this->url('job', array('action'=>'running')); ?>"><?php echo $this->translate('Running'); ?></a></li>
+ <li><a href="<?php echo $this->url('job', array('action'=>'waiting')); ?>"><?php echo $this->translate('Waiting'); ?></a></li>
+ <li><a href="<?php echo $this->url('job', array('action'=>'unsuccessful')); ?>"><?php echo $this->translate('Unsuccessful'); ?></a></li>
+ <li><a href="<?php echo $this->url('job', array('action'=>'successful')); ?>"><?php echo $this->translate('Successful'); ?></a></li>
+ <li class="active"><a href="<?php echo $this->url('job', array('action'=>'timeline')); ?>"><?php echo $this->translate('Timeline'); ?></a></li>
</ul>
<br />
diff --git a/module/Job/view/job/job/unsuccessful.phtml b/module/Job/view/job/job/unsuccessful.phtml
index b19ca39..389b9f9 100644
--- a/module/Job/view/job/job/unsuccessful.phtml
+++ b/module/Job/view/job/job/unsuccessful.phtml
@@ -30,13 +30,13 @@ $this->headTitle($title);
?>
<ul class="nav nav-tabs">
- <li><a href="<?php echo $this->url('job', array('action'=>'index')); ?>"><?php echo $this->translate('History'); ?></a></li>
- <li><a href="<?php echo $this->url('job', array('action'=>'running')); ?>"><?php echo $this->translate('Running'); ?></a></li>
- <li><a href="<?php echo $this->url('job', array('action'=>'waiting')); ?>"><?php echo $this->translate('Waiting'); ?></a></li>
- <li class="active"><a href="<?php echo $this->url('job', array('action'=>'unsuccessful')); ?>"><?php echo $this->translate('Unsuccessful (past 24 hours)'); ?></a></li>
- <li><a href="<?php echo $this->url('job', array('action'=>'successful')); ?>"><?php echo $this->translate('Successful (past 24 hours)'); ?></a></li>
- <!-- <li><a href="<?php echo $this->url('job', array('action'=>'timeline')); ?>"><?php echo $this->translate('Timeline'); ?></a></li> -->
- <li><a href="<?php echo $this->url('job', array('action'=>'run')); ?>"><?php echo $this->translate('Run'); ?></a></li>
+ <li><a href="<?php echo $this->url('job', array('action'=>'index')); ?>"><?php echo $this->translate('History'); ?></a></li>
+ <li><a href="<?php echo $this->url('job', array('action'=>'running')); ?>"><?php echo $this->translate('Running'); ?></a></li>
+ <li><a href="<?php echo $this->url('job', array('action'=>'waiting')); ?>"><?php echo $this->translate('Waiting'); ?></a></li>
+ <li class="active"><a href="<?php echo $this->url('job', array('action'=>'unsuccessful')); ?>"><?php echo $this->translate('Unsuccessful (past 24 hours)'); ?></a></li>
+ <li><a href="<?php echo $this->url('job', array('action'=>'successful')); ?>"><?php echo $this->translate('Successful (past 24 hours)'); ?></a></li>
+ <!-- <li><a href="<?php echo $this->url('job', array('action'=>'timeline')); ?>"><?php echo $this->translate('Timeline'); ?></a></li> -->
+ <li><a href="<?php echo $this->url('job', array('action'=>'run')); ?>"><?php echo $this->translate('Run'); ?></a></li>
</ul>
<br />
@@ -56,15 +56,15 @@ $this->headTitle($title);
<table class="table table-hover" id="jobtable">
<thead class="bg-primary">
- <th><?php echo $this->translate("Job"); ?></th>
- <th><?php echo $this->translate("Name"); ?></th>
- <th><?php echo $this->translate("Client"); ?></th>
- <th><?php echo $this->translate("Type"); ?></th>
- <th><?php echo $this->translate("Level"); ?></th>
- <th><?php echo $this->translate("Start"); ?></th>
- <th><?php echo $this->translate("End"); ?></th>
- <th><?php echo $this->translate("Status"); ?></th>
- <th><?php echo $this->translate("Actions"); ?></th>
+ <th><?php echo $this->translate("Job"); ?></th>
+ <th><?php echo $this->translate("Name"); ?></th>
+ <th><?php echo $this->translate("Client"); ?></th>
+ <th><?php echo $this->translate("Type"); ?></th>
+ <th><?php echo $this->translate("Level"); ?></th>
+ <th><?php echo $this->translate("Start"); ?></th>
+ <th><?php echo $this->translate("End"); ?></th>
+ <th><?php echo $this->translate("Status"); ?></th>
+ <th><?php echo $this->translate("Actions"); ?></th>
</thead>
</table>
@@ -84,274 +84,277 @@ $this->headTitle($title);
$(document).ready(function() {
- var table = $('#jobtable').DataTable( {
- "ajax": {
- "url": "<?php echo $this->url('job', array('action' => 'getData'), null) . '?data=unsuccessful'; ?>",
- "dataSrc": ""
- },
- "columns": [
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null },
- {
- "orderable": false,
- "data": null
- }
- ],
- "paging": true,
- "ordering": true,
- "info": true,
- "pagingType": "full_numbers",
- "stateSave": true,
- "columnDefs": [
- {
- "targets": 0,
- "data": null,
- "render": function(data, type, full, meta) {
- return '<a href="<?php echo $this->basePath() . '/job/details/'; ?>'+data.jobid+'">'+data.jobid+'</a>';
- }
- },
- {
- "targets": 1,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.name;
- }
- },
- {
- "targets": 2,
- "data": null,
- "render": function(data, type, full, meta) {
- return '<a href="<?php echo $this->basePath() . '/client/details/'; ?>'+data.client+'">'+data.client+'</a>';
- }
- },
- {
- "targets": 3,
- "data": null,
- "render": function(data, type, full, meta) {
- var output;
- switch(data.type) {
- case 'B':
- output = 'Backup';
- break;
- case 'M':
- output = 'Migrated';
- break;
- case 'V':
- output = 'Verify';
- break;
- case 'R':
- output = 'Restore';
- break;
- case 'U':
- output = 'Console program';
- break;
- case 'I':
- output = 'Internal system job';
- break;
- case 'D':
- output = 'Admin';
- break;
- case 'A':
- output = 'Archive';
- break;
- case 'C':
- output = 'Copy of a job';
- break;
- case 'c':
- output = 'Copy job';
- break;
- case 'g':
- output = 'Migration job';
- break;
- case 'S':
- output = 'Scan';
- break;
- default:
- output = data.type;
- break;
- }
- return output;
- }
- },
- {
- "targets": 4,
- "data": null,
- "render": function(data, type, full, meta) {
- if(data.level == "F") {
- return 'Full';
- }
- else if(data.level == "D") {
- return 'Differential';
- }
- else if(data.level == "I") {
- return 'Incremental';
- }
- else {
- return data.level;
- }
- }
- },
- {
- "targets": 5,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.starttime;
- }
- },
- {
- "targets": 6,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.endtime;
- }
- },
- {
- "targets": 7,
- "data": null,
- "render": function(data, type, full, meta) {
+ var table = $('#jobtable').DataTable( {
+ "ajax": {
+ "url": "<?php echo $this->url('job', array('action' => 'getData'), null) . '?data=unsuccessful'; ?>",
+ "dataSrc": ""
+ },
+ "columns": [
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ {
+ "orderable": false,
+ "data": null
+ }
+ ],
+ "paging": true,
+ "ordering": true,
+ "info": true,
+ "pagingType": "full_numbers",
+ "stateSave": true,
+ "columnDefs": [
+ {
+ "targets": 0,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return '<a href="<?php echo $this->basePath() . '/job/details/'; ?>'+data.jobid+'">'+data.jobid+'</a>';
+ }
+ },
+ {
+ "targets": 1,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.name;
+ }
+ },
+ {
+ "targets": 2,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return '<a href="<?php echo $this->basePath() . '/client/details/'; ?>'+data.client+'">'+data.client+'</a>';
+ }
+ },
+ {
+ "targets": 3,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ var output;
+ switch(data.type) {
+ case 'B':
+ output = 'Backup';
+ break;
+ case 'M':
+ output = 'Migrated';
+ break;
+ case 'V':
+ output = 'Verify';
+ break;
+ case 'R':
+ output = 'Restore';
+ break;
+ case 'U':
+ output = 'Console program';
+ break;
+ case 'I':
+ output = 'Internal system job';
+ break;
+ case 'D':
+ output = 'Admin';
+ break;
+ case 'A':
+ output = 'Archive';
+ break;
+ case 'C':
+ output = 'Copy of a job';
+ break;
+ case 'c':
+ output = 'Copy job';
+ break;
+ case 'g':
+ output = 'Migration job';
+ break;
+ case 'S':
+ output = 'Scan';
+ break;
+ default:
+ output = data.type;
+ break;
+ }
+ return output;
+ }
+ },
+ {
+ "targets": 4,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ switch(data.level) {
+ case 'F':
+ return 'Full';
+ case 'D':
+ return 'Differential';
+ case 'I':
+ return 'Incremental';
+ default:
+ return data.level;
+ }
+ }
+ },
+ {
+ "targets": 5,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.starttime;
+ }
+ },
+ {
+ "targets": 6,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.endtime;
+ }
+ },
+ {
+ "targets": 7,
+ "data": null,
+ "render": function(data, type, full, meta) {
- var output;
+ var output;
- switch(data.jobstatus) {
+ switch(data.jobstatus) {
- // Non-fatal error
- case 'e':
- output = '<span class="label label-danger">Failure</span>';
- break;
- // Terminated with errors
- case 'E':
- output = '<span class="label label-danger">Failure</span>';
- break;
- // Fatal error
- case 'f':
- output = '<span class="label label-danger">Failure</span>';
- break;
- // Terminated successful
- case 'T':
- output = '<span class="label label-success">Success</span>';
- break;
- // Running
- case 'R':
- output = '<span class="label label-info">Running</span>';
- break;
- // Created no yet running
- case 'C':
- output = '<span class="label label-default">Queued</span>';
- break;
- // Blocked
- case 'B':
- output = '<span class="label label-warning">Blocked</span>';
- break;
- // Verify found differences
- case 'D':
- output = '<span class="label label-warning">Verify found differences</span>';
- break;
- // Canceled by user
- case 'A':
- output = '<span class="label label-warning">Canceled</span>';
- break;
- // Waiting for client
- case 'F':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting for storage daemon
- case 'S':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting for new media
- case 'm':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting for media mount
- case 'M':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting for storage resource
- case 's':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting for job resource
- case 'j':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting for client resource
- case 'c':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting on maximum jobs
- case 'd':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting on starttime
- case 't':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting on higher priority jobs
- case 'p':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // SD despooling attributes
- case 'a':
- output = '<span class="label label-info">SD despooling attributes</span>';
- break;
- // Doing batch insert file records
- case 'i':
- output = '<span class="label label-info">Doing batch insert file records</span>';
- break;
- // Incomplete
- case 'I':
- output = '<span class="label label-primary">Incomplete</span>';
- break;
- // Committing data
- case 'L':
- output = '<span class="label label-info">Committing data</span>';
- break;
- // Terminated with warnings
- case 'W':
- output = '<span class="label label-warning">Warning</span>';
- break;
- // Doing data despooling
- case 'l':
- output = '<span class="label label-info">Doing data despooling</span>';
- break;
- // Queued waiting for device
- case 'q':
- output = '<span class="label label-default">Queued waiting for device</span>';
- break;
- // Default
- default:
- output = '<span class="label label-primary">' + data.jobStatus + '</span>';
- break;
- }
+ // Non-fatal error
+ case 'e':
+ output = '<span class="label label-danger">Failure</span>';
+ break;
+ // Terminated with errors
+ case 'E':
+ output = '<span class="label label-danger">Failure</span>';
+ break;
+ // Fatal error
+ case 'f':
+ output = '<span class="label label-danger">Failure</span>';
+ break;
+ // Terminated successful
+ case 'T':
+ output = '<span class="label label-success">Success</span>';
+ break;
+ // Running
+ case 'R':
+ output = '<span class="label label-info">Running</span>';
+ break;
+ // Created no yet running
+ case 'C':
+ output = '<span class="label label-default">Queued</span>';
+ break;
+ // Blocked
+ case 'B':
+ output = '<span class="label label-warning">Blocked</span>';
+ break;
+ // Verify found differences
+ case 'D':
+ output = '<span class="label label-warning">Verify found differences</span>';
+ break;
+ // Canceled by user
+ case 'A':
+ output = '<span class="label label-warning">Canceled</span>';
+ break;
+ // Waiting for client
+ case 'F':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting for storage daemon
+ case 'S':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting for new media
+ case 'm':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting for media mount
+ case 'M':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting for storage resource
+ case 's':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting for job resource
+ case 'j':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting for client resource
+ case 'c':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting on maximum jobs
+ case 'd':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting on starttime
+ case 't':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting on higher priority jobs
+ case 'p':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // SD despooling attributes
+ case 'a':
+ output = '<span class="label label-info">SD despooling attributes</span>';
+ break;
+ // Doing batch insert file records
+ case 'i':
+ output = '<span class="label label-info">Doing batch insert file records</span>';
+ break;
+ // Incomplete
+ case 'I':
+ output = '<span class="label label-primary">Incomplete</span>';
+ break;
+ // Committing data
+ case 'L':
+ output = '<span class="label label-info">Committing data</span>';
+ break;
+ // Terminated with warnings
+ case 'W':
+ output = '<span class="label label-warning">Warning</span>';
+ break;
+ // Doing data despooling
+ case 'l':
+ output = '<span class="label label-info">Doing data despooling</span>';
+ break;
+ // Queued waiting for device
+ case 'q':
+ output = '<span class="label label-default">Queued waiting for device</span>';
+ break;
+ // Default
+ default:
+ output = '<span class="label label-primary">' + data.jobStatus + '</span>';
+ break;
+ }
- return output;
- }
+ return output;
+ }
- },
- {
- "targets": 8,
- "data": null,
- "render": function(data, type, full, meta) {
- if(data.type == 'B') {
- if(data.jobstatus == 'T' || data.jobstatus == 'E' || data.jobstatus == 'e' || data.jobstatus == 'f' || data.jobstatus == 'A') {
- return '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath() . '/job/rerun/'; ?>'+data.jobid+'" title="Rerun" id="btn-1"><span class="glyphicon glyphicon-repeat"></span></a>';
- }
- }
- return '';
- }
- }
- ]
- } );
+ },
+ {
+ "targets": 8,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ if(data.type == 'B') {
+ switch(data.jobstatus) {
+ case 'T':
+ case 'E':
+ case 'e':
+ case 'f':
+ case 'A':
+ return '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath() . '/job/rerun/'; ?>'+data.jobid+'" title="Rerun" id="btn-1"><span class="glyphicon glyphicon-repeat"></span></a>';
+ }
+ }
+ return '';
+ }
+ }
+ ]
+ } );
- $('#jobtable tbody').on('mouseover', '#btn-1', function () {
- $('[data-toggle="tooltip"]').tooltip();
- });
+ $('#jobtable tbody').on('mouseover', '#btn-1', function () {
+ $('[data-toggle="tooltip"]').tooltip();
+ });
} );
diff --git a/module/Job/view/job/job/waiting.phtml b/module/Job/view/job/job/waiting.phtml
index a9cad41..13fb68c 100644
--- a/module/Job/view/job/job/waiting.phtml
+++ b/module/Job/view/job/job/waiting.phtml
@@ -3,7 +3,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/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
@@ -30,13 +30,13 @@ $this->headTitle($title);
?>
<ul class="nav nav-tabs">
- <li><a href="<?php echo $this->url('job', array('action'=>'index')); ?>"><?php echo $this->translate('History'); ?></a></li>
- <li><a href="<?php echo $this->url('job', array('action'=>'running')); ?>"><?php echo $this->translate('Running'); ?></a></li>
- <li class="active"><a href="<?php echo $this->url('job', array('action'=>'waiting')); ?>"><?php echo $this->translate('Waiting'); ?></a></li>
- <li><a href="<?php echo $this->url('job', array('action'=>'unsuccessful')); ?>"><?php echo $this->translate('Unsuccessful (past 24 hours)'); ?></a></li>
- <li><a href="<?php echo $this->url('job', array('action'=>'successful')); ?>"><?php echo $this->translate('Successful (past 24 hours)'); ?></a></li>
- <!-- <li><a href="<?php echo $this->url('job', array('action'=>'timeline')); ?>"><?php echo $this->translate('Timeline'); ?></a></li> -->
- <li><a href="<?php echo $this->url('job', array('action'=>'run')); ?>"><?php echo $this->translate('Run'); ?></a></li>
+ <li><a href="<?php echo $this->url('job', array('action'=>'index')); ?>"><?php echo $this->translate('History'); ?></a></li>
+ <li><a href="<?php echo $this->url('job', array('action'=>'running')); ?>"><?php echo $this->translate('Running'); ?></a></li>
+ <li class="active"><a href="<?php echo $this->url('job', array('action'=>'waiting')); ?>"><?php echo $this->translate('Waiting'); ?></a></li>
+ <li><a href="<?php echo $this->url('job', array('action'=>'unsuccessful')); ?>"><?php echo $this->translate('Unsuccessful (past 24 hours)'); ?></a></li>
+ <li><a href="<?php echo $this->url('job', array('action'=>'successful')); ?>"><?php echo $this->translate('Successful (past 24 hours)'); ?></a></li>
+ <!-- <li><a href="<?php echo $this->url('job', array('action'=>'timeline')); ?>"><?php echo $this->translate('Timeline'); ?></a></li> -->
+ <li><a href="<?php echo $this->url('job', array('action'=>'run')); ?>"><?php echo $this->translate('Run'); ?></a></li>
</ul>
<br />
@@ -56,13 +56,13 @@ $this->headTitle($title);
<table class="table table-hover" id="jobtable">
<thead class="bg-primary">
- <th><?php echo $this->translate("Job"); ?></th>
- <th><?php echo $this->translate("Name"); ?></th>
- <th><?php echo $this->translate("Client"); ?></th>
- <th><?php echo $this->translate("Type"); ?></th>
- <th><?php echo $this->translate("Level"); ?></th>
- <th><?php echo $this->translate("Status"); ?></th>
- <th><?php echo $this->translate("Actions"); ?></th>
+ <th><?php echo $this->translate("Job"); ?></th>
+ <th><?php echo $this->translate("Name"); ?></th>
+ <th><?php echo $this->translate("Client"); ?></th>
+ <th><?php echo $this->translate("Type"); ?></th>
+ <th><?php echo $this->translate("Level"); ?></th>
+ <th><?php echo $this->translate("Status"); ?></th>
+ <th><?php echo $this->translate("Actions"); ?></th>
</thead>
</table>
@@ -82,256 +82,254 @@ $this->headTitle($title);
$(document).ready(function() {
- var table = $('#jobtable').DataTable( {
- "ajax": {
- "url": "<?php echo $this->url('job', array('action' => 'getData'), null) . '?data=waiting'; ?>",
- "dataSrc": ""
- },
- "columns": [
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null },
- {
- "orderable": false,
- "data": null
- }
- ],
- "paging": true,
- "ordering": true,
- "info": true,
- "pagingType": "full_numbers",
- "stateSave": true,
- "columnDefs": [
- {
- "targets": 0,
- "data": null,
- "render": function(data, type, full, meta) {
- return '<a href="<?php echo $this->basePath() . '/job/details/'; ?>'+data.jobid+'">'+data.jobid+'</a>';
- }
- },
- {
- "targets": 1,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.name;
- }
- },
- {
- "targets": 2,
- "data": null,
- "render": function(data, type, full, meta) {
- return '<a href="<?php echo $this->basePath() . '/client/details/'; ?>'+data.client+'">'+data.client+'</a>';
- }
- },
- {
- "targets": 3,
- "data": null,
- "render": function(data, type, full, meta) {
- var output;
- switch(data.type) {
- case 'B':
- output = 'Backup';
- break;
- case 'M':
- output = 'Migrated';
- break;
- case 'V':
- output = 'Verify';
- break;
- case 'R':
- output = 'Restore';
- break;
- case 'U':
- output = 'Console program';
- break;
- case 'I':
- output = 'Internal system job';
- break;
- case 'D':
- output = 'Admin';
- break;
- case 'A':
- output = 'Archive';
- break;
- case 'C':
- output = 'Copy of a job';
- break;
- case 'c':
- output = 'Copy job';
- break;
- case 'g':
- output = 'Migration job';
- break;
- case 'S':
- output = 'Scan';
- break;
- default:
- output = data.type;
- break;
- }
- return output;
- }
- },
- {
- "targets": 4,
- "data": null,
- "render": function(data, type, full, meta) {
- if(data.level == "F") {
- return 'Full';
- }
- else if(data.level == "D") {
- return 'Differential';
- }
- else if(data.level == "I") {
- return 'Incremental';
- }
- else {
- return data.level;
- }
- }
- },
- {
- "targets": 5,
- "data": null,
- "render": function(data, type, full, meta) {
+ var table = $('#jobtable').DataTable( {
+ "ajax": {
+ "url": "<?php echo $this->url('job', array('action' => 'getData'), null) . '?data=waiting'; ?>",
+ "dataSrc": ""
+ },
+ "columns": [
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ {
+ "orderable": false,
+ "data": null
+ }
+ ],
+ "paging": true,
+ "ordering": true,
+ "info": true,
+ "pagingType": "full_numbers",
+ "stateSave": true,
+ "columnDefs": [
+ {
+ "targets": 0,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return '<a href="<?php echo $this->basePath() . '/job/details/'; ?>'+data.jobid+'">'+data.jobid+'</a>';
+ }
+ },
+ {
+ "targets": 1,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.name;
+ }
+ },
+ {
+ "targets": 2,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return '<a href="<?php echo $this->basePath() . '/client/details/'; ?>'+data.client+'">'+data.client+'</a>';
+ }
+ },
+ {
+ "targets": 3,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ var output;
+ switch(data.type) {
+ case 'B':
+ output = 'Backup';
+ break;
+ case 'M':
+ output = 'Migrated';
+ break;
+ case 'V':
+ output = 'Verify';
+ break;
+ case 'R':
+ output = 'Restore';
+ break;
+ case 'U':
+ output = 'Console program';
+ break;
+ case 'I':
+ output = 'Internal system job';
+ break;
+ case 'D':
+ output = 'Admin';
+ break;
+ case 'A':
+ output = 'Archive';
+ break;
+ case 'C':
+ output = 'Copy of a job';
+ break;
+ case 'c':
+ output = 'Copy job';
+ break;
+ case 'g':
+ output = 'Migration job';
+ break;
+ case 'S':
+ output = 'Scan';
+ break;
+ default:
+ output = data.type;
+ break;
+ }
+ return output;
+ }
+ },
+ {
+ "targets": 4,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ switch(data.level) {
+ case 'F':
+ return 'Full';
+ case 'D':
+ return 'Differential';
+ case 'I':
+ return 'Incremental';
+ default:
+ return data.level;
+ }
+ }
+ },
+ {
+ "targets": 5,
+ "data": null,
+ "render": function(data, type, full, meta) {
- var output;
+ var output;
- switch(data.jobstatus) {
+ switch(data.jobstatus) {
- // Non-fatal error
- case 'e':
- output = '<span class="label label-danger">Failure</span>';
- break;
- // Terminated with errors
- case 'E':
- output = '<span class="label label-danger">Failure</span>';
- break;
- // Fatal error
- case 'f':
- output = '<span class="label label-danger">Failure</span>';
- break;
- // Terminated successful
- case 'T':
- output = '<span class="label label-success">Success</span>';
- break;
- // Running
- case 'R':
- output = '<span class="label label-info">Running</span>';
- break;
- // Created no yet running
- case 'C':
- output = '<span class="label label-default">Queued</span>';
- break;
- // Blocked
- case 'B':
- output = '<span class="label label-warning">Blocked</span>';
- break;
- // Verify found differences
- case 'D':
- output = '<span class="label label-warning">Verify found differences</span>';
- break;
- // Canceled by user
- case 'A':
- output = '<span class="label label-warning">Canceled</span>';
- break;
- // Waiting for client
- case 'F':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting for storage daemon
- case 'S':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting for new media
- case 'm':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting for media mount
- case 'M':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting for storage resource
- case 's':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting for job resource
- case 'j':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting for client resource
- case 'c':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting on maximum jobs
- case 'd':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting on starttime
- case 't':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // Waiting on higher priority jobs
- case 'p':
- output = '<span class="label label-default">Waiting</span>';
- break;
- // SD despooling attributes
- case 'a':
- output = '<span class="label label-info">SD despooling attributes</span>';
- break;
- // Doing batch insert file records
- case 'i':
- output = '<span class="label label-info">Doing batch insert file records</span>';
- break;
- // Incomplete
- case 'I':
- output = '<span class="label label-primary">Incomplete</span>';
- break;
- // Committing data
- case 'L':
- output = '<span class="label label-info">Committing data</span>';
- break;
- // Terminated with warnings
- case 'W':
- output = '<span class="label label-warning">Warning</span>';
- break;
- // Doing data despooling
- case 'l':
- output = '<span class="label label-info">Doing data despooling</span>';
- break;
- // Queued waiting for device
- case 'q':
- output = '<span class="label label-default">Queued waiting for device</span>';
- break;
- // Default
- default:
- output = '<span class="label label-primary">' + data.jobStatus + '</span>';
- break;
- }
+ // Non-fatal error
+ case 'e':
+ output = '<span class="label label-danger">Failure</span>';
+ break;
+ // Terminated with errors
+ case 'E':
+ output = '<span class="label label-danger">Failure</span>';
+ break;
+ // Fatal error
+ case 'f':
+ output = '<span class="label label-danger">Failure</span>';
+ break;
+ // Terminated successful
+ case 'T':
+ output = '<span class="label label-success">Success</span>';
+ break;
+ // Running
+ case 'R':
+ output = '<span class="label label-info">Running</span>';
+ break;
+ // Created no yet running
+ case 'C':
+ output = '<span class="label label-default">Queued</span>';
+ break;
+ // Blocked
+ case 'B':
+ output = '<span class="label label-warning">Blocked</span>';
+ break;
+ // Verify found differences
+ case 'D':
+ output = '<span class="label label-warning">Verify found differences</span>';
+ break;
+ // Canceled by user
+ case 'A':
+ output = '<span class="label label-warning">Canceled</span>';
+ break;
+ // Waiting for client
+ case 'F':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting for storage daemon
+ case 'S':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting for new media
+ case 'm':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting for media mount
+ case 'M':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting for storage resource
+ case 's':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting for job resource
+ case 'j':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting for client resource
+ case 'c':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting on maximum jobs
+ case 'd':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting on starttime
+ case 't':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // Waiting on higher priority jobs
+ case 'p':
+ output = '<span class="label label-default">Waiting</span>';
+ break;
+ // SD despooling attributes
+ case 'a':
+ output = '<span class="label label-info">SD despooling attributes</span>';
+ break;
+ // Doing batch insert file records
+ case 'i':
+ output = '<span class="label label-info">Doing batch insert file records</span>';
+ break;
+ // Incomplete
+ case 'I':
+ output = '<span class="label label-primary">Incomplete</span>';
+ break;
+ // Committing data
+ case 'L':
+ output = '<span class="label label-info">Committing data</span>';
+ break;
+ // Terminated with warnings
+ case 'W':
+ output = '<span class="label label-warning">Warning</span>';
+ break;
+ // Doing data despooling
+ case 'l':
+ output = '<span class="label label-info">Doing data despooling</span>';
+ break;
+ // Queued waiting for device
+ case 'q':
+ output = '<span class="label label-default">Queued waiting for device</span>';
+ break;
+ // Default
+ default:
+ output = '<span class="label label-primary">' + data.jobStatus + '</span>';
+ break;
+ }
- return output;
- }
+ return output;
+ }
- },
- {
- "targets": 6,
- "data": null,
- "render": function(data, type, full, meta) {
- if(data.type == 'B') {
- return '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath() . '/job/cancel/'; ?>'+data.jobid+'" title="Cancel" id="btn-1"><span class="glyphicon glyphicon-trash"></span></a>';
- }
- return '';
- }
- }
- ]
- } );
+ },
+ {
+ "targets": 6,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ if(data.type == 'B') {
+ return '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath() . '/job/cancel/'; ?>'+data.jobid+'" title="Cancel" id="btn-1"><span class="glyphicon glyphicon-trash"></span></a>';
+ }
+ return '';
+ }
+ }
+ ]
+ } );
- $('#jobtable tbody').on('mouseover', '#btn-1', function () {
- $('[data-toggle="tooltip"]').tooltip();
- } );
+ $('#jobtable tbody').on('mouseover', '#btn-1', function () {
+ $('[data-toggle="tooltip"]').tooltip();
+ } );
} );
diff --git a/module/Media/Module.php b/module/Media/Module.php
index 78a8b3b..cd3571d 100644
--- a/module/Media/Module.php
+++ b/module/Media/Module.php
@@ -8,36 +8,36 @@ use Media\Model\MediaModel;
class Module
{
- public function getAutoloaderConfig()
- {
- return array(
- 'Zend\Loader\ClassMapAutoloader' => array(
- __DIR__ . '/autoload_classmap.php',
- ),
- 'Zend\Loader\StandardAutoloader' => array(
- 'namespaces' => array(
- __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
- ),
- ),
- );
- }
-
- public function getConfig()
- {
- return include __DIR__ . '/config/module.config.php';
- }
-
- public function getServiceConfig()
- {
- return array(
- 'factories' => array(
- 'Media\Model\MediaModel' => function() {
- $model = new MediaModel();
- return $model;
- }
- )
- );
- }
+ public function getAutoloaderConfig()
+ {
+ return array(
+ 'Zend\Loader\ClassMapAutoloader' => array(
+ __DIR__ . '/autoload_classmap.php',
+ ),
+ 'Zend\Loader\StandardAutoloader' => array(
+ 'namespaces' => array(
+ __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
+ ),
+ ),
+ );
+ }
+
+ public function getConfig()
+ {
+ return include __DIR__ . '/config/module.config.php';
+ }
+
+ public function getServiceConfig()
+ {
+ return array(
+ 'factories' => array(
+ 'Media\Model\MediaModel' => function() {
+ $model = new MediaModel();
+ return $model;
+ }
+ )
+ );
+ }
}
diff --git a/module/Media/config/module.config.php b/module/Media/config/module.config.php
index 2db66da..56d5e3c 100644
--- a/module/Media/config/module.config.php
+++ b/module/Media/config/module.config.php
@@ -25,39 +25,39 @@
return array(
- 'controllers' => array(
- 'invokables' => array(
- 'Media\Controller\Media' => 'Media\Controller\MediaController',
- ),
- ),
- 'controller_plugins' => array(
- 'invokables' => array(
- 'SessionTimeoutPlugin' => 'Application\Controller\Plugin\SessionTimeoutPlugin',
- ),
- ),
- 'router' => array(
- 'routes' => array(
- 'media' => array(
- 'type' => 'segment',
- 'options' => array(
- 'route' => '/media[/][:action][/][:id]',
- 'constraints' => array(
- 'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
- 'id' => '[a-zA-Z0-9_-]*',
- ),
- 'defaults' => array(
- 'controller' => 'Media\Controller\Media',
- 'action' => 'index',
- ),
- ),
- ),
- ),
- ),
+ 'controllers' => array(
+ 'invokables' => array(
+ 'Media\Controller\Media' => 'Media\Controller\MediaController',
+ ),
+ ),
+ 'controller_plugins' => array(
+ 'invokables' => array(
+ 'SessionTimeoutPlugin' => 'Application\Controller\Plugin\SessionTimeoutPlugin',
+ ),
+ ),
+ 'router' => array(
+ 'routes' => array(
+ 'media' => array(
+ 'type' => 'segment',
+ 'options' => array(
+ 'route' => '/media[/][:action][/][:id]',
+ 'constraints' => array(
+ 'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
+ 'id' => '[a-zA-Z0-9_-]*',
+ ),
+ 'defaults' => array(
+ 'controller' => 'Media\Controller\Media',
+ 'action' => 'index',
+ ),
+ ),
+ ),
+ ),
+ ),
- 'view_manager' => array(
- 'template_path_stack' => array(
- 'media' => __DIR__ . '/../view',
- ),
- ),
+ 'view_manager' => array(
+ 'template_path_stack' => array(
+ 'media' => __DIR__ . '/../view',
+ ),
+ ),
);
diff --git a/module/Media/src/Media/Controller/MediaController.php b/module/Media/src/Media/Controller/MediaController.php
index f495c9d..c7c095c 100644
--- a/module/Media/src/Media/Controller/MediaController.php
+++ b/module/Media/src/Media/Controller/MediaController.php
@@ -31,78 +31,78 @@ use Zend\Json\Json;
class MediaController extends AbstractActionController
{
- protected $mediaModel;
-
- public function indexAction()
- {
- if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
-
- $volumes = $this->getMediaModel()->getVolumes();
-
- return new ViewModel(
- array(
- 'volumes' => $volumes,
- )
- );
-
- }
- else {
- return $this->redirect()->toRoute('auth', array('action' => 'login'));
- }
- }
-
- public function detailsAction()
- {
- if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
-
- $volumename = $this->params()->fromRoute('id');
- $volume = $this->getMediaModel()->getVolume($volumename);
-
- return new ViewModel(array(
- 'media' => $volume,
- ));
-
- }
- else {
- return $this->redirect()->toRoute('auth', array('action' => 'login'));
- }
- }
-
- public function getDataAction()
- {
- if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()){
-
- $data = $this->params()->fromQuery('data');
-
- if($data == "all") {
- $result = $this->getMediaModel()->getVolumes();
- }
- else {
- $result = null;
- }
-
- $response = $this->getResponse();
- $response->getHeaders()->addHeaderLine('Content-Type','application/json');
-
- if(isset($result)) {
- $response->setContent(JSON::encode($result));
- }
-
- return $response;
-
- }
- else {
- return $this->redirect()->toRoute('auth', array('action' => 'login'));
- }
- }
-
- public function getMediaModel()
- {
- if(!$this->mediaModel) {
- $sm = $this->getServiceLocator();
- $this->mediaModel = $sm->get('Media\Model\MediaModel');
- }
- return $this->mediaModel;
- }
+ protected $mediaModel;
+
+ public function indexAction()
+ {
+ if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
+
+ $volumes = $this->getMediaModel()->getVolumes();
+
+ return new ViewModel(
+ array(
+ 'volumes' => $volumes,
+ )
+ );
+
+ }
+ else {
+ return $this->redirect()->toRoute('auth', array('action' => 'login'));
+ }
+ }
+
+ public function detailsAction()
+ {
+ if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
+
+ $volumename = $this->params()->fromRoute('id');
+ $volume = $this->getMediaModel()->getVolume($volumename);
+
+ return new ViewModel(array(
+ 'media' => $volume,
+ ));
+
+ }
+ else {
+ return $this->redirect()->toRoute('auth', array('action' => 'login'));
+ }
+ }
+
+ public function getDataAction()
+ {
+ if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()){
+
+ $data = $this->params()->fromQuery('data');
+
+ if($data == "all") {
+ $result = $this->getMediaModel()->getVolumes();
+ }
+ else {
+ $result = null;
+ }
+
+ $response = $this->getResponse();
+ $response->getHeaders()->addHeaderLine('Content-Type','application/json');
+
+ if(isset($result)) {
+ $response->setContent(JSON::encode($result));
+ }
+
+ return $response;
+
+ }
+ else {
+ return $this->redirect()->toRoute('auth', array('action' => 'login'));
+ }
+ }
+
+ public function getMediaModel()
+ {
+ if(!$this->mediaModel) {
+ $sm = $this->getServiceLocator();
+ $this->mediaModel = $sm->get('Media\Model\MediaModel');
+ }
+ return $this->mediaModel;
+ }
}
diff --git a/module/Media/src/Media/Model/MediaModel.php b/module/Media/src/Media/Model/MediaModel.php
index c2c83a0..551d54a 100644
--- a/module/Media/src/Media/Model/MediaModel.php
+++ b/module/Media/src/Media/Model/MediaModel.php
@@ -30,43 +30,43 @@ use Zend\ServiceManager\ServiceLocatorInterface;
class MediaModel implements ServiceLocatorAwareInterface
{
- protected $serviceLocator;
- protected $director;
+ protected $serviceLocator;
+ protected $director;
- public function __construct()
- {
- }
+ public function __construct()
+ {
+ }
- public function setServiceLocator(ServiceLocatorInterface $serviceLocator)
- {
- $this->serviceLocator = $serviceLocator;
- }
+ public function setServiceLocator(ServiceLocatorInterface $serviceLocator)
+ {
+ $this->serviceLocator = $serviceLocator;
+ }
- public function getServiceLocator()
- {
- return $this->serviceLocator;
- }
+ public function getServiceLocator()
+ {
+ return $this->serviceLocator;
+ }
- public function getVolumes()
- {
- $cmd = 'llist volumes all';
- $this->director = $this->getServiceLocator()->get('director');
- $result = $this->director->send_command($cmd, 2, null);
- $volumes = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
- return $volumes['result']['volumes'];
- }
+ public function getVolumes()
+ {
+ $cmd = 'llist volumes all';
+ $this->director = $this->getServiceLocator()->get('director');
+ $result = $this->director->send_command($cmd, 2, null);
+ $volumes = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
+ return $volumes['result']['volumes'];
+ }
- public function getVolume($volume=null)
- {
- if(isset($volume)) {
- $cmd = 'llist volume="'.$volume.'"';
- $this->director = $this->getServiceLocator()->get('director');
- $result = $this->director->send_command($cmd, 2, null);
- $volume = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
- return $volume['result']['volume'];
- }
- else {
- return false;
- }
- }
+ public function getVolume($volume=null)
+ {
+ if(isset($volume)) {
+ $cmd = 'llist volume="'.$volume.'"';
+ $this->director = $this->getServiceLocator()->get('director');
+ $result = $this->director->send_command($cmd, 2, null);
+ $volume = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
+ return $volume['result']['volume'];
+ }
+ else {
+ return false;
+ }
+ }
}
diff --git a/module/Media/view/media/media/details.phtml b/module/Media/view/media/media/details.phtml
index 7b7459a..67a431c 100644
--- a/module/Media/view/media/media/details.phtml
+++ b/module/Media/view/media/media/details.phtml
@@ -40,48 +40,48 @@ $this->headTitle($title);
<div class="panel-body">
- <table class="table table-condensed">
- <tr><th>Volume ID</th><td><?php echo $this->escapeHtml($media['mediaid']); ?></td></tr>
- <tr><th>Volumename</th><td><?php echo $this->escapeHtml($media['volumename']); ?></td></tr>
- <tr><th>Mediatype</th><td><?php echo $this->escapeHtml($media['mediatype']); ?></td></tr>
- <tr><th>Mediatype ID</th><td></td></tr>
- <tr><th>Labeltype</th><td><?php echo $this->escapeHtml($media['labeltype']); ?></td></tr>
- <tr><th>First written</th><td><?php echo $this->printDate($media['firstwritten']); ?></td></tr>
- <tr><th>Last written</th><td><?php echo $this->printDate($media['lastwritten']); ?></td></tr>
- <tr><th>Label date</th><td><?php echo $this->printDate($media['labeldate']); ?></td></tr>
- <tr><th>Volume jobs</th><td><?php echo $this->escapeHtml($media['voljobs']); ?></td></tr>
- <tr><th>Volume files</th><td><?php echo $this->escapeHtml($media['volfiles']); ?></td></tr>
- <tr><th>Volume blocks</th><td><?php echo $this->escapeHtml($media['volblocks']); ?></td></tr>
- <tr><th>Volume mounts</th><td><?php echo $this->escapeHtml($media['volmounts']); ?></td></tr>
- <tr><th>Volume used bytes</th><td><?php echo $this->printBytes($media['volbytes']); ?></td></tr>
- <tr><th>Volume errors</th><td><?php echo $this->escapeHtml($media['volerrors']); ?></td></tr>
- <tr><th>Volume writes</th><td><?php echo $this->escapeHtml($media['volwrites']); ?></td></tr>
- <tr><th>Volume capacity bytes</th><td><?php echo $this->escapeHtml($media['volcapacitybytes']); ?></td></tr>
- <tr><th>Volume Status</th><td><?php echo $this->escapeHtml($media['volstatus']); ?></td></tr>
- <tr><th>Enabled</th><td><?php echo $this->escapeHtml($media['enabled']); ?></td></tr>
- <tr><th>Recycle</th><td><?php echo $this->escapeHtml($media['recycle']); ?></td></tr>
- <tr><th>Action on purge</th><td></td></tr>
- <tr><th>Volume retention/expiration</th><td><?php echo $this->printExpiration($media['volretention'], $media['lastwritten'], $media['volstatus']); ?></td></tr>
- <tr><th>Volume use duration</th><td><?php echo $this->escapeHtml($media['voluseduration']); ?></td></tr>
- <tr><th>Volume maximum jobs</th><td><?php echo $this->escapeHtml($media['maxvoljobs']); ?></td></tr>
- <tr><th>Volume maximum files</th><td><?php echo $this->escapeHtml($media['maxvolfiles']); ?></td></tr>
- <tr><th>Volume maximum bytes</th><td><?php echo $this->printBytes($media['maxvolbytes']); ?></td></tr>
- <tr><th>In changer</th><td><?php echo $this->escapeHtml($media['inchanger']); ?></td></tr>
- <tr><th>Storage ID</th><td><?php echo $this->escapeHtml($media['storageid']); ?></td></tr>
- <tr><th>Device ID</th><td><?php echo $this->escapeHtml($media['deviceid']); ?></td></tr>
- <tr><th>Media addressing</th><td></td></tr>
- <tr><th>Volume readtime</th><td></td></tr>
- <tr><th>Volume writetime</th><td></td></tr>
- <tr><th>Endfile</th><td><?php echo $this->escapeHtml($media['endfile']); ?></td></tr>
- <tr><th>Endblock</th><td><?php echo $this->escapeHtml($media['endblock']); ?></td></tr>
- <tr><th>Location ID</th><td><?php echo $this->escapeHtml($media['locationid']); ?></td></tr>
- <tr><th>Recycle count</th><td><?php echo $this->escapeHtml($media['recyclecount']); ?></td></tr>
- <tr><th>Initial write</th><td><?php echo $this->escapeHtml($media['initialwrite']); ?></td></tr>
- <tr><th>Scratchpool ID</th><td><?php echo $this->escapeHtml($media['scratchpoolid']); ?></td></tr>
- <tr><th>Recyclepool ID</th><td><?php echo $this->escapeHtml($media['recyclepoolid']); ?></td></tr>
- <tr><th>Encryptionkey</th><td></td></tr>
- <tr><th>Comment</th><td><?php echo $this->escapeHtml($media['comment']); ?></td></tr>
- </table>
+ <table class="table table-condensed">
+ <tr><th>Volume ID</th><td><?php echo $this->escapeHtml($media['mediaid']); ?></td></tr>
+ <tr><th>Volumename</th><td><?php echo $this->escapeHtml($media['volumename']); ?></td></tr>
+ <tr><th>Mediatype</th><td><?php echo $this->escapeHtml($media['mediatype']); ?></td></tr>
+ <tr><th>Mediatype ID</th><td></td></tr>
+ <tr><th>Labeltype</th><td><?php echo $this->escapeHtml($media['labeltype']); ?></td></tr>
+ <tr><th>First written</th><td><?php echo $this->printDate($media['firstwritten']); ?></td></tr>
+ <tr><th>Last written</th><td><?php echo $this->printDate($media['lastwritten']); ?></td></tr>
+ <tr><th>Label date</th><td><?php echo $this->printDate($media['labeldate']); ?></td></tr>
+ <tr><th>Volume jobs</th><td><?php echo $this->escapeHtml($media['voljobs']); ?></td></tr>
+ <tr><th>Volume files</th><td><?php echo $this->escapeHtml($media['volfiles']); ?></td></tr>
+ <tr><th>Volume blocks</th><td><?php echo $this->escapeHtml($media['volblocks']); ?></td></tr>
+ <tr><th>Volume mounts</th><td><?php echo $this->escapeHtml($media['volmounts']); ?></td></tr>
+ <tr><th>Volume used bytes</th><td><?php echo $this->printBytes($media['volbytes']); ?></td></tr>
+ <tr><th>Volume errors</th><td><?php echo $this->escapeHtml($media['volerrors']); ?></td></tr>
+ <tr><th>Volume writes</th><td><?php echo $this->escapeHtml($media['volwrites']); ?></td></tr>
+ <tr><th>Volume capacity bytes</th><td><?php echo $this->escapeHtml($media['volcapacitybytes']); ?></td></tr>
+ <tr><th>Volume Status</th><td><?php echo $this->escapeHtml($media['volstatus']); ?></td></tr>
+ <tr><th>Enabled</th><td><?php echo $this->escapeHtml($media['enabled']); ?></td></tr>
+ <tr><th>Recycle</th><td><?php echo $this->escapeHtml($media['recycle']); ?></td></tr>
+ <tr><th>Action on purge</th><td></td></tr>
+ <tr><th>Volume retention/expiration</th><td><?php echo $this->printExpiration($media['volretention'], $media['lastwritten'], $media['volstatus']); ?></td></tr>
+ <tr><th>Volume use duration</th><td><?php echo $this->escapeHtml($media['voluseduration']); ?></td></tr>
+ <tr><th>Volume maximum jobs</th><td><?php echo $this->escapeHtml($media['maxvoljobs']); ?></td></tr>
+ <tr><th>Volume maximum files</th><td><?php echo $this->escapeHtml($media['maxvolfiles']); ?></td></tr>
+ <tr><th>Volume maximum bytes</th><td><?php echo $this->printBytes($media['maxvolbytes']); ?></td></tr>
+ <tr><th>In changer</th><td><?php echo $this->escapeHtml($media['inchanger']); ?></td></tr>
+ <tr><th>Storage ID</th><td><?php echo $this->escapeHtml($media['storageid']); ?></td></tr>
+ <tr><th>Device ID</th><td><?php echo $this->escapeHtml($media['deviceid']); ?></td></tr>
+ <tr><th>Media addressing</th><td></td></tr>
+ <tr><th>Volume readtime</th><td></td></tr>
+ <tr><th>Volume writetime</th><td></td></tr>
+ <tr><th>Endfile</th><td><?php echo $this->escapeHtml($media['endfile']); ?></td></tr>
+ <tr><th>Endblock</th><td><?php echo $this->escapeHtml($media['endblock']); ?></td></tr>
+ <tr><th>Location ID</th><td><?php echo $this->escapeHtml($media['locationid']); ?></td></tr>
+ <tr><th>Recycle count</th><td><?php echo $this->escapeHtml($media['recyclecount']); ?></td></tr>
+ <tr><th>Initial write</th><td><?php echo $this->escapeHtml($media['initialwrite']); ?></td></tr>
+ <tr><th>Scratchpool ID</th><td><?php echo $this->escapeHtml($media['scratchpoolid']); ?></td></tr>
+ <tr><th>Recyclepool ID</th><td><?php echo $this->escapeHtml($media['recyclepoolid']); ?></td></tr>
+ <tr><th>Encryptionkey</th><td></td></tr>
+ <tr><th>Comment</th><td><?php echo $this->escapeHtml($media['comment']); ?></td></tr>
+ </table>
</div>
</div>
diff --git a/module/Media/view/media/media/index.phtml b/module/Media/view/media/media/index.phtml
index f8e2a66..c80b78f 100644
--- a/module/Media/view/media/media/index.phtml
+++ b/module/Media/view/media/media/index.phtml
@@ -43,16 +43,16 @@ $this->headTitle($title);
<table class="table" id="volumes">
<thead class="bg-primary">
- <th></th>
- <th><?php echo $this->translate("Name"); ?></th>
- <th><?php echo $this->translate("Storage"); ?></th>
- <th><?php echo $this->translate("Type"); ?></th>
- <th><?php echo $this->translate("Last written"); ?></th>
- <th><?php echo $this->translate("Status"); ?></th>
- <th><?php echo $this->translate("Retention/Expiration"); ?></th>
- <th><?php echo $this->translate("Maximum bytes"); ?></div></th>
- <th><?php echo $this->translate("Current bytes"); ?></div></th>
- <th><?php echo $this->translate("Free bytes"); ?></div></th>
+ <th></th>
+ <th><?php echo $this->translate("Name"); ?></th>
+ <th><?php echo $this->translate("Storage"); ?></th>
+ <th><?php echo $this->translate("Type"); ?></th>
+ <th><?php echo $this->translate("Last written"); ?></th>
+ <th><?php echo $this->translate("Status"); ?></th>
+ <th><?php echo $this->translate("Retention/Expiration"); ?></th>
+ <th><?php echo $this->translate("Maximum bytes"); ?></div></th>
+ <th><?php echo $this->translate("Current bytes"); ?></div></th>
+ <th><?php echo $this->translate("Free bytes"); ?></div></th>
</thead>
</table>
@@ -71,15 +71,15 @@ $this->headTitle($title);
<style>
td.details-control:after {
- font-family: "Glyphicons Halflings";
- content: "\e081";
- cursor: pointer;
+ font-family: "Glyphicons Halflings";
+ content: "\e081";
+ cursor: pointer;
}
tr.shown td.details-control:after {
- font-family: "Glyphicons Halflings";
- content: "\e082";
- cursor: pointer;
+ font-family: "Glyphicons Halflings";
+ content: "\e082";
+ cursor: pointer;
}
</style>
@@ -88,215 +88,215 @@ tr.shown td.details-control:after {
function format( d ) {
- var r;
+ var r;
- if(d.recycle == 1) {
- r = '<span class="label label-success">Yes</span>';
- }
- else {
- r = '<span class="label label-danger">No</span>';
- }
+ if(d.recycle == 1) {
+ r = '<span class="label label-success">Yes</span>';
+ }
+ else {
+ r = '<span class="label label-danger">No</span>';
+ }
- return '<table class="table table-bordered">'+
- '<tr>'+
- '<th>Label date</th>'+
- '<td>'+ d.labeldate +'</td>'+
- '</tr>'+
- '<tr>'+
- '<th>First written</th>'+
- '<td>'+ d.firstwritten +'</td>'+
- '</tr>'+
- '<tr>'+
- '<th>Last written</th>'+
- '<td>'+ d.lastwritten +'</td>'+
- '</tr>'+
- '<tr>'+
- '<th>Volume jobs</th>'+
- '<td>'+ d.voljobs +'</td>'+
- '</tr>'+
- '<tr>'+
- '<th>Recycle</th>'+
- '<td>'+ r +'</td>'+
- '</tr>'+
- '</table>';
+ return '<table class="table table-bordered">'+
+ '<tr>'+
+ '<th>Label date</th>'+
+ '<td>'+ d.labeldate +'</td>'+
+ '</tr>'+
+ '<tr>'+
+ '<th>First written</th>'+
+ '<td>'+ d.firstwritten +'</td>'+
+ '</tr>'+
+ '<tr>'+
+ '<th>Last written</th>'+
+ '<td>'+ d.lastwritten +'</td>'+
+ '</tr>'+
+ '<tr>'+
+ '<th>Volume jobs</th>'+
+ '<td>'+ d.voljobs +'</td>'+
+ '</tr>'+
+ '<tr>'+
+ '<th>Recycle</th>'+
+ '<td>'+ r +'</td>'+
+ '</tr>'+
+ '</table>';
}
$(document).ready(function() {
- var table = $('#volumes').DataTable( {
- "ajax": {
- "url": "<?php echo $this->url('media', array('action' => 'getData'), null) . '?data=all'; ?>",
- "dataSrc": ""
- },
- "columns": [
- {
- "className": 'details-control',
- "data": null,
- "orderable": false,
- "defaultContent": ''
- },
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null }
- ],
- "paging": true,
- "ordering": true,
- "info": true,
- "pagingType": "full_numbers",
- "stateSave": true,
- "columnDefs": [
- {
- "targets": 1,
- "data": null,
- "render": function(data, type, full, meta) {
- return '<a href="<?php echo $this->basePath() . '/media/details/'; ?>'+data.volumename+'">'+data.volumename+'</a>';
- }
- },
- {
- "targets": 2,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.storageid;
- }
- },
- {
- "targets": 3,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.mediatype;
- }
- },
- {
- "targets": 4,
- "data": null,
- "render": function(data, type, full, meta) {
+ var table = $('#volumes').DataTable( {
+ "ajax": {
+ "url": "<?php echo $this->url('media', array('action' => 'getData'), null) . '?data=all'; ?>",
+ "dataSrc": ""
+ },
+ "columns": [
+ {
+ "className": 'details-control',
+ "data": null,
+ "orderable": false,
+ "defaultContent": ''
+ },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null }
+ ],
+ "paging": true,
+ "ordering": true,
+ "info": true,
+ "pagingType": "full_numbers",
+ "stateSave": true,
+ "columnDefs": [
+ {
+ "targets": 1,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return '<a href="<?php echo $this->basePath() . '/media/details/'; ?>'+data.volumename+'">'+data.volumename+'</a>';
+ }
+ },
+ {
+ "targets": 2,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.storageid;
+ }
+ },
+ {
+ "targets": 3,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.mediatype;
+ }
+ },
+ {
+ "targets": 4,
+ "data": null,
+ "render": function(data, type, full, meta) {
- if(data.lastwritten == null || data.lastwritten == "") {
- return 'never';
- }
- else {
- var d = Date.now() / 1000;
- var a = data.lastwritten.split(" ");
- var b = new Date(a[0]).getTime() / 1000;
- var interval = Math.floor( (d - b) / (3600 * 24) );
+ if(data.lastwritten == null || data.lastwritten == "") {
+ return 'never';
+ }
+ else {
+ var d = Date.now() / 1000;
+ var a = data.lastwritten.split(" ");
+ var b = new Date(a[0]).getTime() / 1000;
+ var interval = Math.floor( (d - b) / (3600 * 24) );
- if(interval < 1) {
- return '<span id="lastwritten" data-toggle="tooltip" title="' + data.lastwritten + '">today</span>';
- }
- else if(interval <= 31 && interval >= 1) {
- return '<span id="lastwritten" data-toggle="tooltip" title="' + data.lastwritten + '">' + interval + ' day(s) ago</span>';
- }
- else if(interval >= 31 && interval <= 365) {
- return '<span id="lastwritten" data-toggle="tooltip" title="' + data.lastwritten + '">' + Math.round(interval / 31) + ' month(s) ago</span>';
- }
- else if(interval > 365) {
- return '<span id="lastwritten" data-toggle="tooltip" title="' + data.lastwritten + '">' + Math.round(interval / 365) + ' year(s) ago</span>';
- }
- else {
- return data.lastwritten;
- }
- }
- }
- },
- {
- "targets": 5,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.volstatus;
- }
- },
- {
- "targets": 6,
- "data": null,
- "render": function(data, type, full, meta) {
- if(data.volstatus == "Used" || data.volstatus == "Full") {
- if(data.lastwritten == null || data.lastwritten == "") {
- return '-';
- }
- else {
- var d = Date.now() / 1000;
- var a = data.lastwritten.split(" ");
- var b = new Date(a[0]).getTime() / 1000;
- var interval = (d - b) / (3600 * 24);
- var retention = Math.round(data.volretention / 60 / 60 / 24);
- var expiration = Math.round(retention - interval);
- if(expiration <= 0) {
- return '<span class="label label-danger">expired</span>';
- }
+ if(interval < 1) {
+ return '<span id="lastwritten" data-toggle="tooltip" title="' + data.lastwritten + '">today</span>';
+ }
+ else if(interval <= 31 && interval >= 1) {
+ return '<span id="lastwritten" data-toggle="tooltip" title="' + data.lastwritten + '">' + interval + ' day(s) ago</span>';
+ }
+ else if(interval >= 31 && interval <= 365) {
+ return '<span id="lastwritten" data-toggle="tooltip" title="' + data.lastwritten + '">' + Math.round(interval / 31) + ' month(s) ago</span>';
+ }
+ else if(interval > 365) {
+ return '<span id="lastwritten" data-toggle="tooltip" title="' + data.lastwritten + '">' + Math.round(interval / 365) + ' year(s) ago</span>';
+ }
+ else {
+ return data.lastwritten;
+ }
+ }
+ }
+ },
+ {
+ "targets": 5,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.volstatus;
+ }
+ },
+ {
+ "targets": 6,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ if(data.volstatus == "Used" || data.volstatus == "Full") {
+ if(data.lastwritten == null || data.lastwritten == "") {
+ return '-';
+ }
+ else {
+ var d = Date.now() / 1000;
+ var a = data.lastwritten.split(" ");
+ var b = new Date(a[0]).getTime() / 1000;
+ var interval = (d - b) / (3600 * 24);
+ var retention = Math.round(data.volretention / 60 / 60 / 24);
+ var expiration = Math.round(retention - interval);
+ if(expiration <= 0) {
+ return '<span class="label label-danger">expired</span>';
+ }
- if(expiration > 0) {
- return '<span class="label label-warning">expires in ' + expiration + ' days</span>';
- }
- }
- }
- else {
- return Math.round((data.volretention / 60 / 60 / 24)) + ' days';
- }
- }
- },
- {
- "targets": 7,
- "data": null,
- "render": function(data, type, full, meta) {
- if(data.maxvolbytes == 0) return "-";
- var k = 1000;
- var units = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB"];
- var i = Math.floor(Math.log(data.maxvolbytes) / Math.log(k));
- return parseFloat((data.maxvolbytes / Math.pow(k, i)).toFixed(2)) + " " + units[i];
- }
- },
- {
- "targets": 8,
- "data": null,
- "render": function(data, type, full, meta) {
- if(data.volbytes == 0) return "0.00 B";
- var k = 1000;
- var units = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB"];
- var i = Math.floor(Math.log(data.volbytes) / Math.log(k));
- return parseFloat((data.volbytes / Math.pow(k, i)).toFixed(2)) + " " + units[i];
- }
- },
- {
- "targets": 9,
- "data": null,
- "render": function(data, type, full, meta) {
- if(data.maxvolbytes == null || data.maxvolbytes == 0) return "-";
- if(data.volbytes == null || data.volbytes == 0) return "0.00 B";
- var d = data.maxvolbytes - data.volbytes;
- var k = 1000;
- var units = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB"];
- var i = Math.floor(Math.log(d) / Math.log(k));
- return parseFloat((d / Math.pow(k, i)).toFixed(2)) + " " + units[i];
- }
- }
- ]
+ if(expiration > 0) {
+ return '<span class="label label-warning">expires in ' + expiration + ' days</span>';
+ }
+ }
+ }
+ else {
+ return Math.round((data.volretention / 60 / 60 / 24)) + ' days';
+ }
+ }
+ },
+ {
+ "targets": 7,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ if(data.maxvolbytes == 0) return "-";
+ var k = 1000;
+ var units = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB"];
+ var i = Math.floor(Math.log(data.maxvolbytes) / Math.log(k));
+ return parseFloat((data.maxvolbytes / Math.pow(k, i)).toFixed(2)) + " " + units[i];
+ }
+ },
+ {
+ "targets": 8,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ if(data.volbytes == 0) return "0.00 B";
+ var k = 1000;
+ var units = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB"];
+ var i = Math.floor(Math.log(data.volbytes) / Math.log(k));
+ return parseFloat((data.volbytes / Math.pow(k, i)).toFixed(2)) + " " + units[i];
+ }
+ },
+ {
+ "targets": 9,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ if(data.maxvolbytes == null || data.maxvolbytes == 0) return "-";
+ if(data.volbytes == null || data.volbytes == 0) return "0.00 B";
+ var d = data.maxvolbytes - data.volbytes;
+ var k = 1000;
+ var units = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB"];
+ var i = Math.floor(Math.log(d) / Math.log(k));
+ return parseFloat((d / Math.pow(k, i)).toFixed(2)) + " " + units[i];
+ }
+ }
+ ]
- } );
+ } );
- $('#volumes tbody').on('mouseover', '#lastwritten', function () {
- $('[data-toggle="tooltip"]').tooltip();
- } );
+ $('#volumes tbody').on('mouseover', '#lastwritten', function () {
+ $('[data-toggle="tooltip"]').tooltip();
+ } );
- $('#volumes tbody').on('click', 'td.details-control', function () {
- var tr = $(this).closest('tr');
- var row = table.row( tr );
- if ( row.child.isShown() ) {
- // This row is already open - close it
- row.child.hide();
- tr.removeClass('shown');
- }
- else {
- // Open this row
- row.child( format(row.data()) ).show();
- tr.addClass('shown');
- }
- } );
+ $('#volumes tbody').on('click', 'td.details-control', function () {
+ var tr = $(this).closest('tr');
+ var row = table.row( tr );
+ if ( row.child.isShown() ) {
+ // This row is already open - close it
+ row.child.hide();
+ tr.removeClass('shown');
+ }
+ else {
+ // Open this row
+ row.child( format(row.data()) ).show();
+ tr.addClass('shown');
+ }
+ } );
} );
diff --git a/module/Pool/Module.php b/module/Pool/Module.php
index 0c09483..d1744d6 100644
--- a/module/Pool/Module.php
+++ b/module/Pool/Module.php
@@ -8,36 +8,36 @@ use Pool\Model\PoolModel;
class Module
{
- public function getAutoloaderConfig()
- {
- return array(
- 'Zend\Loader\ClassMapAutoloader' => array(
- __DIR__ . '/autoload_classmap.php',
- ),
- 'Zend\Loader\StandardAutoloader' => array(
- 'namespaces' => array(
- __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
- ),
- ),
- );
- }
-
- public function getConfig()
- {
- return include __DIR__ . '/config/module.config.php';
- }
-
- public function getServiceConfig()
- {
- return array(
- 'factories' => array(
- 'Pool\Model\PoolModel' => function() {
- $model = new PoolModel();
- return $model;
- }
- )
- );
- }
+ public function getAutoloaderConfig()
+ {
+ return array(
+ 'Zend\Loader\ClassMapAutoloader' => array(
+ __DIR__ . '/autoload_classmap.php',
+ ),
+ 'Zend\Loader\StandardAutoloader' => array(
+ 'namespaces' => array(
+ __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
+ ),
+ ),
+ );
+ }
+
+ public function getConfig()
+ {
+ return include __DIR__ . '/config/module.config.php';
+ }
+
+ public function getServiceConfig()
+ {
+ return array(
+ 'factories' => array(
+ 'Pool\Model\PoolModel' => function() {
+ $model = new PoolModel();
+ return $model;
+ }
+ )
+ );
+ }
}
diff --git a/module/Pool/config/module.config.php b/module/Pool/config/module.config.php
index fddbf52..2227808 100644
--- a/module/Pool/config/module.config.php
+++ b/module/Pool/config/module.config.php
@@ -3,7 +3,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/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
@@ -25,40 +25,40 @@
return array(
- 'controllers' => array(
- 'invokables' => array(
- 'Pool\Controller\Pool' => 'Pool\Controller\PoolController',
- ),
- ),
- 'controller_plugins' => array(
- 'invokables' => array(
- 'SessionTimeoutPlugin' => 'Application\Controller\Plugin\SessionTimeoutPlugin',
- ),
- ),
- 'router' => array(
- 'routes' => array(
- 'pool' => array(
- 'type' => 'segment',
- 'options' => array(
- 'route' => '/pool[/][:action][/][:id]',
- 'constraints' => array(
- 'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
- 'id' => '[a-zA-Z][a-zA-Z0-9_-]*',
- ),
- 'defaults' => array(
- 'controller' => 'Pool\Controller\Pool',
- 'action' => 'index',
- ),
- ),
+ 'controllers' => array(
+ 'invokables' => array(
+ 'Pool\Controller\Pool' => 'Pool\Controller\PoolController',
+ ),
+ ),
+ 'controller_plugins' => array(
+ 'invokables' => array(
+ 'SessionTimeoutPlugin' => 'Application\Controller\Plugin\SessionTimeoutPlugin',
+ ),
+ ),
+ 'router' => array(
+ 'routes' => array(
+ 'pool' => array(
+ 'type' => 'segment',
+ 'options' => array(
+ 'route' => '/pool[/][:action][/][:id]',
+ 'constraints' => array(
+ 'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
+ 'id' => '[a-zA-Z][a-zA-Z0-9_-]*',
+ ),
+ 'defaults' => array(
+ 'controller' => 'Pool\Controller\Pool',
+ 'action' => 'index',
+ ),
+ ),
- ),
- ),
- ),
+ ),
+ ),
+ ),
- 'view_manager' => array(
- 'template_path_stack' => array(
- 'pool' => __DIR__ . '/../view',
- ),
- ),
+ 'view_manager' => array(
+ 'template_path_stack' => array(
+ 'pool' => __DIR__ . '/../view',
+ ),
+ ),
);
diff --git a/module/Pool/src/Pool/Controller/PoolController.php b/module/Pool/src/Pool/Controller/PoolController.php
index e994833..c0fe3e9 100644
--- a/module/Pool/src/Pool/Controller/PoolController.php
+++ b/module/Pool/src/Pool/Controller/PoolController.php
@@ -31,85 +31,85 @@ use Zend\Json\Json;
class PoolController extends AbstractActionController
{
- protected $poolModel;
-
- public function indexAction()
- {
- if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
-
- $pools = $this->getPoolModel()->getPools();
-
- return new ViewModel(
- array(
- 'pools' => $pools,
- )
- );
-
- }
- else {
- return $this->redirect()->toRoute('auth', array('action' => 'login'));
- }
- }
-
- public function detailsAction()
- {
- if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
-
-
- $poolname = $this->params()->fromRoute('id');
- $pool = $this->getPoolModel()->getPool($poolname);
-
- return new ViewModel(
- array(
- 'pool' => $poolname,
- )
- );
- }
- else {
- return $this->redirect()->toRoute('auth', array('action' => 'login'));
- }
- }
-
- public function getDataAction()
- {
- if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
-
- $data = $this->params()->fromQuery('data');
- $pool = $this->params()->fromQuery('pool');
-
- if($data == "all") {
- $result = $this->getPoolModel()->getPools();
- }
- elseif($data == "details" && isset($pool)) {
- $result = $this->getPoolModel()->getPool($pool);
- }
- elseif($data == "volumes" && isset($pool)) {
- $result = $this->getPoolModel()->getPoolMedia($pool);
- }
- else {
- $result = null;
- }
-
- $response = $this->getResponse();
- $response->getHeaders()->addHeaderLine('Content-Type', 'application/json');
-
- if(isset($result)) {
- $response->setContent(JSON::encode($result));
- }
-
- return $response;
- }
- else {
- return $this->redirect()->toRoute('auth', array('action' => 'login'));
- }
- }
-
- public function getPoolModel()
- {
- if(!$this->poolModel) {
- $sm = $this->getServiceLocator();
- $this->poolModel = $sm->get('Pool\Model\PoolModel');
- }
- return $this->poolModel;
- }
+ protected $poolModel;
+
+ public function indexAction()
+ {
+ if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
+
+ $pools = $this->getPoolModel()->getPools();
+
+ return new ViewModel(
+ array(
+ 'pools' => $pools,
+ )
+ );
+
+ }
+ else {
+ return $this->redirect()->toRoute('auth', array('action' => 'login'));
+ }
+ }
+
+ public function detailsAction()
+ {
+ if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
+
+
+ $poolname = $this->params()->fromRoute('id');
+ $pool = $this->getPoolModel()->getPool($poolname);
+
+ return new ViewModel(
+ array(
+ 'pool' => $poolname,
+ )
+ );
+ }
+ else {
+ return $this->redirect()->toRoute('auth', array('action' => 'login'));
+ }
+ }
+
+ public function getDataAction()
+ {
+ if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
+
+ $data = $this->params()->fromQuery('data');
+ $pool = $this->params()->fromQuery('pool');
+
+ if($data == "all") {
+ $result = $this->getPoolModel()->getPools();
+ }
+ elseif($data == "details" && isset($pool)) {
+ $result = $this->getPoolModel()->getPool($pool);
+ }
+ elseif($data == "volumes" && isset($pool)) {
+ $result = $this->getPoolModel()->getPoolMedia($pool);
+ }
+ else {
+ $result = null;
+ }
+
+ $response = $this->getResponse();
+ $response->getHeaders()->addHeaderLine('Content-Type', 'application/json');
+
+ if(isset($result)) {
+ $response->setContent(JSON::encode($result));
+ }
+
+ return $response;
+ }
+ else {
+ return $this->redirect()->toRoute('auth', array('action' => 'login'));
+ }
+ }
+
+ public function getPoolModel()
+ {
+ if(!$this->poolModel) {
+ $sm = $this->getServiceLocator();
+ $this->poolModel = $sm->get('Pool\Model\PoolModel');
+ }
+ return $this->poolModel;
+ }
}
diff --git a/module/Pool/src/Pool/Model/PoolModel.php b/module/Pool/src/Pool/Model/PoolModel.php
index 94cd78f..d062568 100644
--- a/module/Pool/src/Pool/Model/PoolModel.php
+++ b/module/Pool/src/Pool/Model/PoolModel.php
@@ -30,57 +30,57 @@ use Zend\ServiceManager\ServiceLocatorInterface;
class PoolModel implements ServiceLocatorAwareInterface
{
- protected $serviceLocator;
- protected $director;
+ protected $serviceLocator;
+ protected $director;
- public function __construct()
- {
- }
+ public function __construct()
+ {
+ }
- public function setServiceLocator(ServiceLocatorInterface $serviceLocator)
- {
- $this->serviceLocator = $serviceLocator;
- }
+ public function setServiceLocator(ServiceLocatorInterface $serviceLocator)
+ {
+ $this->serviceLocator = $serviceLocator;
+ }
- public function getServiceLocator()
- {
- return $this->serviceLocator;
- }
+ public function getServiceLocator()
+ {
+ return $this->serviceLocator;
+ }
- public function getPools()
- {
- $cmd = 'llist pools';
- $this->director = $this->getServiceLocator()->get('director');
- $result = $this->director->send_command($cmd, 2, null);
- $pools = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
- return $pools['result']['pools'];
- }
+ public function getPools()
+ {
+ $cmd = 'llist pools';
+ $this->director = $this->getServiceLocator()->get('director');
+ $result = $this->director->send_command($cmd, 2, null);
+ $pools = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
+ return $pools['result']['pools'];
+ }
- public function getPool($pool=null)
- {
- if(isset($pool)) {
- $cmd = 'llist pool="'.$pool.'"';
- $this->director = $this->getServiceLocator()->get('director');
- $result = $this->director->send_command($cmd, 2, null);
- $pool = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
- return $pool['result']['pools'];
- }
- else {
- return false;
- }
- }
+ public function getPool($pool=null)
+ {
+ if(isset($pool)) {
+ $cmd = 'llist pool="'.$pool.'"';
+ $this->director = $this->getServiceLocator()->get('director');
+ $result = $this->director->send_command($cmd, 2, null);
+ $pool = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
+ return $pool['result']['pools'];
+ }
+ else {
+ return false;
+ }
+ }
- public function getPoolMedia($pool=null)
- {
- if(isset($pool)) {
- $cmd = 'llist media pool="'.$pool.'"';
- $this->director = $this->getServiceLocator()->get('director');
- $result = $this->director->send_command($cmd, 2, null);
- $media = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
- return $media['result']['volumes'];
- }
- else {
- return false;
- }
- }
+ public function getPoolMedia($pool=null)
+ {
+ if(isset($pool)) {
+ $cmd = 'llist media pool="'.$pool.'"';
+ $this->director = $this->getServiceLocator()->get('director');
+ $result = $this->director->send_command($cmd, 2, null);
+ $media = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
+ return $media['result']['volumes'];
+ }
+ else {
+ return false;
+ }
+ }
}
diff --git a/module/Pool/view/pool/pool/details.phtml b/module/Pool/view/pool/pool/details.phtml
index 1920196..a64ef7e 100644
--- a/module/Pool/view/pool/pool/details.phtml
+++ b/module/Pool/view/pool/pool/details.phtml
@@ -44,13 +44,13 @@ $this->headTitle($title);
<table class="table table-hover" id="pool">
<thead class="bg-primary">
- <th>Name</th>
- <th>Type</th>
- <th>Volumes</th>
- <th>Maximum volumes</th>
- <th>Volume retention</th>
- <th>Maximum volume jobs</th>
- <th>Maximum volume bytes</th>
+ <th>Name</th>
+ <th>Type</th>
+ <th>Volumes</th>
+ <th>Maximum volumes</th>
+ <th>Volume retention</th>
+ <th>Maximum volume jobs</th>
+ <th>Maximum volume bytes</th>
</thead>
</table>
@@ -75,16 +75,16 @@ $this->headTitle($title);
<table class="table table-hover" id="volumes">
<thead class="bg-primary">
- <th></th>
- <th>Name</th>
- <th>Storage</th>
- <th>Type</th>
- <th>Last written</th>
- <th>Status</th>
- <th>Retention/Expiration</th>
- <th>Maximum bytes</th>
- <th>Current bytes</th>
- <th>Free bytes</th>
+ <th></th>
+ <th>Name</th>
+ <th>Storage</th>
+ <th>Type</th>
+ <th>Last written</th>
+ <th>Status</th>
+ <th>Retention/Expiration</th>
+ <th>Maximum bytes</th>
+ <th>Current bytes</th>
+ <th>Free bytes</th>
</thead>
</table>
@@ -103,15 +103,15 @@ $this->headTitle($title);
<style>
td.details-control:after {
- font-family: "Glyphicons Halflings";
- content: "\e081";
- cursor: pointer;
+ font-family: "Glyphicons Halflings";
+ content: "\e081";
+ cursor: pointer;
}
tr.shown td.details-control:after {
- font-family: "Glyphicons Halflings";
- content: "\e082";
- cursor: pointer;
+ font-family: "Glyphicons Halflings";
+ content: "\e082";
+ cursor: pointer;
}
</style>
@@ -120,294 +120,294 @@ tr.shown td.details-control:after {
function format( d ) {
- var r;
-
- if(d.recycle == 1) {
- r = '<span class="label label-success">Yes</span>';
- }
- else {
- r = '<span class="label label-danger">No</span>';
- }
-
- return '<table class="table table-bordered">'+
- '<tr>'+
- '<th>Label date</th>'+
- '<td>'+ d.labeldate +'</td>'+
- '</tr>'+
- '<tr>'+
- '<th>First written</th>'+
- '<td>'+ d.firstwritten +'</td>'+
- '</tr>'+
- '<tr>'+
- '<th>Last written</th>'+
- '<td>'+ d.lastwritten +'</td>'+
- '</tr>'+
- '<tr>'+
- '<th>Volume jobs</th>'+
- '<td>'+ d.voljobs +'</td>'+
- '</tr>'+
- '<tr>'+
- '<th>Recycle</th>'+
- '<td>'+ r +'</td>'+
- '</tr>'+
- '</table>';
+ var r;
+
+ if(d.recycle == 1) {
+ r = '<span class="label label-success">Yes</span>';
+ }
+ else {
+ r = '<span class="label label-danger">No</span>';
+ }
+
+ return '<table class="table table-bordered">'+
+ '<tr>'+
+ '<th>Label date</th>'+
+ '<td>'+ d.labeldate +'</td>'+
+ '</tr>'+
+ '<tr>'+
+ '<th>First written</th>'+
+ '<td>'+ d.firstwritten +'</td>'+
+ '</tr>'+
+ '<tr>'+
+ '<th>Last written</th>'+
+ '<td>'+ d.lastwritten +'</td>'+
+ '</tr>'+
+ '<tr>'+
+ '<th>Volume jobs</th>'+
+ '<td>'+ d.voljobs +'</td>'+
+ '</tr>'+
+ '<tr>'+
+ '<th>Recycle</th>'+
+ '<td>'+ r +'</td>'+
+ '</tr>'+
+ '</table>';
}
$(document).ready(function() {
- var tab_pool = $('#pool').DataTable( {
- "ajax": {
- "url": "<?php echo $this->url('pool', array('action' => 'getData'), null) . '?data=details&pool='.$this->pool; ?>",
- "dataSrc": ""
- },
- "columns" : [
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null }
- ],
- "paging": false,
- "ordering": false,
- "info": false,
- "pagingType": "full_numbers",
- "stateSave": true,
- "bFilter": false,
- "columnDefs": [
- {
- "targets": 0,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.name;
- }
- },
- {
- "targets": 1,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.pooltype;
- }
- },
- {
- "targets": 2,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.numvols;
- }
- },
- {
- "targets": 3,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.maxvols;
- }
- },
- {
- "targets": 4,
- "data": null,
- "render": function(data, type, full, meta) {
- return Math.round((data.volretention / 60 / 60 / 24)) + ' days';
- }
- },
- {
- "targets": 5,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.maxvoljobs;
- }
- },
- {
- "targets": 6,
- "data": null,
- "render": function(data, type, full, meta) {
- if(data.maxvolbytes == 0) return "-";
- var k = 1000;
- var units = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB"];
- var i = Math.floor(Math.log(data.maxvolbytes) / Math.log(k));
- return parseFloat((data.maxvolbytes / Math.pow(k, i)).toFixed(2)) + " " + units[i];
- }
- }
- ]
-
- } );
-
- var tab_volumes = $('#volumes').DataTable( {
- "ajax": {
- "url": "<?php echo $this->url('pool', array('action' => 'getData'), null) . '?data=volumes&pool='.$this->pool; ?>",
- "dataSrc": ""
- },
- "columns": [
- {
- "className": 'details-control',
- "data": null,
- "orderable": false,
- "defaultContent": ''
- },
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null }
- ],
- "paging": true,
- "ordering": true,
- "info": true,
- "pagingType": "full_numbers",
- "stateSave": true,
- "columnDefs": [
- {
- "targets": 1,
- "data": null,
- "render": function(data, type, full, meta) {
- return '<a href="<?php echo $this->basePath() . '/media/details/'; ?>'+data.volumename+'">'+data.volumename+'</a>';
- }
- },
- {
- "targets": 2,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.storageid;
- }
- },
- {
- "targets": 3,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.mediatype;
- }
- },
- {
- "targets": 4,
- "data": null,
- "render": function(data, type, full, meta) {
-
- if(data.lastwritten == null || data.lastwritten == "") {
- return 'never';
- }
- else {
- var d = Date.now() / 1000;
- var a = data.lastwritten.split(" ");
- var b = new Date(a[0]).getTime() / 1000;
- var interval = Math.floor( (d - b) / (3600 * 24) );
-
- if(interval < 1) {
- return '<span id="lastwritten" data-toggle="tooltip" title="' + data.lastwritten + '">today</span>';
- }
- else if(interval <= 31 && interval >= 1) {
- return '<span id="lastwritten" data-toggle="tooltip" title="' + data.lastwritten + '">' + interval + ' day(s) ago</span>';
- }
- else if(interval >= 31 && interval <= 365) {
- return '<span id="lastwritten" data-toggle="tooltip" title="' + data.lastwritten + '">' + Math.round(interval / 31) + ' month(s) ago</span>';
- }
- else if(interval > 365) {
- return '<span id="lastwritten" data-toggle="tooltip" title="' + data.lastwritten + '">' + Math.round(interval / 365) + ' year(s) ago</span>';
- }
- else {
- return data.lastwritten;
- }
- }
- }
- },
- {
- "targets": 5,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.volstatus;
- }
- },
- {
- "targets": 6,
- "data": null,
- "render": function(data, type, full, meta) {
- if(data.volstatus == "Used" || data.volstatus == "Full") {
- if(data.lastwritten == null || data.lastwritten == "") {
- return '-';
- }
- else {
- var d = Date.now() / 1000;
- var a = data.lastwritten.split(" ");
- var b = new Date(a[0]).getTime() / 1000;
- var interval = (d - b) / (3600 * 24);
- var retention = Math.round(data.volretention / 60 / 60 / 24);
- var expiration = Math.round(retention - interval);
- if(expiration <= 0) {
- return '<span class="label label-danger">expired</span>';
- }
-
- if(expiration > 0) {
- return '<span class="label label-warning">expires in ' + expiration + ' days</span>';
- }
- }
- }
- else {
- return Math.round((data.volretention / 60 / 60 / 24)) + ' days';
- }
- }
- },
- {
- "targets": 7,
- "data": null,
- "render": function(data, type, full, meta) {
- if(data.maxvolbytes == 0) return "-";
- var k = 1000;
- var units = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB"];
- var i = Math.floor(Math.log(data.maxvolbytes) / Math.log(k));
- return parseFloat((data.maxvolbytes / Math.pow(k, i)).toFixed(2)) + " " + units[i];
- }
- },
- {
- "targets": 8,
- "data": null,
- "render": function(data, type, full, meta) {
- if(data.volbytes == 0) return "0.00 B";
- var k = 1000;
- var units = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB"];
- var i = Math.floor(Math.log(data.volbytes) / Math.log(k));
- return parseFloat((data.volbytes / Math.pow(k, i)).toFixed(2)) + " " + units[i];
- }
- },
- {
- "targets": 9,
- "data": null,
- "render": function(data, type, full, meta) {
- if(data.maxvolbytes == null || data.maxvolbytes == 0) return "-";
- if(data.volbytes == null || data.volbytes == 0) return "0.00 B";
- var d = data.maxvolbytes - data.volbytes;
- var k = 1000;
- var units = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB"];
- var i = Math.floor(Math.log(d) / Math.log(k));
- return parseFloat((d / Math.pow(k, i)).toFixed(2)) + " " + units[i];
- }
- }
- ]
-
- } );
-
-
- $('#volumes tbody').on('mouseover', '#lastwritten', function () {
- $('[data-toggle="tooltip"]').tooltip();
- } );
-
- $('#volumes tbody').on('click', 'td.details-control', function () {
- var tr = $(this).closest('tr');
- var row = tab_volumes.row( tr );
- if ( row.child.isShown() ) {
- // This row is already open - close it
- row.child.hide();
- tr.removeClass('shown');
- }
- else {
- // Open this row
- row.child( format(row.data()) ).show();
- tr.addClass('shown');
- }
- } );
+ var tab_pool = $('#pool').DataTable( {
+ "ajax": {
+ "url": "<?php echo $this->url('pool', array('action' => 'getData'), null) . '?data=details&pool='.$this->pool; ?>",
+ "dataSrc": ""
+ },
+ "columns" : [
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null }
+ ],
+ "paging": false,
+ "ordering": false,
+ "info": false,
+ "pagingType": "full_numbers",
+ "stateSave": true,
+ "bFilter": false,
+ "columnDefs": [
+ {
+ "targets": 0,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.name;
+ }
+ },
+ {
+ "targets": 1,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.pooltype;
+ }
+ },
+ {
+ "targets": 2,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.numvols;
+ }
+ },
+ {
+ "targets": 3,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.maxvols;
+ }
+ },
+ {
+ "targets": 4,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return Math.round((data.volretention / 60 / 60 / 24)) + ' days';
+ }
+ },
+ {
+ "targets": 5,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.maxvoljobs;
+ }
+ },
+ {
+ "targets": 6,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ if(data.maxvolbytes == 0) return "-";
+ var k = 1000;
+ var units = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB"];
+ var i = Math.floor(Math.log(data.maxvolbytes) / Math.log(k));
+ return parseFloat((data.maxvolbytes / Math.pow(k, i)).toFixed(2)) + " " + units[i];
+ }
+ }
+ ]
+
+ } );
+
+ var tab_volumes = $('#volumes').DataTable( {
+ "ajax": {
+ "url": "<?php echo $this->url('pool', array('action' => 'getData'), null) . '?data=volumes&pool='.$this->pool; ?>",
+ "dataSrc": ""
+ },
+ "columns": [
+ {
+ "className": 'details-control',
+ "data": null,
+ "orderable": false,
+ "defaultContent": ''
+ },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null }
+ ],
+ "paging": true,
+ "ordering": true,
+ "info": true,
+ "pagingType": "full_numbers",
+ "stateSave": true,
+ "columnDefs": [
+ {
+ "targets": 1,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return '<a href="<?php echo $this->basePath() . '/media/details/'; ?>'+data.volumename+'">'+data.volumename+'</a>';
+ }
+ },
+ {
+ "targets": 2,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.storageid;
+ }
+ },
+ {
+ "targets": 3,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.mediatype;
+ }
+ },
+ {
+ "targets": 4,
+ "data": null,
+ "render": function(data, type, full, meta) {
+
+ if(data.lastwritten == null || data.lastwritten == "") {
+ return 'never';
+ }
+ else {
+ var d = Date.now() / 1000;
+ var a = data.lastwritten.split(" ");
+ var b = new Date(a[0]).getTime() / 1000;
+ var interval = Math.floor( (d - b) / (3600 * 24) );
+
+ if(interval < 1) {
+ return '<span id="lastwritten" data-toggle="tooltip" title="' + data.lastwritten + '">today</span>';
+ }
+ else if(interval <= 31 && interval >= 1) {
+ return '<span id="lastwritten" data-toggle="tooltip" title="' + data.lastwritten + '">' + interval + ' day(s) ago</span>';
+ }
+ else if(interval >= 31 && interval <= 365) {
+ return '<span id="lastwritten" data-toggle="tooltip" title="' + data.lastwritten + '">' + Math.round(interval / 31) + ' month(s) ago</span>';
+ }
+ else if(interval > 365) {
+ return '<span id="lastwritten" data-toggle="tooltip" title="' + data.lastwritten + '">' + Math.round(interval / 365) + ' year(s) ago</span>';
+ }
+ else {
+ return data.lastwritten;
+ }
+ }
+ }
+ },
+ {
+ "targets": 5,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.volstatus;
+ }
+ },
+ {
+ "targets": 6,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ if(data.volstatus == "Used" || data.volstatus == "Full") {
+ if(data.lastwritten == null || data.lastwritten == "") {
+ return '-';
+ }
+ else {
+ var d = Date.now() / 1000;
+ var a = data.lastwritten.split(" ");
+ var b = new Date(a[0]).getTime() / 1000;
+ var interval = (d - b) / (3600 * 24);
+ var retention = Math.round(data.volretention / 60 / 60 / 24);
+ var expiration = Math.round(retention - interval);
+ if(expiration <= 0) {
+ return '<span class="label label-danger">expired</span>';
+ }
+
+ if(expiration > 0) {
+ return '<span class="label label-warning">expires in ' + expiration + ' days</span>';
+ }
+ }
+ }
+ else {
+ return Math.round((data.volretention / 60 / 60 / 24)) + ' days';
+ }
+ }
+ },
+ {
+ "targets": 7,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ if(data.maxvolbytes == 0) return "-";
+ var k = 1000;
+ var units = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB"];
+ var i = Math.floor(Math.log(data.maxvolbytes) / Math.log(k));
+ return parseFloat((data.maxvolbytes / Math.pow(k, i)).toFixed(2)) + " " + units[i];
+ }
+ },
+ {
+ "targets": 8,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ if(data.volbytes == 0) return "0.00 B";
+ var k = 1000;
+ var units = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB"];
+ var i = Math.floor(Math.log(data.volbytes) / Math.log(k));
+ return parseFloat((data.volbytes / Math.pow(k, i)).toFixed(2)) + " " + units[i];
+ }
+ },
+ {
+ "targets": 9,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ if(data.maxvolbytes == null || data.maxvolbytes == 0) return "-";
+ if(data.volbytes == null || data.volbytes == 0) return "0.00 B";
+ var d = data.maxvolbytes - data.volbytes;
+ var k = 1000;
+ var units = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB"];
+ var i = Math.floor(Math.log(d) / Math.log(k));
+ return parseFloat((d / Math.pow(k, i)).toFixed(2)) + " " + units[i];
+ }
+ }
+ ]
+
+ } );
+
+
+ $('#volumes tbody').on('mouseover', '#lastwritten', function () {
+ $('[data-toggle="tooltip"]').tooltip();
+ } );
+
+ $('#volumes tbody').on('click', 'td.details-control', function () {
+ var tr = $(this).closest('tr');
+ var row = tab_volumes.row( tr );
+ if ( row.child.isShown() ) {
+ // This row is already open - close it
+ row.child.hide();
+ tr.removeClass('shown');
+ }
+ else {
+ // Open this row
+ row.child( format(row.data()) ).show();
+ tr.addClass('shown');
+ }
+ } );
} );
diff --git a/module/Pool/view/pool/pool/index.phtml b/module/Pool/view/pool/pool/index.phtml
index ea117e2..5da3e8f 100644
--- a/module/Pool/view/pool/pool/index.phtml
+++ b/module/Pool/view/pool/pool/index.phtml
@@ -43,13 +43,13 @@ $this->headTitle($title);
<table class="table table-hover" id="pools">
<thead class="bg-primary">
- <th>Name</th>
- <th>Type</th>
- <th>Volumes</th>
- <th>Maximum volumes</th>
- <th>Volume retention</th>
- <th>Maximum volume jobs</th>
- <th>Maximum volume bytes</th>
+ <th>Name</th>
+ <th>Type</th>
+ <th>Volumes</th>
+ <th>Maximum volumes</th>
+ <th>Volume retention</th>
+ <th>Maximum volume jobs</th>
+ <th>Maximum volume bytes</th>
</thead>
</table>
@@ -68,79 +68,79 @@ $this->headTitle($title);
<script>
var table= $('#pools').DataTable( {
- "ajax": {
- "url": "<?php echo $this->url('pool', array('action' => 'getData'), null) . '?data=all'; ?>",
- "dataSrc": ""
- },
- "columns" : [
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null },
- { "data": null }
- ],
- "paging": true,
- "ordering": true,
- "info": true,
- "pagingType": "full_numbers",
- "stateSave": true,
- "columnDefs": [
- {
- "targets": 0,
- "data": null,
- "render": function(data, type, full, meta) {
- return '<a href="<?php echo $this->basePath() . '/pool/details/'; ?>'+data.name+'">'+data.name+'</a>';
- }
- },
- {
- "targets": 1,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.pooltype;
- }
- },
- {
- "targets": 2,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.numvols;
- }
- },
- {
- "targets": 3,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.maxvols;
- }
- },
- {
- "targets": 4,
- "data": null,
- "render": function(data, type, full, meta) {
- return Math.round((data.volretention / 60 / 60 / 24)) + ' days';
- }
- },
- {
- "targets": 5,
- "data": null,
- "render": function(data, type, full, meta) {
- return data.maxvoljobs;
- }
- },
- {
- "targets": 6,
- "data": null,
- "render": function(data, type, full, meta) {
- if(data.maxvolbytes == 0) return "-";
- var k = 1000;
- var units = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB"];
- var i = Math.floor(Math.log(data.maxvolbytes) / Math.log(k));
- return parseFloat((data.maxvolbytes / Math.pow(k, i)).toFixed(2)) + " " + units[i];
- }
- }
- ]
+ "ajax": {
+ "url": "<?php echo $this->url('pool', array('action' => 'getData'), null) . '?data=all'; ?>",
+ "dataSrc": ""
+ },
+ "columns" : [
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null },
+ { "data": null }
+ ],
+ "paging": true,
+ "ordering": true,
+ "info": true,
+ "pagingType": "full_numbers",
+ "stateSave": true,
+ "columnDefs": [
+ {
+ "targets": 0,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return '<a href="<?php echo $this->basePath() . '/pool/details/'; ?>'+data.name+'">'+data.name+'</a>';
+ }
+ },
+ {
+ "targets": 1,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.pooltype;
+ }
+ },
+ {
+ "targets": 2,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.numvols;
+ }
+ },
+ {
+ "targets": 3,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.maxvols;
+ }
+ },
+ {
+ "targets": 4,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return Math.round((data.volretention / 60 / 60 / 24)) + ' days';
+ }
+ },
+ {
+ "targets": 5,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ return data.maxvoljobs;
+ }
+ },
+ {
+ "targets": 6,
+ "data": null,
+ "render": function(data, type, full, meta) {
+ if(data.maxvolbytes == 0) return "-";
+ var k = 1000;
+ var units = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB"];
+ var i = Math.floor(Math.log(data.maxvolbytes) / Math.log(k));
+ return parseFloat((data.maxvolbytes / Math.pow(k, i)).toFixed(2)) + " " + units[i];
+ }
+ }
+ ]
} );
</script>
diff --git a/module/Restore/Module.php b/module/Restore/Module.php
index 7cd53d3..29bed2c 100644
--- a/module/Restore/Module.php
+++ b/module/Restore/Module.php
@@ -8,37 +8,37 @@ use Restore\Model\RestoreModel;
class Module
{
- public function getAutoloaderConfig()
- {
- return array(
- 'Zend\Loader\ClassMapAutoloader' => array(
- __DIR__ . '/autoload_classmap.php',
- ),
- 'Zend\Loader\StandardAutoloader' => array(
- 'namespaces' => array(
- __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
- ),
- ),
- );
- }
-
- public function getConfig()
- {
- return include __DIR__ . '/config/module.config.php';
- }
-
- public function getServiceConfig()
- {
- return array(
- 'factories' => array(
- 'Restore\Model\RestoreModel' => function()
- {
- $model = new RestoreModel();
- return $model;
- },
- ),
- );
- }
+ public function getAutoloaderConfig()
+ {
+ return array(
+ 'Zend\Loader\ClassMapAutoloader' => array(
+ __DIR__ . '/autoload_classmap.php',
+ ),
+ 'Zend\Loader\StandardAutoloader' => array(
+ 'namespaces' => array(
+ __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
+ ),
+ ),
+ );
+ }
+
+ public function getConfig()
+ {
+ return include __DIR__ . '/config/module.config.php';
+ }
+
+ public function getServiceConfig()
+ {
+ return array(
+ 'factories' => array(
+ 'Restore\Model\RestoreModel' => function()
+ {
+ $model = new RestoreModel();
+ return $model;
+ },
+ ),
+ );
+ }
}
diff --git a/module/Restore/config/module.config.php b/module/Restore/config/module.config.php
index e373314..aa7dab4 100644
--- a/module/Restore/config/module.config.php
+++ b/module/Restore/config/module.config.php
@@ -25,39 +25,39 @@
return array(
- 'controllers' => array(
- 'invokables' => array(
- 'Restore\Controller\Restore' => 'Restore\Controller\RestoreController',
- ),
- ),
- 'controller_plugins' => array(
- 'invokables' => array(
- 'SessionTimeoutPlugin' => 'Application\Controller\Plugin\SessionTimeoutPlugin',
- ),
- ),
- 'router' => array(
- 'routes' => array(
- 'restore' => array(
- 'type' => 'segment',
- 'options' => array(
- 'route' => '/restore[/][:action][/:id]',
- 'constraints' => array(
- 'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
- 'id' => '[0-9]+',
- ),
- 'defaults' => array(
- 'controller' => 'Restore\Controller\Restore',
- 'action' => 'index',
- ),
- ),
- ),
- ),
- ),
-
- 'view_manager' => array(
- 'template_path_stack' => array(
- 'restore' => __DIR__ . '/../view',
- ),
- ),
+ 'controllers' => array(
+ 'invokables' => array(
+ 'Restore\Controller\Restore' => 'Restore\Controller\RestoreController',
+ ),
+ ),
+ 'controller_plugins' => array(
+ 'invokables' => array(
+ 'SessionTimeoutPlugin' => 'Application\Controller\Plugin\SessionTimeoutPlugin',
+ ),
+ ),
+ 'router' => array(
+ 'routes' => array(
+ 'restore' => array(
+ 'type' => 'segment',
+ 'options' => array(
+ 'route' => '/restore[/][:action][/:id]',
+ 'constraints' => array(
+ 'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
+ 'id' => '[0-9]+',
+ ),
+ 'defaults' => array(
+ 'controller' => 'Restore\Controller\Restore',
+ 'action' => 'index',
+ ),
+ ),
+ ),
+ ),
+ ),
+
+ 'view_manager' => array(
+ 'template_path_stack' => array(
+ 'restore' => __DIR__ . '/../view',
+ ),
+ ),
);
diff --git a/module/Restore/src/Restore/Controller/RestoreController.php b/module/Restore/src/Restore/Controller/RestoreController.php
index 0f5e54e..eb8f172 100644
--- a/module/Restore/src/Restore/Controller/RestoreController.php
+++ b/module/Restore/src/Restore/Controller/RestoreController.php
@@ -34,365 +34,365 @@ use Restore\Form\RestoreForm;
class RestoreController extends AbstractActionController
{
- protected $restoreModel;
- protected $restore_params;
-
- /**
- *
- */
- public function indexAction()
- {
- if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
-
- $this->getRestoreParams();
- $errors = null;
-
- if($this->restore_params['client'] == null) {
- $clients = $this->getRestoreModel()->getClients();
- $client = array_pop($clients);
- $this->restore_params['client'] = $client['name'];
- }
-
- if($this->restore_params['type'] == "client" && $this->restore_params['jobid'] == null) {
- $latestbackup = $this->getRestoreModel()->getClientBackups($this->restore_params['client'], "any", "desc", 1);
- if(empty($latestbackup)) {
- $this->restore_params['jobid'] = null;
- }
- else {
- $this->restore_params['jobid'] = $latestbackup[0]['jobid'];
- }
- }
-
- if(isset($this->restore_params['mergejobs']) && $this->restore_params['mergejobs'] == 1) {
- $jobids = $this->restore_params['jobid'];
- }
- else {
- $jobids = $this->getRestoreModel()->getJobIds($this->restore_params['jobid'], $this->restore_params['mergefilesets']);
- $this->restore_params['jobids'] = $jobids;
- }
-
- if($this->restore_params['type'] == "client") {
- $backups = $this->getRestoreModel()->getClientBackups($this->restore_params['client'], "any", "desc");
- }
-
- //$jobs = $this->getRestoreModel()->getJobs();
- $clients = $this->getRestoreModel()->getClients();
- $filesets = $this->getRestoreModel()->getFilesets();
- $restorejobs = $this->getRestoreModel()->getRestoreJobs();
-
- if($backups == null) {
- $errors = 'No backups of client <strong>'.$this->restore_params['client'].'</strong> found.';
- }
-
- // Create the form
- $form = new RestoreForm(
- $this->restore_params,
- //$jobs,
- $clients,
- $filesets,
- $restorejobs,
- $jobids,
- $backups
- );
-
- // Set the method attribute for the form
- $form->setAttribute('method', 'post');
- $form->setAttribute('onsubmit','return getFiles()');
-
- $request = $this->getRequest();
-
- if($request->isPost()) {
-
- $restore = new Restore();
- $form->setInputFilter($restore->getInputFilter());
- $form->setData( $request->getPost() );
-
- if($form->isValid()) {
-
- if($this->restore_params['type'] == "client") {
-
- $type = $this->restore_params['type'];
- $jobid = $form->getInputFilter()->getValue('jobid');
- $client = $form->getInputFilter()->getValue('client');
- $restoreclient = $form->getInputFilter()->getValue('restoreclient');
- $restorejob = $form->getInputFilter()->getValue('restorejob');
- $where = $form->getInputFilter()->getValue('where');
- $fileid = $form->getInputFilter()->getValue('checked_files');
- $dirid = $form->getInputFilter()->getValue('checked_directories');
- $jobids = $form->getInputFilter()->getValue('jobids_hidden');
- $replace = $form->getInputFilter()->getValue('replace');
-
- $result = $this->getRestoreModel()->restore($type, $jobid, $client, $restoreclient, $restorejob, $where, $fileid, $dirid, $jobids, $replace);
-
- }
-
- return new ViewModel(array(
- 'result' => $result
- ));
-
- }
- else {
- return new ViewModel(array(
- 'restore_params' => $this->restore_params,
- 'form' => $form,
- ));
- }
-
- }
- else {
- return new ViewModel(array(
- 'restore_params' => $this->restore_params,
- 'form' => $form,
- 'errors' => $errors
- ));
- }
-
- }
- else {
- return $this->redirect()->toRoute('auth', array('action' => 'login'));
- }
- }
-
- /**
- * Delivers a subtree as Json for JStree
- */
- public function filebrowserAction()
- {
- if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
- $this->getRestoreParams();
- $this->layout('layout/json');
- return new ViewModel(array(
- 'items' => $this->buildSubtree()
- ));
- }
- else{
- return $this->redirect()->toRoute('auth', array('action' => 'login'));
- }
- }
-
- /**
- * Builds a subtree as Json for JStree
- */
- private function buildSubtree()
- {
-
- $this->getRestoreParams();
-
- // Get directories
- if($this->restore_params['type'] == "client") {
- $jobids = $this->getRestoreModel()->getJobIds($this->restore_params['jobid'],$this->restore_params['mergefilesets'],$this->restore_params['mergejobs']);
- $this->restore_params['jobids'] = $jobids;
- $directories = $this->getRestoreModel()->getDirectories($this->restore_params['jobids'],$this->restore_params['id']);
- }
- else {
- $directories = $this->getRestoreModel()->getDirectories($this->restore_params['jobid'],$this->restore_params['id']);
- }
-
- // Get files
- if($this->restore_params['type'] == "client") {
- $jobids = $this->getRestoreModel()->getJobIds($this->restore_params['jobid'],$this->restore_params['mergefilesets'],$this->restore_params['mergejobs']);
- $this->restore_params['jobids'] = $jobids;
- $files = $this->getRestoreModel()->getFiles($this->restore_params['jobids'],$this->restore_params['id']);
- }
- else {
- $files = $this->getRestoreModel()->getFiles($this->restore_params['jobid'],$this->restore_params['id']);
- }
-
- $dnum = count($directories);
- $fnum = count($files);
- $tmp = $dnum;
-
- // Build Json for JStree
- $items = '[';
-
- if($dnum > 0) {
-
- foreach($directories as $dir) {
- if($dir['name'] == ".") {
- --$dnum;
- next($directories);
- }
- elseif($dir['name'] == "..") {
- --$dnum;
- next($directories);
- }
- else {
- --$dnum;
- $items .= '{';
- $items .= '"id":"-' . $dir['pathid'] . '"';
- $items .= ',"text":"' . $dir["name"] . '"';
- $items .= ',"icon":"glyphicon glyphicon-folder-close"';
- $items .= ',"state":""';
- $items .= ',"data":' . \Zend\Json\Json::encode($dir, \Zend\Json\Json::TYPE_OBJECT);
- $items .= ',"children":true';
- $items .= '}';
- if($dnum > 0) {
- $items .= ",";
- }
- }
- }
-
- }
-
- if( $tmp > 2 && $fnum > 0 ) {
- $items .= ",";
- }
-
- if($fnum > 0) {
-
- foreach($files as $file) {
- $items .= '{';
- $items .= '"id":"' . $file["fileid"] . '"';
- $items .= ',"text":"' . $file["name"] . '"';
- $items .= ',"icon":"glyphicon glyphicon-file"';
- $items .= ',"state":""';
- $items .= ',"data":' . \Zend\Json\Json::encode($file, \Zend\Json\Json::TYPE_OBJECT);
- $items .= '}';
- --$fnum;
- if($fnum > 0) {
- $items .= ",";
- }
- }
-
- }
-
- $items .= ']';
-
- return $items;
- }
-
- /**
- * Retrieve restore parameters
- */
- private function getRestoreParams()
- {
- if($this->params()->fromQuery('type')) {
- $this->restore_params['type'] = $this->params()->fromQuery('type');
- }
- else {
- $this->restore_params['type'] = 'client';
- }
-
- if($this->params()->fromQuery('jobid')) {
- $this->restore_params['jobid'] = $this->params()->fromQuery('jobid');
- }
- else {
- $this->restore_params['jobid'] = null;
- }
-
- if($this->params()->fromQuery('client')) {
- $this->restore_params['client'] = $this->params()->fromQuery('client');
- }
- else {
- $this->restore_params['client'] = null;
- }
-
- if($this->params()->fromQuery('restoreclient')) {
- $this->restore_params['restoreclient'] = $this->params()->fromQuery('restoreclient');
- }
- else {
- $this->restore_params['restoreclient'] = null;
- }
-
- if($this->params()->fromQuery('restorejob')) {
- $this->restore_params['restorejob'] = $this->params()->fromQuery('restorejob');
- }
- else {
- $this->restore_params['restorejob'] = null;
- }
-
- if($this->params()->fromQuery('fileset')) {
- $this->restore_params['fileset'] = $this->params()->fromQuery('fileset');
- }
- else {
- $this->restore_params['fileset'] = null;
- }
-
- if($this->params()->fromQuery('before')) {
- $this->restore_params['before'] = $this->params()->fromQuery('before');
- }
- else {
- $this->restore_params['before'] = null;
- }
-
- if($this->params()->fromQuery('where')) {
- $this->restore_params['where'] = $this->params()->fromQuery('where');
- }
- else {
- $this->restore_params['where'] = null;
- }
-
- if($this->params()->fromQuery('fileid')) {
- $this->restore_params['fileid'] = $this->params()->fromQuery('fileid');
- }
- else {
- $this->restore_params['fileid'] = null;
- }
-
- if($this->params()->fromQuery('dirid')) {
- $this->restore_params['dirid'] = $this->params()->fromQuery('dirid');
- }
- else {
- $this->restore_params['dirid'] = null;
- }
-
- if($this->params()->fromQuery('id')) {
- $this->restore_params['id'] = $this->params()->fromQuery('id');
- }
- else {
- $this->restore_params['id'] = null;
- }
-
- if($this->params()->fromQuery('jobids')) {
- $this->restore_params['jobids'] = $this->params()->fromQuery('jobids');
- }
- else {
- $this->restore_params['jobids'] = null;
- }
-
- if($this->params()->fromQuery('mergefilesets')) {
- $this->restore_params['mergefilesets'] = $this->params()->fromQuery('mergefilesets');
- }
- else {
- $this->restore_params['mergefilesets'] = 0;
- }
-
- if($this->params()->fromQuery('mergejobs')) {
- $this->restore_params['mergejobs'] = $this->params()->fromQuery('mergejobs');
- }
- else {
- $this->restore_params['mergejobs'] = 0;
- }
-
- if($this->params()->fromQuery('replace')) {
- $this->restore_params['replace'] = $this->params()->fromQuery('replace');
- }
- else {
- $this->restore_params['replace'] = null;
- }
-
- if($this->params()->fromQuery('replaceoptions')) {
- $this->restore_params['replaceoptions'] = $this->params()->fromQuery('replaceoptions');
- }
- else {
- $this->restore_params['replaceoptions'] = null;
- }
-
- if($this->params()->fromQuery('versions')) {
- $this->restore_params['versions'] = $this->params()->fromQuery('versions');
- }
- else {
- $this->restore_params['versions'] = null;
- }
-
- }
-
- public function getRestoreModel()
- {
- if(!$this->restoreModel) {
- $sm = $this->getServiceLocator();
- $this->restoreModel = $sm->get('Restore\Model\RestoreModel');
- }
- return $this->restoreModel;
- }
+ protected $restoreModel;
+ protected $restore_params;
+
+ /**
+ *
+ */
+ public function indexAction()
+ {
+ if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
+
+ $this->getRestoreParams();
+ $errors = null;
+
+ if($this->restore_params['client'] == null) {
+ $clients = $this->getRestoreModel()->getClients();
+ $client = array_pop($clients);
+ $this->restore_params['client'] = $client['name'];
+ }
+
+ if($this->restore_params['type'] == "client" && $this->restore_params['jobid'] == null) {
+ $latestbackup = $this->getRestoreModel()->getClientBackups($this->restore_params['client'], "any", "desc", 1);
+ if(empty($latestbackup)) {
+ $this->restore_params['jobid'] = null;
+ }
+ else {
+ $this->restore_params['jobid'] = $latestbackup[0]['jobid'];
+ }
+ }
+
+ if(isset($this->restore_params['mergejobs']) && $this->restore_params['mergejobs'] == 1) {
+ $jobids = $this->restore_params['jobid'];
+ }
+ else {
+ $jobids = $this->getRestoreModel()->getJobIds($this->restore_params['jobid'], $this->restore_params['mergefilesets']);
+ $this->restore_params['jobids'] = $jobids;
+ }
+
+ if($this->restore_params['type'] == "client") {
+ $backups = $this->getRestoreModel()->getClientBackups($this->restore_params['client'], "any", "desc");
+ }
+
+ //$jobs = $this->getRestoreModel()->getJobs();
+ $clients = $this->getRestoreModel()->getClients();
+ $filesets = $this->getRestoreModel()->getFilesets();
+ $restorejobs = $this->getRestoreModel()->getRestoreJobs();
+
+ if($backups == null) {
+ $errors = 'No backups of client <strong>'.$this->restore_params['client'].'</strong> found.';
+ }
+
+ // Create the form
+ $form = new RestoreForm(
+ $this->restore_params,
+ //$jobs,
+ $clients,
+ $filesets,
+ $restorejobs,
+ $jobids,
+ $backups
+ );
+
+ // Set the method attribute for the form
+ $form->setAttribute('method', 'post');
+ $form->setAttribute('onsubmit','return getFiles()');
+
+ $request = $this->getRequest();
+
+ if($request->isPost()) {
+
+ $restore = new Restore();
+ $form->setInputFilter($restore->getInputFilter());
+ $form->setData( $request->getPost() );
+
+ if($form->isValid()) {
+
+ if($this->restore_params['type'] == "client") {
+
+ $type = $this->restore_params['type'];
+ $jobid = $form->getInputFilter()->getValue('jobid');
+ $client = $form->getInputFilter()->getValue('client');
+ $restoreclient = $form->getInputFilter()->getValue('restoreclient');
+ $restorejob = $form->getInputFilter()->getValue('restorejob');
+ $where = $form->getInputFilter()->getValue('where');
+ $fileid = $form->getInputFilter()->getValue('checked_files');
+ $dirid = $form->getInputFilter()->getValue('checked_directories');
+ $jobids = $form->getInputFilter()->getValue('jobids_hidden');
+ $replace = $form->getInputFilter()->getValue('replace');
+
+ $result = $this->getRestoreModel()->restore($type, $jobid, $client, $restoreclient, $restorejob, $where, $fileid, $dirid, $jobids, $replace);
+
+ }
+
+ return new ViewModel(array(
+ 'result' => $result
+ ));
+
+ }
+ else {
+ return new ViewModel(array(
+ 'restore_params' => $this->restore_params,
+ 'form' => $form,
+ ));
+ }
+
+ }
+ else {
+ return new ViewModel(array(
+ 'restore_params' => $this->restore_params,
+ 'form' => $form,
+ 'errors' => $errors
+ ));
+ }
+
+ }
+ else {
+ return $this->redirect()->toRoute('auth', array('action' => 'login'));
+ }
+ }
+
+ /**
+ * Delivers a subtree as Json for JStree
+ */
+ public function filebrowserAction()
+ {
+ if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
+ $this->getRestoreParams();
+ $this->layout('layout/json');
+ return new ViewModel(array(
+ 'items' => $this->buildSubtree()
+ ));
+ }
+ else{
+ return $this->redirect()->toRoute('auth', array('action' => 'login'));
+ }
+ }
+
+ /**
+ * Builds a subtree as Json for JStree
+ */
+ private function buildSubtree()
+ {
+
+ $this->getRestoreParams();
+
+ // Get directories
+ if($this->restore_params['type'] == "client") {
+ $jobids = $this->getRestoreModel()->getJobIds($this->restore_params['jobid'],$this->restore_params['mergefilesets'],$this->restore_params['mergejobs']);
+ $this->restore_params['jobids'] = $jobids;
+ $directories = $this->getRestoreModel()->getDirectories($this->restore_params['jobids'],$this->restore_params['id']);
+ }
+ else {
+ $directories = $this->getRestoreModel()->getDirectories($this->restore_params['jobid'],$this->restore_params['id']);
+ }
+
+ // Get files
+ if($this->restore_params['type'] == "client") {
+ $jobids = $this->getRestoreModel()->getJobIds($this->restore_params['jobid'],$this->restore_params['mergefilesets'],$this->restore_params['mergejobs']);
+ $this->restore_params['jobids'] = $jobids;
+ $files = $this->getRestoreModel()->getFiles($this->restore_params['jobids'],$this->restore_params['id']);
+ }
+ else {
+ $files = $this->getRestoreModel()->getFiles($this->restore_params['jobid'],$this->restore_params['id']);
+ }
+
+ $dnum = count($directories);
+ $fnum = count($files);
+ $tmp = $dnum;
+
+ // Build Json for JStree
+ $items = '[';
+
+ if($dnum > 0) {
+
+ foreach($directories as $dir) {
+ if($dir['name'] == ".") {
+ --$dnum;
+ next($directories);
+ }
+ elseif($dir['name'] == "..") {
+ --$dnum;
+ next($directories);
+ }
+ else {
+ --$dnum;
+ $items .= '{';
+ $items .= '"id":"-' . $dir['pathid'] . '"';
+ $items .= ',"text":"' . $dir["name"] . '"';
+ $items .= ',"icon":"glyphicon glyphicon-folder-close"';
+ $items .= ',"state":""';
+ $items .= ',"data":' . \Zend\Json\Json::encode($dir, \Zend\Json\Json::TYPE_OBJECT);
+ $items .= ',"children":true';
+ $items .= '}';
+ if($dnum > 0) {
+ $items .= ",";
+ }
+ }
+ }
+
+ }
+
+ if( $tmp > 2 && $fnum > 0 ) {
+ $items .= ",";
+ }
+
+ if($fnum > 0) {
+
+ foreach($files as $file) {
+ $items .= '{';
+ $items .= '"id":"' . $file["fileid"] . '"';
+ $items .= ',"text":"' . $file["name"] . '"';
+ $items .= ',"icon":"glyphicon glyphicon-file"';
+ $items .= ',"state":""';
+ $items .= ',"data":' . \Zend\Json\Json::encode($file, \Zend\Json\Json::TYPE_OBJECT);
+ $items .= '}';
+ --$fnum;
+ if($fnum > 0) {
+ $items .= ",";
+ }
+ }
+
+ }
+
+ $items .= ']';
+
+ return $items;
+ }
+
+ /**
+ * Retrieve restore parameters
+ */
+ private function getRestoreParams()
+ {
+ if($this->params()->fromQuery('type')) {
+ $this->restore_params['type'] = $this->params()->fromQuery('type');
+ }
+ else {
+ $this->restore_params['type'] = 'client';
+ }
+
+ if($this->params()->fromQuery('jobid')) {
+ $this->restore_params['jobid'] = $this->params()->fromQuery('jobid');
+ }
+ else {
+ $this->restore_params['jobid'] = null;
+ }
+
+ if($this->params()->fromQuery('client')) {
+ $this->restore_params['client'] = $this->params()->fromQuery('client');
+ }
+ else {
+ $this->restore_params['client'] = null;
+ }
+
+ if($this->params()->fromQuery('restoreclient')) {
+ $this->restore_params['restoreclient'] = $this->params()->fromQuery('restoreclient');
+ }
+ else {
+ $this->restore_params['restoreclient'] = null;
+ }
+
+ if($this->params()->fromQuery('restorejob')) {
+ $this->restore_params['restorejob'] = $this->params()->fromQuery('restorejob');
+ }
+ else {
+ $this->restore_params['restorejob'] = null;
+ }
+
+ if($this->params()->fromQuery('fileset')) {
+ $this->restore_params['fileset'] = $this->params()->fromQuery('fileset');
+ }
+ else {
+ $this->restore_params['fileset'] = null;
+ }
+
+ if($this->params()->fromQuery('before')) {
+ $this->restore_params['before'] = $this->params()->fromQuery('before');
+ }
+ else {
+ $this->restore_params['before'] = null;
+ }
+
+ if($this->params()->fromQuery('where')) {
+ $this->restore_params['where'] = $this->params()->fromQuery('where');
+ }
+ else {
+ $this->restore_params['where'] = null;
+ }
+
+ if($this->params()->fromQuery('fileid')) {
+ $this->restore_params['fileid'] = $this->params()->fromQuery('fileid');
+ }
+ else {
+ $this->restore_params['fileid'] = null;
+ }
+
+ if($this->params()->fromQuery('dirid')) {
+ $this->restore_params['dirid'] = $this->params()->fromQuery('dirid');
+ }
+ else {
+ $this->restore_params['dirid'] = null;
+ }
+
+ if($this->params()->fromQuery('id')) {
+ $this->restore_params['id'] = $this->params()->fromQuery('id');
+ }
+ else {
+ $this->restore_params['id'] = null;
+ }
+
+ if($this->params()->fromQuery('jobids')) {
+ $this->restore_params['jobids'] = $this->params()->fromQuery('jobids');
+ }
+ else {
+ $this->restore_params['jobids'] = null;
+ }
+
+ if($this->params()->fromQuery('mergefilesets')) {
+ $this->restore_params['mergefilesets'] = $this->params()->fromQuery('mergefilesets');
+ }
+ else {
+ $this->restore_params['mergefilesets'] = 0;
+ }
+
+ if($this->params()->fromQuery('mergejobs')) {
+ $this->restore_params['mergejobs'] = $this->params()->fromQuery('mergejobs');
+ }
+ else {
+ $this->restore_params['mergejobs'] = 0;
+ }
+
+ if($this->params()->fromQuery('replace')) {
+ $this->restore_params['replace'] = $this->params()->fromQuery('replace');
+ }
+ else {
+ $this->restore_params['replace'] = null;
+ }
+
+ if($this->params()->fromQuery('replaceoptions')) {
+ $this->restore_params['replaceoptions'] = $this->params()->fromQuery('replaceoptions');
+ }
+ else {
+ $this->restore_params['replaceoptions'] = null;
+ }
+
+ if($this->params()->fromQuery('versions')) {
+ $this->restore_params['versions'] = $this->params()->fromQuery('versions');
+ }
+ else {
+ $this->restore_params['versions'] = null;
+ }
+
+ }
+
+ public function getRestoreModel()
+ {
+ if(!$this->restoreModel) {
+ $sm = $this->getServiceLocator();
+ $this->restoreModel = $sm->get('Restore\Model\RestoreModel');
+ }
+ return $this->restoreModel;
+ }
}
diff --git a/module/Restore/src/Restore/Form/RestoreForm.php b/module/Restore/src/Restore/Form/RestoreForm.php
index 24648bb..eca7ca0 100644
--- a/module/Restore/src/Restore/Form/RestoreForm.php
+++ b/module/Restore/src/Restore/Form/RestoreForm.php
@@ -31,554 +31,554 @@ use Zend\Form\Element;
class RestoreForm extends Form
{
- protected $restore_params;
- //protected $jobs;
- protected $clients;
- protected $filesets;
- protected $restorejobs;
- protected $jobids;
- protected $backups;
-
- public function __construct($restore_params=null, /*$jobs=null,*/ $clients=null, $filesets=null, $restorejobs=null, $jobids=null, $backups=null)
- {
-
- parent::__construct('restore');
-
- $this->restore_params = $restore_params;
- //$this->jobs = $jobs;
- $this->clients = $clients;
- $this->filesets = $filesets;
- $this->restorejobs = $restorejobs;
- $this->jobids = $jobids;
- $this->backups = $backups;
+ protected $restore_params;
+ //protected $jobs;
+ protected $clients;
+ protected $filesets;
+ protected $restorejobs;
+ protected $jobids;
+ protected $backups;
+
+ public function __construct($restore_params=null, /*$jobs=null,*/ $clients=null, $filesets=null, $restorejobs=null, $jobids=null, $backups=null)
+ {
+
+ parent::__construct('restore');
+
+ $this->restore_params = $restore_params;
+ //$this->jobs = $jobs;
+ $this->clients = $clients;
+ $this->filesets = $filesets;
+ $this->restorejobs = $restorejobs;
+ $this->jobids = $jobids;
+ $this->backups = $backups;
/*
- // Job
- if(isset($restore_params['jobid'])) {
- $this->add(array(
- 'name' => 'jobid',
- 'type' => 'select',
- 'options' => array(
- 'label' => 'Job',
- 'empty_option' => 'Please choose a job',
- 'value_options' => $this->getJobList()
- ),
- 'attributes' => array(
- 'id' => 'jobid',
- 'value' => $restore_params['jobid']
- )
- ));
- }
- else {
- $this->add(array(
- 'name' => 'jobid',
- 'type' => 'select',
- 'options' => array(
- 'label' => 'Job',
- 'empty_option' => 'Please choose a job',
- 'value_options' => $this->getJobList()
- ),
- 'attributes' => array(
- 'id' => 'jobid'
- )
- ));
- }
+ // Job
+ if(isset($restore_params['jobid'])) {
+ $this->add(array(
+ 'name' => 'jobid',
+ 'type' => 'select',
+ 'options' => array(
+ 'label' => 'Job',
+ 'empty_option' => 'Please choose a job',
+ 'value_options' => $this->getJobList()
+ ),
+ 'attributes' => array(
+ 'id' => 'jobid',
+ 'value' => $restore_params['jobid']
+ )
+ ));
+ }
+ else {
+ $this->add(array(
+ 'name' => 'jobid',
+ 'type' => 'select',
+ 'options' => array(
+ 'label' => 'Job',
+ 'empty_option' => 'Please choose a job',
+ 'value_options' => $this->getJobList()
+ ),
+ 'attributes' => array(
+ 'id' => 'jobid'
+ )
+ ));
+ }
*/
- // Backup jobs
- if(isset($restore_params['jobid'])) {
- $this->add(array(
- 'name' => 'backups',
- 'type' => 'select',
- 'options' => array(
- 'label' => 'Backup jobs',
- //'empty_option' => 'Please choose a backup',
- 'value_options' => $this->getBackupList()
- ),
- 'attributes' => array(
- 'class' => 'form-control selectpicker show-tick',
- 'data-live-search' => 'true',
- 'id' => 'jobid',
- 'value' => $restore_params['jobid']
- )
- ));
- }
- else {
- $this->add(array(
- 'name' => 'backups',
- 'type' => 'select',
- 'options' => array(
- 'label' => 'Backups',
- //'empty_option' => 'Please choose a backup',
- 'value_options' => $this->getBackupList()
- ),
- 'attributes' => array(
- 'class' => 'form-control selectpicker show-tick',
- 'data-live-search' => 'true',
- 'id' => 'jobid'
- )
- ));
- }
-
- // Client
- if(isset($restore_params['client'])) {
- if($restore_params['type'] == "client") {
- $this->add(array(
- 'name' => 'client',
- 'type' => 'select',
- 'options' => array(
- 'label' => 'Client',
- //'empty_option' => 'Please choose a client',
- 'value_options' => $this->getClientList()
- ),
- 'attributes' => array(
- 'class' => 'form-control selectpicker show-tick',
- 'data-live-search' => 'true',
- 'id' => 'client',
- 'value' => $restore_params['client']
- )
- ));
- }
- else {
- $this->add(array(
- 'name' => 'client',
- 'type' => 'select',
- 'options' => array(
- 'label' => 'Client',
- //'empty_option' => 'Please choose a client',
- 'value_options' => $this->getClientList()
- ),
- 'attributes' => array(
- 'class' => 'form-control selectpicker show-tick',
- 'data-live-search' => 'true',
- 'id' => 'client',
- 'value' => $restore_params['client']
- )
- ));
- }
- }
- else {
- $this->add(array(
- 'name' => 'client',
- 'type' => 'select',
- 'options' => array(
- 'label' => 'Client',
- //'empty_option' => 'Please choose a client',
- 'value_options' => $this->getClientList()
- ),
- 'attributes' => array(
- 'class' => 'form-control selectpicker show-tick',
- 'data-live-search' => 'true',
- 'id' => 'client',
- 'value' => @array_pop($this->getClientList())
- )
- ));
- }
-
- // Restore client
- if(isset($restore_params['restoreclient'])) {
- $this->add(array(
- 'name' => 'restoreclient',
- 'type' => 'select',
- 'options' => array(
- 'label' => 'Restore to (another) client',
- //'empty_option' => 'Please choose a client',
- 'value_options' => $this->getClientList()
- ),
- 'attributes' => array(
- 'class' => 'form-control selectpicker show-tick',
- 'data-live-search' => 'true',
- 'id' => 'restoreclient',
- 'value' => $restore_params['restoreclient']
- )
- ));
- }
- elseif(!isset($restore_params['restoreclient']) && isset($restore_params['client']) ) {
- $this->add(array(
- 'name' => 'restoreclient',
- 'type' => 'select',
- 'options' => array(
- 'label' => 'Restore to (another) client',
- //'empty_option' => 'Please choose a client',
- 'value_options' => $this->getClientList()
- ),
- 'attributes' => array(
- 'class' => 'form-control selectpicker show-tick',
- 'data-live-search' => 'true',
- 'id' => 'restoreclient',
- 'value' => $restore_params['client']
- )
- ));
- }
- else {
- $this->add(array(
- 'name' => 'restoreclient',
- 'type' => 'select',
- 'options' => array(
- 'label' => 'Restore to (another) client',
- //'empty_option' => 'Please choose a client',
- 'value_options' => $this->getClientList()
- ),
- 'attributes' => array(
- 'class' => 'form-control selectpicker show-tick',
- 'data-live-search' => 'true',
- 'id' => 'restoreclient'
- )
- ));
- }
-
- // Fileset
- if(isset($restore_params['fileset'])) {
- $this->add(array(
- 'name' => 'fileset',
- 'type' => 'select',
- 'options' => array(
- 'label' => 'Fileset',
- 'empty_option' => 'Please choose a fileset',
- 'value_options' => $this->getFilesetList()
- ),
- 'attributes' => array(
- 'id' => 'fileset',
- 'value' => $restore_params['fileset']
- )
- ));
- }
- else {
- $this->add(array(
- 'name' => 'fileset',
- 'type' => 'select',
- 'options' => array(
- 'label' => 'Fileset',
- 'empty_option' => 'Please choose a fileset',
- 'value_options' => $this->getFilesetList()
- ),
- 'attributes' => array(
- 'id' => 'fileset'
- )
- ));
- }
-
- // Restore Job
- if(isset($restore_params['restorejob'])) {
- $this->add(array(
- 'name' => 'restorejob',
- 'type' => 'select',
- 'options' => array(
- 'label' => 'Restore job',
- //'empty_option' => 'Please choose a restore job',
- 'value_options' => $this->getRestoreJobList()
- ),
- 'attributes' => array(
- 'class' => 'form-control selectpicker show-tick',
- 'data-live-search' => 'true',
- 'id' => 'restorejob',
- 'value' => $restore_params['restorejob']
- )
- ));
- }
- else {
- if(count($this->getRestoreJobList()) == 1) {
- $this->add(array(
- 'name' => 'restorejob',
- 'type' => 'select',
- 'options' => array(
- 'label' => 'Restore job',
- //'empty_option' => 'Please choose a restore job',
- 'value_options' => $this->getRestoreJobList()
- ),
- 'attributes' => array(
- 'class' => 'form-control selectpicker show-tick',
- 'data-live-search' => 'true',
- 'id' => 'restorejob',
- 'value' => @array_pop($this->getRestoreJobList())
- )
- ));
- }
- else {
- $this->add(array(
- 'name' => 'restorejob',
- 'type' => 'select',
- 'options' => array(
- 'label' => 'Restore job',
- //'empty_option' => 'Please choose a restore job',
- 'value_options' => $this->getRestoreJobList()
- ),
- 'attributes' => array(
- 'class' => 'form-control selectpicker show-tick',
- 'data-live-search' => 'true',
- 'id' => 'restorejob'
- )
- ));
- }
- }
-
- // Merge filesets
- if(isset($restore_params['mergefilesets'])) {
- $this->add(array(
- 'name' => 'mergefilesets',
- 'type' => 'select',
- 'options' => array(
- 'label' => 'Merge all client filesets?',
- 'value_options' => array(
- '0' => 'Yes',
- '1' => 'No'
- )
- ),
- 'attributes' => array(
- 'class' => 'form-control selectpicker show-tick',
- 'id' => 'mergefilesets',
- 'value' => $restore_params['mergefilesets']
- )
- )
- );
- }
- else {
- $this->add(array(
- 'name' => 'mergefilesets',
- 'type' => 'select',
- 'options' => array(
- 'label' => 'Merge all client filesets?',
- 'value_options' => array(
- '0' => 'Yes',
- '1' => 'No'
- )
- ),
- 'attributes' => array(
- 'class' => 'form-control selectpicker show-tick',
- 'id' => 'mergefilesets',
- 'value' => '0'
- )
- )
- );
- }
-
- // Merge jobs
- if(isset($restore_params['mergejobs'])) {
- $this->add(array(
- 'name' => 'mergejobs',
- 'type' => 'select',
- 'options' => array(
- 'label' => 'Merge all related jobs to last full backup of selected backup job?',
- 'value_options' => array(
- '0' => 'Yes',
- '1' => 'No'
- )
- ),
- 'attributes' => array(
- 'class' => 'form-control selectpicker show-tick',
- 'id' => 'mergejobs',
- 'value' => $restore_params['mergejobs']
- )
- )
- );
- }
- else {
- $this->add(array(
- 'name' => 'mergejobs',
- 'type' => 'select',
- 'options' => array(
- 'label' => 'Merge jobs?',
- 'value_options' => array(
- '0' => 'Yes',
- '1' => 'No'
- )
- ),
- 'attributes' => array(
- 'class' => 'form-control selectpicker show-tick',
- 'id' => 'mergejobs',
- 'value' => '0'
- )
- )
- );
- }
-
- // Replace
- $this->add(array(
- 'name' => 'replace',
- 'type' => 'select',
- 'options' => array(
- 'label' => 'Replace files on client?',
- 'value_options' => array(
- 'always' => 'always',
- 'never' => 'never',
- 'ifolder' => 'if older',
- 'ifnewer' => 'if newer'
- )
- ),
- 'attributes' => array(
- 'class' => 'form-control selectpicker show-tick',
- 'id' => 'replace',
- 'value' => 'never'
- )
- )
- );
-
- // Where
- $this->add(array(
- 'name' => 'where',
- 'type' => 'text',
- 'options' => array(
- 'label' => 'Restore location on client'
- ),
- 'attributes' => array(
- 'class' => 'form-control selectpicker show-tick',
- 'value' => '/tmp/bareos-restores/',
- 'id' => 'where',
- 'size' => '30',
- 'placeholder' => 'e.g. / or /tmp/bareos-restores/'
- )
- )
- );
-
- // JobIds hidden
- $this->add(array(
- 'name' => 'jobids_hidden',
- 'type' => 'Zend\Form\Element\Hidden',
- 'attributes' => array(
- 'value' => $this->getJobIds(),
- 'id' => 'jobids_hidden'
- )
- )
- );
-
- // JobIds display (for debugging)
- $this->add(array(
- 'name' => 'jobids_display',
- 'type' => 'text',
- 'options' => array(
- 'label' => 'Related jobs for a most recent full restore'
- ),
- 'attributes' => array(
- 'value' => $this->getJobIds(),
- 'id' => 'jobids_display',
- 'readonly' => true
- )
- )
- );
-
- // filebrowser checked files
- $this->add(array(
- 'name' => 'checked_files',
- 'type' => 'Zend\Form\Element\Hidden',
- 'attributes' => array(
- 'value' => '',
- 'id' => 'checked_files'
- )
- )
- );
-
- // filebrowser checked directories
- $this->add(array(
- 'name' => 'checked_directories',
- 'type' => 'Zend\Form\Element\Hidden',
- 'attributes' => array(
- 'value' => '',
- 'id' => 'checked_directories'
- )
- )
- );
-
- // Submit button
- $this->add(array(
- 'name' => 'submit',
- 'type' => 'submit',
- 'attributes' => array(
- 'value' => 'Restore',
- 'id' => 'submit'
- )
- ));
-
- }
-
- /**
- *
- */
- private function getJobList()
- {
- $selectData = array();
- if(!empty($this->jobs)) {
- foreach($this->jobs as $job) {
- $selectData[$job['jobid']] = $job['jobid'] . " - " . $job['name'];
- }
- }
- return $selectData;
- }
-
- /**
- *
- */
- private function getBackupList()
- {
- $selectData = array();
- if(!empty($this->backups)) {
-
- foreach($this->backups as $backup) {
- switch($backup['level']) {
- case 'I':
- $level = "Incremental";
- break;
- case 'D':
- $level = "Differential";
- break;
- case 'F':
- $level = "Full";
- break;
- }
- $selectData[$backup['jobid']] = "(" . $backup['jobid'] . ") " . $backup['starttime'] . " - " . $backup['name'] . " - " . $level;
- }
- }
- return $selectData;
- }
-
- /**
- *
- */
- private function getJobIds()
- {
- return $this->jobids;
- }
-
- /**
- *
- */
- private function getClientList()
- {
- $selectData = array();
- if(!empty($this->clients)) {
- foreach($this->clients as $client) {
- $selectData[$client['name']] = $client['name'];
- }
- }
- ksort($selectData);
- return $selectData;
- }
-
- /**
- *
- */
- private function getFilesetList()
- {
- $selectData = array();
- if(!empty($this->filesets)) {
- foreach($this->filesets as $fileset) {
- $selectData[$fileset['name']] = $fileset['name'];
- }
- }
- return $selectData;
- }
-
- /**
- *
- */
- private function getRestoreJobList()
- {
- $selectData = array();
- if(!empty($this->restorejobs)) {
- foreach($this->restorejobs as $restorejob) {
- $selectData[$restorejob['name']] = $restorejob['name'];
- }
- }
- return $selectData;
- }
+ // Backup jobs
+ if(isset($restore_params['jobid'])) {
+ $this->add(array(
+ 'name' => 'backups',
+ 'type' => 'select',
+ 'options' => array(
+ 'label' => 'Backup jobs',
+ //'empty_option' => 'Please choose a backup',
+ 'value_options' => $this->getBackupList()
+ ),
+ 'attributes' => array(
+ 'class' => 'form-control selectpicker show-tick',
+ 'data-live-search' => 'true',
+ 'id' => 'jobid',
+ 'value' => $restore_params['jobid']
+ )
+ ));
+ }
+ else {
+ $this->add(array(
+ 'name' => 'backups',
+ 'type' => 'select',
+ 'options' => array(
+ 'label' => 'Backups',
+ //'empty_option' => 'Please choose a backup',
+ 'value_options' => $this->getBackupList()
+ ),
+ 'attributes' => array(
+ 'class' => 'form-control selectpicker show-tick',
+ 'data-live-search' => 'true',
+ 'id' => 'jobid'
+ )
+ ));
+ }
+
+ // Client
+ if(isset($restore_params['client'])) {
+ if($restore_params['type'] == "client") {
+ $this->add(array(
+ 'name' => 'client',
+ 'type' => 'select',
+ 'options' => array(
+ 'label' => 'Client',
+ //'empty_option' => 'Please choose a client',
+ 'value_options' => $this->getClientList()
+ ),
+ 'attributes' => array(
+ 'class' => 'form-control selectpicker show-tick',
+ 'data-live-search' => 'true',
+ 'id' => 'client',
+ 'value' => $restore_params['client']
+ )
+ ));
+ }
+ else {
+ $this->add(array(
+ 'name' => 'client',
+ 'type' => 'select',
+ 'options' => array(
+ 'label' => 'Client',
+ //'empty_option' => 'Please choose a client',
+ 'value_options' => $this->getClientList()
+ ),
+ 'attributes' => array(
+ 'class' => 'form-control selectpicker show-tick',
+ 'data-live-search' => 'true',
+ 'id' => 'client',
+ 'value' => $restore_params['client']
+ )
+ ));
+ }
+ }
+ else {
+ $this->add(array(
+ 'name' => 'client',
+ 'type' => 'select',
+ 'options' => array(
+ 'label' => 'Client',
+ //'empty_option' => 'Please choose a client',
+ 'value_options' => $this->getClientList()
+ ),
+ 'attributes' => array(
+ 'class' => 'form-control selectpicker show-tick',
+ 'data-live-search' => 'true',
+ 'id' => 'client',
+ 'value' => @array_pop($this->getClientList())
+ )
+ ));
+ }
+
+ // Restore client
+ if(isset($restore_params['restoreclient'])) {
+ $this->add(array(
+ 'name' => 'restoreclient',
+ 'type' => 'select',
+ 'options' => array(
+ 'label' => 'Restore to (another) client',
+ //'empty_option' => 'Please choose a client',
+ 'value_options' => $this->getClientList()
+ ),
+ 'attributes' => array(
+ 'class' => 'form-control selectpicker show-tick',
+ 'data-live-search' => 'true',
+ 'id' => 'restoreclient',
+ 'value' => $restore_params['restoreclient']
+ )
+ ));
+ }
+ elseif(!isset($restore_params['restoreclient']) && isset($restore_params['client']) ) {
+ $this->add(array(
+ 'name' => 'restoreclient',
+ 'type' => 'select',
+ 'options' => array(
+ 'label' => 'Restore to (another) client',
+ //'empty_option' => 'Please choose a client',
+ 'value_options' => $this->getClientList()
+ ),
+ 'attributes' => array(
+ 'class' => 'form-control selectpicker show-tick',
+ 'data-live-search' => 'true',
+ 'id' => 'restoreclient',
+ 'value' => $restore_params['client']
+ )
+ ));
+ }
+ else {
+ $this->add(array(
+ 'name' => 'restoreclient',
+ 'type' => 'select',
+ 'options' => array(
+ 'label' => 'Restore to (another) client',
+ //'empty_option' => 'Please choose a client',
+ 'value_options' => $this->getClientList()
+ ),
+ 'attributes' => array(
+ 'class' => 'form-control selectpicker show-tick',
+ 'data-live-search' => 'true',
+ 'id' => 'restoreclient'
+ )
+ ));
+ }
+
+ // Fileset
+ if(isset($restore_params['fileset'])) {
+ $this->add(array(
+ 'name' => 'fileset',
+ 'type' => 'select',
+ 'options' => array(
+ 'label' => 'Fileset',
+ 'empty_option' => 'Please choose a fileset',
+ 'value_options' => $this->getFilesetList()
+ ),
+ 'attributes' => array(
+ 'id' => 'fileset',
+ 'value' => $restore_params['fileset']
+ )
+ ));
+ }
+ else {
+ $this->add(array(
+ 'name' => 'fileset',
+ 'type' => 'select',
+ 'options' => array(
+ 'label' => 'Fileset',
+ 'empty_option' => 'Please choose a fileset',
+ 'value_options' => $this->getFilesetList()
+ ),
+ 'attributes' => array(
+ 'id' => 'fileset'
+ )
+ ));
+ }
+
+ // Restore Job
+ if(isset($restore_params['restorejob'])) {
+ $this->add(array(
+ 'name' => 'restorejob',
+ 'type' => 'select',
+ 'options' => array(
+ 'label' => 'Restore job',
+ //'empty_option' => 'Please choose a restore job',
+ 'value_options' => $this->getRestoreJobList()
+ ),
+ 'attributes' => array(
+ 'class' => 'form-control selectpicker show-tick',
+ 'data-live-search' => 'true',
+ 'id' => 'restorejob',
+ 'value' => $restore_params['restorejob']
+ )
+ ));
+ }
+ else {
+ if(count($this->getRestoreJobList()) == 1) {
+ $this->add(array(
+ 'name' => 'restorejob',
+ 'type' => 'select',
+ 'options' => array(
+ 'label' => 'Restore job',
+ //'empty_option' => 'Please choose a restore job',
+ 'value_options' => $this->getRestoreJobList()
+ ),
+ 'attributes' => array(
+ 'class' => 'form-control selectpicker show-tick',
+ 'data-live-search' => 'true',
+ 'id' => 'restorejob',
+ 'value' => @array_pop($this->getRestoreJobList())
+ )
+ ));
+ }
+ else {
+ $this->add(array(
+ 'name' => 'restorejob',
+ 'type' => 'select',
+ 'options' => array(
+ 'label' => 'Restore job',
+ //'empty_option' => 'Please choose a restore job',
+ 'value_options' => $this->getRestoreJobList()
+ ),
+ 'attributes' => array(
+ 'class' => 'form-control selectpicker show-tick',
+ 'data-live-search' => 'true',
+ 'id' => 'restorejob'
+ )
+ ));
+ }
+ }
+
+ // Merge filesets
+ if(isset($restore_params['mergefilesets'])) {
+ $this->add(array(
+ 'name' => 'mergefilesets',
+ 'type' => 'select',
+ 'options' => array(
+ 'label' => 'Merge all client filesets?',
+ 'value_options' => array(
+ '0' => 'Yes',
+ '1' => 'No'
+ )
+ ),
+ 'attributes' => array(
+ 'class' => 'form-control selectpicker show-tick',
+ 'id' => 'mergefilesets',
+ 'value' => $restore_params['mergefilesets']
+ )
+ )
+ );
+ }
+ else {
+ $this->add(array(
+ 'name' => 'mergefilesets',
+ 'type' => 'select',
+ 'options' => array(
+ 'label' => 'Merge all client filesets?',
+ 'value_options' => array(
+ '0' => 'Yes',
+ '1' => 'No'
+ )
+ ),
+ 'attributes' => array(
+ 'class' => 'form-control selectpicker show-tick',
+ 'id' => 'mergefilesets',
+ 'value' => '0'
+ )
+ )
+ );
+ }
+
+ // Merge jobs
+ if(isset($restore_params['mergejobs'])) {
+ $this->add(array(
+ 'name' => 'mergejobs',
+ 'type' => 'select',
+ 'options' => array(
+ 'label' => 'Merge all related jobs to last full backup of selected backup job?',
+ 'value_options' => array(
+ '0' => 'Yes',
+ '1' => 'No'
+ )
+ ),
+ 'attributes' => array(
+ 'class' => 'form-control selectpicker show-tick',
+ 'id' => 'mergejobs',
+ 'value' => $restore_params['mergejobs']
+ )
+ )
+ );
+ }
+ else {
+ $this->add(array(
+ 'name' => 'mergejobs',
+ 'type' => 'select',
+ 'options' => array(
+ 'label' => 'Merge jobs?',
+ 'value_options' => array(
+ '0' => 'Yes',
+ '1' => 'No'
+ )
+ ),
+ 'attributes' => array(
+ 'class' => 'form-control selectpicker show-tick',
+ 'id' => 'mergejobs',
+ 'value' => '0'
+ )
+ )
+ );
+ }
+
+ // Replace
+ $this->add(array(
+ 'name' => 'replace',
+ 'type' => 'select',
+ 'options' => array(
+ 'label' => 'Replace files on client?',
+ 'value_options' => array(
+ 'always' => 'always',
+ 'never' => 'never',
+ 'ifolder' => 'if older',
+ 'ifnewer' => 'if newer'
+ )
+ ),
+ 'attributes' => array(
+ 'class' => 'form-control selectpicker show-tick',
+ 'id' => 'replace',
+ 'value' => 'never'
+ )
+ )
+ );
+
+ // Where
+ $this->add(array(
+ 'name' => 'where',
+ 'type' => 'text',
+ 'options' => array(
+ 'label' => 'Restore location on client'
+ ),
+ 'attributes' => array(
+ 'class' => 'form-control selectpicker show-tick',
+ 'value' => '/tmp/bareos-restores/',
+ 'id' => 'where',
+ 'size' => '30',
+ 'placeholder' => 'e.g. / or /tmp/bareos-restores/'
+ )
+ )
+ );
+
+ // JobIds hidden
+ $this->add(array(
+ 'name' => 'jobids_hidden',
+ 'type' => 'Zend\Form\Element\Hidden',
+ 'attributes' => array(
+ 'value' => $this->getJobIds(),
+ 'id' => 'jobids_hidden'
+ )
+ )
+ );
+
+ // JobIds display (for debugging)
+ $this->add(array(
+ 'name' => 'jobids_display',
+ 'type' => 'text',
+ 'options' => array(
+ 'label' => 'Related jobs for a most recent full restore'
+ ),
+ 'attributes' => array(
+ 'value' => $this->getJobIds(),
+ 'id' => 'jobids_display',
+ 'readonly' => true
+ )
+ )
+ );
+
+ // filebrowser checked files
+ $this->add(array(
+ 'name' => 'checked_files',
+ 'type' => 'Zend\Form\Element\Hidden',
+ 'attributes' => array(
+ 'value' => '',
+ 'id' => 'checked_files'
+ )
+ )
+ );
+
+ // filebrowser checked directories
+ $this->add(array(
+ 'name' => 'checked_directories',
+ 'type' => 'Zend\Form\Element\Hidden',
+ 'attributes' => array(
+ 'value' => '',
+ 'id' => 'checked_directories'
+ )
+ )
+ );
+
+ // Submit button
+ $this->add(array(
+ 'name' => 'submit',
+ 'type' => 'submit',
+ 'attributes' => array(
+ 'value' => 'Restore',
+ 'id' => 'submit'
+ )
+ ));
+
+ }
+
+ /**
+ *
+ */
+ private function getJobList()
+ {
+ $selectData = array();
+ if(!empty($this->jobs)) {
+ foreach($this->jobs as $job) {
+ $selectData[$job['jobid']] = $job['jobid'] . " - " . $job['name'];
+ }
+ }
+ return $selectData;
+ }
+
+ /**
+ *
+ */
+ private function getBackupList()
+ {
+ $selectData = array();
+ if(!empty($this->backups)) {
+
+ foreach($this->backups as $backup) {
+ switch($backup['level']) {
+ case 'I':
+ $level = "Incremental";
+ break;
+ case 'D':
+ $level = "Differential";
+ break;
+ case 'F':
+ $level = "Full";
+ break;
+ }
+ $selectData[$backup['jobid']] = "(" . $backup['jobid'] . ") " . $backup['starttime'] . " - " . $backup['name'] . " - " . $level;
+ }
+ }
+ return $selectData;
+ }
+
+ /**
+ *
+ */
+ private function getJobIds()
+ {
+ return $this->jobids;
+ }
+
+ /**
+ *
+ */
+ private function getClientList()
+ {
+ $selectData = array();
+ if(!empty($this->clients)) {
+ foreach($this->clients as $client) {
+ $selectData[$client['name']] = $client['name'];
+ }
+ }
+ ksort($selectData);
+ return $selectData;
+ }
+
+ /**
+ *
+ */
+ private function getFilesetList()
+ {
+ $selectData = array();
+ if(!empty($this->filesets)) {
+ foreach($this->filesets as $fileset) {
+ $selectData[$fileset['name']] = $fileset['name'];
+ }
+ }
+ return $selectData;
+ }
+
+ /**
+ *
+ */
+ private function getRestoreJobList()
+ {
+ $selectData = array();
+ if(!empty($this->restorejobs)) {
+ foreach($this->restorejobs as $restorejob) {
+ $selectData[$restorejob['name']] = $restorejob['name'];
+ }
+ }
+ return $selectData;
+ }
}
diff --git a/module/Restore/src/Restore/Model/Restore.php b/module/Restore/src/Restore/Model/Restore.php
index d8d7a61..6070b40 100644
--- a/module/Restore/src/Restore/Model/Restore.php
+++ b/module/Restore/src/Restore/Model/Restore.php
@@ -32,234 +32,234 @@ use Zend\InputFilter\InputFilterInterface;
class Restore implements InputFilterAwareInterface
{
- protected $job;
- protected $client;
- protected $restoreclient;
- protected $fileset;
- protected $beforedate;
+ protected $job;
+ protected $client;
+ protected $restoreclient;
+ protected $fileset;
+ protected $beforedate;
- protected $inputFilter;
+ protected $inputFilter;
- public function setInputFilter(InputFilterInterface $inputFilter)
- {
- throw new \Exception("setInputFiler() not used");
- }
+ public function setInputFilter(InputFilterInterface $inputFilter)
+ {
+ throw new \Exception("setInputFiler() not used");
+ }
- public function getInputFilter()
- {
- if(!$this->inputFilter) {
+ public function getInputFilter()
+ {
+ if(!$this->inputFilter) {
- $inputFilter = new InputFilter();
+ $inputFilter = new InputFilter();
- $inputFilter->add(array(
- 'name' => 'jobid',
- 'required' => false,
- 'filters' => array(
- array('name' => 'StripTags'),
- array('name' => 'StringTrim'),
- ),
- 'validators' => array(
- array(
- 'name' => 'StringLength',
- 'options' => array(
- 'encoding' => 'UTF-8',
- 'min' => 1,
- 'max' => 64
- )
- )
- )
- ));
+ $inputFilter->add(array(
+ 'name' => 'jobid',
+ 'required' => false,
+ 'filters' => array(
+ array('name' => 'StripTags'),
+ array('name' => 'StringTrim'),
+ ),
+ 'validators' => array(
+ array(
+ 'name' => 'StringLength',
+ 'options' => array(
+ 'encoding' => 'UTF-8',
+ 'min' => 1,
+ 'max' => 64
+ )
+ )
+ )
+ ));
- $inputFilter->add(array(
- 'name' => 'backups',
- 'required' => false,
- 'filters' => array(
- array('name' => 'StripTags'),
- array('name' => 'StringTrim'),
- ),
- 'validators' => array(
- array(
- 'name' => 'StringLength',
- 'options' => array(
- 'encoding' => 'UTF-8',
- 'min' => 1,
- 'max' => 128
- )
- )
- )
- ));
+ $inputFilter->add(array(
+ 'name' => 'backups',
+ 'required' => false,
+ 'filters' => array(
+ array('name' => 'StripTags'),
+ array('name' => 'StringTrim'),
+ ),
+ 'validators' => array(
+ array(
+ 'name' => 'StringLength',
+ 'options' => array(
+ 'encoding' => 'UTF-8',
+ 'min' => 1,
+ 'max' => 128
+ )
+ )
+ )
+ ));
- $inputFilter->add(array(
- 'name' => 'client',
- 'required' => false,
- 'filters' => array(
- array('name' => 'StripTags'),
- array('name' => 'StringTrim'),
- ),
- 'validators' => array(
- array(
- 'name' => 'StringLength',
- 'options' => array(
- 'encoding' => 'UTF-8',
- 'min' => 1,
- 'max' => 128
- )
- )
- )
- ));
+ $inputFilter->add(array(
+ 'name' => 'client',
+ 'required' => false,
+ 'filters' => array(
+ array('name' => 'StripTags'),
+ array('name' => 'StringTrim'),
+ ),
+ 'validators' => array(
+ array(
+ 'name' => 'StringLength',
+ 'options' => array(
+ 'encoding' => 'UTF-8',
+ 'min' => 1,
+ 'max' => 128
+ )
+ )
+ )
+ ));
- $inputFilter->add(array(
- 'name' => 'restoreclient',
- 'required' => false,
- 'filters' => array(
- array('name' => 'StripTags'),
- array('name' => 'StringTrim'),
- ),
- 'validators' => array(
- array(
- 'name' => 'StringLength',
- 'options' => array(
- 'encoding' => 'UTF-8',
- 'min' => 1,
- 'max' => 128
- )
- )
- )
- ));
+ $inputFilter->add(array(
+ 'name' => 'restoreclient',
+ 'required' => false,
+ 'filters' => array(
+ array('name' => 'StripTags'),
+ array('name' => 'StringTrim'),
+ ),
+ 'validators' => array(
+ array(
+ 'name' => 'StringLength',
+ 'options' => array(
+ 'encoding' => 'UTF-8',
+ 'min' => 1,
+ 'max' => 128
+ )
+ )
+ )
+ ));
- $inputFilter->add(array(
- 'name' => 'fileset',
- 'required' => false,
- 'filters' => array(
- array('name' => 'StripTags'),
- array('name' => 'StringTrim'),
- ),
- 'validators' => array(
- array(
- 'name' => 'StringLength',
- 'options' => array(
- 'encoding' => 'UTF-8',
- 'min' => 1,
- 'max' => 128
- )
- )
- )
- ));
+ $inputFilter->add(array(
+ 'name' => 'fileset',
+ 'required' => false,
+ 'filters' => array(
+ array('name' => 'StripTags'),
+ array('name' => 'StringTrim'),
+ ),
+ 'validators' => array(
+ array(
+ 'name' => 'StringLength',
+ 'options' => array(
+ 'encoding' => 'UTF-8',
+ 'min' => 1,
+ 'max' => 128
+ )
+ )
+ )
+ ));
- $inputFilter->add(array(
- 'name' => 'before',
- 'required' => false,
- 'filters' => array(
- array('name' => 'StripTags'),
- array('name' => 'StringTrim'),
- ),
- 'validators' => array(
- array(
- 'name' => 'StringLength',
- 'options' => array(
- 'encoding' => 'UTF-8',
- 'min' => 1,
- 'max' => 128
- )
- )
- )
- ));
+ $inputFilter->add(array(
+ 'name' => 'before',
+ 'required' => false,
+ 'filters' => array(
+ array('name' => 'StripTags'),
+ array('name' => 'StringTrim'),
+ ),
+ 'validators' => array(
+ array(
+ 'name' => 'StringLength',
+ 'options' => array(
+ 'encoding' => 'UTF-8',
+ 'min' => 1,
+ 'max' => 128
+ )
+ )
+ )
+ ));
- $inputFilter->add(array(
- 'name' => 'where',
- 'required' => true,
- 'filters' => array(
- array('name' => 'StripTags'),
- array('name' => 'StringTrim'),
- ),
- 'validators' => array(
- array(
- 'name' => 'StringLength',
- 'options' => array(
- 'encoding' => 'UTF-8',
- 'min' => 1,
- 'max' => 128
- )
- )
- )
- ));
+ $inputFilter->add(array(
+ 'name' => 'where',
+ 'required' => true,
+ 'filters' => array(
+ array('name' => 'StripTags'),
+ array('name' => 'StringTrim'),
+ ),
+ 'validators' => array(
+ array(
+ 'name' => 'StringLength',
+ 'options' => array(
+ 'encoding' => 'UTF-8',
+ 'min' => 1,
+ 'max' => 128
+ )
+ )
+ )
+ ));
- $inputFilter->add(array(
- 'name' => 'restorejob',
- 'required' => true,
- 'filters' => array(
- array('name' => 'StripTags'),
- array('name' => 'StringTrim'),
- ),
- 'validators' => array(
- array(
- 'name' => 'StringLength',
- 'options' => array(
- 'encoding' => 'UTF-8',
- 'min' => 1,
- 'max' => 128
- )
- )
- )
- ));
+ $inputFilter->add(array(
+ 'name' => 'restorejob',
+ 'required' => true,
+ 'filters' => array(
+ array('name' => 'StripTags'),
+ array('name' => 'StringTrim'),
+ ),
+ 'validators' => array(
+ array(
+ 'name' => 'StringLength',
+ 'options' => array(
+ 'encoding' => 'UTF-8',
+ 'min' => 1,
+ 'max' => 128
+ )
+ )
+ )
+ ));
- $inputFilter->add(array(
- 'name' => 'checked_files',
- 'required' => false,
- 'filters' => array(
- array('name' => 'StripTags'),
- array('name' => 'StringTrim'),
- ),
- 'validators' => array(
- array(
- 'name' => 'StringLength',
- 'options' => array(
- 'encoding' => 'UTF-8'
- )
- )
- )
- ));
+ $inputFilter->add(array(
+ 'name' => 'checked_files',
+ 'required' => false,
+ 'filters' => array(
+ array('name' => 'StripTags'),
+ array('name' => 'StringTrim'),
+ ),
+ 'validators' => array(
+ array(
+ 'name' => 'StringLength',
+ 'options' => array(
+ 'encoding' => 'UTF-8'
+ )
+ )
+ )
+ ));
- $inputFilter->add(array(
- 'name' => 'checked_directories',
- 'required' => false,
- 'filters' => array(
- array('name' => 'StripTags'),
- array('name' => 'StringTrim'),
- ),
- 'validators' => array(
- array(
- 'name' => 'StringLength',
- 'options' => array(
- 'encoding' => 'UTF-8'
- )
- )
- )
- ));
+ $inputFilter->add(array(
+ 'name' => 'checked_directories',
+ 'required' => false,
+ 'filters' => array(
+ array('name' => 'StripTags'),
+ array('name' => 'StringTrim'),
+ ),
+ 'validators' => array(
+ array(
+ 'name' => 'StringLength',
+ 'options' => array(
+ 'encoding' => 'UTF-8'
+ )
+ )
+ )
+ ));
- $inputFilter->add(array(
- 'name' => 'jobids_hidden',
- 'required' => false,
- 'filters' => array(
- array('name' => 'StripTags'),
- array('name' => 'StringTrim'),
- ),
- 'validators' => array(
- array(
- 'name' => 'StringLength',
- 'options' => array(
- 'encoding' => 'UTF-8'
- )
- )
- )
- ));
+ $inputFilter->add(array(
+ 'name' => 'jobids_hidden',
+ 'required' => false,
+ 'filters' => array(
+ array('name' => 'StripTags'),
+ array('name' => 'StringTrim'),
+ ),
+ 'validators' => array(
+ array(
+ 'name' => 'StringLength',
+ 'options' => array(
+ 'encoding' => 'UTF-8'
+ )
+ )
+ )
+ ));
- $this->inputFilter = $inputFilter;
+ $this->inputFilter = $inputFilter;
- }
+ }
- return $inputFilter;
+ return $inputFilter;
- }
+ }
}
diff --git a/module/Restore/src/Restore/Model/RestoreModel.php b/module/Restore/src/Restore/Model/RestoreModel.php
index a8cf09e..5e05130 100644
--- a/module/Restore/src/Restore/Model/RestoreModel.php
+++ b/module/Restore/src/Restore/Model/RestoreModel.php
@@ -30,181 +30,181 @@ use Zend\ServiceManager\ServiceLocatorInterface;
class RestoreModel implements ServiceLocatorAwareInterface
{
- protected $serviceLocator;
- protected $director;
-
- public function __construct()
- {
- }
-
- public function setServiceLocator(ServiceLocatorInterface $serviceLocator)
- {
- $this->serviceLocator = $serviceLocator;
- }
-
- public function getServiceLocator()
- {
- return $this->serviceLocator;
- }
-
- public function getDirectories($jobid=null, $pathid=null) {
- if(isset($jobid)) {
- if($pathid == null || $pathid== "#") {
- $cmd = '.bvfs_lsdirs jobid='.$jobid.' path=';
- }
- else {
- $cmd = '.bvfs_lsdirs jobid='.$jobid.' pathid='.abs($pathid).'';
- }
- $this->director = $this->getServiceLocator()->get('director');
- $result = $this->director->send_command($cmd, 2, $jobid);
- $directories = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
- if(empty($directories['result']['directories'])) {
- return null;
- }
- else {
- return $directories['result']['directories'];
- }
- }
- else {
- return false;
- }
- }
-
- public function getFiles($jobid=null, $pathid=null) {
- if(isset($jobid)) {
- if($pathid == null || $pathid == "#") {
- $cmd = '.bvfs_lsfiles jobid='.$jobid.' path=';
- }
- else {
- $cmd = '.bvfs_lsfiles jobid='.$jobid.' pathid='.abs($pathid).'';
- }
- $this->director = $this->getServiceLocator()->get('director');
- $result = $this->director->send_command($cmd, 2, $jobid);
- $files = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
- if(empty($files['result']['files'])) {
- return null;
- }
- else {
- return $files['result']['files'];
- }
- }
- else {
- return false;
- }
- }
-
- public function getJobs()
- {
- $cmd = 'llist jobs';
- $this->director = $this->getServiceLocator()->get('director');
- $result = $this->director->send_command($cmd, 2, null);
- $jobs = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
- if(empty($jobs['result']['jobs'])) {
- return null;
- }
- else {
- return $jobs['result']['jobs'];
- }
- }
-
- public function getClients()
- {
- $cmd = 'llist clients';
- $this->director = $this->getServiceLocator()->get('director');
- $result = $this->director->send_command($cmd, 2, null);
- $clients = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
- return $clients['result']['clients'];
- }
-
- public function getFilesets()
- {
- $cmd = '.filesets';
- $this->director = $this->getServiceLocator()->get('director');
- $result = $this->director->send_command($cmd, 2, null);
- $filesets = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
- return $filesets['result']['filesets'];
- }
-
- public function getClientBackups($client=null, $fileset=null, $order=null, $limit=null)
- {
- if(isset($client, $fileset, $order)) {
- if($limit != null) {
- $cmd = 'list backups client='.$client.' fileset='.$fileset.' order='.$order.' limit='.$limit.'';
- }
- else {
- $cmd = 'list backups client='.$client.' fileset='.$fileset.' order='.$order.'';
- }
- $this->director = $this->getServiceLocator()->get('director');
- $result = $this->director->send_command($cmd, 2, null);
- $backups = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
- if(empty($backups['result'])) {
- return null;
- }
- else {
- return $backups['result']['backups'];
- }
- }
- else {
- return false;
- }
- }
-
- public function getRestoreJobs()
- {
- $cmd = '.jobs type=R';
- $this->director = $this->getServiceLocator()->get('director');
- $result = $this->director->send_command($cmd, 2, null);
- $restorejobs = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
- return $restorejobs['result']['jobs'];
- }
-
- public function getJobIds($jobid=null, $mergefilesets=0, $mergejobs=0)
- {
- if(isset($jobid)) {
- if($mergefilesets == 0 && $mergejobs == 0) {
- $cmd = '.bvfs_get_jobids jobid='.$jobid.' all';
- }
- elseif($mergefilesets == 1 && $mergejobs == 0) {
- $cmd = '.bvfs_get_jobids jobid='.$jobid.'';
- }
- elseif($mergefilesets == 1 && $mergejobs == 1) {
- return $jobid;
- }
- $this->director = $this->getServiceLocator()->get('director');
- $result = $this->director->send_command($cmd, 2, null);
- $jobids = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
- if(!empty($jobids['result'])) {
- $result = "";
- $i = count($jobids['result']['jobids']);
- foreach($jobids['result']['jobids'] as $jobid) {
- $result .= $jobid['id'];
- --$i;
- if($i > 0) {
- $result .= ",";
- }
- }
- }
- return $result;
- }
- else {
- return false;
- }
- }
-
- public function restore($type=null, $jobid=null, $client=null, $restoreclient=null, $restorejob=null, $where=null, $fileid=null, $dirid=null, $jobids=null, $replace=null)
- {
- if(isset($type)) {
- $this->director = $this->getServiceLocator()->get('director');
- if($type == "client") {
- $result = $this->director->restore($type, $jobid, $client, $restoreclient, $restorejob, $where, $fileid, $dirid, $jobids, $replace);
- }
- elseif($type == "job") {
- // TODO
- }
- return $result;
- }
- else {
- return false;
- }
- }
+ protected $serviceLocator;
+ protected $director;
+
+ public function __construct()
+ {
+ }
+
+ public function setServiceLocator(ServiceLocatorInterface $serviceLocator)
+ {
+ $this->serviceLocator = $serviceLocator;
+ }
+
+ public function getServiceLocator()
+ {
+ return $this->serviceLocator;
+ }
+
+ public function getDirectories($jobid=null, $pathid=null) {
+ if(isset($jobid)) {
+ if($pathid == null || $pathid== "#") {
+ $cmd = '.bvfs_lsdirs jobid='.$jobid.' path=';
+ }
+ else {
+ $cmd = '.bvfs_lsdirs jobid='.$jobid.' pathid='.abs($pathid).'';
+ }
+ $this->director = $this->getServiceLocator()->get('director');
+ $result = $this->director->send_command($cmd, 2, $jobid);
+ $directories = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
+ if(empty($directories['result']['directories'])) {
+ return null;
+ }
+ else {
+ return $directories['result']['directories'];
+ }
+ }
+ else {
+ return false;
+ }
+ }
+
+ public function getFiles($jobid=null, $pathid=null) {
+ if(isset($jobid)) {
+ if($pathid == null || $pathid == "#") {
+ $cmd = '.bvfs_lsfiles jobid='.$jobid.' path=';
+ }
+ else {
+ $cmd = '.bvfs_lsfiles jobid='.$jobid.' pathid='.abs($pathid).'';
+ }
+ $this->director = $this->getServiceLocator()->get('director');
+ $result = $this->director->send_command($cmd, 2, $jobid);
+ $files = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
+ if(empty($files['result']['files'])) {
+ return null;
+ }
+ else {
+ return $files['result']['files'];
+ }
+ }
+ else {
+ return false;
+ }
+ }
+
+ public function getJobs()
+ {
+ $cmd = 'llist jobs';
+ $this->director = $this->getServiceLocator()->get('director');
+ $result = $this->director->send_command($cmd, 2, null);
+ $jobs = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
+ if(empty($jobs['result']['jobs'])) {
+ return null;
+ }
+ else {
+ return $jobs['result']['jobs'];
+ }
+ }
+
+ public function getClients()
+ {
+ $cmd = 'llist clients';
+ $this->director = $this->getServiceLocator()->get('director');
+ $result = $this->director->send_command($cmd, 2, null);
+ $clients = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
+ return $clients['result']['clients'];
+ }
+
+ public function getFilesets()
+ {
+ $cmd = '.filesets';
+ $this->director = $this->getServiceLocator()->get('director');
+ $result = $this->director->send_command($cmd, 2, null);
+ $filesets = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
+ return $filesets['result']['filesets'];
+ }
+
+ public function getClientBackups($client=null, $fileset=null, $order=null, $limit=null)
+ {
+ if(isset($client, $fileset, $order)) {
+ if($limit != null) {
+ $cmd = 'list backups client='.$client.' fileset='.$fileset.' order='.$order.' limit='.$limit.'';
+ }
+ else {
+ $cmd = 'list backups client='.$client.' fileset='.$fileset.' order='.$order.'';
+ }
+ $this->director = $this->getServiceLocator()->get('director');
+ $result = $this->director->send_command($cmd, 2, null);
+ $backups = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
+ if(empty($backups['result'])) {
+ return null;
+ }
+ else {
+ return $backups['result']['backups'];
+ }
+ }
+ else {
+ return false;
+ }
+ }
+
+ public function getRestoreJobs()
+ {
+ $cmd = '.jobs type=R';
+ $this->director = $this->getServiceLocator()->get('director');
+ $result = $this->director->send_command($cmd, 2, null);
+ $restorejobs = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
+ return $restorejobs['result']['jobs'];
+ }
+
+ public function getJobIds($jobid=null, $mergefilesets=0, $mergejobs=0)
+ {
+ if(isset($jobid)) {
+ if($mergefilesets == 0 && $mergejobs == 0) {
+ $cmd = '.bvfs_get_jobids jobid='.$jobid.' all';
+ }
+ elseif($mergefilesets == 1 && $mergejobs == 0) {
+ $cmd = '.bvfs_get_jobids jobid='.$jobid.'';
+ }
+ elseif($mergefilesets == 1 && $mergejobs == 1) {
+ return $jobid;
+ }
+ $this->director = $this->getServiceLocator()->get('director');
+ $result = $this->director->send_command($cmd, 2, null);
+ $jobids = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
+ if(!empty($jobids['result'])) {
+ $result = "";
+ $i = count($jobids['result']['jobids']);
+ foreach($jobids['result']['jobids'] as $jobid) {
+ $result .= $jobid['id'];
+ --$i;
+ if($i > 0) {
+ $result .= ",";
+ }
+ }
+ }
+ return $result;
+ }
+ else {
+ return false;
+ }
+ }
+
+ public function restore($type=null, $jobid=null, $client=null, $restoreclient=null, $restorejob=null, $where=null, $fileid=null, $dirid=null, $jobids=null, $replace=null)
+ {
+ if(isset($type)) {
+ $this->director = $this->getServiceLocator()->get('director');
+ if($type == "client") {
+ $result = $this->director->restore($type, $jobid, $client, $restoreclient, $restorejob, $where, $fileid, $dirid, $jobids, $replace);
+ }
+ elseif($type == "job") {
+ // TODO
+ }
+ return $result;
+ }
+ else {
+ return false;
+ }
+ }
}
diff --git a/module/Restore/view/restore/restore/filebrowser.phtml b/module/Restore/view/restore/restore/filebrowser.phtml
index 30fd6e4..396af8a 100644
--- a/module/Restore/view/restore/restore/filebrowser.phtml
+++ b/module/Restore/view/restore/restore/filebrowser.phtml
@@ -1,4 +1,4 @@
<?php
- header('Content-Type: application/json');
- echo $this->items;
+ header('Content-Type: application/json');
+ echo $this->items;
?>
diff --git a/module/Restore/view/restore/restore/index.phtml b/module/Restore/view/restore/restore/index.phtml
index d54e1a3..5c6deea 100644
--- a/module/Restore/view/restore/restore/index.phtml
+++ b/module/Restore/view/restore/restore/index.phtml
@@ -29,84 +29,84 @@ $this->headTitle($title);
?>
<?php
- if(isset($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>
+ if(isset($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>';
- }
+ }
?>
<?php if(isset($this->result)) : ?>
- <div class="row">
- <div class="col-md-12">
- <pre>
- <code>
- <?php echo $this->result; ?>
- </code>
- </pre>
- </div>
- </div>
+ <div class="row">
+ <div class="col-md-12">
+ <pre>
+ <code>
+ <?php echo $this->result; ?>
+ </code>
+ </pre>
+ </div>
+ </div>
<?php elseif(!isset($this->result)) : ?>
<?php
- $form->prepare();
- $form->setAttribute('class','form-horizontal');
- echo $this->form()->openTag($form);
+ $form->prepare();
+ $form->setAttribute('class','form-horizontal');
+ echo $this->form()->openTag($form);
?>
<div class="row">
- <div class="col-md-3">
-
- <?php
- if($this->restore_params['type'] == "client") {
- echo '<p>'.$this->formRow($form->get('client')).'</p>';
- echo '<p>'.$this->formRow($form->get('backups')).'</p>';
- echo '<p>'.$this->formRow($form->get('mergefilesets')).'</p>';
- echo '<p>'.$this->formRow($form->get('mergejobs')).'</p>';
- echo '<p>'.$this->formRow($form->get('restoreclient')).'</p>';
- echo '<p>'.$this->formRow($form->get('restorejob')).'</p>';
- echo '<p>'.$this->formRow($form->get('replace')).'</p>';
- echo '<p>'.$this->formRow($form->get('where')).'</p>';
- // Hidden fields
- echo $this->formRow($form->get('checked_files'));
- echo $this->formRow($form->get('checked_directories'));
- echo $this->formRow($form->get('jobids_hidden'));
- }
- elseif($this->restore_params['type'] == "job") {
- echo $this->formRow($form->get('jobid')->setAttribute('class', 'form-control'));
- echo $this->formRow($form->get('restoreclient')->setAttribute('class','form-control'));
- echo $this->formRow($form->get('restorejob')->setAttribute('class','form-control'));
- echo $this->formRow($form->get('where')->setAttribute('class','form-control'));
- }
+ <div class="col-md-3">
+
+ <?php
+ if($this->restore_params['type'] == "client") {
+ echo '<p>'.$this->formRow($form->get('client')).'</p>';
+ echo '<p>'.$this->formRow($form->get('backups')).'</p>';
+ echo '<p>'.$this->formRow($form->get('mergefilesets')).'</p>';
+ echo '<p>'.$this->formRow($form->get('mergejobs')).'</p>';
+ echo '<p>'.$this->formRow($form->get('restoreclient')).'</p>';
+ echo '<p>'.$this->formRow($form->get('restorejob')).'</p>';
+ echo '<p>'.$this->formRow($form->get('replace')).'</p>';
+ echo '<p>'.$this->formRow($form->get('where')).'</p>';
+ // Hidden fields
+ echo $this->formRow($form->get('checked_files'));
+ echo $this->formRow($form->get('checked_directories'));
+ echo $this->formRow($form->get('jobids_hidden'));
+ }
+ elseif($this->restore_params['type'] == "job") {
+ echo $this->formRow($form->get('jobid')->setAttribute('class', 'form-control'));
+ echo $this->formRow($form->get('restoreclient')->setAttribute('class','form-control'));
+ echo $this->formRow($form->get('restorejob')->setAttribute('class','form-control'));
+ echo $this->formRow($form->get('where')->setAttribute('class','form-control'));
+ }
?>
- </div>
-
- <div class="col-md-9">
- <?php
- if($this->restore_params['type'] == "client") {
- //echo $this->formRow($form->get('jobids_display')->setAttribute('class','form-control')); // for debugging
- echo '<strong>Select files to be restored</strong>';
- echo '<div class="panel panel-default" style="height: 650px; overflow: scroll;"><div id="filebrowser"></div></div>';
- /*
- echo '<div class="input-group">';
- echo '<div class="input-group-addon"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></div>';
- echo '<div><input class="search-input form-control" placeholder="Search for files and directories"></input></div>';
- echo '</div>';
- */
- }
- elseif($this->restore_params['type'] == "job") {
- }
- ?>
- </div>
+ </div>
+
+ <div class="col-md-9">
+ <?php
+ if($this->restore_params['type'] == "client") {
+ //echo $this->formRow($form->get('jobids_display')->setAttribute('class','form-control')); // for debugging
+ echo '<strong>Select files to be restored</strong>';
+ echo '<div class="panel panel-default" style="height: 650px; overflow: scroll;"><div id="filebrowser"></div></div>';
+ /*
+ echo '<div class="input-group">';
+ echo '<div class="input-group-addon"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></div>';
+ echo '<div><input class="search-input form-control" placeholder="Search for files and directories"></input></div>';
+ echo '</div>';
+ */
+ }
+ elseif($this->restore_params['type'] == "job") {
+ }
+ ?>
+ </div>
</div>
<div class="row">
- <div class="col-md-3">
- <?php echo $this->formSubmit($form->get('submit')->setAttribute('class','btn btn-primary')); ?>
- </div>
+ <div class="col-md-3">
+ <?php echo $this->formSubmit($form->get('submit')->setAttribute('class','btn btn-primary')); ?>
+ </div>
</div>
<?php
@@ -114,162 +114,162 @@ $this->headTitle($title);
?>
<?php
- echo $this->headScript()->prependFile($this->basePath() . '/js/jstree.min.js');
- echo $this->headScript()->prependFile($this->basePath() . '/js/jstreegrid.js');
- echo $this->headLink()->prependStylesheet($this->basePath() . '/css/jstree.min.css');
+ echo $this->headScript()->prependFile($this->basePath() . '/js/jstree.min.js');
+ echo $this->headScript()->prependFile($this->basePath() . '/js/jstreegrid.js');
+ echo $this->headLink()->prependStylesheet($this->basePath() . '/css/jstree.min.css');
?>
<script type="text/javascript">
- function unix_to_human(UNIX_timestamp) {
+ function unix_to_human(UNIX_timestamp) {
- var t = new Date(UNIX_timestamp * 1000);
- var formatted = t.toUTCString();
+ var t = new Date(UNIX_timestamp * 1000);
+ var formatted = t.toUTCString();
- return formatted;
+ return formatted;
- }
+ }
- function format_bytes(v) {
- if(v == 0) {
- return "0.00 B";
- }
- else {
- var k = 1000;
- var units = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB"];
- var i = Math.floor(Math.log(v) / Math.log(k));
- return parseFloat((v / Math.pow(k, i)).toFixed(2)) + " " + units[i];
- }
- }
-
- function getFiles() {
-
- var checked_files = [];
- var checked_directories = [];
-
- var checked_ids = $('#filebrowser').jstree('get_checked','full',true);
-
- $(checked_ids).each(function () {
- if(this.data.type == 'F') {
- checked_files.push(this.id);
- }
- else if(this.data.type == 'D') {
- checked_directories.push(Math.abs(this.id));
- }
- });
-
- document.getElementById('checked_files').value = checked_files.join(",");
- document.getElementById('checked_directories').value = checked_directories.join(",");
-
- if(checked_ids.length == 0) {
- alert("No files or directories selected!");
- return false;
- }
-
- return confirm("Are you sure?");
-
- }
-
- function updateRestoreParams(k, v) {
-
- var p = [];
- var params = [];
-
- p['type'] = '<?php echo $this->restore_params['type']; ?>';
-
- if(k == 'client') {
- p['jobid'] = '';
- }
- else {
- p['jobid'] = '<?php echo $this->restore_params['jobid']; ?>';
- }
-
- p['client'] = '<?php echo $this->restore_params['client']; ?>';
-
- if(k == 'client') {
- p['restoreclient'] = '';
- }
- else {
- p['restoreclient'] = '<?php echo $this->restore_params['restoreclient']; ?>';
- }
-
- p['restorejob'] = '<?php echo $this->restore_params['restorejob']; ?>';
- p['where'] = '<?php echo $this->restore_params['where']; ?>';
- p['fileset'] = '<?php echo $this->restore_params['fileset']; ?>';
-
- if(k == 'mergejobs' && v == '1') {
- p['mergefilesets'] = '1';
- }
- else {
- p['mergefilesets'] = '<?php echo $this->restore_params['mergefilesets']; ?>';
- }
-
- if(k == 'mergefilesets' && v == '0') {
- p['mergejobs'] = '0';
- }
- else {
- p['mergejobs'] = '<?php echo $this->restore_params['mergejobs']; ?>';
- }
-
- p[k] = v;
-
- var key;
-
- for(key in p) {
- params.push(key + "=" + p[key]);
- }
-
- return params.join('&');
-
- }
-
- $(".search-input").keyup(function() {
- var searchString = $(this).val();
- console.log(searchString);
- $('#filebrowser').jstree('search', searchString);
- });
-
- $('#filebrowser').jstree({
- 'core' : {
- 'data' :{
- 'url' : '<?php echo $this->basePath() . "/restore/filebrowser?type=" . $this->restore_params['type'] . "&jobid=" . $this->restore_params['jobid'] . "&mergefilesets=" . $this->restore_params['mergefilesets'] . "&mergejobs=" . $this->restore_params['mergejobs']; ?>',
- 'dataType' : 'json',
- 'data' : function (node) {
- return { 'id' : node.id };
- },
- //'error' : alert('Error') // debug
- }
- },
- 'plugins' : [ "grid", "checkbox", "state", "sort", "search" ],
- 'grid' : {
- columns: [
- { width: 500, header: "Name", title: "_DATA_" },
- { width: 125, header: "Size", value: function(node) { return(format_bytes(node.data.stat.size)); } },
- { header: "Date", value: function(node) { return(unix_to_human(node.data.stat.mtime)); } }
- ],
- resizable: true,
- },
- 'search' : {
- "case_sensitive" : false,
- "show_only_matches" : false
- }
- });
-
- $('#jobid').change(function(event) {
- window.location.href = window.location.pathname + '?' + updateRestoreParams('jobid', this.value);
- });
-
- $('#client').change(function(event) {
- window.location.href = window.location.pathname + '?' + updateRestoreParams('client', this.value);
- });
-
- $('#mergefilesets').change(function(event) {
- window.location.href = window.location.pathname + '?' + updateRestoreParams('mergefilesets', this.value);
- });
-
- $('#mergejobs').change(function(event) {
- window.location.href = window.location.pathname + '?' + updateRestoreParams('mergejobs', this.value);
- });
+ function format_bytes(v) {
+ if(v == 0) {
+ return "0.00 B";
+ }
+ else {
+ var k = 1000;
+ var units = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB"];
+ var i = Math.floor(Math.log(v) / Math.log(k));
+ return parseFloat((v / Math.pow(k, i)).toFixed(2)) + " " + units[i];
+ }
+ }
+
+ function getFiles() {
+
+ var checked_files = [];
+ var checked_directories = [];
+
+ var checked_ids = $('#filebrowser').jstree('get_checked','full',true);
+
+ $(checked_ids).each(function () {
+ if(this.data.type == 'F') {
+ checked_files.push(this.id);
+ }
+ else if(this.data.type == 'D') {
+ checked_directories.push(Math.abs(this.id));
+ }
+ });
+
+ document.getElementById('checked_files').value = checked_files.join(",");
+ document.getElementById('checked_directories').value = checked_directories.join(",");
+
+ if(checked_ids.length == 0) {
+ alert("No files or directories selected!");
+ return false;
+ }
+
+ return confirm("Are you sure?");
+
+ }
+
+ function updateRestoreParams(k, v) {
+
+ var p = [];
+ var params = [];
+
+ p['type'] = '<?php echo $this->restore_params['type']; ?>';
+
+ if(k == 'client') {
+ p['jobid'] = '';
+ }
+ else {
+ p['jobid'] = '<?php echo $this->restore_params['jobid']; ?>';
+ }
+
+ p['client'] = '<?php echo $this->restore_params['client']; ?>';
+
+ if(k == 'client') {
+ p['restoreclient'] = '';
+ }
+ else {
+ p['restoreclient'] = '<?php echo $this->restore_params['restoreclient']; ?>';
+ }
+
+ p['restorejob'] = '<?php echo $this->restore_params['restorejob']; ?>';
+ p['where'] = '<?php echo $this->restore_params['where']; ?>';
+ p['fileset'] = '<?php echo $this->restore_params['fileset']; ?>';
+
+ if(k == 'mergejobs' && v == '1') {
+ p['mergefilesets'] = '1';
+ }
+ else {
+ p['mergefilesets'] = '<?php echo $this->restore_params['mergefilesets']; ?>';
+ }
+
+ if(k == 'mergefilesets' && v == '0') {
+ p['mergejobs'] = '0';
+ }
+ else {
+ p['mergejobs'] = '<?php echo $this->restore_params['mergejobs']; ?>';
+ }
+
+ p[k] = v;
+
+ var key;
+
+ for(key in p) {
+ params.push(key + "=" + p[key]);
+ }
+
+ return params.join('&');
+
+ }
+
+ $(".search-input").keyup(function() {
+ var searchString = $(this).val();
+ console.log(searchString);
+ $('#filebrowser').jstree('search', searchString);
+ });
+
+ $('#filebrowser').jstree({
+ 'core' : {
+ 'data' :{
+ 'url' : '<?php echo $this->basePath() . "/restore/filebrowser?type=" . $this->restore_params['type'] . "&jobid=" . $this->restore_params['jobid'] . "&mergefilesets=" . $this->restore_params['mergefilesets'] . "&mergejobs=" . $this->restore_params['mergejobs']; ?>',
+ 'dataType' : 'json',
+ 'data' : function (node) {
+ return { 'id' : node.id };
+ },
+ //'error' : alert('Error') // debug
+ }
+ },
+ 'plugins' : [ "grid", "checkbox", "state", "sort", "search" ],
+ 'grid' : {
+ columns: [
+ { width: 500, header: "Name", title: "_DATA_" },
+ { width: 125, header: "Size", value: function(node) { return(format_bytes(node.data.stat.size)); } },
+ { header: "Date", value: function(node) { return(unix_to_human(node.data.stat.mtime)); } }
+ ],
+ resizable: true,
+ },
+ 'search' : {
+ "case_sensitive" : false,
+ "show_only_matches" : false
+ }
+ });
+
+ $('#jobid').change(function(event) {
+ window.location.href = window.location.pathname + '?' + updateRestoreParams('jobid', this.value);
+ });
+
+ $('#client').change(function(event) {
+ window.location.href = window.location.pathname + '?' + updateRestoreParams('client', this.value);
+ });
+
+ $('#mergefilesets').change(function(event) {
+ window.location.href = window.location.pathname + '?' + updateRestoreParams('mergefilesets', this.value);
+ });
+
+ $('#mergejobs').change(function(event) {
+ window.location.href = window.location.pathname + '?' + updateRestoreParams('mergejobs', this.value);
+ });
</script>
diff --git a/module/Storage/Module.php b/module/Storage/Module.php
index 0d84391..255a290 100644
--- a/module/Storage/Module.php
+++ b/module/Storage/Module.php
@@ -8,35 +8,35 @@ use Storage\Model\StorageModel;
class Module
{
- public function getAutoloaderConfig()
- {
- return array(
- 'Zend\Loader\ClassMapAutoloader' => array(
- __DIR__ . '/autoload_classmap.php',
- ),
- 'Zend\Loader\StandardAutoloader' => array(
- 'namespaces' => array(
- __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
- ),
- ),
- );
- }
+ public function getAutoloaderConfig()
+ {
+ return array(
+ 'Zend\Loader\ClassMapAutoloader' => array(
+ __DIR__ . '/autoload_classmap.php',
+ ),
+ 'Zend\Loader\StandardAutoloader' => array(
+ 'namespaces' => array(
+ __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
+ ),
+ ),
+ );
+ }
- public function getConfig()
- {
- return include __DIR__ . '/config/module.config.php';
- }
+ public function getConfig()
+ {
+ return include __DIR__ . '/config/module.config.php';
+ }
- public function getServiceConfig()
- {
- return array(
- 'factories' => array(
- 'Storage\Model\StorageModel' => function() {
- $model = new StorageModel();
- return $model;
- }
- )
- );
- }
+ public function getServiceConfig()
+ {
+ return array(
+ 'factories' => array(
+ 'Storage\Model\StorageModel' => function() {
+ $model = new StorageModel();
+ return $model;
+ }
+ )
+ );
+ }
}
diff --git a/module/Storage/config/module.config.php b/module/Storage/config/module.config.php
index 5d1af6a..ff6f25d 100644
--- a/module/Storage/config/module.config.php
+++ b/module/Storage/config/module.config.php
@@ -25,39 +25,39 @@
return array(
- 'controllers' => array(
- 'invokables' => array(
- 'Storage\Controller\Storage' => 'Storage\Controller\StorageController',
- ),
- ),
- 'controller_plugins' => array(
- 'invokables' => array(
- 'SessionTimeoutPlugin' => 'Application\Controller\Plugin\SessionTimeoutPlugin',
- ),
- ),
- 'router' => array(
- 'routes' => array(
- 'storage' => array(
- 'type' => 'segment',
- 'options' => array(
- 'route' => '/storage[/][:action][/][:id]',
- 'constraints' => array(
- 'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
- 'id' => '[0-9]+',
- ),
- 'defaults' => array(
- 'controller' => 'Storage\Controller\Storage',
- 'action' => 'index',
- ),
- ),
- ),
- ),
- ),
+ 'controllers' => array(
+ 'invokables' => array(
+ 'Storage\Controller\Storage' => 'Storage\Controller\StorageController',
+ ),
+ ),
+ 'controller_plugins' => array(
+ 'invokables' => array(
+ 'SessionTimeoutPlugin' => 'Application\Controller\Plugin\SessionTimeoutPlugin',
+ ),
+ ),
+ 'router' => array(
+ 'routes' => array(
+ 'storage' => array(
+ 'type' => 'segment',
+ 'options' => array(
+ 'route' => '/storage[/][:action][/][:id]',
+ 'constraints' => array(
+ 'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
+ 'id' => '[0-9]+',
+ ),
+ 'defaults' => array(
+ 'controller' => 'Storage\Controller\Storage',
+ 'action' => 'index',
+ ),
+ ),
+ ),
+ ),
+ ),
- 'view_manager' => array(
- 'template_path_stack' => array(
- 'storage' => __DIR__ . '/../view',
- ),
- ),
+ 'view_manager' => array(
+ 'template_path_stack' => array(
+ 'storage' => __DIR__ . '/../view',
+ ),
+ ),
);
diff --git a/module/Storage/src/Storage/Controller/StorageController.php b/module/Storage/src/Storage/Controller/StorageController.php
index d5502f1..a324598 100644
--- a/module/Storage/src/Storage/Controller/StorageController.php
+++ b/module/Storage/src/Storage/Controller/StorageController.php
@@ -32,74 +32,74 @@ use Zend\Json\Json;
class StorageController extends AbstractActionController
{
- protected $storageModel;
-
- public function indexAction()
- {
- if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
- return new ViewModel(array());
- }
- else {
- return $this->redirect()->toRoute('auth', array('action' => 'login'));
- }
- }
-
- public function detailsAction()
- {
- if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
- return new ViewModel(array());
- }
- else {
- return $this->redirect()->toRoute('auth', array('action' => 'login'));
- }
- }
-
- public function autochangerAction()
- {
- if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
- return new ViewModel(array());
- }
- else {
- return $this->redirect()->toRoute('auth', array('action' => 'login'));
- }
- }
-
- public function getDataAction()
- {
- if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
-
- $data = $this->params()->fromQuery('data');
- $storage = $this->params()->fromQuery('storage');
-
- if($data == "all") {
- $result = $this->getStorageModel()->getStorages();
- }
- else {
- $result = null;
- }
-
- $response = $this->getResponse();
- $response->getHeaders()->addHeaderLine('Content-Type', 'application/json');
-
- if(isset($result)) {
- $response->setContent(JSON::encode($result));
- }
-
- return $response;
- }
- else {
- return $this->redirect()->toRoute('auth', array('action' => 'login'));
- }
- }
-
- public function getStorageModel()
- {
- if(!$this->storageModel) {
- $sm = $this->getServiceLocator();
- $this->storageModel = $sm->get('Storage\Model\StorageModel');
- }
- return $this->storageModel;
- }
+ protected $storageModel;
+
+ public function indexAction()
+ {
+ if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
+ return new ViewModel(array());
+ }
+ else {
+ return $this->redirect()->toRoute('auth', array('action' => 'login'));
+ }
+ }
+
+ public function detailsAction()
+ {
+ if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
+ return new ViewModel(array());
+ }
+ else {
+ return $this->redirect()->toRoute('auth', array('action' => 'login'));
+ }
+ }
+
+ public function autochangerAction()
+ {
+ if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
+ return new ViewModel(array());
+ }
+ else {
+ return $this->redirect()->toRoute('auth', array('action' => 'login'));
+ }
+ }
+
+ public function getDataAction()
+ {
+ if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {
+
+ $data = $this->params()->fromQuery('data');
+ $storage = $this->params()->fromQuery('storage');
+
+ if($data == "all") {
+ $result = $this->getStorageModel()->getStorages();
+ }
+ else {
+ $result = null;
+ }
+
+ $response = $this->getResponse();
+ $response->getHeaders()->addHeaderLine('Content-Type', 'application/json');
+
+ if(isset($result)) {
+ $response->setContent(JSON::encode($result));
+ }
+
+ return $response;
+ }
+ else {
+ return $this->redirect()->toRoute('auth', array('action' => 'login'));
+ }
+ }
+
+ public function getStorageModel()
+ {
+ if(!$this->storageModel) {
+ $sm = $this->getServiceLocator();
+ $this->storageModel = $sm->get('Storage\Model\StorageModel');
+ }
+ return $this->storageModel;
+ }
}
diff --git a/module/Storage/src/Storage/Model/StorageModel.php b/module/Storage/src/Storage/Model/StorageModel.php
index 5ed4547..4a0f835 100644
--- a/module/Storage/src/Storage/Model/StorageModel.php
+++ b/module/Storage/src/Storage/Model/StorageModel.php
@@ -30,31 +30,31 @@ use Zend\ServiceManager\ServiceLocatorInterface;
class StorageModel implements ServiceLocatorAwareInterface
{
- protected $serviceLocator;
- protected $director;
-
- public function __construct()
- {
- }
-
- public function setServiceLocator(ServiceLocatorInterface $serviceLocator)
- {
- $this->serviceLocator = $serviceLocator;
- }
-
- public function getServiceLocator()
- {
- return $this->serviceLocator;
- }
-
- public function getStorages()
- {
- $cmd = 'list storages';
- $this->director = $this->getServiceLocator()->get('director');
- $result = $this->director->send_command($cmd, 2, null);
- $storages = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
- return $storages['result']['storages'];
- }
+ protected $serviceLocator;
+ protected $director;
+
+ public function __construct()
+ {
+ }
+
+ public function setServiceLocator(ServiceLocatorInterface $serviceLocator)
+ {
+ $this->serviceLocator = $serviceLocator;
+ }
+
+ public function getServiceLocator()
+ {
+ return $this->serviceLocator;
+ }
+
+ public function getStorages()
+ {
+ $cmd = 'list storages';
+ $this->director = $this->getServiceLocator()->get('director');
+ $result = $this->director->send_command($cmd, 2, null);
+ $storages = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
+ return $storages['result']['storages'];
+ }
}
diff --git a/module/Storage/view/storage/storage/details.phtml b/module/Storage/view/storage/storage/details.phtml
index 96406b8..cdc22b2 100644
--- a/module/Storage/view/storage/storage/details.phtml
+++ b/module/Storage/view/storage/storage/details.phtml
@@ -7,7 +7,7 @@
* @link https://github.com/bareos/bareos-webui for the canonical source repository
* @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
+ * @author Frank Bergkemper
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
diff --git a/module/Storage/view/storage/storage/index.phtml b/module/Storage/view/storage/storage/index.phtml
index 2071d74..2ffc72f 100644
--- a/module/Storage/view/storage/storage/index.phtml
+++ b/module/Storage/view/storage/storage/index.phtml
@@ -7,7 +7,7 @@
* @link https://github.com/bareos/bareos-webui for the canonical source repository
* @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
+ * @author Frank Bergkemper
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -43,8 +43,8 @@ $this->headTitle($title);
<table class="table table-hover" id="storages">
<thead class="bg-primary">
- <th><?php echo $this->translate("Name"); ?></th>
- <th><?php echo $this->translate("Autochanger"); ?></th>
+ <th><?php echo $this->translate("Name"); ?></th>
+ <th><?php echo $this->translate("Autochanger"); ?></th>
</thead>
</table>
@@ -64,49 +64,49 @@ $this->headTitle($title);
$(document).ready(function() {
- var table= $('#storages').DataTable( {
- "ajax": {
- "url": "<?php echo $this->url('storage', array('action' => 'getData'), null) . '?data=all'; ?>",
- "dataSrc": ""
- },
- "columns" : [
- {
- "className": "storage-name",
- "orderable": true,
- "data": "name"
- },
- {
- "className": "storage-autochanger",
- "orderable": true,
- "data": "autochanger"
- },
- ],
- "paging": true,
- "ordering": true,
- "info": true,
- "pagingType": "full_numbers",
- "stateSave": true,
- "columnDefs": [
- {
- "targets": 0,
- "data": "name",
- "render": function(data, type, full, meta) {
- return data;
- }
- },
- {
- "targets": 1,
- "data": "autochanger",
- "render": function(data, type, full, meta) {
- var a = '<span class="label label-default">No</span>';
- if(data == "1") {
- a = '<span class="label label-success">Yes</span>';
- }
- return a;
- }
- },
- ]
- });
+ var table= $('#storages').DataTable( {
+ "ajax": {
+ "url": "<?php echo $this->url('storage', array('action' => 'getData'), null) . '?data=all'; ?>",
+ "dataSrc": ""
+ },
+ "columns" : [
+ {
+ "className": "storage-name",
+ "orderable": true,
+ "data": "name"
+ },
+ {
+ "className": "storage-autochanger",
+ "orderable": true,
+ "data": "autochanger"
+ },
+ ],
+ "paging": true,
+ "ordering": true,
+ "info": true,
+ "pagingType": "full_numbers",
+ "stateSave": true,
+ "columnDefs": [
+ {
+ "targets": 0,
+ "data": "name",
+ "render": function(data, type, full, meta) {
+ return data;
+ }
+ },
+ {
+ "targets": 1,
+ "data": "autochanger",
+ "render": function(data, type, full, meta) {
+ var a = '<span class="label label-default">No</span>';
+ if(data == "1") {
+ a = '<span class="label label-success">Yes</span>';
+ }
+ return a;
+ }
+ },
+ ]
+ });
});
diff --git a/public/index.php b/public/index.php
index b7612db..b21c8da 100644
--- a/public/index.php
+++ b/public/index.php
@@ -1,9 +1,9 @@
<?php
if ($_SERVER['APPLICATION_ENV'] == 'development') {
- error_reporting(E_ALL);
- ini_set("display_errors", 1);
- define('REQUEST_MICROTIME', microtime(true));
+ error_reporting(E_ALL);
+ ini_set("display_errors", 1);
+ define('REQUEST_MICROTIME', microtime(true));
}
/**
diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php
index 8fd8130..5bbce75 100644
--- a/tests/Bootstrap.php
+++ b/tests/Bootstrap.php
@@ -10,95 +10,95 @@ use RuntimeException;
error_reporting(E_ALL | E_STRICT);
chdir(__DIR__);
-class Bootstrap
+class Bootstrap
{
- protected static $serviceManager;
-
- public static function init()
- {
- $zf2ModulePaths = array(dirname(dirname(__DIR__)));
- if (($path = static::findParentPath('vendor'))) {
- $zf2ModulePaths[] = $path;
- }
- if (($path = static::findParentPath('module')) !== $zf2ModulePaths[0]) {
- $zf2ModulePaths[] = $path;
- }
-
- static::initAutoloader();
-
- // use ModuleManager to load this module and it's dependencies
- $config = array(
- 'module_listener_options' => array('module_paths' => $zf2ModulePaths,),
- 'modules' => array('Job')
- );
-
- $serviceManager = new ServiceManager(new ServiceManagerConfig());
- $serviceManager->setService('ApplicationConfig', $config);
- $serviceManager->get('ModuleManager')->loadModules();
- static::$serviceManager = $serviceManager;
- }
-
- public static function chroot()
- {
- $rootPath = dirname(static::findParentPath('module'));
- chdir($rootPath);
- }
-
- public static function getServiceManager()
- {
- return static::$serviceManager;
- }
-
- protected static function initAutoloader()
- {
- $vendorPath = static::findParentPath('vendor');
-
- $zf2Path = getenv('ZF2_PATH');
-
- if (!$zf2Path) {
- if (defined('ZF2_PATH')) {
- $zf2Path = ZF2_PATH;
- }
- elseif (is_dir($vendorPath . '/ZF2/library')) {
- $zf2Path = $vendorPath . '/ZF2/library';
- }
- elseif (is_dir($vendorPath . '/zendframework/zendframework/library')) {
- $zf2Path = $vendorPath . '/zendframework/zendframework/library';
- }
- }
-
- if (!$zf2Path) {
- throw new RuntimeException('Unable to load ZF2. Run `php composer.phar install` or' . ' define a ZF2_PATH environment variable.');
- }
-
- if (file_exists($vendorPath . '/autoload.php')) {
- include $vendorPath . '/autoload.php';
- }
-
- include $zf2Path . '/Zend/Loader/AutoloaderFactory.php';
-
- AutoloaderFactory::factory(array(
- 'Zend\Loader\StandardAutoloader' => array(
- 'autoregister_zf' => true,
- 'namespaces' => array(
- __NAMESPACE__ => __DIR__ . '/' . __NAMESPACE__,
- ),
- ),
- ));
- }
-
- protected static function findParentPath($path)
- {
- $dir = __DIR__;
- $previousDir = '.';
- while (!is_dir($dir . '/' . $path)) {
- $dir = dirname($dir);
- if ($previousDir === $dir)
- return false;
- $previousDir = $dir;
- }
- return $dir . '/' . $path;
- }
+ protected static $serviceManager;
+
+ public static function init()
+ {
+ $zf2ModulePaths = array(dirname(dirname(__DIR__)));
+ if (($path = static::findParentPath('vendor'))) {
+ $zf2ModulePaths[] = $path;
+ }
+ if (($path = static::findParentPath('module')) !== $zf2ModulePaths[0]) {
+ $zf2ModulePaths[] = $path;
+ }
+
+ static::initAutoloader();
+
+ // use ModuleManager to load this module and it's dependencies
+ $config = array(
+ 'module_listener_options' => array('module_paths' => $zf2ModulePaths,),
+ 'modules' => array('Job')
+ );
+
+ $serviceManager = new ServiceManager(new ServiceManagerConfig());
+ $serviceManager->setService('ApplicationConfig', $config);
+ $serviceManager->get('ModuleManager')->loadModules();
+ static::$serviceManager = $serviceManager;
+ }
+
+ public static function chroot()
+ {
+ $rootPath = dirname(static::findParentPath('module'));
+ chdir($rootPath);
+ }
+
+ public static function getServiceManager()
+ {
+ return static::$serviceManager;
+ }
+
+ protected static function initAutoloader()
+ {
+ $vendorPath = static::findParentPath('vendor');
+
+ $zf2Path = getenv('ZF2_PATH');
+
+ if (!$zf2Path) {
+ if (defined('ZF2_PATH')) {
+ $zf2Path = ZF2_PATH;
+ }
+ elseif (is_dir($vendorPath . '/ZF2/library')) {
+ $zf2Path = $vendorPath . '/ZF2/library';
+ }
+ elseif (is_dir($vendorPath . '/zendframework/zendframework/library')) {
+ $zf2Path = $vendorPath . '/zendframework/zendframework/library';
+ }
+ }
+
+ if (!$zf2Path) {
+ throw new RuntimeException('Unable to load ZF2. Run `php composer.phar install` or' . ' define a ZF2_PATH environment variable.');
+ }
+
+ if (file_exists($vendorPath . '/autoload.php')) {
+ include $vendorPath . '/autoload.php';
+ }
+
+ include $zf2Path . '/Zend/Loader/AutoloaderFactory.php';
+
+ AutoloaderFactory::factory(array(
+ 'Zend\Loader\StandardAutoloader' => array(
+ 'autoregister_zf' => true,
+ 'namespaces' => array(
+ __NAMESPACE__ => __DIR__ . '/' . __NAMESPACE__,
+ ),
+ ),
+ ));
+ }
+
+ protected static function findParentPath($path)
+ {
+ $dir = __DIR__;
+ $previousDir = '.';
+ while (!is_dir($dir . '/' . $path)) {
+ $dir = dirname($dir);
+ if ($previousDir === $dir)
+ return false;
+ $previousDir = $dir;
+ }
+ return $dir . '/' . $path;
+ }
}
diff --git a/tests/ClientTest/Controller/IndexControllerTest.php b/tests/ClientTest/Controller/IndexControllerTest.php
index b404ad8..7874b73 100644
--- a/tests/ClientTest/Controller/IndexControllerTest.php
+++ b/tests/ClientTest/Controller/IndexControllerTest.php
@@ -3,7 +3,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/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
@@ -29,23 +29,23 @@ use Zend\Test\PHPUnit\Controller\AbstractHttpControllerTestCase;
class ClientControllerTest extends AbstractHttpControllerTestCase
{
- protected $traceError = true;
+ protected $traceError = true;
- public function setUp()
- {
- $this->setApplicationConfig(
- include './config/application.config.php'
- );
- }
+ public function setUp()
+ {
+ $this->setApplicationConfig(
+ include './config/application.config.php'
+ );
+ }
- public function testIndexActionCanBeAccessed()
- {
- $this->dispatch('/client');
- $this->assertResponseStatusCode(200);
- $this->assertModuleName('Client');
- $this->assertControllerName('Client\Controller\Client');
- $this->assertControllerClass('ClientController');
- $this->assertMatchedRouteName('client');
- }
+ public function testIndexActionCanBeAccessed()
+ {
+ $this->dispatch('/client');
+ $this->assertResponseStatusCode(200);
+ $this->assertModuleName('Client');
+ $this->assertControllerName('Client\Controller\Client');
+ $this->assertControllerClass('ClientController');
+ $this->assertMatchedRouteName('client');
+ }
}
diff --git a/tests/ClientTest/Model/ClientTableTest.php b/tests/ClientTest/Model/ClientTableTest.php
index 03090f0..e4b8af3 100644
--- a/tests/ClientTest/Model/ClientTableTest.php
+++ b/tests/ClientTest/Model/ClientTableTest.php
@@ -3,7 +3,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/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
@@ -30,30 +30,30 @@ use Client\Model\Client;
use Zend\Db\ResultSet\ResultSet;
use PHPUnit_Framework_TestCase;
-class ClientTableTest extends PHPUnit_Framework_TestCase
+class ClientTableTest extends PHPUnit_Framework_TestCase
{
-
- public function testFetchAllReturnsAllClients()
- {
- $resultSet = new ResultSet();
- $mockTableGateway = $this->getMock(
- 'Zend\Db\TableGateway\TableGateway',
- array('select'),
- array(),
- '',
- false
- );
+ public function testFetchAllReturnsAllClients()
+ {
+ $resultSet = new ResultSet();
+
+ $mockTableGateway = $this->getMock(
+ 'Zend\Db\TableGateway\TableGateway',
+ array('select'),
+ array(),
+ '',
+ false
+ );
- $mockTableGateway->expects($this->once())
- ->method('select')
- ->with()
- ->will($this->returnValue($resultSet));
+ $mockTableGateway->expects($this->once())
+ ->method('select')
+ ->with()
+ ->will($this->returnValue($resultSet));
- $clientTable = new ClientTable($mockTableGateway);
+ $clientTable = new ClientTable($mockTableGateway);
- $this->assertSame($resultSet, $clientTable->fetchAll());
+ $this->assertSame($resultSet, $clientTable->fetchAll());
- }
+ }
}
diff --git a/tests/DashboardTest/Controller/IndexControllerTest.php b/tests/DashboardTest/Controller/IndexControllerTest.php
index cc4cc79..5586e9d 100644
--- a/tests/DashboardTest/Controller/IndexControllerTest.php
+++ b/tests/DashboardTest/Controller/IndexControllerTest.php
@@ -3,7 +3,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/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
@@ -29,24 +29,24 @@ use Zend\Test\PHPUnit\Controller\AbstractHttpControllerTestCase;
class DashboardControllerTest extends AbstractHttpControllerTestCase
{
-
- protected $traceError = true;
-
- public function setUp()
- {
- $this->setApplicationConfig(
- include './config/application.config.php'
- );
- }
-
- public function testIndexActionCanBeAccessed()
- {
- $this->dispatch('/dashboard');
- $this->assertResponseStatusCode(200);
- $this->assertModuleName('Dashboard');
- $this->assertControllerName('Dashboard\Controller\Dashboard');
- $this->assertControllerClass('DashboardController');
- $this->assertMatchedRouteName('dashboard');
- }
+
+ protected $traceError = true;
+
+ public function setUp()
+ {
+ $this->setApplicationConfig(
+ include './config/application.config.php'
+ );
+ }
+
+ public function testIndexActionCanBeAccessed()
+ {
+ $this->dispatch('/dashboard');
+ $this->assertResponseStatusCode(200);
+ $this->assertModuleName('Dashboard');
+ $this->assertControllerName('Dashboard\Controller\Dashboard');
+ $this->assertControllerClass('DashboardController');
+ $this->assertMatchedRouteName('dashboard');
+ }
}
diff --git a/tests/DirectorTest/Controller/IndexControllerTest.php b/tests/DirectorTest/Controller/IndexControllerTest.php
index 8732f0c..fa20cf5 100644
--- a/tests/DirectorTest/Controller/IndexControllerTest.php
+++ b/tests/DirectorTest/Controller/IndexControllerTest.php
@@ -3,7 +3,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/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
@@ -29,24 +29,24 @@ use Zend\Test\PHPUnit\Controller\AbstractHttpControllerTestCase;
class DirectorControllerTest extends AbstractHttpControllerTestCase
{
-
- protected $traceError = true;
-
- public function setUp()
- {
- $this->setApplicationConfig(
- include './config/application.config.php'
- );
- }
-
- public function testIndexActionCanBeAccessed()
- {
- $this->dispatch('/director');
- $this->assertResponseStatusCode(200);
- $this->assertModuleName('Director');
- $this->assertControllerName('Director\Controller\Director');
- $this->assertControllerClass('DirectorController');
- $this->assertMatchedRouteName('director');
- }
+
+ protected $traceError = true;
+
+ public function setUp()
+ {
+ $this->setApplicationConfig(
+ include './config/application.config.php'
+ );
+ }
+
+ public function testIndexActionCanBeAccessed()
+ {
+ $this->dispatch('/director');
+ $this->assertResponseStatusCode(200);
+ $this->assertModuleName('Director');
+ $this->assertControllerName('Director\Controller\Director');
+ $this->assertControllerClass('DirectorController');
+ $this->assertMatchedRouteName('director');
+ }
}
diff --git a/tests/FileTest/Controller/IndexControllerTest.php b/tests/FileTest/Controller/IndexControllerTest.php
index 53304e9..2b7eb2a 100644
--- a/tests/FileTest/Controller/IndexControllerTest.php
+++ b/tests/FileTest/Controller/IndexControllerTest.php
@@ -3,7 +3,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/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
@@ -30,23 +30,23 @@ use Zend\Test\PHPUnit\Controller\AbstractHttpControllerTestCase;
class FileControllerTest extends AbstractHttpControllerTestCase
{
- protected $traceError = true;
-
- public function setUp()
- {
- $this->setApplicationConfig(
- include './config/application.config.php'
- );
- }
-
- public function testIndexActionCanBeAccessed()
- {
- $this->dispatch('/file');
- $this->assertResponseStatusCode(200);
- $this->assertModuleName('File');
- $this->assertControllerName('File\Controller\File');
- $this->assertControllerClass('FileController');
- $this->assertMatchedRouteName('file');
- }
+ protected $traceError = true;
+
+ public function setUp()
+ {
+ $this->setApplicationConfig(
+ include './config/application.config.php'
+ );
+ }
+
+ public function testIndexActionCanBeAccessed()
+ {
+ $this->dispatch('/file');
+ $this->assertResponseStatusCode(200);
+ $this->assertModuleName('File');
+ $this->assertControllerName('File\Controller\File');
+ $this->assertControllerClass('FileController');
+ $this->assertMatchedRouteName('file');
+ }
}
diff --git a/tests/FileTest/Model/FileTableTest.php b/tests/FileTest/Model/FileTableTest.php
index 4378f59..bc1322a 100644
--- a/tests/FileTest/Model/FileTableTest.php
+++ b/tests/FileTest/Model/FileTableTest.php
@@ -3,7 +3,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/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
@@ -30,30 +30,30 @@ use File\Model\File;
use Zend\Db\ResultSet\ResultSet;
use PHPUnit_Framework_TestCase;
-class FileTableTest extends PHPUnit_Framework_TestCase
+class FileTableTest extends PHPUnit_Framework_TestCase
{
-
- public function testFetchAllReturnsAllJobs()
- {
- $resultSet = new ResultSet();
- $mockTableGateway = $this->getMock(
- 'Zend\Db\TableGateway\TableGateway',
- array('select'),
- array(),
- '',
- false
- );
+ public function testFetchAllReturnsAllJobs()
+ {
+ $resultSet = new ResultSet();
+
+ $mockTableGateway = $this->getMock(
+ 'Zend\Db\TableGateway\TableGateway',
+ array('select'),
+ array(),
+ '',
+ false
+ );
- $mockTableGateway->expects($this->once())
- ->method('select')
- ->with()
- ->will($this->returnValue($resultSet));
+ $mockTableGateway->expects($this->once())
+ ->method('select')
+ ->with()
+ ->will($this->returnValue($resultSet));
- $fileTable = new FileTable($mockTableGateway);
+ $fileTable = new FileTable($mockTableGateway);
- $this->assertSame($resultSet, $fileTable->fetchAll());
+ $this->assertSame($resultSet, $fileTable->fetchAll());
- }
+ }
}
diff --git a/tests/FilesetTest/Controller/IndexControllerTest.php b/tests/FilesetTest/Controller/IndexControllerTest.php
index 2eac691..b167131 100644
--- a/tests/FilesetTest/Controller/IndexControllerTest.php
+++ b/tests/FilesetTest/Controller/IndexControllerTest.php
@@ -3,7 +3,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/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
@@ -30,23 +30,23 @@ use Zend\Test\PHPUnit\Controller\AbstractHttpControllerTestCase;
class FilesetControllerTest extends AbstractHttpControllerTestCase
{
- protected $traceError = true;
-
- public function setUp()
- {
- $this->setApplicationConfig(
- include './config/application.config.php'
- );
- }
-
- public function testIndexActionCanBeAccessed()
- {
- $this->dispatch('/fileset');
- $this->assertResponseStatusCode(200);
- $this->assertModuleName('Fileset');
- $this->assertControllerName('Fileset\Controller\Fileset');
- $this->assertControllerClass('FilesetController');
- $this->assertMatchedRouteName('fileset');
- }
+ protected $traceError = true;
+
+ public function setUp()
+ {
+ $this->setApplicationConfig(
+ include './config/application.config.php'
+ );
+ }
+
+ public function testIndexActionCanBeAccessed()
+ {
+ $this->dispatch('/fileset');
+ $this->assertResponseStatusCode(200);
+ $this->assertModuleName('Fileset');
+ $this->assertControllerName('Fileset\Controller\Fileset');
+ $this->assertControllerClass('FilesetController');
+ $this->assertMatchedRouteName('fileset');
+ }
}
diff --git a/tests/FilesetTest/Model/FilesetTableTest.php b/tests/FilesetTest/Model/FilesetTableTest.php
index 6aeb251..8cad582 100644
--- a/tests/FilesetTest/Model/FilesetTableTest.php
+++ b/tests/FilesetTest/Model/FilesetTableTest.php
@@ -3,7 +3,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/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
@@ -30,30 +30,30 @@ use Fileset\Model\Fileset;
use Zend\Db\ResultSet\ResultSet;
use PHPUnit_Framework_TestCase;
-class FilesetTableTest extends PHPUnit_Framework_TestCase
+class FilesetTableTest extends PHPUnit_Framework_TestCase
{
-
- public function testFetchAllReturnsAllFilesets()
- {
- $resultSet = new ResultSet();
- $mockTableGateway = $this->getMock(
- 'Zend\Db\TableGateway\TableGateway',
- array('select'),
- array(),
- '',
- false
- );
+ public function testFetchAllReturnsAllFilesets()
+ {
+ $resultSet = new ResultSet();
+
+ $mockTableGateway = $this->getMock(
+ 'Zend\Db\TableGateway\TableGateway',
+ array('select'),
+ array(),
+ '',
+ false
+ );
- $mockTableGateway->expects($this->once())
- ->method('select')
- ->with()
- ->will($this->returnValue($resultSet));
+ $mockTableGateway->expects($this->once())
+ ->method('select')
+ ->with()
+ ->will($this->returnValue($resultSet));
- $filesetTable = new FilesetTable($mockTableGateway);
+ $filesetTable = new FilesetTable($mockTableGateway);
- $this->assertSame($resultSet, $filesetTable->fetchAll());
+ $this->assertSame($resultSet, $filesetTable->fetchAll());
- }
+ }
}
diff --git a/tests/JobTest/Controller/IndexControllerTest.php b/tests/JobTest/Controller/IndexControllerTest.php
index fcb6349..94eda57 100644
--- a/tests/JobTest/Controller/IndexControllerTest.php
+++ b/tests/JobTest/Controller/IndexControllerTest.php
@@ -3,7 +3,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/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
@@ -27,26 +27,26 @@ namespace JobTest\Controller;
use Zend\Test\PHPUnit\Controller\AbstractHttpControllerTestCase;
-class JobControllerTest extends AbstractHttpControllerTestCase
+class JobControllerTest extends AbstractHttpControllerTestCase
{
- protected $traceError = true;
-
- public function setUp()
- {
- $this->setApplicationConfig(
- include './config/application.config.php'
- );
- }
-
- public function testIndexActionCanBeAccessed()
- {
- $this->dispatch('/job');
- $this->assertResponseStatusCode(200);
- $this->assertModuleName('Job');
- $this->assertControllerName('Job\Controller\Job');
- $this->assertControllerClass('JobController');
- $this->assertMatchedRouteName('job');
- }
-
+ protected $traceError = true;
+
+ public function setUp()
+ {
+ $this->setApplicationConfig(
+ include './config/application.config.php'
+ );
+ }
+
+ public function testIndexActionCanBeAccessed()
+ {
+ $this->dispatch('/job');
+ $this->assertResponseStatusCode(200);
+ $this->assertModuleName('Job');
+ $this->assertControllerName('Job\Controller\Job');
+ $this->assertControllerClass('JobController');
+ $this->assertMatchedRouteName('job');
+ }
+
}
diff --git a/tests/JobTest/Model/JobTableTest.php b/tests/JobTest/Model/JobTableTest.php
index b432ffa..8e765e2 100644
--- a/tests/JobTest/Model/JobTableTest.php
+++ b/tests/JobTest/Model/JobTableTest.php
@@ -3,7 +3,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/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
@@ -32,27 +32,27 @@ use PHPUnit_Framework_TestCase;
class JobTableTest extends PHPUnit_Framework_TestCase
{
- public function testFetchAllReturnsAllJobs()
- {
- $resultSet = new ResultSet();
-
- $mockTableGateway = $this->getMock(
- 'Zend\Db\TableGateway\TableGateway',
- array('select'),
- array(),
- '',
- false
- );
-
- $mockTableGateway->expects($this->once())
- ->method('select')
- ->with()
- ->will($this->returnValue($resultSet));
-
- $jobTable = new JobTable($mockTableGateway);
-
- $this->assertSame($resultSet, $jobTable->fetchAll());
-
- }
+ public function testFetchAllReturnsAllJobs()
+ {
+ $resultSet = new ResultSet();
+
+ $mockTableGateway = $this->getMock(
+ 'Zend\Db\TableGateway\TableGateway',
+ array('select'),
+ array(),
+ '',
+ false
+ );
+
+ $mockTableGateway->expects($this->once())
+ ->method('select')
+ ->with()
+ ->will($this->returnValue($resultSet));
+
+ $jobTable = new JobTable($mockTableGateway);
+
+ $this->assertSame($resultSet, $jobTable->fetchAll());
+
+ }
}
diff --git a/tests/LogTest/Controller/IndexControllerTest.php b/tests/LogTest/Controller/IndexControllerTest.php
index 39c51aa..581ebf5 100644
--- a/tests/LogTest/Controller/IndexControllerTest.php
+++ b/tests/LogTest/Controller/IndexControllerTest.php
@@ -3,7 +3,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/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
@@ -30,23 +30,23 @@ use Zend\Test\PHPUnit\Controller\AbstractHttpControllerTestCase;
class LogControllerTest extends AbstractHttpControllerTestCase
{
- protected $traceError = true;
-
- public function setUp()
- {
- $this->setApplicationConfig(
- include './config/application.config.php'
- );
- }
-
- public function testIndexActionCanBeAccessed()
- {
- $this->dispatch('/log');
- $this->assertResponseStatusCode(200);
- $this->assertModuleName('Log');
- $this->assertControllerName('Log\Controller\Log');
- $this->assertControllerClass('LogController');
- $this->assertMatchedRouteName('log');
- }
+ protected $traceError = true;
+
+ public function setUp()
+ {
+ $this->setApplicationConfig(
+ include './config/application.config.php'
+ );
+ }
+
+ public function testIndexActionCanBeAccessed()
+ {
+ $this->dispatch('/log');
+ $this->assertResponseStatusCode(200);
+ $this->assertModuleName('Log');
+ $this->assertControllerName('Log\Controller\Log');
+ $this->assertControllerClass('LogController');
+ $this->assertMatchedRouteName('log');
+ }
}
diff --git a/tests/LogTest/Model/LogTableTest.php b/tests/LogTest/Model/LogTableTest.php
index 82813a9..af8264f 100644
--- a/tests/LogTest/Model/LogTableTest.php
+++ b/tests/LogTest/Model/LogTableTest.php
@@ -3,7 +3,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/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
@@ -32,26 +32,26 @@ use PHPUnit_Framework_TestCase;
class LogTableTest extends PHPUnit_Framework_TestCase
{
- public function testFetchAllReturnsAllLogs()
- {
- $resultSet = new ResultSet();
+ public function testFetchAllReturnsAllLogs()
+ {
+ $resultSet = new ResultSet();
- $mockTableGateway = $this->getMock(
- 'Zend\Db\TableGateway\TableGateway',
- array('select'),
- array(),
- '',
- false
- );
+ $mockTableGateway = $this->getMock(
+ 'Zend\Db\TableGateway\TableGateway',
+ array('select'),
+ array(),
+ '',
+ false
+ );
- $mockTableGateway->expects($this->once())
- ->method('select')
- ->with()
- ->will($this->returnValue($resultSet));
+ $mockTableGateway->expects($this->once())
+ ->method('select')
+ ->with()
+ ->will($this->returnValue($resultSet));
- $logTable = new LogTable($mockTableGateway);
+ $logTable = new LogTable($mockTableGateway);
- $this->assertSame($resultSet, $logTable->fetchAll());
+ $this->assertSame($resultSet, $logTable->fetchAll());
- }
+ }
}
diff --git a/tests/MediaTest/Controller/IndexControllerTest.php b/tests/MediaTest/Controller/IndexControllerTest.php
index 99ca810..1024b80 100644
--- a/tests/MediaTest/Controller/IndexControllerTest.php
+++ b/tests/MediaTest/Controller/IndexControllerTest.php
@@ -3,7 +3,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/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
@@ -27,26 +27,26 @@ namespace MediaTest\Controller;
use Zend\Test\PHPUnit\Controller\AbstractHttpControllerTestCase;
-class MediaControllerTest extends AbstractHttpControllerTestCase
+class MediaControllerTest extends AbstractHttpControllerTestCase
{
- protected $traceError = true;
-
- public function setUp()
- {
- $this->setApplicationConfig(
- include './config/application.config.php'
- );
- }
-
- public function testIndexActionCanBeAccessed()
- {
- $this->dispatch('/media');
- $this->assertResponseStatusCode(200);
- $this->assertModuleName('Media');
- $this->assertControllerName('Media\Controller\Media');
- $this->assertControllerClass('MediaController');
- $this->assertMatchedRouteName('media');
- }
+ protected $traceError = true;
+
+ public function setUp()
+ {
+ $this->setApplicationConfig(
+ include './config/application.config.php'
+ );
+ }
+
+ public function testIndexActionCanBeAccessed()
+ {
+ $this->dispatch('/media');
+ $this->assertResponseStatusCode(200);
+ $this->assertModuleName('Media');
+ $this->assertControllerName('Media\Controller\Media');
+ $this->assertControllerClass('MediaController');
+ $this->assertMatchedRouteName('media');
+ }
}
diff --git a/tests/MediaTest/Model/MediaTableTest.php b/tests/MediaTest/Model/MediaTableTest.php
index 5034677..252d25b 100644
--- a/tests/MediaTest/Model/MediaTableTest.php
+++ b/tests/MediaTest/Model/MediaTableTest.php
@@ -3,7 +3,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/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
@@ -30,29 +30,29 @@ use Media\Model\Media;
use Zend\Db\ResultSet\ResultSet;
use PHPUnit_Framework_TestCase;
-class MediaTableTest extends PHPUnit_Framework_TestCase
+class MediaTableTest extends PHPUnit_Framework_TestCase
{
- public function testFetchAllReturnsAllMedia()
- {
- $resultSet = new ResultSet();
+ public function testFetchAllReturnsAllMedia()
+ {
+ $resultSet = new ResultSet();
- $mockTableGateway = $this->getMock(
- 'Zend\Db\TableGateway\TableGateway',
- array('select'),
- array(),
- '',
- false
- );
+ $mockTableGateway = $this->getMock(
+ 'Zend\Db\TableGateway\TableGateway',
+ array('select'),
+ array(),
+ '',
+ false
+ );
- $mockTableGateway->expects($this->once())
- ->method('select')
- ->with()
- ->will($this->returnValue($resultSet));
+ $mockTableGateway->expects($this->once())
+ ->method('select')
+ ->with()
+ ->will($this->returnValue($resultSet));
- $mediaTable = new MediaTable($mockTableGateway);
+ $mediaTable = new MediaTable($mockTableGateway);
- $this->assertSame($resultSet, $mediaTable->fetchAll());
+ $this->assertSame($resultSet, $mediaTable->fetchAll());
- }
+ }
}
diff --git a/tests/PoolTest/Controller/IndexControllerTest.php b/tests/PoolTest/Controller/IndexControllerTest.php
index a7f399d..1fab26b 100644
--- a/tests/PoolTest/Controller/IndexControllerTest.php
+++ b/tests/PoolTest/Controller/IndexControllerTest.php
@@ -3,7 +3,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/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
@@ -29,23 +29,23 @@ use Zend\Test\PHPUnit\Controller\AbstractHttpControllerTestCase;
class PoolControllerTest extends AbstractHttpControllerTestCase
{
- protected $traceError = true;
+ protected $traceError = true;
- public function setUp()
- {
- $this->setApplicationConfig(
- include './config/application.config.php'
- );
- }
+ public function setUp()
+ {
+ $this->setApplicationConfig(
+ include './config/application.config.php'
+ );
+ }
- public function testIndexActionCanBeAccessed()
- {
- $this->dispatch('/pool');
- $this->assertResponseStatusCode(200);
- $this->assertModuleName('Pool');
- $this->assertControllerName('Pool\Controller\Pool');
- $this->assertControllerClass('PoolController');
- $this->assertMatchedRouteName('pool');
- }
+ public function testIndexActionCanBeAccessed()
+ {
+ $this->dispatch('/pool');
+ $this->assertResponseStatusCode(200);
+ $this->assertModuleName('Pool');
+ $this->assertControllerName('Pool\Controller\Pool');
+ $this->assertControllerClass('PoolController');
+ $this->assertMatchedRouteName('pool');
+ }
}
diff --git a/tests/PoolTest/Model/PoolTableTest.php b/tests/PoolTest/Model/PoolTableTest.php
index f9abe5f..be594a2 100644
--- a/tests/PoolTest/Model/PoolTableTest.php
+++ b/tests/PoolTest/Model/PoolTableTest.php
@@ -3,7 +3,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/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
@@ -30,28 +30,28 @@ use Pool\Model\Job;
use Zend\Db\ResultSet\ResultSet;
use PHPUnit_Framework_TestCase;
-class PoolTableTest extends PHPUnit_Framework_TestCase
+class PoolTableTest extends PHPUnit_Framework_TestCase
{
- public function testFetchAllReturnsAllPools()
- {
- $resultSet = new ResultSet();
+ public function testFetchAllReturnsAllPools()
+ {
+ $resultSet = new ResultSet();
- $mockTableGateway = $this->getMock(
- 'Zend\Db\TableGateway\TableGateway',
- array('select'),
- array(),
- '',
- false
- );
+ $mockTableGateway = $this->getMock(
+ 'Zend\Db\TableGateway\TableGateway',
+ array('select'),
+ array(),
+ '',
+ false
+ );
- $mockTableGateway->expects($this->once())
- ->method('select')
- ->with()
- ->will($this->returnValue($resultSet));
+ $mockTableGateway->expects($this->once())
+ ->method('select')
+ ->with()
+ ->will($this->returnValue($resultSet));
- $poolTable = new PoolTable($mockTableGateway);
+ $poolTable = new PoolTable($mockTableGateway);
- $this->assertSame($resultSet, $poolTable->fetchAll());
+ $this->assertSame($resultSet, $poolTable->fetchAll());
- }
+ }
}
diff --git a/tests/RestoreTest/Controller/IndexControllerTest.php b/tests/RestoreTest/Controller/IndexControllerTest.php
index 349fe69..d8f16b2 100644
--- a/tests/RestoreTest/Controller/IndexControllerTest.php
+++ b/tests/RestoreTest/Controller/IndexControllerTest.php
@@ -3,7 +3,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/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
@@ -29,24 +29,24 @@ use Zend\Test\PHPUnit\Controller\AbstractHttpControllerTestCase;
class RestoreControllerTest extends AbstractHttpControllerTestCase
{
-
- protected $traceError = true;
-
- public function setUp()
- {
- $this->setApplicationConfig(
- include './config/application.config.php'
- );
- }
-
- public function testIndexActionCanBeAccessed()
- {
- $this->dispatch('/restore');
- $this->assertResponseStatusCode(200);
- $this->assertModuleName('Restore');
- $this->assertControllerName('Restore\Controller\Restore');
- $this->assertControllerClass('RestoreController');
- $this->assertMatchedRouteName('restore');
- }
+
+ protected $traceError = true;
+
+ public function setUp()
+ {
+ $this->setApplicationConfig(
+ include './config/application.config.php'
+ );
+ }
+
+ public function testIndexActionCanBeAccessed()
+ {
+ $this->dispatch('/restore');
+ $this->assertResponseStatusCode(200);
+ $this->assertModuleName('Restore');
+ $this->assertControllerName('Restore\Controller\Restore');
+ $this->assertControllerClass('RestoreController');
+ $this->assertMatchedRouteName('restore');
+ }
}
diff --git a/tests/StorageTest/Controller/IndexControllerTest.php b/tests/StorageTest/Controller/IndexControllerTest.php
index 0b61f69..4c0f18d 100644
--- a/tests/StorageTest/Controller/IndexControllerTest.php
+++ b/tests/StorageTest/Controller/IndexControllerTest.php
@@ -3,7 +3,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/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
@@ -27,26 +27,26 @@ namespace StorageTest\Controller;
use Zend\Test\PHPUnit\Controller\AbstractHttpControllerTestCase;
-class StorageControllerTest extends AbstractHttpControllerTestCase
+class StorageControllerTest extends AbstractHttpControllerTestCase
{
-
- protected $traceError = true;
-
- public function setUp()
- {
- $this->setApplicationConfig(
- include './config/application.config.php'
- );
- }
-
- public function testIndexActionCanBeAccessed()
- {
- $this->dispatch('/storage');
- $this->assertResponseStatusCode(200);
- $this->assertModuleName('Storage');
- $this->assertControllerName('Storage\Controller\Storage');
- $this->assertControllerClass('StorageController');
- $this->assertMatchedRouteName('storage');
- }
+
+ protected $traceError = true;
+
+ public function setUp()
+ {
+ $this->setApplicationConfig(
+ include './config/application.config.php'
+ );
+ }
+
+ public function testIndexActionCanBeAccessed()
+ {
+ $this->dispatch('/storage');
+ $this->assertResponseStatusCode(200);
+ $this->assertModuleName('Storage');
+ $this->assertControllerName('Storage\Controller\Storage');
+ $this->assertControllerClass('StorageController');
+ $this->assertMatchedRouteName('storage');
+ }
}
diff --git a/tests/StorageTest/Model/StorageTableTest.php b/tests/StorageTest/Model/StorageTableTest.php
index 54a9c2d..b76af86 100644
--- a/tests/StorageTest/Model/StorageTableTest.php
+++ b/tests/StorageTest/Model/StorageTableTest.php
@@ -3,7 +3,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/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
@@ -33,27 +33,27 @@ use PHPUnit_Framework_TestCase;
class StorageTableTest extends PHPUnit_Framework_TestCase
{
- public function testFetchAllReturnsAllJobs()
- {
- $resultSet = new ResultSet();
+ public function testFetchAllReturnsAllJobs()
+ {
+ $resultSet = new ResultSet();
- $mockTableGateway = $this->getMock(
- 'Zend\Db\TableGateway\TableGateway',
- array('select'),
- array(),
- '',
- false
- );
+ $mockTableGateway = $this->getMock(
+ 'Zend\Db\TableGateway\TableGateway',
+ array('select'),
+ array(),
+ '',
+ false
+ );
- $mockTableGateway->expects($this->once())
- ->method('select')
- ->with()
- ->will($this->returnValue($resultSet));
+ $mockTableGateway->expects($this->once())
+ ->method('select')
+ ->with()
+ ->will($this->returnValue($resultSet));
- $storageTable = new StorageTable($mockTableGateway);
+ $storageTable = new StorageTable($mockTableGateway);
- $this->assertSame($resultSet, $storageTable->fetchAll());
+ $this->assertSame($resultSet, $storageTable->fetchAll());
- }
+ }
}
diff --git a/vendor/Bareos/library/Bareos/BSock/BareosBSock.php b/vendor/Bareos/library/Bareos/BSock/BareosBSock.php
index afc09e4..443eae1 100644
--- a/vendor/Bareos/library/Bareos/BSock/BareosBSock.php
+++ b/vendor/Bareos/library/Bareos/BSock/BareosBSock.php
@@ -27,921 +27,921 @@ namespace Bareos\BSock;
class BareosBSock implements BareosBSockInterface
{
- const BNET_TLS_NONE = 0; /* cannot do TLS */
- const BNET_TLS_OK = 1; /* can do, but not required on my end */
- const BNET_TLS_REQUIRED = 2; /* TLS is required */
-
- const BNET_EOD = -1; /* End of data stream, new data may follow */
- const BNET_EOD_POLL = -2; /* End of data and poll all in one */
- const BNET_STATUS = -3; /* Send full status */
- const BNET_TERMINATE = -4; /* Conversation terminated, doing close() */
- const BNET_POLL = -5; /* Poll request, I'm hanging on a read */
- const BNET_HEARTBEAT = -6; /* Heartbeat Response requested */
- const BNET_HB_RESPONSE = -7; /* Only response permited to HB */
- const BNET_xxxxxxPROMPT = -8; /* No longer used -- Prompt for subcommand */
- const BNET_BTIME = -9; /* Send UTC btime */
- const BNET_BREAK = -10; /* Stop current command -- ctl-c */
- const BNET_START_SELECT = -11; /* Start of a selection list */
- const BNET_END_SELECT = -12; /* End of a select list */
- const BNET_INVALID_CMD = -13; /* Invalid command sent */
- const BNET_CMD_FAILED = -14; /* Command failed */
- const BNET_CMD_OK = -15; /* Command succeeded */
- const BNET_CMD_BEGIN = -16; /* Start command execution */
- const BNET_MSGS_PENDING = -17; /* Messages pending */
- const BNET_MAIN_PROMPT = -18; /* Server ready and waiting */
- const BNET_SELECT_INPUT = -19; /* Return selection input */
- const BNET_WARNING_MSG = -20; /* Warning message */
- const BNET_ERROR_MSG = -21; /* Error message -- command failed */
- const BNET_INFO_MSG = -22; /* Info message -- status line */
- const BNET_RUN_CMD = -23; /* Run command follows */
- const BNET_YESNO = -24; /* Request yes no response */
- const BNET_START_RTREE = -25; /* Start restore tree mode */
- const BNET_END_RTREE = -26; /* End restore tree mode */
- const BNET_SUB_PROMPT = -27; /* Indicate we are at a subprompt */
- const BNET_TEXT_INPUT = -28; /* Get text input from user */
-
- const DIR_OK_AUTH = "1000 OK auth\n";
- const DIR_AUTH_FAILED = "1999 Authorization failed.\n";
-
- protected $config = array(
- 'debug' => false,
- 'host' => null,
- 'port' => null,
- 'password' => null,
- 'console_name' => null,
- 'tls_verify_peer' => null,
- 'server_can_do_tls' => null,
- 'server_requires_tls' => null,
- 'client_can_do_tls' => null,
- 'client_requires_tls' => null,
- 'ca_file' => null,
- 'cert_file' => null,
- 'cert_file_passphrase' => null,
- 'allowed_cns' => null,
- );
-
- private $socket = null;
-
- /**
- * Initialize connection
- */
- public function init()
- {
- if(self::connect($this->config['console_name'], $this->config['password'])) {
- return true;
- } else {
- return false;
- }
- }
-
- /**
- * Authenticate
- */
- public function auth($console, $password)
- {
- if(self::connect($console, $password)) {
- return true;
- } else {
- return false;
- }
- }
-
- /**
- * Set configuration
- */
- private function set_config_keyword($setting, $key)
- {
- if (array_key_exists($key, $this->config)) {
- $this->config[$key] = $setting;
- } else {
- throw new \Exception("Illegal parameter $key in /config/autoload/local.php");
- }
- }
-
- /**
- * Set user credentials
- */
- public function set_user_credentials($username=null, $password=null)
- {
- $this->config['console_name'] = $username;
- $this->config['password'] = $password;
-
- if($this->config['debug']) {
- // extended debug: print config array
- var_dump($this->config);
- }
- }
-
- /**
- * Set the connection configuration
- *
- * @param $config
- */
- public function set_config($config)
- {
- array_walk($config, array('self', 'set_config_keyword'));
-
- if(empty($config['host'])) {
- throw new \Exception("Missing parameter 'host' in /config/autoload/local.php");
- }
-
- if(empty($config['port'])) {
- throw new \Exception("Missing parameter 'port' in /config/autoload/local.php");
- }
-
- if($this->config['debug']) {
- // extended debug: print config array
- var_dump($this->config);
- }
- }
-
- /**
- * Network to host length
- *
- * @param $buffer
- * @return int
- */
- private function ntohl($buffer)
- {
- $len = array();
- $actual_length = 0;
-
- $len = unpack('N', $buffer);
- $actual_length = (float) $len[1];
-
- if($actual_length > (float)2147483647) {
- $actual_length -= (float)"4294967296";
- }
-
- return (int) $actual_length;
- }
-
- /**
- * Replace spaces in a string with the special escape character ^A which is used
- * to send strings with spaces to specific director commands.
- *
- * @param $str
- * @return string
- */
- private function bash_spaces($str)
- {
- $length = strlen($str);
- $bashed_str = "";
-
- for($i = 0; $i < $length; $i++) {
- if($str[$i] == ' ') {
- $bashed_str .= '^A';
- } else {
- $bashed_str .= $str[$i];
- }
- }
-
- return $bashed_str;
- }
-
- /**
- * Send a string over the console socket.
- * Encode the length as the first 4 bytes of the message and append the string.
- *
- * @param $msg
- * @return boolean
- */
- private function send($msg)
- {
- $str_length = 0;
- $str_length = strlen($msg);
- $msg = pack('N', $str_length) . $msg;
- $str_length += 4;
-
- while($str_length > 0) {
- $send = fwrite($this->socket, $msg, $str_length);
- if($send === false) {
- return false;
- } elseif($send < $str_length) {
- $msg = substr($msg, $send);
- $str_length -= $send;
- } else {
- return true;
- }
- }
- }
-
- /**
- * Receive a string over the console socket.
- * First read first 4 bytes which encoded the length of the string and
- * the read the actual string.
- *
- * @return string
- */
- private function receive($len=0)
- {
- $buffer = "";
- $msg_len = 0;
-
- if ($len === 0) {
- $buffer = fread($this->socket, 4);
- if($buffer == false){
- return false;
- }
- $msg_len = self::ntohl($buffer);
- } else {
- $msg_len = $len;
- }
-
- if ($msg_len > 0) {
- $buffer = fread($this->socket, $msg_len);
- }
-
- return $buffer;
- }
-
- /**
- * Special receive function that also knows the different so called BNET signals the
- * Bareos director can send as part of the data stream.
- *
- * @return string
- */
- private function receive_message()
- {
- $msg = "";
- $buffer = "";
-
- while (true) {
- $buffer = fread($this->socket, 4);
-
- if ($buffer === false) {
- throw new \Exception("Error reading socket. " . socket_strerror(socket_last_error()) . "\n");
- }
-
- $len = self::ntohl($buffer);
-
- if ($len == 0) {
- break;
- }
- if ($len > 0) {
- $rlen = 1024;
- while (floor($len / $rlen) > 0) {
- $msg .= fread($this->socket, $rlen);
- $len -= $rlen;
- }
- $msg .= fread($this->socket, $len);
- } elseif ($len < 0) {
- // signal received
- switch ($len) {
- case self::BNET_EOD:
- if ($this->config['debug']) {
- echo "Got BNET_EOD\n";
- }
- return $msg;
- case self::BNET_EOD_POLL:
- if ($this->config['debug']) {
- echo "Got BNET_EOD_POLL\n";
- }
- break;
- case self::BNET_STATUS:
- if ($this->config['debug']) {
- echo "Got BNET_STATUS\n";
- }
- break;
- case self::BNET_TERMINATE:
- if ($this->config['debug']) {
- echo "Got BNET_TERMINATE\n";
- }
- break;
- case self::BNET_POLL:
- if ($this->config['debug']) {
- echo "Got BNET_POLL\n";
- }
- break;
- case self::BNET_HEARTBEAT:
- if ($this->config['debug']) {
- echo "Got BNET_HEARTBEAT\n";
- }
- break;
- case self::BNET_HB_RESPONSE:
- if ($this->config['debug']) {
- echo "Got BNET_HB_RESPONSE\n";
- }
- break;
- case self::BNET_xxxxxxPROMPT:
- if ($this->config['debug']) {
- echo "Got BNET_xxxxxxPROMPT\n";
- }
- break;
- case self::BNET_BTIME:
- if ($this->config['debug']) {
- echo "Got BNET_BTIME\n";
- }
- break;
- case self::BNET_BREAK:
- if ($this->config['debug']) {
- echo "Got BNET_BREAK\n";
- }
- break;
- case self::BNET_START_SELECT:
- if ($this->config['debug']) {
- echo "Got BNET_START_SELECT\n";
- }
- break;
- case self::BNET_END_SELECT:
- if ($this->config['debug']) {
- echo "Got BNET_END_SELECT\n";
- }
- break;
- case self::BNET_INVALID_CMD:
- if ($this->config['debug']) {
- echo "Got BNET_INVALID_CMD\n";
- }
- break;
- case self::BNET_CMD_FAILED:
- if ($this->config['debug']) {
- echo "Got BNET_CMD_FAILED\n";
- }
- break;
- case self::BNET_CMD_OK:
- if ($this->config['debug']) {
- echo "Got BNET_CMD_OK\n";
- }
- break;
- case self::BNET_CMD_BEGIN:
- if ($this->config['debug']) {
- echo "Got BNET_CMD_BEGIN\n";
- }
- break;
- case self::BNET_MSGS_PENDING:
- if ($this->config['debug']) {
- echo "Got BNET_MSGS_PENDING\n";
- }
- break;
- case self::BNET_MAIN_PROMPT:
- if ($this->config['debug']) {
- echo "Got BNET_MAIN_PROMPT\n";
- }
- return $msg;
- case self::BNET_SELECT_INPUT:
- if ($this->config['debug']) {
- echo "Got BNET_SELECT_INPUT\n";
- }
- break;
- case self::BNET_WARNING_MSG:
- if ($this->config['debug']) {
- echo "Got BNET_WARNINGS_MSG\n";
- }
- break;
- case self::BNET_ERROR_MSG:
- if ($this->config['debug']) {
- echo "Got BNET_ERROR_MSG\n";
- }
- break;
- case self::BNET_INFO_MSG:
- if ($this->config['debug']) {
- echo "Got BNET_INFO_MSG\n";
- }
- break;
- case self::BNET_RUN_CMD:
- if ($this->config['debug']) {
- echo "Got BNET_RUN_CMD\n";
- }
- break;
- case self::BNET_YESNO:
- if ($this->config['debug']) {
- echo "Got BNET_YESNO\n";
- }
- break;
- case self::BNET_START_RTREE:
- if ($this->config['debug']) {
- echo "Got BNET_START_RTREE\n";
- }
- break;
- case self::BNET_END_RTREE:
- if ($this->config['debug']) {
- echo "Got BNET_END_RTREE\n";
- }
- break;
- case self::BNET_SUB_PROMPT:
- if ($this->config['debug']) {
- echo "Got BNET_SUB_PROMPT\n";
- }
- return $msg;
- case self::BNET_TEXT_INPUT:
- if ($this->config['debug']) {
- echo "Got BNET_TEXT_INPUT\n";
- }
- break;
- default:
- throw new \Exception("Received unknown signal " . $len . "\n");
- break;
- }
- } else {
- throw new \Exception("Received illegal packet of size " . $len . "\n");
- }
- }
-
- return $msg;
- }
-
-
- /**
- * Connect to a Bareos Director, authenticate the session and establish TLS if needed.
- *
- * @return boolean
- */
- private function connect($username, $password)
- {
- if (!isset($this->config['host']) or !isset($this->config['port'])) {
- return false;
- }
-
- $this->config['console_name'] = $username;
- $this->config['password'] = $password;
-
- $port = $this->config['port'];
- $remote = "tcp://" . $this->config['host'] . ":" . $port;
-
- // set default stream context options
- $opts = array(
- 'socket' => array(
- 'bindto' => '0:0',
- ),
- );
-
- $context = stream_context_create($opts);
-
- /*
- * It only makes sense to setup the whole TLS context when we as client support or
- * demand a TLS connection.
- */
- if ($this->config['client_can_do_tls'] || $this->config['client_requires_tls']) {
- /*
- * We verify the peer ourself so the normal stream layer doesn't need to.
- * But that does mean we need to capture the certficate.
- */
- $result = stream_context_set_option($context, 'ssl', 'verify_peer', false);
- $result = stream_context_set_option($context, 'ssl', 'capture_peer_cert', true);
-
- /*
- * Setup a CA file
- */
- if (!empty($this->config['ca_file'])) {
- $result = stream_context_set_option($context, 'ssl', 'cafile', $this->config['ca_file']);
- if ($this->config['tls_verify_peer']) {
- $result = stream_context_set_option($context, 'ssl', 'verify_peer', true);
- }
- } else {
- $result = stream_context_set_option($context, 'ssl', 'allow_self_signed', true);
- }
-
- /*
- * Cert file which needs to contain the client certificate and the key in PEM encoding.
- */
- if (!empty($this->config['cert_file'])) {
- $result = stream_context_set_option($context, 'ssl', 'local_cert', $this->config['cert_file']);
-
- /*
- * Passphrase needed to unlock the above cert file.
- */
- if (!empty($this->config['cert_file_passphrase'])) {
- $result = stream_context_set_option($context, 'ssl', 'passphrase', $this->config['cert_file_passphrase']);
- }
- }
- }
-
- try {
- //$this->socket = stream_socket_client($remote, $error, $errstr, 60, STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT, $context);
- $this->socket = stream_socket_client($remote, $error, $errstr, 60, STREAM_CLIENT_CONNECT, $context);
- if (!$this->socket) {
- throw new \Exception("Error: " . $errstr . ", director seems to be down or blocking our request.");
- }
- }
- catch(\Exception $e) {
- echo $e->getMessage();
- exit;
- }
-
- if($this->config['debug']) {
- echo "Connected to " . $this->config['host'] . " on port " . $this->config['port'] . "\n";
- }
-
- if (!self::login()) {
- return false;
- }
-
- if (($this->config['server_can_do_tls'] || $this->config['server_requires_tls']) &&
- ($this->config['client_can_do_tls'] || $this->config['client_requires_tls'])) {
- $result = stream_socket_enable_crypto($this->socket, true, STREAM_CRYPTO_METHOD_TLS_CLIENT);
- if (!$result) {
- throw new \Exception("Error in TLS handshake\n");
- }
- }
-
- if ($this->config['tls_verify_peer']) {
- if (!empty($this->config['allowed_cns'])) {
- if (!self::tls_postconnect_verify_cn()) {
- throw new \Exception("Error in TLS postconnect verify CN\n");
- }
- } else {
- if (!self::tls_postconnect_verify_host()) {
- throw new \Exception("Error in TLS postconnect verify host\n");
- }
- }
- }
-
- /*
- * Get the 1000 OK: xx-dir Version: ...
- */
- $recv = self::receive();
-
- if($this->config['debug']) {
- echo($recv);
- }
-
- return true;
- }
-
- /**
- * Disconnect a connected console session
- *
- * @return boolean
- */
- public function disconnect()
- {
- if ($this->socket != null) {
- fclose($this->socket);
- if ($this->config['debug']) {
- echo "Connection to " . $this->config['host'] . " on port " . $this->config['port'] . " closed\n";
- }
- return true;
- }
-
- return false;
- }
-
- /**
- * Login into a Bareos Director e.g. authenticate the console session
- *
- * @return boolean
- */
- private function login()
- {
- if(isset($this->config['console_name'])) {
- $bashed_console_name = self::bash_spaces($this->config['console_name']);
- $DIR_HELLO = "Hello " . $bashed_console_name . " calling\n";
- } else {
- $DIR_HELLO = "Hello *UserAgent* calling\n";
- }
-
- self::send($DIR_HELLO);
- $recv = self::receive();
-
- self::cram_md5_response($recv, $this->config['password']);
- $recv = self::receive();
-
- if(strncasecmp($recv, self::DIR_AUTH_FAILED, strlen(self::DIR_AUTH_FAILED)) == 0) {
- return false;
- //throw new \Exception("Failed to authenticate with Director\n");
- } elseif(strncasecmp($recv, self::DIR_OK_AUTH, strlen(self::DIR_OK_AUTH)) == 0) {
- return self::cram_md5_challenge($this->config['password']);
- } else {
- return false;
- //throw new \Exception("Unknown response to authentication by Director $recv\n");
- }
-
- }
-
- /**
- * Verify the CN of the certificate against a list of allowed CN names.
- *
- * @return boolean
- */
- private function tls_postconnect_verify_cn()
- {
- $options = stream_context_get_options($this->socket);
-
- if (isset($options['ssl']) && isset($options['ssl']['peer_certificate'])) {
- $cert_data = openssl_x509_parse($options["ssl"]["peer_certificate"]);
-
- if ($this->config['debug']) {
- print_r($cert_data);
- }
-
- if (isset($cert_data['subject']['CN'])) {
- $common_names = $cert_data['subject']['CN'];
- if ($this->config['debug']) {
- echo("CommonNames: " . $common_names . "\n");
- }
- }
-
- if (isset($common_names)) {
- $checks = explode(',', $common_names);
-
- foreach($checks as $check) {
- $allowed_cns = explode(',', $this->config['allowed_cns']);
- foreach($allowed_cns as $allowed_cn) {
- if (strcasecmp($check, $allowed_cn) == 0) {
- return true;
- }
- }
- }
- }
- }
-
- return false;
- }
-
- /**
- * Verify TLS names
- *
- * @param $names
- * @return boolean
- */
- private function verify_tls_name($names)
- {
- $hostname = $this->config['host'];
- $checks = explode(',', $names);
-
- $tmp = explode('.', $hostname);
- $rev_hostname = array_reverse($tmp);
- $ok = false;
-
- foreach($checks as $check) {
- $tmp = explode(':', $check);
-
- /*
- * Candidates must start with DNS:
- */
- if ($tmp[0] != 'DNS') {
- continue;
- }
-
- /*
- * and have something afterwards
- */
- if (!isset($tmp[1])) {
- continue;
- }
-
- $tmp = explode('.', $tmp[1]);
-
- /*
- * "*.com" is not a valid match
- */
- if (count($tmp) < 3) {
- continue;
- }
-
- $cand = array_reverse($tmp);
- $ok = true;
-
- foreach($cand as $i => $item) {
- if (!isset($rev_hostname[$i])) {
- $ok = false;
- break;
- }
-
- if ($rev_hostname[$i] == $item) {
- continue;
- }
-
- if ($item == '*') {
- break;
- }
- }
-
- if ($ok) {
- break;
- }
- }
-
- return $ok;
- }
-
- /**
- * Verify the subjectAltName or CN of the certificate against the hostname we are connecting to.
- *
- * @return boolean
- */
- private function tls_postconnect_verify_host()
- {
- $options = stream_context_get_options($this->socket);
-
- if (isset($options['ssl']) && isset($options['ssl']['peer_certificate'])) {
- $cert_data = openssl_x509_parse($options["ssl"]["peer_certificate"]);
-
- if ($this->config['debug']) {
- print_r($cert_data);
- }
-
- /*
- * Check subjectAltName extensions first.
- */
- if (isset($cert_data['extensions'])) {
- if (isset($cert_data['extensions']['subjectAltName'])) {
- $alt_names = $cert_data['extensions']['subjectAltName'];
- if ($this->config['debug']) {
- echo("AltNames: " . $alt_names . "\n");
- }
-
- if (self::verify_tls_name($alt_names)) {
- return true;
- }
- }
- }
-
- /*
- * Try verifying against the subject name.
- */
- if (isset($cert_data['subject']['CN'])) {
- $common_names = "DNS:" . $cert_data['subject']['CN'];
- if ($this->config['debug']) {
- echo("CommonNames: " . $common_names . "\n");
- }
-
- if (self::verify_tls_name($common_names)) {
- return true;
- }
- }
- }
-
- return false;
- }
-
- /**
- * Perform a CRAM MD5 response
- *
- * @param $recv
- * @param $password
- * @return boolean
- */
- private function cram_md5_response($recv, $password)
- {
- list($chal, $ssl) = sscanf($recv, "auth cram-md5 %s ssl=%d");
-
- switch($ssl) {
- case self::BNET_TLS_OK:
- $this->config['server_can_do_tls'] = true;
- break;
- case self::BNET_TLS_REQUIRED:
- $this->config['server_requires_tls'] = true;
- break;
- default:
- $this->config['server_can_do_tls'] = false;
- $this->config['server_requires_tls'] = false;
- break;
- }
-
- $m = hash_hmac('md5', $chal, md5($password), true);
- $msg = rtrim(base64_encode($m), "=");
-
- self::send($msg);
-
- return true;
- }
-
- /**
- * Perform a CRAM MD5 challenge
- *
- * @param $password
- * @return boolean
- */
- private function cram_md5_challenge($password)
- {
- $rand = rand(1000000000, 9999999999);
- $time = time();
- $clientname = "php-bsock";
- $client = "<" . $rand . "." . $time . "@" . $clientname . ">";
-
- if($this->config['client_requires_tls']) {
- $DIR_AUTH = sprintf("auth cram-md5 %s ssl=%d\n", $client, self::BNET_TLS_REQUIRED);
- } elseif($this->config['client_can_do_tls']) {
- $DIR_AUTH = sprintf("auth cram-md5 %s ssl=%d\n", $client, self::BNET_TLS_OK);
- } else {
- $DIR_AUTH = sprintf("auth cram-md5 %s ssl=%d\n", $client, self::BNET_TLS_NONE);
- }
-
- if(self::send($DIR_AUTH) == true) {
- $recv = self::receive();
- $m = hash_hmac('md5', $client, md5($password), true);
-
- $b64 = new BareosBase64();
- $msg = rtrim( $b64->encode($m, false), "=" );
-
- if (self::send(self::DIR_OK_AUTH) == true && strcmp(trim($recv), trim($msg)) == 0) {
- return true;
- } else {
- return false;
- }
- } else {
- return false;
- }
-
- }
-
- /**
- * Send a single command
- *
- * @param $cmd
- * @param $api
- * @return string
- */
- public function send_command($cmd, $api=0, $jobid=null)
- {
- $result = "";
- $debug = "";
-
- switch($api) {
- case 2:
- // Enable api 2 with compact mode enabled
- self::send(".api 2 compact=yes");
- try {
- $debug = self::receive_message();
- if(!preg_match('/result/', $debug)) {
- throw new \Exception("Error: API 2 not available on director.
- Please upgrade to version 15.2.1 or greater and/or compile with jansson support.");
- }
- }
- catch(\Exception $e) {
- echo $e->getMessage();
- exit;
- }
- break;
- case 1:
- self::send(".api 1");
- $debug = self::receive_message();
- break;
- default:
- self::send(".api 0");
- $debug = self::receive_message();
- break;
- }
-
- if(self::send("use")) {
- $debug = self::receive_message();
- }
-
- if($jobid != null) {
- if(self::send(".bvfs_update jobid=$jobid")) {
- $debug = self::receive_message();
- }
- }
-
- if(self::send($cmd)) {
- $result = self::receive_message();
- }
-
- return $result;
- }
-
- /**
- *
- *
- * @param $type
- * @param $jobid
- * @param $client
- * @param $restoreclient
- * @param $restorejob
- * @param $where
- * @param $fileid
- * @param $dirid
- * @param $jobids
- *
- * @return string
- */
- public function restore($type=null, $jobid=null, $client=null, $restoreclient=null, $restorejob=null, $where=null, $fileid=null, $dirid=null, $jobids=null, $replace=null)
- {
- $result = "";
- $debug = "";
- $rnd = rand(1000,1000000);
-
- if(self::send(".api 0")) {
- $debug = self::receive_message();
- }
-
- if(self::send(".bvfs_update jobid=$jobids")) {
- $debug = self::receive_message();
- }
-
- if(self::send(".bvfs_restore jobid=$jobids fileid=$fileid dirid=$dirid path=b2000$rnd")) {
- $debug = self::receive_message();
- }
-
- if(self::send("restore file=?b2000$rnd client=$client restoreclient=$restoreclient restorejob=$restorejob where=$where replace=$replace yes")) {
- $result = self::receive_message();
- }
-
- if(self::send(".bvfs_cleanup path=b2000$rnd")) {
- $debug = self::receive_message();
- }
-
- return $result;
- }
-
- /**
- * Destructor
- */
- public function __destruct()
- {
- self::disconnect();
- }
+ const BNET_TLS_NONE = 0; /* cannot do TLS */
+ const BNET_TLS_OK = 1; /* can do, but not required on my end */
+ const BNET_TLS_REQUIRED = 2; /* TLS is required */
+
+ const BNET_EOD = -1; /* End of data stream, new data may follow */
+ const BNET_EOD_POLL = -2; /* End of data and poll all in one */
+ const BNET_STATUS = -3; /* Send full status */
+ const BNET_TERMINATE = -4; /* Conversation terminated, doing close() */
+ const BNET_POLL = -5; /* Poll request, I'm hanging on a read */
+ const BNET_HEARTBEAT = -6; /* Heartbeat Response requested */
+ const BNET_HB_RESPONSE = -7; /* Only response permited to HB */
+ const BNET_xxxxxxPROMPT = -8; /* No longer used -- Prompt for subcommand */
+ const BNET_BTIME = -9; /* Send UTC btime */
+ const BNET_BREAK = -10; /* Stop current command -- ctl-c */
+ const BNET_START_SELECT = -11; /* Start of a selection list */
+ const BNET_END_SELECT = -12; /* End of a select list */
+ const BNET_INVALID_CMD = -13; /* Invalid command sent */
+ const BNET_CMD_FAILED = -14; /* Command failed */
+ const BNET_CMD_OK = -15; /* Command succeeded */
+ const BNET_CMD_BEGIN = -16; /* Start command execution */
+ const BNET_MSGS_PENDING = -17; /* Messages pending */
+ const BNET_MAIN_PROMPT = -18; /* Server ready and waiting */
+ const BNET_SELECT_INPUT = -19; /* Return selection input */
+ const BNET_WARNING_MSG = -20; /* Warning message */
+ const BNET_ERROR_MSG = -21; /* Error message -- command failed */
+ const BNET_INFO_MSG = -22; /* Info message -- status line */
+ const BNET_RUN_CMD = -23; /* Run command follows */
+ const BNET_YESNO = -24; /* Request yes no response */
+ const BNET_START_RTREE = -25; /* Start restore tree mode */
+ const BNET_END_RTREE = -26; /* End restore tree mode */
+ const BNET_SUB_PROMPT = -27; /* Indicate we are at a subprompt */
+ const BNET_TEXT_INPUT = -28; /* Get text input from user */
+
+ const DIR_OK_AUTH = "1000 OK auth\n";
+ const DIR_AUTH_FAILED = "1999 Authorization failed.\n";
+
+ protected $config = array(
+ 'debug' => false,
+ 'host' => null,
+ 'port' => null,
+ 'password' => null,
+ 'console_name' => null,
+ 'tls_verify_peer' => null,
+ 'server_can_do_tls' => null,
+ 'server_requires_tls' => null,
+ 'client_can_do_tls' => null,
+ 'client_requires_tls' => null,
+ 'ca_file' => null,
+ 'cert_file' => null,
+ 'cert_file_passphrase' => null,
+ 'allowed_cns' => null,
+ );
+
+ private $socket = null;
+
+ /**
+ * Initialize connection
+ */
+ public function init()
+ {
+ if(self::connect($this->config['console_name'], $this->config['password'])) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Authenticate
+ */
+ public function auth($console, $password)
+ {
+ if(self::connect($console, $password)) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Set configuration
+ */
+ private function set_config_keyword($setting, $key)
+ {
+ if (array_key_exists($key, $this->config)) {
+ $this->config[$key] = $setting;
+ } else {
+ throw new \Exception("Illegal parameter $key in /config/autoload/local.php");
+ }
+ }
+
+ /**
+ * Set user credentials
+ */
+ public function set_user_credentials($username=null, $password=null)
+ {
+ $this->config['console_name'] = $username;
+ $this->config['password'] = $password;
+
+ if($this->config['debug']) {
+ // extended debug: print config array
+ var_dump($this->config);
+ }
+ }
+
+ /**
+ * Set the connection configuration
+ *
+ * @param $config
+ */
+ public function set_config($config)
+ {
+ array_walk($config, array('self', 'set_config_keyword'));
+
+ if(empty($config['host'])) {
+ throw new \Exception("Missing parameter 'host' in /config/autoload/local.php");
+ }
+
+ if(empty($config['port'])) {
+ throw new \Exception("Missing parameter 'port' in /config/autoload/local.php");
+ }
+
+ if($this->config['debug']) {
+ // extended debug: print config array
+ var_dump($this->config);
+ }
+ }
+
+ /**
+ * Network to host length
+ *
+ * @param $buffer
+ * @return int
+ */
+ private function ntohl($buffer)
+ {
+ $len = array();
+ $actual_length = 0;
+
+ $len = unpack('N', $buffer);
+ $actual_length = (float) $len[1];
+
+ if($actual_length > (float)2147483647) {
+ $actual_length -= (float)"4294967296";
+ }
+
+ return (int) $actual_length;
+ }
+
+ /**
+ * Replace spaces in a string with the special escape character ^A which is used
+ * to send strings with spaces to specific director commands.
+ *
+ * @param $str
+ * @return string
+ */
+ private function bash_spaces($str)
+ {
+ $length = strlen($str);
+ $bashed_str = "";
+
+ for($i = 0; $i < $length; $i++) {
+ if($str[$i] == ' ') {
+ $bashed_str .= '^A';
+ } else {
+ $bashed_str .= $str[$i];
+ }
+ }
+
+ return $bashed_str;
+ }
+
+ /**
+ * Send a string over the console socket.
+ * Encode the length as the first 4 bytes of the message and append the string.
+ *
+ * @param $msg
+ * @return boolean
+ */
+ private function send($msg)
+ {
+ $str_length = 0;
+ $str_length = strlen($msg);
+ $msg = pack('N', $str_length) . $msg;
+ $str_length += 4;
+
+ while($str_length > 0) {
+ $send = fwrite($this->socket, $msg, $str_length);
+ if($send === false) {
+ return false;
+ } elseif($send < $str_length) {
+ $msg = substr($msg, $send);
+ $str_length -= $send;
+ } else {
+ return true;
+ }
+ }
+ }
+
+ /**
+ * Receive a string over the console socket.
+ * First read first 4 bytes which encoded the length of the string and
+ * the read the actual string.
+ *
+ * @return string
+ */
+ private function receive($len=0)
+ {
+ $buffer = "";
+ $msg_len = 0;
+
+ if ($len === 0) {
+ $buffer = fread($this->socket, 4);
+ if($buffer == false){
+ return false;
+ }
+ $msg_len = self::ntohl($buffer);
+ } else {
+ $msg_len = $len;
+ }
+
+ if ($msg_len > 0) {
+ $buffer = fread($this->socket, $msg_len);
+ }
+
+ return $buffer;
+ }
+
+ /**
+ * Special receive function that also knows the different so called BNET signals the
+ * Bareos director can send as part of the data stream.
+ *
+ * @return string
+ */
+ private function receive_message()
+ {
+ $msg = "";
+ $buffer = "";
+
+ while (true) {
+ $buffer = fread($this->socket, 4);
+
+ if ($buffer === false) {
+ throw new \Exception("Error reading socket. " . socket_strerror(socket_last_error()) . "\n");
+ }
+
+ $len = self::ntohl($buffer);
+
+ if ($len == 0) {
+ break;
+ }
+ if ($len > 0) {
+ $rlen = 1024;
+ while (floor($len / $rlen) > 0) {
+ $msg .= fread($this->socket, $rlen);
+ $len -= $rlen;
+ }
+ $msg .= fread($this->socket, $len);
+ } elseif ($len < 0) {
+ // signal received
+ switch ($len) {
+ case self::BNET_EOD:
+ if ($this->config['debug']) {
+ echo "Got BNET_EOD\n";
+ }
+ return $msg;
+ case self::BNET_EOD_POLL:
+ if ($this->config['debug']) {
+ echo "Got BNET_EOD_POLL\n";
+ }
+ break;
+ case self::BNET_STATUS:
+ if ($this->config['debug']) {
+ echo "Got BNET_STATUS\n";
+ }
+ break;
+ case self::BNET_TERMINATE:
+ if ($this->config['debug']) {
+ echo "Got BNET_TERMINATE\n";
+ }
+ break;
+ case self::BNET_POLL:
+ if ($this->config['debug']) {
+ echo "Got BNET_POLL\n";
+ }
+ break;
+ case self::BNET_HEARTBEAT:
+ if ($this->config['debug']) {
+ echo "Got BNET_HEARTBEAT\n";
+ }
+ break;
+ case self::BNET_HB_RESPONSE:
+ if ($this->config['debug']) {
+ echo "Got BNET_HB_RESPONSE\n";
+ }
+ break;
+ case self::BNET_xxxxxxPROMPT:
+ if ($this->config['debug']) {
+ echo "Got BNET_xxxxxxPROMPT\n";
+ }
+ break;
+ case self::BNET_BTIME:
+ if ($this->config['debug']) {
+ echo "Got BNET_BTIME\n";
+ }
+ break;
+ case self::BNET_BREAK:
+ if ($this->config['debug']) {
+ echo "Got BNET_BREAK\n";
+ }
+ break;
+ case self::BNET_START_SELECT:
+ if ($this->config['debug']) {
+ echo "Got BNET_START_SELECT\n";
+ }
+ break;
+ case self::BNET_END_SELECT:
+ if ($this->config['debug']) {
+ echo "Got BNET_END_SELECT\n";
+ }
+ break;
+ case self::BNET_INVALID_CMD:
+ if ($this->config['debug']) {
+ echo "Got BNET_INVALID_CMD\n";
+ }
+ break;
+ case self::BNET_CMD_FAILED:
+ if ($this->config['debug']) {
+ echo "Got BNET_CMD_FAILED\n";
+ }
+ break;
+ case self::BNET_CMD_OK:
+ if ($this->config['debug']) {
+ echo "Got BNET_CMD_OK\n";
+ }
+ break;
+ case self::BNET_CMD_BEGIN:
+ if ($this->config['debug']) {
+ echo "Got BNET_CMD_BEGIN\n";
+ }
+ break;
+ case self::BNET_MSGS_PENDING:
+ if ($this->config['debug']) {
+ echo "Got BNET_MSGS_PENDING\n";
+ }
+ break;
+ case self::BNET_MAIN_PROMPT:
+ if ($this->config['debug']) {
+ echo "Got BNET_MAIN_PROMPT\n";
+ }
+ return $msg;
+ case self::BNET_SELECT_INPUT:
+ if ($this->config['debug']) {
+ echo "Got BNET_SELECT_INPUT\n";
+ }
+ break;
+ case self::BNET_WARNING_MSG:
+ if ($this->config['debug']) {
+ echo "Got BNET_WARNINGS_MSG\n";
+ }
+ break;
+ case self::BNET_ERROR_MSG:
+ if ($this->config['debug']) {
+ echo "Got BNET_ERROR_MSG\n";
+ }
+ break;
+ case self::BNET_INFO_MSG:
+ if ($this->config['debug']) {
+ echo "Got BNET_INFO_MSG\n";
+ }
+ break;
+ case self::BNET_RUN_CMD:
+ if ($this->config['debug']) {
+ echo "Got BNET_RUN_CMD\n";
+ }
+ break;
+ case self::BNET_YESNO:
+ if ($this->config['debug']) {
+ echo "Got BNET_YESNO\n";
+ }
+ break;
+ case self::BNET_START_RTREE:
+ if ($this->config['debug']) {
+ echo "Got BNET_START_RTREE\n";
+ }
+ break;
+ case self::BNET_END_RTREE:
+ if ($this->config['debug']) {
+ echo "Got BNET_END_RTREE\n";
+ }
+ break;
+ case self::BNET_SUB_PROMPT:
+ if ($this->config['debug']) {
+ echo "Got BNET_SUB_PROMPT\n";
+ }
+ return $msg;
+ case self::BNET_TEXT_INPUT:
+ if ($this->config['debug']) {
+ echo "Got BNET_TEXT_INPUT\n";
+ }
+ break;
+ default:
+ throw new \Exception("Received unknown signal " . $len . "\n");
+ break;
+ }
+ } else {
+ throw new \Exception("Received illegal packet of size " . $len . "\n");
+ }
+ }
+
+ return $msg;
+ }
+
+
+ /**
+ * Connect to a Bareos Director, authenticate the session and establish TLS if needed.
+ *
+ * @return boolean
+ */
+ private function connect($username, $password)
+ {
+ if (!isset($this->config['host']) or !isset($this->config['port'])) {
+ return false;
+ }
+
+ $this->config['console_name'] = $username;
+ $this->config['password'] = $password;
+
+ $port = $this->config['port'];
+ $remote = "tcp://" . $this->config['host'] . ":" . $port;
+
+ // set default stream context options
+ $opts = array(
+ 'socket' => array(
+ 'bindto' => '0:0',
+ ),
+ );
+
+ $context = stream_context_create($opts);
+
+ /*
+ * It only makes sense to setup the whole TLS context when we as client support or
+ * demand a TLS connection.
+ */
+ if ($this->config['client_can_do_tls'] || $this->config['client_requires_tls']) {
+ /*
+ * We verify the peer ourself so the normal stream layer doesn't need to.
+ * But that does mean we need to capture the certficate.
+ */
+ $result = stream_context_set_option($context, 'ssl', 'verify_peer', false);
+ $result = stream_context_set_option($context, 'ssl', 'capture_peer_cert', true);
+
+ /*
+ * Setup a CA file
+ */
+ if (!empty($this->config['ca_file'])) {
+ $result = stream_context_set_option($context, 'ssl', 'cafile', $this->config['ca_file']);
+ if ($this->config['tls_verify_peer']) {
+ $result = stream_context_set_option($context, 'ssl', 'verify_peer', true);
+ }
+ } else {
+ $result = stream_context_set_option($context, 'ssl', 'allow_self_signed', true);
+ }
+
+ /*
+ * Cert file which needs to contain the client certificate and the key in PEM encoding.
+ */
+ if (!empty($this->config['cert_file'])) {
+ $result = stream_context_set_option($context, 'ssl', 'local_cert', $this->config['cert_file']);
+
+ /*
+ * Passphrase needed to unlock the above cert file.
+ */
+ if (!empty($this->config['cert_file_passphrase'])) {
+ $result = stream_context_set_option($context, 'ssl', 'passphrase', $this->config['cert_file_passphrase']);
+ }
+ }
+ }
+
+ try {
+ //$this->socket = stream_socket_client($remote, $error, $errstr, 60, STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT, $context);
+ $this->socket = stream_socket_client($remote, $error, $errstr, 60, STREAM_CLIENT_CONNECT, $context);
+ if (!$this->socket) {
+ throw new \Exception("Error: " . $errstr . ", director seems to be down or blocking our request.");
+ }
+ }
+ catch(\Exception $e) {
+ echo $e->getMessage();
+ exit;
+ }
+
+ if($this->config['debug']) {
+ echo "Connected to " . $this->config['host'] . " on port " . $this->config['port'] . "\n";
+ }
+
+ if (!self::login()) {
+ return false;
+ }
+
+ if (($this->config['server_can_do_tls'] || $this->config['server_requires_tls']) &&
+ ($this->config['client_can_do_tls'] || $this->config['client_requires_tls'])) {
+ $result = stream_socket_enable_crypto($this->socket, true, STREAM_CRYPTO_METHOD_TLS_CLIENT);
+ if (!$result) {
+ throw new \Exception("Error in TLS handshake\n");
+ }
+ }
+
+ if ($this->config['tls_verify_peer']) {
+ if (!empty($this->config['allowed_cns'])) {
+ if (!self::tls_postconnect_verify_cn()) {
+ throw new \Exception("Error in TLS postconnect verify CN\n");
+ }
+ } else {
+ if (!self::tls_postconnect_verify_host()) {
+ throw new \Exception("Error in TLS postconnect verify host\n");
+ }
+ }
+ }
+
+ /*
+ * Get the 1000 OK: xx-dir Version: ...
+ */
+ $recv = self::receive();
+
+ if($this->config['debug']) {
+ echo($recv);
+ }
+
+ return true;
+ }
+
+ /**
+ * Disconnect a connected console session
+ *
+ * @return boolean
+ */
+ public function disconnect()
+ {
+ if ($this->socket != null) {
+ fclose($this->socket);
+ if ($this->config['debug']) {
+ echo "Connection to " . $this->config['host'] . " on port " . $this->config['port'] . " closed\n";
+ }
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Login into a Bareos Director e.g. authenticate the console session
+ *
+ * @return boolean
+ */
+ private function login()
+ {
+ if(isset($this->config['console_name'])) {
+ $bashed_console_name = self::bash_spaces($this->config['console_name']);
+ $DIR_HELLO = "Hello " . $bashed_console_name . " calling\n";
+ } else {
+ $DIR_HELLO = "Hello *UserAgent* calling\n";
+ }
+
+ self::send($DIR_HELLO);
+ $recv = self::receive();
+
+ self::cram_md5_response($recv, $this->config['password']);
+ $recv = self::receive();
+
+ if(strncasecmp($recv, self::DIR_AUTH_FAILED, strlen(self::DIR_AUTH_FAILED)) == 0) {
+ return false;
+ //throw new \Exception("Failed to authenticate with Director\n");
+ } elseif(strncasecmp($recv, self::DIR_OK_AUTH, strlen(self::DIR_OK_AUTH)) == 0) {
+ return self::cram_md5_challenge($this->config['password']);
+ } else {
+ return false;
+ //throw new \Exception("Unknown response to authentication by Director $recv\n");
+ }
+
+ }
+
+ /**
+ * Verify the CN of the certificate against a list of allowed CN names.
+ *
+ * @return boolean
+ */
+ private function tls_postconnect_verify_cn()
+ {
+ $options = stream_context_get_options($this->socket);
+
+ if (isset($options['ssl']) && isset($options['ssl']['peer_certificate'])) {
+ $cert_data = openssl_x509_parse($options["ssl"]["peer_certificate"]);
+
+ if ($this->config['debug']) {
+ print_r($cert_data);
+ }
+
+ if (isset($cert_data['subject']['CN'])) {
+ $common_names = $cert_data['subject']['CN'];
+ if ($this->config['debug']) {
+ echo("CommonNames: " . $common_names . "\n");
+ }
+ }
+
+ if (isset($common_names)) {
+ $checks = explode(',', $common_names);
+
+ foreach($checks as $check) {
+ $allowed_cns = explode(',', $this->config['allowed_cns']);
+ foreach($allowed_cns as $allowed_cn) {
+ if (strcasecmp($check, $allowed_cn) == 0) {
+ return true;
+ }
+ }
+ }
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Verify TLS names
+ *
+ * @param $names
+ * @return boolean
+ */
+ private function verify_tls_name($names)
+ {
+ $hostname = $this->config['host'];
+ $checks = explode(',', $names);
+
+ $tmp = explode('.', $hostname);
+ $rev_hostname = array_reverse($tmp);
+ $ok = false;
+
+ foreach($checks as $check) {
+ $tmp = explode(':', $check);
+
+ /*
+ * Candidates must start with DNS:
+ */
+ if ($tmp[0] != 'DNS') {
+ continue;
+ }
+
+ /*
+ * and have something afterwards
+ */
+ if (!isset($tmp[1])) {
+ continue;
+ }
+
+ $tmp = explode('.', $tmp[1]);
+
+ /*
+ * "*.com" is not a valid match
+ */
+ if (count($tmp) < 3) {
+ continue;
+ }
+
+ $cand = array_reverse($tmp);
+ $ok = true;
+
+ foreach($cand as $i => $item) {
+ if (!isset($rev_hostname[$i])) {
+ $ok = false;
+ break;
+ }
+
+ if ($rev_hostname[$i] == $item) {
+ continue;
+ }
+
+ if ($item == '*') {
+ break;
+ }
+ }
+
+ if ($ok) {
+ break;
+ }
+ }
+
+ return $ok;
+ }
+
+ /**
+ * Verify the subjectAltName or CN of the certificate against the hostname we are connecting to.
+ *
+ * @return boolean
+ */
+ private function tls_postconnect_verify_host()
+ {
+ $options = stream_context_get_options($this->socket);
+
+ if (isset($options['ssl']) && isset($options['ssl']['peer_certificate'])) {
+ $cert_data = openssl_x509_parse($options["ssl"]["peer_certificate"]);
+
+ if ($this->config['debug']) {
+ print_r($cert_data);
+ }
+
+ /*
+ * Check subjectAltName extensions first.
+ */
+ if (isset($cert_data['extensions'])) {
+ if (isset($cert_data['extensions']['subjectAltName'])) {
+ $alt_names = $cert_data['extensions']['subjectAltName'];
+ if ($this->config['debug']) {
+ echo("AltNames: " . $alt_names . "\n");
+ }
+
+ if (self::verify_tls_name($alt_names)) {
+ return true;
+ }
+ }
+ }
+
+ /*
+ * Try verifying against the subject name.
+ */
+ if (isset($cert_data['subject']['CN'])) {
+ $common_names = "DNS:" . $cert_data['subject']['CN'];
+ if ($this->config['debug']) {
+ echo("CommonNames: " . $common_names . "\n");
+ }
+
+ if (self::verify_tls_name($common_names)) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Perform a CRAM MD5 response
+ *
+ * @param $recv
+ * @param $password
+ * @return boolean
+ */
+ private function cram_md5_response($recv, $password)
+ {
+ list($chal, $ssl) = sscanf($recv, "auth cram-md5 %s ssl=%d");
+
+ switch($ssl) {
+ case self::BNET_TLS_OK:
+ $this->config['server_can_do_tls'] = true;
+ break;
+ case self::BNET_TLS_REQUIRED:
+ $this->config['server_requires_tls'] = true;
+ break;
+ default:
+ $this->config['server_can_do_tls'] = false;
+ $this->config['server_requires_tls'] = false;
+ break;
+ }
+
+ $m = hash_hmac('md5', $chal, md5($password), true);
+ $msg = rtrim(base64_encode($m), "=");
+
+ self::send($msg);
+
+ return true;
+ }
+
+ /**
+ * Perform a CRAM MD5 challenge
+ *
+ * @param $password
+ * @return boolean
+ */
+ private function cram_md5_challenge($password)
+ {
+ $rand = rand(1000000000, 9999999999);
+ $time = time();
+ $clientname = "php-bsock";
+ $client = "<" . $rand . "." . $time . "@" . $clientname . ">";
+
+ if($this->config['client_requires_tls']) {
+ $DIR_AUTH = sprintf("auth cram-md5 %s ssl=%d\n", $client, self::BNET_TLS_REQUIRED);
+ } elseif($this->config['client_can_do_tls']) {
+ $DIR_AUTH = sprintf("auth cram-md5 %s ssl=%d\n", $client, self::BNET_TLS_OK);
+ } else {
+ $DIR_AUTH = sprintf("auth cram-md5 %s ssl=%d\n", $client, self::BNET_TLS_NONE);
+ }
+
+ if(self::send($DIR_AUTH) == true) {
+ $recv = self::receive();
+ $m = hash_hmac('md5', $client, md5($password), true);
+
+ $b64 = new BareosBase64();
+ $msg = rtrim( $b64->encode($m, false), "=" );
+
+ if (self::send(self::DIR_OK_AUTH) == true && strcmp(trim($recv), trim($msg)) == 0) {
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+ return false;
+ }
+
+ }
+
+ /**
+ * Send a single command
+ *
+ * @param $cmd
+ * @param $api
+ * @return string
+ */
+ public function send_command($cmd, $api=0, $jobid=null)
+ {
+ $result = "";
+ $debug = "";
+
+ switch($api) {
+ case 2:
+ // Enable api 2 with compact mode enabled
+ self::send(".api 2 compact=yes");
+ try {
+ $debug = self::receive_message();
+ if(!preg_match('/result/', $debug)) {
+ throw new \Exception("Error: API 2 not available on director.
+ Please upgrade to version 15.2.1 or greater and/or compile with jansson support.");
+ }
+ }
+ catch(\Exception $e) {
+ echo $e->getMessage();
+ exit;
+ }
+ break;
+ case 1:
+ self::send(".api 1");
+ $debug = self::receive_message();
+ break;
+ default:
+ self::send(".api 0");
+ $debug = self::receive_message();
+ break;
+ }
+
+ if(self::send("use")) {
+ $debug = self::receive_message();
+ }
+
+ if($jobid != null) {
+ if(self::send(".bvfs_update jobid=$jobid")) {
+ $debug = self::receive_message();
+ }
+ }
+
+ if(self::send($cmd)) {
+ $result = self::receive_message();
+ }
+
+ return $result;
+ }
+
+ /**
+ *
+ *
+ * @param $type
+ * @param $jobid
+ * @param $client
+ * @param $restoreclient
+ * @param $restorejob
+ * @param $where
+ * @param $fileid
+ * @param $dirid
+ * @param $jobids
+ *
+ * @return string
+ */
+ public function restore($type=null, $jobid=null, $client=null, $restoreclient=null, $restorejob=null, $where=null, $fileid=null, $dirid=null, $jobids=null, $replace=null)
+ {
+ $result = "";
+ $debug = "";
+ $rnd = rand(1000,1000000);
+
+ if(self::send(".api 0")) {
+ $debug = self::receive_message();
+ }
+
+ if(self::send(".bvfs_update jobid=$jobids")) {
+ $debug = self::receive_message();
+ }
+
+ if(self::send(".bvfs_restore jobid=$jobids fileid=$fileid dirid=$dirid path=b2000$rnd")) {
+ $debug = self::receive_message();
+ }
+
+ if(self::send("restore file=?b2000$rnd client=$client restoreclient=$restoreclient restorejob=$restorejob where=$where replace=$replace yes")) {
+ $result = self::receive_message();
+ }
+
+ if(self::send(".bvfs_cleanup path=b2000$rnd")) {
+ $debug = self::receive_message();
+ }
+
+ return $result;
+ }
+
+ /**
+ * Destructor
+ */
+ public function __destruct()
+ {
+ self::disconnect();
+ }
}
?>
diff --git a/vendor/Bareos/library/Bareos/BSock/BareosBSockAbstractServiceFactory.php b/vendor/Bareos/library/Bareos/BSock/BareosBSockAbstractServiceFactory.php
index 94e0f55..501dfe1 100644
--- a/vendor/Bareos/library/Bareos/BSock/BareosBSockAbstractServiceFactory.php
+++ b/vendor/Bareos/library/Bareos/BSock/BareosBSockAbstractServiceFactory.php
@@ -31,59 +31,59 @@ use Zend\ServiceManager\ServiceLocatorInterface;
class BSockAbstractServiceFactory implements AbstractFactoryInterface
{
- protected $config;
-
- /**
- */
- public function canCreateServiceWithName(ServiceLocatorInterface $service, $name $requestedName)
- {
- $config = $this->getConfig($service);
-
- if (empty($config)) {
- return false;
- }
-
- return (
- isset($config[$requestedName])
- && is_array($config[$requestedName])
- && !empty($config[$requestedName])
- );
-
- }
-
- /**
- */
- public function createServiceWithName(ServiceLocatorInterface $service, $name, $requestedName)
- {
- $config = $this->getConfig($service);
- return new BSock($config[$requestedName]);
- }
-
- /**
- */
- protected function getConfig()
- {
- if ($this->config !== null) {
- return $this->config;
- }
-
- if (!$service->has('Config')) {
- $this->config = array();
- return $this->config;
- }
-
- $config = $service->get('Config');
- if (!isset($config['directors']) || !is_array($config['directors'])) {
- $this->config = array();
- return $this->config;
- }
-
- // todo
-
- $this->config = $config['directors'][$_SESSION['bareos']['director']];
-
- return $this->config;
-
- }
+ protected $config;
+
+ /**
+ */
+ public function canCreateServiceWithName(ServiceLocatorInterface $service, $name $requestedName)
+ {
+ $config = $this->getConfig($service);
+
+ if (empty($config)) {
+ return false;
+ }
+
+ return (
+ isset($config[$requestedName])
+ && is_array($config[$requestedName])
+ && !empty($config[$requestedName])
+ );
+
+ }
+
+ /**
+ */
+ public function createServiceWithName(ServiceLocatorInterface $service, $name, $requestedName)
+ {
+ $config = $this->getConfig($service);
+ return new BSock($config[$requestedName]);
+ }
+
+ /**
+ */
+ protected function getConfig()
+ {
+ if ($this->config !== null) {
+ return $this->config;
+ }
+
+ if (!$service->has('Config')) {
+ $this->config = array();
+ return $this->config;
+ }
+
+ $config = $service->get('Config');
+ if (!isset($config['directors']) || !is_array($config['directors'])) {
+ $this->config = array();
+ return $this->config;
+ }
+
+ // todo
+
+ $this->config = $config['directors'][$_SESSION['bareos']['director']];
+
+ return $this->config;
+
+ }
}
diff --git a/vendor/Bareos/library/Bareos/BSock/BareosBSockInterface.php b/vendor/Bareos/library/Bareos/BSock/BareosBSockInterface.php
index 002cf9f..0b0ed7b 100644
--- a/vendor/Bareos/library/Bareos/BSock/BareosBSockInterface.php
+++ b/vendor/Bareos/library/Bareos/BSock/BareosBSockInterface.php
@@ -27,50 +27,50 @@ namespace Bareos\BSock;
interface BareosBSockInterface
{
- /**
- * Initialize connection
- *
- * @return boolean
- */
- public function init();
+ /**
+ * Initialize connection
+ *
+ * @return boolean
+ */
+ public function init();
- /**
- * Authenticate
- *
- * @param $console
- * @param $password
- * @return boolean
- */
- public function auth($console, $password);
+ /**
+ * Authenticate
+ *
+ * @param $console
+ * @param $password
+ * @return boolean
+ */
+ public function auth($console, $password);
- /**
- * Set user credentials
- *
- * @param $username
- * @param password
- */
- public function set_user_credentials($username=null, $password=null);
+ /**
+ * Set user credentials
+ *
+ * @param $username
+ * @param password
+ */
+ public function set_user_credentials($username=null, $password=null);
- /**
- * Set configuration
- *
- * @param $config
- */
- public function set_config($config);
+ /**
+ * Set configuration
+ *
+ * @param $config
+ */
+ public function set_config($config);
- /**
- * Disconnect
- *
- * @return boolean
- */
- public function disconnect();
+ /**
+ * Disconnect
+ *
+ * @return boolean
+ */
+ public function disconnect();
- /**
- * Send command
- *
- * @param $cmd
- * @return string
- */
- public function send_command($cmd);
+ /**
+ * Send command
+ *
+ * @param $cmd
+ * @return string
+ */
+ public function send_command($cmd);
}
diff --git a/vendor/Bareos/library/Bareos/BSock/BareosBSockServiceFactory.php b/vendor/Bareos/library/Bareos/BSock/BareosBSockServiceFactory.php
index d5b8221..a15cee5 100644
--- a/vendor/Bareos/library/Bareos/BSock/BareosBSockServiceFactory.php
+++ b/vendor/Bareos/library/Bareos/BSock/BareosBSockServiceFactory.php
@@ -30,21 +30,21 @@ use Zend\ServiceManager\ServiceLocatorInterface;
class BareosBSockServiceFactory implements FactoryInterface
{
- protected $bsock;
+ protected $bsock;
- /**
- */
- public function createService(ServiceLocatorInterface $serviceLocator)
- {
- $config = $serviceLocator->get('Config');
- $this->bsock = new BareosBSock($config['directors']);
+ /**
+ */
+ public function createService(ServiceLocatorInterface $serviceLocator)
+ {
+ $config = $serviceLocator->get('Config');
+ $this->bsock = new BareosBSock($config['directors']);
- if (isset($_SESSION['bareos']['director'])) {
- $this->bsock->set_config($config['directors'][$_SESSION['bareos']['director']]);
- $this->bsock->set_user_credentials($_SESSION['bareos']['username'], $_SESSION['bareos']['password']);
- $this->bsock->init();
- }
+ if (isset($_SESSION['bareos']['director'])) {
+ $this->bsock->set_config($config['directors'][$_SESSION['bareos']['director']]);
+ $this->bsock->set_user_credentials($_SESSION['bareos']['username'], $_SESSION['bareos']['password']);
+ $this->bsock->init();
+ }
- return $this->bsock;
- }
+ return $this->bsock;
+ }
}
diff --git a/vendor/Bareos/library/Bareos/BSock/BareosBase64.php b/vendor/Bareos/library/Bareos/BSock/BareosBase64.php
index a117982..6fd9b1f 100644
--- a/vendor/Bareos/library/Bareos/BSock/BareosBase64.php
+++ b/vendor/Bareos/library/Bareos/BSock/BareosBase64.php
@@ -27,81 +27,81 @@ namespace Bareos\BSock;
class BareosBase64
{
- private $base64_digits = array(
- 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
- 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
- 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
- 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
- '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/');
+ private $base64_digits = array(
+ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
+ 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
+ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
+ 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/');
- private $encoded = "";
+ private $encoded = "";
- /**
- * base64 encoding
- * @param $arg
- * @param $compatible (true=standard / false=non-standard)
- * @return string
- */
- public function encode($arg, $compatible=false)
- {
- if (strlen($arg) <= 0) {
- return false;
- } else {
- if ($compatible) {
- $this->encoded = base64_encode($arg);
- } else {
- $this->encoded = self::to_bareos_base64($arg);
- }
- }
- return $this->encoded;
- }
+ /**
+ * base64 encoding
+ * @param $arg
+ * @param $compatible (true=standard / false=non-standard)
+ * @return string
+ */
+ public function encode($arg, $compatible=false)
+ {
+ if (strlen($arg) <= 0) {
+ return false;
+ } else {
+ if ($compatible) {
+ $this->encoded = base64_encode($arg);
+ } else {
+ $this->encoded = self::to_bareos_base64($arg);
+ }
+ }
+ return $this->encoded;
+ }
- /**
- * Computes the 2's complement
- */
- private function twos_comp($val, $bits)
- {
- if ( ($val & (1 << ($bits - 1) )) != 0 )
- $val = $val - (1 << $bits);
- return $val;
- }
+ /**
+ * Computes the 2's complement
+ */
+ private function twos_comp($val, $bits)
+ {
+ if ( ($val & (1 << ($bits - 1) )) != 0 )
+ $val = $val - (1 << $bits);
+ return $val;
+ }
- /**
- * Bareos base64 encoding
- * @param $arg
- */
- private function to_bareos_base64($arg)
- {
- $reg = 0;
- $rem = 0;
- $save = 0;
- $mask = 0;
- $len = strlen($arg);
- $buffer = "";
+ /**
+ * Bareos base64 encoding
+ * @param $arg
+ */
+ private function to_bareos_base64($arg)
+ {
+ $reg = 0;
+ $rem = 0;
+ $save = 0;
+ $mask = 0;
+ $len = strlen($arg);
+ $buffer = "";
- for ( $i = 0; $i < $len; ) {
- if ($rem < 6) {
- $reg <<= 8;
- $t = ord( $arg[$i++] );
- if ($t > 127) {
- $t = $this->twos_comp($t, 8);
- }
- $reg |= $t;
- $rem += 8;
- }
- $save = $reg;
- $reg >>= ($rem - 6);
- $tmp = $reg & 0x3F;
- $buffer .= $this->base64_digits[$tmp];
- $reg = $save;
- $rem -= 6;
- }
+ for ( $i = 0; $i < $len; ) {
+ if ($rem < 6) {
+ $reg <<= 8;
+ $t = ord( $arg[$i++] );
+ if ($t > 127) {
+ $t = $this->twos_comp($t, 8);
+ }
+ $reg |= $t;
+ $rem += 8;
+ }
+ $save = $reg;
+ $reg >>= ($rem - 6);
+ $tmp = $reg & 0x3F;
+ $buffer .= $this->base64_digits[$tmp];
+ $reg = $save;
+ $rem -= 6;
+ }
- $mask = (1 << $rem) - 1;
- $buffer .= $this->base64_digits[$reg & $mask];
+ $mask = (1 << $rem) - 1;
+ $buffer .= $this->base64_digits[$reg & $mask];
- return $buffer;
- }
+ return $buffer;
+ }
}