From da45d8839c94444f8e89f45ef290516542976ee8 Mon Sep 17 00:00:00 2001 From: Kate Arzamastseva Date: Thu, 18 Aug 2011 15:03:33 +0300 Subject: [PATCH] issue #50 styling uploader --- inc/lang/en/lang.php | 6 +++--- inc/media.php | 8 +++++--- lib/scripts/fileuploaderextended.js | 5 ++++- lib/tpl/default/_fileuploader.css | 11 ++++++++++- 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/inc/lang/en/lang.php b/inc/lang/en/lang.php index 88fbadbd2b..58a7d56ed6 100644 --- a/inc/lang/en/lang.php +++ b/inc/lang/en/lang.php @@ -129,7 +129,7 @@ $lang['mediausage'] = 'Use the following syntax to reference this file:'; $lang['mediaview'] = 'View original file'; $lang['mediaroot'] = 'root'; -$lang['mediaupload'] = 'Upload a file to the current namespace here. To create subnamespaces, prepend them to your "Upload as" filename separated by colons.'; +$lang['mediaupload'] = 'Upload a file to the current namespace here. To create subnamespaces, prepend them to your "Upload as" filename separated by colons. Files also can be selected by drag and drop.'; $lang['mediaextchange'] = 'Filextension changed from .%s to .%s!'; $lang['js']['mediatitle'] = 'Link settings'; @@ -354,8 +354,8 @@ $lang['js']['media_diff_opacity'] = 'Overlay'; $lang['js']['media_diff_portions'] = 'Slider'; -$lang['js']['media_select'] = 'Select files...'; -$lang['js']['media_upload_btn'] = 'Start uploading'; +$lang['js']['media_select'] = 'Select files…'; +$lang['js']['media_upload_btn'] = 'Upload'; $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 abd817767e..8ef075f170 100644 --- a/inc/media.php +++ b/inc/media.php @@ -248,6 +248,8 @@ function media_delete($id,$auth){ * @return mixed false on error, id of the new file on success */ function media_upload_xhr($ns,$auth){ + if(!checkSecurityToken()) return false; + $id = $_GET['qqfile']; list($ext,$mime,$dl) = mimetype($id); $input = fopen("php://input", "r"); @@ -685,7 +687,7 @@ function media_tab_files_options($ns, $sort){ global $lang; echo '
'; - echo $ns; + echo $ns ? $ns : '['.$lang['mediaroot'].']'; echo '
'; @@ -753,7 +755,7 @@ function media_tab_upload($ns,$auth=null,$jump='') { if(is_null($auth)) $auth = auth_quickaclcheck("$ns:*"); echo '
'; - echo sprintf($lang['media_upload'], $ns); + echo sprintf($lang['media_upload'], $ns ? $ns : '['.$lang['mediaroot'].']'); echo '
'; echo '
'; @@ -775,7 +777,7 @@ function media_tab_search($ns,$auth=null) { if (!$query) $query = ''; echo '
'; - echo sprintf($lang['media_search'], $ns); + echo sprintf($lang['media_search'], $ns ? $ns : '['.$lang['mediaroot'].']'); echo'
'; echo '
'; diff --git a/lib/scripts/fileuploaderextended.js b/lib/scripts/fileuploaderextended.js index 60a3427a84..36fc3ec63d 100644 --- a/lib/scripts/fileuploaderextended.js +++ b/lib/scripts/fileuploaderextended.js @@ -56,6 +56,8 @@ qq.extend(qq.FileUploader.prototype, { this._find(item, 'size').style.display = 'none'; var nameElement = this._find(item, 'nameInput'); + fileName = fileName.toLowerCase(); + fileName = fileName.replace(/([^a-z0-9_\.\-]+)/g, '_'); nameElement.value = fileName; nameElement.id = 'mediamanager__upload_item'+id; @@ -77,8 +79,9 @@ qq.FileUploaderExtended = function(o){ '
' + LANG.media_drop + '
' + '
' + LANG.media_select + '
' + '
' + + '
' + '' + - '
' + + '
' + '
', // template for one item in file list diff --git a/lib/tpl/default/_fileuploader.css b/lib/tpl/default/_fileuploader.css index 07f3158a19..e87ba94db3 100644 --- a/lib/tpl/default/_fileuploader.css +++ b/lib/tpl/default/_fileuploader.css @@ -87,5 +87,14 @@ } .qq-uploader #dw__ow { - margin: 10px 0; + margin: 10px 3px -5px 10px; } + +.qq-uploader .check { + line-height: 18px; +} + +.qq-uploader #mediamanager__upload_button { + margin-top: -5px; + margin-bottom: 10px; +} \ No newline at end of file