summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKate Arzamastseva <pshns@ukr.net>2011-06-24 00:41:47 +0300
committerKate Arzamastseva <pshns@ukr.net>2011-06-24 00:41:47 +0300
commit70c3cc9a17d47d8986cba0805d943c1a68af1740 (patch)
tree7be6592a4494ea0dff13f544c9f3412dd9502364
parent88a71175e3de9e3ad8b20ca9eb710aaf773cb788 (diff)
downloadrpg-70c3cc9a17d47d8986cba0805d943c1a68af1740.tar.gz
rpg-70c3cc9a17d47d8986cba0805d943c1a68af1740.tar.bz2
media action buttons
-rw-r--r--inc/lang/en/lang.php1
-rw-r--r--inc/media.php37
-rw-r--r--inc/template.php10
-rw-r--r--lib/tpl/default/mediamanager.css4
4 files changed, 34 insertions, 18 deletions
diff --git a/inc/lang/en/lang.php b/inc/lang/en/lang.php
index a55981983..abe59d0aa 100644
--- a/inc/lang/en/lang.php
+++ b/inc/lang/en/lang.php
@@ -340,5 +340,6 @@ $lang['media_history'] = 'These are the older revisions of the file.';
$lang['media_meta_edited']= 'metadata edited';
$lang['media_perm_read'] = 'Sorry, you don\'t have enough rights to read files.';
$lang['media_perm_upload']= 'Sorry, you don\'t have enough rights to upload files.';
+$lang['media_update'] = 'Upload new version';
//Setup VIM: ex: et ts=2 :
diff --git a/inc/media.php b/inc/media.php
index fc7f72941..19aee0d06 100644
--- a/inc/media.php
+++ b/inc/media.php
@@ -795,21 +795,27 @@ function media_preview($image, $auth, $rev=false) {
$more = '';
if ($rev) $more = "rev=$rev";
$src = ml($image, $more);
-
+ echo '<div class="mediamanager-preview">';
echo '<img src="'.$src.'" alt="" width="99%" style="max-width: '.$w.'px;" /><br /><br />';
- $link = ml($image,$more,true);
- echo $image.' <a href="'.$link.'" target="_blank"><img src="'.DOKU_BASE.'lib/images/magnifier.png" '.
- 'alt="'.$lang['mediaview'].'" title="'.$lang['mediaview'].'" class="btn" /></a>';
+ $link = ml($image,$more,true,'&');
+
+ $form = new Doku_Form(array('action'=>$link, 'target'=>'_blank'));
+ $form->addElement(form_makeButton('submit','',$lang['mediaview']));
+ $form->printForm();
// delete button
if($auth >= AUTH_DELETE && !$rev){
- $link = media_managerURL(array('delete' => $image,'sectok' => getSecurityToken()));
- echo ' <a href="'.$link.'" class="btn_media_delete" title="'.$image.'">'.
- '<img src="'.DOKU_BASE.'lib/images/trash.png" alt="'.$lang['btn_delete'].'" '.
- 'title="'.$lang['btn_delete'].'" class="btn" /></a>';
- }
+ $form = new Doku_Form(array('action'=>media_managerURL(array('delete' => $image))));
+ $form->addElement(form_makeButton('submit','',$lang['btn_delete']));
+ $form->printForm();
+ $form = new Doku_Form(array('action'=>media_managerURL()));
+ $form->addHidden('mediado','update');
+ $form->addElement(form_makeButton('submit','',$lang['media_update']));
+ $form->printForm();
+ }
+ echo '</div>';
}
/**
@@ -1217,6 +1223,13 @@ function media_uploadform($ns, $auth, $fullscreen = false){
return;
}
+ $update = false;
+ $id = '';
+ if ($auth >= AUTH_DELETE && $fullscreen && $_REQUEST['mediado'] == 'update') {
+ $update = true;
+ $id = cleanID($_REQUEST['image']);
+ }
+
// The default HTML upload form
$params = array('id' => 'dw__upload',
'enctype' => 'multipart/form-data');
@@ -1231,13 +1244,15 @@ function media_uploadform($ns, $auth, $fullscreen = false){
$form->addElement(form_makeFileField('upload', $lang['txt_upload'].':', 'upload__file'));
$form->addElement(form_makeCloseTag('p'));
$form->addElement(form_makeOpenTag('p'));
- $form->addElement(form_makeTextField('id', '', $lang['txt_filename'].':', 'upload__name'));
+ $form->addElement(form_makeTextField('id', $id, $lang['txt_filename'].':', 'upload__name'));
$form->addElement(form_makeButton('submit', '', $lang['btn_upload']));
$form->addElement(form_makeCloseTag('p'));
if($auth >= AUTH_DELETE){
$form->addElement(form_makeOpenTag('p'));
- $form->addElement(form_makeCheckboxField('ow', 1, $lang['txt_overwrt'], 'dw__ow', 'check'));
+ $attrs = array();
+ if ($update) $attrs['checked'] = 'checked';
+ $form->addElement(form_makeCheckboxField('ow', 1, $lang['txt_overwrt'], 'dw__ow', 'check', $attrs));
$form->addElement(form_makeCloseTag('p'));
}
html_form('upload', $form);
diff --git a/inc/template.php b/inc/template.php
index 051679fb9..4226c0e52 100644
--- a/inc/template.php
+++ b/inc/template.php
@@ -1142,6 +1142,7 @@ function tpl_fileList(){
$opened_tab = $_REQUEST['tab_files'];
if (!$opened_tab) $opened_tab = 'files';
+ if ($_REQUEST['mediado'] == 'update') $opened_tab = 'upload';
media_tabs_files($opened_tab);
if ($opened_tab == 'files') media_tab_files($NS,$AUTH,$JUMPTO);
@@ -1161,11 +1162,9 @@ function tpl_fileList(){
function tpl_fileDetails(){
global $AUTH;
global $NS;
- global $IMG;
if ($_REQUEST['image']) $image = cleanID($_REQUEST['image']);
- if (!isset($IMG) && !isset($image)) return '';
- if (isset($NS) && getNS($image) != $NS) return '';
+ if (!isset($image) || isset($NS) && getNS($image) != $NS) return '';
$opened_tab = $_REQUEST['tab_details'];
if (!$opened_tab) $opened_tab = 'view';
@@ -1173,10 +1172,7 @@ function tpl_fileDetails(){
media_tabs_details($opened_tab);
if ($opened_tab == 'view') media_tab_view($image, $NS, $AUTH);
- if ($opened_tab == 'edit') {
- if ($IMG) media_tab_edit($IMG, $NS, $AUTH);
- else if ($image) media_tab_edit($image, $NS, $AUTH);
- }
+ if ($opened_tab == 'edit') media_tab_edit($image, $NS, $AUTH);
if ($opened_tab == 'history') media_tab_history($image,$NS,$AUTH);
}
diff --git a/lib/tpl/default/mediamanager.css b/lib/tpl/default/mediamanager.css
index e7c78dbcf..7a85f3c8b 100644
--- a/lib/tpl/default/mediamanager.css
+++ b/lib/tpl/default/mediamanager.css
@@ -248,4 +248,8 @@ form.meta textarea.edit {
vertical-align: top;
zoom: 1;
*display: inline;
+}
+
+.mediamanager-preview {
+ margin-bottom: 5px;
} \ No newline at end of file