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;
}
});
})
// 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 {
html += '<input id="shareWith" type="text" placeholder="'+t('core', 'Resharing is not allowed')+'" style="width:90%;" disabled="disabled"/>';
html += '</div>';

View file

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

View file

@ -411,18 +411,19 @@ class OC_Util {
exit();
}
/**
* get an id unqiue for this instance
* @return string
*/
public static function getInstanceId() {
$id=OC_Config::getValue('instanceid', null);
if(is_null($id)) {
$id=uniqid();
OC_Config::setValue('instanceid', $id);
}
return $id;
}
/**
* get an id unique for this instance
* @return string
*/
public static function getInstanceId() {
$id = OC_Config::getValue('instanceid', null);
if(is_null($id)) {
// 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);
}
return $id;
}
/**
* @brief Static lifespan (in seconds) when a request token expires.

View file

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

View file

@ -1,5 +1,6 @@
/**
* 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.
* See the COPYING-README file.
*/
@ -16,19 +17,27 @@ OC.Log={
levels:['Debug','Info','Warning','Error','Fatal'],
loaded:3,//are initially loaded
getMore:function(count){
if(!count){
count=10;
}
count = count || 10;
$.get(OC.filePath('settings','ajax','getlog.php'),{offset:OC.Log.loaded,count:count},function(result){
if(result.status=='success'){
OC.Log.addEntries(result.data);
$('html, body').animate({scrollTop: $(document).height()}, 800);
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){
for(var i=0;i<entries.length;i++){
var entry=entries[i];
@ -36,15 +45,15 @@ OC.Log={
var levelTd=$('<td/>');
levelTd.text(OC.Log.levels[entry.level]);
row.append(levelTd);
var appTd=$('<td/>');
appTd.text(entry.app);
row.append(appTd);
var messageTd=$('<td/>');
messageTd.text(entry.message);
row.append(messageTd);
var timeTd=$('<td/>');
timeTd.text(formatDate(entry.time*1000));
row.append(timeTd);
@ -58,4 +67,7 @@ $(document).ready(function(){
$('#moreLog').click(function(){
OC.Log.getMore();
})
$('#lessLog').click(function(){
OC.Log.showLess();
})
});

View file

@ -6,6 +6,7 @@
var UserList = {
useUndo: true,
availableGroups: [],
/**
* @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);
tr.find('td.subadmins').empty();
}
var allGroups = String($('#content table').attr('data-groups')).split(', ');
$.each(allGroups, function (i, group) {
$.each(this.availableGroups, function (i, group) {
groupsSelect.append($('<option value="' + escapeHTML(group) + '">' + escapeHTML(group) + '</option>'));
if (typeof subadminSelect !== 'undefined' && group != 'admin') {
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) {
UserList.doSort();
}
@ -218,7 +217,14 @@ var UserList = {
username: user,
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 () {
UserList.doSort();
UserList.availableGroups = $('#content table').attr('data-groups').split(', ');
UserList.offset = $('tbody tr').length;
$('tbody tr:last').bind('inview', function (event, isInView, visiblePartX, visiblePartY) {
OC.Router.registerLoadedCallback(function () {
@ -421,6 +428,8 @@ $(document).ready(function () {
OC.dialogs.alert(result.data.message,
t('settings', 'Error creating user'));
} else {
var addedGroups = result.data.groups.split(', ');
UserList.availableGroups = $.unique($.merge(UserList.availableGroups, addedGroups));
if($('tr[data-uid="' + username + '"]').length === 0) {
UserList.add(username, username, result.data.groups, null, 'default', true);
}

View file

@ -201,7 +201,7 @@ if (!$_['internetconnectionworking']) {
<?php endif;
endfor;?>
</select>
<table id='log'>
<table id="log">
<?php foreach ($_['entries'] as $entry): ?>
<tr>
<td>
@ -220,7 +220,8 @@ endfor;?>
<?php endforeach;?>
</table>
<?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; ?>
</fieldset>

View file

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