From: Marcin Haba Date: Tue, 21 Nov 2017 20:28:20 +0000 (+0100) Subject: baculum: Stop using hidden fields to store item identifiers X-Git-Tag: Release-9.0.7~32 X-Git-Url: https://git.sur5r.net/?p=bacula%2Fbacula;a=commitdiff_plain;h=342b9cda4455c07d24132134ee0bc71b9a0bb39e baculum: Stop using hidden fields to store item identifiers --- diff --git a/gui/baculum/protected/API/endpoints.xml b/gui/baculum/protected/API/endpoints.xml index cc5c656d45..6a9146e75f 100644 --- a/gui/baculum/protected/API/endpoints.xml +++ b/gui/baculum/protected/API/endpoints.xml @@ -37,8 +37,6 @@ - - diff --git a/gui/baculum/protected/Web/JavaScript/slide-window.js b/gui/baculum/protected/Web/JavaScript/slide-window.js index ce24cf7fd0..442fcf5050 100644 --- a/gui/baculum/protected/Web/JavaScript/slide-window.js +++ b/gui/baculum/protected/Web/JavaScript/slide-window.js @@ -146,9 +146,9 @@ var SlideWindowClass = jQuery.klass({ if (actions_btn.length === 1) { actions_btn[0].addEventListener('mouseup', function(e) { var row = self.getGridRowUnderCursor(e); - var el = $(row).find('input[type=hidden]'); + var el = $(row).find('div[data-type="item_value"]'); if(el.length === 1) { - self.actionsRequest.setCallbackParameter(el[0].value); + self.actionsRequest.setCallbackParameter(el[0].getAttribute('rel')); self.actionsRequest.dispatch(); } }); @@ -276,9 +276,16 @@ var SlideWindowClass = jQuery.klass({ } var set_callback_parameter = function(element) { - var el = $(element).find('input[type=hidden]') - if(el.length === 1) { - var val = el[0].value; + var val; + if ($('#' + this.gridEl).length === 1) { + var el = $(element).find('div[data-type="item_value"]') + if (el.length === 1) { + val = el[0].getAttribute('rel'); + } + } else if ($('#' + this.repeaterEl).length === 1) { + val = element.getAttribute('rel'); + } + if (val) { this.openConfigurationById(val); } }.bind(this); @@ -295,7 +302,9 @@ var SlideWindowClass = jQuery.klass({ }); }.bind(this)); Formatters.set_formatters(); - this.revertSortingFromCookie(); + if (grid.length === 1) { + this.revertSortingFromCookie(); + } }, openConfigurationById: function(id) { @@ -447,7 +456,7 @@ var SlideWindowClass = jQuery.klass({ }, setActions: function() { var checkboxes = this.getCheckboxes(); - checkboxes.each(function(index, el) { + $(checkboxes).each(function(index, el) { $(el).on('change', function() { var is_checked = this.isAnyChecked(checkboxes); if(is_checked === true && !this.areActionsOpen()) { diff --git a/gui/baculum/protected/Web/Portlets/ClientList.tpl b/gui/baculum/protected/Web/Portlets/ClientList.tpl index 9c05a1db58..eaf1d8ac8f 100644 --- a/gui/baculum/protected/Web/Portlets/ClientList.tpl +++ b/gui/baculum/protected/Web/Portlets/ClientList.tpl @@ -3,10 +3,9 @@ - - <%=@$this->DataItem->name%> - - +
+ <%#$this->DataItem->name%> +
@@ -23,8 +22,7 @@ > -
<%=$this->getParent()->Data['name']%>
- +
<%=$this->getParent()->Data['name']%>
diff --git a/gui/baculum/protected/Web/Portlets/JobList.tpl b/gui/baculum/protected/Web/Portlets/JobList.tpl index 51c816a6b7..3108d19848 100644 --- a/gui/baculum/protected/Web/Portlets/JobList.tpl +++ b/gui/baculum/protected/Web/Portlets/JobList.tpl @@ -3,10 +3,9 @@ - - [<%=@$this->DataItem->jobid%>] <%=@$this->DataItem->name%> - - +
+ [<%#$this->DataItem->jobid%>] <%#$this->DataItem->name%> +
@@ -35,8 +34,7 @@ /> -
<%=$this->getPage()->JobWindow->formatJobName($this->getParent()->Data['name'])%>
- +
<%=$this->getPage()->JobWindow->formatJobName($this->getParent()->Data['name'])%>
diff --git a/gui/baculum/protected/Web/Portlets/JobRunList.tpl b/gui/baculum/protected/Web/Portlets/JobRunList.tpl index 823f578f84..2e158762f8 100644 --- a/gui/baculum/protected/Web/Portlets/JobRunList.tpl +++ b/gui/baculum/protected/Web/Portlets/JobRunList.tpl @@ -4,11 +4,9 @@ <%=($this->getPage()->JobRunWindow->oldDirector != $this->DataItem['director']) ? '
' . Prado::localize('Director:') . ' ' . $this->DataItem['director'] . '
': ''%> - - <%=@$this->DataItem['name']%> - - - +
+ <%#$this->DataItem['name']%> +
<%=!($this->getPage()->JobRunWindow->oldDirector = $this->DataItem['director'])%>
@@ -26,8 +24,7 @@ > -
<%=$this->getParent()->DataItem['name']%>
- +
<%=$this->getParent()->DataItem['name']%>
- - <%=@$this->DataItem->name%> - - +
+ <%#$this->DataItem->name%> +
@@ -24,8 +23,7 @@ > -
<%=$this->getParent()->Data['name']%>
- +
<%=$this->getParent()->Data['name']%>
- - <%=@$this->DataItem->name%> - - +
+ <%#$this->DataItem->name%> +
@@ -23,8 +22,7 @@ > -
<%=$this->getParent()->Data['name']%>
- +
<%=$this->getParent()->Data['name']%>
diff --git a/gui/baculum/protected/Web/Portlets/VolumeList.php b/gui/baculum/protected/Web/Portlets/VolumeList.php index b723837d3b..cd9ecf27f0 100644 --- a/gui/baculum/protected/Web/Portlets/VolumeList.php +++ b/gui/baculum/protected/Web/Portlets/VolumeList.php @@ -34,8 +34,6 @@ class VolumeList extends Portlets implements ISlideWindow { public $ID; public $buttonID; public $windowTitle; - public $pools; - public $oldPool; public $view; public function setID($id) { @@ -63,7 +61,7 @@ class VolumeList extends Portlets implements ISlideWindow { } public function prepareData($sender, $param) { - $params = $this->getUrlParams(array('volumes', 'withpools'), $this->getPage()->VolumeWindow->ID); + $params = $this->getUrlParams(array('volumes'), $this->getPage()->VolumeWindow->ID); $volumes = $this->Application->getModule('api')->get($params); $isDetailView = $_SESSION['view' . $this->getPage()->VolumeWindow->ID] == 'details'; if($isDetailView === true) { @@ -101,7 +99,7 @@ class VolumeList extends Portlets implements ISlideWindow { } public function sortDataGrid($sender, $param) { - $params = $this->getUrlParams(array('volumes', 'withpools'), $this->getPage()->VolumeWindow->ID); + $params = $this->getUrlParams(array('volumes'), $this->getPage()->VolumeWindow->ID); $data = $this->Application->getModule('api')->get($params)->output; $data = $this->Application->getModule('misc')->objectToArray($data); $this->DataGrid->DataSource = $this->sortData($data, $param->SortExpression, $sender->UniqueID); diff --git a/gui/baculum/protected/Web/Portlets/VolumeList.tpl b/gui/baculum/protected/Web/Portlets/VolumeList.tpl index 6fa0345c39..7e138d28bb 100644 --- a/gui/baculum/protected/Web/Portlets/VolumeList.tpl +++ b/gui/baculum/protected/Web/Portlets/VolumeList.tpl @@ -3,13 +3,10 @@ - <%=(isset($this->DataItem->pool->name) && $this->getPage()->VolumeWindow->oldPool != $this->DataItem->pool->name) ? '
' . Prado::localize('Pool:') . ' ' . $this->DataItem->pool->name . '
': ''%> - - <%=@$this->DataItem->volumename%> -
<%=isset($this->DataItem->volstatus) ? $this->DataItem->volstatus : ''%>
- -
- <%=!(isset($this->DataItem->pool->name) ? ($this->getPage()->VolumeWindow->oldPool = $this->DataItem->pool->name) : false)%> +
+ <%#$this->DataItem->volumename%> +
<%#$this->DataItem->volstatus%>
+
@@ -31,8 +28,7 @@ -
<%=$this->getPage()->VolumeWindow->formatVolumeField($this->getParent()->Data['volumename'])%>
- +
<%=$this->getPage()->VolumeWindow->formatVolumeField($this->getParent()->Data['volumename'])%>