diff --git a/apps/files_pdfviewer/appinfo/info.xml b/apps/files_pdfviewer/appinfo/info.xml index 86a6c3f22f..f133f1900d 100755 --- a/apps/files_pdfviewer/appinfo/info.xml +++ b/apps/files_pdfviewer/appinfo/info.xml @@ -1,7 +1,8 @@ files_pdfviewer - PDF viewer (pdfjs-based) + PDF Viewer + Inline PDF viewer (pdfjs-based) 0.1 GPL Joan Creus diff --git a/apps/gallery/lib/photo.php b/apps/gallery/lib/photo.php index 4eb313bfc3..872ecc9488 100644 --- a/apps/gallery/lib/photo.php +++ b/apps/gallery/lib/photo.php @@ -69,7 +69,6 @@ class OC_Gallery_Photo { public static function getThumbnail($image_name) { $save_dir = OC_Config::getValue("datadirectory").'/'. OC_User::getUser() .'/gallery/'; $save_dir .= dirname($image_name). '/'; - $image_name = basename($image_name); $thumb_file = $save_dir . $image_name; if (file_exists($thumb_file)) { $image = new OC_Image($thumb_file); diff --git a/core/css/styles.css b/core/css/styles.css index 335b008ffd..b14c8fb9ca 100644 --- a/core/css/styles.css +++ b/core/css/styles.css @@ -40,8 +40,8 @@ input[type="text"]:hover, input[type="text"]:focus, input[type="text"]:active, input[type="password"]:hover, input[type="password"]:focus, input[type="password"]:active, .searchbox input[type="search"]:hover, .searchbox input[type="search"]:focus, .searchbox input[type="search"]:active { background-color:#fff; color:#333; opacity:1; } -input[type="submit"], input[type="button"], button, .button, #quota, div.jp-progress, .pager li a { width:auto; padding:.4em; border:1px solid #ddd; font-weight:bold; cursor:pointer; background:#f8f8f8; color:#555; text-shadow:#fff 0 1px 0; -moz-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; -webkit-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; } -input[type="submit"]:hover, input[type="submit"]:focus, input[type="button"]:hover, input[type="button"]:focus, .button:hover { background:#fff; color:#333; } +input[type="submit"], input[type="button"], button, .button, #quota, div.jp-progress, select, .pager li a { width:auto; padding:.4em; border:1px solid #ddd; font-weight:bold; cursor:pointer; background:#f8f8f8; color:#555; text-shadow:#fff 0 1px 0; -moz-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; -webkit-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; } +input[type="submit"]:hover, input[type="submit"]:focus, input[type="button"]:hover, select:hover, select:focus, select:active, input[type="button"]:focus, .button:hover { background:#fff; color:#333; } input[type="checkbox"] { width:auto; } #quota { cursor:default; } diff --git a/files/js/files.js b/files/js/files.js index bebcf4e97a..9f1f5368df 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -166,6 +166,7 @@ $(document).ready(function() { $('.file_upload_start').live('change',function(){ var form=$(this).closest('form'); + var that=this; var uploadId=form.attr('data-upload-id'); var files=this.files; var target=form.children('iframe'); @@ -173,6 +174,12 @@ $(document).ready(function() { if(files){ for(var i=0;i$('#max_upload').val()){ diff --git a/lib/fileproxy/quota.php b/lib/fileproxy/quota.php index 94a49176ee..9e4c2d0643 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/lib/group/database.php b/lib/group/database.php index f35f61434f..1afd4b5fe4 100644 --- a/lib/group/database.php +++ b/lib/group/database.php @@ -130,7 +130,7 @@ class OC_Group_Database extends OC_Group_Backend { * removes the user from a group. */ public static function removeFromGroup( $uid, $gid ){ - $query = OC_DB::prepare( "DELETE FROM `*PREFIX*group_user` WHERE `uid` = ? AND `gid` = ?" ); + $query = OC_DB::prepare( "DELETE FROM *PREFIX*group_user WHERE uid = ? AND gid = ?" ); $result = $query->execute( array( $uid, $gid )); return true; diff --git a/lib/user.php b/lib/user.php index 34f44f572e..0746fcc6eb 100644 --- a/lib/user.php +++ b/lib/user.php @@ -321,7 +321,10 @@ class OC_User { $users=array(); foreach(self::$_usedBackends as $backend){ if($backend->implementsActions(OC_USER_BACKEND_GET_USERS)){ - $users=array_merge($users,$backend->getUsers()); + $backendUsers=$backend->getUsers(); + if(is_array($backendUsers)){ + $users=array_merge($users,$backendUsers); + } } } return $users; diff --git a/settings/ajax/setquota.php b/settings/ajax/setquota.php index d4e3c58ac1..dc87625a05 100644 --- a/settings/ajax/setquota.php +++ b/settings/ajax/setquota.php @@ -5,14 +5,28 @@ require_once('../../lib/base.php'); OC_JSON::checkAdminUser(); -$username = $_POST["username"]; +$username = isset($_POST["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); + if($quota==0){ + $quota='default'; + }else{ + $quota=OC_Helper::humanFileSize($quota); + } +} // Return Success story -OC_Preferences::setValue($username,'files','quota',$quota); +if($username){ + OC_Preferences::setValue($username,'files','quota',$quota); +}else{//set the default quota when no username is specified + if($quota=='default'){//'default' as default quota makes no sense + $quota='none'; + } + OC_Appconfig::setValue('files','default_quota',$quota); +} OC_JSON::success(array("data" => array( "username" => $username ,'quota'=>$quota))); ?> diff --git a/settings/css/settings.css b/settings/css/settings.css index a8af839a1e..7a5873bb4d 100644 --- a/settings/css/settings.css +++ b/settings/css/settings.css @@ -29,6 +29,12 @@ 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 } +div.quota { float:right; display:block; position:absolute; right:25em; top:0; } +select.quota { position:absolute; left:0; top:0; 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; } +div.quota>span { position:absolute; right:0em; white-space:nowrap; top: 0.7em } +select.quota.active { background: #fff; } /* APPS */ li { color:#888; } diff --git a/settings/js/users.js b/settings/js/users.js index c9b1d855db..eed93d3b30 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,66 @@ $(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(); + select.addClass('active'); + 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=$('')); }); tr.find('td.groups').append(select); @@ -166,5 +202,9 @@ $(document).ready(function(){ } applyMultiplySelect(select); $('#content table tbody').last().after(tr); + + tr.find('select.quota option').attr('selected',null); + tr.find('select.quota option').first().attr('selected','selected'); + tr.find('select.quota').data('previous','default'); }); }); diff --git a/settings/templates/users.php b/settings/templates/users.php index fde4cfb9ae..a23a5bafe6 100644 --- a/settings/templates/users.php +++ b/settings/templates/users.php @@ -21,6 +21,21 @@ foreach($_["groups"] as $group) { +
+ t('Default Quota');?>: + + +
@@ -48,9 +63,17 @@ foreach($_["groups"] as $group) { -
- 0)?$user['quota']:'None';?> - set new password + + + diff --git a/settings/users.php b/settings/users.php index e5dcc04948..96515a90ce 100644 --- a/settings/users.php +++ b/settings/users.php @@ -18,17 +18,26 @@ $users = array(); $groups = array(); foreach( OC_User::getUsers() as $i ){ - $users[] = array( "name" => $i, "groups" => join( ", ", OC_Group::getUserGroups( $i ) ),'quota'=>OC_Preferences::getValue($i,'files','quota',0)); + $users[] = array( "name" => $i, "groups" => join( ", ", OC_Group::getUserGroups( $i ) ),'quota'=>OC_Preferences::getValue($i,'files','quota','default')); } foreach( OC_Group::getGroups() as $i ){ // Do some more work here soon $groups[] = array( "name" => $i ); } +$quotaPreset=OC_Appconfig::getValue('files','quota_preset','default,none,1 GB, 5 GB, 10 GB'); +$quotaPreset=explode(',',$quotaPreset); +foreach($quotaPreset as &$preset){ + $preset=trim($preset); +} + +$defaultQuota=OC_Appconfig::getValue('files','default_quota','none'); $tmpl = new OC_Template( "settings", "users", "user" ); $tmpl->assign( "users", $users ); $tmpl->assign( "groups", $groups ); +$tmpl->assign( 'quota_preset', $quotaPreset); +$tmpl->assign( 'default_quota', $defaultQuota); $tmpl->printPage(); ?>