PageRenderTime 34ms CodeModel.GetById 9ms RepoModel.GetById 1ms app.codeStats 0ms

/app/views/configure/conf.auth.php

http://classroombookings.googlecode.com/
PHP | 316 lines | 282 code | 28 blank | 6 comment | 13 complexity | 5de8b260007fb28ea28f94eb43a829a6 MD5 | raw file
  1. <?php
  2. echo form_open('configure/save_auth', array('name' => 'form_confauth', 'id' => 'form_confauth'));
  3. // Start tabindex
  4. $t = 1;
  5. ?>
  6. <table class="form" cellpadding="6" cellspacing="0" border="0" width="100%">
  7. <tr class="h"><td colspan="2">Pre-authentication</td></tr>
  8. <tr>
  9. <td class="caption">
  10. <label for="preauth" accesskey="P" title="Enable pre-authentication support. Tick this box to enable it, click Save, then the key will be generated and displayed below."><u>P</u>re-authentication</label>
  11. <p class="tip">Enable pre-authentication support. Tick this box to enable it, click Save, then the key will be generated and displayed below.</p>
  12. </td>
  13. <td class="field">
  14. <label for="preauth" class="check">
  15. <?php
  16. echo form_hidden('preauthkey', $auth->preauthkey);
  17. unset($check);
  18. $check['name'] = 'preauth';
  19. $check['id'] = 'preauth';
  20. $check['value'] = '1';
  21. $check['checked'] = set_radio($check['name'], $check['value'], (!empty($auth->preauthkey)));
  22. $check['tabindex'] = $t;
  23. echo form_checkbox($check);
  24. $t++;
  25. ?>Enable
  26. </label>
  27. </td>
  28. </tr>
  29. <?php
  30. if(!empty($auth->preauthkey)){
  31. echo form_hidden('preauthfirst', '0');
  32. ?>
  33. <tr class="preauth">
  34. <td class="caption">
  35. <label for="preauthgroup_id" class="r" accesskey="U" title="Choose a group that users created automatically via preauth will belong to.">Default gro<u>u</u>p</label>
  36. <p class="tip">Choose a group that users created automatically via preauth will belong to.</p>
  37. </td>
  38. <td class="field">
  39. <?php
  40. echo form_dropdown('preauthgroup_id', $groups, set_value('preauthgroup_id', (isset($auth->preauthgroup_id)) ? $auth->preauthgroup_id : 0), array('tabindex' => $t));
  41. $t++;
  42. ?>
  43. </td>
  44. </tr>
  45. <tr class="preauth">
  46. <td class="caption">
  47. <label for="preauthemail" class="r" accesskey="E" title="Default email address domain applied to users created via preauthentication."><u>E</u>mail domain</label>
  48. <p class="tip">Default email address domain applied to users created via preauthentication.</p>
  49. </td>
  50. <td class="field">
  51. <?php
  52. unset($input);
  53. $input['accesskey'] = 'E';
  54. $input['name'] = 'preauthemail';
  55. $input['id'] = 'preauthemail';
  56. $input['size'] = '50';
  57. $input['maxlength'] = '100';
  58. $input['tabindex'] = $t;
  59. $input['value'] = @set_value('preauthemail', $auth->preauthemail);
  60. echo form_input($input);
  61. $t++;
  62. ?>
  63. </td>
  64. </tr>
  65. <tr class="preauth">
  66. <td class="caption">
  67. <label title="Please read the documentation on how to use the pre-authentication key.">Pre-auth key</label>
  68. <p class="tip">Please read the documentation on how to use the pre-authentication key.</p>
  69. </td>
  70. <td class="field">
  71. <?php echo $auth->preauthkey ?>
  72. </td>
  73. </tr>
  74. <?php
  75. } else {
  76. echo form_hidden('preauthfirst', '1');
  77. }
  78. ?>
  79. <tr class="h"><td colspan="2">LDAP/Active Directory</td></tr>
  80. <tr>
  81. <td class="caption">
  82. <label for="ldap" accesskey="L" title="If you enable LDAP authentication, users who attempt to login with LDAP credentials will be added to Classroombookings if successful. Ensure you set the Default group below to ensure they inherit the correct permissions."><u>L</u>DAP</label>
  83. <p class="tip">If you enable LDAP authentication, users who attempt to login with LDAP credentials will be added to Classroombookings if successful. Ensure you set the Default group below to ensure they inherit the correct permissions.</p>
  84. </td>
  85. <td class="field">
  86. <label for="ldap" class="check">
  87. <?php
  88. unset($check);
  89. $check['name'] = 'ldap';
  90. $check['id'] = 'ldap';
  91. $check['value'] = '1';
  92. $check['checked'] = set_radio($check['name'], $check['value'], ($auth->ldap == 1));
  93. $check['tabindex'] = $t;
  94. echo form_checkbox($check);
  95. $t++;
  96. ?>Enable
  97. </label>
  98. </td>
  99. </tr>
  100. <?php
  101. if($auth->ldap == 1){
  102. echo form_hidden('ldapfirst', '0');
  103. ?>
  104. <tr class="ldap">
  105. <td class="caption">
  106. <label for="ldaphost" class="r" accesskey="H" title="The LDAP hostname or IP address. If specifying a hostname, please ensure that the server can resolve it via DNS."><u>H</u>ostname</label>
  107. <p class="tip">The LDAP hostname or IP address. If specifying a hostname, please ensure that the server can resolve it via DNS.</p>
  108. </td>
  109. <td class="field">
  110. <?php
  111. unset($input);
  112. $input['accesskey'] = 'H';
  113. $input['name'] = 'ldaphost';
  114. $input['id'] = 'ldaphost';
  115. $input['size'] = '40';
  116. $input['maxlength'] = '50';
  117. $input['tabindex'] = $t;
  118. $input['value'] = set_value('ldaphost', $auth->ldaphost);
  119. echo form_input($input);
  120. $t++;
  121. ?>
  122. </td>
  123. </tr>
  124. <tr class="ldap">
  125. <td class="caption">
  126. <label for="ldapport" class="r" accesskey="C" title="TCP port used to communicate with the LDAP port on, use 389 if unsure.">T<u>C</u>P Port</label>
  127. <p class="tip">TCP port used to communicate with the LDAP port on, use 389 if unsure.</p>
  128. </td>
  129. <td class="field">
  130. <?php
  131. unset($input);
  132. $input['accesskey'] = 'C';
  133. $input['name'] = 'ldapport';
  134. $input['id'] = 'ldapport';
  135. $input['size'] = '5';
  136. $input['maxlength'] = '5';
  137. $input['tabindex'] = $t;
  138. $input['value'] = set_value('ldapport', ($auth->ldapport) ? $auth->ldapport : '389');
  139. echo form_input($input);
  140. $t++;
  141. ?>
  142. </td>
  143. </tr>
  144. <tr class="ldap">
  145. <td class="caption">
  146. <label for="ldapbase" class="r" accesskey="D" title="Separate multiple DNs to search with a semicolon">Base <u>D</u>Ns</label>
  147. <p class="tip">Separate multiple DNs to search with a semicolon.</p>
  148. </td>
  149. <td class="field">
  150. <?php
  151. unset($input);
  152. $input['accesskey'] = 'D';
  153. $input['name'] = 'ldapbase';
  154. $input['id'] = 'ldapbase';
  155. $input['maxlength'] = '65536';
  156. $input['tabindex'] = $t;
  157. $input['rows'] = '6';
  158. $input['cols'] = '60';
  159. $input['value'] = set_value('ldapbase', $auth->ldapbase);
  160. echo form_textarea($input);
  161. $t++;
  162. ?>
  163. </td>
  164. </tr>
  165. <tr class="ldap">
  166. <td class="caption">
  167. <label for="ldapfilter" class="r" accesskey="F" title="LDAP query filter. %u is where the supplied username will be replaced. Leave as default if unsure.">LDAP query filter</label>
  168. <p class="tip">LDAP query filter. %u is where the supplied username will be replaced. Leave as default if unsure.</p>
  169. </td>
  170. <td class="field">
  171. <?php
  172. unset($input);
  173. $input['accesskey'] = 'F';
  174. $input['name'] = 'ldapfilter';
  175. $input['id'] = 'ldapfilter';
  176. #$input['size'] = '60';
  177. $input['maxlength'] = '5120';
  178. $input['tabindex'] = $t;
  179. $input['rows'] = '4';
  180. $input['cols'] = '60';
  181. $input['value'] = set_value('ldapfilter', ($auth->ldapfilter) ? $auth->ldapfilter : "(& (| (!(displayname=Administrator*)) (!(displayname=Admin*)) ) (cn=%u) )");
  182. echo form_textarea($input);
  183. $t++;
  184. ?>
  185. </td>
  186. </tr>
  187. <tr class="ldap">
  188. <td class="caption">
  189. <label for="ldapgroup_id" class="r" accesskey="G" title="This is the group that users who authenticate via LDAP will become members of automatically.">Default CRBS group</label>
  190. <p class="tip">This is the group that users who authenticate via LDAP will become members of automatically.</p>
  191. </td>
  192. <td class="field">
  193. <?php
  194. echo form_dropdown('ldapgroup_id', $groups, set_value('ldapgroup_id', (isset($auth->ldapgroup_id)) ? $auth->ldapgroup_id : 0), array('tabindex' => $t));
  195. $t++;
  196. ?>
  197. </td>
  198. </tr>
  199. <tr>
  200. <td class="caption">
  201. <label for="ldaploginupdate" accesskey="T" title="If this option is enabled, the user details (display name, group and department membership) will be updated with their LDAP info every time they login; potentially un-doing any customisations you made to the user.">Upda<u>t</u>e details on login</label>
  202. <p class="tip">If this option is enabled, the user details (display name, group and department membership) will be updated with their LDAP info every time they login; potentially un-doing any customisations you made to the user.</p>
  203. </td>
  204. <td class="field">
  205. <label for="ldaploginupdate" class="check">
  206. <?php
  207. unset($check);
  208. $check['name'] = 'ldaploginupdate';
  209. $check['id'] = 'ldaploginupdate';
  210. $check['value'] = '1';
  211. $check['checked'] = set_radio($check['name'], $check['value'], ($auth->ldaploginupdate == 1));
  212. $check['tabindex'] = $t;
  213. echo form_checkbox($check);
  214. $t++;
  215. ?>Yes
  216. </label>
  217. </td>
  218. </tr>
  219. <tr class="ldap">
  220. <td class="caption">
  221. <label for="ldaptestuser" accesskey="U" title="Enter a username to test the LDAP settings with, and click Test LDAP.">Test username</label>
  222. <p class="tip">Enter a username to test the LDAP settings with, and click Test LDAP.</p>
  223. </td>
  224. <td class="field">
  225. <?php
  226. unset($input);
  227. $input['accesskey'] = 'U';
  228. $input['name'] = 'ldaptestuser';
  229. $input['id'] = 'ldaptestuser';
  230. $input['size'] = '20';
  231. $input['maxlength'] = '50';
  232. $input['tabindex'] = $t;
  233. $input['autocomplete'] = 'off';
  234. $input['value'] = set_value('ldaptestuser');
  235. echo form_input($input);
  236. $t++;
  237. ?>
  238. </td>
  239. </tr>
  240. <tr class="ldap">
  241. <td class="caption">
  242. <label for="ldaptestpass" accesskey="W">Test password</label>
  243. </td>
  244. <td class="field">
  245. <?php
  246. unset($input);
  247. $input['accesskey'] = 'W';
  248. $input['name'] = 'ldaptestpass';
  249. $input['id'] = 'ldaptestpass';
  250. $input['size'] = '20';
  251. $input['maxlength'] = '50';
  252. $input['tabindex'] = $t;
  253. $input['autocomplete'] = 'off';
  254. $input['value'] = set_value('ldaptestpass');
  255. echo form_password($input);
  256. $t++;
  257. ?>
  258. </td>
  259. </tr>
  260. <?php
  261. } else {
  262. echo form_hidden('ldapfirst', '1');
  263. }
  264. ?>
  265. <?php
  266. unset($buttons);
  267. $buttons[] = array('submit', 'positive', 'Save authentication settings', 'disk1.gif', $t);
  268. $buttons[] = array('other', 'positive', 'Test LDAP', 'control-double.gif', $t+1);
  269. $this->load->view('parts/buttons', array('buttons' => $buttons));
  270. ?>
  271. </table>
  272. </form>
  273. <script type="text/javascript">
  274. $("#test-ldap").bind("click", function(e){
  275. var w = window.open("about:blank","ldaptestwin","width=640,height=400,toolbar=0,location=0,menubar=0,scrollbars=1,resizable=1");
  276. var oldaction = $("#form_confauth").attr("action");
  277. var oldtarget = $("#form_confauth").attr("target");
  278. $("#form_confauth").attr("action","<?php echo site_url("configure/test_ldap") ?>");
  279. $("#form_confauth").attr("target","ldaptestwin");
  280. $("#form_confauth").submit();
  281. $("#form_confauth").attr("action",oldaction);
  282. $("#form_confauth").attr("target",oldtarget);
  283. });
  284. /*
  285. function togglefields(cat, visibility){
  286. $(".preauth").addClass("hidden");
  287. } */
  288. </script>