Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Admin page split #796

Merged
merged 46 commits into from
Aug 16, 2016
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
ceeb44b
Initial work on Apps page split:
blizzz Aug 8, 2016
9d9c540
fix duplicated db index name
blizzz Aug 9, 2016
97df444
remove mistakenly added file
blizzz Aug 9, 2016
518545f
Fallback for legacy settings. They are placed into Additional Settings
blizzz Aug 9, 2016
1eb8b95
more admin page splitup improvements
blizzz Aug 10, 2016
0fc34c9
fix registration of admin settings and section on app install
blizzz Aug 10, 2016
f3b15a9
fixes, improvements, and another app:
blizzz Aug 10, 2016
14ddf9d
rename IAdmin to ISettings, the interface is not bound to a specific …
blizzz Aug 11, 2016
5696c8a
adjust federatedfilesharing
blizzz Aug 11, 2016
a2f752b
adjust files_external
blizzz Aug 11, 2016
ce6ad5d
make sure shipped apps also setup their admin settings on a fresh ins…
blizzz Aug 11, 2016
e8ea671
superfluous
blizzz Aug 11, 2016
36c1b7e
adjust Theming app
blizzz Aug 11, 2016
30ff3ad
adjust files app, and integrate files_external into that section
blizzz Aug 11, 2016
c0a2a1f
superfluous
blizzz Aug 11, 2016
3f9e1b3
adjust federation app
blizzz Aug 11, 2016
3dfdc8e
adjust systemtags app
blizzz Aug 11, 2016
8f12f5d
Add missing since annotations
LukasReschke Aug 11, 2016
225eb27
Add since tags to class
LukasReschke Aug 11, 2016
8261ccc
Merge branch 'master' into implement_712
LukasReschke Aug 11, 2016
82bf479
Resolve conflict
LukasReschke Aug 11, 2016
ac04ba6
register app autoload instead of loading apps
blizzz Aug 12, 2016
18fd8ff
rename "Tenmplate" to "ThemingDefaults" to make the auto loader happy"
schiessle Aug 12, 2016
0c15081
rename remaining occurences of OCA/Theming/Template
blizzz Aug 12, 2016
9aa6b99
added some missed diagnosis output
blizzz Aug 12, 2016
0fdf801
fix theming tests
blizzz Aug 12, 2016
90e58b7
mark current section
blizzz Aug 12, 2016
7a2b96c
change casing in section display names
blizzz Aug 12, 2016
a133e79
make updatenotification settings appear as if it is part of the versi…
blizzz Aug 12, 2016
b99ecb3
move systemstags to sharign section, drop collaboration section
blizzz Aug 12, 2016
d2fcac8
change federatedfilesharing css class to followupsection to reduce wh…
blizzz Aug 12, 2016
158d78e
move mail settings and file handling to additional ones, thus files_e…
blizzz Aug 12, 2016
8188bb4
simplify encryption manager fetching in DIContainer
blizzz Aug 12, 2016
75a73a5
satisfy dependencies for files_external
blizzz Aug 15, 2016
8a7a0f3
Add unit tests
LukasReschke Aug 15, 2016
7ffb7b0
Use MockBuilder instead of createMock
LukasReschke Aug 15, 2016
6c6338b
Merge branch 'master' into implement_712
LukasReschke Aug 15, 2016
9edca39
attempt to remove section and settings entries when an app got disabled
blizzz Aug 15, 2016
208e551
check registered sections and settings after an app got updated to ga…
blizzz Aug 15, 2016
d96e8f5
adopt to Controller constructor changes
blizzz Aug 15, 2016
83ba2f2
final db indexes
blizzz Aug 16, 2016
58530ab
fix missing parameters in sharing settings page
blizzz Aug 16, 2016
f76b64d
add missing encryption modules to settings
blizzz Aug 16, 2016
4946cc2
for new we cannot have nested settings, default module is only append…
blizzz Aug 16, 2016
717e222
Merge branch 'master' into implement_712
blizzz Aug 16, 2016
4943441
adjust tests to latest changes
blizzz Aug 16, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion apps/user_ldap/appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ A user logs into ownCloud with their LDAP or AD credentials, and is granted acce
</description>
<licence>AGPL</licence>
<author>Dominik Schmidt and Arthur Schiwon</author>
<version>1.1.0</version>
<version>1.1.1</version>
<types>
<authentication/>
</types>
Expand All @@ -27,4 +27,9 @@ A user logs into ownCloud with their LDAP or AD credentials, and is granted acce
<job>OCA\User_LDAP\Jobs\UpdateGroups</job>
<job>OCA\User_LDAP\Jobs\CleanUp</job>
</background-jobs>

<settings>
<admin>\OCA\User_LDAP\Settings\Admin</admin>
<admin-section>\OCA\User_LDAP\Settings\Section</admin-section>
</settings>
</info>
115 changes: 115 additions & 0 deletions apps/user_ldap/lib/Settings/Admin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
<?php
/**
* @copyright Copyright (c) 2016 Arthur Schiwon <blizzz@arthur-schiwon.de>
*
* @author Arthur Schiwon <blizzz@arthur-schiwon.de>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* 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
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

namespace OCA\User_LDAP\Settings;


use OCA\User_LDAP\Configuration;
use OCA\User_LDAP\Helper;
use OCP\IL10N;
use OCP\Settings\IAdmin;
use OCP\Template;

class Admin implements IAdmin {

/** @var IL10N */
private $l;

