@@ -27,10 +27,10 @@ discard block |
||
27 | 27 | { |
28 | 28 | parent::__construct([ |
29 | 29 | 'title' => config('epesi.ui.title', 'EPESI'), |
30 | - 'cdn' => array_merge($this->cdn, (array) config('epesi.ui.cdn')), |
|
30 | + 'cdn' => array_merge($this->cdn, (array) config('epesi.ui.cdn')), |
|
31 | 31 | //TODO: set the skin from admin / user selection |
32 | - 'skin' => config('epesi.ui.skin', $this->skin), |
|
33 | - 'template_dir' => array_merge(ModuleManager::collect('templates', $this->skin), (array) $this->template_dir) |
|
32 | + 'skin' => config('epesi.ui.skin', $this->skin), |
|
33 | + 'template_dir' => array_merge(ModuleManager::collect('templates', $this->skin), (array) $this->template_dir) |
|
34 | 34 | ]); |
35 | 35 | } |
36 | 36 | |
@@ -72,43 +72,43 @@ discard block |
||
72 | 72 | |
73 | 73 | public function renderException($exception) |
74 | 74 | { |
75 | - ob_start(); |
|
76 | - if ($exception instanceof TokenMismatchException) { |
|
77 | - $this->jsRedirectHomepage(__('Session expired! Redirecting to your home page ...')); |
|
78 | - } |
|
79 | - elseif ($exception instanceof NotFoundHttpException) { |
|
80 | - $this->jsRedirectHomepage(__('Requested page not found! Redirecting to your home page ...')); |
|
81 | - } |
|
82 | - else { |
|
83 | - $this->caughtException($exception); |
|
84 | - } |
|
75 | + ob_start(); |
|
76 | + if ($exception instanceof TokenMismatchException) { |
|
77 | + $this->jsRedirectHomepage(__('Session expired! Redirecting to your home page ...')); |
|
78 | + } |
|
79 | + elseif ($exception instanceof NotFoundHttpException) { |
|
80 | + $this->jsRedirectHomepage(__('Requested page not found! Redirecting to your home page ...')); |
|
81 | + } |
|
82 | + else { |
|
83 | + $this->caughtException($exception); |
|
84 | + } |
|
85 | 85 | |
86 | - return ob_get_clean(); |
|
86 | + return ob_get_clean(); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | public function jsRedirectHomepage($message) |
90 | 90 | { |
91 | - $homepageUrl = url(HomePage\Models\HomePage::pathOfUser()); |
|
91 | + $homepageUrl = url(HomePage\Models\HomePage::pathOfUser()); |
|
92 | 92 | |
93 | - $redirectJs = $this->jsRedirectConfirm($homepageUrl, $message)->jsRender(); |
|
93 | + $redirectJs = $this->jsRedirectConfirm($homepageUrl, $message)->jsRender(); |
|
94 | 94 | |
95 | - if ($this->isJsonRequest()) { |
|
96 | - $this->outputResponseJSON([ |
|
97 | - 'success' => true, |
|
98 | - 'message' => $message, |
|
99 | - 'atkjs' => $redirectJs |
|
100 | - ]); |
|
101 | - } |
|
102 | - else { |
|
103 | - $this->outputResponseHTML('<script>' . $redirectJs . '</script>'); |
|
104 | - } |
|
95 | + if ($this->isJsonRequest()) { |
|
96 | + $this->outputResponseJSON([ |
|
97 | + 'success' => true, |
|
98 | + 'message' => $message, |
|
99 | + 'atkjs' => $redirectJs |
|
100 | + ]); |
|
101 | + } |
|
102 | + else { |
|
103 | + $this->outputResponseHTML('<script>' . $redirectJs . '</script>'); |
|
104 | + } |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | public function jsRedirectConfirm($page, $message) |
108 | 108 | { |
109 | - $redirectJs = $this->jsRedirect($page)->jsRender(); |
|
109 | + $redirectJs = $this->jsRedirect($page)->jsRender(); |
|
110 | 110 | |
111 | - return new jsExpression("if (confirm([])) { $redirectJs }", [$message]); |
|
111 | + return new jsExpression("if (confirm([])) { $redirectJs }", [$message]); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | |
80 | 80 | $form->addField('language', ['DropDown', 'values' => $values, 'caption' => __('Select Language'), 'iconLeft' => 'globe'], ['required'=>true])->set($wizard->recall('language', 'en')); |
81 | 81 | |
82 | - $form->onSubmit(function ($form) use ($wizard) { |
|
82 | + $form->onSubmit(function($form) use ($wizard) { |
|
83 | 83 | $wizard->memorize('language', $form->model['language']); |
84 | 84 | |
85 | 85 | App::setLocale($form->model['language']); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $form->addField('support', ['CheckBox', 'caption' => __('I will not remove "Support -> About" credit page from the application menu.')], ['required'=>true]); |
112 | 112 | $form->addField('store', ['CheckBox', 'caption' => __('I will not remove or rename ":epesi Store" links from the application.', ['epesi' => config('epesi.ui.title')])], ['required'=>true]); |
113 | 113 | |
114 | - $form->onSubmit(function ($form) use ($wizard) { |
|
114 | + $form->onSubmit(function($form) use ($wizard) { |
|
115 | 115 | return $wizard->jsNext(); |
116 | 116 | }); |
117 | 117 | |
@@ -139,12 +139,12 @@ discard block |
||
139 | 139 | $form->addField('create', ['CheckBox', 'caption' => __('Create New Database')])->on('change', new jsExpression('if ($(event.target).is(":checked")) alert([])', [__('WARNING: Make sure you have CREATE access level to do this!')])); |
140 | 140 | |
141 | 141 | foreach ($wizard->recall('connection', []) as $name => $value) { |
142 | - if (! $field = $form->fields[$name]?? null) continue; |
|
142 | + if (!$field = $form->fields[$name]?? null) continue; |
|
143 | 143 | |
144 | 144 | $field->set($value); |
145 | 145 | } |
146 | 146 | |
147 | - $form->onSubmit(function ($form) use ($wizard) { |
|
147 | + $form->onSubmit(function($form) use ($wizard) { |
|
148 | 148 | $connection = $form->model->get(); |
149 | 149 | |
150 | 150 | $wizard->memorize('connection', $connection); |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | |
193 | 193 | $form->model->set($wizard->recall('user')); |
194 | 194 | |
195 | - $form->validate(function ($form) use ($wizard) { |
|
195 | + $form->validate(function($form) use ($wizard) { |
|
196 | 196 | $wizard->memorize('user', $form->model->get()); |
197 | 197 | |
198 | 198 | return $wizard->jsNext(); |
@@ -10,66 +10,66 @@ |
||
10 | 10 | |
11 | 11 | class Controller extends BaseController |
12 | 12 | { |
13 | - public function index() |
|
14 | - { |
|
15 | - return SystemCore::isInstalled()? redirect('home'): redirect('install'); |
|
16 | - } |
|
13 | + public function index() |
|
14 | + { |
|
15 | + return SystemCore::isInstalled()? redirect('home'): redirect('install'); |
|
16 | + } |
|
17 | 17 | |
18 | - public function install(UI $ui) |
|
19 | - { |
|
20 | - // make sure the installation information is fresh |
|
21 | - ModuleManager::clearCache(); |
|
18 | + public function install(UI $ui) |
|
19 | + { |
|
20 | + // make sure the installation information is fresh |
|
21 | + ModuleManager::clearCache(); |
|
22 | 22 | |
23 | - if (SystemCore::isInstalled()) return redirect('home'); |
|
23 | + if (SystemCore::isInstalled()) return redirect('home'); |
|
24 | 24 | |
25 | - $ui->title = __(':epesi > Installation', ['epesi' => config('epesi.ui.title')]); |
|
25 | + $ui->title = __(':epesi > Installation', ['epesi' => config('epesi.ui.title')]); |
|
26 | 26 | |
27 | - $ui->initLayout('Centered'); |
|
27 | + $ui->initLayout('Centered'); |
|
28 | 28 | |
29 | - $ui->layout->set('logo', url('logo')); |
|
30 | - $ui->layout->template->setHTML('copyright', config('epesi.ui.copyright')); |
|
29 | + $ui->layout->set('logo', url('logo')); |
|
30 | + $ui->layout->template->setHTML('copyright', config('epesi.ui.copyright')); |
|
31 | 31 | |
32 | - $ui->add(new \Epesi\Core\System\SystemInstallWizard()); |
|
32 | + $ui->add(new \Epesi\Core\System\SystemInstallWizard()); |
|
33 | 33 | |
34 | - return $ui->response(); |
|
35 | - } |
|
34 | + return $ui->response(); |
|
35 | + } |
|
36 | 36 | |
37 | - public function home() |
|
38 | - { |
|
39 | - return redirect(SystemCore::isInstalled()? \Epesi\Core\HomePage\Models\HomePage::pathOfUser(): 'install'); |
|
40 | - } |
|
37 | + public function home() |
|
38 | + { |
|
39 | + return redirect(SystemCore::isInstalled()? \Epesi\Core\HomePage\Models\HomePage::pathOfUser(): 'install'); |
|
40 | + } |
|
41 | 41 | |
42 | - public function logo() |
|
43 | - { |
|
44 | - $logoFile = \Epesi\Core\System\Logo\LogoSettings::getLogoFile(); |
|
42 | + public function logo() |
|
43 | + { |
|
44 | + $logoFile = \Epesi\Core\System\Logo\LogoSettings::getLogoFile(); |
|
45 | 45 | |
46 | - return response(File::get($logoFile), 200, ['Content-type' => File::mimeType($logoFile)])->setMaxAge(604800)->setPublic(); |
|
47 | - } |
|
46 | + return response(File::get($logoFile), 200, ['Content-type' => File::mimeType($logoFile)])->setMaxAge(604800)->setPublic(); |
|
47 | + } |
|
48 | 48 | |
49 | - public function view(UI $ui, $module, $method = 'body', $args = []) |
|
50 | - { |
|
51 | - $ui->initLayout(new LayoutView()); |
|
49 | + public function view(UI $ui, $module, $method = 'body', $args = []) |
|
50 | + { |
|
51 | + $ui->initLayout(new LayoutView()); |
|
52 | 52 | |
53 | - $alias = explode(':', $module); |
|
53 | + $alias = explode(':', $module); |
|
54 | 54 | |
55 | - $moduleAlias = $alias[0]; |
|
56 | - $viewAlias = $alias[1]?? null; |
|
55 | + $moduleAlias = $alias[0]; |
|
56 | + $viewAlias = $alias[1]?? null; |
|
57 | 57 | |
58 | - $view = null; |
|
59 | - if ($module = ModuleManager::getClass($moduleAlias, true)) { |
|
60 | - $viewClass = $module::view($viewAlias); |
|
58 | + $view = null; |
|
59 | + if ($module = ModuleManager::getClass($moduleAlias, true)) { |
|
60 | + $viewClass = $module::view($viewAlias); |
|
61 | 61 | |
62 | - if (class_exists($viewClass)) { |
|
63 | - $view = new $viewClass(); |
|
64 | - } |
|
65 | - } |
|
62 | + if (class_exists($viewClass)) { |
|
63 | + $view = new $viewClass(); |
|
64 | + } |
|
65 | + } |
|
66 | 66 | |
67 | - if (! $view) abort(404); |
|
67 | + if (! $view) abort(404); |
|
68 | 68 | |
69 | - $ui->add($view)->displayModuleContent($method, $args); |
|
69 | + $ui->add($view)->displayModuleContent($method, $args); |
|
70 | 70 | |
71 | - $ui->setLocation($view->location()); |
|
71 | + $ui->setLocation($view->location()); |
|
72 | 72 | |
73 | - return $ui->response(); |
|
74 | - } |
|
73 | + return $ui->response(); |
|
74 | + } |
|
75 | 75 | } |
@@ -20,7 +20,9 @@ discard block |
||
20 | 20 | // make sure the installation information is fresh |
21 | 21 | ModuleManager::clearCache(); |
22 | 22 | |
23 | - if (SystemCore::isInstalled()) return redirect('home'); |
|
23 | + if (SystemCore::isInstalled()) { |
|
24 | + return redirect('home'); |
|
25 | + } |
|
24 | 26 | |
25 | 27 | $ui->title = __(':epesi > Installation', ['epesi' => config('epesi.ui.title')]); |
26 | 28 | |
@@ -64,7 +66,9 @@ discard block |
||
64 | 66 | } |
65 | 67 | } |
66 | 68 | |
67 | - if (! $view) abort(404); |
|
69 | + if (! $view) { |
|
70 | + abort(404); |
|
71 | + } |
|
68 | 72 | |
69 | 73 | $ui->add($view)->displayModuleContent($method, $args); |
70 | 74 |