1<?php 2 3/** 4 * 5 * bareos-webui - Bareos Web-Frontend 6 * 7 * @link https://github.com/bareos/bareos for the canonical source repository 8 * @copyright Copyright (c) 2013-2020 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 = 'Jobs'; 27$this->headTitle($title); 28 29?> 30 31<ul class="nav nav-tabs"> 32 <li><a href="<?php echo $this->url('job', array('action'=>'index')); ?>"><?php echo $this->translate('Show'); ?></a></li> 33 <li class="active"><a href="<?php echo $this->url('job', array('action'=>'actions')); ?>"><?php echo $this->translate('Actions'); ?></a></li> 34 <li><a href="<?php echo $this->url('job', array('action'=>'run')); ?>"><?php echo $this->translate('Run'); ?></a></li> 35</ul> 36 37<br /> 38 39<?php if($this->acl_alert) : echo $this->ACLAlert($this->invalid_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 66<div class="panel panel-default"> 67 68<div class="panel-heading"> 69<h3 class="panel-title"><?php echo $this->translate("Job Actions"); ?></h3> 70</div> 71 72<div class="panel-body"> 73 74<table 75 class="table table-no-bordered table-hover" 76 id="jobactions" 77 data-filter-control="true"> 78 79 <thead class="bg-primary"> 80 <th 81 data-field="name" 82 data-filter-control="input" 83 data-filter-control-placeholder="<?php echo $this->translate("Job name"); ?>"> 84 <?php echo $this->translate("Job name"); ?> 85 </th> 86 <th 87 data-field="enabled" 88 data-filter-control="input" 89 data-filter-control-placeholder="<?php echo $this->translate("Status"); ?>"> 90 <?php echo $this->translate("Status"); ?> 91 </th> 92 <th> 93 <?php echo $this->translate("Actions"); ?> 94 </th> 95 </thead> 96 97</table> 98 99</div> 100</div> 101</div> 102</div> 103 104<?php 105 echo $this->headScript()->prependFile($this->basePath() . '/js/custom-functions.js'); 106 echo $this->headLink()->prependStylesheet($this->basePath() . '/css/bootstrap-table-filter-control.min.css'); 107 echo $this->headLink()->prependStylesheet($this->basePath() . '/css/bootstrap-table.min.css'); 108 echo $this->headScript()->prependFile($this->basePath() . '/js/bootstrap-table-formatter.js'); 109 echo $this->headScript()->prependFile($this->basePath() . '/js/bootstrap-table-filter-control.min.js'); 110 echo $this->headScript()->prependFile($this->basePath() . '/js/bootstrap-table-locale-all.min.js'); 111 echo $this->headScript()->prependFile($this->basePath() . '/js/bootstrap-table-cookie.min.js'); 112 echo $this->headScript()->prependFile($this->basePath() . '/js/bootstrap-table.min.js'); 113?> 114 115<script> 116 117 var basePath = "<?php echo $this->basePath(); ?>"; 118 var result = '<?php echo str_replace(array("\n","\r"), "", $this->result); ?>'; 119 120 function attachJobActionsTable() { 121 $('#jobactions').bootstrapTable({ 122 locale: '<?php echo str_replace('_','-', $_SESSION['bareos']['locale']); ?>', 123 cookie: <?php echo $_SESSION['bareos']['dt_statesave']; ?>, 124 cookieIdTable: 'job_jobactions', 125 url: '<?php echo $this->url('job', array('action' => 'getData'), null) . '?data=runjobs'; ?>', 126 method: 'get', 127 dataType: 'json', 128 pagination : true, 129 sidePagination: 'client', 130 pageList: [ <?php echo $_SESSION['bareos']['dt_lengthmenu']; ?> ], 131 pageSize: <?php echo $_SESSION['bareos']['dt_pagelength']; ?>, 132 search: false, 133 showPaginationSwitch: true, 134 showRefresh: true, 135 sortName: 'name', 136 sortOrder: 'asc', 137 columns: [ 138 { 139 field: 'name', 140 sortable: true, 141 formatter: function(value) { 142 return formatJobName(value, basePath); 143 } 144 }, 145 { 146 field: 'enabled', 147 sortable: true, 148 formatter: function(value) { 149 return formatEnabledDisabledStatus(value); 150 } 151 }, 152 { 153 field: 'actions', 154 formatter: function(value, row, index) { 155 return jobResourceActionButtonsFormatter(value, row, index, basePath); 156 } 157 } 158 ] 159 }); 160 } 161 162 $(document).ready(function() { 163 164 if(result.length > 0) { 165 $("#modal-001").modal(); 166 } 167 168 setDtTextDomain('<?php echo $this->basePath() . '/js/locale'; ?>'); 169 setDtLocale('<?php echo $_SESSION['bareos']['locale']; ?>'); 170 171 attachJobActionsTable(); 172 173 }); 174 175</script> 176 177<?php endif; ?> 178