public function __construct(IL10N $l) {
$this->l = $l;
}

/**
* @return Template all parameters are supposed to be assigned
*/
public function render() {
$settings = new Template('user_ldap', 'settings');

$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);

// assign default values
$config = new Configuration('', false);
$defaults = $config->getDefaults();
foreach($defaults as $key => $default) {
$settings->assign($key.'_default', $default);
}

return $settings;
}

/**
* @return string the section ID, e.g. 'sharing'
*/
public function getSection() {
return 'ldap';
}

/**
* @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;
}

private function renderControls() {
$controls = new Template('user_ldap', 'part.settingcontrols');
return $controls->fetchPage();

}
}
67 changes: 67 additions & 0 deletions apps/user_ldap/lib/Settings/Section.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php
/**
* @copyright Copyright (c) 2016 Arthur Schiwon <blizzz@arthur-schiwon.de>
*
* @author Arthur Schiwon <blizzz@arthur-schiwon.de>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* 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
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

namespace OCA\User_LDAP\Settings;

use OCP\IL10N;
use OCP\Settings\ISection;

class Section implements ISection {
/** @var IL10N */
private $l;

public function __construct(IL10N $l) {
$this->l = $l;
}

/**
* returns the ID of the section. It is supposed to be a lower case string,
* e.g. 'ldap'
*
* @returns string
*/
public function getID() {
return 'ldap';
}

/**
* returns the translated name as it should be displayed, e.g. 'LDAP / AD
* integration'. Use the L10N service to translate it.
*
* @return string
*/
public function getName() {
return $this->l->t('LDAP / AD Integration');
}

/**
* @return int whether the form should be rather on the top or bottom of
* the settings navigation. The sections are arranged in ascending order of
* the priority values. It is required to return a value between 0 and 99.
*
* E.g.: 70
*/
public function getPriority() {
return 25;
}
}
75 changes: 0 additions & 75 deletions apps/user_ldap/settings.php

This file was deleted.

2 changes: 1 addition & 1 deletion core/templates/untrustedDomain.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<?php p($l->t('Depending on your configuration, as an administrator you might also be able to use the button below to trust this domain.')); ?>
<br><br>
<p style="text-align:center;">
<a href="<?php print_unescaped(\OC::$server->getURLGenerator()->getAbsoluteURL(\OCP\Util::linkToRoute('settings_admin'))); ?>?trustDomain=<?php p($_['domain']); ?>" class="button">
<a href="<?php print_unescaped(\OC::$server->getURLGenerator()->getAbsoluteURL(\OCP\Util::linkToRoute('settings.AdminSettings.index'))); ?>?trustDomain=<?php p($_['domain']); ?>" class="button">
<?php p($l->t('Add "%s" as trusted domain', array($_['domain']))); ?>
</a>
</p>
Expand Down
94 changes: 94 additions & 0 deletions db_structure.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1976,4 +1976,98 @@

</table>

<table>
<!-- Extra admin settings sections -->
<name>*dbprefix*admin_sections</name>

<declaration>

<field>
<name>id</name>
<type>text</type>
<default></default>
<notnull>false</notnull>
<length>64</length>
</field>

<field>
<name>class</name>
<type>text</type>
<default></default>
<notnull>true</notnull>
<length>255</length>
</field>

<field>
<name>priority</name>
<type>integer</type>
<default></default>
<notnull>true</notnull>
<length>1</length>
</field>

<index>
<name>admin_sections_id_index</name>
<unique>true</unique>
<field>
<name>id</name>
<sorting>ascending</sorting>
</field>
</index>

</declaration>
</table>

<table>
<!-- Extra admin settings -->
<name>*dbprefix*admin_settings</name>

<declaration>

<field>
<name>id</name>
<type>integer</type>
<default>0</default>
<notnull>true</notnull>
<autoincrement>1</autoincrement>
<length>4</length>
</field>

<field>
<name>class</name>
<type>text</type>
<default></default>
<notnull>true</notnull>
<length>255</length>
</field>

<!-- id of the section, foreign key: admin_sections.id -->
<field>
<name>section</name>
<type>text</type>
<default></default>
<notnull>false</notnull>
<length>64</length>
</field>

<field>
<name>priority</name>
<type>integer</type>
<default></default>
<notnull>true</notnull>
<length>1</length>
</field>

<index>
<name>admin_settings_id_index</name>
<unique>true</unique>
<field>
<name>id</name>
<sorting>ascending</sorting>
</field>
</index>

</declaration>
</table>

</database>
1 change: 1 addition & 0 deletions lib/private/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ public static function installApp( $data = array()) {
}

\OC_App::setupBackgroundJobs($info['background-jobs']);
\OC::$server->getSettingsManager()->setupSettings($info['settings']);

//run appinfo/install.php
if((!isset($data['noinstall']) or $data['noinstall']==false)) {
Expand Down
Loading