You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

settings.php 2.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. /**
  3. * ownCloud - user_ldap
  4. *
  5. * @author Dominik Schmidt
  6. * @author Arthur Schiwon
  7. * @copyright 2011 Dominik Schmidt dev@dominik-schmidt.de
  8. * @copyright 2012-2013 Arthur Schiwon blizzz@owncloud.com
  9. *
  10. * This library is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
  12. * License as published by the Free Software Foundation; either
  13. * version 3 of the License, or any later version.
  14. *
  15. * This library is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
  19. *
  20. * You should have received a copy of the GNU Affero General Public
  21. * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  22. *
  23. */
  24. OC_Util::checkAdminUser();
  25. OCP\Util::addScript('user_ldap', 'ldapFilter');
  26. OCP\Util::addScript('user_ldap', 'settings');
  27. OCP\Util::addScript('core', 'jquery.multiselect');
  28. OCP\Util::addStyle('user_ldap', 'settings');
  29. OCP\Util::addStyle('core', 'jquery.multiselect');
  30. OCP\Util::addStyle('core', 'jquery-ui-1.10.0.custom');
  31. // fill template
  32. $tmpl = new OCP\Template('user_ldap', 'settings');
  33. $prefixes = \OCA\user_ldap\lib\Helper::getServerConfigurationPrefixes();
  34. $hosts = \OCA\user_ldap\lib\Helper::getServerConfigurationHosts();
  35. $wizardHtml = '';
  36. $toc = array();
  37. $wControls = new OCP\Template('user_ldap', 'part.wizardcontrols');
  38. $wControls = $wControls->fetchPage();
  39. $sControls = new OCP\Template('user_ldap', 'part.settingcontrols');
  40. $sControls = $sControls->fetchPage();
  41. $wizTabs = array();
  42. $wizTabs[] = array('tpl' => 'part.wizard-server', 'cap' => 'Server');
  43. $wizTabs[] = array('tpl' => 'part.wizard-userfilter', 'cap' => 'User Filter');
  44. $wizTabs[] = array('tpl' => 'part.wizard-loginfilter', 'cap' => 'Login Filter');
  45. $wizTabs[] = array('tpl' => 'part.wizard-groupfilter', 'cap' => 'Group Filter');
  46. for($i = 0; $i < count($wizTabs); $i++) {
  47. $tab = new OCP\Template('user_ldap', $wizTabs[$i]['tpl']);
  48. if($i === 0) {
  49. $tab->assign('serverConfigurationPrefixes', $prefixes);
  50. $tab->assign('serverConfigurationHosts', $hosts);
  51. }
  52. $tab->assign('wizardControls', $wControls);
  53. $wizardHtml .= $tab->fetchPage();
  54. $toc['#ldapWizard'.($i+1)] = $wizTabs[$i]['cap'];
  55. }
  56. $tmpl->assign('tabs', $wizardHtml);
  57. $tmpl->assign('toc', $toc);
  58. $tmpl->assign('settingControls', $sControls);
  59. // assign default values
  60. $config = new \OCA\user_ldap\lib\Configuration('', false);
  61. $defaults = $config->getDefaults();
  62. foreach($defaults as $key => $default) {
  63. $tmpl->assign($key.'_default', $default);
  64. }
  65. return $tmpl->fetchPage();