Skip to content

Commit 752f0ce

Browse files
committed
!410 - Added bundles to generate new release
1 parent a78cea7 commit 752f0ce

File tree

7 files changed

+393
-390
lines changed

7 files changed

+393
-390
lines changed

apps/Core/Components/Devtools/Modules/ModulesComponent.php

Lines changed: 95 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public function viewAction()
149149
$type = strtolower($this->getData()['type']);
150150

151151
if ($type !== 'apptypes') {
152-
if ($type !== 'core') {
152+
if ($type !== 'core' && $type !== 'bundles') {
153153
$this->view->categoryArr = ${$type . 'CategoryArr'};
154154

155155
if ($type === 'components') {
@@ -161,7 +161,6 @@ public function viewAction()
161161
} else if ($type === 'apptypes') {
162162
unset($apis[1]);//Remove core
163163
}
164-
165164
$this->view->type = $type;
166165
$this->view->module = null;
167166
$this->view->apis = $apis;
@@ -178,98 +177,100 @@ public function viewAction()
178177

179178
$module['module_details'] = $this->modules->{$type}->getById($this->getData()['id']);
180179

181-
if ($module['module_details']['module_type'] === 'components') {
182-
$moduleLocation = 'apps/' . ucfirst($module['module_details']['app_type']) . '/Components/';
183-
if ($module['module_details']['menu']) {
184-
$this->view->moduleMenu = $this->helper->encode($this->helper->decode($module['module_details']['menu'], true));
185-
$this->view->menuBaseStructure = $this->basepackages->menus->getMenusForAppType($module['module_details']['app_type']);
186-
} else {
187-
$this->view->moduleMenu = false;
188-
$this->view->menuBaseStructure = [];
180+
if ($module['module_details']['module_type'] !== 'bundles') {
181+
if ($module['module_details']['module_type'] === 'components') {
182+
$moduleLocation = 'apps/' . ucfirst($module['module_details']['app_type']) . '/Components/';
183+
if ($module['module_details']['menu']) {
184+
$this->view->moduleMenu = $this->helper->encode($this->helper->decode($module['module_details']['menu'], true));
185+
$this->view->menuBaseStructure = $this->basepackages->menus->getMenusForAppType($module['module_details']['app_type']);
186+
} else {
187+
$this->view->moduleMenu = false;
188+
$this->view->menuBaseStructure = [];
189+
}
190+
} else if ($module['module_details']['module_type'] === 'packages') {
191+
if ($module['module_details']['app_type'] === 'core' &&
192+
($module['module_details']['category'] === 'basepackages' ||
193+
$module['module_details']['category'] === 'providers')
194+
) {
195+
if ($module['module_details']['category'] === 'basepackages') {
196+
$moduleLocation = 'system/Base/Installer/Packages/Setup/Register/Modules/Packages/Basepackages/';
197+
} else if ($module['module_details']['category'] === 'providers') {
198+
$moduleLocation = 'system/Base/Installer/Packages/Setup/Register/Modules/Packages/Providers/';
199+
}
200+
} else {
201+
$moduleLocation = 'apps/' . ucfirst($module['module_details']['app_type']) . '/Packages/';
202+
}
203+
} else if ($module['module_details']['module_type'] === 'middlewares') {
204+
$moduleLocation = 'apps/' . ucfirst($module['module_details']['app_type']) . '/Middlewares/';
205+
} else if ($module['module_details']['module_type'] === 'views') {
206+
$moduleLocation = 'apps/' . ucfirst($module['module_details']['app_type']) . '/Views/';
189207
}
190-
} else if ($module['module_details']['module_type'] === 'packages') {
191-
if ($module['module_details']['app_type'] === 'core' &&
208+
209+
if ($module['module_details']['module_type'] === 'packages' &&
192210
($module['module_details']['category'] === 'basepackages' ||
193211
$module['module_details']['category'] === 'providers')
194212
) {
195-
if ($module['module_details']['category'] === 'basepackages') {
196-
$moduleLocation = 'system/Base/Installer/Packages/Setup/Register/Modules/Packages/Basepackages/';
197-
} else if ($module['module_details']['category'] === 'providers') {
198-
$moduleLocation = 'system/Base/Installer/Packages/Setup/Register/Modules/Packages/Providers/';
199-
}
213+
$jsonFile =
214+
$moduleLocation .
215+
ucfirst($module['module_details']['name']) . '/' .
216+
substr($module['module_details']['module_type'], 0, -1) . '.json';
200217
} else {
201-
$moduleLocation = 'apps/' . ucfirst($module['module_details']['app_type']) . '/Packages/';
202-
}
203-
} else if ($module['module_details']['module_type'] === 'middlewares') {
204-
$moduleLocation = 'apps/' . ucfirst($module['module_details']['app_type']) . '/Middlewares/';
205-
} else if ($module['module_details']['module_type'] === 'views') {
206-
$moduleLocation = 'apps/' . ucfirst($module['module_details']['app_type']) . '/Views/';
207-
}
208-
209-
if ($module['module_details']['module_type'] === 'packages' &&
210-
($module['module_details']['category'] === 'basepackages' ||
211-
$module['module_details']['category'] === 'providers')
212-
) {
213-
$jsonFile =
214-
$moduleLocation .
215-
ucfirst($module['module_details']['name']) . '/' .
216-
substr($module['module_details']['module_type'], 0, -1) . '.json';
217-
} else {
218-
if ($module['module_details']['module_type'] === 'components') {
219-
$routeArr = explode('/', $module['module_details']['route']);
220-
221-
foreach ($routeArr as &$path) {
222-
$path = ucfirst($path);
223-
}
218+
if ($module['module_details']['module_type'] === 'components') {
219+
$routeArr = explode('/', $module['module_details']['route']);
224220

225-
$routePath = implode('/', $routeArr) . '/Install/';
226-
} else if ($module['module_details']['module_type'] === 'middlewares') {
227-
$routePath = $module['module_details']['name'] . '/Install/';
228-
} else if ($module['module_details']['module_type'] === 'packages') {
229-
$pathArr = preg_split('/(?=[A-Z])/', $module['module_details']['name'], -1, PREG_SPLIT_NO_EMPTY);
221+
foreach ($routeArr as &$path) {
222+
$path = ucfirst($path);
223+
}
230224

231-
$routePath = implode('/', $pathArr) . '/Install/';
232-
} else if ($module['module_details']['module_type'] === 'views') {
233-
if (!$module['module_details']['view_modules_version'] ||
234-
($module['module_details']['base_view_module_id'] && $module['module_details']['base_view_module_id'] != '0')
235-
) {
236-
$baseView = $this->modules->views->getViewById($module['module_details']['base_view_module_id']);
225+
$routePath = implode('/', $routeArr) . '/Install/';
226+
} else if ($module['module_details']['module_type'] === 'middlewares') {
227+
$routePath = $module['module_details']['name'] . '/Install/';
228+
} else if ($module['module_details']['module_type'] === 'packages') {
229+
$pathArr = preg_split('/(?=[A-Z])/', $module['module_details']['name'], -1, PREG_SPLIT_NO_EMPTY);
230+
231+
$routePath = implode('/', $pathArr) . '/Install/';
232+
} else if ($module['module_details']['module_type'] === 'views') {
233+
if (!$module['module_details']['view_modules_version'] ||
234+
($module['module_details']['base_view_module_id'] && $module['module_details']['base_view_module_id'] != '0')
235+
) {
236+
$baseView = $this->modules->views->getViewById($module['module_details']['base_view_module_id']);
237+
238+
$pathArr = preg_split('/(?=[A-Z])/', ucfirst($module['module_details']['name']), -1, PREG_SPLIT_NO_EMPTY);
239+
240+
if (count($pathArr) > 1) {
241+
foreach ($pathArr as &$path) {
242+
$path = strtolower($path);
243+
}
244+
} else {
245+
$pathArr[0] = strtolower($pathArr[0]);
246+
}
237247

238-
$pathArr = preg_split('/(?=[A-Z])/', ucfirst($module['module_details']['name']), -1, PREG_SPLIT_NO_EMPTY);
248+
$module['route'] = implode('/', $pathArr);
239249

240-
if (count($pathArr) > 1) {
241-
foreach ($pathArr as &$path) {
242-
$path = strtolower($path);
243-
}
250+
$routePath = $baseView['name'] . '/html/' . $module['route'] . '/';
244251
} else {
245-
$pathArr[0] = strtolower($pathArr[0]);
252+
$routePath = $module['module_details']['name'] . '/';
246253
}
247-
248-
$module['route'] = implode('/', $pathArr);
249-
250-
$routePath = $baseView['name'] . '/html/' . $module['route'] . '/';
251-
} else {
252-
$routePath = $module['module_details']['name'] . '/';
253254
}
254-
}
255255

256-
$jsonFile =
257-
$moduleLocation .
258-
$routePath .
259-
substr($module['module_details']['module_type'], 0, -1) . '.json';
260-
}
256+
$jsonFile =
257+
$moduleLocation .
258+
$routePath .
259+
substr($module['module_details']['module_type'], 0, -1) . '.json';
260+
}
261261

262-
try {
263-
$module = array_merge($module, $this->basepackages->utils->validateJson(
264-
[
265-
'json' => $this->localContent->read($jsonFile),
266-
'returnJson' => 'array'
267-
]
268-
));
269-
270-
$module['id'] = $module['module_details']['id'];
271-
} catch (\throwable $e) {
272-
throw new \Exception($e->getMessage());
262+
try {
263+
$module = array_merge($module, $this->basepackages->utils->validateJson(
264+
[
265+
'json' => $this->localContent->read($jsonFile),
266+
'returnJson' => 'array'
267+
]
268+
));
269+
270+
$module['id'] = $module['module_details']['id'];
271+
} catch (\throwable $e) {
272+
throw new \Exception($e->getMessage());
273+
}
273274
}
274275
}
275276

@@ -278,10 +279,10 @@ public function viewAction()
278279
} else {
279280
$this->view->moduleWidgets = $module['widgets'] = $this->helper->encode([]);
280281
}
281-
if (is_array($module['settings'])) {
282+
if (isset($module['settings']) && is_array($module['settings'])) {
282283
$this->view->moduleSettings = $module['settings'] = $this->helper->encode($module['settings']);
283284
}
284-
if (is_array($module['dependencies'])) {
285+
if (isset($module['settings']) && is_array($module['dependencies'])) {
285286
$this->view->moduleDependencies = $module['dependencies'] = $this->helper->encode($module['dependencies']);
286287
}
287288
} else {
@@ -306,7 +307,16 @@ public function viewAction()
306307
}
307308
}
308309

309-
$this->view->module = $module;
310+
if ($module['module_details']['module_type'] === 'bundles') {
311+
$moduleArr = [];
312+
313+
$moduleArr = $module['module_details'];
314+
$moduleArr['module_details'] = $module['module_details'];
315+
316+
$this->view->module = $moduleArr;
317+
} else {
318+
$this->view->module = $module;
319+
}
310320
}
311321
} else if (isset($this->getData()['id']) &&
312322
isset($this->getData()['bundles'])
@@ -571,11 +581,11 @@ public function generateReleaseAction()
571581
);
572582
}
573583

574-
public function publishBundleJsonAction()
584+
public function commitBundleJsonAction()
575585
{
576586
$this->requestIsPost();
577587

578-
if ($this->modulesPackage->publishBundleJson($this->postData())) {
588+
if ($this->modulesPackage->commitBundleJson($this->postData())) {
579589
$this->addResponse(
580590
$this->modulesPackage->packagesData->responseMessage,
581591
$this->modulesPackage->packagesData->responseCode,

apps/Core/Packages/Adminltetags/Tags/Buttons/SectionWithFormButtons.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ protected function generateFormButtonsContent()
8383

8484
if (isset($this->params['formButtons']['addActionUrl']) ||
8585
isset($this->params['formButtons']['updateActionUrl']) ||
86-
isset($this->params['formButtons']['closeActionUrl'])
86+
isset($this->params['formButtons']['closeActionUrl']) ||
87+
isset($this->params['formButtons']['cancelActionUrl'])
8788
) {
8889
if (isset($this->params['formButtons']['addActionUrl'])) {
8990
$this->buttonParams['addActionUrl'] =
@@ -98,7 +99,6 @@ protected function generateFormButtonsContent()
9899
}
99100

100101
if (isset($this->params['formButtons']['updateActionUrl'])) {
101-
102102
$this->buttonParams['updateActionUrl'] =
103103
$this->links->url($this->params['formButtons']['updateActionUrl']);
104104

@@ -117,7 +117,6 @@ protected function generateFormButtonsContent()
117117
$this->buttonParams['cancelActionUrl'] =
118118
$this->links->url($this->params['formButtons']['cancelActionUrl']);
119119
}
120-
121120
if (isset($this->params['formButtons']['closeActionUrl'])) {
122121
$this->buttonParams['closeActionUrl'] =
123122
$this->links->url($this->params['formButtons']['closeActionUrl']);
@@ -239,6 +238,9 @@ protected function generateFormButtonsContent()
239238
if (count($buttonsArr) === 1 && isset($buttonsArr['closeForm'])) {
240239
$buttonsArr['closeForm']['hidden'] = false;
241240
}
241+
if (count($buttonsArr) === 1 && isset($buttonsArr['cancelForm'])) {
242+
$buttonsArr['cancelForm']['hidden'] = false;
243+
}
242244

243245
$this->content .= $this->adminLTETags->useTag('buttons',
244246
[

0 commit comments

Comments
 (0)