1 | <?php |
---|
2 | # -- BEGIN LICENSE BLOCK ---------------------------------- |
---|
3 | # |
---|
4 | # This file is part of Dotclear 2 Gallery plugin. |
---|
5 | # |
---|
6 | # Copyright (c) 2004-2008 Bruno Hondelatte, and contributors. |
---|
7 | # Many, many thanks to Olivier Meunier and the Dotclear Team. |
---|
8 | # Licensed under the GPL version 2.0 license. |
---|
9 | # See LICENSE file or |
---|
10 | # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
---|
11 | # |
---|
12 | # -- END LICENSE BLOCK ------------------------------------ |
---|
13 | |
---|
14 | if (!defined('DC_CONTEXT_ADMIN')) { exit; } |
---|
15 | |
---|
16 | |
---|
17 | $post_id = ''; |
---|
18 | $cat_id = ''; |
---|
19 | $post_dt = ''; |
---|
20 | $post_format = $core->auth->getOption('post_format'); |
---|
21 | $post_password = ''; |
---|
22 | $post_url = ''; |
---|
23 | $post_lang = $core->auth->getInfo('user_lang'); |
---|
24 | $post_title = ''; |
---|
25 | $post_excerpt = ''; |
---|
26 | $post_excerpt_xhtml = ''; |
---|
27 | $post_content = ''; |
---|
28 | $post_content_xhtml = ''; |
---|
29 | $post_notes = ''; |
---|
30 | $post_status = $core->auth->getInfo('user_post_status'); |
---|
31 | $post_selected = false; |
---|
32 | if (version_compare(str_replace("-r","-p",DC_VERSION),'2.2-alpha','>=')) { |
---|
33 | $post_open_comment = $core->blog->settings->system->allow_comments; |
---|
34 | $post_open_tb = $core->blog->settings->system->allow_trackbacks; |
---|
35 | } else { |
---|
36 | $post_open_comment = $core->blog->settings->allow_comments; |
---|
37 | $post_open_tb = $core->blog->settings->allow_trackbacks; |
---|
38 | } |
---|
39 | |
---|
40 | $post_media = array(); |
---|
41 | |
---|
42 | $page_title = __('New gallery'); |
---|
43 | $can_view_page = true; |
---|
44 | $can_edit_post = $core->auth->check('usage,contentadmin',$core->blog->id); |
---|
45 | $can_publish = $core->auth->check('publish,contentadmin',$core->blog->id); |
---|
46 | |
---|
47 | $core->media = new dcMedia($core); |
---|
48 | $core->meta = new dcMeta($core); |
---|
49 | |
---|
50 | |
---|
51 | $themes = $core->gallery->getThemes(); |
---|
52 | $themes[__('Use blog settings')]='default'; |
---|
53 | $themes_integ = $themes; |
---|
54 | $themes_integ[__('same as gallery theme')] = 'sameasgal'; |
---|
55 | /* |
---|
56 | $post_headlink = '<link rel="%s" title="%s" href="post.php?id=%s" />'; |
---|
57 | $post_link = '<a href="post.php?id=%s" title="%s">%s</a>'; |
---|
58 | */ |
---|
59 | $next_link = $prev_link = $next_headlink = $prev_headlink = null; |
---|
60 | |
---|
61 | $gal_headlink = '<link rel="%s" title="%s" href="plugin.php?p=gallery&m=gal&id=%s" />'; |
---|
62 | $gal_link = '<a href="plugin.php?p=gallery&m=gal&id=%s" title="%s">%s</a>'; |
---|
63 | |
---|
64 | |
---|
65 | # If user can't publish |
---|
66 | if (!$can_publish) { |
---|
67 | $post_status = -2; |
---|
68 | } |
---|
69 | |
---|
70 | $orderby_combo = $core->gallery->orderby; |
---|
71 | $sortby_combo = $core->gallery->sortby; |
---|
72 | |
---|
73 | # Getting categories |
---|
74 | $categories_combo = array(' ' => ''); |
---|
75 | try { |
---|
76 | $categories = $core->blog->getCategories(); |
---|
77 | while ($categories->fetch()) { |
---|
78 | $categories_combo[str_repeat(' ',$categories->level-1).'• '. |
---|
79 | html::escapeHTML($categories->cat_title)] = $categories->cat_id; |
---|
80 | $reverse_cat[$categories->cat_id] = html::escapeHTML($categories->cat_title); |
---|
81 | } |
---|
82 | $reverse_cat[null] = ""; |
---|
83 | } catch (Exception $e) { } |
---|
84 | |
---|
85 | # Status combo |
---|
86 | foreach ($core->blog->getAllPostStatus() as $k => $v) { |
---|
87 | $status_combo[$v] = (string) $k; |
---|
88 | } |
---|
89 | |
---|
90 | # Formaters combo |
---|
91 | foreach ($core->getFormaters() as $v) { |
---|
92 | $formaters_combo[$v] = $v; |
---|
93 | } |
---|
94 | |
---|
95 | $c_media_dir = $c_tag = $c_user = $c_cat = 0; |
---|
96 | $f_recurse_dir = 0; |
---|
97 | $f_sub_cat = 0; |
---|
98 | $f_media_dir = $f_tag = $f_user = $f_cat = null; |
---|
99 | $f_orderby = $f_sortby = null; |
---|
100 | $f_theme = "default"; |
---|
101 | $f_themeinteg = "default"; |
---|
102 | |
---|
103 | |
---|
104 | # Get entry informations |
---|
105 | if (!empty($_REQUEST['id'])) |
---|
106 | { |
---|
107 | $params['post_id'] = $_REQUEST['id']; |
---|
108 | |
---|
109 | $post = $core->gallery->getGalleries($params); |
---|
110 | |
---|
111 | if ($post->isEmpty()) |
---|
112 | { |
---|
113 | $core->error->add(__('This entry does not exist.')); |
---|
114 | $can_view_page = false; |
---|
115 | } |
---|
116 | else |
---|
117 | { |
---|
118 | $post_id = $post->post_id; |
---|
119 | $cat_id = $post->cat_id; |
---|
120 | $post_dt = date('Y-m-d H:i',strtotime($post->post_dt)); |
---|
121 | $post_format = $post->post_format; |
---|
122 | $post_password = $post->post_password; |
---|
123 | $post_url = $post->post_url; |
---|
124 | $post_lang = $post->post_lang; |
---|
125 | $post_title = $post->post_title; |
---|
126 | $post_excerpt = $post->post_excerpt; |
---|
127 | $post_excerpt_xhtml = $post->post_excerpt_xhtml; |
---|
128 | $post_content = $post->post_content; |
---|
129 | if (trim($post_content) === "///html\n<p></p>\n///" || trim($post_content) == '' || |
---|
130 | trim($post_content) === "///html\n<p> </p>\n///") |
---|
131 | $post_content = ''; |
---|
132 | $post_content_xhtml = $post->post_content_xhtml; |
---|
133 | if (trim($post_content_xhtml) === "<p></p>" || trim($post_content_xhtml) == '' || |
---|
134 | trim($post_content_xhtml) === "<p> </p>") |
---|
135 | $post_content_xhtml = ''; |
---|
136 | $post_notes = $post->post_notes; |
---|
137 | $post_status = $post->post_status; |
---|
138 | $post_selected = (boolean) $post->post_selected; |
---|
139 | $post_open_comment = (boolean) $post->post_open_comment; |
---|
140 | $post_open_tb = (boolean) $post->post_open_tb; |
---|
141 | $gal_filters = $core->gallery->getGalParams($post); |
---|
142 | if (isset($gal_filters['media_dir'])) { |
---|
143 | $c_media_dir=true; |
---|
144 | $f_media_dir=$gal_filters['media_dir'][0]; |
---|
145 | } |
---|
146 | if (isset($gal_filters['recurse_dir'])) { |
---|
147 | $f_recurse_dir = 1; |
---|
148 | } |
---|
149 | if (isset($gal_filters['sub_cat'])) { |
---|
150 | $f_sub_cat = 1; |
---|
151 | } |
---|
152 | if (isset($gal_filters['tag'])) { |
---|
153 | $c_tag=true; |
---|
154 | $f_tag=$gal_filters['tag']; |
---|
155 | } |
---|
156 | if (isset($gal_filters['user_id'])) { |
---|
157 | $c_user=true; |
---|
158 | $f_user=$gal_filters['user_id']; |
---|
159 | } |
---|
160 | if (isset($gal_filters['cat_id'])) { |
---|
161 | $c_cat=true; |
---|
162 | $f_cat=(integer)$gal_filters['cat_id']; |
---|
163 | } |
---|
164 | if (isset($gal_filters['orderby'])) { |
---|
165 | $f_orderby = $gal_filters['orderby']; |
---|
166 | } else { |
---|
167 | $f_orderby = 'P.post_dt'; |
---|
168 | } |
---|
169 | if (isset($gal_filters['sortby'])) { |
---|
170 | $f_sortby = $gal_filters['sortby']; |
---|
171 | } else { |
---|
172 | $f_orderby = 'ASC'; |
---|
173 | } |
---|
174 | $gal_thumb = $core->gallery->getPostMedia($post_id); |
---|
175 | $has_thumb = (sizeof($gal_thumb) != 0); |
---|
176 | if ($has_thumb) { |
---|
177 | $gal_thumb = $gal_thumb[0]; |
---|
178 | } |
---|
179 | $meta_list = $core->meta->getMetaArray($post->post_meta); |
---|
180 | $gal_nb_img = isset($meta_list['galitem'])?sizeof($meta_list['galitem']):0; |
---|
181 | $f_theme = isset($meta_list['galtheme'])?$meta_list['galtheme'][0]:'default'; |
---|
182 | $f_themeinteg = isset($meta_list['galthemeinteg'])?$meta_list['galthemeinteg'][0]:'default'; |
---|
183 | |
---|
184 | /*$gal_meta=$core->meta->getMetaArray($post->post_meta); |
---|
185 | if (isset($gal_meta["galordering"])) { |
---|
186 | } else { |
---|
187 | $gal_ordering = 'P.date'; |
---|
188 | } |
---|
189 | if (isset($gal_meta["galorderdir"])) { |
---|
190 | } else { |
---|
191 | $gal_ordedir = 'ASC'; |
---|
192 | }*/ |
---|
193 | |
---|
194 | $page_title = __('Edit gallery'); |
---|
195 | |
---|
196 | $can_edit_post = $post->isEditable(); |
---|
197 | |
---|
198 | $next_rs = $core->gallery->getNextGallery($post_id,strtotime($post_dt),1); |
---|
199 | $prev_rs = $core->gallery->getNextGallery($post_id,strtotime($post_dt),-1); |
---|
200 | if ($next_rs !== null) { |
---|
201 | $next_link = sprintf($gal_link,$next_rs->post_id, |
---|
202 | html::escapeHTML($next_rs->post_title),__('next gallery').' »'); |
---|
203 | $next_headlink = sprintf($gal_headlink,'next', |
---|
204 | html::escapeHTML($next_rs->post_title),$next_rs->post_id); |
---|
205 | } |
---|
206 | |
---|
207 | if ($prev_rs !== null) { |
---|
208 | $prev_link = sprintf($gal_link,$prev_rs->post_id, |
---|
209 | html::escapeHTML($prev_rs->post_title),'« '.__('previous gallery')); |
---|
210 | $prev_headlink = sprintf($gal_headlink,'previous', |
---|
211 | html::escapeHTML($prev_rs->post_title),$prev_rs->post_id); |
---|
212 | } |
---|
213 | } |
---|
214 | } |
---|
215 | |
---|
216 | |
---|
217 | $dirs_combo = array(); |
---|
218 | foreach ($core->media->getRootDirs() as $v) { |
---|
219 | if ($v->relname == "") |
---|
220 | $dirs_combo['/'] = "."; |
---|
221 | else |
---|
222 | $dirs_combo['/'.$v->relname] = $v->relname; |
---|
223 | } |
---|
224 | # Format excerpt and content |
---|
225 | if (!empty($_POST) && $can_edit_post) |
---|
226 | { |
---|
227 | $post_format = $_POST['post_format']; |
---|
228 | $post_excerpt = $_POST['post_excerpt']; |
---|
229 | $post_content = $_POST['post_content']; |
---|
230 | |
---|
231 | /* Enable null post content */ |
---|
232 | if (trim($post_content)==='') |
---|
233 | $post_content="///html\n<p> </p>\n///"; |
---|
234 | |
---|
235 | if (trim($post_content_xhtml)==='') |
---|
236 | $post_content_xhtml="<p> </p>"; |
---|
237 | |
---|
238 | $post_title = $_POST['post_title']; |
---|
239 | |
---|
240 | $cat_id = (integer) $_POST['cat_id']; |
---|
241 | |
---|
242 | if (isset($_POST['post_status'])) { |
---|
243 | $post_status = (integer) $_POST['post_status']; |
---|
244 | } |
---|
245 | |
---|
246 | if (empty($_POST['post_dt'])) { |
---|
247 | $post_dt = ''; |
---|
248 | } else { |
---|
249 | $post_dt = strtotime($_POST['post_dt']); |
---|
250 | $post_dt = date('Y-m-d H:i',$post_dt); |
---|
251 | } |
---|
252 | |
---|
253 | $post_open_comment = !empty($_POST['post_open_comment']); |
---|
254 | $post_open_tb = !empty($_POST['post_open_tb']); |
---|
255 | $post_selected = !empty($_POST['post_selected']); |
---|
256 | $post_lang = $_POST['post_lang']; |
---|
257 | $post_password = !empty($_POST['post_password']) ? $_POST['post_password'] : null; |
---|
258 | |
---|
259 | $post_notes = $_POST['post_notes']; |
---|
260 | |
---|
261 | $c_media_dir = !empty($_POST['c_media_dir']); |
---|
262 | $c_tag = !empty($_POST['c_tag']); |
---|
263 | $c_cat = !empty($_POST['c_cat']); |
---|
264 | $c_user = !empty($_POST['c_user']); |
---|
265 | $f_media_dir = !empty($_POST['f_media_dir']) ? $_POST['f_media_dir'] : null; |
---|
266 | $f_recurse_dir = !empty($_POST['f_recurse_dir']); |
---|
267 | $f_sub_cat = !empty($_POST['f_sub_cat']); |
---|
268 | $f_tag = !empty($_POST['f_tag']) ? $_POST['f_tag'] : null; |
---|
269 | $f_cat = !empty($_POST['f_cat']) ? $_POST['f_cat'] : null; |
---|
270 | $f_user = !empty($_POST['f_user']) ? $_POST['f_user'] : null; |
---|
271 | $f_orderby = !empty($_POST['f_orderby']) ? $_POST['f_orderby'] : null; |
---|
272 | $f_sortby = !empty($_POST['f_sortby']) ? $_POST['f_sortby'] : null; |
---|
273 | $f_theme = !empty($_POST['f_theme']) ? $_POST['f_theme'] : 'default'; |
---|
274 | $f_themeinteg = !empty($_POST['f_themeinteg']) ? $_POST['f_themeinteg'] : 'default'; |
---|
275 | |
---|
276 | |
---|
277 | if (isset($_POST['post_url'])) { |
---|
278 | $post_url = $_POST['post_url']; |
---|
279 | } |
---|
280 | |
---|
281 | $core->blog->setPostContent( |
---|
282 | $post_id,$post_format,$post_lang, |
---|
283 | $post_excerpt,$post_excerpt_xhtml,$post_content,$post_content_xhtml |
---|
284 | ); |
---|
285 | |
---|
286 | } |
---|
287 | |
---|
288 | # Create or update post |
---|
289 | if (!empty($_POST) && !empty($_POST['save']) && $can_edit_post) |
---|
290 | { |
---|
291 | $cur = $core->con->openCursor($core->prefix.'post'); |
---|
292 | |
---|
293 | $cur->post_title = $post_title; |
---|
294 | $cur->cat_id = ($cat_id ? $cat_id : null); |
---|
295 | $cur->post_dt = $post_dt ? date('Y-m-d H:i:00',strtotime($post_dt)) : ''; |
---|
296 | $cur->post_format = $post_format; |
---|
297 | $cur->post_password = $post_password; |
---|
298 | $cur->post_lang = $post_lang; |
---|
299 | $cur->post_title = $post_title; |
---|
300 | $cur->post_excerpt = $post_excerpt; |
---|
301 | $cur->post_excerpt_xhtml = $post_excerpt_xhtml; |
---|
302 | $cur->post_content = $post_content; |
---|
303 | $cur->post_content_xhtml = $post_content_xhtml; |
---|
304 | $cur->post_notes = $post_notes; |
---|
305 | $cur->post_status = $post_status; |
---|
306 | $cur->post_selected = (integer) $post_selected; |
---|
307 | $cur->post_open_comment = (integer) $post_open_comment; |
---|
308 | $cur->post_open_tb = (integer) $post_open_tb; |
---|
309 | $cur->post_type='gal'; |
---|
310 | |
---|
311 | if (isset($_POST['post_url'])) { |
---|
312 | $cur->post_url = $post_url; |
---|
313 | } |
---|
314 | |
---|
315 | $updated=false; |
---|
316 | # Update post |
---|
317 | if ($post_id) |
---|
318 | { |
---|
319 | try |
---|
320 | { |
---|
321 | # --BEHAVIOR-- adminBeforeGalleryUpdate |
---|
322 | $core->callBehavior('adminBeforeGalleryUpdate',$cur,$post_id); |
---|
323 | |
---|
324 | $core->blog->updPost($post_id,$cur); |
---|
325 | |
---|
326 | # --BEHAVIOR-- adminAfterGalleryUpdate |
---|
327 | $core->callBehavior('adminAfterGalleryUpdate',$cur,$post_id); |
---|
328 | |
---|
329 | $updated=true; |
---|
330 | |
---|
331 | } |
---|
332 | catch (Exception $e) |
---|
333 | { |
---|
334 | $core->error->add($e->getMessage()); |
---|
335 | } |
---|
336 | } |
---|
337 | else |
---|
338 | { |
---|
339 | $cur->user_id = $core->auth->userID(); |
---|
340 | |
---|
341 | try |
---|
342 | { |
---|
343 | # --BEHAVIOR-- adminBeforeGalleryCreate |
---|
344 | $core->callBehavior('adminBeforeGalleryCreate',$cur); |
---|
345 | |
---|
346 | $post_id = $core->blog->addPost($cur); |
---|
347 | |
---|
348 | # --BEHAVIOR-- adminAfterGalleryCreate |
---|
349 | $core->callBehavior('adminAfterGalleryCreate',$cur,$post_id); |
---|
350 | $updated=true; |
---|
351 | } |
---|
352 | catch (Exception $e) |
---|
353 | { |
---|
354 | $core->error->add($e->getMessage()); |
---|
355 | } |
---|
356 | } |
---|
357 | if ($updated) { |
---|
358 | $core->meta->delPostMeta($post_id,"galmediadir"); |
---|
359 | $core->meta->delPostMeta($post_id,"galrecursedir"); |
---|
360 | $core->meta->delPostMeta($post_id,"galsubcat"); |
---|
361 | $core->meta->delPostMeta($post_id,"galtag"); |
---|
362 | $core->meta->delPostMeta($post_id,"galcat"); |
---|
363 | $core->meta->delPostMeta($post_id,"galuser"); |
---|
364 | $core->meta->delPostMeta($post_id,"galorderby"); |
---|
365 | $core->meta->delPostMeta($post_id,"galsortby"); |
---|
366 | $core->meta->delPostMeta($post_id,"galtheme"); |
---|
367 | $core->meta->delPostMeta($post_id,"galthemeinteg"); |
---|
368 | $core->meta->delPostMeta($post_id,"subcat"); |
---|
369 | if ($c_media_dir) { |
---|
370 | $core->meta->setPostMeta($post_id,"galmediadir",$f_media_dir); |
---|
371 | $core->meta->setPostMeta($post_id,"galrecursedir",(integer)$f_recurse_dir); |
---|
372 | } |
---|
373 | if ($c_tag) { |
---|
374 | $core->meta->setPostMeta($post_id,"galtag",$f_tag); |
---|
375 | } |
---|
376 | if ($c_cat) { |
---|
377 | $core->meta->setPostMeta($post_id,"galcat",$f_cat); |
---|
378 | $core->meta->setPostMeta($post_id,"galsubcat",(integer)$f_sub_cat); |
---|
379 | } |
---|
380 | if ($c_user) { |
---|
381 | $core->meta->setPostMeta($post_id,"galuser",$f_user); |
---|
382 | } |
---|
383 | if (isset ($f_orderby)) { |
---|
384 | $core->meta->setPostMeta($post_id,"galorderby",$f_orderby); |
---|
385 | } |
---|
386 | if (isset ($f_sortby)) { |
---|
387 | $core->meta->setPostMeta($post_id,"galsortby",$f_sortby); |
---|
388 | } |
---|
389 | if (isset ($f_themeinteg) && $f_themeinteg != 'default') { |
---|
390 | $core->meta->setPostMeta($post_id,"galthemeinteg",$f_themeinteg); |
---|
391 | } |
---|
392 | if (isset ($f_theme) && $f_theme != 'default') { |
---|
393 | $core->meta->setPostMeta($post_id,"galtheme",$f_theme); |
---|
394 | } |
---|
395 | $core->gallery->refreshGallery($post_id); |
---|
396 | |
---|
397 | http::redirect('plugin.php?p=gallery&m=gal&id='.$post_id.'&upd=1'); |
---|
398 | } |
---|
399 | } |
---|
400 | ?> |
---|
401 | <html> |
---|
402 | <head> |
---|
403 | <title>Gallery</title> |
---|
404 | <?php echo dcPage::jsDatePicker(). |
---|
405 | dcPage::jsToolBar(). |
---|
406 | dcPage::jsModal(). |
---|
407 | dcPage::jsLoad('index.php?pf=gallery/js/_gal.js'). |
---|
408 | dcPage::jsLoad('index.php?pf=gallery/js/posttag.js'). |
---|
409 | dcPage::jsConfirmClose('entry-form'). |
---|
410 | dcPage::jsPageTabs('edit-entry'). |
---|
411 | tagsBehaviors::postHeaders(). |
---|
412 | $core->callBehavior('adminGalleryHeaders'); ?> |
---|
413 | |
---|
414 | <link rel="stylesheet" type="text/css" href="index.php?pf=gallery/admin_css/style.css" /> |
---|
415 | |
---|
416 | </script> |
---|
417 | </head> |
---|
418 | <body> |
---|
419 | <?php |
---|
420 | /* DISPLAY |
---|
421 | -------------------------------------------------------- */ |
---|
422 | $default_tab = 'edit-entry'; |
---|
423 | if (!$can_edit_post) { |
---|
424 | $default_tab = ''; |
---|
425 | } |
---|
426 | if (!empty($_GET['co'])) { |
---|
427 | $default_tab = 'comments'; |
---|
428 | } |
---|
429 | |
---|
430 | if (!empty($_GET['upd'])) { |
---|
431 | echo '<p class="message">'.__('The gallery has been successfully updated.').'</p>'; |
---|
432 | } |
---|
433 | elseif (!empty($_GET['crea'])) { |
---|
434 | echo '<p class="message">'.__('The gallery has been successfully created.').'</p>'; |
---|
435 | } |
---|
436 | elseif (!empty($_GET['attached'])) { |
---|
437 | echo '<p class="message">'.__('File has been successfully attached.').'</p>'; |
---|
438 | } |
---|
439 | elseif (!empty($_GET['rmattach'])) { |
---|
440 | echo '<p class="message">'.__('Attachment has been successfully removed.').'</p>'; |
---|
441 | } |
---|
442 | |
---|
443 | # XHTML conversion |
---|
444 | if (!empty($_GET['xconv'])) |
---|
445 | { |
---|
446 | $post_excerpt = $post_excerpt_xhtml; |
---|
447 | $post_content = $post_content_xhtml; |
---|
448 | $post_format = 'xhtml'; |
---|
449 | |
---|
450 | echo '<p class="message">'.__('Don\'t forget to validate your XHTML conversion by saving your post.').'</p>'; |
---|
451 | } |
---|
452 | |
---|
453 | |
---|
454 | if ($core->error->flag()) { |
---|
455 | echo |
---|
456 | '<div class="error"><strong>'.__('Errors:').'</strong>'. |
---|
457 | $core->error->toHTML(). |
---|
458 | '</div>'; |
---|
459 | } |
---|
460 | |
---|
461 | echo '<h2>'.html::escapeHTML($core->blog->name).' > '.__('Gallery')." > ".$page_title.'</h2>'; |
---|
462 | |
---|
463 | # Exit if we cannot view page |
---|
464 | if (!$can_view_page) { |
---|
465 | exit; |
---|
466 | } |
---|
467 | if ($post_id) |
---|
468 | { |
---|
469 | echo '<p>'; |
---|
470 | if ($prev_link) { |
---|
471 | echo $prev_link.' - '; |
---|
472 | } |
---|
473 | |
---|
474 | if ($post->post_status == 1) { |
---|
475 | echo '<a id="post-preview" href="'.$post->getURL().'" class="button">'.__('view gallery').'</a>'; |
---|
476 | } else { |
---|
477 | |
---|
478 | $preview_url = |
---|
479 | $core->blog->url.$core->url->getBase('gallerypreview').'/'. |
---|
480 | $core->auth->userID().'/'. |
---|
481 | http::browserUID(DC_MASTER_KEY.$core->auth->userID().$core->auth->getInfo('user_pwd')). |
---|
482 | '/'.$post->post_url; |
---|
483 | echo '<a id="post-preview" href="'.$preview_url.'" class="button">'.__('Preview gallery').'</a>'; |
---|
484 | } |
---|
485 | |
---|
486 | if ($next_link) { |
---|
487 | echo ' - '.$next_link; |
---|
488 | } |
---|
489 | |
---|
490 | # --BEHAVIOR-- adminGalleryNavLinks |
---|
491 | $core->callBehavior('adminGalleryNavLinks',isset($post) ? $post : null); |
---|
492 | |
---|
493 | echo '</p>'; |
---|
494 | } |
---|
495 | echo '<p><a href="plugin.php?p=gallery" class="multi-part">'.__('Galleries').'</a></p>'; |
---|
496 | echo '<div id="edit-entry" class="multi-part" title="'.__('Gallery').'">'; |
---|
497 | |
---|
498 | if ($post_id) { |
---|
499 | echo "<fieldset><legend>".__('Information')."</legend>"; |
---|
500 | echo '<div class="two-cols">'. |
---|
501 | '<div class="col">'. |
---|
502 | "<h3>".__('Presentation thumbnail')."</h3>"; |
---|
503 | $change_thumb_url='plugin.php?p=gallery&m=galthumb&gal_id='.$post_id; |
---|
504 | if ($c_media_dir) |
---|
505 | $change_thumb_url .= '&d='.$f_media_dir; |
---|
506 | |
---|
507 | if ($has_thumb) { |
---|
508 | echo '<div class="gal-media-item">'; |
---|
509 | echo '<a class="media-icon media-link" href="'.$gal_thumb->file_url.'"><img src="'.$gal_thumb->media_icon.'" /></a>'; |
---|
510 | echo '<form action="plugin.php?p=gallery&m=galthumb" method="post">'; |
---|
511 | echo '<ul>'; |
---|
512 | echo '<li>'.$gal_thumb->basename.'</li>'; |
---|
513 | echo '<li>'.$gal_thumb->media_dtstr.' - '. files::size($gal_thumb->size).' - '. |
---|
514 | '<a href="'.$change_thumb_url.'">'.__('Change').'</a></li>'. |
---|
515 | '<li><input type="image" src="images/minus.png" alt="'.__('Remove').'" style="border: 0px;" '. |
---|
516 | 'title="'.__('Remove').'" /> '.__('Remove').' '. |
---|
517 | form::hidden('gal_id',$post_id). |
---|
518 | form::hidden('detach',1).$core->formNonce(). |
---|
519 | '</form></li></ul>'; |
---|
520 | echo '</div>'; |
---|
521 | } else { |
---|
522 | echo '<p>'.__('This gallery has no presentation thumbnail').'</p>'; |
---|
523 | echo '<p><a href="'.$change_thumb_url.'">'.__('Define one').'</a>'.'</p>'; |
---|
524 | } |
---|
525 | $gal_nb_img_txt = ($gal_nb_img > 1) ? __("This gallery has %d images"):__("This gallery has %d image"); |
---|
526 | echo '</div>'. |
---|
527 | '<div class="col">'. |
---|
528 | "<h3>".__('Images')."</h3>". |
---|
529 | '<p>'.sprintf($gal_nb_img_txt,$gal_nb_img).'</p>'. |
---|
530 | '</div>'. |
---|
531 | '</div>'; |
---|
532 | echo "</fieldset>"; |
---|
533 | } |
---|
534 | |
---|
535 | |
---|
536 | /* Post form if we can edit post |
---|
537 | -------------------------------------------------------- */ |
---|
538 | if ($can_edit_post) |
---|
539 | { |
---|
540 | |
---|
541 | echo '<form action="plugin.php?p=gallery&m=gal" method="post" id="entry-form">'; |
---|
542 | echo '<div id="entry-sidebar">'; |
---|
543 | |
---|
544 | echo '<p><label>'.__('Category:'). |
---|
545 | form::combo('cat_id',$categories_combo,$cat_id,'maximal',3). |
---|
546 | '</label></p>'. |
---|
547 | |
---|
548 | '<p><label>'.__('Gallery status:'). |
---|
549 | form::combo('post_status',$status_combo,$post_status,'',3,!$can_publish). |
---|
550 | '</label></p>'. |
---|
551 | |
---|
552 | '<p><label>'.__('Published on:'). |
---|
553 | form::field('post_dt',16,16,$post_dt,'',3). |
---|
554 | '</label></p>'. |
---|
555 | |
---|
556 | '<p><label>'.__('Text formating:'). |
---|
557 | form::combo('post_format',$formaters_combo,$post_format,'',3). |
---|
558 | ($post_id && $post_format != 'xhtml' ? '<a href="plugin.php?p=gallery&m=gal&id='.$post_id.'&xconv=1">'.__('Convert to XHTML').'</a>' : ''). |
---|
559 | '</label></p>'. |
---|
560 | |
---|
561 | '<p><label class="classic">'.form::checkbox('post_open_comment',1,$post_open_comment,'',3).' '. |
---|
562 | __('Accept comments').'</label></p>'. |
---|
563 | '<p><label class="classic">'.form::checkbox('post_open_tb',1,$post_open_tb,'',3).' '. |
---|
564 | __('Accept trackbacks').'</label></p>'. |
---|
565 | '<p><label class="classic">'.form::checkbox('post_selected',1,$post_selected,'',3).' '. |
---|
566 | __('Selected gallery').'</label></p>'. |
---|
567 | |
---|
568 | '<p><label>'.__('Gallery password:'). |
---|
569 | form::field('post_password',10,32,html::escapeHTML($post_password),'maximal',3). |
---|
570 | '</label></p>'. |
---|
571 | |
---|
572 | '<div class="lockable">'. |
---|
573 | '<p><label>'.__('Basename:'). |
---|
574 | form::field('post_url',10,255,html::escapeHTML($post_url),'maximal',3). |
---|
575 | '</label></p>'. |
---|
576 | '<p class="form-note warn">'. |
---|
577 | __('Warning: If you set the URL manually, it may conflict with another entry.'). |
---|
578 | '</p>'. |
---|
579 | '</div>'. |
---|
580 | |
---|
581 | '<p><label>'.__('Entry lang:'). |
---|
582 | form::field('post_lang',5,255,html::escapeHTML($post_lang),'',3). |
---|
583 | '</label></p>'; |
---|
584 | if (isset($post)) |
---|
585 | tagsBehaviors::tagsField($post); |
---|
586 | |
---|
587 | # --BEHAVIOR-- adminGalleryFormSidebar |
---|
588 | $core->callBehavior('adminGalleryFormSidebar',isset($post) ? $post : null); |
---|
589 | |
---|
590 | echo '</div>'; // End #entry-sidebar |
---|
591 | |
---|
592 | echo '<div id="entry-content"><fieldset class="constrained">'; |
---|
593 | |
---|
594 | echo |
---|
595 | '<p class="col"><label class="required" title="'.__('Required field').'">'.__('Title:'). |
---|
596 | form::field('post_title',20,255,html::escapeHTML($post_title),'maximal',2). |
---|
597 | '</label></p>'. |
---|
598 | |
---|
599 | "<fieldset><legend>".__('Settings')."</legend>". |
---|
600 | '<div class="two-cols">'. |
---|
601 | '<div class="col">'. |
---|
602 | "<h3>".__('Filters')."</h3>". |
---|
603 | "<p>".__('Select below the image filters you wish to set for this gallery (at least 1 must be selected)')."</p>". |
---|
604 | '<p><label class="classic">'.form::checkbox('c_media_dir',1,$c_media_dir,"disablenext").'</label><label class="classic">'. |
---|
605 | __('Media dir')." : ".form::combo('f_media_dir',$dirs_combo,$f_media_dir).'</label>'. |
---|
606 | '<br /><label class="classic" style="margin-left: 20px;">'.form::checkbox('f_recurse_dir',1,$f_recurse_dir).__('include subdirs').'</label></p>'. |
---|
607 | '<p><label class="classic">'.form::checkbox('c_tag',1,$c_tag,"disablenext").'</label><label class="classic">'. |
---|
608 | __('Tag')." : ".form::field('f_tag',20,100,$f_tag,'',2).'</label></p>'. |
---|
609 | '<p><label class="classic">'.form::checkbox('c_cat',1,$c_cat,"disablenext").'</label><label class="classic">'. |
---|
610 | __('Category')." : ".form::combo('f_cat',$categories_combo,$f_cat).'</label>'. |
---|
611 | '<br /><label class="classic" style="margin-left: 20px;">'.form::checkbox('f_sub_cat',1,$f_sub_cat).__('Include sub-categories').'</label></p>'. |
---|
612 | '<p><label class="classic">'.form::checkbox('c_user',1,$c_user,"disablenext").'</label><label class="classic">'. |
---|
613 | __('User')." : ".form::field('f_user',20,20,$f_user,'',2).'</label></p>'. |
---|
614 | "</div>". |
---|
615 | '<div class="col">'. |
---|
616 | "<h3>".__('Order')."</h3>". |
---|
617 | '<p><label class="classic">'.__('Order')." : ".form::combo('f_orderby',$orderby_combo,$f_orderby).'</label></p>'. |
---|
618 | '<p><label class="classic">'.__('Sort')." : ".form::combo('f_sortby',$sortby_combo,$f_sortby).'</label></p>'. |
---|
619 | "<h3>".__('Theme')."</h3>". |
---|
620 | '<p><label class="classic">'.__('Gallery theme')." : ".form::combo('f_theme',$themes,$f_theme).'</label></p>'. |
---|
621 | '<p><label class="classic">'.__('Gallery integrated theme')." : ".form::combo('f_themeinteg',$themes_integ,$f_themeinteg).'</label></p>'. |
---|
622 | '</div>'. |
---|
623 | '</div>'. |
---|
624 | "</fieldset>". |
---|
625 | |
---|
626 | '<p class="area" id="excerpt-area"><label for="post_excerpt">'.__('Excerpt:'). |
---|
627 | '</label> '. |
---|
628 | form::textarea('post_excerpt',50,5,html::escapeHTML($post_excerpt),'',2). |
---|
629 | '</p>'. |
---|
630 | |
---|
631 | '<p class="area" id="content-area"><label '. |
---|
632 | 'for="post_content">'.__('Content:').'</label> '. |
---|
633 | form::textarea('post_content',50,$core->auth->getOption('edit_size'),html::escapeHTML($post_content),'',2). |
---|
634 | '</p>'. |
---|
635 | |
---|
636 | '<p class="area" id="notes-area"><label>'.__('Notes:').'</label>'. |
---|
637 | form::textarea('post_notes',50,5,html::escapeHTML($post_notes),'',2). |
---|
638 | '</p>'; |
---|
639 | |
---|
640 | # --BEHAVIOR-- adminGalleryForm |
---|
641 | $core->callBehavior('adminGalleryForm',isset($post) ? $post : null); |
---|
642 | |
---|
643 | |
---|
644 | echo |
---|
645 | '<p>'. |
---|
646 | ($post_id ? form::hidden('id',$post_id) : ''). |
---|
647 | $core->formNonce(). |
---|
648 | '<input type="submit" value="'.__('save').' (s)" tabindex="4" '. |
---|
649 | 'accesskey="s" name="save" /> '. |
---|
650 | '</p>'; |
---|
651 | |
---|
652 | |
---|
653 | echo '</fieldset></div>'; // End #entry-content |
---|
654 | echo '</form>'; |
---|
655 | |
---|
656 | /*if ($post_id && $post->post_status == 1) { |
---|
657 | echo '<br /><p><a href="trackbacks.php?id='.$post_id.'" class="multi-part">'. |
---|
658 | __('Ping blogs').'</a></p>'; |
---|
659 | }*/ |
---|
660 | |
---|
661 | if ($post_id && !empty($post_media)) |
---|
662 | { |
---|
663 | echo |
---|
664 | '<form action="post_media.php" id="attachment-remove-hide" method="post">'. |
---|
665 | '<div>'.form::hidden(array('post_id'),$post_id). |
---|
666 | form::hidden(array('media_id'),''). |
---|
667 | $core->formNonce(). |
---|
668 | form::hidden(array('remove'),1).'</div></form>'; |
---|
669 | } |
---|
670 | } // if canedit post |
---|
671 | echo '</div>'; |
---|
672 | echo '<p><a href="plugin.php?p=gallery&m=items" class="multi-part">'.__('Images').'</a></p>'; |
---|
673 | echo '<p><a href="plugin.php?p=gallery&m=newitems" class="multi-part">'.__('Manage new items').'</a></p>'; |
---|
674 | echo '<p><a href="plugin.php?p=gallery&m=options" class="multi-part">'.__('Options').'</a></p>'; |
---|
675 | if ($core->auth->isSuperAdmin()) |
---|
676 | echo '<p><a href="plugin.php?p=gallery&m=maintenance" class="multi-part">'.__('Maintenance').'</a></p>'; |
---|
677 | ?> |
---|
678 | |
---|
679 | |
---|
680 | </body> |
---|
681 | </html> |
---|