-
Notifications
You must be signed in to change notification settings - Fork 4
/
boot.php
executable file
·79 lines (67 loc) · 3.81 KB
/
boot.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
/**
* @author mail[at]doerr-softwaredevelopment[dot]com Joachim Doerr
* @package redaxo5
* @license MIT
*/
require_once __DIR__ . '/vendor/autoload.php';
use forCal\Manager\forCalDatabaseManager;
if (rex::isBackend() && rex::getUser()) {
$config = $this->getConfig();
if (rex_addon::get('watson')->isAvailable()) {
function forcal_search(rex_extension_point $ep)
{
$subject = $ep->getSubject();
$subject[] = 'Watson\Workflows\forCal\forCalProvider';
return $subject;
}
rex_extension::register('WATSON_PROVIDER', 'forcal_search', rex_extension::LATE);
}
if (rex_addon::get('quick_navigation')->isAvailable()) {
rex_extension::register('QUICK_NAVI_CUSTOM', ['forCalQn','getCalHistory'], rex_extension::LATE);
}
// create custom fields
forCalDatabaseManager::executeCustomFieldHandle();
rex_view::setJsProperty('forcal_events_api_url', rex_url::backendController(['rex-api-call' => 'forcal_exchange', '_csrf_token' => \forCal\Handler\forCalApi::getToken()]));
// add js
rex_view::addJSFile($this->getAssetsUrl('vendor/palettecolorpicker/palette-color-picker.js'));
rex_view::addJSFile($this->getAssetsUrl('vendor/fullcalendar/packages/core/main.js'));
rex_view::addJSFile($this->getAssetsUrl('vendor/fullcalendar/packages/interaction/main.js'));
rex_view::addJSFile($this->getAssetsUrl('vendor/fullcalendar/packages/daygrid/main.js'));
rex_view::addJSFile($this->getAssetsUrl('vendor/fullcalendar/packages/timegrid/main.js'));
rex_view::addJSFile($this->getAssetsUrl('vendor/fullcalendar/packages/list/main.js'));
rex_view::addJSFile($this->getAssetsUrl('vendor/fullcalendar/packages/core/locales-all.js'));
rex_view::addJSFile($this->getAssetsUrl('vendor/daterangepicker/moment.min.js'));
rex_view::addJSFile($this->getAssetsUrl('vendor/daterangepicker/daterangepicker.js'));
rex_view::addJSFile($this->getAssetsUrl('vendor/clockpicker/bootstrap-clockpicker.js'));
rex_view::addJSFile($this->getAssetsUrl('forcal.js'));
// add css
rex_view::addCssFile($this->getAssetsUrl('vendor/palettecolorpicker/palette-color-picker.css'));
rex_view::addCssFile($this->getAssetsUrl('vendor/fullcalendar/packages/core/main.css'));
rex_view::addCssFile($this->getAssetsUrl('vendor/fullcalendar/packages/daygrid/main.css'));
rex_view::addCssFile($this->getAssetsUrl('vendor/fullcalendar/packages/timegrid/main.css'));
rex_view::addCssFile($this->getAssetsUrl('vendor/fullcalendar/packages/list/main.css'));
rex_view::addCssFile($this->getAssetsUrl('vendor/daterangepicker/daterangepicker.css'));
rex_view::addCssFile($this->getAssetsUrl('vendor/clockpicker/bootstrap-clockpicker.min.css'));
rex_view::addCssFile($this->getAssetsUrl('forcal.css'));
if(rex_string::versionCompare(rex::getVersion(), '5.13.0-dev', '>=')) {
rex_view::addCssFile($this->getAssetsUrl('forcal-dark.css'));
}
rex_extension::register('CLANG_ADDED', function () {
// duplicate lang columns
forCalDatabaseManager::executeAddLangFields();
});
rex_view::setJsProperty('forcal_shortcut_save', isset($config['forcal_shortcut_save']) && $config['forcal_shortcut_save'] ? $config['forcal_shortcut_save'] : false);
$page = $this->getProperty('page');
if ($page && isset($config['forcal_start_page'])) {
$entry = $page['subpages'][$config['forcal_start_page']];
unset($page['subpages'][$config['forcal_start_page']]);
$page['subpages'] = [$config['forcal_start_page'] => $entry] + $page['subpages'];
$this->setProperty('page', $page);
}
}
if (rex_plugin::get('forcal', 'documentation')->isInstalled()) {
$plugin = rex_plugin::get('forcal', 'documentation');
$manager = rex_package_manager::factory($plugin);
$success = $manager->delete();
}