Merge pull request #1534 from owncloud/files_l10n
Add translation support back to move/rename
This commit is contained in:
commit
40f6e1eba0
|
@ -11,8 +11,10 @@ $dir = stripslashes($_POST["dir"]);
|
|||
$file = stripslashes($_POST["file"]);
|
||||
$target = stripslashes(rawurldecode($_POST["target"]));
|
||||
|
||||
$l = OC_L10N::get('files');
|
||||
|
||||
if(\OC\Files\Filesystem::file_exists($target . '/' . $file)) {
|
||||
OCP\JSON::error(array("data" => array( "message" => "Could not move $file - File with this name already exists" )));
|
||||
OCP\JSON::error(array("data" => array( "message" => $l->t("Could not move %s - File with this name already exists", array($file)) )));
|
||||
exit;
|
||||
}
|
||||
|
||||
|
@ -22,8 +24,8 @@ if ($dir != '' || $file != 'Shared') {
|
|||
if(\OC\Files\Filesystem::rename($sourceFile, $targetFile)) {
|
||||
OCP\JSON::success(array("data" => array( "dir" => $dir, "files" => $file )));
|
||||
} else {
|
||||
OCP\JSON::error(array("data" => array( "message" => "Could not move $file" )));
|
||||
OCP\JSON::error(array("data" => array( "message" => $l->t("Could not move %s", array($file)) )));
|
||||
}
|
||||
}else{
|
||||
OCP\JSON::error(array("data" => array( "message" => "Could not move $file" )));
|
||||
OCP\JSON::error(array("data" => array( "message" => $l->t("Could not move %s", array($file)) )));
|
||||
}
|
||||
|
|
|
@ -11,14 +11,16 @@ $dir = stripslashes($_GET["dir"]);
|
|||
$file = stripslashes($_GET["file"]);
|
||||
$newname = stripslashes($_GET["newname"]);
|
||||
|
||||
$l = OC_L10N::get('files');
|
||||
|
||||
if ( $newname !== '.' and ($dir != '' || $file != 'Shared') and $newname !== '.') {
|
||||
$targetFile = \OC\Files\Filesystem::normalizePath($dir . '/' . $newname);
|
||||
$sourceFile = \OC\Files\Filesystem::normalizePath($dir . '/' . $file);
|
||||
if(\OC\Files\Filesystem::rename($sourceFile, $targetFile)) {
|
||||
OCP\JSON::success(array("data" => array( "dir" => $dir, "file" => $file, "newname" => $newname )));
|
||||
} else {
|
||||
OCP\JSON::error(array("data" => array( "message" => "Unable to rename file" )));
|
||||
OCP\JSON::error(array("data" => array( "message" => $l->t("Unable to rename file") )));
|
||||
}
|
||||
}else{
|
||||
OCP\JSON::error(array("data" => array( "message" => "Unable to rename file" )));
|
||||
OCP\JSON::error(array("data" => array( "message" => $l->t("Unable to rename file") )));
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ foreach ($files['size'] as $size) {
|
|||
$totalSize += $size;
|
||||
}
|
||||
if ($totalSize > \OC\Files\Filesystem::free_space($dir)) {
|
||||
OCP\JSON::error(array('data' => array('message' => $l->t('Not enough space available'),
|
||||
OCP\JSON::error(array('data' => array('message' => $l->t('Not enough storage available'),
|
||||
'uploadMaxFilesize' => $maxUploadFilesize,
|
||||
'maxHumanFilesize' => $maxHumanFilesize)));
|
||||
exit();
|
||||
|
|
Loading…
Reference in New Issue