Merge branch 'master' into files_encryption

This commit is contained in:
Sam Tuke 2013-03-29 15:59:54 +01:00
commit 3cbfacb439
8 changed files with 71 additions and 29 deletions

View File

@ -235,7 +235,18 @@ OC.Share={
}); });
return false; return false;
} }
}); })
// customize internal _renderItem function to display groups and users differently
.data("ui-autocomplete")._renderItem = function( ul, item ) {
var insert = $( "<a>" ).text( item.label );
if(item.label.length > 8 && item.label.substr(item.label.length-8) === ' (group)') {
// current label is group - wrap "strong" element
insert = insert.wrapInner('<strong>');
}
return $( "<li>" )
.append( insert )
.appendTo( ul );
};
} else { } else {
html += '<input id="shareWith" type="text" placeholder="'+t('core', 'Resharing is not allowed')+'" style="width:90%;" disabled="disabled"/>'; html += '<input id="shareWith" type="text" placeholder="'+t('core', 'Resharing is not allowed')+'" style="width:90%;" disabled="disabled"/>';
html += '</div>'; html += '</div>';

View File

@ -134,8 +134,10 @@ class OC_Installer{
} }
// check if the app is compatible with this version of ownCloud // check if the app is compatible with this version of ownCloud
$version=OC_Util::getVersion(); if(
if(!isset($info['require']) or ($version[0]>$info['require'])) { !isset($info['require'])
or !OC_App::isAppVersionCompatible(OC_Util::getVersion(), $info['require'])
) {
OC_Log::write('core', OC_Log::write('core',
'App can\'t be installed because it is not compatible with this version of ownCloud', 'App can\'t be installed because it is not compatible with this version of ownCloud',
OC_Log::ERROR); OC_Log::ERROR);

View File

@ -412,13 +412,14 @@ class OC_Util {
} }
/** /**
* get an id unqiue for this instance * get an id unique for this instance
* @return string * @return string
*/ */
public static function getInstanceId() { public static function getInstanceId() {
$id=OC_Config::getValue('instanceid', null); $id = OC_Config::getValue('instanceid', null);
if(is_null($id)) { if(is_null($id)) {
$id=uniqid(); // We need to guarantee at least one letter in instanceid so it can be used as the session_name
$id = 'oc' . uniqid();
OC_Config::setValue('instanceid', $id); OC_Config::setValue('instanceid', $id);
} }
return $id; return $id;

View File

@ -79,6 +79,7 @@ span.version { margin-left:1em; margin-right:1em; color:#555; }
/* LOG */ /* LOG */
#log { white-space:normal; } #log { white-space:normal; }
#lessLog { display:none; }
/* ADMIN */ /* ADMIN */
span.securitywarning {color:#C33; font-weight:bold; } span.securitywarning {color:#C33; font-weight:bold; }

View File

@ -1,5 +1,6 @@
/** /**
* Copyright (c) 2012, Robin Appelman <icewind1991@gmail.com> * Copyright (c) 2012, Robin Appelman <icewind1991@gmail.com>
* Copyright (c) 2013, Morris Jobke <morris.jobke@gmail.com>
* This file is licensed under the Affero General Public License version 3 or later. * This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file. * See the COPYING-README file.
*/ */
@ -16,19 +17,27 @@ OC.Log={
levels:['Debug','Info','Warning','Error','Fatal'], levels:['Debug','Info','Warning','Error','Fatal'],
loaded:3,//are initially loaded loaded:3,//are initially loaded
getMore:function(count){ getMore:function(count){
if(!count){ count = count || 10;
count=10;
}
$.get(OC.filePath('settings','ajax','getlog.php'),{offset:OC.Log.loaded,count:count},function(result){ $.get(OC.filePath('settings','ajax','getlog.php'),{offset:OC.Log.loaded,count:count},function(result){
if(result.status=='success'){ if(result.status=='success'){
OC.Log.addEntries(result.data); OC.Log.addEntries(result.data);
$('html, body').animate({scrollTop: $(document).height()}, 800);
if(!result.remain){ if(!result.remain){
$('#moreLog').css('display', 'none'); $('#moreLog').hide();
} }
$('#lessLog').show();
} }
}); });
}, },
showLess:function(count){
count = count || 10;
//calculate remaining items - at least 3
OC.Log.loaded = Math.max(3,OC.Log.loaded-count);
$('#moreLog').show();
// remove all non-remaining items
$('#log tr').slice(OC.Log.loaded).remove();
if(OC.Log.loaded <= 3)
$('#lessLog').hide();
},
addEntries:function(entries){ addEntries:function(entries){
for(var i=0;i<entries.length;i++){ for(var i=0;i<entries.length;i++){
var entry=entries[i]; var entry=entries[i];
@ -58,4 +67,7 @@ $(document).ready(function(){
$('#moreLog').click(function(){ $('#moreLog').click(function(){
OC.Log.getMore(); OC.Log.getMore();
}) })
$('#lessLog').click(function(){
OC.Log.showLess();
})
}); });

View File

@ -6,6 +6,7 @@
var UserList = { var UserList = {
useUndo: true, useUndo: true,
availableGroups: [],
/** /**
* @brief Initiate user deletion process in UI * @brief Initiate user deletion process in UI
@ -78,8 +79,7 @@ var UserList = {
var subadminSelect = $('<select multiple="multiple" class="subadminsselect" data-placehoder="subadmins" title="' + t('settings', 'Group Admin') + '">').attr('data-username', username).attr('data-user-groups', groups).attr('data-subadmin', subadmin); var subadminSelect = $('<select multiple="multiple" class="subadminsselect" data-placehoder="subadmins" title="' + t('settings', 'Group Admin') + '">').attr('data-username', username).attr('data-user-groups', groups).attr('data-subadmin', subadmin);
tr.find('td.subadmins').empty(); tr.find('td.subadmins').empty();
} }
var allGroups = String($('#content table').attr('data-groups')).split(', '); $.each(this.availableGroups, function (i, group) {
$.each(allGroups, function (i, group) {
groupsSelect.append($('<option value="' + escapeHTML(group) + '">' + escapeHTML(group) + '</option>')); groupsSelect.append($('<option value="' + escapeHTML(group) + '">' + escapeHTML(group) + '</option>'));
if (typeof subadminSelect !== 'undefined' && group != 'admin') { if (typeof subadminSelect !== 'undefined' && group != 'admin') {
subadminSelect.append($('<option value="' + escapeHTML(group) + '">' + escapeHTML(group) + '</option>')); subadminSelect.append($('<option value="' + escapeHTML(group) + '">' + escapeHTML(group) + '</option>'));
@ -188,7 +188,6 @@ var UserList = {
}); });
} }
}); });
console.log('length', result.data.length);
if (result.data.length > 0) { if (result.data.length > 0) {
UserList.doSort(); UserList.doSort();
} }
@ -218,7 +217,14 @@ var UserList = {
username: user, username: user,
group: group group: group
}, },
function () { function (response) {
if(response.status === 'success' && response.data.action === 'add') {
if(UserList.availableGroups.indexOf(response.data.gropname) === -1) {
UserList.availableGroups.push(response.data.gropname);
}
} else {
OC.Notification.show(response.data.message);
}
} }
); );
}; };
@ -289,6 +295,7 @@ var UserList = {
$(document).ready(function () { $(document).ready(function () {
UserList.doSort(); UserList.doSort();
UserList.availableGroups = $('#content table').attr('data-groups').split(', ');
UserList.offset = $('tbody tr').length; UserList.offset = $('tbody tr').length;
$('tbody tr:last').bind('inview', function (event, isInView, visiblePartX, visiblePartY) { $('tbody tr:last').bind('inview', function (event, isInView, visiblePartX, visiblePartY) {
OC.Router.registerLoadedCallback(function () { OC.Router.registerLoadedCallback(function () {
@ -421,6 +428,8 @@ $(document).ready(function () {
OC.dialogs.alert(result.data.message, OC.dialogs.alert(result.data.message,
t('settings', 'Error creating user')); t('settings', 'Error creating user'));
} else { } else {
var addedGroups = result.data.groups.split(', ');
UserList.availableGroups = $.unique($.merge(UserList.availableGroups, addedGroups));
if($('tr[data-uid="' + username + '"]').length === 0) { if($('tr[data-uid="' + username + '"]').length === 0) {
UserList.add(username, username, result.data.groups, null, 'default', true); UserList.add(username, username, result.data.groups, null, 'default', true);
} }

View File

@ -201,7 +201,7 @@ if (!$_['internetconnectionworking']) {
<?php endif; <?php endif;
endfor;?> endfor;?>
</select> </select>
<table id='log'> <table id="log">
<?php foreach ($_['entries'] as $entry): ?> <?php foreach ($_['entries'] as $entry): ?>
<tr> <tr>
<td> <td>
@ -220,7 +220,8 @@ endfor;?>
<?php endforeach;?> <?php endforeach;?>
</table> </table>
<?php if ($_['entriesremain']): ?> <?php if ($_['entriesremain']): ?>
<input id='moreLog' type='button' value='<?php p($l->t('More'));?>...'> <input id="moreLog" type="button" value="<?php p($l->t('More'));?>...">
<input id="lessLog" type="button" value="<?php p($l->t('Less'));?>...">
<?php endif; ?> <?php endif; ?>
</fieldset> </fieldset>

View File

@ -54,4 +54,9 @@ class Test_Util extends PHPUnit_Framework_TestCase {
$this->assertEquals('no-reply@example.com', $email); $this->assertEquals('no-reply@example.com', $email);
OC_Config::deleteKey('mail_domain'); OC_Config::deleteKey('mail_domain');
} }
function testGetInstanceIdGeneratesValidId() {
OC_Config::deleteKey('instanceid');
$this->assertStringStartsWith('oc', OC_Util::getInstanceId());
}
} }