From 3ed7d5d5215de51294cff53c0f9c30cfc2484a4f Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Mon, 21 Jan 2013 21:25:38 +0100 Subject: Move isadmin to external file --- settings/routes.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'settings/routes.php') diff --git a/settings/routes.php b/settings/routes.php index 9b5bf809230..bac1f61fc50 100644 --- a/settings/routes.php +++ b/settings/routes.php @@ -60,3 +60,5 @@ $this->create('settings_ajax_setloglevel', '/settings/ajax/setloglevel.php') ->actionInclude('settings/ajax/setloglevel.php'); $this->create('settings_ajax_setsecurity', '/settings/ajax/setsecurity.php') ->actionInclude('settings/ajax/setsecurity.php'); +$this->create('isadmin', '/settings/js/isadmin.js') + ->actionInclude('settings/js/isadmin.php'); -- cgit v1.2.3 From d2383338ded4fb980737062234584b29c284a4d5 Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Mon, 21 Jan 2013 22:18:42 +0100 Subject: External JSON for the Apps --- settings/apps.php | 1 + settings/js/apps-custom.php | 24 ++++++++++++++++++++++++ settings/routes.php | 2 ++ settings/templates/apps.php | 10 +++------- 4 files changed, 30 insertions(+), 7 deletions(-) create mode 100644 settings/js/apps-custom.php (limited to 'settings/routes.php') diff --git a/settings/apps.php b/settings/apps.php index 9de7bdc80a7..384e92bfbb7 100644 --- a/settings/apps.php +++ b/settings/apps.php @@ -42,6 +42,7 @@ function app_sort( $a, $b ) { } +$combinedApps = OC_App::listAllApps(); usort( $combinedApps, 'app_sort' ); $tmpl = new OC_Template( "settings", "apps", "user" ); diff --git a/settings/js/apps-custom.php b/settings/js/apps-custom.php new file mode 100644 index 00000000000..e0e7a2d6c79 --- /dev/null +++ b/settings/js/apps-custom.php @@ -0,0 +1,24 @@ + + * 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"); +} \ No newline at end of file diff --git a/settings/routes.php b/settings/routes.php index bac1f61fc50..1c766837dd1 100644 --- a/settings/routes.php +++ b/settings/routes.php @@ -53,6 +53,8 @@ $this->create('settings_ajax_disableapp', '/settings/ajax/disableapp.php') ->actionInclude('settings/ajax/disableapp.php'); $this->create('settings_ajax_navigationdetect', '/settings/ajax/navigationdetect.php') ->actionInclude('settings/ajax/navigationdetect.php'); +$this->create('apps_custom', '/settings/js/apps-custom.js') + ->actionInclude('settings/js/apps-custom.php'); // admin $this->create('settings_ajax_getlog', '/settings/ajax/getlog.php') ->actionInclude('settings/ajax/getlog.php'); diff --git a/settings/templates/apps.php b/settings/templates/apps.php index 0490f63fb67..98b0e6c725c 100644 --- a/settings/templates/apps.php +++ b/settings/templates/apps.php @@ -3,9 +3,8 @@ * This file is licensed under the Affero General Public License version 3 or later. * See the COPYING-README file. */?> - + +
t('Add your App');?> t('More Apps');?> @@ -15,9 +14,6 @@
  • data-id="" data-type="" data-installed="1"> - 3rd party' ?>
  • @@ -32,4 +28,4 @@
    - + \ No newline at end of file -- cgit v1.2.3 From e0f2ed2757b698448d49fa3e73340ce9ced25e7a Mon Sep 17 00:00:00 2001 From: Björn Schießle Date: Mon, 28 Jan 2013 14:09:11 +0100 Subject: interface and API to change display names --- lib/user.php | 19 +++++++++++++++++-- lib/user/backend.php | 2 ++ settings/js/users.js | 37 +++++++++++++++++++++++++++++++++++++ settings/routes.php | 2 ++ settings/templates/users.php | 2 +- 5 files changed, 59 insertions(+), 3 deletions(-) (limited to 'settings/routes.php') diff --git a/lib/user.php b/lib/user.php index 65f899aa27c..b91abd71fe6 100644 --- a/lib/user.php +++ b/lib/user.php @@ -269,10 +269,25 @@ class OC_User { /** * @brief Sets user display name for session */ - private static function setDisplayName($uid) { - $_SESSION['display_name'] = self::determineDisplayName($uid); + public static function setDisplayName($uid, $displayName = null) { + $result = false; + if ($displayName ) { + foreach(self::$_usedBackends as $backend) { + if($backend->implementsActions(OC_USER_BACKEND_SET_DISPLAYNAME)) { + if($backend->userExists($uid)) { + $success |= $backend->setDisplayName($uid, $displayName); + } + } + } + } else { + $displayName = self::determineDisplayName($uid); + $result = true; + } + $_SESSION['display_name'] = $displayName; + return result; } + /** * @brief get display name * @param $uid The username diff --git a/lib/user/backend.php b/lib/user/backend.php index fe37a64cc03..efea622e312 100644 --- a/lib/user/backend.php +++ b/lib/user/backend.php @@ -36,6 +36,7 @@ define('OC_USER_BACKEND_SET_PASSWORD', 0x000010); define('OC_USER_BACKEND_CHECK_PASSWORD', 0x000100); define('OC_USER_BACKEND_GET_HOME', 0x001000); define('OC_USER_BACKEND_GET_DISPLAYNAME', 0x010000); +define('OC_USER_BACKEND_SET_DISPLAYNAME', 0x010000); /** @@ -52,6 +53,7 @@ abstract class OC_User_Backend implements OC_User_Interface { OC_USER_BACKEND_CHECK_PASSWORD => 'checkPassword', OC_USER_BACKEND_GET_HOME => 'getHome', OC_USER_BACKEND_GET_DISPLAYNAME => 'getDisplayName', + OC_USER_BACKEND_SET_DISPLAYNAME => 'setDisplayName', ); /** diff --git a/settings/js/users.js b/settings/js/users.js index fa6f058d923..835f46f6ed3 100644 --- a/settings/js/users.js +++ b/settings/js/users.js @@ -300,6 +300,43 @@ $(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 input = $(''); + img.css('display', 'none'); + img.parent().children('span').replaceWith(input); + input.focus(); + input.keypress(function (event) { + console.log("event!"); + if (event.keyCode == 13) { + console.log("13"); + if ($(this).val().length > 0) { + console.log("post"); + $.post( + OC.filePath('settings', 'ajax', 'changedisplayname.php'), + {username:uid, displayName:$(this).val()}, + function (result) { + console.log("come back!"); + } + ); + 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); diff --git a/settings/routes.php b/settings/routes.php index 9b5bf809230..c9156f9a115 100644 --- a/settings/routes.php +++ b/settings/routes.php @@ -39,6 +39,8 @@ $this->create('settings_ajax_removegroup', '/settings/ajax/removegroup.php') ->actionInclude('settings/ajax/removegroup.php'); $this->create('settings_ajax_changepassword', '/settings/ajax/changepassword.php') ->actionInclude('settings/ajax/changepassword.php'); +$this->create('settings_ajax_changedisplayname', '/settings/ajax/changedisplayname.php') +->actionInclude('settings/ajax/changedisplayname.php'); // personel $this->create('settings_ajax_lostpassword', '/settings/ajax/lostpassword.php') ->actionInclude('settings/ajax/lostpassword.php'); diff --git a/settings/templates/users.php b/settings/templates/users.php index 64dce38ba31..2ba57fb4a7c 100644 --- a/settings/templates/users.php +++ b/settings/templates/users.php @@ -93,7 +93,7 @@ var isadmin = ; "> - change display name -- cgit v1.2.3