|
|
@@ -42,17 +42,13 @@ class SidebarAjax extends Sidebar implements \ModulesGarden\Servers\ProxmoxCloud
|
|
|
/**
|
|
|
* overwrite this function, use add function to add ajax elements
|
|
|
*/
|
|
|
- public function prepareAjaxData()
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
+ public function prepareAjaxData() {}
|
|
|
|
|
|
/**
|
|
|
* do not overwrite this function
|
|
|
* @return type \ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\ResponseTemplates\RawDataJsonResponse
|
|
|
*/
|
|
|
- public function returnAjaxData()
|
|
|
- {
|
|
|
+ public function returnAjaxData() {
|
|
|
$this->prepareAjaxData();
|
|
|
|
|
|
$returnData = $this->parseProvidedData();
|
|
|
@@ -60,13 +56,11 @@ class SidebarAjax extends Sidebar implements \ModulesGarden\Servers\ProxmoxCloud
|
|
|
return (new ResponseTemplates\RawDataJsonResponse($returnData))->setCallBackFunction($this->callBackFunction);
|
|
|
}
|
|
|
|
|
|
- protected function parseProvidedData()
|
|
|
- {
|
|
|
+ protected function parseProvidedData() {
|
|
|
$this->loadLang();
|
|
|
|
|
|
$data = [];
|
|
|
- foreach ($this->ajaxMenuElements as $mItem)
|
|
|
- {
|
|
|
+ foreach ($this->ajaxMenuElements as $mItem) {
|
|
|
$data[] = [
|
|
|
'id' => $mItem->getId(),
|
|
|
'namespace' => $mItem->getNamespace(),
|
|
|
@@ -82,28 +76,23 @@ class SidebarAjax extends Sidebar implements \ModulesGarden\Servers\ProxmoxCloud
|
|
|
return $data;
|
|
|
}
|
|
|
|
|
|
- public function add($sidebar)
|
|
|
- {
|
|
|
+ public function add($sidebar) {
|
|
|
$this->ajaxMenuElements[$sidebar->getId()] = $sidebar;
|
|
|
|
|
|
- if (method_exists($sidebar, 'setParent'))
|
|
|
- {
|
|
|
+ if (method_exists($sidebar, 'setParent')) {
|
|
|
$sidebar->setParent($this);
|
|
|
}
|
|
|
|
|
|
return $this;
|
|
|
}
|
|
|
|
|
|
- public function parseOnClickAction($actionString)
|
|
|
- {
|
|
|
- if (stripos($actionString, '(') > 0)
|
|
|
- {
|
|
|
+ public function parseOnClickAction($actionString) {
|
|
|
+ if (stripos($actionString, '(') > 0) {
|
|
|
$actions = explode('(', $actionString);
|
|
|
$action = $actions[0];
|
|
|
$paramsString = trim(trim(trim($actions[1], ';'), ')'), "'");
|
|
|
$params = explode(',', $paramsString);
|
|
|
- foreach ($params as $key => $param)
|
|
|
- {
|
|
|
+ foreach ($params as $key => $param) {
|
|
|
$params[$key] = trim(trim(trim($param), "'"), '"');
|
|
|
}
|
|
|
|