From c472bad9de398442c30ec1410d07284f0db8b821 Mon Sep 17 00:00:00 2001 From: Kate Arzamastseva Date: Fri, 19 Aug 2011 20:56:43 +0300 Subject: issue #44 new uploader in the media popup --- inc/lang/en/lang.php | 1 + inc/media.php | 50 +++---------------------------------- lib/exe/ajax.php | 4 ++- lib/scripts/fileuploaderextended.js | 8 +++++- lib/scripts/media.js | 4 +-- lib/tpl/default/_fileuploader.css | 32 +++++++++++++----------- lib/tpl/default/media.css | 5 ++++ lib/tpl/default/mediamanager.css | 7 +++++- 8 files changed, 45 insertions(+), 66 deletions(-) diff --git a/inc/lang/en/lang.php b/inc/lang/en/lang.php index 58a7d56ed..3406927fe 100644 --- a/inc/lang/en/lang.php +++ b/inc/lang/en/lang.php @@ -356,6 +356,7 @@ $lang['js']['media_diff_portions'] = 'Slider'; $lang['js']['media_select'] = 'Select files…'; $lang['js']['media_upload_btn'] = 'Upload'; +$lang['js']['media_done_btn'] = 'Done'; $lang['js']['media_drop'] = 'Drop files here to upload'; $lang['js']['media_cancel'] = 'remove'; $lang['js']['media_overwrt'] = 'Overwrite existing files'; diff --git a/inc/media.php b/inc/media.php index 8ef075f17..d083fd2b2 100644 --- a/inc/media.php +++ b/inc/media.php @@ -1626,14 +1626,14 @@ function media_uploadform($ns, $auth, $fullscreen = false){ $params = array('id' => 'dw__upload', 'enctype' => 'multipart/form-data'); if (!$fullscreen) { - $params['action'] = DOKU_BASE.'lib/exe/mediamanager.php'; + $params['action'] = DOKU_BASE.'lib/exe/mediamanager.php?ns='.$ns; } else { $params['action'] = media_managerURL(array('tab_files' => 'files', 'tab_details' => 'view'), '&'); } $form = new Doku_Form($params); - if (!$fullscreen) $form->addElement('
' . $lang['mediaupload'] . '
'); + if (!$fullscreen) echo '
' . $lang['mediaupload'] . '
'; $form->addElement(formSecurityToken()); $form->addHidden('ns', hsc($ns)); $form->addElement(form_makeOpenTag('p')); @@ -1651,52 +1651,10 @@ function media_uploadform($ns, $auth, $fullscreen = false){ $form->addElement(form_makeCheckboxField('ow', 1, $lang['txt_overwrt'], 'dw__ow', 'check', $attrs)); $form->addElement(form_makeCloseTag('p')); } - if ($fullscreen) { - echo '
'; - } + echo '
'; html_form('upload', $form); - - if ($fullscreen) { - echo '
'; - return ''; - } - - // prepare flashvars for multiupload - $opt = array( - 'L_gridname' => $lang['mu_gridname'] , - 'L_gridsize' => $lang['mu_gridsize'] , - 'L_gridstat' => $lang['mu_gridstat'] , - 'L_namespace' => $lang['mu_namespace'] , - 'L_overwrite' => $lang['txt_overwrt'], - 'L_browse' => $lang['mu_browse'], - 'L_upload' => $lang['btn_upload'], - 'L_toobig' => $lang['mu_toobig'], - 'L_ready' => $lang['mu_ready'], - 'L_done' => $lang['mu_done'], - 'L_fail' => $lang['mu_fail'], - 'L_authfail' => $lang['mu_authfail'], - 'L_progress' => $lang['mu_progress'], - 'L_filetypes' => $lang['mu_filetypes'], - 'L_info' => $lang['mu_info'], - 'L_lasterr' => $lang['mu_lasterr'], - - 'O_ns' => ":$ns", - 'O_backend' => 'mediamanager.php?'.session_name().'='.session_id(), - 'O_maxsize' => php_to_byte(ini_get('upload_max_filesize')), - 'O_extensions'=> join('|',array_keys(getMimeTypes())), - 'O_overwrite' => ($auth >= AUTH_DELETE), - 'O_sectok' => getSecurityToken(), - 'O_authtok' => auth_createToken(), - ); - $var = buildURLparams($opt); - // output the flash uploader - ?> - - '; } /** diff --git a/lib/exe/ajax.php b/lib/exe/ajax.php index 52131d864..d8754b875 100644 --- a/lib/exe/ajax.php +++ b/lib/exe/ajax.php @@ -265,9 +265,11 @@ function ajax_mediaupload(){ $res = media_upload_xhr($NS, $AUTH); $id = $_GET['qqfile']; } + $id = cleanID($id, false, true); if ($res) $result = array('success' => true, - 'link' => media_managerURL(array('ns' => getNS($id), 'image' => $id), '&')); + 'link' => media_managerURL(array('ns' => getNS($id), 'image' => $id), '&'), + 'id' => $id); if (!$result) { $error = ''; diff --git a/lib/scripts/fileuploaderextended.js b/lib/scripts/fileuploaderextended.js index 36fc3ec63..f4a3219bb 100644 --- a/lib/scripts/fileuploaderextended.js +++ b/lib/scripts/fileuploaderextended.js @@ -167,7 +167,7 @@ qq.extend(qq.FileUploaderExtended.prototype, { if (result.success){ qq.addClass(item, this._classes.success); - $link = '' + nameInput.value + ''; + $link = '' + nameInput.value + ''; jQuery(fileElement).html($link); } else { @@ -175,6 +175,12 @@ qq.extend(qq.FileUploaderExtended.prototype, { var fail = this._find(item, 'failedText'); if (result.error) qq.setText(fail, result.error); } + + if (document.getElementById('media__content') && !document.getElementById('mediamanager__done_form')) { + var button = '
'; + button += '
' + jQuery('#mediamanager__uploader').append(button); + } } }); diff --git a/lib/scripts/media.js b/lib/scripts/media.js index 36dadf232..997321a65 100644 --- a/lib/scripts/media.js +++ b/lib/scripts/media.js @@ -43,7 +43,8 @@ var dw_mediamanager = { .delegate('a.select', 'click', dw_mediamanager.select) // Attach deletion confirmation dialog to the delete buttons .delegate('#media__content a.btn_media_delete', 'click', - dw_mediamanager.confirmattach); + dw_mediamanager.confirmattach) + .delegate('#mediamanager__done_form', 'submit', dw_mediamanager.list); $tree.dw_tree({toggle_selector: 'img', load_data: function (show_sublist, $clicky) { @@ -670,7 +671,6 @@ var dw_mediamanager = { prepare_content: function ($content) { // hide syntax example $content.find('div.example:visible').hide(); - dw_mediamanager.initFlashUpload(); }, /** diff --git a/lib/tpl/default/_fileuploader.css b/lib/tpl/default/_fileuploader.css index e87ba94db..0e53f8187 100644 --- a/lib/tpl/default/_fileuploader.css +++ b/lib/tpl/default/_fileuploader.css @@ -4,20 +4,18 @@ } .qq-upload-button { - display: block; - width: 115px; - padding: 7px 0; - text-align: center; - background: __background_alt__; + display: inline-block; border: 1px solid __border__; - color: __extern__; - font-weight: bold; + color: __text__; + background-color: __background__; + vertical-align: middle; + text-decoration: none; + font-size: 100%; + cursor: pointer; + margin: 1px; margin-bottom: 5px; -} - -.qq-upload-button-hover { - background: __border__; - color: __background__; + padding: 0.125em 0.4em; + background: __background__ url(images/buttonshadow.png) repeat-x bottom; } .qq-upload-button-focus { @@ -42,11 +40,11 @@ top: 50%; width:100%; margin-top:-8px; - font-size:16px; + font-size: 120%; } .qq-upload-drop-area-active { - background: #DADADA; + background: __background_alt__; } .qq-upload-file, .qq-upload-spinner, .qq-upload-size, .qq-upload-cancel, .qq-upload-failed-text { @@ -62,7 +60,7 @@ } .qq-upload-size,.qq-upload-cancel { - font-size:11px; + font-size: 85%; } .qq-upload-failed-text { @@ -97,4 +95,8 @@ .qq-uploader #mediamanager__upload_button { margin-top: -5px; margin-bottom: 10px; +} + +.qq-uploader div.li { + margin-bottom: 5px; } \ No newline at end of file diff --git a/lib/tpl/default/media.css b/lib/tpl/default/media.css index 7b558a80b..b325a1ef6 100644 --- a/lib/tpl/default/media.css +++ b/lib/tpl/default/media.css @@ -151,6 +151,11 @@ it's dirty, so any "real" fixes are welcome */ border-bottom: solid 1px __border__; padding: 0 0.5em 1em 0.5em; } + +#media__content form#dw__upload { + border-bottom: 0; +} + #media__content form#dw__upload fieldset { padding: 0; margin: 0; diff --git a/lib/tpl/default/mediamanager.css b/lib/tpl/default/mediamanager.css index f6ad721e0..ad371ee3d 100644 --- a/lib/tpl/default/mediamanager.css +++ b/lib/tpl/default/mediamanager.css @@ -289,6 +289,11 @@ padding-bottom: 0.5em; } +#media__content #mediamanager__uploader { + border-bottom: 1px solid #8CACBB; + padding-bottom: 0.5em; +} + /* File preview */ .mediamanager__preview, @@ -318,7 +323,7 @@ form.meta textarea.edit { } #mediamanager__details #page__revisions ul li div.li div { - font-size: 12px; + font-size: 90%; color: __text_neu__; padding-left: 18px; } -- cgit v1.2.3