From b3f3b8c23f4f07a4d38e952f4d77827380c34b58 Mon Sep 17 00:00:00 2001 From: Marvin Thomas Rabe Date: Tue, 21 Feb 2012 22:31:35 +0100 Subject: UI problems solved. Bookmarks app updated. --- settings/css/settings.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'settings') diff --git a/settings/css/settings.css b/settings/css/settings.css index 8d89cee6ec0..a8af839a1e6 100644 --- a/settings/css/settings.css +++ b/settings/css/settings.css @@ -26,9 +26,9 @@ tr:hover>td.password>span { margin:0; cursor:pointer; } tr:hover>td.remove>img, tr:hover>td.password>img, tr:hover>td.quota>img { visibility:visible; cursor:pointer; } tr:hover>td.remove>img { float:right; } li.selected { background-color:#ddd; } -#content>table:not(.nostyle) { margin-top:6.5em; } +#content>table:not(.nostyle) { margin-top:3em; } table:not(.nostyle) { width:100%; } - +#rightcontent { padding-left: 1em; } /* APPS */ li { color:#888; } -- cgit v1.2.3 From 3988ec2813c88fdd8a5caf5bb2a04a60868b18cc Mon Sep 17 00:00:00 2001 From: Marvin Thomas Rabe Date: Wed, 22 Feb 2012 23:22:17 +0100 Subject: Updated bookmark form --- apps/bookmarks/css/bookmarks.css | 7 +------ apps/bookmarks/js/bookmarks.js | 18 +++--------------- apps/bookmarks/templates/list.php | 13 ++++--------- settings/templates/users.php | 11 +++++------ 4 files changed, 13 insertions(+), 36 deletions(-) (limited to 'settings') diff --git a/apps/bookmarks/css/bookmarks.css b/apps/bookmarks/css/bookmarks.css index fedd2af7c4c..12ccf938b55 100644 --- a/apps/bookmarks/css/bookmarks.css +++ b/apps/bookmarks/css/bookmarks.css @@ -15,11 +15,6 @@ padding: 0.5ex; } -.bookmarks_add { - display: none; - margin-top: 45px; -} - .bookmarks_list { margin-top: 36px; } @@ -35,7 +30,7 @@ } .bookmarks_input { - width: 20em; + width: 8em; } .bookmark_actions { diff --git a/apps/bookmarks/js/bookmarks.js b/apps/bookmarks/js/bookmarks.js index 6db0969a2bb..166024eabde 100644 --- a/apps/bookmarks/js/bookmarks.js +++ b/apps/bookmarks/js/bookmarks.js @@ -3,11 +3,7 @@ var bookmarks_loading = false; var bookmarks_sorting = 'bookmarks_sorting_recent'; -$(document).ready(function() { - $('.bookmarks_addBtn').click(function(event){ - $('.bookmarks_add').slideToggle(); - }); - +$(document).ready(function() { $('#bookmark_add_submit').click(addOrEditBookmark); $(window).scroll(updateOnBottom); @@ -55,21 +51,14 @@ function addOrEditBookmark(event) { var title = encodeEntities($('#bookmark_add_title').val()); var tags = encodeEntities($('#bookmark_add_tags').val()); var taglist = tags.split(' '); - var tagshtml = ''; $("#firstrun").hide(); - - for ( var i=0, len=taglist.length; i' + taglist[i] + ' '; - } if (id == 0) { $.ajax({ url: 'ajax/addBookmark.php', data: 'url=' + encodeURI(url) + '&title=' + encodeURI(title) + '&tags=' + encodeURI(tags), success: function(response){ - var bookmark_id = response.data; - $('.bookmarks_add').slideToggle(); - $('.bookmarks_add').children('p').children('.bookmarks_input').val(''); + $('.bookmarks_input').val(''); $('.bookmarks_list').empty(); bookmarks_page = 0; getBookmarks(); @@ -81,8 +70,7 @@ function addOrEditBookmark(event) { url: 'ajax/editBookmark.php', data: 'id=' + id + '&url=' + encodeURI(url) + '&title=' + encodeURI(title) + '&tags=' + encodeURI(tags), success: function(){ - $('.bookmarks_add').slideToggle(); - $('.bookmarks_add').children('p').children('.bookmarks_input').val(''); + $('.bookmarks_input').val(''); $('#bookmark_add_id').val('0'); $('.bookmarks_list').empty(); bookmarks_page = 0; diff --git a/apps/bookmarks/templates/list.php b/apps/bookmarks/templates/list.php index 46577d16832..b3849069fee 100644 --- a/apps/bookmarks/templates/list.php +++ b/apps/bookmarks/templates/list.php @@ -9,16 +9,11 @@ ?>
- -
-
-

-

-

-

-

-

+ + + +
diff --git a/settings/templates/users.php b/settings/templates/users.php index bcc4d65fe43..fde4cfb9aed 100644 --- a/settings/templates/users.php +++ b/settings/templates/users.php @@ -12,15 +12,14 @@ foreach($_["groups"] as $group) {
- - - + + - - + +
-- cgit v1.2.3 From 9f5bce81b037624099012038f1ebfeb94d3317fd Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 24 Feb 2012 14:10:19 +0100 Subject: add a default user quota --- lib/fileproxy/quota.php | 30 ++++++++++++++++++++++++++++-- settings/ajax/setquota.php | 10 ++++++++-- 2 files changed, 36 insertions(+), 4 deletions(-) (limited to 'settings') diff --git a/lib/fileproxy/quota.php b/lib/fileproxy/quota.php index 94a49176ee6..9e4c2d0643e 100644 --- a/lib/fileproxy/quota.php +++ b/lib/fileproxy/quota.php @@ -26,11 +26,37 @@ */ class OC_FileProxy_Quota extends OC_FileProxy{ + private $userQuota=-1; + + /** + * get the quota for the current user + * @return int + */ + private function getQuota(){ + if($this->userQuota!=-1){ + return $this->userQuota; + } + $userQuota=OC_Preferences::getValue(OC_User::getUser(),'files','quota','default'); + if($userQuota=='default'){ + $userQuota=OC_AppConfig::getValue('files','default_quota','none'); + } + if($userQuota=='none'){ + $this->userQuota=0; + }else{ + $this->userQuota=OC_Helper::computerFileSize($userQuota); + } + return $this->userQuota; + + } + + /** + * get the free space in the users home folder + * @return int + */ private function getFreeSpace(){ $rootInfo=OC_FileCache::get(''); $usedSpace=$rootInfo['size']; - $totalSpace=OC_Preferences::getValue(OC_User::getUser(),'files','quota',0); - $totalSpace=OC_Helper::computerFileSize($totalSpace); + $totalSpace=$this->getQuota(); if($totalSpace==0){ return 0; } diff --git a/settings/ajax/setquota.php b/settings/ajax/setquota.php index d4e3c58ac11..7bfc65102c1 100644 --- a/settings/ajax/setquota.php +++ b/settings/ajax/setquota.php @@ -8,8 +8,14 @@ OC_JSON::checkAdminUser(); $username = $_POST["username"]; //make sure the quota is in the expected format -$quota= OC_Helper::computerFileSize($_POST["quota"]); -$quota=OC_Helper::humanFileSize($quota); +$quota=$_POST["quota"]; +if($quota!='none' and $quota!='default'){ + $quota= OC_Helper::computerFileSize($quota); + $quota=OC_Helper::humanFileSize($quota); +} +if($quota==0){ + $quota='default'; +} // Return Success story OC_Preferences::setValue($username,'files','quota',$quota); -- cgit v1.2.3 From 4230e217af16b400cf6eba26c2333ee4ea1f884c Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 24 Feb 2012 14:38:40 +0100 Subject: new config widget for user quota --- settings/ajax/setquota.php | 9 ++-- settings/css/settings.css | 3 ++ settings/js/users.js | 105 ++++++++++++++++++++++++++++--------------- settings/templates/users.php | 14 ++++-- settings/users.php | 8 +++- 5 files changed, 94 insertions(+), 45 deletions(-) (limited to 'settings') diff --git a/settings/ajax/setquota.php b/settings/ajax/setquota.php index 7bfc65102c1..e66513e54cc 100644 --- a/settings/ajax/setquota.php +++ b/settings/ajax/setquota.php @@ -11,10 +11,11 @@ $username = $_POST["username"]; $quota=$_POST["quota"]; if($quota!='none' and $quota!='default'){ $quota= OC_Helper::computerFileSize($quota); - $quota=OC_Helper::humanFileSize($quota); -} -if($quota==0){ - $quota='default'; + if($quota==0){ + $quota='default'; + }else{ + $quota=OC_Helper::humanFileSize($quota); + } } // Return Success story diff --git a/settings/css/settings.css b/settings/css/settings.css index a8af839a1e6..b80d7da82c6 100644 --- a/settings/css/settings.css +++ b/settings/css/settings.css @@ -29,6 +29,9 @@ li.selected { background-color:#ddd; } #content>table:not(.nostyle) { margin-top:3em; } table:not(.nostyle) { width:100%; } #rightcontent { padding-left: 1em; } +td.quota { position:relative } +select.quota { position:absolute; left:0px; top:0px; width:10em; } +input.quota-other { display:none; position:absolute; left:0.1em; top:0.1em; width:7em; border:none; -webkit-box-shadow: none -mox-box-shadow:none ; box-shadow:none; } /* APPS */ li { color:#888; } diff --git a/settings/js/users.js b/settings/js/users.js index c9b1d855db0..bfc00138e0e 100644 --- a/settings/js/users.js +++ b/settings/js/users.js @@ -5,6 +5,18 @@ */ $(document).ready(function(){ + function setQuota(uid,quota,ready){ + $.post( + OC.filePath('settings','ajax','setquota.php'), + {username:uid,quota:quota}, + function(result){ + if(ready){ + ready(result.data.quota); + } + } + ); + } + function applyMultiplySelect(element){ var checked=[]; var user=element.data('username'); @@ -82,48 +94,63 @@ $(document).ready(function(){ $('td.password').live('click',function(event){ $(this).children('img').click(); }); - - $('td.quota>img').live('click',function(event){ - event.stopPropagation(); - var img=$(this); - var uid=img.parent().parent().data('uid'); - var input=$(''); - var quota=img.parent().children('span').text(); - if(quota=='None'){ - quota=''; + + $('select.quota').live('change',function(){ + var select=$(this); + var uid=$(this).parent().parent().data('uid'); + var quota=$(this).val(); + var other=$(this).next(); + if(quota!='other'){ + other.hide(); + select.data('previous',quota); + setQuota(uid,quota); + }else{ + other.show(); + other.focus(); } - input.val(quota); - img.css('display','none'); - img.parent().children('span').replaceWith(input); - input.focus(); - input.keypress(function(event) { - if(event.keyCode == 13) { - $(this).parent().attr('data-quota',$(this).val()); - if($(this).val().length>0){ - $.post( - OC.filePath('settings','ajax','setquota.php'), - {username:uid,quota:$(this).val()}, - function(result){ - img.parent().children('span').text(result.data.quota) - $(this).parent().attr('data-quota',result.data.quota); - } - ); - input.blur(); + }); + $('select.quota').each(function(i,select){ + $(select).data('previous',$(select).val()); + }) + + $('input.quota-other').live('change',function(){ + var uid=$(this).parent().parent().data('uid'); + var quota=$(this).val(); + var select=$(this).prev(); + var other=$(this); + if(quota){ + setQuota(uid,quota,function(quota){ + select.children().attr('selected',null); + var existingOption=select.children().filter(function(i,option){ + return ($(option).val()==quota); + }); + if(existingOption.length){ + existingOption.attr('selected','selected'); }else{ - input.blur(); + var option=$('