Dotclear

source: admin/media_item.php @ 2256:d3c3fa1723ab

Revision 2256:d3c3fa1723ab, 20.9 KB checked in by Dsls, 12 years ago (diff)

updated most of notices to new format, should fix #1710 (maintenance and daInstaller still to be updated)

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         
292          echo '<h3>'.__('Image alignment').'</h3>';
293          $i_align = array(
294               'none' => array(__('None'),($media_img_default_alignment == 'none' ? 1 : 0)),
295               'left' => array(__('Left'),($media_img_default_alignment == 'left' ? 1 : 0)),
296               'right' => array(__('Right'),($media_img_default_alignment == 'right' ? 1 : 0)),
297               'center' => array(__('Center'),($media_img_default_alignment == 'center' ? 1 : 0))
298          );
299         
300          echo '<p>';
301          foreach ($i_align as $k => $v) {
302               echo '<label class="classic">'.
303               form::radio(array('alignment'),$k,$v[1]).' '.$v[0].'</label><br /> ';
304          }
305          echo '</p>';
306         
307          echo
308          '<h3>'.__('Image insertion').'</h3>'.
309          '<p>'.
310          '<label for="insert1" class="classic">'.form::radio(array('insertion','insert1'),'simple',!$media_img_default_link).
311          __('As a single image').'</label><br />'.
312          '<label for="insert2" class="classic">'.form::radio(array('insertion','insert2'),'link',$media_img_default_link).
313          __('As a link to the original image').'</label>'.
314          '</p>';
315     }
316     elseif ($file->type == 'audio/mpeg3')
317     {
318          $media_type = 'mp3';
319         
320          echo '<h3>'.__('MP3 disposition').'</h3>';
321          dcPage::message(__("Please note that you cannot insert mp3 files with visual editor."),false);
322         
323          $i_align = array(
324               'none' => array(__('None'),($media_img_default_alignment == 'none' ? 1 : 0)),
325               'left' => array(__('Left'),($media_img_default_alignment == 'left' ? 1 : 0)),
326               'right' => array(__('Right'),($media_img_default_alignment == 'right' ? 1 : 0)),
327               'center' => array(__('Center'),($media_img_default_alignment == 'center' ? 1 : 0))
328          );
329         
330          echo '<p>';
331          foreach ($i_align as $k => $v) {
332               echo '<label class="classic">'.
333               form::radio(array('alignment'),$k,$v[1]).' '.$v[0].'</label><br /> ';
334          }
335         
336          $public_player_style = unserialize($core->blog->settings->themes->mp3player_style);
337          $public_player = dcMedia::mp3player($file->file_url,$core->blog->getQmarkURL().'pf=player_mp3.swf',$public_player_style);
338          echo form::hidden('public_player',html::escapeHTML($public_player));
339          echo '</p>';
340     }
341     elseif ($file->type == 'video/x-flv' || $file->type == 'video/mp4' || $file->type == 'video/x-m4v')
342     {
343          $media_type = 'flv';
344         
345          dcPage::message(__("Please note that you cannot insert video files with visual editor."),false);
346         
347          echo
348          '<h3>'.__('Video size').'</h3>'.
349          '<p><label for="video_w" class="classic">'.__('Width:').'</label> '.
350          form::field('video_w',3,4,400).'  '.
351          '<label for="video_h" class="classic">'.__('Height:').'</label> '.
352          form::field('video_h',3,4,300).
353          '</p>';
354         
355          echo '<h3>'.__('Video disposition').'</h3>';
356         
357          $i_align = array(
358               'none' => array(__('None'),($media_img_default_alignment == 'none' ? 1 : 0)),
359               'left' => array(__('Left'),($media_img_default_alignment == 'left' ? 1 : 0)),
360               'right' => array(__('Right'),($media_img_default_alignment == 'right' ? 1 : 0)),
361               'center' => array(__('Center'),($media_img_default_alignment == 'center' ? 1 : 0))
362          );
363         
364          echo '<p>';
365          foreach ($i_align as $k => $v) {
366               echo '<label class="classic">'.
367               form::radio(array('alignment'),$k,$v[1]).' '.$v[0].'</label><br /> ';
368          }
369         
370          $public_player_style = unserialize($core->blog->settings->themes->flvplayer_style);
371          $public_player = dcMedia::flvplayer($file->file_url,$core->blog->getQmarkURL().'pf=player_flv.swf',$public_player_style);
372          echo form::hidden('public_player',html::escapeHTML($public_player));
373          echo '</p>';
374     }
375     else
376     {
377          $media_type = 'default';
378          echo '<p>'.__('Media item will be inserted as a link.').'</p>';
379     }
380
381     echo
382     '<p>'.
383     '<a id="media-insert-ok" class="button submit" href="#">'.__('Insert').'</a> '.
384     '<a id="media-insert-cancel" class="button" href="#">'.__('Cancel').'</a>'.
385     form::hidden(array('type'),html::escapeHTML($media_type)).
386     form::hidden(array('title'),html::escapeHTML($file->media_title)).
387     form::hidden(array('description'),html::escapeHTML($media_desc)).
388     form::hidden(array('url'),$file->file_url).
389     '</p>';
390     
391     echo '</form>';
392
393     if ($media_type != 'default') {
394          echo
395          '<div class="border-top">'.
396          '<form id="save_settings" action="'.html::escapeURL($page_url).'" method="post">'.
397          '<p>'.__('Make current settings as default').' '.
398          '<input class="reset" type="submit" name="save_blog_prefs" value="'.__('OK').'" />'.
399          form::hidden(array('pref_src'),'').
400          form::hidden(array('pref_alignment'),'').
401          form::hidden(array('pref_insertion'),'').
402          form::hidden(array('id'),$id).
403          $core->formNonce().'</p>'.
404          '</form>'.'</div>';
405     }
406
407     echo '</div>';
408}
409
410if ($popup) {
411     echo
412     '<div class="multi-part" title="'.__('Media details').'" id="media-details-tab">';
413} else {
414     echo '<h3 class="out-of-screen-if-js">'.__('Media details').'</h3>';
415}
416echo
417'<p id="media-icon"><img src="'.$file->media_icon.'?'.time()*rand().'" alt="" /></p>';
418
419echo
420'<div id="media-details">'.
421'<div class="near-icon">';
422
423if ($file->media_image)
424{
425     $thumb_size = !empty($_GET['size']) ? $_GET['size'] : 's';
426     
427     if (!isset($core->media->thumb_sizes[$thumb_size]) && $thumb_size != 'o') {
428          $thumb_size = 's';
429     }
430     
431     if (isset($file->media_thumb[$thumb_size])) {
432          echo '<p><img src="'.$file->media_thumb[$thumb_size].'?'.time()*rand().'" alt="" /></p>';
433     } elseif ($thumb_size == 'o') {
434          $S = getimagesize($file->file);
435          $class = ($S[1] > 500) ? ' class="overheight"' : '';
436          unset($S);
437          echo '<p id="media-original-image"'.$class.'><img src="'.$file->file_url.'?'.time()*rand().'" alt="" /></p>';
438     }
439     
440     echo '<p>'.__('Available sizes:').' ';
441     foreach (array_reverse($file->media_thumb) as $s => $v)
442     {
443          $strong_link = ($s == $thumb_size) ? '<strong>%s</strong>' : '%s';
444          printf($strong_link,'<a href="'.html::escapeURL($page_url).
445          '&amp;id='.$id.'&amp;size='.$s.'&amp;tab=media-details-tab">'.$core->media->thumb_sizes[$s][2].'</a> | ');
446     }
447     echo '<a href="'.html::escapeURL($page_url).'&amp;id='.$id.'&amp;size=o&amp;tab=media-details-tab">'.__('original').'</a>';
448     echo '</p>';
449}
450
451if ($file->type == 'audio/mpeg3')
452{
453     echo dcMedia::mp3player($file->file_url,'index.php?pf=player_mp3.swf');
454}
455
456if ($file->type == 'video/x-flv' || $file->type == 'video/mp4' || $file->type == 'video/x-m4v')
457{
458     echo dcMedia::flvplayer($file->file_url,'index.php?pf=player_flv.swf');
459}
460
461echo
462'<h3>'.__('Media details').'</h3>'.
463'<ul>'.
464     '<li><strong>'.__('File owner:').'</strong> '.$file->media_user.'</li>'.
465     '<li><strong>'.__('File type:').'</strong> '.$file->type.'</li>'.
466     '<li><strong>'.__('File size:').'</strong> '.files::size($file->size).'</li>'.
467     '<li><strong>'.__('File URL:').'</strong> <a href="'.$file->file_url.'">'.$file->file_url.'</a></li>'.
468'</ul>';
469
470if (empty($_GET['find_posts']))
471{
472     echo
473     '<p><a class="button" href="'.html::escapeHTML($page_url).'&amp;id='.$id.'&amp;find_posts=1&amp;tab=media-details-tab">'.
474     __('Show entries containing this media').'</a></p>';
475}
476else
477{
478     echo '<h3>'.__('Entries containing this media').'</h3>';
479     $params = array(
480          'post_type' => '',
481          'from' => 'LEFT OUTER JOIN '.$core->prefix.'post_media PM ON P.post_id = PM.post_id ',
482          'sql' => 'AND ('.
483               'PM.media_id = '.(integer) $id.' '.
484               "OR post_content_xhtml LIKE '%".$core->con->escape($file->relname)."%' ".
485               "OR post_excerpt_xhtml LIKE '%".$core->con->escape($file->relname)."%' "
486     );
487     
488     if ($file->media_image)
489     { # We look for thumbnails too
490          if (preg_match('#^http(s)?://#',$core->blog->settings->system->public_url)) {
491               $media_root = $core->blog->settings->system->public_url;
492          } else {
493               $media_root = $core->blog->host.path::clean($core->blog->settings->system->public_url).'/';
494          }
495          foreach ($file->media_thumb as $v) {
496               $v = preg_replace('/^'.preg_quote($media_root,'/').'/','',$v);
497               $params['sql'] .= "OR post_content_xhtml LIKE '%".$core->con->escape($v)."%' ";
498               $params['sql'] .= "OR post_excerpt_xhtml LIKE '%".$core->con->escape($v)."%' ";
499          }
500     }
501     
502     $params['sql'] .= ') ';
503     
504     $rs = $core->blog->getPosts($params);
505     
506     if ($rs->isEmpty())
507     {
508          echo '<p>'.__('No entry seems contain this media.').'</p>';
509     }
510     else
511     {
512          echo '<ul>';
513          while ($rs->fetch()) {
514               $img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />';
515               switch ($rs->post_status) {
516                    case 1:
517                         $img_status = sprintf($img,__('published'),'check-on.png');
518                         break;
519                    case 0:
520                         $img_status = sprintf($img,__('unpublished'),'check-off.png');
521                         break;
522                    case -1:
523                         $img_status = sprintf($img,__('scheduled'),'scheduled.png');
524                         break;
525                    case -2:
526                         $img_status = sprintf($img,__('pending'),'check-wrn.png');
527                         break;
528               }
529               echo '<li>'.$img_status.' '.'<a href="'.$core->getPostAdminURL($rs->post_type,$rs->post_id).'">'.
530                    $rs->post_title.'</a>'.
531                    ($rs->post_type != 'post' ? ' ('.html::escapeHTML($rs->post_type).')' : '').
532                    ' - '.dt::dt2str(__('%Y-%m-%d %H:%M'),$rs->post_dt).'</li>';
533          }
534          echo '</ul>';
535     }
536}
537
538if ($file->type == 'image/jpeg')
539{
540     echo '<h3>'.__('Image details').'</h3>';
541     
542     $details = '';
543     if (count($file->media_meta) > 0)
544     {
545          foreach ($file->media_meta as $k => $v)
546          {
547               if ((string) $v) {
548                    $details .= '<li><strong>'.$k.':</strong> '.html::escapeHTML($v).'</li>';
549               }
550          }
551     }
552     if ($details) {
553          echo '<ul>'.$details.'</ul>';
554     } else {
555          echo '<p>'.__('No detail').'</p>';
556     }
557}
558
559echo '</div>';
560
561echo '<h3>'.__('Updates and modifications').'</h3>';
562
563if ($file->editable && $core_media_writable)
564{
565     if ($file->media_type == 'image')
566     {
567          echo
568          '<form class="clear fieldset" action="'.html::escapeURL($page_url).'" method="post">'.
569          '<h4>'.__('Update thumbnails').'</h4>'.
570          '<p>'.__('This will create or update thumbnails for this image.').'</p>'.
571          '<p><input type="submit" name="thumbs" value="'.__('Update thumbnails').'" />'.
572          form::hidden(array('id'),$id).
573          $core->formNonce().'</p>'.
574          '</form>';
575     }
576     
577     if ($file->type == 'application/zip')
578     {
579          $inflate_combo = array(
580               __('Extract in a new directory') => 'new',
581               __('Extract in current directory') => 'current'
582          );
583         
584          echo
585          '<form class="clear fieldset" id="file-unzip" action="'.html::escapeURL($page_url).'" method="post">'.
586          '<h4>'.__('Extract archive').'</h4>'.
587          '<ul>'.
588          '<li><strong>'.__('Extract in a new directory').'</strong> : '.
589          __('This will extract archive in a new directory that should not exist yet.').'</li>'.
590          '<li><strong>'.__('Extract in current directory').'</strong> : '.
591          __('This will extract archive in current directory and will overwrite existing files or directory.').'</li>'.
592          '</ul>'.
593          '<p><label for="inflate_mode" class="classic">'.__('Extract mode:').'</label> '.
594          form::combo('inflate_mode',$inflate_combo,'new').
595          '<input type="submit" name="unzip" value="'.__('Extract').'" />'.
596          form::hidden(array('id'),$id).
597          $core->formNonce().'</p>'.
598          '</form>';
599     }
600     
601     echo
602     '<form class="clear fieldset" action="'.html::escapeURL($page_url).'" method="post">'.
603     '<h4>'.__('Change media properties').'</h4>'.
604     '<p><label for="media_file">'.__('File name:').'</label>'.
605     form::field('media_file',30,255,html::escapeHTML($file->basename)).'</p>'.
606     '<p><label for="media_title">'.__('File title:').'</label>'.
607     form::field('media_title',30,255,html::escapeHTML($file->media_title)).'</p>'.
608     '<p><label for="media_dt">'.__('File date:').'</label>'.
609     form::field('media_dt',16,16,html::escapeHTML($file->media_dtstr)).'</p>'.
610     '<p><label for="media_private" class="classic">'.form::checkbox('media_private',1,$file->media_priv).' '.
611     __('Private').'</label></p>'.
612     '<p><label for="media_path">'.__('New directory:').'</label>'.
613     form::combo('media_path',$dirs_combo,dirname($file->relname)).'</p>'.
614     '<p><input type="submit" accesskey="s" value="'.__('Save').'" />'.
615     form::hidden(array('id'),$id).
616     $core->formNonce().'</p>'.
617     '</form>';
618     
619     echo
620     '<form class="clear fieldset" action="'.html::escapeURL($page_url).'" method="post" enctype="multipart/form-data">'.
621     '<h4>'.__('Change file').'</h4>'.
622     '<div>'.form::hidden(array('MAX_FILE_SIZE'),DC_MAX_UPLOAD_SIZE).'</div>'.
623     '<p><label for="upfile">'.__('Choose a file:').
624     ' ('.sprintf(__('Maximum size %s'),files::size(DC_MAX_UPLOAD_SIZE)).') '.
625     '<input type="file" id="upfile" name="upfile" size="35" />'.
626     '</label></p>'.
627     '<p><input type="submit" value="'.__('Send').'" />'.
628     form::hidden(array('id'),$id).
629     $core->formNonce().'</p>'.
630     '</form>';
631
632     if ($file->del) {
633          echo
634          '<form id="delete-form" method="post" action="'.html::escapeURL($media_page_url).
635          '&amp;d='.rawurlencode(dirname($file->relname)).
636          '&amp;remove='.rawurlencode($file->basename).'">'.
637          '<p><input name="delete" type="submit" class="delete" value="'.__('Delete this media').'" />'.
638          form::hidden('remove',rawurlencode($file->basename)).
639          form::hidden('rmyes',1).
640          $core->formNonce().'</p>'.
641          '</form>';
642     }
643
644
645     # --BEHAVIOR-- adminMediaItemForm
646     $core->callBehavior('adminMediaItemForm',$file);
647}
648
649echo
650'</div>';
651if ($popup) {
652     echo
653     '</div>';
654}
655
656call_user_func($close_f);
657?>
Note: See TracBrowser for help on using the repository browser.

Sites map