!form reply
<input type="hidden" name="up_$job" id="" value="authtype">
<fieldset class="property_fields blockcenter">
<legend>$wims_name_configb</legend>
<div class="field box">
<div class="formHelp">$name_intro_authtype</div>
!set wims_ref_class=wims_button_help float_right
!href cmd=help&special_parm=config&special_parm2=authtype $wims_name_help
!formselect up_authidp
list $authidp_method_list prompt
$name_method_list
</div>
</fieldset>
<fieldset id="cas_settings" class="property_fields blockcenter">
<legend>CAS Settings</legend>
<div class="field box">
!! also in public_html/modules/adm/class/regclass/proc/newclass.phtml
!if $jquery_defined=yes
!if $auth_cas_url_list!=$empty
<script>
$$(function() {
!if $class_cas_auth notitemof $auth_cas_url_list
!! set the actual selected option
$$('#up_cas_auth_select').val("other");
!endif
$$('#up_cas_auth_select').on('change', function() {
var check = this.value === "other";
var text_input
= $$
(this
).next();
text_input.prop('required', check).toggle(check);
!! only the select OR the input will be sent
if(check){
$$(this).prop('name', "");
text_input.prop('name', "up_cas_auth");
}else{
$$(this).prop('name', "up_cas_auth");
text_input.prop('name', "");
}
}).change();
});
</script>
<label for="up_cas_auth_select">CAS URL</label>
!formselect up_cas_auth_select
list $auth_cas_url_list,other prompt
$auth_cas_name_list,$wims_name_otherurl
!endif
<input size="40" type="url" name="up_cas_auth" value="$class_cas_auth" placeholder="https://ent.fr/cas" id="up_cas_auth">
!else
!! no jquery
<label for="up_cas_auth">CAS URL</label>
<input size="40" type="url" name="up_cas_auth" value="$class_cas_auth" placeholder="https://ent.fr/cas" id="up_cas_auth">
!if $auth_cas_list != $empty
<div class="formHelp">$auth_cas_list</div>
!endif
!endif
</div>
</fieldset>
<fieldset id="php_settings" class="property_fields blockcenter">
<legend>PHP Settings</legend>
<div class="field box">
<label for="up_php_auth">PHP</label>
<input size="30" name="up_php_auth" id="up_php_auth" value="$class_php_auth">
</div>
<div class="field box">
!set wims_ref_class=wims_button_help float_right
!href cmd=help&special_parm=config&special_parm2=authtype2 $wims_name_help
<label for="up_connections">connections</label>
<input size="30" name="up_connections" id="up_connections" value="$class_connections">
</div>
</fieldset>
<fieldset id="ldap_settings" class="property_fields blockcenter">
<legend>LDAP Settings</legend>
<div class="field box">
<label for="up_ldap_auth">ldap auth <span class="field_required">*</span></label>
<input size="30" name="up_ldap_auth" id="up_ldap_auth" value="$class_ldap_auth" placeholder="ldap.u-psud.fr">
</div>
<div class="field box">
<label for="up_ldap_port">ldap port</label>
<input size="30" name="up_ldap_port" id="up_ldap_port" value="$class_ldap_port" placeholder="389">
</div>
<div class="field box">
<label for="up_ldap_version">ldap version</label>
<input size="30" name="up_ldap_version" id="up_ldap_version" value="$class_ldap_version" placeholder="3">
</div>
<div class="field box">
<label for="up_ldap_base">ldap base <span class="field_required">*</span></label>
<input size="30" name="up_ldap_base" id="up_ldap_base" value="$class_ldap_base" placeholder="ou=people,dc=u-psud,dc=fr">
</div>
<div class="field box">
<label for="up_ldap_branch">ldap branch <span class="field_required">*</span></label>
<input size="30" name="up_ldap_branch" id="up_ldap_branch" value="$class_ldap_branch" placeholder="ou=people,dc=u-psud,dc=fr">
</div>
<div class="field box">
<label for="up_ldap_accreditation">ldap accreditation</label>
<input size="50" name="up_ldap_accreditation" id="up_ldap_accreditation" value='' placeholder='accreditation (nothing, or -D some_path -w some_password)'>
</div>
<div class="field box">
<label for="up_ldap_uid">ldap uid</label>
<input size="30" name="up_ldap_uid" id="up_ldap_uid" value="$class_ldap_uid" placeholder="uid">
</div>
<div class="field box">
<label for="up_ldap_login">ldap login</label>
<input size="30" name="up_ldap_login" id="up_ldap_login" value="$class_ldap_login" placeholder="uid">
</div>
<div class="field box">
<label for="up_ldap_regnum">ldap regnum</label>
<input size="30" name="up_ldap_regnum" id="up_ldap_regnum" value="$class_ldap_regnum">
</div>
<div class="field box">
<label for="up_ldap_email">ldap email</label>
<input size="30" name="up_ldap_email" id="up_ldap_email" value="$class_ldap_email">
</div>
<div class="field box">
<label for="up_ldap_photourl">ldap photourl</label>
<input size="30" name="up_ldap_photourl" id="up_ldap_photourl" value="$class_ldap_photourl">
</div>
</fieldset>
<div class="wimscenter actions">
<input type="submit" name="save" id="authtype_save" value="$wims_name_tosave">
$ $
!set wims_ref_class=wims_button wims_secondary_button
!href cmd=reply&job=$job $wims_name_giveup
</div>
!formend
!if $jquery_defined=yes
<script>
$$(function() {
!! define which input must be required in
each case
var required_inputs = {'cas':['up_cas_auth'],
'ldap': ['up_ldap_auth', 'up_ldap_base', 'up_ldap_branch'],
'php': []
}
!! init (hide all settings but the selected)
!for type in cas,php,ldap
!if $type notin $up_authidp
$$("#$(type)_settings").hide();
!else
required_inputs["$(type)"].forEach(function(element) {
$$("#"+element).prop('required', true);
});
!endif
!! when user select another auth type, display the right inputs and change the required one
$$("#up_authidp").change(function() {
var value=$$(this).val();
!for type in cas,php,ldap
if (value.indexOf("$type") >= 0){
$$("#$(type)_settings").show("slow");
required_inputs["$type"].forEach(function(element) {
$$("#"+element).prop('required', true);
});
}
else{
$$("#$(type)_settings").hide("slow");
required_inputs["$type"].forEach(function(element) {
$$("#"+element).prop('required', false);
});
}
});
});
</script>
!endif
!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 \
up_ldap_email up_ldap_regnum up_ldap_photourl up_ldap_accreditation