--- /dev/null
+<?php
+/*
+ * Bacula(R) - The Network Backup Solution
+ * Baculum - Bacula web interface
+ *
+ * Copyright (C) 2013-2017 Kern Sibbald
+ *
+ * The main author of Baculum is Marcin Haba.
+ * The original author of Bacula is Kern Sibbald, with contributions
+ * from many others, a complete list can be found in the file AUTHORS.
+ *
+ * You may use this file and others of this release according to the
+ * license defined in the LICENSE file, which includes the Affero General
+ * Public License, v3.0 ("AGPLv3") and some additional permissions and
+ * terms pursuant to its AGPLv3 Section 7.
+ *
+ * This notice must be preserved when any source code is
+ * conveyed and/or propagated.
+ *
+ * Bacula(R) is a registered trademark of Kern Sibbald.
+ */
+
+class FileSetsInfo extends BaculumAPIServer {
+
+ public function get() {
+ $filesets = $this->getModule('fileset')->getFileSets();
+ $allowed_filesets = $this->getModule('bconsole')->bconsoleCommand($this->director, array('.fileset'), $this->user);
+ if ($allowed_filesets->exitcode === 0) {
+ if (is_array($filesets) && count($filesets) > 0) {
+ $fs = array();
+ for ($i = 0; $i < count($filesets); $i++) {
+ if(in_array($filesets[$i]->fileset, $allowed_filesets->output)) {
+ $fs[] = $filesets[$i];
+ }
+ }
+ $this->output = $fs;
+ $this->error = FileSetError::ERROR_NO_ERRORS;
+ } else {
+ $this->output = FileSetError::MSG_ERROR_FILESET_DOES_NOT_EXISTS;
+ $this->error = FileSetError::ERROR_FILESET_DOES_NOT_EXISTS;
+ }
+ } else {
+ $this->output = $allowed_filesets->output;
+ $this->error = $allowed_filesets->exitcode;
+ }
+ }
+}
+
+?>
<url ServiceParameter="API.JobTasks" pattern="api/jobs/tasks/limit/{limit}/" parameters.limit="\d+" />
<url ServiceParameter="API.Job" pattern="api/jobs/{id}/" parameters.id="\d+" />
<url ServiceParameter="API.Jobs" pattern="api/jobs/limit/{limit}/" parameters.limit="\d+" />
- <url ServiceParameter="API.JobsRecent" pattern="api/jobs/recent/{name}/client/{client}/fileset/{fileset}/" parameters.name="[a-zA-Z0-9:.\-_ ]+" parameters.client="[a-zA-Z0-9:.\-_ ]+" parameters.fileset="[a-zA-Z0-9:.\-_ ]+" />
+ <url ServiceParameter="API.JobsRecent" pattern="api/jobs/recent/{name}/client/{client}/filesetid/{filesetid}/" parameters.name="[a-zA-Z0-9:.\-_ ]+" parameters.client="[a-zA-Z0-9:.\-_ ]+" parameters.filesetid="\d+" />
<url ServiceParameter="API.JobsRecent" pattern="api/jobs/recent/{name}/clientid/{clientid}/filesetid/{filesetid}/" parameters.name="[a-zA-Z0-9:.\-_ ]+" parameters.clientid="\d+" parameters.filesetid="\d+" />
<url ServiceParameter="API.JobEstimate" pattern="api/jobs/estimate/" />
<url ServiceParameter="API.JobRun" pattern="api/jobs/run/" />
<!-- fileset endpoints -->
<url ServiceParameter="API.FileSets" pattern="api/filesets/" />
<url ServiceParameter="API.FileSet" pattern="api/filesets/{id}/" parameters.id="\d+" />
+ <url ServiceParameter="API.FileSetsInfo" pattern="api/filesets/info/" />
<!-- Bacula config module endpoints -->
<url ServiceParameter="API.JSONToolsTest" pattern="api/config/tools/test/" />
<url ServiceParameter="API.ConfigDirTest" pattern="api/config/directory/test/" />
<com:TActiveDropDownList ID="GroupBackupFileSet" CssClass="textbox" Width="350px" CausesValidation="false" />
</div>
</div>
- <div class="line">
- <div class="text"><com:TLabel ForControl="GroupBackupStorage" Text="<%[ Storage resource: ]%>" /></div>
- <div class="field">
- <com:TActiveDropDownList ID="GroupBackupStorage" OnInit="setStorage" CssClass="textbox" Width="350px" CausesValidation="false" />
- </div>
- </div>
- <div class="line">
- <div class="text"><com:TLabel ForControl="GroupBackupPool" Text="<%[ Pool resource: ]%>" /></div>
- <div class="field">
- <com:TActiveDropDownList ID="GroupBackupPool" OnInit="setPool" CssClass="textbox" Width="350px" CausesValidation="false" />
- </div>
- </div>
</com:TActivePanel>
</com:TWizardStep>
<com:TWizardStep ID="Step3" Title="<%[ Step 3 - select files to restore ]%>" StepType="Auto">
parent::onLoad($param);
if($this->RestoreWizard->ActiveStepIndex == 0) {
$this->jobs = $this->getModule('api')->get(array('jobs'))->output;
- $this->filesets = $this->getModule('api')->get(array('filesets'))->output;
+ $this->filesets = $this->getModule('api')->get(array('filesets', 'info'))->output;
}
$this->clients = $this->getModule('api')->get(array('clients'))->output;
}
$fileset_list = array();
- foreach($this->filesets as $director => $filesets) {
- $fileset_list = array_merge($fileset_list, $filesets);
+ for ($i = 0; $i < count($this->filesets); $i++) {
+ $fileset_list[$this->filesets[$i]->filesetid] = $this->filesets[$i]->fileset . ' (' . $this->filesets[$i]->createtime . ')';
}
+ asort($fileset_list);
$this->BackupToRestore->dataSource = $jobs_list;
$this->BackupToRestore->dataBind();
$this->GroupBackupToRestore->dataSource = $jobs_group_list;
$this->GroupBackupToRestore->dataBind();
- $this->GroupBackupFileSet->dataSource = array_combine($fileset_list, $fileset_list);
+ $this->GroupBackupFileSet->dataSource = $fileset_list;
$this->GroupBackupFileSet->dataBind();
$this->setRestoreClients($sender, $param);
}
}
}
- public function setStorage($sender, $param) {
- if(!$this->IsPostBack) {
- $storagesList = array();
- $storages = $this->getModule('api')->get(array('storages'))->output;
- foreach($storages as $storage) {
- $storagesList[$storage->storageid] = $storage->name;
- }
- $this->GroupBackupStorage->dataSource = $storagesList;
- $this->GroupBackupStorage->dataBind();
- }
- }
-
- public function setPool($sender, $param) {
- if(!$this->IsPostBack) {
- $poolsList = array();
- $pools = $this->getModule('api')->get(array('pools'))->output;
- foreach($pools as $pool) {
- $poolsList[$pool->poolid] = $pool->name;
- }
- $this->GroupBackupPool->dataSource = $poolsList;
- $this->GroupBackupPool->dataBind();
- }
- }
-
public function setBackupClient($sender, $param) {
$this->ClientToRestore->SelectedValue = $param->SelectedValue;
}
$this->GroupBackupToRestore->SelectedValue,
'client',
$this->BackupClientName->SelectedValue,
- 'fileset',
+ 'filesetid',
$this->GroupBackupFileSet->SelectedValue
);
$jobs_recent = $this->getModule('api')->get($params);