Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2012-09-29 20:08:54 +0400
committerBart Visscher <bartv@thisnet.nl>2012-10-02 20:00:23 +0400
commitbb136b9adf021cb154ff05222d3439373312bbc5 (patch)
treea6fccf936b0a40c7d48d55a23f4897b0332c3192
parent210ea4d9d9a3488918c898beb6d6508c60686ad1 (diff)
Make the settings ajax calls use the router
-rw-r--r--core/js/js.js7
-rw-r--r--core/routes.php14
-rw-r--r--settings/ajax/apps/ocs.php3
-rw-r--r--settings/ajax/changepassword.php2
-rw-r--r--settings/ajax/creategroup.php2
-rw-r--r--settings/ajax/createuser.php2
-rw-r--r--settings/ajax/disableapp.php2
-rw-r--r--settings/ajax/enableapp.php2
-rw-r--r--settings/ajax/getlog.php3
-rw-r--r--settings/ajax/lostpassword.php2
-rw-r--r--settings/ajax/openid.php3
-rw-r--r--settings/ajax/removegroup.php3
-rw-r--r--settings/ajax/removeuser.php3
-rw-r--r--settings/ajax/setlanguage.php3
-rw-r--r--settings/ajax/setloglevel.php1
-rw-r--r--settings/ajax/setquota.php3
-rw-r--r--settings/ajax/togglegroups.php3
-rw-r--r--settings/ajax/togglesubadmins.php5
-rw-r--r--settings/ajax/userlist.php4
-rw-r--r--settings/js/users.js2
-rw-r--r--settings/routes.php62
21 files changed, 72 insertions, 59 deletions
diff --git a/core/js/js.js b/core/js/js.js
index 39a58a24599..ffe3507a4eb 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -88,7 +88,12 @@ var OC={
}
link+=file;
}else{
- link+='/';
+ if (app == 'settings' && type == 'ajax') {
+ link+='/index.php/';
+ }
+ else {
+ link+='/';
+ }
if(!isCore){
link+='apps/';
}
diff --git a/core/routes.php b/core/routes.php
index 9a84eb64a3b..b0f41dd2861 100644
--- a/core/routes.php
+++ b/core/routes.php
@@ -6,19 +6,7 @@
* See the COPYING-README file.
*/
-// Core settings pages
-$this->create('settings_help', '/settings/help')
- ->actionInclude('settings/help.php');
-$this->create('settings_personal', '/settings/personal')
- ->actionInclude('settings/personal.php');
-$this->create('settings_settings', '/settings')
- ->actionInclude('settings/settings.php');
-$this->create('settings_users', '/settings/users')
- ->actionInclude('settings/users.php');
-$this->create('settings_apps', '/settings/apps')
- ->actionInclude('settings/apps.php');
-$this->create('settings_admin', '/settings/admin')
- ->actionInclude('settings/admin.php');
+require_once('settings/routes.php');
// Not specifically routed
$this->create('app_css', '/apps/{app}/{file}')
diff --git a/settings/ajax/apps/ocs.php b/settings/ajax/apps/ocs.php
index fb78cc89248..4d6f1116e7d 100644
--- a/settings/ajax/apps/ocs.php
+++ b/settings/ajax/apps/ocs.php
@@ -6,9 +6,6 @@
* See the COPYING-README file.
*/
-// Init owncloud
-require_once '../../../lib/base.php';
-
OC_JSON::checkAdminUser();
$l = OC_L10N::get('settings');
diff --git a/settings/ajax/changepassword.php b/settings/ajax/changepassword.php
index b251fea504b..200fdec26de 100644
--- a/settings/ajax/changepassword.php
+++ b/settings/ajax/changepassword.php
@@ -1,7 +1,5 @@
<?php
-// Init owncloud
-require_once '../../lib/base.php';
OCP\JSON::callCheck();
$username = isset($_POST["username"]) ? $_POST["username"] : OC_User::getUser();
diff --git a/settings/ajax/creategroup.php b/settings/ajax/creategroup.php
index 83733ac4d2d..bb3b0620e8a 100644
--- a/settings/ajax/creategroup.php
+++ b/settings/ajax/creategroup.php
@@ -1,7 +1,5 @@
<?php
-// Init owncloud
-require_once '../../lib/base.php';
OCP\JSON::callCheck();
// Check if we are a user
diff --git a/settings/ajax/createuser.php b/settings/ajax/createuser.php
index bdf7e4983ac..49fc0e0f53b 100644
--- a/settings/ajax/createuser.php
+++ b/settings/ajax/createuser.php
@@ -1,7 +1,5 @@
<?php
-// Init owncloud
-require_once '../../lib/base.php';
OCP\JSON::callCheck();
// Check if we are a user
diff --git a/settings/ajax/disableapp.php b/settings/ajax/disableapp.php
index 977a536af21..a39b06b9c7d 100644
--- a/settings/ajax/disableapp.php
+++ b/settings/ajax/disableapp.php
@@ -1,6 +1,4 @@
<?php
-// Init owncloud
-require_once '../../lib/base.php';
OC_JSON::checkAdminUser();
OCP\JSON::callCheck();
OC_JSON::setContentTypeHeader();
diff --git a/settings/ajax/enableapp.php b/settings/ajax/enableapp.php
index c3b3491db93..f4d5c53adef 100644
--- a/settings/ajax/enableapp.php
+++ b/settings/ajax/enableapp.php
@@ -1,7 +1,5 @@
<?php
-// Init owncloud
-require_once '../../lib/base.php';
OC_JSON::checkAdminUser();
OCP\JSON::callCheck();
OC_JSON::setContentTypeHeader();
diff --git a/settings/ajax/getlog.php b/settings/ajax/getlog.php
index 9b9240f8253..22128ef57b5 100644
--- a/settings/ajax/getlog.php
+++ b/settings/ajax/getlog.php
@@ -5,9 +5,6 @@
* See the COPYING-README file.
*/
-// Init owncloud
-require_once '../../lib/base.php';
-
OC_JSON::checkAdminUser();
$count=(isset($_GET['count']))?$_GET['count']:50;
diff --git a/settings/ajax/lostpassword.php b/settings/ajax/lostpassword.php
index 2a40ba09a8a..b5f47bbceab 100644
--- a/settings/ajax/lostpassword.php
+++ b/settings/ajax/lostpassword.php
@@ -1,7 +1,5 @@
<?php
-// Init owncloud
-require_once '../../lib/base.php';
OC_JSON::checkLoggedIn();
OCP\JSON::callCheck();
diff --git a/settings/ajax/openid.php b/settings/ajax/openid.php
index ecec085383c..23c43c3c48e 100644
--- a/settings/ajax/openid.php
+++ b/settings/ajax/openid.php
@@ -1,8 +1,5 @@
<?php
-// Init owncloud
-require_once '../../lib/base.php';
-
$l=OC_L10N::get('settings');
OC_JSON::checkLoggedIn();
diff --git a/settings/ajax/removegroup.php b/settings/ajax/removegroup.php
index 33e1a514c88..798d7916e61 100644
--- a/settings/ajax/removegroup.php
+++ b/settings/ajax/removegroup.php
@@ -1,8 +1,5 @@
<?php
-// Init owncloud
-require_once '../../lib/base.php';
-
OC_JSON::checkAdminUser();
OCP\JSON::callCheck();
diff --git a/settings/ajax/removeuser.php b/settings/ajax/removeuser.php
index 6b11fa5c4fb..a10dc29321d 100644
--- a/settings/ajax/removeuser.php
+++ b/settings/ajax/removeuser.php
@@ -1,8 +1,5 @@
<?php
-// Init owncloud
-require_once '../../lib/base.php';
-
OC_JSON::checkSubAdminUser();
OCP\JSON::callCheck();
diff --git a/settings/ajax/setlanguage.php b/settings/ajax/setlanguage.php
index 42eea7a96fd..aebb1b31b6f 100644
--- a/settings/ajax/setlanguage.php
+++ b/settings/ajax/setlanguage.php
@@ -1,8 +1,5 @@
<?php
-// Init owncloud
-require_once '../../lib/base.php';
-
$l=OC_L10N::get('settings');
OC_JSON::checkLoggedIn();
diff --git a/settings/ajax/setloglevel.php b/settings/ajax/setloglevel.php
index 982899e106a..542219f86c6 100644
--- a/settings/ajax/setloglevel.php
+++ b/settings/ajax/setloglevel.php
@@ -5,7 +5,6 @@
* See the COPYING-README file.
*/
-require_once '../../lib/base.php';
OC_Util::checkAdminUser();
OCP\JSON::callCheck();
diff --git a/settings/ajax/setquota.php b/settings/ajax/setquota.php
index 2352ae9e427..4b32585b306 100644
--- a/settings/ajax/setquota.php
+++ b/settings/ajax/setquota.php
@@ -5,9 +5,6 @@
* See the COPYING-README file.
*/
-// Init owncloud
-require_once '../../lib/base.php';
-
OC_JSON::checkSubAdminUser();
OCP\JSON::callCheck();
diff --git a/settings/ajax/togglegroups.php b/settings/ajax/togglegroups.php
index 65747968c17..de941f99132 100644
--- a/settings/ajax/togglegroups.php
+++ b/settings/ajax/togglegroups.php
@@ -1,8 +1,5 @@
<?php
-// Init owncloud
-require_once '../../lib/base.php';
-
OC_JSON::checkSubAdminUser();
OCP\JSON::callCheck();
diff --git a/settings/ajax/togglesubadmins.php b/settings/ajax/togglesubadmins.php
index 5f7126dca34..7aaa90aad5f 100644
--- a/settings/ajax/togglesubadmins.php
+++ b/settings/ajax/togglesubadmins.php
@@ -1,8 +1,5 @@
<?php
-// Init owncloud
-require_once '../../lib/base.php';
-
OC_JSON::checkAdminUser();
OCP\JSON::callCheck();
@@ -16,4 +13,4 @@ if(OC_SubAdmin::isSubAdminofGroup($username, $group)) {
OC_SubAdmin::createSubAdmin($username, $group);
}
-OC_JSON::success(); \ No newline at end of file
+OC_JSON::success();
diff --git a/settings/ajax/userlist.php b/settings/ajax/userlist.php
index 840b6d72dc7..61b1a388fc3 100644
--- a/settings/ajax/userlist.php
+++ b/settings/ajax/userlist.php
@@ -20,8 +20,6 @@
*
*/
-require_once '../../lib/base.php';
-
OC_JSON::callCheck();
OC_JSON::checkSubAdminUser();
if (isset($_GET['offset'])) {
@@ -49,4 +47,4 @@ if (OC_Group::inGroup(OC_User::getUser(), 'admin')) {
'quota' => OC_Preferences::getValue($user, 'files', 'quota', 'default'));
}
}
-OC_JSON::success(array('data' => $users)); \ No newline at end of file
+OC_JSON::success(array('data' => $users));
diff --git a/settings/js/users.js b/settings/js/users.js
index 20bd94993bc..81a3181ba59 100644
--- a/settings/js/users.js
+++ b/settings/js/users.js
@@ -130,7 +130,7 @@ var UserList={
if (typeof UserList.offset === 'undefined') {
UserList.offset = $('tbody tr').length;
}
- $.get(OC.filePath('settings', 'ajax', 'userlist.php'), { offset: UserList.offset }, function(result) {
+ $.get(OC.filePath('settings', 'ajax', 'userlist'), { offset: UserList.offset }, function(result) {
if (result.status === 'success') {
$.each(result.data, function(index, user) {
var tr = UserList.add(user.name, user.groups, user.subadmin, user.quota, false);
diff --git a/settings/routes.php b/settings/routes.php
new file mode 100644
index 00000000000..b64a357be0e
--- /dev/null
+++ b/settings/routes.php
@@ -0,0 +1,62 @@
+<?php
+/**
+ * Copyright (c) 2012 Bart Visscher <bartv@thisnet.nl>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+// Settings pages
+$this->create('settings_help', '/settings/help')
+ ->actionInclude('settings/help.php');
+$this->create('settings_personal', '/settings/personal')
+ ->actionInclude('settings/personal.php');
+$this->create('settings_settings', '/settings')
+ ->actionInclude('settings/settings.php');
+$this->create('settings_users', '/settings/users')
+ ->actionInclude('settings/users.php');
+$this->create('settings_apps', '/settings/apps')
+ ->actionInclude('settings/apps.php');
+$this->create('settings_admin', '/settings/admin')
+ ->actionInclude('settings/admin.php');
+// Settings ajax actions
+// users
+$this->create('settings_admin', '/settings/ajax/userlist')
+ ->actionInclude('settings/ajax/userlist.php');
+$this->create('settings_ajax_createuser', '/settings/ajax/createuser.php')
+ ->actionInclude('settings_ajax_createuser');
+$this->create('settings_ajax_removeuser', '/settings/ajax/removeuser.php')
+ ->actionInclude('settings/ajax/removeuser.php');
+$this->create('settings_ajax_setquota', '/settings/ajax/setquota.php')
+ ->actionInclude('settings/ajax/setquota.php');
+$this->create('settings_ajax_creategroup', '/settings/ajax/creategroup.php')
+ ->actionInclude('settings_ajax_creategroup');
+$this->create('settings_ajax_togglegroups', '/settings/ajax/togglegroups.php')
+ ->actionInclude('settings/ajax/togglegroups.php');
+$this->create('settings_ajax_togglesubadmins', '/settings/ajax/togglesubadmins.php')
+ ->actionInclude('settings/ajax/togglesubadmins.php');
+$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');
+// personel
+$this->create('settings_ajax_lostpassword', '/settings/ajax/lostpassword.php')
+ ->actionInclude('settings/ajax/lostpassword.php');
+$this->create('settings_ajax_setlanguage', '/settings/ajax/setlanguage.php')
+ ->actionInclude('settings/ajax/setlanguage.php');
+// apps
+$this->create('settings_ajax_apps_ocs', '/settings/ajax/apps/ocs.php')
+ ->actionInclude('settings/ajax/apps/ocs.php');
+$this->create('settings_ajax_enableapp', '/settings/ajax/enableapp.php')
+ ->actionInclude('settings/ajax/enableapp.php');
+$this->create('settings_ajax_disableapp', '/settings/ajax/disableapp.php')
+ ->actionInclude('settings/ajax/disableapp.php');
+// admin
+$this->create('settings_ajax_getlog', '/settings/ajax/getlog.php')
+ ->actionInclude('settings/ajax/getlog.php');
+$this->create('settings_ajax_setloglevel', '/settings/ajax/setloglevel.php')
+ ->actionInclude('settings/ajax/setloglevel.php');
+
+// apps/user_openid
+$this->create('settings_ajax_openid', '/settings/ajax/openid.php')
+ ->actionInclude('settings/ajax/openid.php');