summaryrefslogtreecommitdiffstats
path: root/files
diff options
context:
space:
mode:
authorTom Needham <needham.thomas@gmail.com>2012-01-01 01:18:02 +0000
committerTom Needham <needham.thomas@gmail.com>2012-01-01 01:18:02 +0000
commitcbb2db8622dbcff2314204bc548ebdd3005bd0fc (patch)
treebbe14faf0201b4131b8ca9c9d4eac59edb7da5e8 /files
parente7de25434206a4849a7c7315d4d9926325c7b730 (diff)
parenteb4cd869107d4afa1c259751e765ca39defb9279 (diff)
downloadnextcloud-server-cbb2db8622dbcff2314204bc548ebdd3005bd0fc.tar.gz
nextcloud-server-cbb2db8622dbcff2314204bc548ebdd3005bd0fc.zip
Fix merge conflicts
Diffstat (limited to 'files')
-rw-r--r--files/ajax/newfolder.php2
-rw-r--r--files/ajax/upload.php3
-rw-r--r--files/index.php3
-rw-r--r--files/js/fileactions.js2
-rw-r--r--files/js/filelist.js15
-rw-r--r--files/templates/index.php63
-rw-r--r--files/templates/part.list.php10
7 files changed, 50 insertions, 48 deletions
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 041ec0c92e3..5f0f68d9531 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 5740ece9716..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);
@@ -125,7 +125,7 @@ FileList={
tr.data('renaming',true);
var td=tr.children('td.filename');
var input=$('<input class="filename"></input>').val(name);
- var form=$('<form action="#"></form>')
+ var form=$('<form></form>')
form.append(input);
td.children('a.name').text('');
td.children('a.name').append(form)
@@ -134,9 +134,10 @@ FileList={
event.stopPropagation();
event.preventDefault();
var newname=input.val();
- tr.data('renaming',false);
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{
@@ -148,12 +149,12 @@ FileList={
if(newname.indexOf('.')>0){
span.append($('<span class="extention">'+newname.substr(newname.lastIndexOf('.'))+'</span>'));
}
- $.ajax({
- url: 'ajax/rename.php',
- data: { dir : $('#dir').val(), newname: newname, file: name }
+ $.get(OC.filePath('files','ajax','rename.php'), { dir : $('#dir').val(), newname: newname, file: name },function(){
+ tr.data('renaming',false);
});
+ return false;
});
- form.click(function(event){
+ input.click(function(event){
event.stopPropagation();
event.preventDefault();
});
diff --git a/files/templates/index.php b/files/templates/index.php
index 722c38e4776..c4acab25cc4 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 46830ba3a37..ae3f32b2e9f 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['mime']?>" 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['mime']?>" 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['mime']); ?>)">
<?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']);?>