Language course html

From Redazione
Jump to navigation Jump to search
 
(70 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
This form is intended to create language courses of a given organization or to characterize as such whatever page of it (not containing already a form).
 +
 +
Once the key-data are created, insert the abstract of the course editing the page using the buttons "Edit" or "Edit source" in the top panel.
 +
 +
 +
{{Form_header|form=Language course }}
 +
 +
 
<html>
 
<html>
 +
 
<div class="ci_form_container">
 
<div class="ci_form_container">
  
Line 10: Line 19:
  
 
<!--
 
<!--
Language_course_Title
+
Form language course_Title=
Language_course_Language
+
Form language course_Language=
Language_course_Academic_year
+
Form language course_Academic_year=
Language_course_Description
+
Form language course Level=
Language_course_Level
+
Form language course_Teachers=
Language_course_Teachers
+
Form language course Price=
Language_course_Price
+
Form language course_Notes=
Language_course_Dates and times
+
Form language course_Contact phone=
Language_course_Contacts
+
Form language course_Contact email=
 
-->
 
-->
  
<!--------------------------TITLE-------------------------->
 
<div class="ci_form_section">
 
<span class="ci_form_section_label">
 
Title
 
</span>
 
 
<input class="ci_form_input" type="text" placeholder="" name="Form language course[Title]" value="">
 
 
</span>
 
 
</div>
 
 
<!--------------------------LANGUAGE-------------------------->
 
<!--------------------------LANGUAGE-------------------------->
  
Line 39: Line 37:
 
</span>
 
</span>
  
<input type="hidden" value="1" name="Form language course[language][is_list]">
+
<select class="ci_form_input" name="Form language course[Language]">
 
 
<select class="ci_form_input" name="Form language course[Languages]">
 
 
<option></option>
 
<option></option>
 
<option>Afrikaans</option>
 
<option>Afrikaans</option>
Line 150: Line 146:
 
<span class="ci_form_section_help">
 
<span class="ci_form_section_help">
 
</span>
 
</span>
 
<!--------------------------DESCRIPTION-------------------------->
 
 
<div class="ci_form_section">
 
<span class="ci_form_section_label">
 
Description
 
</span>
 
 
<textarea name="Form language course[Description]" class="form_language_course_input" style="width:100%" rows="3">
 
</textarea>
 
</span>
 
 
 
</div>
 
</div>
  
Line 171: Line 155:
 
</span>
 
</span>
  
<select class="ci_form_input" name="Form language course[Level]">
+
<!--
 +
<input type="hidden" name="Form language course[Level]">
 +
-->
 +
 
 +
<table>
 +
<tr><td><select class="ci_form_input" name="Form language course[Level from]">
 
<option></option>
 
<option></option>
 
<option>A1</option>
 
<option>A1</option>
 +
<option>A2</option>
 +
<option>B1</option>
 +
<option>B2</option>
 +
<option>C1</option>
 +
</select>
 +
</td>
 +
<td><select class="ci_form_input" name="Form language course[Level to]">
 +
<option></option>
 
<option>A2</option>
 
<option>A2</option>
 
<option>B1</option>
 
<option>B1</option>
Line 181: Line 178:
 
</select>
 
</select>
 
</td> </tr>
 
</td> </tr>
 +
 +
 
</table>
 
</table>
  
 
<span class="ci_form_section_help">
 
<span class="ci_form_section_help">
 +
Select the range of levels targeted by this course
 
</span>
 
</span>
 +
 +
</div>
 +
  
 
<!--------------------------TEACHERS-------------------------->
 
<!--------------------------TEACHERS-------------------------->
Line 195: Line 198:
 
<input type="hidden" value="1" name="Form language course[Teachers][is_list]">
 
<input type="hidden" value="1" name="Form language course[Teachers][is_list]">
  
 +
<select id="select_teachers" multiple class="ci_form_input" name="Form language course[Teachers][]">
 
</html>
 
</html>
 
+
{{#arraydefine:myarray|{{#ask:
 
 
 
 
{{#arraymap:value|delimiter|variable|formula|new_delimiter}}
 
 
 
Gloria<PROP>Maritan##Luca<PROP>Speziale##Manana<PROP>Jokharidze
 
 
 
{{#arraymap:
 
{{#ask:
 
 
[[~{{#ci_userAffiliatedTo:}}*]] [[Category:Teachers]]
 
[[~{{#ci_userAffiliatedTo:}}*]] [[Category:Teachers]]
 
|?Teacher first name=
 
|?Teacher first name=
Line 211: Line 207:
 
|format=array
 
|format=array
 
|sep=##
 
|sep=##
}}
+
}}|##|sort=asc, unique}}
|##|x|<option>x</option>|}}
 
  
<html>
 
<select multiple class="ci_form_input select_languages" name="Form language course[Teachers][]">
 
</html>
 
{{#replace:string|search term|replacement term}}
 
  
 +
{{#ci_noparse_isHTML:
 
{{#replace:
 
{{#replace:
 
{{#arraymap:
 
{{#arraymap:
{{#ask:
+
{{#arrayprint:myarray|##}}
[[~{{#ci_userAffiliatedTo:}}*]] [[Category:Teachers]]
+
|##|x|<option>x</option>|}}
|?Teacher first name=
+
|<PROP>|<nowiki/> <nowiki/>}}
|?Teacher last name=
 
|mainlabel=-
 
|format=array
 
|sep=##
 
 
}}
 
}}
|##|x|<option>x</option>|}}
+
<html>
|<PROP>| }}
 
  
  
<html>
 
 
</select>
 
</select>
  
 +
<span class="ci_form_section_help">
 +
Select one or more teachers heading this course entered through the form </html>[[Special:FormEdit/Teacher]]<html>
 +
</span>
  
</span>
+
</div>
  
  
Line 249: Line 238:
 
<input class="ci_form_input" type="text" placeholder="" name="Form language course[Price]" value="">
 
<input class="ci_form_input" type="text" placeholder="" name="Form language course[Price]" value="">
  
 +
<span class="ci_form_section_help">
 
</span>
 
</span>
  
<!--------------------------DATE AND TIMES-------------------------->
+
</div>
 +
 
 +
 
 +
 
 +
<!--------------------------Notes-------------------------->
  
 
<div class="ci_form_section">
 
<div class="ci_form_section">
 
<span class="ci_form_section_label">
 
<span class="ci_form_section_label">
Dates and times
+
Notes
 
</span>
 
</span>
  
<textarea name="Form language course[Dates and times]" class="form_language_course_input" style="width:100%" rows="3">
+
<textarea name="Form language course[Notes]" class="form_Language_course_input" style="width:100%" rows="3">
 
</textarea>
 
</textarea>
 +
<span class="ci_form_section_help">
 +
Write any useful information regarding the course location and time
 
</span>
 
</span>
  
 
</div>
 
</div>
<!--------------------------CONTACTS-------------------------->
+
 
 +
 
 +
<!--------------------------CONTACT Email-------------------------->
  
 
<div class="ci_form_section">
 
<div class="ci_form_section">
 
<span class="ci_form_section_label">
 
<span class="ci_form_section_label">
Contacts (email)
+
Contact (email)
 
</span>
 
</span>
  
<input class="ci_form_input" type="Email" placeholder="" name="Form language course[Contacts]" value="">
+
<input class="ci_form_input" type="Email" placeholder="" name="Form language course[Contact email]" value="">
  
 +
<span class="ci_form_section_help">
 
</span>
 
</span>
 +
 +
</div>
 +
 +
 +
<!--------------------------CONTACT (phone)-------------------------->
 +
 +
 +
<!--------------------------phone number-------------------------->
 +
 +
<div class="ci_form_section">
 +
<span class="ci_form_section_label">
 +
Phone number
 +
</span>
 +
 +
 +
<style>
 +
.iti__flag {background-image: url("/w/ci_scripts/intl-tel-input/img/flags.png");}
 +
 +
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
 +
  .iti__flag {background-image: url("/w/ci_scripts/intl-tel-input/img/flags@2x.png");}
 +
}
 +
 +
.iti { width: 100%; }
 +
</style>
 +
 +
<input class="ci_form_input" type="tel" id="phone" style="width:100%">
 +
<input type="hidden" id="phone_input" value="" name="Form language course[Contact phone]" style="width:100%">
 +
 +
 +
<span class="ci_form_section_help">
 +
</span>
 +
</div>
 +
 +
 +
  
 
<!--------------------------SUBMIT-------------------------->
 
<!--------------------------SUBMIT-------------------------->
Line 290: Line 324:
 
<script>
 
<script>
  
$(window).load(function() {
 
  
var api = new mw.Api();
 
api.get( {
 
    action: 'ask',
 
    query: '[[~</html>{{#userAffiliatedTo:}}<html>*]] [[Category:Teachers]]'
 
} ).done( function ( data ) {
 
    console.log( data );
 
} );
 
  
 +
$ci(function() {
 +
 +
 +
/*
 +
if("</html>{{PAGENAME}}<html>" == "FormEdit/Language course") {
 +
$ci('#logo_section').hide();
 +
}
 +
*/
 +
 +
var teachers = [</html>{{#replace:
 +
{{#arraymap:
 +
{{#ask:
 +
[[~{{#ci_userAffiliatedTo:}}*]] [[Category:Teachers]]
 +
|?Teacher first name=
 +
|?Teacher last name=
 +
|mainlabel=-
 +
|format=array
 +
|sep=##
 +
}}
 +
|##|x|'x'|,}}
 +
|<PROP>|<nowiki/> <nowiki/>}}
 +
<html>];
 +
 +
var dropdown = $ci("#select_teachers");
 +
$ci.each(teachers, function(index,value) {
 +
    //dropdown.append($ci("<option />").text(value));
 
});
 
});
  
  
$(function(){
+
$ci('select[multiple]').multiselect({search: true});
  
 +
$ci('.ci_form textarea').autosize();
  
$('select[multiple]').multiselect({search: true});
+
var input = document.querySelector("#phone");
  
$('.ci_form textarea').autosize();
+
var iti = window.intlTelInput(input, {
 +
initialCountry: "</html>{{#ci_visitorIsoCode:}}<html>",
 +
utilsScript: '/w/ci_scripts/intl-tel-input/js/utils.js',
 +
nationalMode: false,
 +
separateDialCode: true,
 +
});
  
 +
var val_ = $ci('#phone_input').val();
  
if("</html>{{PAGENAME}}<html>" == "FormEdit/Teacher") {
+
if(val_) {
$('#picture_section').hide();
+
iti.setNumber(val_);
 
}
 
}
  
  
  
$('form').submit(function() {
+
 
 +
$ci('form').submit(function() {
 +
 
 
  // ***attention !!!
 
  // ***attention !!!
 
  // otherwise pageforms will not retrieve it!
 
  // otherwise pageforms will not retrieve it!
  $('input').removeAttr('disabled');
+
  $ci('input').removeAttr('disabled');
 +
 
 +
 +
var required = ['Language','Academic year','Level from','Level to','Teachers']
 +
for(var i of required) {
 +
 
 +
//if(!el.prop('multiple') || !el.children(":selected").val() ) {
 +
if(!$ci('[name="Form language course[' + i + ']"]').val()) {
 +
if(!$ci('[name="Form language course[' + i + '][]"]').val()) {
 +
alert(i + ' must be set')
 +
return false;
 +
}
 +
}
 +
 
 +
}
 +
 
 +
/*
 +
if(!$ci('[name="Form language course[Level from]"]').val() || !$ci('[name="Form language course[Level to]"]').val()) {
 +
alert('Language level must be set')
 +
return false;
 +
}
 +
 
 +
$ci('[name="Form language course[Level]"]').val($ci('[name="Form language course[Level from]"]').val() + '-' + $ci('[name="Form language course[Level to]"]').val());
 +
 
 +
*/
 +
var number = iti.getNumber(intlTelInputUtils.numberFormat.E164);
 +
 
 +
if(number) {
 +
$ci('#phone_input').val(number);
 +
}
 +
 
 +
 
 
  return true;
 
  return true;
 
});
 
});

Latest revision as of 21:28, 7 December 2020

This form is intended to create language courses of a given organization or to characterize as such whatever page of it (not containing already a form).

Once the key-data are created, insert the abstract of the course editing the page using the buttons "Edit" or "Edit source" in the top panel.


The form will be created in the current page (). If you want to create the form in a new page, go here.


Select the range of levels targeted by this course
Select one or more teachers heading this course entered through the form Teacher
Write any useful information regarding the course location and time