Merge pull request #1059 from owncloud/fixing-998-master
Fixing 998 master
This commit is contained in:
commit
276d98b9dd
|
@ -21,20 +21,11 @@ foreach($files as $file) {
|
|||
}
|
||||
}
|
||||
|
||||
// updated max file size after upload
|
||||
$l=new OC_L10N('files');
|
||||
$maxUploadFilesize=OCP\Util::maxUploadFilesize($dir);
|
||||
$maxHumanFilesize=OCP\Util::humanFileSize($maxUploadFilesize);
|
||||
$maxHumanFilesize=$l->t('Upload') . ' max. '.$maxHumanFilesize;
|
||||
// get array with updated storage stats (e.g. max file size) after upload
|
||||
$storageStats = \OCA\files\lib\Helper::buildFileStorageStatistics($dir);
|
||||
|
||||
if ($success) {
|
||||
OCP\JSON::success(array("data" => array( "dir" => $dir, "files" => $files,
|
||||
'uploadMaxFilesize'=>$maxUploadFilesize,
|
||||
'maxHumanFilesize'=>$maxHumanFilesize
|
||||
)));
|
||||
OCP\JSON::success(array("data" => array_merge(array("dir" => $dir, "files" => $files), $storageStats)));
|
||||
} else {
|
||||
OCP\JSON::error(array("data" => array( "message" => "Could not delete:\n" . $filesWithError,
|
||||
'uploadMaxFilesize'=>$maxUploadFilesize,
|
||||
'maxHumanFilesize'=>$maxHumanFilesize
|
||||
)));
|
||||
OCP\JSON::error(array("data" => array_merge(array("message" => "Could not delete:\n" . $filesWithError), $storageStats)));
|
||||
}
|
||||
|
|
|
@ -5,12 +5,5 @@ $RUNTIME_APPTYPES = array('filesystem');
|
|||
|
||||
OCP\JSON::checkLoggedIn();
|
||||
|
||||
$l=new OC_L10N('files');
|
||||
$maxUploadFilesize = OCP\Util::maxUploadFilesize($dir);
|
||||
$maxHumanFilesize = OCP\Util::humanFileSize($maxUploadFilesize);
|
||||
$maxHumanFilesize = $l->t('Upload') . ' max. ' . $maxHumanFilesize;
|
||||
|
||||
// send back json
|
||||
OCP\JSON::success(array('data' => array('uploadMaxFilesize' => $maxUploadFilesize,
|
||||
'maxHumanFilesize' => $maxHumanFilesize
|
||||
)));
|
||||
OCP\JSON::success(array('data' => \OCA\files\lib\Helper::buildFileStorageStatistics('/')));
|
||||
|
|
|
@ -10,17 +10,11 @@ OCP\JSON::checkLoggedIn();
|
|||
OCP\JSON::callCheck();
|
||||
$l = OC_L10N::get('files');
|
||||
|
||||
// current max upload size
|
||||
$l=new OC_L10N('files');
|
||||
$maxUploadFilesize=OCP\Util::maxUploadFilesize($dir);
|
||||
$maxHumanFilesize=OCP\Util::humanFileSize($maxUploadFilesize);
|
||||
$maxHumanFilesize=$l->t('Upload') . ' max. '.$maxHumanFilesize;
|
||||
// get array with current storage stats (e.g. max file size)
|
||||
$storageStats = \OCA\files\lib\Helper::buildFileStorageStatistics($dir);
|
||||
|
||||
if (!isset($_FILES['files'])) {
|
||||
OCP\JSON::error(array('data' => array( 'message' => $l->t( 'No file was uploaded. Unknown error' ),
|
||||
'uploadMaxFilesize'=>$maxUploadFilesize,
|
||||
'maxHumanFilesize'=>$maxHumanFilesize
|
||||
)));
|
||||
OCP\JSON::error(array('data' => array_merge(array('message' => $l->t('No file was uploaded. Unknown error')), $storageStats)));
|
||||
exit();
|
||||
}
|
||||
|
||||
|
@ -37,10 +31,7 @@ foreach ($_FILES['files']['error'] as $error) {
|
|||
UPLOAD_ERR_NO_TMP_DIR => $l->t('Missing a temporary folder'),
|
||||
UPLOAD_ERR_CANT_WRITE => $l->t('Failed to write to disk'),
|
||||
);
|
||||
OCP\JSON::error(array('data' => array( 'message' => $errors[$error],
|
||||
'uploadMaxFilesize'=>$maxUploadFilesize,
|
||||
'maxHumanFilesize'=>$maxHumanFilesize
|
||||
)));
|
||||
OCP\JSON::error(array('data' => array_merge(array('message' => $errors[$error]), $storageStats)));
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
@ -54,9 +45,7 @@ foreach($files['size'] as $size) {
|
|||
$totalSize += $size;
|
||||
}
|
||||
if ($totalSize > OC_Filesystem::free_space($dir)) {
|
||||
OCP\JSON::error(array('data' => array( 'message' => $l->t( 'Not enough space available' ),
|
||||
'uploadMaxFilesize'=>$maxUploadFilesize,
|
||||
'maxHumanFilesize'=>$maxHumanFilesize)));
|
||||
OCP\JSON::error(array('data' => array_merge(array('message' => $l->t('Not enough storage available')), $storageStats)));
|
||||
exit();
|
||||
}
|
||||
|
||||
|
@ -70,18 +59,15 @@ if(strpos($dir, '..') === false) {
|
|||
if (is_uploaded_file($files['tmp_name'][$i]) and OC_Filesystem::fromTmpFile($files['tmp_name'][$i], $target)) {
|
||||
$meta = OC_FileCache::get($target);
|
||||
$id = OC_FileCache::getId($target);
|
||||
// updated max file size after upload
|
||||
$maxUploadFilesize=OCP\Util::maxUploadFilesize($dir);
|
||||
$maxHumanFilesize=OCP\Util::humanFileSize($maxUploadFilesize);
|
||||
$maxHumanFilesize=$l->t('Upload') . ' max. '.$maxHumanFilesize;
|
||||
|
||||
$result[]=array( 'status' => 'success',
|
||||
// updated max file size after upload
|
||||
$storageStats = \OCA\files\lib\Helper::buildFileStorageStatistics($dir);
|
||||
|
||||
$result[] = array_merge(array('status' => 'success',
|
||||
'mime' => $meta['mimetype'],
|
||||
'size' => $meta['size'],
|
||||
'id' => $id,
|
||||
'name'=>basename($target),
|
||||
'uploadMaxFilesize'=>$maxUploadFilesize,
|
||||
'maxHumanFilesize'=>$maxHumanFilesize
|
||||
'name' => basename($target)), $storageStats
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -91,7 +77,4 @@ if(strpos($dir, '..') === false) {
|
|||
$error = $l->t('Invalid directory.');
|
||||
}
|
||||
|
||||
OCP\JSON::error(array('data' => array('message' => $error,
|
||||
'uploadMaxFilesize'=>$maxUploadFilesize,
|
||||
'maxHumanFilesize'=>$maxHumanFilesize
|
||||
)));
|
||||
OCP\JSON::error(array('data' => array_merge(array('message' => $error), $storageStats)));
|
||||
|
|
|
@ -93,6 +93,9 @@ if (OC_Filesystem::isSharable($dir . '/')) {
|
|||
$permissions |= OCP\PERMISSION_SHARE;
|
||||
}
|
||||
|
||||
// information about storage capacities
|
||||
$storageInfo=OC_Helper::getStorageInfo();
|
||||
|
||||
$tmpl = new OCP\Template('files', 'index', 'user');
|
||||
$tmpl->assign('fileList', $list->fetchPage(), false);
|
||||
$tmpl->assign('breadcrumb', $breadcrumbNav->fetchPage(), false);
|
||||
|
@ -103,4 +106,5 @@ $tmpl->assign('files', $files);
|
|||
$tmpl->assign('uploadMaxFilesize', $maxUploadFilesize);
|
||||
$tmpl->assign('uploadMaxHumanFilesize', OCP\Util::humanFileSize($maxUploadFilesize));
|
||||
$tmpl->assign('allowZipDownload', intval(OCP\Config::getSystemValue('allowZipDownload', true)));
|
||||
$tmpl->assign('usedSpacePercent', (int)$storageInfo['relative']);
|
||||
$tmpl->printPage();
|
||||
|
|
|
@ -201,15 +201,14 @@ var FileList={
|
|||
},
|
||||
checkName:function(oldName, newName, isNewFile) {
|
||||
if (isNewFile || $('tr').filterAttr('data-file', newName).length > 0) {
|
||||
if (isNewFile) {
|
||||
$('#notification').html(t('files', '{new_name} already exists', {new_name: escapeHTML(newName)})+'<span class="replace">'+t('files', 'replace')+'</span><span class="suggest">'+t('files', 'suggest name')+'</span><span class="cancel">'+t('files', 'cancel')+'</span>');
|
||||
} else {
|
||||
$('#notification').html(t('files', '{new_name} already exists', {new_name: escapeHTML(newName)})+'<span class="replace">'+t('files', 'replace')+'</span><span class="cancel">'+t('files', 'cancel')+'</span>');
|
||||
}
|
||||
$('#notification').data('oldName', oldName);
|
||||
$('#notification').data('newName', newName);
|
||||
$('#notification').data('isNewFile', isNewFile);
|
||||
$('#notification').fadeIn();
|
||||
if (isNewFile) {
|
||||
OC.Notification.showHtml(t('files', '{new_name} already exists', {new_name: escapeHTML(newName)})+'<span class="replace">'+t('files', 'replace')+'</span><span class="suggest">'+t('files', 'suggest name')+'</span><span class="cancel">'+t('files', 'cancel')+'</span>');
|
||||
} else {
|
||||
OC.Notification.showHtml(t('files', '{new_name} already exists', {new_name: escapeHTML(newName)})+'<span class="replace">'+t('files', 'replace')+'</span><span class="cancel">'+t('files', 'cancel')+'</span>');
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
@ -251,11 +250,10 @@ var FileList={
|
|||
FileList.finishReplace();
|
||||
};
|
||||
if (isNewFile) {
|
||||
$('#notification').html(t('files', 'replaced {new_name}', {new_name: newName})+'<span class="undo">'+t('files', 'undo')+'</span>');
|
||||
OC.Notification.showHtml(t('files', 'replaced {new_name}', {new_name: newName})+'<span class="undo">'+t('files', 'undo')+'</span>');
|
||||
} else {
|
||||
$('#notification').html(t('files', 'replaced {new_name} with {old_name}', {new_name: newName}, {old_name: oldName})+'<span class="undo">'+t('files', 'undo')+'</span>');
|
||||
OC.Notification.showHtml(t('files', 'replaced {new_name} with {old_name}', {new_name: newName}, {old_name: oldName})+'<span class="undo">'+t('files', 'undo')+'</span>');
|
||||
}
|
||||
$('#notification').fadeIn();
|
||||
},
|
||||
finishReplace:function() {
|
||||
if (!FileList.replaceCanceled && FileList.replaceOldName && FileList.replaceNewName) {
|
||||
|
@ -285,11 +283,10 @@ var FileList={
|
|||
} else {
|
||||
// NOTE: Temporary fix to change the text to unshared for files in root of Shared folder
|
||||
if ($('#dir').val() == '/Shared') {
|
||||
$('#notification').html(t('files', 'unshared {files}', {'files': escapeHTML(files)})+'<span class="undo">'+t('files', 'undo')+'</span>');
|
||||
OC.Notification.showHtml(t('files', 'unshared {files}', {'files': escapeHTML(files)})+'<span class="undo">'+t('files', 'undo')+'</span>');
|
||||
} else {
|
||||
$('#notification').html(t('files', 'deleted {files}', {'files': escapeHTML(files)})+'<span class="undo">'+t('files', 'undo')+'</span>');
|
||||
OC.Notification.showHtml(t('files', 'deleted {files}', {'files': escapeHTML(files)})+'<span class="undo">'+t('files', 'undo')+'</span>');
|
||||
}
|
||||
$('#notification').fadeIn();
|
||||
}
|
||||
},
|
||||
finishDelete:function(ready,sync){
|
||||
|
@ -302,7 +299,7 @@ var FileList={
|
|||
data: {dir:$('#dir').val(),files:fileNames},
|
||||
complete: function(data){
|
||||
boolOperationFinished(data, function(){
|
||||
$('#notification').fadeOut('400');
|
||||
OC.Notification.hide();
|
||||
$.each(FileList.deleteFiles,function(index,file){
|
||||
FileList.remove(file);
|
||||
});
|
||||
|
@ -362,16 +359,16 @@ $(document).ready(function(){
|
|||
FileList.replaceIsNewFile = null;
|
||||
}
|
||||
FileList.lastAction = null;
|
||||
$('#notification').fadeOut('400');
|
||||
OC.Notification.hide();
|
||||
});
|
||||
$('#notification .replace').live('click', function() {
|
||||
$('#notification').fadeOut('400', function() {
|
||||
OC.Notification.hide(function() {
|
||||
FileList.replace($('#notification').data('oldName'), $('#notification').data('newName'), $('#notification').data('isNewFile'));
|
||||
});
|
||||
});
|
||||
$('#notification .suggest').live('click', function() {
|
||||
$('tr').filterAttr('data-file', $('#notification').data('oldName')).show();
|
||||
$('#notification').fadeOut('400');
|
||||
OC.Notification.hide();
|
||||
});
|
||||
$('#notification .cancel').live('click', function() {
|
||||
if ($('#notification').data('isNewFile')) {
|
||||
|
|
|
@ -32,26 +32,28 @@ Files={
|
|||
}
|
||||
if(response.data !== undefined && response.data.uploadMaxFilesize !== undefined) {
|
||||
$('#max_upload').val(response.data.uploadMaxFilesize);
|
||||
$('#data-upload-form a').attr('original-title', response.data.maxHumanFilesize);
|
||||
$('#upload.button').attr('original-title', response.data.maxHumanFilesize);
|
||||
$('#usedSpacePercent').val(response.data.usedSpacePercent);
|
||||
Files.displayStorageWarnings();
|
||||
}
|
||||
if(response[0] == undefined) {
|
||||
return;
|
||||
}
|
||||
if(response[0].uploadMaxFilesize !== undefined) {
|
||||
$('#max_upload').val(response[0].uploadMaxFilesize);
|
||||
$('#data-upload-form a').attr('original-title', response[0].maxHumanFilesize);
|
||||
$('#upload.button').attr('original-title', response[0].maxHumanFilesize);
|
||||
$('#usedSpacePercent').val(response[0].usedSpacePercent);
|
||||
Files.displayStorageWarnings();
|
||||
}
|
||||
|
||||
},
|
||||
isFileNameValid:function (name) {
|
||||
if (name === '.') {
|
||||
$('#notification').text(t('files', '\'.\' is an invalid file name.'));
|
||||
$('#notification').fadeIn();
|
||||
OC.Notification.show(t('files', '\'.\' is an invalid file name.'));
|
||||
return false;
|
||||
}
|
||||
if (name.length == 0) {
|
||||
$('#notification').text(t('files', 'File name cannot be empty.'));
|
||||
$('#notification').fadeIn();
|
||||
OC.Notification.show(t('files', 'File name cannot be empty.'));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -59,13 +61,26 @@ Files={
|
|||
var invalid_characters = ['\\', '/', '<', '>', ':', '"', '|', '?', '*'];
|
||||
for (var i = 0; i < invalid_characters.length; i++) {
|
||||
if (name.indexOf(invalid_characters[i]) != -1) {
|
||||
$('#notification').text(t('files', "Invalid name, '\\', '/', '<', '>', ':', '\"', '|', '?' and '*' are not allowed."));
|
||||
$('#notification').fadeIn();
|
||||
OC.Notification.show(t('files', "Invalid name, '\\', '/', '<', '>', ':', '\"', '|', '?' and '*' are not allowed."));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
$('#notification').fadeOut();
|
||||
OC.Notification.hide();
|
||||
return true;
|
||||
},
|
||||
displayStorageWarnings: function() {
|
||||
if (!OC.Notification.isHidden()) {
|
||||
return;
|
||||
}
|
||||
|
||||
var usedSpacePercent = $('#usedSpacePercent').val();
|
||||
if (usedSpacePercent > 98) {
|
||||
OC.Notification.show(t('files', 'Your storage is full, files can not be updated or synced anymore!'));
|
||||
return;
|
||||
}
|
||||
if (usedSpacePercent > 90) {
|
||||
OC.Notification.show(t('files', 'Your storage is almost full ({usedSpacePercent}%)', {usedSpacePercent: usedSpacePercent}));
|
||||
}
|
||||
}
|
||||
};
|
||||
$(document).ready(function() {
|
||||
|
@ -201,8 +216,7 @@ $(document).ready(function() {
|
|||
$('.download').click('click',function(event) {
|
||||
var files=getSelectedFiles('name').join(';');
|
||||
var dir=$('#dir').val()||'/';
|
||||
$('#notification').text(t('files','Your download is being prepared. This might take some time if the files are big.'));
|
||||
$('#notification').fadeIn();
|
||||
OC.Notification.show(t('files','Your download is being prepared. This might take some time if the files are big.'));
|
||||
// use special download URL if provided, e.g. for public shared files
|
||||
if ( (downloadURL = document.getElementById("downloadURL")) ) {
|
||||
window.location=downloadURL.value+"&download&files="+files;
|
||||
|
@ -331,8 +345,7 @@ $(document).ready(function() {
|
|||
var response;
|
||||
response=jQuery.parseJSON(result);
|
||||
if(response[0] == undefined || response[0].status != 'success') {
|
||||
$('#notification').text(t('files', response.data.message));
|
||||
$('#notification').fadeIn();
|
||||
OC.Notification.show(t('files', response.data.message));
|
||||
}
|
||||
Files.updateMaxUploadFilesize(response);
|
||||
var file=response[0];
|
||||
|
@ -372,9 +385,7 @@ $(document).ready(function() {
|
|||
uploadtext.text(t('files', '{count} files uploading', {count: currentUploads}));
|
||||
}
|
||||
delete uploadingFiles[dirName][fileName];
|
||||
$('#notification').hide();
|
||||
$('#notification').text(t('files', 'Upload cancelled.'));
|
||||
$('#notification').fadeIn();
|
||||
OC.Notification.show(t('files', 'Upload cancelled.'));
|
||||
}
|
||||
});
|
||||
//TODO test with filenames containing slashes
|
||||
|
@ -401,8 +412,7 @@ $(document).ready(function() {
|
|||
FileList.loadingDone(file.name, file.id);
|
||||
} else {
|
||||
Files.cancelUpload(this.files[0].name);
|
||||
$('#notification').text(t('files', response.data.message));
|
||||
$('#notification').fadeIn();
|
||||
OC.Notification.show(t('files', response.data.message));
|
||||
$('#fileList > tr').not('[data-mime]').fadeOut();
|
||||
$('#fileList > tr').not('[data-mime]').remove();
|
||||
}
|
||||
|
@ -410,9 +420,7 @@ $(document).ready(function() {
|
|||
.error(function(jqXHR, textStatus, errorThrown) {
|
||||
if(errorThrown === 'abort') {
|
||||
Files.cancelUpload(this.files[0].name);
|
||||
$('#notification').hide();
|
||||
$('#notification').text(t('files', 'Upload cancelled.'));
|
||||
$('#notification').fadeIn();
|
||||
OC.Notification.show(t('files', 'Upload cancelled.'));
|
||||
}
|
||||
});
|
||||
uploadingFiles[uniqueName] = jqXHR;
|
||||
|
@ -435,8 +443,7 @@ $(document).ready(function() {
|
|||
FileList.loadingDone(file.name, file.id);
|
||||
} else {
|
||||
//TODO Files.cancelUpload(/*where do we get the filename*/);
|
||||
$('#notification').text(t('files', response.data.message));
|
||||
$('#notification').fadeIn();
|
||||
OC.Notification.show(t('files', response.data.message));
|
||||
$('#fileList > tr').not('[data-mime]').fadeOut();
|
||||
$('#fileList > tr').not('[data-mime]').remove();
|
||||
}
|
||||
|
@ -556,14 +563,12 @@ $(document).ready(function() {
|
|||
event.preventDefault();
|
||||
var newname=input.val();
|
||||
if(type == 'web' && newname.length == 0) {
|
||||
$('#notification').text(t('files', 'URL cannot be empty.'));
|
||||
$('#notification').fadeIn();
|
||||
OC.Notification.show(t('files', 'URL cannot be empty.'));
|
||||
return false;
|
||||
} else if (type != 'web' && !Files.isFileNameValid(newname)) {
|
||||
return false;
|
||||
} else if( type == 'folder' && $('#dir').val() == '/' && newname == 'Shared') {
|
||||
$('#notification').text(t('files','Invalid folder name. Usage of \'Shared\' is reserved by Owncloud'));
|
||||
$('#notification').fadeIn();
|
||||
OC.Notification.show(t('files','Invalid folder name. Usage of \'Shared\' is reserved by Owncloud'));
|
||||
return false;
|
||||
}
|
||||
if (FileList.lastAction) {
|
||||
|
@ -734,6 +739,10 @@ $(document).ready(function() {
|
|||
|
||||
resizeBreadcrumbs(true);
|
||||
|
||||
// display storage warnings
|
||||
setTimeout ( "Files.displayStorageWarnings()", 100 );
|
||||
OC.Notification.setDefault(Files.displayStorageWarnings);
|
||||
|
||||
// file space size sync
|
||||
function update_storage_statistics() {
|
||||
$.getJSON(OC.filePath('files','ajax','getstoragestats.php'),function(response) {
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
namespace OCA\files\lib;
|
||||
|
||||
class Helper
|
||||
{
|
||||
public static function buildFileStorageStatistics($dir) {
|
||||
$l = new \OC_L10N('files');
|
||||
$maxUploadFilesize = \OCP\Util::maxUploadFilesize($dir);
|
||||
$maxHumanFilesize = \OCP\Util::humanFileSize($maxUploadFilesize);
|
||||
$maxHumanFilesize = $l->t('Upload') . ' max. ' . $maxHumanFilesize;
|
||||
|
||||
// information about storage capacities
|
||||
$storageInfo = \OC_Helper::getStorageInfo();
|
||||
|
||||
return array('uploadMaxFilesize' => $maxUploadFilesize,
|
||||
'maxHumanFilesize' => $maxHumanFilesize,
|
||||
'usedSpacePercent' => (int)$storageInfo['relative']);
|
||||
}
|
||||
}
|
|
@ -50,7 +50,6 @@
|
|||
<?php endif;?>
|
||||
<input type="hidden" name="permissions" value="<?php echo $_['permissions']; ?>" id="permissions">
|
||||
</div>
|
||||
<div id='notification'></div>
|
||||
|
||||
<?php if (isset($_['files']) and $_['isCreatable'] and count($_['files'])==0):?>
|
||||
<div id="emptyfolder"><?php echo $l->t('Nothing in here. Upload something!')?></div>
|
||||
|
@ -115,3 +114,4 @@
|
|||
|
||||
<!-- config hints for javascript -->
|
||||
<input type="hidden" name="allowZipDownload" id="allowZipDownload" value="<?php echo $_['allowZipDownload']; ?>" />
|
||||
<input type="hidden" name="usedSpacePercent" id="usedSpacePercent" value="<?php echo $_['usedSpacePercent']; ?>" />
|
||||
|
|
|
@ -191,7 +191,8 @@ fieldset.warning legend { color:#b94a48 !important; }
|
|||
.bold { font-weight:bold; }
|
||||
.center { text-align:center; }
|
||||
|
||||
#notification { z-index:101; background-color:#fc4; border:0; padding:0 .7em .3em; display:none; position:fixed; left:50%; top:0; -moz-border-radius-bottomleft:1em; -webkit-border-bottom-left-radius:1em; border-bottom-left-radius:1em; -moz-border-radius-bottomright:1em; -webkit-border-bottom-right-radius:1em; border-bottom-right-radius:1em; }
|
||||
#notification-container { position: fixed; top: 0px; width: 100%; text-align: center; z-index: 101; line-height: 1.2;}
|
||||
#notification { z-index:101; background-color:#fc4; border:0; padding:0 .7em .3em; display:none; position: relative; top:0; -moz-border-radius-bottomleft:1em; -webkit-border-bottom-left-radius:1em; border-bottom-left-radius:1em; -moz-border-radius-bottomright:1em; -webkit-border-bottom-right-radius:1em; border-bottom-right-radius:1em; }
|
||||
#notification span { cursor:pointer; font-weight:bold; margin-left:1em; }
|
||||
|
||||
tr .action, .selectedActions a { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; filter:alpha(opacity=0); opacity:0; }
|
||||
|
|
|
@ -44,7 +44,7 @@ function t(app,text, vars){
|
|||
return typeof r === 'string' || typeof r === 'number' ? r : a;
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
if( typeof( t.cache[app][text] ) !== 'undefined' ){
|
||||
if(typeof vars === 'object') {
|
||||
return _build(t.cache[app][text], vars);
|
||||
|
@ -310,6 +310,41 @@ OC.search.lastResults={};
|
|||
OC.addStyle.loaded=[];
|
||||
OC.addScript.loaded=[];
|
||||
|
||||
OC.Notification={
|
||||
getDefaultNotificationFunction: null,
|
||||
setDefault: function(callback) {
|
||||
OC.Notification.getDefaultNotificationFunction = callback;
|
||||
},
|
||||
hide: function(callback) {
|
||||
$("#notification").text('');
|
||||
$('#notification').fadeOut('400', function(){
|
||||
if (OC.Notification.isHidden()) {
|
||||
if (OC.Notification.getDefaultNotificationFunction) {
|
||||
OC.Notification.getDefaultNotificationFunction.call();
|
||||
}
|
||||
}
|
||||
if (callback) {
|
||||
callback.call();
|
||||
}
|
||||
});
|
||||
},
|
||||
showHtml: function(html) {
|
||||
var notification = $('#notification');
|
||||
notification.hide();
|
||||
notification.html(html);
|
||||
notification.fadeIn().css("display","inline");
|
||||
},
|
||||
show: function(text) {
|
||||
var notification = $('#notification');
|
||||
notification.hide();
|
||||
notification.text(text);
|
||||
notification.fadeIn().css("display","inline");
|
||||
},
|
||||
isHidden: function() {
|
||||
return ($("#notification").text() === '');
|
||||
}
|
||||
};
|
||||
|
||||
OC.Breadcrumb={
|
||||
container:null,
|
||||
crumbs:[],
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
</head>
|
||||
|
||||
<body id="<?php echo $_['bodyid'];?>">
|
||||
<div id="notification-container">
|
||||
<div id="notification"></div>
|
||||
</div>
|
||||
<header><div id="header">
|
||||
<a href="<?php echo link_to('', 'index.php'); ?>" title="" id="owncloud"><img class="svg" src="<?php echo image_path('', 'logo-wide.svg'); ?>" alt="ownCloud" /></a>
|
||||
<a class="header-right header-action" id="logout" href="<?php echo link_to('', 'index.php'); ?>?logout=true"><img class="svg" alt="<?php echo $l->t('Log out');?>" title="<?php echo $l->t('Log out'); echo OC_User::getUser()?' ('.OC_User::getUser().') ':'' ?>" src="<?php echo image_path('', 'actions/logout.svg'); ?>" /></a>
|
||||
|
|
|
@ -785,4 +785,23 @@ class OC_Helper {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the disc space
|
||||
*/
|
||||
public static function getStorageInfo() {
|
||||
$rootInfo = OC_FileCache::get('');
|
||||
$used = $rootInfo['size'];
|
||||
if ($used < 0) {
|
||||
$used = 0;
|
||||
}
|
||||
$free = OC_Filesystem::free_space();
|
||||
$total = $free + $used;
|
||||
if ($total == 0) {
|
||||
$total = 1; // prevent division by zero
|
||||
}
|
||||
$relative = round(($used / $total) * 10000) / 100;
|
||||
|
||||
return array('free' => $free, 'used' => $used, 'total' => $total, 'relative' => $relative);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,9 +26,8 @@ var UserList = {
|
|||
UserList.deleteCanceled = false;
|
||||
|
||||
// Provide user with option to undo
|
||||
$('#notification').html(t('users', 'deleted') + ' ' + uid + '<span class="undo">' + t('users', 'undo') + '</span>');
|
||||
$('#notification').data('deleteuser', true);
|
||||
$('#notification').fadeIn();
|
||||
OC.Notification.showHtml(t('users', 'deleted') + ' ' + uid + '<span class="undo">' + t('users', 'undo') + '</span>');
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -53,7 +52,7 @@ var UserList = {
|
|||
success:function (result) {
|
||||
if (result.status == 'success') {
|
||||
// Remove undo option, & remove user from table
|
||||
$('#notification').fadeOut();
|
||||
OC.Notification.hide();
|
||||
$('tr').filterAttr('data-uid', UserList.deleteUid).remove();
|
||||
UserList.deleteCanceled = true;
|
||||
if (ready) {
|
||||
|
@ -197,7 +196,7 @@ var UserList = {
|
|||
checked:checked,
|
||||
oncheck:checkHandeler,
|
||||
onuncheck:checkHandeler,
|
||||
minWidth:100,
|
||||
minWidth:100
|
||||
});
|
||||
}
|
||||
if ($(element).attr('class') == 'subadminsselect') {
|
||||
|
@ -232,7 +231,7 @@ var UserList = {
|
|||
checked:checked,
|
||||
oncheck:checkHandeler,
|
||||
onuncheck:checkHandeler,
|
||||
minWidth:100,
|
||||
minWidth:100
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -389,7 +388,7 @@ $(document).ready(function () {
|
|||
{
|
||||
username:username,
|
||||
password:password,
|
||||
groups:groups,
|
||||
groups:groups
|
||||
},
|
||||
function (result) {
|
||||
if (result.status != 'success') {
|
||||
|
@ -402,13 +401,13 @@ $(document).ready(function () {
|
|||
);
|
||||
});
|
||||
// Handle undo notifications
|
||||
$('#notification').hide();
|
||||
OC.Notification.hide();
|
||||
$('#notification .undo').live('click', function () {
|
||||
if ($('#notification').data('deleteuser')) {
|
||||
$('tbody tr').filterAttr('data-uid', UserList.deleteUid).show();
|
||||
UserList.deleteCanceled = true;
|
||||
}
|
||||
$('#notification').fadeOut();
|
||||
OC.Notification.hide();
|
||||
});
|
||||
UserList.useUndo = ('onbeforeunload' in window)
|
||||
$(window).bind('beforeunload', function () {
|
||||
|
|
|
@ -15,15 +15,7 @@ OC_Util::addScript( '3rdparty', 'chosen/chosen.jquery.min' );
|
|||
OC_Util::addStyle( '3rdparty', 'chosen' );
|
||||
OC_App::setActiveNavigationEntry( 'personal' );
|
||||
|
||||
// calculate the disc space
|
||||
$rootInfo=OC_FileCache::get('');
|
||||
$sharedInfo=OC_FileCache::get('/Shared');
|
||||
$used=$rootInfo['size'];
|
||||
if($used<0) $used=0;
|
||||
$free=OC_Filesystem::free_space();
|
||||
$total=$free+$used;
|
||||
if($total==0) $total=1; // prevent division by zero
|
||||
$relative=round(($used/$total)*10000)/100;
|
||||
$storageInfo=OC_Helper::getStorageInfo();
|
||||
|
||||
$email=OC_Preferences::getValue(OC_User::getUser(), 'settings', 'email', '');
|
||||
|
||||
|
@ -50,9 +42,9 @@ foreach($languageCodes as $lang) {
|
|||
|
||||
// Return template
|
||||
$tmpl = new OC_Template( 'settings', 'personal', 'user');
|
||||
$tmpl->assign('usage', OC_Helper::humanFileSize($used));
|
||||
$tmpl->assign('total_space', OC_Helper::humanFileSize($total));
|
||||
$tmpl->assign('usage_relative', $relative);
|
||||
$tmpl->assign('usage', OC_Helper::humanFileSize($storageInfo['used']));
|
||||
$tmpl->assign('total_space', OC_Helper::humanFileSize($storageInfo['total']));
|
||||
$tmpl->assign('usage_relative', $storageInfo['relative']);
|
||||
$tmpl->assign('email', $email);
|
||||
$tmpl->assign('languages', $languages);
|
||||
|
||||
|
|
|
@ -73,8 +73,6 @@ $_['subadmingroups'] = array_flip($items);
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div id='notification'></div>
|
||||
|
||||
<table data-groups="<?php echo implode(', ', $allGroups);?>">
|
||||
<thead>
|
||||
<tr>
|
||||
|
|
Loading…
Reference in New Issue