X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;ds=inline;f=htdocs%2Fjavascript%2Fprofile.js;h=b54277f7ed0f539577ac540010ec6e54ab3a35e1;hb=e1082e206561844a788977f3ea676f78e4112a68;hp=108ce44bcb35932aec87cbca80bf62b7f6bcae3a;hpb=d0edeb70f254ed642b59c7c3636b7802266bcfe4;p=platal.git
diff --git a/htdocs/javascript/profile.js b/htdocs/javascript/profile.js
index 108ce44..b54277f 100644
--- a/htdocs/javascript/profile.js
+++ b/htdocs/javascript/profile.js
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2003-2008 Polytechnique.org *
+ * Copyright (C) 2003-2009 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -24,10 +24,15 @@ function wizPage_onLoad(id)
{
switch (id) {
case 'general':
- fillType(document.forms.prof_annu['appli1[type]'], document.forms.prof_annu['appli1[id]'].selectedIndex-1);
- selectType(document.forms.prof_annu['appli1[type]'], document.forms.prof_annu['appli1_tmp'].value);
- fillType(document.forms.prof_annu['appli2[type]'], document.forms.prof_annu['appli2[id]'].selectedIndex-1);
- selectType(document.forms.prof_annu['appli2[type]'], document.forms.prof_annu['appli2_tmp'].value);
+ var i = 0;
+ var prefix = 'edu_';
+ while ($('.' + prefix + i).length != 0) {
+ i++;
+ }
+ i--;
+ for (var j = 0; j < i; j++) {
+ prepareType(j);
+ }
break;
case 'poly':
updateGroupSubLink(document.forms.prof_annu.groupesx_sub);
@@ -46,50 +51,190 @@ function wizPage_onLoad(id)
for (var i = 0 ; document.getElementById('job_' + i) != null ; ++i) {
updateJobSecteur(i, 'job_' + i, 'jobs[' + i + ']',
document.forms.prof_annu["jobs[" + i + "][ss_secteur]"].value);
+ updateJobSousSecteur(i, 'job_' + i, 'jobs[' + i + ']',
+ document.forms.prof_annu["jobs[" + i + "][sss_secteur]"].value);
}
setTimeout('registerEnterpriseAutocomplete(-1)', 100);
break;
}
}
-var applisType;
-var applisTypeAll;
+var educationDegree;
+var educationDegreeAll;
+var educationDegreeName;
// General
var subgrades;
var names;
-function fillType(selectCtrl, appli, fill)
+function fillType(selectCtrl, edu, fill)
{
var i;
- var i0=0;
+ var i0 = 0;
- for (i = selectCtrl.options.length; i >=0; i--) {
+ for (i = selectCtrl.options.length; i >= 0; i--) {
selectCtrl.options[i] = null;
}
- if (fill || appli <0) {
+ if (fill || edu < 0) {
selectCtrl.options[0] = new Option(' ');
- i0=1;
+ i0 = 1;
+ }
+ if (edu >= 0) {
+ for (i = 0; i < educationDegree[edu].length; i++) {
+ selectCtrl.options[i0 + i] = new Option(educationDegreeName[educationDegree[edu][i] - 1], educationDegree[edu][i]);
+ }
+ } else if (fill) {
+ for (i = 0; i < educationDegreeAll.length; i++) {
+ selectCtrl.options[i0 + i] = new Option(educationDegreeName[educationDegreeAll[i] - 1], educationDegreeAll[i]);
+ }
}
- if (appli>=0)
- for (i=0; i < applisType[appli].length; i++)
- selectCtrl.options[i0+i] = new Option(applisType[appli][i]);
- else if (fill)
- for (i=0; i < applisTypeAll.length; i++)
- selectCtrl.options[i0+i] = new Option(applisTypeAll[i]);
}
function selectType(selectCtrl, type)
{
for (i = 0; i < selectCtrl.options.length; i++) {
- if (selectCtrl.options[i].text == type)
- selectCtrl.selectedIndex=i;
+ if (selectCtrl.options[i].value == type) {
+ selectCtrl.selectedIndex = i;
+ }
}
}
+function prepareType(i)
+{
+ fillType(document.forms.prof_annu["edus[" + i + "][degreeid]"], document.forms.prof_annu["edus[" + i + "][eduid]"].selectedIndex - 1);
+ selectType(document.forms.prof_annu["edus[" + i + "][degreeid]"], document.forms.prof_annu["edu_" + i + "_tmp"].value);
+}
+function toggleNamesAdvanced()
+{
+ $('.names_advanced').toggle();
+}
+
+function addSearchName()
+{
+ var i = 0;
+ while ($('#search_name_' + i).length != 0) {
+ i++;
+ }
+ Ajax.update_html('search_name_' + i, 'profile/ajax/searchname/' + i, function(data){
+ $('#searchname').before(data);
+ changeNameFlag(i);
+ });
+}
+
+function removeSearchName(i)
+{
+ $('#search_name_' + i).remove();
+ updateNameDisplay();
+}
+
+function changeNameFlag(i)
+{
+ $('#flag_' + i).remove();
+ var typeid = $('#search_name_' + i).find('select').val();
+ var type = $('#search_name_' + i).find('select :selected').text();
+ if ($('[@name=sn_type_' + typeid + '_' + i + ']').val() > 0) {
+ $('#flag_cb_' + i).after(' ' +
+ '' +
+ '' +
+ '' +
+ '');
+ } else {
+ $('#flag_cb_' + i).after(' ' +
+ '
' +
+ '' +
+ '');
+ }
+}
+
+function updateNameDisplay()
+{
+ var searchnames = '';
+ for (var i = 0; i < 10; i++) {
+ if ($('#search_name_' + i).find(':text').val()) {
+ searchnames += $('#search_name_' + i).find('[name*=typeid]').val() + ';';
+ searchnames += $('#search_name_' + i).find(':checked').length-1 + ';';
+ searchnames += $('#search_name_' + i).find(':text').val() + ';;';
+ }
+ }
+ Ajax.update_html(null, 'profile/ajax/buildnames/' + searchnames, function(data){
+ var name = data.split(';');
+ $('#public_name').html(name[0]);
+ $('#private_name').html(name[0] + name[1]);
+ });
+}
+
+function delNationality(i)
+{
+ $('#nationalite' + i).hide().find('select').val('');
+}
+
+function addNationality()
+{
+ var i = 0;
+ if ($('#nationalite2').find('select').val() == "") {
+ i = 2;
+ } else if ($('#nationalite3').find('select').val() == "") {
+ i = 3;
+ }
+ if ((i == 2) || (i == 3)) {
+ $('#nationalite' + i).show();
+ }
+}
+
+function addNetworking()
+{
+ var i = 0;
+ var nws = 'networking_';
+ while (document.getElementById(nws + i) != null) {
+ i++;
+ }
+ var namefirst = '';
+ var html = '