-
Notifications
You must be signed in to change notification settings - Fork 11
/
index.php
162 lines (147 loc) · 7 KB
/
index.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<?php
/**
* Copyright 1999-2017 Horde LLC (http://www.horde.org/)
*
* See the enclosed file LICENSE for license information (GPL). If you
* not receive such a file, see also http://www.horde.org/licenses/gpl.
*/
require_once __DIR__ . '/lib/Application.php';
Horde_Registry::appInit('kronolith', array('nodynamicinit' => true));
/* Determine View */
switch ($registry->getView()) {
case Horde_Registry::VIEW_MINIMAL:
case Horde_Registry::VIEW_SMARTMOBILE:
include KRONOLITH_BASE . '/smartmobile.php';
exit;
case Horde_Registry::VIEW_BASIC:
case Horde_Registry::VIEW_DYNAMIC:
if ($registry->getView() == Horde_Registry::VIEW_DYNAMIC &&
$prefs->getValue('dynamic_view')) {
break;
}
include KRONOLITH_BASE . '/' . $prefs->getValue('defaultview') . '.php';
exit;
}
/* Load Ajax interface. */
$today = new Horde_Date($_SERVER['REQUEST_TIME']);
$ampm = !$prefs->getValue('twentyFour');
$dayStart = $prefs->getValue('day_hour_start') / 2;
$dayEnd = $prefs->getValue('day_hour_end') / 2;
$eventAlarmMethods = $eventAlarmParams = $taskAlarmMethods = $taskAlarmParams = '';
foreach ($injector->getInstance('Horde_Alarm')->handlers() as $method => $handler) {
$eventAlarmMethods .= ' <input type="checkbox" name="event_alarms[]" id="kronolithEventAlarm' . $method . '" value="' . $method . '" /> <label for="kronolithEventAlarm' . $method . '">' . $handler->getDescription() . '</label>';
$taskAlarmMethods .= ' <input type="checkbox" name="task[alarm_methods][]" id="kronolithTaskAlarm' . $method . '" value="' . $method . '" /> <label for="kronolithTaskAlarm' . $method . '">' . $handler->getDescription() . '</label>';
$params = $handler->getParameters();
if (!count($params)) {
continue;
}
$eventAlarmParams .= ' <div id="kronolithEventAlarm' . $method . 'Params" style="display:none">';
$taskAlarmParams .= ' <div id="kronolithTaskAlarm' . $method . 'Params" style="display:none">';
foreach ($params as $name => $param) {
$eventAlarmParams .= ' <label for="kronolithEventAlarmParam' . $name
. '">' . $param['desc'] . '</label> ';
$eventNameAtt = 'name="event_alarms_' . $name . '"';
$eventAtt = 'id="kronolithEventAlarmParam' . $name . '" ' . $eventNameAtt;
$taskAlarmParams .= ' <label for="kronolithTaskAlarmParam' . $name
. '">' . $param['desc'] . '</label> ';
$taskNameAtt = 'name="task[methods][' . $method . '][' . $name . ']"';
$taskAtt = 'id="kronolithTaskAlarmParam' . $name . '" ' . $taskNameAtt;
switch ($param['type']) {
case 'text':
$eventAlarmParams .= '<input type="text" ' . $eventAtt . ' />';
$taskAlarmParams .= '<input type="text" ' . $taskAtt . ' />';
break;
case 'boolean':
$eventAlarmParams .= '<input type="checkbox" ' . $eventAtt . ' />';
$taskAlarmParams .= '<input type="checkbox" ' . $taskAtt . ' />';
break;
case 'sound':
$eventAlarmParams .= '<ul class="sound-list"><li><input type="radio" ' . $eventAtt
. ' value="" checked="checked" /> ' . _("No Sound") . '</li>';
$taskAlarmParams .= '<ul class="sound-list"><li><input type="radio" ' . $taskAtt
. ' value="" checked="checked" /> ' . _("No Sound") . '</li>';
foreach (Horde_Themes::soundList() as $key => $val) {
$sound = htmlspecialchars($key);
$value = sprintf('<li><input type="radio" id="%s%s" %s value="%s" /> <embed autostart="false" src="%s" /> %s</li>',
'%s',
$name . str_replace('.wav', '', $sound),
'%s',
$sound,
htmlspecialchars($val->uri),
$sound);
$eventAlarmParams .= sprintf($value,
'kronolithEventAlarmParam',
$eventNameAtt);
$taskAlarmParams .= sprintf($value,
'kronolithTaskAlarmParam',
$taskNameAtt);
}
$eventAlarmParams .= '</ul>';
$taskAlarmParams .= '</ul>';
break;
}
$eventAlarmParams .= '<br />';
$taskAlarmParams .= '<br />';
}
$eventAlarmParams = substr($eventAlarmParams, 0, - 6) . '</div>';
$taskAlarmParams = substr($taskAlarmParams, 0, - 6) . '</div>';
}
$impleFactory = $injector->getInstance('Horde_Core_Factory_Imple');
$impleFactory->create('Kronolith_Ajax_Imple_TagAutoCompleter', array(
'box' => 'kronolithEventACBox',
'id' => 'kronolithEventTags',
'pretty' => true
));
$impleFactory->create('Kronolith_Ajax_Imple_TagAutoCompleter', array(
'box' => 'kronolithCalendarinternalACBox',
'id' => 'kronolithCalendarinternalTags',
'pretty' => true,
'triggerContainer' => 'kronolithACCalendarTriggerContainer'
));
$impleFactory->create('Kronolith_Ajax_Imple_TagAutoCompleter', array(
'box' => 'kronolithTaskACBox',
'id' => 'kronolithTaskTags',
'pretty' => true
));
$impleFactory->create('Kronolith_Ajax_Imple_UserAutoCompleter', array(
'box' => 'kronolithUsersACBox',
'displayFilter' => 'function(u) { return KronolithCore.parseUser(u).name; }',
'id' => 'kronolithEventUsers',
'onAdd' => 'function(u) { KronolithCore.addUser(u); KronolithCore.checkOrganizerAsAttendee(); }',
'onRemove' => 'KronolithCore.removeUser.bind(KronolithCore)',
'pretty' => true,
));
$impleFactory->create('Kronolith_Ajax_Imple_ContactAutoCompleter', array(
'box' => 'kronolithAttendeesACBox',
'id' => 'kronolithEventAttendees',
'onAdd' => 'function(a) { KronolithCore.addAttendee(a); KronolithCore.checkOrganizerAsAttendee(); }',
'onRemove' => 'KronolithCore.removeAttendee.bind(KronolithCore)',
'pretty' => true,
'triggerContainer' => 'kronolithAttendeesACTriggerContainer',
'beforeUpdate' => 'function(a) { return KronolithCore.normalizeAttendee(a); }'
));
$impleFactory->create('Kronolith_Ajax_Imple_ResourceAutoCompleter', array(
'box' => 'kronolithResourceACBox',
'id' => 'kronolithEventResources',
'onAdd' => 'KronolithCore.addResource.bind(KronolithCore)',
'onRemove' => 'KronolithCore.removeResource.bind(KronolithCore)',
'pretty' => true,
'triggerContainer' => 'kronolithResourceACTriggerContainer'
));
if ($conf['maps']['driver']) {
Horde::initMap();
}
$time_jobs = $time_clients = false;
if ($registry->hasMethod('time/listJobTypes')) {
try {
$time_jobs = $registry->time->listJobTypes(array('enabled' => true));
$time_clients = $registry->time->listClients();
} catch (Horde_Exception_PushApp $e) {
}
}
$topbar = $injector->getInstance('Horde_View_Topbar');
$topbar->search = true;
$injector->getInstance('Kronolith_Ajax')->init();
require KRONOLITH_TEMPLATES . '/dynamic/index.inc';
echo $injector->getInstance('Kronolith_View_Sidebar');
$page_output->footer();