Subversion Repositories wimsdev

Rev

Rev 17180 | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1.  
  2. !form reply
  3.   <input type="hidden" name="up_$job" id="" value="authtype">
  4.  
  5.   <fieldset class="property_fields blockcenter">
  6.     <legend>$wims_name_configb</legend>
  7.     <div class="field box">
  8.       <div class="formHelp">$name_intro_authtype</div>
  9.       !set wims_ref_class=wims_button_help float_right
  10.       !href cmd=help&special_parm=config&special_parm2=authtype $wims_name_help
  11.       !formselect up_authidp list $authidp_method_list prompt $name_method_list
  12.     </div>
  13.   </fieldset>
  14.  
  15.   <fieldset id="cas_settings" class="property_fields blockcenter">
  16.     <legend>CAS Settings</legend>
  17.     <div class="field box">
  18.       !! also in public_html/modules/adm/class/regclass/proc/newclass.phtml
  19.  
  20.       !if $jquery_defined=yes
  21.         !if $auth_cas_url_list!=$empty
  22.           <script>
  23.             $$(function() {
  24.               !if $class_cas_auth notitemof $auth_cas_url_list
  25.                 !! set the actual selected option
  26.                 $$('#up_cas_auth_select').val("other");
  27.               !endif
  28.               $$('#up_cas_auth_select').on('change', function() {
  29.                 var check = this.value === "other";
  30.                 var text_input = $$(this).next();
  31.                 text_input.prop('required', check).toggle(check);
  32.                 !! only the select OR the input will be sent
  33.                 if(check){
  34.                   $$(this).prop('name', "");
  35.                   text_input.prop('name', "up_cas_auth");
  36.                 }else{
  37.                   $$(this).prop('name', "up_cas_auth");
  38.                   text_input.prop('name', "");
  39.                 }
  40.               }).change();
  41.             });
  42.           </script>
  43.           <label for="up_cas_auth_select">CAS URL</label>
  44.           !formselect up_cas_auth_select list $auth_cas_url_list,other prompt $auth_cas_name_list,$wims_name_otherurl
  45.         !endif
  46.         <input size="40" type="url" name="up_cas_auth" value="$class_cas_auth" placeholder="https://ent.fr/cas" id="up_cas_auth">
  47.       !else
  48.         !! no jquery
  49.         <label for="up_cas_auth">CAS URL</label>
  50.         <input size="40" type="url" name="up_cas_auth" value="$class_cas_auth" placeholder="https://ent.fr/cas" id="up_cas_auth">
  51.         !if $auth_cas_list != $empty
  52.           <div class="formHelp">$auth_cas_list</div>
  53.         !endif
  54.       !endif
  55.     </div>
  56.   </fieldset>
  57.  
  58.   <fieldset id="php_settings" class="property_fields blockcenter">
  59.     <legend>PHP Settings</legend>
  60.     <div class="field box">
  61.       <label for="up_php_auth">PHP</label>
  62.       <input size="30" name="up_php_auth" id="up_php_auth" value="$class_php_auth">
  63.     </div>
  64.     <div class="field box">
  65.       !set wims_ref_class=wims_button_help float_right
  66.       !href cmd=help&special_parm=config&special_parm2=authtype2 $wims_name_help
  67.       <label for="up_connections">connections</label>
  68.       <input size="30" name="up_connections" id="up_connections" value="$class_connections">
  69.     </div>
  70.   </fieldset>
  71.  
  72.   <fieldset id="ldap_settings" class="property_fields blockcenter">
  73.     <legend>LDAP Settings</legend>
  74.     <div class="field box">
  75.       <label for="up_ldap_auth">ldap auth <span class="field_required">*</span></label>
  76.       <input size="30" name="up_ldap_auth" id="up_ldap_auth" value="$class_ldap_auth" placeholder="ldap.u-psud.fr">
  77.     </div>
  78.     <div class="field box">
  79.       <label for="up_ldap_port">ldap port</label>
  80.       <input size="30" name="up_ldap_port" id="up_ldap_port" value="$class_ldap_port" placeholder="389">
  81.     </div>
  82.     <div class="field box">
  83.       <label for="up_ldap_version">ldap version</label>
  84.       <input size="30" name="up_ldap_version" id="up_ldap_version" value="$class_ldap_version" placeholder="3">
  85.     </div>
  86.     <div class="field box">
  87.       <label for="up_ldap_base">ldap base <span class="field_required">*</span></label>
  88.       <input size="30" name="up_ldap_base" id="up_ldap_base" value="$class_ldap_base" placeholder="ou=people,dc=u-psud,dc=fr">
  89.     </div>
  90.     <div class="field box">
  91.       <label for="up_ldap_branch">ldap branch <span class="field_required">*</span></label>
  92.       <input size="30" name="up_ldap_branch" id="up_ldap_branch" value="$class_ldap_branch" placeholder="ou=people,dc=u-psud,dc=fr">
  93.     </div>
  94.     <div class="field box">
  95.       <label for="up_ldap_accreditation">ldap accreditation</label>
  96.       <input size="50" name="up_ldap_accreditation" id="up_ldap_accreditation" value='' placeholder='accreditation (nothing, or -D some_path -w some_password)'>
  97.     </div>
  98.     <div class="field box">
  99.       <label for="up_ldap_uid">ldap uid</label>
  100.       <input size="30" name="up_ldap_uid" id="up_ldap_uid" value="$class_ldap_uid" placeholder="uid">
  101.     </div>
  102.     <div class="field box">
  103.       <label for="up_ldap_login">ldap login</label>
  104.       <input size="30" name="up_ldap_login" id="up_ldap_login" value="$class_ldap_login" placeholder="uid">
  105.     </div>
  106.     <div class="field box">
  107.       <label for="up_ldap_regnum">ldap regnum</label>
  108.       <input size="30" name="up_ldap_regnum" id="up_ldap_regnum" value="$class_ldap_regnum">
  109.     </div>
  110.     <div class="field box">
  111.       <label for="up_ldap_email">ldap email</label>
  112.       <input size="30" name="up_ldap_email" id="up_ldap_email" value="$class_ldap_email">
  113.     </div>
  114.     <div class="field box">
  115.       <label for="up_ldap_photourl">ldap photourl</label>
  116.       <input size="30" name="up_ldap_photourl" id="up_ldap_photourl" value="$class_ldap_photourl">
  117.     </div>
  118.   </fieldset>
  119.  
  120.   <div class="wimscenter actions">
  121.     <input type="submit" name="save" id="authtype_save" value="$wims_name_tosave">
  122.     $ $
  123. !set wims_ref_class=wims_button wims_secondary_button
  124. !href cmd=reply&job=$job $wims_name_giveup
  125.   </div>
  126.  
  127. !formend
  128.  
  129. !if $jquery_defined=yes
  130.   <script>
  131.     $$(function() {
  132.  
  133.       !! define which input must be required in each case
  134.       var required_inputs = {'cas':['up_cas_auth'],
  135.                              'ldap': ['up_ldap_auth', 'up_ldap_base', 'up_ldap_branch'],
  136.                              'php': []
  137.                             }
  138.  
  139.       !! init (hide all settings but the selected)
  140.       !for type in cas,php,ldap
  141.         !if $type notin $up_authidp
  142.           $$("#$(type)_settings").hide();
  143.         !else
  144.           required_inputs["$(type)"].forEach(function(element) {
  145.             $$("#"+element).prop('required', true);
  146.           });
  147.         !endif
  148.       !next
  149.       !! when user select another auth type, display the right inputs and change the required one
  150.       $$("#up_authidp").change(function() {
  151.         var value=$$(this).val();
  152.         !for type in cas,php,ldap
  153.           if (value.indexOf("$type") >= 0){
  154.             $$("#$(type)_settings").show("slow");
  155.             required_inputs["$type"].forEach(function(element) {
  156.               $$("#"+element).prop('required', true);
  157.             });
  158.           }
  159.           else{
  160.             $$("#$(type)_settings").hide("slow");
  161.             required_inputs["$type"].forEach(function(element) {
  162.               $$("#"+element).prop('required', false);
  163.             });
  164.           }
  165.         !next
  166.       });
  167.     });
  168.   </script>
  169. !endif
  170.  
  171. !reset up_authidp up_cas_auth up_php_auth up_connections up_ldap_auth up_ldap_port up_ldap_version up_ldap_base up_ldap_branch up_ldap_uid up_ldap_login \
  172.   up_ldap_email up_ldap_regnum up_ldap_photourl up_ldap_accreditation
  173.