Dotclear

source: admin/media_item.php @ 2751:a96ec5640056

Revision 2751:a96ec5640056, 21.8 KB checked in by Nicolas <nikrou77@…>, 11 years ago (diff)

Each editor (ckeditor, legacy ones) loads its own context when it is active.
Add plugin_id parameter to transmit that context
Remove call of ckeditorExtraPlugins behavior until a good solution is found.
Closes #1983

Line 
1<?php
2# -- BEGIN LICENSE BLOCK ---------------------------------------
3#
4# This file is part of Dotclear 2.
5#
6# Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear
7# Licensed under the GPL version 2.0 license.
8# See LICENSE file or
9# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
10#
11# -- END LICENSE BLOCK -----------------------------------------
12
13require dirname(__FILE__).'/../inc/admin/prepend.php';
14
15dcPage::check('media,media_admin');
16
17$tab = empty($_REQUEST['tab']) ? '' : $_REQUEST['tab'];
18
19$post_id = !empty($_GET['post_id']) ? (integer) $_GET['post_id'] : null;
20if ($post_id) {
21     $post = $core->blog->getPosts(array('post_id'=>$post_id));
22     if ($post->isEmpty()) {
23          $post_id = null;
24     }
25     $post_title = $post->post_title;
26     unset($post);
27}
28
29$file = null;
30$popup = (integer) !empty($_GET['popup']);
31$plugin_id = isset($_REQUEST['plugin_id']) ? html::sanitizeURL($_REQUEST['plugin_id']) : '';
32$page_url = $core->adminurl->get("admin.media.item",array('popup' => $popup,'post_id' => $post_id));
33$media_page_url = $core->adminurl->get("admin.media",array('popup' => $popup,'post_id' => $post_id));
34
35$id = !empty($_REQUEST['id']) ? (integer) $_REQUEST['id'] : '';
36
37if ($popup) {
38     $open_f = array('dcPage','openPopup');
39     $close_f = array('dcPage','closePopup');
40} else {
41     $open_f = array('dcPage','open');
42     $close_f = create_function('',"dcPage::helpBlock('core_media'); dcPage::close();");
43}
44
45$core_media_writable = false;
46try
47{
48     $core->media = new dcMedia($core);
49
50     if ($id) {
51          $file = $core->media->getFile($id);
52     }
53
54     if ($file === null) {
55          throw new Exception(__('Not a valid file'));
56     }
57
58     $core->media->chdir(dirname($file->relname));
59     $core_media_writable = $core->media->writable();
60
61     # Prepare directories combo box
62     $dirs_combo = array();
63     foreach ($core->media->getDBDirs() as $v) {
64          $dirs_combo['/'.$v] = $v;
65     }
66     # Add parent and direct childs directories if any
67     $core->media->getFSDir();
68     foreach ($core->media->dir['dirs'] as $k => $v) {
69          $dirs_combo['/'.$v->relname] = $v->relname;
70     }
71     ksort($dirs_combo);
72}
73catch (Exception $e)
74{
75     $core->error->add($e->getMessage());
76}
77
78# Upload a new file
79if ($file && !empty($_FILES['upfile']) && $file->editable && $core_media_writable)
80{
81     try {
82          files::uploadStatus($_FILES['upfile']);
83          $core->media->uploadFile($_FILES['upfile']['tmp_name'],$file->basename,null,false,true);
84
85          dcPage::addSuccessNotice(__('File has been successfully updated.'));
86          http::redirect($page_url.'&id='.$id.'&plugin_id='.$plugin_id);
87     } catch (Exception $e) {
88          $core->error->add($e->getMessage());
89     }
90}
91
92# Update file
93if ($file && !empty($_POST['media_file']) && $file->editable && $core_media_writable)
94{
95     $newFile = clone $file;
96
97     $newFile->basename = $_POST['media_file'];
98
99     if ($_POST['media_path']) {
100          $newFile->dir = $_POST['media_path'];
101          $newFile->relname = $_POST['media_path'].'/'.$newFile->basename;
102     } else {
103          $newFile->dir = '';
104          $newFile->relname = $newFile->basename;
105     }
106     $newFile->media_title = $_POST['media_title'];
107     $newFile->media_dt = strtotime($_POST['media_dt']);
108     $newFile->media_dtstr = $_POST['media_dt'];
109     $newFile->media_priv = !empty($_POST['media_private']);
110
111     try {
112          $core->media->updateFile($file,$newFile);
113
114          dcPage::addSuccessNotice(__('File has been successfully updated.'));
115          http::redirect($page_url.'&id='.$id.'&plugin_id='.$plugin_id.'&tab=media-details-tab');
116     } catch (Exception $e) {
117          $core->error->add($e->getMessage());
118     }
119}
120
121# Update thumbnails
122if (!empty($_POST['thumbs']) && $file->media_type == 'image' && $file->editable && $core_media_writable)
123{
124     try {
125          $foo = null;
126          $core->media->mediaFireRecreateEvent($file);
127
128          dcPage::addSuccessNotice(__('Thumbnails have been successfully updated.'));
129          http::redirect($page_url.'&id='.$id.'&plugin_id='.$plugin_id.'&tab=media-details-tab');
130     } catch (Exception $e) {
131          $core->error->add($e->getMessage());
132     }
133}
134
135# Unzip file
136if (!empty($_POST['unzip']) && $file->type == 'application/zip' && $file->editable && $core_media_writable)
137{
138     try {
139          $unzip_dir = $core->media->inflateZipFile($file,$_POST['inflate_mode'] == 'new');
140
141          dcPage::addSuccessNotice(__('Zip file has been successfully extracted.'));
142          http::redirect($media_page_url.'&d='.$unzip_dir.'&plugin_id='.$plugin_id);
143     } catch (Exception $e) {
144          $core->error->add($e->getMessage());
145     }
146}
147
148# Save media insertion settings for the blog
149if (!empty($_POST['save_blog_prefs']))
150{
151     if (!empty($_POST['pref_src'])) {
152          foreach (array_reverse($file->media_thumb) as $s => $v) {
153               if ($v == $_POST['pref_src']) {
154                    $core->blog->settings->system->put('media_img_default_size',$s);
155                    break;
156               }
157          }
158     }
159     if (!empty($_POST['pref_alignment'])) {
160          $core->blog->settings->system->put('media_img_default_alignment',$_POST['pref_alignment']);
161     }
162     if (!empty($_POST['pref_insertion'])) {
163          $core->blog->settings->system->put('media_img_default_link',($_POST['pref_insertion'] == 'link'));
164     }
165
166     dcPage::addSuccessNotice(__('Default media insertion settings have been successfully updated.'));
167     http::redirect($page_url.'&id='.$id.'&plugin_id='.$plugin_id);
168}
169
170# Function to get image title based on meta
171function dcGetImageTitle($file,$pattern,$dto_first=false)
172{
173     $res = array();
174     $pattern = preg_split('/\s*;;\s*/',$pattern);
175     $sep = ', ';
176
177     foreach ($pattern as $v) {
178          if ($v == 'Title') {
179               if ($file->media_title != '') {
180                    $res[] = $file->media_title;
181               }
182          } elseif ($file->media_meta->{$v}) {
183               if ((string) $file->media_meta->{$v} != '') {
184                    $res[] = (string) $file->media_meta->{$v};
185               }
186          } elseif (preg_match('/^Date\((.+?)\)$/u',$v,$m)) {
187               if ($dto_first && ($file->media_meta->DateTimeOriginal != 0)) {
188                    $res[] = dt::dt2str($m[1],(string) $file->media_meta->DateTimeOriginal);
189               } else {
190                    $res[] = dt::str($m[1],$file->media_dt);
191               }
192          } elseif (preg_match('/^DateTimeOriginal\((.+?)\)$/u',$v,$m) && $file->media_meta->DateTimeOriginal) {
193               $res[] = dt::dt2str($m[1],(string) $file->media_meta->DateTimeOriginal);
194          } elseif (preg_match('/^separator\((.*?)\)$/u',$v,$m)) {
195               $sep = $m[1];
196          }
197     }
198     return implode($sep,$res);
199}
200
201/* DISPLAY Main page
202-------------------------------------------------------- */
203$starting_scripts =
204     '<script type="text/javascript">'."\n".
205     "//<![CDATA["."\n".
206     dcPage::jsVar('dotclear.msg.confirm_delete_media',__('Are you sure to delete this media?'))."\n".
207     "//]]>".
208     "</script>".
209     dcPage::jsLoad('js/_media_item.js');
210if ($popup && !empty($plugin_id)) {
211     $starting_scripts .= $core->callBehavior('adminPopupMedia', $plugin_id);
212}
213call_user_func($open_f,__('Media manager'),
214     $starting_scripts.
215     dcPage::jsDatePicker().
216     ($popup ? dcPage::jsPageTabs($tab) : ''),
217     dcPage::breadcrumb(
218          array(
219               html::escapeHTML($core->blog->name) => '',
220               __('Media manager') => html::escapeURL($media_page_url).'&amp;d=',
221               $core->media->breadCrumb(html::escapeURL($media_page_url).'&amp;d=%s').'<span class="page-title">'.$file->basename.'</span>' => ''
222          ),
223          array(
224               'home_link' => !$popup,
225               'hl' => false
226          )
227     )
228);
229
230if ($popup) {
231     // Display notices
232     echo dcPage::notices();
233}
234
235if ($file === null) {
236     call_user_func($close_f);
237     exit;
238}
239
240if (!empty($_GET['fupd']) || !empty($_GET['fupl'])) {
241     dcPage::success(__('File has been successfully updated.'));
242}
243if (!empty($_GET['thumbupd'])) {
244     dcPage::success(__('Thumbnails have been successfully updated.'));
245}
246if (!empty($_GET['blogprefupd'])) {
247     dcPage::success(__('Default media insertion settings have been successfully updated.'));
248}
249
250# Insertion popup
251if ($popup)
252{
253     $media_desc = $file->media_title;
254
255     echo
256     '<div id="media-insert" class="multi-part" title="'.__('Insert media item').'">'.
257     '<h3>'.__('Insert media item').'</h3>'.
258     '<form id="media-insert-form" action="" method="get">';
259
260     $media_img_default_size = $core->blog->settings->system->media_img_default_size;
261     if ($media_img_default_size == '') {
262          $media_img_default_size = 'm';
263     }
264     $media_img_default_alignment = $core->blog->settings->system->media_img_default_alignment;
265     if ($media_img_default_alignment == '') {
266          $media_img_default_alignment = 'none';
267     }
268     $media_img_default_link = (boolean)$core->blog->settings->system->media_img_default_link;
269
270     if ($file->media_type == 'image')
271     {
272          $media_type = 'image';
273          $media_desc = dcGetImageTitle($file,
274               $core->blog->settings->system->media_img_title_pattern,
275               $core->blog->settings->system->media_img_use_dto_first);
276          if ($media_desc == $file->basename) {
277               $media_desc = '';
278          }
279
280          echo
281          '<h3>'.__('Image size:').'</h3> ';
282
283          $s_checked = false;
284          echo '<p>';
285          foreach (array_reverse($file->media_thumb) as $s => $v) {
286               $s_checked = ($s == $media_img_default_size);
287               echo '<label class="classic">'.
288               form::radio(array('src'),html::escapeHTML($v),$s_checked).' '.
289               $core->media->thumb_sizes[$s][2].'</label><br /> ';
290          }
291          $s_checked = (!isset($file->media_thumb[$media_img_default_size]));
292          echo '<label class="classic">'.
293          form::radio(array('src'),$file->file_url,$s_checked).' '.__('original').'</label><br /> ';
294          echo '</p>';
295
296          echo
297          '<div class="two-boxes">'.
298          '<h3>'.__('Image alignment').'</h3>';
299          $i_align = array(
300               'none' => array(__('None'),($media_img_default_alignment == 'none' ? 1 : 0)),
301               'left' => array(__('Left'),($media_img_default_alignment == 'left' ? 1 : 0)),
302               'right' => array(__('Right'),($media_img_default_alignment == 'right' ? 1 : 0)),
303               'center' => array(__('Center'),($media_img_default_alignment == 'center' ? 1 : 0))
304          );
305
306          echo '<p>';
307          foreach ($i_align as $k => $v) {
308               echo '<label class="classic">'.
309               form::radio(array('alignment'),$k,$v[1]).' '.$v[0].'</label><br /> ';
310          }
311          echo '</p>';
312          echo '</div>';
313
314          echo
315          '<div class="two-boxes">'.
316          '<h3>'.__('Image insertion').'</h3>'.
317          '<p>'.
318          '<label for="insert1" class="classic">'.form::radio(array('insertion','insert1'),'simple',!$media_img_default_link).
319          __('As a single image').'</label><br />'.
320          '<label for="insert2" class="classic">'.form::radio(array('insertion','insert2'),'link',$media_img_default_link).
321          __('As a link to the original image').'</label>'.
322          '</p>'.
323          '</div>';
324     }
325     elseif ($file->type == 'audio/mpeg3')
326     {
327          $media_type = 'mp3';
328
329          echo
330          '<div class="two-boxes">'.
331          '<h3>'.__('MP3 disposition').'</h3>';
332          dcPage::message(__("Please note that you cannot insert mp3 files with visual editor."),false);
333
334          $i_align = array(
335               'none' => array(__('None'),($media_img_default_alignment == 'none' ? 1 : 0)),
336               'left' => array(__('Left'),($media_img_default_alignment == 'left' ? 1 : 0)),
337               'right' => array(__('Right'),($media_img_default_alignment == 'right' ? 1 : 0)),
338               'center' => array(__('Center'),($media_img_default_alignment == 'center' ? 1 : 0))
339          );
340
341          echo '<p>';
342          foreach ($i_align as $k => $v) {
343               echo '<label class="classic">'.
344               form::radio(array('alignment'),$k,$v[1]).' '.$v[0].'</label><br /> ';
345          }
346
347          $public_player_style = unserialize($core->blog->settings->themes->mp3player_style);
348          $public_player = dcMedia::mp3player($file->file_url,$core->blog->getQmarkURL().'pf=player_mp3.swf',$public_player_style);
349          echo form::hidden('public_player',html::escapeHTML($public_player));
350          echo '</p>';
351          echo '</div>';
352     }
353     elseif ($file->type == 'video/x-flv' || $file->type == 'video/mp4' || $file->type == 'video/x-m4v')
354     {
355          $media_type = 'flv';
356
357          dcPage::message(__("Please note that you cannot insert video files with visual editor."),false);
358
359          echo
360          '<div class="two-boxes">'.
361          '<h3>'.__('Video size').'</h3>'.
362          '<p><label for="video_w" class="classic">'.__('Width:').'</label> '.
363          form::field('video_w',3,4,400).'  '.
364          '<label for="video_h" class="classic">'.__('Height:').'</label> '.
365          form::field('video_h',3,4,300).
366          '</p>'.
367          '</div>';
368
369
370          echo
371          '<div class="two-boxes">'.
372          '<h3>'.__('Video disposition').'</h3>';
373
374          $i_align = array(
375               'none' => array(__('None'),($media_img_default_alignment == 'none' ? 1 : 0)),
376               'left' => array(__('Left'),($media_img_default_alignment == 'left' ? 1 : 0)),
377               'right' => array(__('Right'),($media_img_default_alignment == 'right' ? 1 : 0)),
378               'center' => array(__('Center'),($media_img_default_alignment == 'center' ? 1 : 0))
379          );
380
381          echo '<p>';
382          foreach ($i_align as $k => $v) {
383               echo '<label class="classic">'.
384               form::radio(array('alignment'),$k,$v[1]).' '.$v[0].'</label><br /> ';
385          }
386
387          $public_player_style = unserialize($core->blog->settings->themes->flvplayer_style);
388          $public_player = dcMedia::flvplayer($file->file_url,$core->blog->getQmarkURL().'pf=player_flv.swf',$public_player_style);
389          echo form::hidden('public_player',html::escapeHTML($public_player));
390          echo '</p>';
391          echo '</div>';
392     }
393     else
394     {
395          $media_type = 'default';
396          echo '<p>'.__('Media item will be inserted as a link.').'</p>';
397     }
398
399     echo
400     '<p>'.
401     '<a id="media-insert-ok" class="button submit" href="#">'.__('Insert').'</a> '.
402     '<a id="media-insert-cancel" class="button" href="#">'.__('Cancel').'</a>'.
403     form::hidden(array('type'),html::escapeHTML($media_type)).
404     form::hidden(array('title'),html::escapeHTML($file->media_title)).
405     form::hidden(array('description'),html::escapeHTML($media_desc)).
406     form::hidden(array('url'),$file->file_url).
407     '</p>';
408
409     echo '</form>';
410
411     if ($media_type != 'default') {
412          echo
413          '<div class="border-top">'.
414          '<form id="save_settings" action="'.html::escapeURL($page_url).'" method="post">'.
415          '<p>'.__('Make current settings as default').' '.
416          '<input class="reset" type="submit" name="save_blog_prefs" value="'.__('OK').'" />'.
417          form::hidden(array('pref_src'),'').
418          form::hidden(array('pref_alignment'),'').
419          form::hidden(array('pref_insertion'),'').
420          form::hidden(array('id'),$id).
421          form::hidden(array('plugin_id'),$plugin_id).
422          $core->formNonce().'</p>'.
423          '</form>'.'</div>';
424     }
425
426     echo '</div>';
427}
428
429if ($popup) {
430     echo
431     '<div class="multi-part" title="'.__('Media details').'" id="media-details-tab">';
432} else {
433     echo '<h3 class="out-of-screen-if-js">'.__('Media details').'</h3>';
434}
435echo
436'<p id="media-icon"><img src="'.$file->media_icon.'?'.time()*rand().'" alt="" /></p>';
437
438echo
439'<div id="media-details">'.
440'<div class="near-icon">';
441
442if ($file->media_image)
443{
444     $thumb_size = !empty($_GET['size']) ? $_GET['size'] : 's';
445
446     if (!isset($core->media->thumb_sizes[$thumb_size]) && $thumb_size != 'o') {
447          $thumb_size = 's';
448     }
449
450     if (isset($file->media_thumb[$thumb_size])) {
451          echo '<p><img src="'.$file->media_thumb[$thumb_size].'?'.time()*rand().'" alt="" /></p>';
452     } elseif ($thumb_size == 'o') {
453          $S = getimagesize($file->file);
454          $class = ($S[1] > 500) ? ' class="overheight"' : '';
455          unset($S);
456          echo '<p id="media-original-image"'.$class.'><img src="'.$file->file_url.'?'.time()*rand().'" alt="" /></p>';
457     }
458
459     echo '<p>'.__('Available sizes:').' ';
460     foreach (array_reverse($file->media_thumb) as $s => $v)
461     {
462          $strong_link = ($s == $thumb_size) ? '<strong>%s</strong>' : '%s';
463          printf($strong_link,'<a href="'.html::escapeURL($page_url).
464          '&amp;id='.$id.'&amp;plugin_id='.$plugin_id.'&amp;size='.$s.'&amp;tab=media-details-tab">'.$core->media->thumb_sizes[$s][2].'</a> | ');
465     }
466     echo '<a href="'.html::escapeURL($page_url).'&amp;id='.$id.'&amp;plugin_id='.$plugin_id.'&amp;size=o&amp;tab=media-details-tab">'.__('original').'</a>';
467     echo '</p>';
468}
469
470if ($file->type == 'audio/mpeg3')
471{
472     echo dcMedia::mp3player($file->file_url,$core->adminurl->get("admin.home",array('pf' => 'player_mp3.swf')));
473}
474
475if ($file->type == 'video/x-flv' || $file->type == 'video/mp4' || $file->type == 'video/x-m4v')
476{
477     echo dcMedia::flvplayer($file->file_url,$core->adminurl->get("admin.home",array('pf' => 'player_flv.swf')));
478}
479
480echo
481'<h3>'.__('Media details').'</h3>'.
482'<ul>'.
483     '<li><strong>'.__('File owner:').'</strong> '.$file->media_user.'</li>'.
484     '<li><strong>'.__('File type:').'</strong> '.$file->type.'</li>'.
485     '<li><strong>'.__('File size:').'</strong> '.files::size($file->size).'</li>'.
486     '<li><strong>'.__('File URL:').'</strong> <a href="'.$file->file_url.'">'.$file->file_url.'</a></li>'.
487'</ul>';
488
489if (empty($_GET['find_posts']))
490{
491     echo
492     '<p><a class="button" href="'.html::escapeHTML($page_url).'&amp;id='.$id.'&plugin_id='.$plugin_id.'&amp;find_posts=1&amp;tab=media-details-tab">'.
493     __('Show entries containing this media').'</a></p>';
494}
495else
496{
497     echo '<h3>'.__('Entries containing this media').'</h3>';
498     $params = array(
499          'post_type' => '',
500          'from' => 'LEFT OUTER JOIN '.$core->prefix.'post_media PM ON P.post_id = PM.post_id ',
501          'sql' => 'AND ('.
502               'PM.media_id = '.(integer) $id.' '.
503               "OR post_content_xhtml LIKE '%".$core->con->escape($file->relname)."%' ".
504               "OR post_excerpt_xhtml LIKE '%".$core->con->escape($file->relname)."%' "
505     );
506
507     if ($file->media_image)
508     { # We look for thumbnails too
509          if (preg_match('#^http(s)?://#',$core->blog->settings->system->public_url)) {
510               $media_root = $core->blog->settings->system->public_url;
511          } else {
512               $media_root = $core->blog->host.path::clean($core->blog->settings->system->public_url).'/';
513          }
514          foreach ($file->media_thumb as $v) {
515               $v = preg_replace('/^'.preg_quote($media_root,'/').'/','',$v);
516               $params['sql'] .= "OR post_content_xhtml LIKE '%".$core->con->escape($v)."%' ";
517               $params['sql'] .= "OR post_excerpt_xhtml LIKE '%".$core->con->escape($v)."%' ";
518          }
519     }
520
521     $params['sql'] .= ') ';
522
523     $rs = $core->blog->getPosts($params);
524
525     if ($rs->isEmpty())
526     {
527          echo '<p>'.__('No entry seems contain this media.').'</p>';
528     }
529     else
530     {
531          echo '<ul>';
532          while ($rs->fetch()) {
533               $img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />';
534               switch ($rs->post_status) {
535                    case 1:
536                         $img_status = sprintf($img,__('published'),'check-on.png');
537                         break;
538                    case 0:
539                         $img_status = sprintf($img,__('unpublished'),'check-off.png');
540                         break;
541                    case -1:
542                         $img_status = sprintf($img,__('scheduled'),'scheduled.png');
543                         break;
544                    case -2:
545                         $img_status = sprintf($img,__('pending'),'check-wrn.png');
546                         break;
547               }
548               echo '<li>'.$img_status.' '.'<a href="'.$core->getPostAdminURL($rs->post_type,$rs->post_id).'">'.
549                    $rs->post_title.'</a>'.
550                    ($rs->post_type != 'post' ? ' ('.html::escapeHTML($rs->post_type).')' : '').
551                    ' - '.dt::dt2str(__('%Y-%m-%d %H:%M'),$rs->post_dt).'</li>';
552          }
553          echo '</ul>';
554     }
555}
556
557if ($file->type == 'image/jpeg')
558{
559     echo '<h3>'.__('Image details').'</h3>';
560
561     $details = '';
562     if (count($file->media_meta) > 0)
563     {
564          foreach ($file->media_meta as $k => $v)
565          {
566               if ((string) $v) {
567                    $details .= '<li><strong>'.$k.':</strong> '.html::escapeHTML($v).'</li>';
568               }
569          }
570     }
571     if ($details) {
572          echo '<ul>'.$details.'</ul>';
573     } else {
574          echo '<p>'.__('No detail').'</p>';
575     }
576}
577
578echo '</div>';
579
580echo '<h3>'.__('Updates and modifications').'</h3>';
581
582if ($file->editable && $core_media_writable)
583{
584     if ($file->media_type == 'image')
585     {
586          echo
587          '<form class="clear fieldset" action="'.html::escapeURL($page_url).'" method="post">'.
588          '<h4>'.__('Update thumbnails').'</h4>'.
589          '<p>'.__('This will create or update thumbnails for this image.').'</p>'.
590          '<p><input type="submit" name="thumbs" value="'.__('Update thumbnails').'" />'.
591          form::hidden(array('id'),$id).
592          form::hidden(array('plugin_id'),$plugin_id).
593          $core->formNonce().'</p>'.
594          '</form>';
595     }
596
597     if ($file->type == 'application/zip')
598     {
599          $inflate_combo = array(
600               __('Extract in a new directory') => 'new',
601               __('Extract in current directory') => 'current'
602          );
603
604          echo
605          '<form class="clear fieldset" id="file-unzip" action="'.html::escapeURL($page_url).'" method="post">'.
606          '<h4>'.__('Extract archive').'</h4>'.
607          '<ul>'.
608          '<li><strong>'.__('Extract in a new directory').'</strong> : '.
609          __('This will extract archive in a new directory that should not exist yet.').'</li>'.
610          '<li><strong>'.__('Extract in current directory').'</strong> : '.
611          __('This will extract archive in current directory and will overwrite existing files or directory.').'</li>'.
612          '</ul>'.
613          '<p><label for="inflate_mode" class="classic">'.__('Extract mode:').'</label> '.
614          form::combo('inflate_mode',$inflate_combo,'new').
615          '<input type="submit" name="unzip" value="'.__('Extract').'" />'.
616          form::hidden(array('id'),$id).
617          form::hidden(array('plugin_id'),$plugin_id).
618          $core->formNonce().'</p>'.
619          '</form>';
620     }
621
622     echo
623     '<form class="clear fieldset" action="'.html::escapeURL($page_url).'" method="post">'.
624     '<h4>'.__('Change media properties').'</h4>'.
625     '<p><label for="media_file">'.__('File name:').'</label>'.
626     form::field('media_file',30,255,html::escapeHTML($file->basename)).'</p>'.
627     '<p><label for="media_title">'.__('File title:').'</label>'.
628     form::field('media_title',30,255,html::escapeHTML($file->media_title)).'</p>'.
629     '<p><label for="media_dt">'.__('File date:').'</label>'.
630     form::field('media_dt',16,16,html::escapeHTML($file->media_dtstr)).'</p>'.
631     '<p><label for="media_private" class="classic">'.form::checkbox('media_private',1,$file->media_priv).' '.
632     __('Private').'</label></p>'.
633     '<p><label for="media_path">'.__('New directory:').'</label>'.
634     form::combo('media_path',$dirs_combo,dirname($file->relname)).'</p>'.
635     '<p><input type="submit" accesskey="s" value="'.__('Save').'" />'.
636     form::hidden(array('id'),$id).
637     form::hidden(array('plugin_id'),$plugin_id).
638     $core->formNonce().'</p>'.
639     '</form>';
640
641     echo
642     '<form class="clear fieldset" action="'.html::escapeURL($page_url).'" method="post" enctype="multipart/form-data">'.
643     '<h4>'.__('Change file').'</h4>'.
644     '<div>'.form::hidden(array('MAX_FILE_SIZE'),DC_MAX_UPLOAD_SIZE).'</div>'.
645     '<p><label for="upfile">'.__('Choose a file:').
646     ' ('.sprintf(__('Maximum size %s'),files::size(DC_MAX_UPLOAD_SIZE)).') '.
647     '<input type="file" id="upfile" name="upfile" size="35" />'.
648     '</label></p>'.
649     '<p><input type="submit" value="'.__('Send').'" />'.
650     form::hidden(array('id'),$id).
651     form::hidden(array('plugin_id'),$plugin_id).
652     $core->formNonce().'</p>'.
653     '</form>';
654
655     if ($file->del) {
656          echo
657          '<form id="delete-form" method="post" action="'.html::escapeURL($media_page_url).
658          '&amp;d='.rawurlencode(dirname($file->relname)).
659          '&amp;plugin_id='.$plugin_id.
660          '&amp;remove='.rawurlencode($file->basename).'">'.
661          '<p><input name="delete" type="submit" class="delete" value="'.__('Delete this media').'" />'.
662          form::hidden('remove',rawurlencode($file->basename)).
663          form::hidden('rmyes',1).
664          $core->formNonce().'</p>'.
665          '</form>';
666     }
667
668
669     # --BEHAVIOR-- adminMediaItemForm
670     $core->callBehavior('adminMediaItemForm',$file);
671}
672
673echo
674'</div>';
675if ($popup) {
676     echo
677     '</div>';
678}
679
680call_user_func($close_f);
Note: See TracBrowser for help on using the repository browser.

Sites map