Dotclear

source: admin/media_item.php @ 2510:22eb32a28268

Revision 2510:22eb32a28268, 21.1 KB checked in by Anne Kozlika <kozlika@…>, 12 years ago (diff)

Displays media popup with columns. Closes #1837.
Add some margin over auth fieldset.

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

Sites map