1 | <?php |
---|
2 | # -- BEGIN LICENSE BLOCK ---------------------------------- |
---|
3 | # This file is part of eventdata, a plugin for Dotclear 2. |
---|
4 | # |
---|
5 | # Copyright (c) 2009 JC Denis and contributors |
---|
6 | # jcdenis@gdwd.com |
---|
7 | # |
---|
8 | # Licensed under the GPL version 2.0 license. |
---|
9 | # A copy of this license is available in LICENSE file or at |
---|
10 | # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
---|
11 | # -- END LICENSE BLOCK ------------------------------------ |
---|
12 | |
---|
13 | if (!defined('DC_CONTEXT_ADMIN')) return; |
---|
14 | |
---|
15 | # Main class |
---|
16 | $E = new eventdata($core); |
---|
17 | |
---|
18 | /** Init some values **/ |
---|
19 | |
---|
20 | # General |
---|
21 | $msg = isset($_REQUEST['done']) ? __('Configuration saved') : ''; |
---|
22 | $img_green = '<img alt="%s" src="'.DC_ADMIN_URL.'?pf=eventdata/img/green.png" />'; |
---|
23 | $img_red = '<img alt="%s" src="'.DC_ADMIN_URL.'?pf=eventdata/img/red.png" />'; |
---|
24 | $img_orange = '<img alt="%s" src="'.DC_ADMIN_URL.'?pf=eventdata/img/orange.png" />'; |
---|
25 | $img_scheduled = '<img alt="%s" src="'.DC_ADMIN_URL.'?pf=eventdata/img/scheduled.png" />'; |
---|
26 | |
---|
27 | # Menu |
---|
28 | $tab = array('about' => __('About')); |
---|
29 | if ($E->checkPerm('pst')) $tab['pst'] = __('Entries'); |
---|
30 | if ($E->checkPerm('cat')) $tab['cat'] = __('Categories'); |
---|
31 | if ($E->checkPerm('tpl')) $tab['tpl'] = __('Templates'); |
---|
32 | if ($E->checkPerm('adm')) $tab['adm'] = __('Administration'); |
---|
33 | if ($core->auth->isSuperAdmin()) $tab['uninstall'] = __('Uninstall'); |
---|
34 | |
---|
35 | # Entries |
---|
36 | $show_filters = false; |
---|
37 | $user_id = !empty($_GET['user_id']) ? $_GET['user_id'] : ''; |
---|
38 | $cat_id = !empty($_GET['cat_id']) ? $_GET['cat_id'] : ''; |
---|
39 | $status = isset($_GET['status']) ? $_GET['status'] : ''; |
---|
40 | $selected = isset($_GET['selected']) ? $_GET['selected'] : ''; |
---|
41 | $sortby = !empty($_GET['sortby']) ? $_GET['sortby'] : 'post_dt'; |
---|
42 | $order = !empty($_GET['order']) ? $_GET['order'] : 'desc'; |
---|
43 | $period = !empty($_GET['period']) ? $_GET['period'] : ''; |
---|
44 | |
---|
45 | $page = !empty($_GET['page']) ? (integer) $_GET['page'] : 1; |
---|
46 | $nb_per_page = 30; |
---|
47 | if (!empty($_GET['nb']) && (integer) $_GET['nb'] > 0) { |
---|
48 | if ($nb_per_page != $_GET['nb']) $show_filters = true; |
---|
49 | $nb_per_page = (integer) $_GET['nb']; |
---|
50 | } |
---|
51 | |
---|
52 | # Categories |
---|
53 | $cats_reordered = @unserialize($E->S->event_tpl_cats); |
---|
54 | if (!is_array($cats_reordered)) $cats_reordered = array(); |
---|
55 | $cats_unlisted = @unserialize($E->S->event_no_cats); |
---|
56 | if (!is_array($cats_unlisted)) $cats_unlisted = array(); |
---|
57 | |
---|
58 | # Templates |
---|
59 | $default_tpl = $default_thm = ''; |
---|
60 | $default_xst = false; |
---|
61 | |
---|
62 | # Uninstall |
---|
63 | $understand = isset($_POST['s']['understand']) ? $_POST['s']['understand'] : 0; |
---|
64 | $delete_table = isset($_POST['s']['delete_table']) ? $_POST['s']['delete_table'] : 0; |
---|
65 | $delete_templates = isset($_POST['s']['delete_templates']) ? $_POST['s']['delete_templates'] : 0; |
---|
66 | $delete_settings = isset($_POST['s']['delete_settings']) ? $_POST['s']['delete_settings'] : 0; |
---|
67 | |
---|
68 | |
---|
69 | /** Combo array **/ |
---|
70 | |
---|
71 | # Actions combo |
---|
72 | $combo_action = array(); |
---|
73 | if ($core->auth->check('delete,contentadmin',$GLOBALS['core']->blog->id)) { |
---|
74 | $combo_action[__('remove events')] = 'event_remove'; |
---|
75 | } |
---|
76 | if ($core->auth->check('publish,contentadmin',$core->blog->id)) { |
---|
77 | $combo_action[__('publish')] = 'publish'; |
---|
78 | $combo_action[__('unpublish')] = 'unpublish'; |
---|
79 | $combo_action[__('schedule')] = 'schedule'; |
---|
80 | $combo_action[__('mark as pending')] = 'pending'; |
---|
81 | } |
---|
82 | if ($E->checkPerm('pst')) { |
---|
83 | $combo_action[__('mark as selected')] = 'selected'; |
---|
84 | $combo_action[__('mark as unselected')] = 'unselected'; |
---|
85 | } |
---|
86 | $combo_action[__('change category')] = 'category'; |
---|
87 | if ($core->auth->check('admin',$core->blog->id)) { |
---|
88 | $combo_action[__('change author')] = 'author'; |
---|
89 | } |
---|
90 | if ($core->auth->check('delete,contentadmin',$core->blog->id)) { |
---|
91 | $combo_action[__('delete')] = 'delete'; |
---|
92 | } |
---|
93 | |
---|
94 | # Categories combo |
---|
95 | $categories_combo = array('-'=>''); |
---|
96 | try { |
---|
97 | $categories = $core->blog->getCategories(array('post_type'=>'post')); //$categories also used by tab['cat'] |
---|
98 | } catch (Exception $e) { |
---|
99 | $core->error->add($e->getMessage()); |
---|
100 | } |
---|
101 | while ($categories->fetch()) { |
---|
102 | $categories_combo[str_repeat(' ',$categories->level-1).'• '. |
---|
103 | html::escapeHTML($categories->cat_title)] = $categories->cat_id; |
---|
104 | } |
---|
105 | |
---|
106 | # Categories actions combo |
---|
107 | $categories_actions_combo = array( |
---|
108 | __('Mark as reordered') => 'reorder_cats', |
---|
109 | __('Mark as not reordered') => 'unreorder_cats', |
---|
110 | __('Mark as unlisted') => 'unlist_cats', |
---|
111 | __('Mark as listed') => 'list_cats' |
---|
112 | ); |
---|
113 | |
---|
114 | # Status combo |
---|
115 | $status_combo = array('-' => ''); |
---|
116 | foreach ($core->blog->getAllPostStatus() as $k => $v) { |
---|
117 | $status_combo[$v] = (string) $k; |
---|
118 | } |
---|
119 | |
---|
120 | # Selected combo |
---|
121 | $selected_combo = array( |
---|
122 | '-' => '', |
---|
123 | __('selected') => '1', |
---|
124 | __('not selected') => '0' |
---|
125 | ); |
---|
126 | |
---|
127 | # Sortby combo |
---|
128 | $sortby_combo = array( |
---|
129 | __('Date') => 'post_dt', |
---|
130 | __('Event start') => 'event_start', |
---|
131 | __('Event end') => 'event_end', |
---|
132 | __('Title') => 'post_title', |
---|
133 | __('Category') => 'cat_title', |
---|
134 | __('Author') => 'user_id', |
---|
135 | __('Status') => 'post_status', |
---|
136 | __('Selected') => 'post_selected' |
---|
137 | ); |
---|
138 | |
---|
139 | # Order combo |
---|
140 | $order_combo = array( |
---|
141 | __('Descending') => 'desc', |
---|
142 | __('Ascending') => 'asc' |
---|
143 | ); |
---|
144 | |
---|
145 | # Period combo |
---|
146 | $period_combo = array( |
---|
147 | '-' => '', |
---|
148 | __('Not started') => 'notstarted', |
---|
149 | __('Started') => 'started', |
---|
150 | __('Finished') => 'finished', |
---|
151 | __('Not finished') => 'notfinished', |
---|
152 | __('Ongoing') => 'ongoing', |
---|
153 | __('Outgoing') => 'outgoing' |
---|
154 | ); |
---|
155 | |
---|
156 | # Templates Combo |
---|
157 | foreach($E->getThemes() AS $k => $v) { |
---|
158 | if ($v['selected']) { |
---|
159 | $combo_templates[__('Current blog theme').' '.$v['name']] = ''; |
---|
160 | $default_thm = $k; |
---|
161 | $default_adt = $v['template_exists']; |
---|
162 | $default_xst = !empty($v['theme_file']); |
---|
163 | } elseif ($v['template_file']) { |
---|
164 | $combo_templates[__('Plugin').' '.$v['name'].' ('.$k.')'] = $k; |
---|
165 | } |
---|
166 | } |
---|
167 | |
---|
168 | |
---|
169 | /** "Static" params **/ |
---|
170 | |
---|
171 | $params = array(); |
---|
172 | $params['limit'] = array((($page-1)*$nb_per_page),$nb_per_page); |
---|
173 | $params['no_content'] = true; |
---|
174 | $params['event_type'] = 'event'; |
---|
175 | $params['post_type'] = ''; |
---|
176 | |
---|
177 | |
---|
178 | /** Filters **/ |
---|
179 | |
---|
180 | # Categories filter |
---|
181 | if ($cat_id !== '' && in_array($cat_id,$categories_combo)) { |
---|
182 | $params['cat_id'] = $cat_id; |
---|
183 | $show_filters = true; |
---|
184 | } |
---|
185 | |
---|
186 | # Status filter |
---|
187 | if ($status !== '' && in_array($status,$status_combo)) { |
---|
188 | $params['post_status'] = $status; |
---|
189 | $show_filters = true; |
---|
190 | } |
---|
191 | |
---|
192 | # Selected filter |
---|
193 | if ($selected !== '' && in_array($selected,$selected_combo)) { |
---|
194 | $params['post_selected'] = $selected; |
---|
195 | $show_filters = true; |
---|
196 | } |
---|
197 | |
---|
198 | # Sortby and order filter |
---|
199 | if ($sortby !== '' && in_array($sortby,$sortby_combo)) { |
---|
200 | if ($order !== '' && in_array($order,$order_combo)) { |
---|
201 | $params['order'] = $sortby.' '.$order; |
---|
202 | } |
---|
203 | if ($sortby != 'post_dt' || $order != 'desc') { |
---|
204 | $show_filters = true; |
---|
205 | } |
---|
206 | } |
---|
207 | |
---|
208 | # Period filter |
---|
209 | if ($period !== '' && in_array($period,$period_combo)) { |
---|
210 | $params['period'] = $period; |
---|
211 | $show_filters = true; |
---|
212 | } |
---|
213 | |
---|
214 | |
---|
215 | /** Display **/ |
---|
216 | |
---|
217 | # Default menu |
---|
218 | $request_tab = isset($_REQUEST['t']) ? $_REQUEST['t'] : ''; |
---|
219 | if (!$E->S->event_option_active && empty($request_tab)) $request_tab = 'adm'; |
---|
220 | if ($E->S->event_option_active && empty($request_tab)) $request_tab = 'pst'; |
---|
221 | if (!array_key_exists($request_tab,$tab)) $request_tab = 'about'; |
---|
222 | |
---|
223 | echo |
---|
224 | '<html>'. |
---|
225 | ' <head>'. |
---|
226 | ' <title>'.__('Events').'</title>'. |
---|
227 | dcPage::jsLoad('js/_posts_list.js'). |
---|
228 | dcPage::jsPageTabs($request_tab). |
---|
229 | ' </head>'. |
---|
230 | ' <body>'. |
---|
231 | ' <h2>'.html::escapeHTML($core->blog->name).' > '.__('Events').' > '.$tab[$request_tab].'</h2>'. |
---|
232 | (!empty($msg) ? '<p class="message">'.$msg.'</p>' : ''); |
---|
233 | |
---|
234 | /************** |
---|
235 | ** Entries |
---|
236 | **************/ |
---|
237 | |
---|
238 | if (isset($tab['pst'])) { |
---|
239 | |
---|
240 | # Event entries list |
---|
241 | try { |
---|
242 | $posts = $E->getPostsByEvent($params); |
---|
243 | $counter = $E->getPostsByEvent($params,true); |
---|
244 | $post_list = new eventdataEventList($core,$posts,$counter->f(0)); |
---|
245 | |
---|
246 | } catch (Exception $e) { |
---|
247 | $core->error->add($e->getMessage()); |
---|
248 | } |
---|
249 | |
---|
250 | echo |
---|
251 | '<div class="multi-part" id="pst" title="'.$tab['pst'].'">'. |
---|
252 | '<p>'.__('This is the list of all entries with event').'</p>'; |
---|
253 | if (!$show_filters) { |
---|
254 | echo dcPage::jsLoad('js/filter-controls.js').'<p><a id="filter-control" class="form-control" href="#">'.__('Filters').'</a></p>'; |
---|
255 | } |
---|
256 | echo ' |
---|
257 | <form action="'.$E->url.'" method="get" id="filters-form"> |
---|
258 | <fieldset><legend>'.__('Filters').'</legend> |
---|
259 | <div class="three-cols"> |
---|
260 | <div class="col"> |
---|
261 | <label>'.__('Category:').form::combo('cat_id',$categories_combo,$cat_id).'</label> |
---|
262 | <label>'.__('Status:').form::combo('status',$status_combo,$status).'</label> |
---|
263 | <label>'.__('Selected:').form::combo('selected',$selected_combo,$selected).'</label> |
---|
264 | </div> |
---|
265 | <div class="col"> |
---|
266 | <label>'.__('Order by:').form::combo('sortby',$sortby_combo,$sortby).'</label> |
---|
267 | <label>'.__('Sort:').form::combo('order',$order_combo,$order).'</label> |
---|
268 | </div> |
---|
269 | <div class="col"> |
---|
270 | <p><label>'.__('Period:').form::combo('period',$period_combo,$period).'</label></p> |
---|
271 | <p><label class="classic">'.form::field('nb',3,3,$nb_per_page).' '.__('Entries per page').'</label> |
---|
272 | <input type="submit" value="'.__('filter').'" /></p> |
---|
273 | </div> |
---|
274 | </div> |
---|
275 | <br class="clear" /> |
---|
276 | </fieldset>'. |
---|
277 | form::hidden('p','eventdata'). |
---|
278 | form::hidden('t','pst'). |
---|
279 | $core->formNonce().' |
---|
280 | </form>'; |
---|
281 | |
---|
282 | $post_list->display($page,$nb_per_page, |
---|
283 | '<form action="posts_actions.php" method="post" id="form-entries">'. |
---|
284 | '%s'. |
---|
285 | '<div class="two-cols">'. |
---|
286 | '<p class="col checkboxes-helpers"></p>'. |
---|
287 | '<p class="col right">'.__('Selected entries action:').' '. |
---|
288 | form::combo('action',$combo_action). |
---|
289 | '<input type="submit" value="'.__('ok').'" /></p>'. |
---|
290 | form::hidden(array('cat_id'),$cat_id). |
---|
291 | form::hidden(array('status'),$status). |
---|
292 | form::hidden(array('selected'),$selected). |
---|
293 | form::hidden(array('sortby'),$sortby). |
---|
294 | form::hidden(array('order'),$order). |
---|
295 | form::hidden(array('page'),$page). |
---|
296 | form::hidden(array('nb'),$nb_per_page). |
---|
297 | form::hidden(array('redir'),$E->url.'&t=pst'). |
---|
298 | $core->formNonce(). |
---|
299 | '</div>'. |
---|
300 | '</form>' |
---|
301 | ); |
---|
302 | echo '</div>'; |
---|
303 | } |
---|
304 | |
---|
305 | /************** |
---|
306 | ** Categories |
---|
307 | **************/ |
---|
308 | |
---|
309 | if (isset($tab['cat'])) { |
---|
310 | |
---|
311 | # Save redirected categories list |
---|
312 | if (!empty($_POST['save']['cat'])) { |
---|
313 | try { |
---|
314 | |
---|
315 | if ($_POST['action'] == 'reorder_cats') $cats_reordered = array_merge($cats_reordered,$_POST['entries']); |
---|
316 | if ($_POST['action'] == 'unreorder_cats') $cats_reordered = array_diff($cats_reordered,$_POST['entries']); |
---|
317 | |
---|
318 | if ($_POST['action'] == 'unlist_cats') $cats_unlisted = array_merge($cats_unlisted,$_POST['entries']); |
---|
319 | if ($_POST['action'] == 'list_cats') $cats_unlisted = array_diff($cats_unlisted,$_POST['entries']); |
---|
320 | |
---|
321 | $s = array( |
---|
322 | 'event_tpl_cats'=>serialize(array_unique($cats_reordered)), |
---|
323 | 'event_no_cats'=>serialize(array_unique($cats_unlisted)), |
---|
324 | ); |
---|
325 | |
---|
326 | $E->setSettings($s); |
---|
327 | |
---|
328 | http::redirect($E->url.'&t=cat&done=1'); |
---|
329 | } |
---|
330 | catch (Exception $e) { |
---|
331 | $core->error->add($e->getMessage()); |
---|
332 | } |
---|
333 | } |
---|
334 | |
---|
335 | echo ' |
---|
336 | <div class="multi-part" id="cat" title="'.$tab['cat'].'"> |
---|
337 | <p>'.__('This is a list of all the categories that can be rearranged by dates of events').'</p> |
---|
338 | <form action="'.$E->url.'" method="post" id="form-entries"> |
---|
339 | <table class="clear"><tr> |
---|
340 | <th colspan="2">'.__('Title').'</th> |
---|
341 | <th>'.__('Id').'</th> |
---|
342 | <th>'.__('Level').'</th> |
---|
343 | <th>'.__('Entries').'</th> |
---|
344 | <th>'.__('Reordered').'</th> |
---|
345 | <th>'.__('Unlisted').'</th> |
---|
346 | </tr>'; |
---|
347 | while ($categories->fetch()) { |
---|
348 | echo |
---|
349 | '<tr class="line">'. |
---|
350 | '<td class="nowrap">'.form::checkbox(array('entries[]'),$categories->cat_id,'','','',false).'</td>'. |
---|
351 | '<td class="maximal"><a href="'.$E->url.'&t=pst&cat_id='.$categories->cat_id.'"> |
---|
352 | '.html::escapeHTML($categories->cat_title).'</a></td>'. |
---|
353 | '<td class="nowrap">'.$categories->cat_id.'</td>'. |
---|
354 | '<td class="nowrap">'.$categories->level.'</td>'. |
---|
355 | '<td class="nowrap">'.$categories->nb_post.'</td>'. |
---|
356 | '<td class="nowrap">'.((in_array($categories->cat_id,$cats_reordered) || in_array($categories->cat_title,$cats_reordered)) ? |
---|
357 | sprintf($img_green,__('Reordered')) : sprintf($img_red,__('Normal'))). |
---|
358 | '</td>'. |
---|
359 | '<td class="nowrap">'.((in_array($categories->cat_id,$cats_unlisted) || in_array($categories->cat_title,$cats_unlisted)) ? |
---|
360 | sprintf($img_red,__('Unlisted')) : sprintf($img_green,__('Normal'))). |
---|
361 | '</td>'. |
---|
362 | '</tr>'; |
---|
363 | } |
---|
364 | echo ' |
---|
365 | </table> |
---|
366 | <div class="two-cols"> |
---|
367 | <p class="col checkboxes-helpers"></p> |
---|
368 | <p class="col right">'.__('Selected categories action:').' '. |
---|
369 | form::combo('action',$categories_actions_combo).' |
---|
370 | <input type="submit" name="save[cat]" value="'.__('ok').'" /></p>'. |
---|
371 | form::hidden('p','eventdata'). |
---|
372 | form::hidden('t','cat'). |
---|
373 | $core->formNonce().' |
---|
374 | </p> |
---|
375 | </div> |
---|
376 | </form> |
---|
377 | </div>'; |
---|
378 | } |
---|
379 | |
---|
380 | /************** |
---|
381 | ** Templates |
---|
382 | **************/ |
---|
383 | |
---|
384 | if (isset($tab['tpl'])) { |
---|
385 | |
---|
386 | # Save tpl options |
---|
387 | if (!empty($_POST['save']['tpl']) && isset($_POST['s'])) { |
---|
388 | try { |
---|
389 | $E->setSettings($_POST['s']); |
---|
390 | http::redirect($E->url.'&t=tpl&done=1'); |
---|
391 | } |
---|
392 | catch (Exception $e) { |
---|
393 | $core->error->add($e->getMessage()); |
---|
394 | } |
---|
395 | } |
---|
396 | |
---|
397 | $default_tpl = in_array($E->S->event_tpl_theme,$combo_templates) ? $E->S->event_tpl_theme : ''; |
---|
398 | |
---|
399 | echo ' |
---|
400 | <div class="multi-part" id="tpl" title="'.$tab['tpl'].'"> |
---|
401 | <p>'.__('This is the management of the public page').'</p> |
---|
402 | '.(!$E->S->event_option_public ? '<p class="error">'.__('Public page is disable').'</p>' : '').' |
---|
403 | <form method="post" action="'.$E->url.'"> |
---|
404 | <h2>'.__('Description').'</h2> |
---|
405 | <p class="col"><label class=" classic">'. |
---|
406 | __('Title').'<br />'. |
---|
407 | form::field('s[event_tpl_title]', 20,255,html::escapeHTML($E->S->event_tpl_title),'maximal').' |
---|
408 | </label></p> |
---|
409 | <p class="area"><label class=" classic">'. |
---|
410 | __('Description').'<br />'. |
---|
411 | form::textArea('s[event_tpl_desc]', 50,5,html::escapeHTML($E->S->event_tpl_desc)).' |
---|
412 | </label></p> |
---|
413 | <h2>'.__('Theme').'</h2> |
---|
414 | <p><ul> |
---|
415 | <li>'.__('Current blog theme:').' <strong>'.$default_thm.'</strong></li> |
---|
416 | <li>'.__('Adapted template exists:').' <strong>'.($default_adt ? __('Yes') : __('No')).'</strong></li> |
---|
417 | <li>'.__('Template on current theme exists:').' <strong>'.($default_xst ? __('Yes') : __('No')).'</strong></li> |
---|
418 | <li>'.__('Alternate template:').' <strong>'.$default_tpl.'</strong></li> |
---|
419 | <li>'.__('Public URL:').' <a href="'.$core->blog->url.$E->S->event_tpl_url.'">'.$core->blog->url.$E->S->event_tpl_url.'</a></li> |
---|
420 | </ul></p> |
---|
421 | <p><label class=" classic">'. |
---|
422 | __('URL prefix:').'<br />'. |
---|
423 | form::field('s[event_tpl_url]', 20,32,html::escapeHTML($E->S->event_tpl_url)).' |
---|
424 | </label></p> |
---|
425 | <p><label class=" classic">'. |
---|
426 | __('Choose predefined page template in case where theme of blog does not have it').'<br />'. |
---|
427 | form::combo('s[event_tpl_theme]',$combo_templates,$default_tpl).' |
---|
428 | </label></p> |
---|
429 | <p><label class=" classic">'. |
---|
430 | __('Disable list of dates of event on an entry').'<br />'. |
---|
431 | form::combo('s[event_tpl_dis_bhv]',array(__('No')=>'0',__('Yes')=>'1'),$E->S->event_tpl_dis_bhv).' |
---|
432 | </label></p>'. |
---|
433 | form::hidden('p','eventdata'). |
---|
434 | form::hidden('t','tpl'). |
---|
435 | $core->formNonce().' |
---|
436 | <input type="submit" name="save[tpl]" value="'.__('Save configuration').'" /> |
---|
437 | </form> |
---|
438 | </div>'; |
---|
439 | } |
---|
440 | |
---|
441 | /************** |
---|
442 | ** Options |
---|
443 | **************/ |
---|
444 | |
---|
445 | if (isset($tab['adm'])) { |
---|
446 | |
---|
447 | echo '<div class="multi-part" id="adm" title="'.$tab['adm'].'">'; |
---|
448 | |
---|
449 | # Save admin options |
---|
450 | if (!empty($_POST['save']['adm']) && isset($_POST['s'])) { |
---|
451 | try { |
---|
452 | $E->setSettings($_POST['s']); |
---|
453 | http::redirect($E->url.'&t=adm&done=1'); |
---|
454 | } |
---|
455 | catch (Exception $e) { |
---|
456 | $core->error->add($e->getMessage()); |
---|
457 | } |
---|
458 | } |
---|
459 | |
---|
460 | # Display |
---|
461 | echo ' |
---|
462 | <p>'.__('Plugin admistration options on this blog').'</p> |
---|
463 | <form method="post" action="'.$E->url.'"> |
---|
464 | <h2>'.__('General').'</h2> |
---|
465 | <p> |
---|
466 | <table class="clear"><tr class="line"> |
---|
467 | <th class="nowrap">'.__('Enable plugin').'</th> |
---|
468 | <td class="nowrap"><label class=" classic">'.form::radio('s[event_option_active]',0, !$E->S->event_option_active).' '.__('No').'</label></td> |
---|
469 | <td class="nowrap"><label class=" classic">'.form::radio('s[event_option_active]',1, $E->S->event_option_active).' '.__('Yes').'</label></td> |
---|
470 | </tr><tr class="line"> |
---|
471 | <th class="nowrap">'.__('Plugin icon in Blog menu').'</th> |
---|
472 | <td class="nowrap"><label class=" classic">'.form::radio('s[event_option_menu]',0, !$E->S->event_option_menu).' '.__('No').'</label></td> |
---|
473 | <td class="nowrap"><label class=" classic">'.form::radio('s[event_option_menu]',1, $E->S->event_option_menu).' '.__('Yes').'</label></td> |
---|
474 | </tr><tr class="line"> |
---|
475 | <th class="nowrap">'.__('Enable public page').'</th> |
---|
476 | <td class="nowrap"><label class=" classic">'.form::radio('s[event_option_public]',0, !$E->S->event_option_public).' '.__('No').'</label></td> |
---|
477 | <td class="nowrap"><label class=" classic">'.form::radio('s[event_option_public]',1, $E->S->event_option_public).' '.__('Yes').'</label></td |
---|
478 | </tr></table></p> |
---|
479 | <h2>'.__('Permissions').'</h2> |
---|
480 | <p> |
---|
481 | <table class="clear"><tr class="line"> |
---|
482 | <th class="nowrap">'.__('Manage events dates on entries').'</th> |
---|
483 | <td class="nowrap"><label class=" classic">'.form::radio('s[event_perm_pst]',0,!$E->S->event_perm_pst).' '.__('admin').'</label></td> |
---|
484 | <td class="nowrap"><label class=" classic">'.form::radio('s[event_perm_pst]',1,$E->S->event_perm_pst).' '.__('admin,usage,contentadmin,eventdata').'</label></td> |
---|
485 | </tr><tr class="line"> |
---|
486 | <th class="nowrap">'.__('Manage list of reordered categories').'</th> |
---|
487 | <td class="nowrap"><label class=" classic">'.form::radio('s[event_perm_cat]',0,!$E->S->event_perm_cat).' '.__('admin').'</label></td> |
---|
488 | <td class="nowrap"><label class=" classic">'.form::radio('s[event_perm_cat]',1,$E->S->event_perm_cat).' '.__('admin,categories,eventdata').'</label></td> |
---|
489 | </tr><tr class="line"> |
---|
490 | <th class="nowrap">'.__('Manage public page').'</th> |
---|
491 | <td class="nowrap"><label class=" classic">'.form::radio('s[event_perm_tpl]',0,!$E->S->event_perm_tpl).' '.__('admin').'</label></td> |
---|
492 | <td class="nowrap"><label class=" classic">'.form::radio('s[event_perm_tpl]',1,$E->S->event_perm_tpl).' '.__('admin,eventdata').'</label></td> |
---|
493 | </tr><tr class="line"> |
---|
494 | <th class="nowrap">'.__('Manage plugin').'</th> |
---|
495 | <td class="nowrap"><label class=" classic">'.form::radio('s[event_perm_adm]',0,!$E->S->event_perm_adm).' '.__('admin').'</label></td> |
---|
496 | <td class="nowrap"><label class=" classic">'.form::radio('s[event_perm_adm]',1,$E->S->event_perm_adm).' '.__('admin,eventdata').'</label></td> |
---|
497 | </tr></table></p> |
---|
498 | <p>'. |
---|
499 | form::hidden('p','eventdata'). |
---|
500 | form::hidden('t','adm'). |
---|
501 | $core->formNonce().' |
---|
502 | <input type="submit" name="save[adm]" value="'.__('Save configuration').'" /></p> |
---|
503 | </form> |
---|
504 | </div>'; |
---|
505 | } |
---|
506 | |
---|
507 | /************** |
---|
508 | ** Uninstall |
---|
509 | **************/ |
---|
510 | |
---|
511 | if (isset($tab['uninstall'])) { |
---|
512 | |
---|
513 | echo '<div class="multi-part" id="uninstall" title="'.$tab['uninstall'].'">'; |
---|
514 | |
---|
515 | # Save admin options |
---|
516 | if (!empty($_POST['save']['validate']) && isset($_POST['s'])) { |
---|
517 | |
---|
518 | try { |
---|
519 | if (1 != $understand) |
---|
520 | throw new Exception(__('You must check warning in order to delete plugin.')); |
---|
521 | |
---|
522 | if (1 == $delete_table) |
---|
523 | eventdataInstall::delTable($core); |
---|
524 | |
---|
525 | if (1 == $delete_templates) |
---|
526 | eventdataInstall::delTemplates($core); |
---|
527 | |
---|
528 | if (1 == $delete_settings) |
---|
529 | eventdataInstall::delSettings($core); |
---|
530 | |
---|
531 | eventdataInstall::delVersion($core); |
---|
532 | eventdataInstall::delModule($core); |
---|
533 | } |
---|
534 | catch (Exception $e) { |
---|
535 | $core->error->add($e->getMessage()); |
---|
536 | } |
---|
537 | |
---|
538 | if (!$core->error->flag()) |
---|
539 | http::redirect('plugins.php?removed=1'); |
---|
540 | } |
---|
541 | # Confirm options |
---|
542 | if (!empty($_POST['save']['uninstall']) && isset($_POST['s']) && 1 == $understand) { |
---|
543 | echo ' |
---|
544 | <p>'.__('In order to properly uninstall this plugin, you must specify the actions to perform').'</p> |
---|
545 | <form method="post" action="'.$E->url.'"> |
---|
546 | <h2>'.__('Validate').'</h2> |
---|
547 | <p> |
---|
548 | <label class=" classic">'.sprintf(($understand ? $img_green : $img_red),'-'). |
---|
549 | __('You understand that if you delete this plugin, the other plugins that use there table and class will no longer work.').'</label><br /> |
---|
550 | <label class=" classic">'.sprintf($img_green,'-'). |
---|
551 | __('Delete plugin files').'</label><br /> |
---|
552 | <label class=" classic">'.sprintf(($delete_table ? $img_green : $img_red),'-'). |
---|
553 | __('Delete plugin database table').'</label><br /> |
---|
554 | <label class=" classic">'.sprintf(($delete_templates ? $img_green : $img_red),'-'). |
---|
555 | __('Delete plugin public templates').'</label><br /> |
---|
556 | <label class=" classic">'.sprintf(($delete_settings ? $img_green : $img_red),'-'). |
---|
557 | __('Delete plugin settings').'</label><br /> |
---|
558 | </p>'. |
---|
559 | form::hidden('p','eventdata'). |
---|
560 | form::hidden('t','uninstall'). |
---|
561 | form::hidden('s[understand]',$understand). |
---|
562 | form::hidden('s[delete_table]',$delete_table). |
---|
563 | form::hidden('s[delete_templates]',$delete_templates). |
---|
564 | form::hidden('s[delete_settings]',$delete_settings). |
---|
565 | $core->formNonce().' |
---|
566 | <input type="submit" name="save[validate]" value="'.__('Uninstall').'" /> |
---|
567 | <input type="submit" name="save[back]" value="'.__('Back').'" /> |
---|
568 | </form>'; |
---|
569 | |
---|
570 | # Option form |
---|
571 | } else { |
---|
572 | if (!empty($_POST['save']['uninstall']) && 1 != $understand) |
---|
573 | $core->error->add(__('You must check warning in order to delete plugin.')); |
---|
574 | |
---|
575 | echo ' |
---|
576 | <p>'.__('In order to properly uninstall this plugin, you must specify the actions to perform').'</p> |
---|
577 | <form method="post" action="'.$E->url.'"> |
---|
578 | <h2>'.__('Uninstall "eventdata" plugin').'</h2> |
---|
579 | <p> |
---|
580 | <label class=" classic">'.form::checkbox('s[understand]',1,$understand). |
---|
581 | __('You understand that if you delete this plugin, the other plugins that use there table and class will no longer work.').'</label><br /> |
---|
582 | <label class=" classic">'.form::checkbox('s[delete_table]',1,$delete_table). |
---|
583 | __('Delete plugin database table').'</label><br /> |
---|
584 | <label class=" classic">'.form::checkbox('s[delete_templates]',1,$delete_templates). |
---|
585 | __('Delete plugin public templates').'</label><br /> |
---|
586 | <label class=" classic">'.form::checkbox('s[delete_settings]',1,$delete_settings). |
---|
587 | __('Delete plugin settings').'</label><br /> |
---|
588 | </p>'. |
---|
589 | form::hidden('p','eventdata'). |
---|
590 | form::hidden('t','uninstall'). |
---|
591 | $core->formNonce().' |
---|
592 | <input type="submit" name="save[uninstall]" value="'.__('Uninstall').'" /> |
---|
593 | </form>'; |
---|
594 | } |
---|
595 | echo '</div>'; |
---|
596 | } |
---|
597 | |
---|
598 | /************** |
---|
599 | ** About |
---|
600 | **************/ |
---|
601 | |
---|
602 | echo ' |
---|
603 | <div class="multi-part" id="about" title="'.$tab['about'].'"> |
---|
604 | <p style="color:Red"><strong>'.__('Warning').':</strong> This is a alpha version,we recommand that you do not use it in production.</p> |
---|
605 | <h2>'.__('About').'</h2> |
---|
606 | <h3>'.__('Version:').'</h3> |
---|
607 | <p>eventdata '.$core->plugins->moduleInfo('eventdata','version').'</p> |
---|
608 | <h3>'.__('Support:').'</h3><p> |
---|
609 | <a href="http://blog.jcdenis.com/?q=dotclear+plugin+eventdata"> |
---|
610 | http://blog.jcdenis.com/?q=dotclear+plugin+eventdata</a><br /> |
---|
611 | <a href="http://forum.dotclear.net/index.php"> |
---|
612 | http://forum.dotclear.net</a><br /> |
---|
613 | There is a full README file in French available at the root of this extension.</p> |
---|
614 | <h3>'.__('Copyrights:').'</h3><p> |
---|
615 | These files are parts of eventdata, a plugin for Dotclear 2.<br /> |
---|
616 | Copyright (c) 2009 JC Denis and contributors<br /> |
---|
617 | Licensed under the GPL version 2.0 license.<br /> |
---|
618 | <a href="http://www.gnu.org/licenses/old-licenses/gpl-2.0.html">http://www.gnu.org/licenses/old-licenses/gpl-2.0.html</a></p> |
---|
619 | <br /> |
---|
620 | <p>Some icons from Silk icon set 1.3 by Mark James at:<br /> |
---|
621 | <a href="http://www.famfamfam.com/lab/icons/silk/">http://www.famfamfam.com/lab/icons/silk/</a><br /> |
---|
622 | under a Creative Commons Attribution 2.5 License<br /> |
---|
623 | <a href="http://creativecommons.org/licenses/by/2.5/">http://creativecommons.org/licenses/by/2.5/</a>.</p> |
---|
624 | <br /> |
---|
625 | <p>Traduced with plugin langOmatic,<br />Packaged with plugin Packager.</p> |
---|
626 | </div> |
---|
627 | '.dcPage::helpBlock('eventdata').' |
---|
628 | </body> |
---|
629 | </html>'; |
---|
630 | ?> |
---|