+++ /dev/null
-<?php
-/**
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- *
- * @author Lukas Reschke <lukas@statuscode.ch>
- *
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
- */
-
-$app = new \OCA\UpdateNotification\AppInfo\Application();
-/** @var OCA\UpdateNotification\Controller\AdminController $controller */
-$controller = $app->getContainer()->query('AdminController');
-return $controller->displayPanel()->render();
<description>Displays update notifications for ownCloud and provides the SSO for the updater.</description>
<licence>AGPL</licence>
<author>Lukas Reschke</author>
- <version>1.0.0</version>
+ <version>1.0.1</version>
<namespace>UpdateNotification</namespace>
<default_enable/>
<dependencies>
<background-jobs>
<job>OCA\UpdateNotification\Notification\BackgroundJob</job>
</background-jobs>
+
+ <settings>
+ <admin>OCA\UpdateNotification\Controller\AdminController</admin>
+ </settings>
</info>
use OCP\IL10N;
use OCP\IRequest;
use OCP\Security\ISecureRandom;
+use OCP\Settings\IAdmin;
-class AdminController extends Controller {
+class AdminController extends Controller implements IAdmin {
/** @var IJobList */
private $jobList;
/** @var ISecureRandom */
return new DataResponse($newToken);
}
+
+ /**
+ * @return TemplateResponse returns the instance with all parameters set, ready to be rendered
+ */
+ public function getForm() {
+ return $this->displayPanel();
+ }
+
+ /**
+ * @return string the section ID, e.g. 'sharing'
+ */
+ public function getSection() {
+ return 'server';
+ }
+
+ /**
+ * @return int whether the form should be rather on the top or bottom of
+ * the admin section. The forms are arranged in ascending order of the
+ * priority values. It is required to return a value between 0 and 100.
+ *
+ * E.g.: 70
+ */
+ public function getPriority() {
+ return 5;
+ }
}
</background-jobs>
<settings>
- <admin>\OCA\User_LDAP\Settings\Admin</admin>
- <admin-section>\OCA\User_LDAP\Settings\Section</admin-section>
+ <admin>OCA\User_LDAP\Settings\Admin</admin>
+ <admin-section>OCA\User_LDAP\Settings\Section</admin-section>
</settings>
</info>
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;
}
/**
- * @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);
}
/**
style('user_ldap', 'settings');
+/** @var \OCP\IL10N $l */
+/** @var array $_ */
+
?>
<form id="ldap" class="section" action="#" method="post">
<div id="ldapSettings">
<ul>
- <?php foreach($_['toc'] as $id => $title) { ?>
- <li id="<?php p($id); ?>"><a href="<?php p($id); ?>"><?php p($title); ?></a></li>
- <?php } ?>
+ <li id="#ldapWizard1"><a href="#ldapWizard1"><?php p($l->t('Server'));?></a></li>
+ <li id="#ldapWizard2"><a href="#ldapWizard2"><?php p($l->t('Users'));?></a></li>
+ <li id="#ldapWizard3"><a href="#ldapWizard3"><?php p($l->t('Login Attributes'));?></a></li>
+ <li id="#ldapWizard4"><a href="#ldapWizard4"><?php p($l->t('Groups'));?></a></li>
<li class="ldapSettingsTabs"><a href="#ldapSettings-2"><?php p($l->t('Expert'));?></a></li>
<li class="ldapSettingsTabs"><a href="#ldapSettings-1"><?php p($l->t('Advanced'));?></a></li>
</ul>
- <?php if(OCP\App::isEnabled('user_webdavauth')) {
- print_unescaped('<p class="ldapwarning">'.$l->t('<b>Warning:</b> Apps user_ldap and user_webdavauth are incompatible. You may experience unexpected behavior. Please ask your system administrator to disable one of them.').'</p>');
- }
- if(!function_exists('ldap_connect')) {
- print_unescaped('<p class="ldapwarning">'.$l->t('<b>Warning:</b> The PHP LDAP module is not installed, the backend will not work. Please ask your system administrator to install it.').'</p>');
- }
- ?>
- <?php print_unescaped($_['tabs']); ?>
+ <?php if(OCP\App::isEnabled('user_webdavauth')) {
+ print_unescaped('<p class="ldapwarning">'.$l->t('<b>Warning:</b> Apps user_ldap and user_webdavauth are incompatible. You may experience unexpected behavior. Please ask your system administrator to disable one of them.').'</p>');
+ }
+ if(!function_exists('ldap_connect')) {
+ print_unescaped('<p class="ldapwarning">'.$l->t('<b>Warning:</b> The PHP LDAP module is not installed, the backend will not work. Please ask your system administrator to install it.').'</p>');
+ }
+ ?>
+ <?php require_once(__DIR__ . '/part.wizard-server.php'); ?>
+ <?php require_once(__DIR__ . '/part.wizard-userfilter.php'); ?>
+ <?php require_once(__DIR__ . '/part.wizard-loginfilter.php'); ?>
+ <?php require_once(__DIR__ . '/part.wizard-groupfilter.php'); ?>
<fieldset id="ldapSettings-1">
<div id="ldapAdvancedAccordion">
<h3><?php p($l->t('Connection Settings'));?></h3>
return $this->getServer()->getDateTimeZone();
});
+ $this->registerService('OCP\\IDateTimeFormatter', function($c) {
+ return $this->getServer()->getDateTimeFormatter();
+ });
+
$this->registerService('OCP\\IDb', function($c) {
return $this->getServer()->getDb();
});
namespace OC\Settings\Admin;
use OC\Encryption\Manager;
+use OCP\AppFramework\Http\TemplateResponse;
use OCP\IUserManager;
use OCP\Settings\IAdmin;
-use OCP\Template;
class Encryption implements IAdmin {
/** @var Manager */
}
/**
- * @return Template all parameters are supposed to be assigned
+ * @return TemplateResponse
*/
- public function render() {
+ public function getForm() {
$parameters = [
// Encryption API
'encryptionEnabled' => $this->manager->isEnabled(),
'externalBackendsEnabled' => count($this->userManager->getBackends()) > 1,
];
- $form = new Template('settings', 'admin/encryption');
- foreach ($parameters as $key => $value) {
- $form->assign($key, $value);
- }
- return $form;
+ return new TemplateResponse('settings', 'admin/encryption', $parameters, '');
}
/**
namespace OC\Settings\Admin;
use OC\Log\File as LogFile;
+use OCP\AppFramework\Http\TemplateResponse;
use OCP\IConfig;
use OCP\Settings\IAdmin;
-use OCP\Template;
class Logging implements IAdmin {
/** @var IConfig */
}
/**
- * @return Template all parameters are supposed to be assigned
+ * @return TemplateResponse
*/
- public function render() {
+ public function getForm() {
$logType = $this->config->getSystemValue('log_type', 'file');
$showLog = ($logType === 'file' || $logType === 'owncloud');
'showLog' => $showLog,
];
- $form = new Template('settings', 'admin/logging');
- foreach ($parameters as $key => $value) {
- $form->assign($key, $value);
- }
- return $form;
+ return new TemplateResponse('settings', 'admin/logging', $parameters, '');
}
/**
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Platforms\SqlitePlatform;
+use OCP\AppFramework\Http\TemplateResponse;
use OCP\IConfig;
use OCP\IDBConnection;
use OCP\Settings\IAdmin;
-use OCP\Template;
class Server implements IAdmin {
}
/**
- * @return Template all parameters are supposed to be assigned
+ * @return TemplateResponse
*/
- public function render() {
+ public function getForm() {
try {
if ($this->db->getDatabasePlatform() instanceof SqlitePlatform) {
$invalidTransactionIsolationLevel = false;
'mail_smtppassword' => $this->config->getSystemValue('mail_smtppassword', ''),
];
- $form = new Template('settings', 'admin/server');
- foreach ($parameters as $key => $value) {
- $form->assign($key, $value);
- }
- return $form;
+ return new TemplateResponse('settings', 'admin/server', $parameters, '');
}
/**
namespace OC\Settings\Admin;
+use OCP\AppFramework\Http\TemplateResponse;
use OCP\IConfig;
use OCP\Settings\IAdmin;
-use OCP\Template;
class Sharing implements IAdmin {
/** @var IConfig */
}
/**
- * @return Template all parameters are supposed to be assigned
+ * @return TemplateResponse
*/
- public function render() {
+ public function getForm() {
$excludeGroupsList = !is_null(json_decode($this->config->getAppValue('core', 'shareapi_exclude_groups_list', '')))
? implode('|', $this->config->getAppValue('core', 'shareapi_exclude_groups_list', '')) : '';
'shareExcludedGroupsList' => $excludeGroupsList,
];
- $form = new Template('settings', 'admin/sharing');
- foreach ($parameters as $key => $value) {
- $form->assign($key, $value);
- }
- return $form;
+ return new TemplateResponse('settings', 'admin/sharing', $parameters, '');
}
/**
namespace OC\Settings\Admin;
+use OCP\AppFramework\Http\TemplateResponse;
use OCP\IConfig;
use OCP\Settings\IAdmin;
-use OCP\Template;
class TipsTricks implements IAdmin {
/** @var IConfig */
}
/**
- * @return Template all parameters are supposed to be assigned
+ * @return TemplateResponse
*/
- public function render() {
+ public function getForm() {
$databaseOverload = (strpos($this->config->getSystemValue('dbtype'), 'sqlite') !== false);
$parameters = [
'databaseOverload' => $databaseOverload,
];
- $form = new Template('settings', 'admin/tipstricks');
- foreach ($parameters as $key => $value) {
- $form->assign($key, $value);
- }
- return $form;
+ return new TemplateResponse('settings', 'admin/tipstricks', $parameters, '');
}
/**
}
self::setupBackgroundJobs($appData['background-jobs']);
if(isset($appData['settings']) && is_array($appData['settings'])) {
+ self::loadApp($appId, false);
\OC::$server->getSettingsManager()->setupSettings($appData['settings']);
}
namespace OCP\Settings;
-use OCP\Template;
+use OCP\AppFramework\Http\TemplateResponse;
interface IAdmin {
/**
- * @return Template all parameters are supposed to be assigned
+ * @return TemplateResponse returns the instance with all parameters set, ready to be rendered
*/
- public function render();
+ public function getForm();
/**
* @return string the section ID, e.g. 'sharing'
foreach ($settings as $prioritizedSettings) {
foreach ($prioritizedSettings as $setting) {
/** @var \OCP\Settings\IAdmin $setting */
- $form = $setting->render();
- $html .= $form->fetchPage();
+ $form = $setting->getForm();
+ $html .= $form->renderAs('')->render();
}
}
return ['content' => $html];
// We only can count up. The 4. digit is only for the internal patchlevel to trigger DB upgrades
// between betas, final and RCs. This is _not_ the public version number. Reset minor/patchlevel
// when updating major/minor version number.
-$OC_Version = array(9, 1, 0, 14);
+$OC_Version = array(9, 1, 0, 15);
// The human readable string
$OC_VersionString = '10.0 beta';