1<?php 2 3/** 4 * 5 * bareos-webui - Bareos Web-Frontend 6 * 7 * @link https://github.com/bareos/bareos-webui for the canonical source repository 8 * @copyright Copyright (c) 2013-2017 Bareos GmbH & Co. KG (http://www.bareos.org/) 9 * @license GNU Affero General Public License (http://www.gnu.org/licenses/) 10 * 11 * This program is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Affero General Public License as published by 13 * the Free Software Foundation, either version 3 of the License, or 14 * (at your option) any later version. 15 * 16 * This program is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU Affero General Public License for more details. 20 * 21 * You should have received a copy of the GNU Affero General Public License 22 * along with this program. If not, see <http://www.gnu.org/licenses/>. 23 * 24 */ 25 26$title = _('Schedules'); 27$this->headTitle($title); 28 29?> 30 31<ul class="nav nav-tabs"> 32 <li class="active"><a href="<?php echo $this->url('schedule', array('action'=>'index')); ?>"><?php echo $this->translate('Show'); ?></a></li> 33 <li><a href="<?php echo $this->url('schedule', array('action'=>'overview')); ?>"><?php echo $this->translate('Overview'); ?></a></li> 34 <li><a href="<?php echo $this->url('schedule', array('action'=>'status')); ?>"><?php echo $this->translate('Scheduler status'); ?></a></li> 35</ul> 36 37<br /> 38 39<?php if($this->acl_alert) : echo $this->ACLAlert($this->required_commands); elseif(!$this->acl_alert) : ?> 40 41<!-- modal-001 start --> 42<div id="modal-001" class="modal fade modal-001" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel"> 43 <div class="modal-dialog modal-md"> 44 <div class="modal-content"> 45 <div class="modal-header"> 46 <button type="button" class="close" data-dismiss="modal" aria-label="Close"> 47 <span aria-hidden="true">×</span> 48 </button> 49 <h4 class="modal-title" id="myModalLabel">Director message</h4> 50 </div> 51 <div class="modal-body"> 52 <p><?php echo str_replace(array("\n","\r"), "<br />", $this->result); ?></p> 53 </div> 54 <div class="modal-footer"> 55 <button type="button" class="btn btn-default" data-dismiss="modal"><?php echo $this->translate("Close"); ?></button> 56 </div> 57 </div> 58 </div> 59</div> 60<!-- modal-001 end --> 61 62<div class="row"> 63 64<div class="col-md-6"> 65<div class="panel panel-default"> 66 67<div class="panel-heading"> 68<h3 class="panel-title"><?php echo $this->translate('Schedules'); ?></h3> 69</div> 70 71<div class="panel-body"> 72 73<table class="table table-no-bordered table-hover" id="schedules"> 74 75<thead class="bg-primary"> 76 <th><?php echo $this->translate("Name"); ?></th> 77 <th><?php echo $this->translate("Status"); ?></th> 78 <th><?php echo $this->translate("Actions"); ?></th> 79</thead> 80 81</table> 82 83</div> 84</div> 85</div> 86</div> 87 88<?php 89 echo $this->headScript()->prependFile($this->basePath() . '/js/custom-functions.js'); 90 echo $this->headLink()->prependStylesheet($this->basePath() . '/css/bootstrap-table.min.css'); 91 echo $this->headScript()->prependFile($this->basePath() . '/js/bootstrap-table-locale-all.min.js'); 92 echo $this->headScript()->prependFile($this->basePath() . '/js/bootstrap-table-cookie.min.js'); 93 echo $this->headScript()->prependFile($this->basePath() . '/js/bootstrap-table.min.js'); 94?> 95 96<script> 97 98 var schedules = null; 99 100 function getSchedules() { 101 102 schedules = $('#schedules').bootstrapTable({ 103 locale: '<?php echo str_replace('_','-', $_SESSION['bareos']['locale']); ?>', 104 cookie: <?php echo $_SESSION['bareos']['dt_statesave']; ?>, 105 cookieIdTable: 'schedules_index', 106 url: '<?php echo $this->url('schedule', array('action' => 'getData'), null) . '?data=all'; ?>', 107 method: 'get', 108 dataType: 'json', 109 pagination : true, 110 sidePagination: 'client', 111 pageList: [ <?php echo $_SESSION['bareos']['dt_lengthmenu']; ?> ], 112 pageSize: <?php echo $_SESSION['bareos']['dt_pagelength']; ?>, 113 search: true, 114 showPaginationSwitch: true, 115 showRefresh: true, 116 sortName: 'name', 117 sortOrder: 'asc', 118 columns: [ 119 { 120 field: 'name', 121 sortable: true, 122 formatter: function(value) { 123 return '<a href="<?php echo $this->basePath() . '/schedule/details?schedule='; ?>'+value+'">'+value+'</a>'; 124 } 125 }, 126 { 127 field: 'enabled', 128 sortable: true, 129 formatter: function(value) { 130 if(value) { 131 return '<span class="label label-success"><?php echo $this->translate("Enabled"); ?></span>'; 132 } 133 else { 134 return '<span class="label label-danger"><?php echo $this->translate("Disabled"); ?></span>'; 135 } 136 } 137 }, 138 { 139 field: 'action', 140 formatter: function(value, row, index) { 141 if(row.enabled) { 142 return '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath(); ?>/schedule/index?action=disable&schedule='+row.name+'" title="<?php echo $this->translate("Disable"); ?>" id="btn-1"><span class="glyphicon glyphicon-remove"></span></a>'; 143 } 144 else { 145 return '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath(); ?>/schedule/index?action=enable&schedule='+row.name+'" title="<?php echo $this->translate("Enable"); ?>" id="btn-1"><span class="glyphicon glyphicon-ok"></span></a>'; 146 } 147 } 148 } 149 ] 150 }); 151 } 152 153 $(document).ready(function() { 154 155 setDtTextDomain('<?php echo $this->basePath() . '/js/locale'; ?>'); 156 setDtLocale('<?php echo $_SESSION['bareos']['locale']; ?>'); 157 158 var result = '<?php echo str_replace(array("\n","\r"), "", $this->result); ?>'; 159 160 if(result.length > 0) { 161 $("#modal-001").modal(); 162 } 163 164 getSchedules(); 165 166 }); 167 168</script> 169 170<?php endif; ?> 171