settings.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. /**
  3. * @author Arthur Schiwon <blizzz@owncloud.com>
  4. * @author ben-denham <bend@catalyst.net.nz>
  5. * @author Dominik Schmidt <dev@dominik-schmidt.de>
  6. * @author Frank Karlitschek <frank@owncloud.org>
  7. * @author Lukas Reschke <lukas@owncloud.com>
  8. * @author Morris Jobke <hey@morrisjobke.de>
  9. * @author Robin Appelman <icewind@owncloud.com>
  10. * @author Robin McCorkell <rmccorkell@karoshi.org.uk>
  11. * @author Volkan Gezer <volkangezer@gmail.com>
  12. *
  13. * @copyright Copyright (c) 2015, ownCloud, Inc.
  14. * @license AGPL-3.0
  15. *
  16. * This code is free software: you can redistribute it and/or modify
  17. * it under the terms of the GNU Affero General Public License, version 3,
  18. * as published by the Free Software Foundation.
  19. *
  20. * This program is distributed in the hope that it will be useful,
  21. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  22. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  23. * GNU Affero General Public License for more details.
  24. *
  25. * You should have received a copy of the GNU Affero General Public License, version 3,
  26. * along with this program. If not, see <http://www.gnu.org/licenses/>
  27. *
  28. */
  29. OC_Util::checkAdminUser();
  30. OCP\Util::addScript('user_ldap', 'ldapFilter');
  31. OCP\Util::addScript('user_ldap', 'experiencedAdmin');
  32. OCP\Util::addScript('user_ldap', 'settings');
  33. \OC_Util::addVendorScript('user_ldap', 'ui-multiselect/src/jquery.multiselect');
  34. OCP\Util::addStyle('user_ldap', 'settings');
  35. \OC_Util::addVendorStyle('user_ldap', 'ui-multiselect/jquery.multiselect');
  36. // fill template
  37. $tmpl = new OCP\Template('user_ldap', 'settings');
  38. $helper = new \OCA\user_ldap\lib\Helper();
  39. $prefixes = $helper->getServerConfigurationPrefixes();
  40. $hosts = $helper->getServerConfigurationHosts();
  41. $wizardHtml = '';
  42. $toc = array();
  43. $wControls = new OCP\Template('user_ldap', 'part.wizardcontrols');
  44. $wControls = $wControls->fetchPage();
  45. $sControls = new OCP\Template('user_ldap', 'part.settingcontrols');
  46. $sControls = $sControls->fetchPage();
  47. $l = \OC::$server->getL10N('user_ldap');
  48. $wizTabs = array();
  49. $wizTabs[] = array('tpl' => 'part.wizard-server', 'cap' => $l->t('Server'));
  50. $wizTabs[] = array('tpl' => 'part.wizard-userfilter', 'cap' => $l->t('User Filter'));
  51. $wizTabs[] = array('tpl' => 'part.wizard-loginfilter', 'cap' => $l->t('Login Filter'));
  52. $wizTabs[] = array('tpl' => 'part.wizard-groupfilter', 'cap' => $l->t('Group Filter'));
  53. $wizTabsCount = count($wizTabs);
  54. for($i = 0; $i < $wizTabsCount; $i++) {
  55. $tab = new OCP\Template('user_ldap', $wizTabs[$i]['tpl']);
  56. if($i === 0) {
  57. $tab->assign('serverConfigurationPrefixes', $prefixes);
  58. $tab->assign('serverConfigurationHosts', $hosts);
  59. }
  60. $tab->assign('wizardControls', $wControls);
  61. $wizardHtml .= $tab->fetchPage();
  62. $toc['#ldapWizard'.($i+1)] = $wizTabs[$i]['cap'];
  63. }
  64. $tmpl->assign('tabs', $wizardHtml);
  65. $tmpl->assign('toc', $toc);
  66. $tmpl->assign('settingControls', $sControls);
  67. // assign default values
  68. $config = new \OCA\user_ldap\lib\Configuration('', false);
  69. $defaults = $config->getDefaults();
  70. foreach($defaults as $key => $default) {
  71. $tmpl->assign($key.'_default', $default);
  72. }
  73. return $tmpl->fetchPage();