File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -49,6 +49,14 @@ public function __construct(IL10N $l) {
4949 public function getForm () {
5050 $ helper = new Helper (\OC ::$ server ->getConfig ());
5151 $ prefixes = $ helper ->getServerConfigurationPrefixes ();
52+ if (count ($ prefixes ) === 0 ) {
53+ $ newPrefix = $ helper ->getNextServerConfigurationPrefix ();
54+ $ config = new Configuration ($ newPrefix , false );
55+ $ config ->setConfiguration ($ config ->getDefaults ());
56+ $ config ->saveConfiguration ();
57+ $ prefixes [] = $ newPrefix ;
58+ }
59+
5260 $ hosts = $ helper ->getServerConfigurationHosts ();
5361
5462 $ wControls = new Template ('user_ldap ' , 'part.wizardcontrols ' );
@@ -62,7 +70,9 @@ public function getForm() {
6270 $ parameters ['wizardControls ' ] = $ wControls ;
6371
6472 // assign default values
65- $ config = new Configuration ('' , false );
73+ if (!isset ($ config )) {
74+ $ config = new Configuration ('' , false );
75+ }
6676 $ defaults = $ config ->getDefaults ();
6777 foreach ($ defaults as $ key => $ default ) {
6878 $ parameters [$ key .'_default ' ] = $ default ;
Original file line number Diff line number Diff line change 11<fieldset id="ldapWizard1">
22 <p>
33 <select id="ldap_serverconfig_chooser" name="ldap_serverconfig_chooser">
4- <?php if (count ($ _ ['serverConfigurationPrefixes ' ]) === 0 ) {
4+ <?php
5+ $ i = 1 ;
6+ $ sel = ' selected ' ;
7+ foreach ($ _ ['serverConfigurationPrefixes ' ] as $ prefix ) {
58 ?>
6- <option value="" selected> <?php p ($ l ->t ('1 . Server' )) ;?> </option>');
9+ <option value="<?php p ( $ prefix ); ?> " <?php p ( $ sel ); $ sel = '' ; ?> > <?php p ($ l ->t ('%s . Server: ' , array ( $ i ++))) ;?> <?php p ( ' ' . $ _ [ ' serverConfigurationHosts ' ][ $ prefix ]); ?> </option>
710 <?php
8- } else {
9- $ i = 1 ;
10- $ sel = ' selected ' ;
11- foreach ($ _ ['serverConfigurationPrefixes ' ] as $ prefix ) {
12- ?>
13- <option value="<?php p ($ prefix ); ?> "<?php p ($ sel ); $ sel = '' ; ?> ><?php p ($ l ->t ('%s. Server: ' , array ($ i ++)));?> <?php p (' ' .$ _ ['serverConfigurationHosts ' ][$ prefix ]); ?> </option>
14- <?php
15- }
1611 }
1712 ?>
1813 </select>
Original file line number Diff line number Diff line change @@ -56,10 +56,8 @@ public function setUp() {
5656 * @UseDB
5757 */
5858 public function testGetForm () {
59-
60- $ helper = new Helper (\OC ::$ server ->getConfig ());
61- $ prefixes = $ helper ->getServerConfigurationPrefixes ();
62- $ hosts = $ helper ->getServerConfigurationHosts ();
59+ $ prefixes = ['s01 ' ];
60+ $ hosts = ['s01 ' => '' ];
6361
6462 $ wControls = new Template ('user_ldap ' , 'part.wizardcontrols ' );
6563 $ wControls = $ wControls ->fetchPage ();
You can’t perform that action at this time.
0 commit comments