diff options
author | Frank Karlitschek <frank@owncloud.org> | 2013-01-30 14:36:17 +0100 |
---|---|---|
committer | Frank Karlitschek <frank@owncloud.org> | 2013-01-30 14:36:17 +0100 |
commit | 66cab77b6d83980d260cd35556d2759089d2971b (patch) | |
tree | ccf3767afba89f90ea82bd0805f23eb189956b53 /settings/js | |
parent | 389c4e84153893a04310876ef70943cad53ee3e7 (diff) | |
parent | 5761bd771f4142394a00083712b63e77f8976946 (diff) | |
download | nextcloud-server-66cab77b6d83980d260cd35556d2759089d2971b.tar.gz nextcloud-server-66cab77b6d83980d260cd35556d2759089d2971b.zip |
merge master
Merge branch 'master' into improved_appsmanagement
Conflicts:
settings/apps.php
settings/templates/apps.php
Diffstat (limited to 'settings/js')
-rw-r--r-- | settings/js/apps-custom.php | 26 | ||||
-rw-r--r-- | settings/js/isadmin.php | 20 | ||||
-rw-r--r-- | settings/js/users.js | 51 |
3 files changed, 89 insertions, 8 deletions
diff --git a/settings/js/apps-custom.php b/settings/js/apps-custom.php new file mode 100644 index 00000000000..9ec2a758ee3 --- /dev/null +++ b/settings/js/apps-custom.php @@ -0,0 +1,26 @@ +<?php +/** + * Copyright (c) 2013 Lukas Reschke <lukas@statuscode.ch> + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ + +// Check if admin user +OC_Util::checkAdminUser(); + +// Set the content type to JSON +header('Content-type: application/json'); + +// Disallow caching +header("Cache-Control: no-cache, must-revalidate"); +header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); + +$combinedApps = OC_App::listAllApps(); + +foreach($combinedApps as $app) { + echo("appData_".$app['id']."=".json_encode($app)); + echo("\n"); +} + +echo ("var appid =\"".$_GET['appid']."\";");
\ No newline at end of file diff --git a/settings/js/isadmin.php b/settings/js/isadmin.php new file mode 100644 index 00000000000..8b31f8a7cf9 --- /dev/null +++ b/settings/js/isadmin.php @@ -0,0 +1,20 @@ +<?php +/** + * Copyright (c) 2013 Lukas Reschke <lukas@statuscode.ch> + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ + +// Set the content type to Javascript +header("Content-type: text/javascript"); + +// Disallow caching +header("Cache-Control: no-cache, must-revalidate"); +header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); + +if (OC_User::isAdminUser(OC_User::getUser())) { + echo("var isadmin = true;"); +} else { + echo("var isadmin = false;"); +}
\ No newline at end of file diff --git a/settings/js/users.js b/settings/js/users.js index fa6f058d923..424d00b51a7 100644 --- a/settings/js/users.js +++ b/settings/js/users.js @@ -26,9 +26,8 @@ var UserList = { UserList.deleteCanceled = false; // Provide user with option to undo - $('#notification').html(t('users', 'deleted') + ' ' + uid + '<span class="undo">' + t('users', 'undo') + '</span>'); $('#notification').data('deleteuser', true); - $('#notification').fadeIn(); + OC.Notification.showHtml(t('users', 'deleted') + ' ' + uid + '<span class="undo">' + t('users', 'undo') + '</span>'); }, /** @@ -53,7 +52,7 @@ var UserList = { success:function (result) { if (result.status == 'success') { // Remove undo option, & remove user from table - $('#notification').fadeOut(); + OC.Notification.hide(); $('tr').filterAttr('data-uid', UserList.deleteUid).remove(); UserList.deleteCanceled = true; if (ready) { @@ -70,7 +69,9 @@ var UserList = { add:function (username, groups, subadmin, quota, sort) { var tr = $('tbody tr').first().clone(); tr.attr('data-uid', username); + tr.attr('data-displayName', username); tr.find('td.name').text(username); + tr.find('td.displayName').text(username); var groupsSelect = $('<select multiple="multiple" class="groupsselect" data-placehoder="Groups" title="' + t('settings', 'Groups') + '"></select>').attr('data-username', username).attr('data-user-groups', groups); tr.find('td.groups').empty(); if (tr.find('td.subadmins').length > 0) { @@ -197,7 +198,7 @@ var UserList = { checked:checked, oncheck:checkHandeler, onuncheck:checkHandeler, - minWidth:100, + minWidth:100 }); } if ($(element).attr('class') == 'subadminsselect') { @@ -232,7 +233,7 @@ var UserList = { checked:checked, oncheck:checkHandeler, onuncheck:checkHandeler, - minWidth:100, + minWidth:100 }); } } @@ -300,6 +301,40 @@ $(document).ready(function () { $('td.password').live('click', function (event) { $(this).children('img').click(); }); + + $('td.displayName>img').live('click', function (event) { + event.stopPropagation(); + var img = $(this); + var uid = img.parent().parent().attr('data-uid'); + var displayName = img.parent().parent().attr('data-displayName'); + var input = $('<input type="text" value="'+displayName+'">'); + img.css('display', 'none'); + img.parent().children('span').replaceWith(input); + input.focus(); + input.keypress(function (event) { + if (event.keyCode == 13) { + if ($(this).val().length > 0) { + $.post( + OC.filePath('settings', 'ajax', 'changedisplayname.php'), + {username:uid, displayName:$(this).val()}, + function (result) { + } + ); + input.blur(); + } else { + input.blur(); + } + } + }); + input.blur(function () { + $(this).replaceWith($(this).val()); + img.css('display', ''); + }); + }); + $('td.displayName').live('click', function (event) { + $(this).children('img').click(); + }); + $('select.quota, select.quota-user').live('change', function () { var select = $(this); @@ -389,7 +424,7 @@ $(document).ready(function () { { username:username, password:password, - groups:groups, + groups:groups }, function (result) { if (result.status != 'success') { @@ -402,13 +437,13 @@ $(document).ready(function () { ); }); // Handle undo notifications - $('#notification').hide(); + OC.Notification.hide(); $('#notification .undo').live('click', function () { if ($('#notification').data('deleteuser')) { $('tbody tr').filterAttr('data-uid', UserList.deleteUid).show(); UserList.deleteCanceled = true; } - $('#notification').fadeOut(); + OC.Notification.hide(); }); UserList.useUndo = ('onbeforeunload' in window) $(window).bind('beforeunload', function () { |