diff options
author | Robin Appelman <icewind1991@gmail.com> | 2012-01-08 01:53:40 +0100 |
---|---|---|
committer | Robin Appelman <icewind1991@gmail.com> | 2012-01-08 01:53:40 +0100 |
commit | d1edc360d9bd7d97c35d25b54dadec61004cd869 (patch) | |
tree | 7344744268280ccbdc194746a7b40dfc90a33260 /files | |
parent | 3844fb0e4ce093bb3c2e67d20f85f61b7723efdc (diff) | |
parent | 8f8985c3e53862e2ca6446f296d4835a9577faac (diff) | |
download | nextcloud-server-d1edc360d9bd7d97c35d25b54dadec61004cd869.tar.gz nextcloud-server-d1edc360d9bd7d97c35d25b54dadec61004cd869.zip |
merge master into filesystem
Diffstat (limited to 'files')
-rw-r--r-- | files/ajax/move.php | 2 | ||||
-rw-r--r-- | files/ajax/newfolder.php | 2 | ||||
-rw-r--r-- | files/ajax/upload.php | 3 | ||||
-rw-r--r-- | files/index.php | 3 | ||||
-rw-r--r-- | files/js/fileactions.js | 2 | ||||
-rw-r--r-- | files/js/filelist.js | 4 | ||||
-rw-r--r-- | files/templates/index.php | 63 | ||||
-rw-r--r-- | files/templates/part.list.php | 10 |
8 files changed, 46 insertions, 43 deletions
diff --git a/files/ajax/move.php b/files/ajax/move.php index 8a56a015486..3517901c6cf 100644 --- a/files/ajax/move.php +++ b/files/ajax/move.php @@ -14,7 +14,7 @@ $target = $_GET["target"]; if(OC_Files::move($dir,$file,$target,$file)){ OC_JSON::success(array("data" => array( "dir" => $dir, "files" => $file ))); }else{ - OC_JSON::error(array("data" => array( "message" => "Could move $file" ))); + OC_JSON::error(array("data" => array( "message" => "Could not move $file" ))); } ?> diff --git a/files/ajax/newfolder.php b/files/ajax/newfolder.php index 6966e912c56..d244fb7be19 100644 --- a/files/ajax/newfolder.php +++ b/files/ajax/newfolder.php @@ -9,7 +9,7 @@ OC_JSON::checkLoggedIn(); $dir = isset( $_GET['dir'] ) ? $_GET['dir'] : ''; $foldername = isset( $_GET['foldername'] ) ? $_GET['foldername'] : ''; -if($foldername == '') { +if(trim($foldername) == '') { OC_JSON::error(array("data" => array( "message" => "Empty Foldername" ))); exit(); } diff --git a/files/ajax/upload.php b/files/ajax/upload.php index d9dafde7779..241edc216ff 100644 --- a/files/ajax/upload.php +++ b/files/ajax/upload.php @@ -14,9 +14,10 @@ if (!isset($_FILES['files'])) { } foreach ($_FILES['files']['error'] as $error) { if ($error != 0) { + $l=new OC_L10N('files'); $errors = array( 0=>$l->t("There is no error, the file uploaded with success"), - 1=>$l->t("The uploaded file exceeds the upload_max_filesize directive in php.ini"), + 1=>$l->t("The uploaded file exceeds the upload_max_filesize directive in php.ini").ini_get('upload_max_filesize'), 2=>$l->t("The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form"), 3=>$l->t("The uploaded file was only partially uploaded"), 4=>$l->t("No file was uploaded"), diff --git a/files/index.php b/files/index.php index 4b3bbd1bfd4..fc69a42bec6 100644 --- a/files/index.php +++ b/files/index.php @@ -71,7 +71,7 @@ $breadcrumb = array(); $pathtohere = ""; foreach( explode( "/", $dir ) as $i ){ if( $i != "" ){ - $pathtohere .= "/$i"; + $pathtohere .= "/".str_replace('+','%20', urlencode($i)); $breadcrumb[] = array( "dir" => $pathtohere, "name" => $i ); } } @@ -97,6 +97,7 @@ $tmpl = new OC_Template( "files", "index", "user" ); $tmpl->assign( "fileList", $list->fetchPage() ); $tmpl->assign( "breadcrumb", $breadcrumbNav->fetchPage() ); $tmpl->assign( 'dir', $dir); +$tmpl->assign( 'readonly', !OC_Filesystem::is_writeable($dir)); $tmpl->assign( "files", $files ); $tmpl->assign( 'uploadMaxFilesize', $maxUploadFilesize); $tmpl->assign( 'uploadMaxHumanFilesize', OC_Helper::humanFileSize($maxUploadFilesize)); diff --git a/files/js/fileactions.js b/files/js/fileactions.js index 9e2688e82c1..6f0729e43b6 100644 --- a/files/js/fileactions.js +++ b/files/js/fileactions.js @@ -137,7 +137,7 @@ FileActions.register('all','Rename',function(){return OC.imagePath('core','actio }); FileActions.register('dir','Open','',function(filename){ - window.location='index.php?dir='+$('#dir').val()+'/'+filename; + window.location='index.php?dir='+encodeURIComponent($('#dir').val()).replace(/%2F/g, '/')+'/'+encodeURIComponent(filename); }); FileActions.setDefault('dir','Open'); diff --git a/files/js/filelist.js b/files/js/filelist.js index 16f73ed58d6..35847e06dfe 100644 --- a/files/js/filelist.js +++ b/files/js/filelist.js @@ -40,7 +40,7 @@ FileList={ html = $('<tr></tr>').attr({ "data-type": "dir", "data-size": size, "data-file": name}); td = $('<td></td>').attr({"class": "filename", "style": 'background-image:url('+OC.imagePath('core', 'filetypes/folder.png')+')' }); td.append('<input type="checkbox" />'); - var link_elem = $('<a></a>').attr({ "class": "name", "href": "index.php?dir="+ encodeURIComponent($('#dir').val()+'/'+name) }); + var link_elem = $('<a></a>').attr({ "class": "name", "href": "index.php?dir="+ encodeURIComponent($('#dir').val()+'/'+name).replace(/%2F/g, '/') }); link_elem.append($('<span></span>').addClass('nametext').text(name)); td.append(link_elem); html.append(td); @@ -136,6 +136,8 @@ FileList={ var newname=input.val(); tr.attr('data-file',newname); td.children('a.name').empty(); + var path = td.children('a.name').attr('href'); + td.children('a.name').attr('href', path.replace(encodeURIComponent(name), encodeURIComponent(newname))); if(newname.indexOf('.')>0){ basename=newname.substr(0,newname.lastIndexOf('.')); }else{ diff --git a/files/templates/index.php b/files/templates/index.php index 21a4e2df010..595e8803353 100644 --- a/files/templates/index.php +++ b/files/templates/index.php @@ -1,42 +1,37 @@ <div id="controls"> <?php echo($_['breadcrumb']); ?> - <?php if (!isset($_['readonly']) || !$_['readonly']) {?> - <div class="actions"> - <div id='new' class='button'> - <a> - <?php echo $l->t('New');?> - </a> - <ul class="popup popupTop"> - <li style="background-image:url('<?php echo mimetype_icon('text/plain') ?>')" data-type='file'><p><?php echo $l->t('Text file');?></p></li> - <li style="background-image:url('<?php echo mimetype_icon('dir') ?>')" data-type='folder'><p><?php echo $l->t('Folder');?></p></li> -<!-- <li style="background-image:url('<?php echo mimetype_icon('dir') ?>')" data-type='web'><p><?php echo $l->t('From the web');?></p></li> --> - </ul> + <?php if (!isset($_['readonly']) || !$_['readonly']):?> + <div class="actions"> + <div id='new' class='button'> + <a> + <?php echo $l->t('New');?> + </a> + <ul class="popup popupTop"> + <li style="background-image:url('<?php echo mimetype_icon('text/plain') ?>')" data-type='file'><p><?php echo $l->t('Text file');?></p></li> + <li style="background-image:url('<?php echo mimetype_icon('dir') ?>')" data-type='folder'><p><?php echo $l->t('Folder');?></p></li> + <!-- <li style="background-image:url('<?php echo mimetype_icon('dir') ?>')" data-type='web'><p><?php echo $l->t('From the web');?></p></li> --> + </ul> + </div> + <div class="file_upload_wrapper svg"> + <form data-upload-id='1' class="file_upload_form" action="ajax/upload.php" method="post" enctype="multipart/form-data" target="file_upload_target_1"> + <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $_['uploadMaxFilesize'] ?>" id="max_upload"> + <input type="hidden" class="max_human_file_size" value="(max <?php echo $_['uploadMaxHumanFilesize']; ?>)"> + <input type="hidden" name="dir" value="<?php echo $_['dir'] ?>" id="dir"> + <button class="file_upload_filename"><img class='svg action' alt="Upload" src="<?php echo image_path("core", "actions/upload.svg"); ?>" /></button> + <input class="file_upload_start" type="file" name='files[]'/> + <a href="#" class="file_upload_button_wrapper" onclick="return false;" title="<?php echo $l->t('Upload'); echo ' max. '.$_['uploadMaxHumanFilesize'] ?>"></a> + <iframe name="file_upload_target_1" class='file_upload_target' src=""></iframe> + </form> + </div> </div> - <div class="file_upload_wrapper svg"> - <form data-upload-id='1' class="file_upload_form" action="ajax/upload.php" method="post" enctype="multipart/form-data" target="file_upload_target_1"> - <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $_['uploadMaxFilesize'] ?>" id="max_upload"> - <input type="hidden" class="max_human_file_size" value="(max <?php echo $_['uploadMaxHumanFilesize']; ?>)"> - <input type="hidden" name="dir" value="<?php echo $_['dir'] ?>" id="dir"> - <button class="file_upload_filename"><img class='svg action' alt="Upload" src="<?php echo image_path("core", "actions/upload.svg"); ?>" /></button> - <input class="file_upload_start" type="file" name='files[]'/> - <a href="#" class="file_upload_button_wrapper" onclick="return false;" title="<?php echo $l->t('Upload'); echo ' max. '.$_['uploadMaxHumanFilesize'] ?>"></a> - <iframe name="file_upload_target_1" class='file_upload_target' src=""></iframe> - </form> - </div> - </div> - <div id="file_action_panel"> - </div> + <div id="file_action_panel"></div> + <?php endif;?> </div> -<?php -} -?> <div id='notification'></div> -<?php -if (isset($_['files'])) { - if (!count($_['files'])) { ?> -<div id="emptyfolder"><?php echo $l->t('Nothing in here. Upload something!')?></div> -<?php }}?> +<?php if (isset($_['files']) and ! $_['readonly'] and count($_['files'])==0):?> + <div id="emptyfolder"><?php echo $l->t('Nothing in here. Upload something!')?></div> +<?php endif; ?> <table> <thead> @@ -53,7 +48,7 @@ if (isset($_['files'])) { <th id="headerDate"><span id="modified"><?php echo $l->t( 'Modified' ); ?></span><span class="selectedActions"><a href="" title="Delete" class="delete"><img class="svg" alt="<?php echo $l->t('Delete')?>" src="<?php echo image_path("core", "actions/delete.svg"); ?>" /></a></span></th> </tr> </thead> - <tbody id="fileList"> + <tbody id="fileList" data-readonly="<?php echo $_['readonly'];?>"> <?php echo($_['fileList']); ?> </tbody> </table> diff --git a/files/templates/part.list.php b/files/templates/part.list.php index 7ae5756c22e..fdcd7d6f8a7 100644 --- a/files/templates/part.list.php +++ b/files/templates/part.list.php @@ -4,11 +4,15 @@ if($simple_size_color<0) $simple_size_color = 0; $relative_modified_date = relative_modified_date($file['mtime']); $relative_date_color = round((time()-$file['mtime'])/60/60/24*14); // the older the file, the brighter the shade of grey; days*14 - if($relative_date_color>200) $relative_date_color = 200; ?> - <tr data-file="<?php echo str_replace('+','%20',urlencode($file['name']));?>" data-type="<?php echo ($file['type'] == 'dir')?'dir':'file'?>" data-mime="<?php echo $file['mimetype']?>" data-size='<?php echo $file['size'];?>'> + if($relative_date_color>200) $relative_date_color = 200; + $name = str_replace('+','%20',urlencode($file['name'])); + $name = str_replace('%2F','/', $name); + $directory = str_replace('+','%20',urlencode($file['directory'])); + $directory = str_replace('%2F','/', $directory); ?> + <tr data-file="<?php echo $name;?>" data-type="<?php echo ($file['type'] == 'dir')?'dir':'file'?>" data-mime="<?php echo $file['mimetype']?>" data-size='<?php echo $file['size'];?>'> <td class="filename svg" style="background-image:url(<?php if($file['type'] == 'dir') echo mimetype_icon('dir'); else echo mimetype_icon($file['mimetype']); ?>)"> <?php if(!isset($_['readonly']) || !$_['readonly']) { ?><input type="checkbox" /><?php } ?> - <a class="name" href="<?php if($file['type'] == 'dir') echo $_['baseURL'].$file['directory'].'/'.$file['name']; else echo $_['downloadURL'].urlencode($file['directory']).'/'.urlencode($file['name']); ?>" title=""> + <a class="name" href="<?php if($file['type'] == 'dir') echo $_['baseURL'].$directory.'/'.$name; else echo $_['downloadURL'].$directory.'/'.$name; ?>" title=""> <span class="nametext"> <?php if($file['type'] == 'dir'):?> <?php echo htmlspecialchars($file['name']);?> |