summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/js/share.js13
-rw-r--r--lib/installer.php6
-rwxr-xr-xlib/util.php25
-rw-r--r--settings/css/settings.css1
-rw-r--r--settings/js/log.js28
-rw-r--r--settings/js/users.js17
-rw-r--r--settings/templates/admin.php5
-rw-r--r--tests/lib/util.php5
8 files changed, 71 insertions, 29 deletions
diff --git a/core/js/share.js b/core/js/share.js
index 8ef76e2d082..7f6ee0ec417 100644
--- a/core/js/share.js
+++ b/core/js/share.js
@@ -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>';
diff --git a/lib/installer.php b/lib/installer.php
index 251d115b76c..49ba4492632 100644
--- a/lib/installer.php
+++ b/lib/installer.php
@@ -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);
diff --git a/lib/util.php b/lib/util.php
index 7e8fc9b6bb7..1fa3ad765d0 100755
--- a/lib/util.php
+++ b/lib/util.php
@@ -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.
diff --git a/settings/css/settings.css b/settings/css/settings.css
index 265a29b8f7f..46a0bbe7c32 100644
--- a/settings/css/settings.css
+++ b/settings/css/settings.css
@@ -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; }
diff --git a/settings/js/log.js b/settings/js/log.js
index 09b8ec1ab44..81117f9e827 100644
--- a/settings/js/log.js
+++ b/settings/js/log.js
@@ -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();
+ })
});
diff --git a/settings/js/users.js b/settings/js/users.js
index b0a70215f1c..d79b21765ff 100644
--- a/settings/js/users.js
+++ b/settings/js/users.js
@@ -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);
}
diff --git a/settings/templates/admin.php b/settings/templates/admin.php
index dd5e89b8f82..9d7a5d9a4cf 100644
--- a/settings/templates/admin.php
+++ b/settings/templates/admin.php
@@ -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>
diff --git a/tests/lib/util.php b/tests/lib/util.php
index 1c9054264c9..1f253825920 100644
--- a/tests/lib/util.php
+++ b/tests/lib/util.php
@@ -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());
+ }
}