Dotclear

source: admin/media_item.php @ 2749:993aebff97bb

Revision 2749:993aebff97bb, 21.4 KB checked in by Nicolas <nikrou77@…>, 11 years ago (diff)

Fix call of javascript of all editors on media_item page but also popup_link and popup_posts
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$page_url = $core->adminurl->get("admin.media.item",array('popup' => $popup,'post_id' => $post_id));
32$media_page_url = $core->adminurl->get("admin.media",array('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     // perhaps better to put active editor in session
211     $post_format = $core->auth->getOption('post_format');
212     $post_editor = $core->auth->getOption('editor');
213
214     $starting_scripts .= $core->callBehavior('adminPopupMedia', $post_editor[$post_format]);
215}
216call_user_func($open_f,__('Media manager'),
217     $starting_scripts.
218     dcPage::jsDatePicker().
219     ($popup ? dcPage::jsPageTabs($tab) : ''),
220     dcPage::breadcrumb(
221          array(
222               html::escapeHTML($core->blog->name) => '',
223               __('Media manager') => html::escapeURL($media_page_url).'&amp;d=',
224               $core->media->breadCrumb(html::escapeURL($media_page_url).'&amp;d=%s').'<span class="page-title">'.$file->basename.'</span>' => ''
225          ),
226          array(
227               'home_link' => !$popup,
228               'hl' => false
229          )
230     )
231);
232
233if ($popup) {
234     // Display notices
235     echo dcPage::notices();
236}
237
238if ($file === null) {
239     call_user_func($close_f);
240     exit;
241}
242
243if (!empty($_GET['fupd']) || !empty($_GET['fupl'])) {
244     dcPage::success(__('File has been successfully updated.'));
245}
246if (!empty($_GET['thumbupd'])) {
247     dcPage::success(__('Thumbnails have been successfully updated.'));
248}
249if (!empty($_GET['blogprefupd'])) {
250     dcPage::success(__('Default media insertion settings have been successfully updated.'));
251}
252
253# Insertion popup
254if ($popup)
255{
256     $media_desc = $file->media_title;
257
258     echo
259     '<div id="media-insert" class="multi-part" title="'.__('Insert media item').'">'.
260     '<h3>'.__('Insert media item').'</h3>'.
261     '<form id="media-insert-form" action="" method="get">';
262
263     $media_img_default_size = $core->blog->settings->system->media_img_default_size;
264     if ($media_img_default_size == '') {
265          $media_img_default_size = 'm';
266     }
267     $media_img_default_alignment = $core->blog->settings->system->media_img_default_alignment;
268     if ($media_img_default_alignment == '') {
269          $media_img_default_alignment = 'none';
270     }
271     $media_img_default_link = (boolean)$core->blog->settings->system->media_img_default_link;
272
273     if ($file->media_type == 'image')
274     {
275          $media_type = 'image';
276          $media_desc = dcGetImageTitle($file,
277               $core->blog->settings->system->media_img_title_pattern,
278               $core->blog->settings->system->media_img_use_dto_first);
279          if ($media_desc == $file->basename) {
280               $media_desc = '';
281          }
282
283          echo
284          '<h3>'.__('Image size:').'</h3> ';
285
286          $s_checked = false;
287          echo '<p>';
288          foreach (array_reverse($file->media_thumb) as $s => $v) {
289               $s_checked = ($s == $media_img_default_size);
290               echo '<label class="classic">'.
291               form::radio(array('src'),html::escapeHTML($v),$s_checked).' '.
292               $core->media->thumb_sizes[$s][2].'</label><br /> ';
293          }
294          $s_checked = (!isset($file->media_thumb[$media_img_default_size]));
295          echo '<label class="classic">'.
296          form::radio(array('src'),$file->file_url,$s_checked).' '.__('original').'</label><br /> ';
297          echo '</p>';
298
299          echo
300          '<div class="two-boxes">'.
301          '<h3>'.__('Image alignment').'</h3>';
302          $i_align = array(
303               'none' => array(__('None'),($media_img_default_alignment == 'none' ? 1 : 0)),
304               'left' => array(__('Left'),($media_img_default_alignment == 'left' ? 1 : 0)),
305               'right' => array(__('Right'),($media_img_default_alignment == 'right' ? 1 : 0)),
306               'center' => array(__('Center'),($media_img_default_alignment == 'center' ? 1 : 0))
307          );
308
309          echo '<p>';
310          foreach ($i_align as $k => $v) {
311               echo '<label class="classic">'.
312               form::radio(array('alignment'),$k,$v[1]).' '.$v[0].'</label><br /> ';
313          }
314          echo '</p>';
315          echo '</div>';
316
317          echo
318          '<div class="two-boxes">'.
319          '<h3>'.__('Image insertion').'</h3>'.
320          '<p>'.
321          '<label for="insert1" class="classic">'.form::radio(array('insertion','insert1'),'simple',!$media_img_default_link).
322          __('As a single image').'</label><br />'.
323          '<label for="insert2" class="classic">'.form::radio(array('insertion','insert2'),'link',$media_img_default_link).
324          __('As a link to the original image').'</label>'.
325          '</p>'.
326          '</div>';
327     }
328     elseif ($file->type == 'audio/mpeg3')
329     {
330          $media_type = 'mp3';
331
332          echo
333          '<div class="two-boxes">'.
334          '<h3>'.__('MP3 disposition').'</h3>';
335          dcPage::message(__("Please note that you cannot insert mp3 files with visual editor."),false);
336
337          $i_align = array(
338               'none' => array(__('None'),($media_img_default_alignment == 'none' ? 1 : 0)),
339               'left' => array(__('Left'),($media_img_default_alignment == 'left' ? 1 : 0)),
340               'right' => array(__('Right'),($media_img_default_alignment == 'right' ? 1 : 0)),
341               'center' => array(__('Center'),($media_img_default_alignment == 'center' ? 1 : 0))
342          );
343
344          echo '<p>';
345          foreach ($i_align as $k => $v) {
346               echo '<label class="classic">'.
347               form::radio(array('alignment'),$k,$v[1]).' '.$v[0].'</label><br /> ';
348          }
349
350          $public_player_style = unserialize($core->blog->settings->themes->mp3player_style);
351          $public_player = dcMedia::mp3player($file->file_url,$core->blog->getQmarkURL().'pf=player_mp3.swf',$public_player_style);
352          echo form::hidden('public_player',html::escapeHTML($public_player));
353          echo '</p>';
354          echo '</div>';
355     }
356     elseif ($file->type == 'video/x-flv' || $file->type == 'video/mp4' || $file->type == 'video/x-m4v')
357     {
358          $media_type = 'flv';
359
360          dcPage::message(__("Please note that you cannot insert video files with visual editor."),false);
361
362          echo
363          '<div class="two-boxes">'.
364          '<h3>'.__('Video size').'</h3>'.
365          '<p><label for="video_w" class="classic">'.__('Width:').'</label> '.
366          form::field('video_w',3,4,400).'  '.
367          '<label for="video_h" class="classic">'.__('Height:').'</label> '.
368          form::field('video_h',3,4,300).
369          '</p>'.
370          '</div>';
371
372
373          echo
374          '<div class="two-boxes">'.
375          '<h3>'.__('Video disposition').'</h3>';
376
377          $i_align = array(
378               'none' => array(__('None'),($media_img_default_alignment == 'none' ? 1 : 0)),
379               'left' => array(__('Left'),($media_img_default_alignment == 'left' ? 1 : 0)),
380               'right' => array(__('Right'),($media_img_default_alignment == 'right' ? 1 : 0)),
381               'center' => array(__('Center'),($media_img_default_alignment == 'center' ? 1 : 0))
382          );
383
384          echo '<p>';
385          foreach ($i_align as $k => $v) {
386               echo '<label class="classic">'.
387               form::radio(array('alignment'),$k,$v[1]).' '.$v[0].'</label><br /> ';
388          }
389
390          $public_player_style = unserialize($core->blog->settings->themes->flvplayer_style);
391          $public_player = dcMedia::flvplayer($file->file_url,$core->blog->getQmarkURL().'pf=player_flv.swf',$public_player_style);
392          echo form::hidden('public_player',html::escapeHTML($public_player));
393          echo '</p>';
394          echo '</div>';
395     }
396     else
397     {
398          $media_type = 'default';
399          echo '<p>'.__('Media item will be inserted as a link.').'</p>';
400     }
401
402     echo
403     '<p>'.
404     '<a id="media-insert-ok" class="button submit" href="#">'.__('Insert').'</a> '.
405     '<a id="media-insert-cancel" class="button" href="#">'.__('Cancel').'</a>'.
406     form::hidden(array('type'),html::escapeHTML($media_type)).
407     form::hidden(array('title'),html::escapeHTML($file->media_title)).
408     form::hidden(array('description'),html::escapeHTML($media_desc)).
409     form::hidden(array('url'),$file->file_url).
410     '</p>';
411
412     echo '</form>';
413
414     if ($media_type != 'default') {
415          echo
416          '<div class="border-top">'.
417          '<form id="save_settings" action="'.html::escapeURL($page_url).'" method="post">'.
418          '<p>'.__('Make current settings as default').' '.
419          '<input class="reset" type="submit" name="save_blog_prefs" value="'.__('OK').'" />'.
420          form::hidden(array('pref_src'),'').
421          form::hidden(array('pref_alignment'),'').
422          form::hidden(array('pref_insertion'),'').
423          form::hidden(array('id'),$id).
424          $core->formNonce().'</p>'.
425          '</form>'.'</div>';
426     }
427
428     echo '</div>';
429}
430
431if ($popup) {
432     echo
433     '<div class="multi-part" title="'.__('Media details').'" id="media-details-tab">';
434} else {
435     echo '<h3 class="out-of-screen-if-js">'.__('Media details').'</h3>';
436}
437echo
438'<p id="media-icon"><img src="'.$file->media_icon.'?'.time()*rand().'" alt="" /></p>';
439
440echo
441'<div id="media-details">'.
442'<div class="near-icon">';
443
444if ($file->media_image)
445{
446     $thumb_size = !empty($_GET['size']) ? $_GET['size'] : 's';
447
448     if (!isset($core->media->thumb_sizes[$thumb_size]) && $thumb_size != 'o') {
449          $thumb_size = 's';
450     }
451
452     if (isset($file->media_thumb[$thumb_size])) {
453          echo '<p><img src="'.$file->media_thumb[$thumb_size].'?'.time()*rand().'" alt="" /></p>';
454     } elseif ($thumb_size == 'o') {
455          $S = getimagesize($file->file);
456          $class = ($S[1] > 500) ? ' class="overheight"' : '';
457          unset($S);
458          echo '<p id="media-original-image"'.$class.'><img src="'.$file->file_url.'?'.time()*rand().'" alt="" /></p>';
459     }
460
461     echo '<p>'.__('Available sizes:').' ';
462     foreach (array_reverse($file->media_thumb) as $s => $v)
463     {
464          $strong_link = ($s == $thumb_size) ? '<strong>%s</strong>' : '%s';
465          printf($strong_link,'<a href="'.html::escapeURL($page_url).
466          '&amp;id='.$id.'&amp;size='.$s.'&amp;tab=media-details-tab">'.$core->media->thumb_sizes[$s][2].'</a> | ');
467     }
468     echo '<a href="'.html::escapeURL($page_url).'&amp;id='.$id.'&amp;size=o&amp;tab=media-details-tab">'.__('original').'</a>';
469     echo '</p>';
470}
471
472if ($file->type == 'audio/mpeg3')
473{
474     echo dcMedia::mp3player($file->file_url,$core->adminurl->get("admin.home",array('pf' => 'player_mp3.swf')));
475}
476
477if ($file->type == 'video/x-flv' || $file->type == 'video/mp4' || $file->type == 'video/x-m4v')
478{
479     echo dcMedia::flvplayer($file->file_url,$core->adminurl->get("admin.home",array('pf' => 'player_flv.swf')));
480}
481
482echo
483'<h3>'.__('Media details').'</h3>'.
484'<ul>'.
485     '<li><strong>'.__('File owner:').'</strong> '.$file->media_user.'</li>'.
486     '<li><strong>'.__('File type:').'</strong> '.$file->type.'</li>'.
487     '<li><strong>'.__('File size:').'</strong> '.files::size($file->size).'</li>'.
488     '<li><strong>'.__('File URL:').'</strong> <a href="'.$file->file_url.'">'.$file->file_url.'</a></li>'.
489'</ul>';
490
491if (empty($_GET['find_posts']))
492{
493     echo
494     '<p><a class="button" href="'.html::escapeHTML($page_url).'&amp;id='.$id.'&amp;find_posts=1&amp;tab=media-details-tab">'.
495     __('Show entries containing this media').'</a></p>';
496}
497else
498{
499     echo '<h3>'.__('Entries containing this media').'</h3>';
500     $params = array(
501          'post_type' => '',
502          'from' => 'LEFT OUTER JOIN '.$core->prefix.'post_media PM ON P.post_id = PM.post_id ',
503          'sql' => 'AND ('.
504               'PM.media_id = '.(integer) $id.' '.
505               "OR post_content_xhtml LIKE '%".$core->con->escape($file->relname)."%' ".
506               "OR post_excerpt_xhtml LIKE '%".$core->con->escape($file->relname)."%' "
507     );
508
509     if ($file->media_image)
510     { # We look for thumbnails too
511          if (preg_match('#^http(s)?://#',$core->blog->settings->system->public_url)) {
512               $media_root = $core->blog->settings->system->public_url;
513          } else {
514               $media_root = $core->blog->host.path::clean($core->blog->settings->system->public_url).'/';
515          }
516          foreach ($file->media_thumb as $v) {
517               $v = preg_replace('/^'.preg_quote($media_root,'/').'/','',$v);
518               $params['sql'] .= "OR post_content_xhtml LIKE '%".$core->con->escape($v)."%' ";
519               $params['sql'] .= "OR post_excerpt_xhtml LIKE '%".$core->con->escape($v)."%' ";
520          }
521     }
522
523     $params['sql'] .= ') ';
524
525     $rs = $core->blog->getPosts($params);
526
527     if ($rs->isEmpty())
528     {
529          echo '<p>'.__('No entry seems contain this media.').'</p>';
530     }
531     else
532     {
533          echo '<ul>';
534          while ($rs->fetch()) {
535               $img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />';
536               switch ($rs->post_status) {
537                    case 1:
538                         $img_status = sprintf($img,__('published'),'check-on.png');
539                         break;
540                    case 0:
541                         $img_status = sprintf($img,__('unpublished'),'check-off.png');
542                         break;
543                    case -1:
544                         $img_status = sprintf($img,__('scheduled'),'scheduled.png');
545                         break;
546                    case -2:
547                         $img_status = sprintf($img,__('pending'),'check-wrn.png');
548                         break;
549               }
550               echo '<li>'.$img_status.' '.'<a href="'.$core->getPostAdminURL($rs->post_type,$rs->post_id).'">'.
551                    $rs->post_title.'</a>'.
552                    ($rs->post_type != 'post' ? ' ('.html::escapeHTML($rs->post_type).')' : '').
553                    ' - '.dt::dt2str(__('%Y-%m-%d %H:%M'),$rs->post_dt).'</li>';
554          }
555          echo '</ul>';
556     }
557}
558
559if ($file->type == 'image/jpeg')
560{
561     echo '<h3>'.__('Image details').'</h3>';
562
563     $details = '';
564     if (count($file->media_meta) > 0)
565     {
566          foreach ($file->media_meta as $k => $v)
567          {
568               if ((string) $v) {
569                    $details .= '<li><strong>'.$k.':</strong> '.html::escapeHTML($v).'</li>';
570               }
571          }
572     }
573     if ($details) {
574          echo '<ul>'.$details.'</ul>';
575     } else {
576          echo '<p>'.__('No detail').'</p>';
577     }
578}
579
580echo '</div>';
581
582echo '<h3>'.__('Updates and modifications').'</h3>';
583
584if ($file->editable && $core_media_writable)
585{
586     if ($file->media_type == 'image')
587     {
588          echo
589          '<form class="clear fieldset" action="'.html::escapeURL($page_url).'" method="post">'.
590          '<h4>'.__('Update thumbnails').'</h4>'.
591          '<p>'.__('This will create or update thumbnails for this image.').'</p>'.
592          '<p><input type="submit" name="thumbs" value="'.__('Update thumbnails').'" />'.
593          form::hidden(array('id'),$id).
594          $core->formNonce().'</p>'.
595          '</form>';
596     }
597
598     if ($file->type == 'application/zip')
599     {
600          $inflate_combo = array(
601               __('Extract in a new directory') => 'new',
602               __('Extract in current directory') => 'current'
603          );
604
605          echo
606          '<form class="clear fieldset" id="file-unzip" action="'.html::escapeURL($page_url).'" method="post">'.
607          '<h4>'.__('Extract archive').'</h4>'.
608          '<ul>'.
609          '<li><strong>'.__('Extract in a new directory').'</strong> : '.
610          __('This will extract archive in a new directory that should not exist yet.').'</li>'.
611          '<li><strong>'.__('Extract in current directory').'</strong> : '.
612          __('This will extract archive in current directory and will overwrite existing files or directory.').'</li>'.
613          '</ul>'.
614          '<p><label for="inflate_mode" class="classic">'.__('Extract mode:').'</label> '.
615          form::combo('inflate_mode',$inflate_combo,'new').
616          '<input type="submit" name="unzip" value="'.__('Extract').'" />'.
617          form::hidden(array('id'),$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     $core->formNonce().'</p>'.
638     '</form>';
639
640     echo
641     '<form class="clear fieldset" action="'.html::escapeURL($page_url).'" method="post" enctype="multipart/form-data">'.
642     '<h4>'.__('Change file').'</h4>'.
643     '<div>'.form::hidden(array('MAX_FILE_SIZE'),DC_MAX_UPLOAD_SIZE).'</div>'.
644     '<p><label for="upfile">'.__('Choose a file:').
645     ' ('.sprintf(__('Maximum size %s'),files::size(DC_MAX_UPLOAD_SIZE)).') '.
646     '<input type="file" id="upfile" name="upfile" size="35" />'.
647     '</label></p>'.
648     '<p><input type="submit" value="'.__('Send').'" />'.
649     form::hidden(array('id'),$id).
650     $core->formNonce().'</p>'.
651     '</form>';
652
653     if ($file->del) {
654          echo
655          '<form id="delete-form" method="post" action="'.html::escapeURL($media_page_url).
656          '&amp;d='.rawurlencode(dirname($file->relname)).
657          '&amp;remove='.rawurlencode($file->basename).'">'.
658          '<p><input name="delete" type="submit" class="delete" value="'.__('Delete this media').'" />'.
659          form::hidden('remove',rawurlencode($file->basename)).
660          form::hidden('rmyes',1).
661          $core->formNonce().'</p>'.
662          '</form>';
663     }
664
665
666     # --BEHAVIOR-- adminMediaItemForm
667     $core->callBehavior('adminMediaItemForm',$file);
668}
669
670echo
671'</div>';
672if ($popup) {
673     echo
674     '</div>';
675}
676
677call_user_func($close_f);
Note: See TracBrowser for help on using the repository browser.

Sites map