summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/lib
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2016-08-10 15:21:25 +0200
committerArthur Schiwon <blizzz@arthur-schiwon.de>2016-08-10 15:21:25 +0200
commit1eb8b951c2eb6388efdd628c878110d78ae4e77d (patch)
tree30f62ea3dd0acf69384cd57d34024c8e82bbea13 /apps/user_ldap/lib
parent518545fc2fc93f31d1885f143a0386c5449679f4 (diff)
downloadnextcloud-server-1eb8b951c2eb6388efdd628c878110d78ae4e77d.tar.gz
nextcloud-server-1eb8b951c2eb6388efdd628c878110d78ae4e77d.zip
more admin page splitup improvements
* bump version to ensure tables are created * make updatenotification app use settings api * change IAdmin::render() to getForm() and change return type from Template to TemplateResponse * adjust User_LDAP accordingly, as well as built-in forms * add IDateTimeFormatter to AppFramework/DependencyInjection/DIContainer.php. This is important so that \OC::$server->query() is able to resolve the constructor parameters. We should ensure that all OCP/* stuff that is available from \OC::$server is available here. Kudos to @LukasReschke * make sure apps that have settings info in their info.xml are loaded before triggering adding the settings setup method
Diffstat (limited to 'apps/user_ldap/lib')
-rw-r--r--apps/user_ldap/lib/Settings/Admin.php40
1 files changed, 9 insertions, 31 deletions
diff --git a/apps/user_ldap/lib/Settings/Admin.php b/apps/user_ldap/lib/Settings/Admin.php
index 11e2627dedd..f155f1cec8d 100644
--- a/apps/user_ldap/lib/Settings/Admin.php
+++ b/apps/user_ldap/lib/Settings/Admin.php
@@ -23,9 +23,9 @@
namespace OCA\User_LDAP\Settings;
-
use OCA\User_LDAP\Configuration;
use OCA\User_LDAP\Helper;
+use OCP\AppFramework\Http\TemplateResponse;
use OCP\IL10N;
use OCP\Settings\IAdmin;
use OCP\Template;
@@ -40,53 +40,31 @@ class Admin implements IAdmin {
}
/**
- * @return Template all parameters are supposed to be assigned
+ * @return TemplateResponse
*/
- public function render() {
- $settings = new Template('user_ldap', 'settings');
-
+ public function getForm() {
$helper = new Helper();
$prefixes = $helper->getServerConfigurationPrefixes();
$hosts = $helper->getServerConfigurationHosts();
- $wizardHtml = '';
- $toc = [];
-
$wControls = new Template('user_ldap', 'part.wizardcontrols');
$wControls = $wControls->fetchPage();
$sControls = new Template('user_ldap', 'part.settingcontrols');
$sControls = $sControls->fetchPage();
- $wizTabs = [
- ['tpl' => 'part.wizard-server', 'cap' => $this->l->t('Server')],
- ['tpl' => 'part.wizard-userfilter', 'cap' => $this->l->t('Users')],
- ['tpl' => 'part.wizard-loginfilter', 'cap' => $this->l->t('Login Attributes')],
- ['tpl' => 'part.wizard-groupfilter', 'cap' => $this->l->t('Groups')],
- ];
- $wizTabsCount = count($wizTabs);
- for($i = 0; $i < $wizTabsCount; $i++) {
- $tab = new Template('user_ldap', $wizTabs[$i]['tpl']);
- if($i === 0) {
- $tab->assign('serverConfigurationPrefixes', $prefixes);
- $tab->assign('serverConfigurationHosts', $hosts);
- }
- $tab->assign('wizardControls', $wControls);
- $wizardHtml .= $tab->fetchPage();
- $toc['#ldapWizard'.($i+1)] = $wizTabs[$i]['cap'];
- }
-
- $settings->assign('tabs', $wizardHtml);
- $settings->assign('toc', $toc);
- $settings->assign('settingControls', $sControls);
+ $parameters['serverConfigurationPrefixes'] = $prefixes;
+ $parameters['serverConfigurationHosts'] = $hosts;
+ $parameters['settingControls'] = $sControls;
+ $parameters['wizardControls'] = $wControls;
// assign default values
$config = new Configuration('', false);
$defaults = $config->getDefaults();
foreach($defaults as $key => $default) {
- $settings->assign($key.'_default', $default);
+ $parameters[$key.'_default'] = $default;
}
- return $settings;
+ return new TemplateResponse('user_ldap', 'settings', $parameters);
}
/**