Make the settings ajax calls use the router

This commit is contained in:
Bart Visscher 2012-09-29 18:08:54 +02:00
parent 210ea4d9d9
commit bb136b9adf
21 changed files with 72 additions and 59 deletions

View File

@ -88,7 +88,12 @@ var OC={
} }
link+=file; link+=file;
}else{ }else{
if (app == 'settings' && type == 'ajax') {
link+='/index.php/';
}
else {
link+='/'; link+='/';
}
if(!isCore){ if(!isCore){
link+='apps/'; link+='apps/';
} }

View File

@ -6,19 +6,7 @@
* See the COPYING-README file. * See the COPYING-README file.
*/ */
// Core settings pages require_once('settings/routes.php');
$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');
// Not specifically routed // Not specifically routed
$this->create('app_css', '/apps/{app}/{file}') $this->create('app_css', '/apps/{app}/{file}')

View File

@ -6,9 +6,6 @@
* See the COPYING-README file. * See the COPYING-README file.
*/ */
// Init owncloud
require_once '../../../lib/base.php';
OC_JSON::checkAdminUser(); OC_JSON::checkAdminUser();
$l = OC_L10N::get('settings'); $l = OC_L10N::get('settings');

View File

@ -1,7 +1,5 @@
<?php <?php
// Init owncloud
require_once '../../lib/base.php';
OCP\JSON::callCheck(); OCP\JSON::callCheck();
$username = isset($_POST["username"]) ? $_POST["username"] : OC_User::getUser(); $username = isset($_POST["username"]) ? $_POST["username"] : OC_User::getUser();

View File

@ -1,7 +1,5 @@
<?php <?php
// Init owncloud
require_once '../../lib/base.php';
OCP\JSON::callCheck(); OCP\JSON::callCheck();
// Check if we are a user // Check if we are a user

View File

@ -1,7 +1,5 @@
<?php <?php
// Init owncloud
require_once '../../lib/base.php';
OCP\JSON::callCheck(); OCP\JSON::callCheck();
// Check if we are a user // Check if we are a user

View File

@ -1,6 +1,4 @@
<?php <?php
// Init owncloud
require_once '../../lib/base.php';
OC_JSON::checkAdminUser(); OC_JSON::checkAdminUser();
OCP\JSON::callCheck(); OCP\JSON::callCheck();
OC_JSON::setContentTypeHeader(); OC_JSON::setContentTypeHeader();

View File

@ -1,7 +1,5 @@
<?php <?php
// Init owncloud
require_once '../../lib/base.php';
OC_JSON::checkAdminUser(); OC_JSON::checkAdminUser();
OCP\JSON::callCheck(); OCP\JSON::callCheck();
OC_JSON::setContentTypeHeader(); OC_JSON::setContentTypeHeader();

View File

@ -5,9 +5,6 @@
* See the COPYING-README file. * See the COPYING-README file.
*/ */
// Init owncloud
require_once '../../lib/base.php';
OC_JSON::checkAdminUser(); OC_JSON::checkAdminUser();
$count=(isset($_GET['count']))?$_GET['count']:50; $count=(isset($_GET['count']))?$_GET['count']:50;

View File

@ -1,7 +1,5 @@
<?php <?php
// Init owncloud
require_once '../../lib/base.php';
OC_JSON::checkLoggedIn(); OC_JSON::checkLoggedIn();
OCP\JSON::callCheck(); OCP\JSON::callCheck();

View File

@ -1,8 +1,5 @@
<?php <?php
// Init owncloud
require_once '../../lib/base.php';
$l=OC_L10N::get('settings'); $l=OC_L10N::get('settings');
OC_JSON::checkLoggedIn(); OC_JSON::checkLoggedIn();

View File

@ -1,8 +1,5 @@
<?php <?php
// Init owncloud
require_once '../../lib/base.php';
OC_JSON::checkAdminUser(); OC_JSON::checkAdminUser();
OCP\JSON::callCheck(); OCP\JSON::callCheck();

View File

@ -1,8 +1,5 @@
<?php <?php
// Init owncloud
require_once '../../lib/base.php';
OC_JSON::checkSubAdminUser(); OC_JSON::checkSubAdminUser();
OCP\JSON::callCheck(); OCP\JSON::callCheck();

View File

@ -1,8 +1,5 @@
<?php <?php
// Init owncloud
require_once '../../lib/base.php';
$l=OC_L10N::get('settings'); $l=OC_L10N::get('settings');
OC_JSON::checkLoggedIn(); OC_JSON::checkLoggedIn();

View File

@ -5,7 +5,6 @@
* See the COPYING-README file. * See the COPYING-README file.
*/ */
require_once '../../lib/base.php';
OC_Util::checkAdminUser(); OC_Util::checkAdminUser();
OCP\JSON::callCheck(); OCP\JSON::callCheck();

View File

@ -5,9 +5,6 @@
* See the COPYING-README file. * See the COPYING-README file.
*/ */
// Init owncloud
require_once '../../lib/base.php';
OC_JSON::checkSubAdminUser(); OC_JSON::checkSubAdminUser();
OCP\JSON::callCheck(); OCP\JSON::callCheck();

View File

@ -1,8 +1,5 @@
<?php <?php
// Init owncloud
require_once '../../lib/base.php';
OC_JSON::checkSubAdminUser(); OC_JSON::checkSubAdminUser();
OCP\JSON::callCheck(); OCP\JSON::callCheck();

View File

@ -1,8 +1,5 @@
<?php <?php
// Init owncloud
require_once '../../lib/base.php';
OC_JSON::checkAdminUser(); OC_JSON::checkAdminUser();
OCP\JSON::callCheck(); OCP\JSON::callCheck();

View File

@ -20,8 +20,6 @@
* *
*/ */
require_once '../../lib/base.php';
OC_JSON::callCheck(); OC_JSON::callCheck();
OC_JSON::checkSubAdminUser(); OC_JSON::checkSubAdminUser();
if (isset($_GET['offset'])) { if (isset($_GET['offset'])) {

View File

@ -130,7 +130,7 @@ var UserList={
if (typeof UserList.offset === 'undefined') { if (typeof UserList.offset === 'undefined') {
UserList.offset = $('tbody tr').length; 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') { if (result.status === 'success') {
$.each(result.data, function(index, user) { $.each(result.data, function(index, user) {
var tr = UserList.add(user.name, user.groups, user.subadmin, user.quota, false); var tr = UserList.add(user.name, user.groups, user.subadmin, user.quota, false);

62
settings/routes.php Normal file
View File

@ -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');