Merge commit 'origin/fusionax' into account
[platal.git] / htdocs / javascript / profile.js
CommitLineData
46ae38a9 1/***************************************************************************
179afa7f 2 * Copyright (C) 2003-2008 Polytechnique.org *
46ae38a9
FB
3 * http://opensource.polytechnique.org/ *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the Free Software *
17 * Foundation, Inc., *
18 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
19 ***************************************************************************/
20
21// Page initialization
22
23function wizPage_onLoad(id)
24{
25 switch (id) {
26 case 'general':
043bbacf
SJ
27 var i = 0;
28 var prefix = 'edu_';
58acfe8b 29 while ($('.' + prefix + i).length != 0) {
043bbacf
SJ
30 i++;
31 }
9937605f 32 i--;
043bbacf
SJ
33 for (var j = 0; j < i; j++) {
34 prepareType(j);
35 }
46ae38a9
FB
36 break;
37 case 'poly':
38 updateGroupSubLink(document.forms.prof_annu.groupesx_sub);
39 break;
40 case 'deco':
41 for (var i in names) {
42 if (typeof names[i] != 'function') {
43 if (document.getElementById("medal_" + i) != null) {
44 getMedalName(i);
45 buildGrade(i, document.forms.prof_annu["medal_" + i + "_grade"].value);
46 }
47 }
48 }
49 break;
50 case 'emploi':
51 for (var i = 0 ; document.getElementById('job_' + i) != null ; ++i) {
52 updateJobSecteur(i, 'job_' + i, 'jobs[' + i + ']',
53 document.forms.prof_annu["jobs[" + i + "][ss_secteur]"].value);
c7139c07
SJ
54 updateJobSousSecteur(i, 'job_' + i, 'jobs[' + i + ']',
55 document.forms.prof_annu["jobs[" + i + "][sss_secteur]"].value);
46ae38a9 56 }
933d9a4c 57 setTimeout('registerEnterpriseAutocomplete(-1)', 100);
46ae38a9
FB
58 break;
59 }
60}
61
f711b03f
SJ
62var educationDegree;
63var educationDegreeAll;
64var educationDegreeName;
46ae38a9
FB
65
66// General
67
68var subgrades;
69var names;
f711b03f 70function fillType(selectCtrl, edu, fill)
46ae38a9
FB
71{
72 var i;
043bbacf 73 var i0 = 0;
46ae38a9 74
043bbacf 75 for (i = selectCtrl.options.length; i >= 0; i--) {
46ae38a9
FB
76 selectCtrl.options[i] = null;
77 }
78
f711b03f 79 if (fill || edu < 0) {
46ae38a9 80 selectCtrl.options[0] = new Option(' ');
043bbacf
SJ
81 i0 = 1;
82 }
f711b03f
SJ
83 if (edu >= 0) {
84 for (i = 0; i < educationDegree[edu].length; i++) {
85 selectCtrl.options[i0 + i] = new Option(educationDegreeName[educationDegree[edu][i] - 1], educationDegree[edu][i]);
043bbacf
SJ
86 }
87 } else if (fill) {
f711b03f
SJ
88 for (i = 0; i < educationDegreeAll.length; i++) {
89 selectCtrl.options[i0 + i] = new Option(educationDegreeName[educationDegreeAll[i] - 1], educationDegreeAll[i]);
043bbacf 90 }
46ae38a9 91 }
46ae38a9
FB
92}
93
94
95function selectType(selectCtrl, type)
96{
97 for (i = 0; i < selectCtrl.options.length; i++) {
043bbacf
SJ
98 if (selectCtrl.options[i].value == type) {
99 selectCtrl.selectedIndex = i;
100 }
46ae38a9
FB
101 }
102}
103
043bbacf
SJ
104function prepareType(i)
105{
106 fillType(document.forms.prof_annu["edus[" + i + "][degreeid]"], document.forms.prof_annu["edus[" + i + "][eduid]"].selectedIndex - 1);
107 selectType(document.forms.prof_annu["edus[" + i + "][degreeid]"], document.forms.prof_annu["edu_" + i + "_tmp"].value);
108}
109
b04882ff
PC
110function addSearchName()
111{
112 var i = 0;
113 while (document.getElementById('search_name_' + i) != null) {
114 i++;
115 }
116 $('#add_search_name').before('<div id="search_name_' + i + '" style="padding:2px" class="center"></div>');
117 Ajax.update_html('search_name_' + i, 'profile/ajax/searchname/' + i,function(){
118 $('#search_name_'+i+' input')[1].focus();
119 });
120}
46ae38a9 121
b04882ff
PC
122function removeSearchName(i)
123{
124 if (document.getElementById('search_name_'+i+'_new') != null) {
125 $('#search_name_'+i).remove();
126 } else {
127 removeObject('search_name_'+i, 'search_name['+i+']');
128 }
129}
46ae38a9 130
8450c2aa
SJ
131function delNationality(i)
132{
133 $('#nationalite' + i).hide().find('select').val('');
134}
135
136function addNationality()
137{
138 var i = 0;
139 if ($('#nationalite2').find('select').val() == "") {
140 i = 2;
141 } else if ($('#nationalite3').find('select').val() == "") {
142 i = 3;
143 }
144 if ((i == 2) || (i == 3)) {
145 $('#nationalite' + i).show();
146 }
147}
148
d1a2252a
GB
149function addNetworking()
150{
151 var i = 0;
92c3f9e5
GB
152 var nws = 'networking_';
153 while (document.getElementById(nws + i) != null) {
d1a2252a
GB
154 i++;
155 }
92c3f9e5 156 var namefirst = '';
d1a2252a 157 var html = '<tr id="networking_' + i + '">'
92c3f9e5
GB
158 + ' <td colspan="2">'
159 + ' <div style="float: left; width: 200px;">'
160 + ' <span class="flags">'
161 + ' <input type="checkbox" name="networking[' + i + '][pub]"/>'
162 + ' <img src="images/icons/flag_green.gif" alt="site public" title="site public">'
163 + ' </span>&nbsp;'
164 + ' <select id="networking_type_' + i + '" name="networking[' + i + '][type]" onchange="javascript:updateNetworking(' + i + ');">';
165 for (nw in nw_list) {
166 if (namefirst == '') {
167 namefirst = nw;
168 }
169 html += ' <option value="' + nw_list[nw] + '">' + nw + '</option>';
170 }
171 html += '</select>'
172 + ' <input type="hidden" id="networking_name_' + i + '" name="networking[' + i + '][name]" value="' + namefirst + '"/>'
173 + ' </div>'
174 + ' <div style="float: left">'
175 + ' <input type="text" name="networking[' + i + '][address]" value="" size="30"/>'
176 + ' <a href="javascript:removeNetworking(' + i + ')">'
177 + ' <img src="images/icons/cross.gif" alt="cross" title="Supprimer cet élément"/>'
178 + ' </a>'
179 + ' </div>'
d1a2252a
GB
180 + ' </td>'
181 + '</tr>';
182
92c3f9e5 183 $('#networking').before(html);
d1a2252a
GB
184}
185
186function removeNetworking(id)
187{
188 $('#networking_' + id).remove();
189}
190
92c3f9e5 191function updateNetworking(i)
d1a2252a 192{
92c3f9e5
GB
193 var name = document.getElementById('networking_name_' + i);
194 var type = document.getElementById('networking_type_' + i);
195 if (type != null && name != null) {
196 name.value = type.options[type.selectedIndex].text;
d1a2252a 197 }
92c3f9e5 198
d1a2252a
GB
199}
200
46ae38a9
FB
201// Addresses
202
203function removeObject(id, pref)
204{
205 document.getElementById(id).style.display = "none";
206 document.forms.prof_annu[pref + "[removed]"].value = "1";
207}
208
209function restoreObject(id, pref)
210{
211 document.getElementById(id).style.display = '';
212 document.forms.prof_annu[pref + "[removed]"].value = "0";
213}
214
215function getAddressElement(adrid, adelement)
216{
217 return document.forms.prof_annu["addresses[" + adrid + "][" + adelement + "]"];
218}
219
220function checkCurrentAddress(newCurrent)
221{
222 var hasCurrent = false;
223 var i = 0;
224 while (getAddressElement(i, 'pub') != null) {
225 var radio = getAddressElement(i, 'current');
226 var removed = getAddressElement(i, 'removed');
227 if (removed.value == "1" && radio.checked) {
228 radio.checked = false;
229 } else if (radio.checked && radio != newCurrent) {
230 radio.checked = false;
231 } else if (radio.checked) {
232 hasCurrent = true;
233 }
234 i++;
235 }
236 if (!hasCurrent) {
237 i = 0;
238 while (getAddressElement(i, 'pub') != null) {
239 var radio = getAddressElement(i, 'current');
240 var removed = getAddressElement(i, 'removed');
241 if (removed.value != "1") {
242 radio.checked= true;
243 return;
244 }
245 i++;
246 }
247 }
248}
249
250function removeAddress(id, pref)
251{
252 removeObject(id, pref);
253 checkCurrentAddress(null);
254 if (document.forms.prof_annu[pref + '[datemaj]'].value != '') {
255 document.getElementById(id + '_grayed').style.display = '';
256 }
257}
258
259function restoreAddress(id, pref)
260{
261 document.getElementById(id + '_grayed').style.display = 'none';
262 checkCurrentAddress(null);
263 restoreObject(id, pref);
264}
265
266function addAddress()
267{
268 var i = 0;
269 while (getAddressElement(i, 'pub') != null) {
270 i++;
271 }
272 $("#add_adr").before('<div id="addresses_' + i + '_cont"></div>');
273 Ajax.update_html('addresses_' + i + '_cont', 'profile/ajax/address/' + i, checkCurrentAddress);
274}
275
043bbacf
SJ
276function addEdu()
277{
278 var i = 0;
62dba58e 279 var j = 0;
043bbacf 280 var prefix = 'edu_';
58acfe8b
SJ
281 var class_parity;
282
62dba58e
SJ
283 while (!$('#edu_add').hasClass(prefix + i)) {
284 if ($('.' + prefix + i).length != 0) {
285 j++;
286 }
043bbacf
SJ
287 i++;
288 }
62dba58e 289 if (j % 2) {
58acfe8b
SJ
290 class_parity = 'pair';
291 } else {
292 class_parity = 'impair';
293 }
62dba58e
SJ
294 $('#edu_add').removeClass(prefix + i);
295 i++;
296 $('#edu_add').addClass(prefix + i);
297 i--;
58acfe8b 298 $.get(platal_baseurl + 'profile/ajax/edu/' + i + '/' + class_parity,
043bbacf 299 function(data) {
58acfe8b 300 $('#edu_add').before(data);
043bbacf
SJ
301 prepareType(i);
302 });
303}
304
62dba58e 305function removeEdu(i)
043bbacf 306{
62dba58e
SJ
307 var prefix = 'edu_';
308 $('.' + prefix + i).remove();
309 while (!$('#edu_add').hasClass(prefix + i)) {
310 $('.' + prefix + i).toggleClass('pair');
311 $('.' + prefix + i).toggleClass('impair');
312 i++;
313 }
043bbacf
SJ
314}
315
bde2be3b 316function addTel(prefid, prefname)
46ae38a9
FB
317{
318 var i = 0;
bde2be3b
GB
319 var prefix = prefid + '_';
320 while (document.getElementById(prefix + i) != null) {
46ae38a9
FB
321 i++;
322 }
bde2be3b
GB
323 $('#' + prefix + 'add').before('<div id="' + prefix + i + '" style="clear: both; padding-top: 4px; padding-bottom: 4px"></div>');
324 Ajax.update_html(prefix + i, 'profile/ajax/tel/' + prefid + '/' + prefname + '/' + i);
46ae38a9
FB
325}
326
bde2be3b
GB
327function removeTel(id)
328{
329 $('#' + id).remove();
330}
331
332function addPhoneComment(id, pref)
333{
334 document.getElementById(id+'_comment').style.display = '';
335 document.getElementById(id+'_addComment').style.display = 'none';
336}
337
338function removePhoneComment(id, pref)
339{
340 document.getElementById(id+'_comment').style.display = 'none';
341 document.forms.prof_annu[pref+ '[comment]'].value = '';
342 document.getElementById(id+'_addComment').style.display = '';
343}
46ae38a9
FB
344
345// Geoloc
346
347function validGeoloc(id, pref)
348{
349 document.getElementById(id + '_geoloc').style.display = 'none';
350 document.getElementById(id + '_geoloc_error').style.display = 'none';
351 document.getElementById(id + '_geoloc_valid').style.display = 'none';
352 document.forms.prof_annu[pref + "[parsevalid]"].value = "1";
353 document.forms.prof_annu[pref + "[text]"].value = document.forms.prof_annu[pref + "[geoloc]"].value;
af66b871 354 document.forms.prof_annu[pref + "[cityid]"].value = document.forms.prof_annu[pref + "[geoloc_cityid]"].value;
8bcadd32 355 $(document.forms.prof_annu[pref + "[text]"]).click(function() { document.forms.prof_annu[pref + "[text]"].blur(); });
46ae38a9
FB
356 document.forms.prof_annu[pref + "[text]"].className = '';
357}
358
359function validAddress(id, pref)
360{
361 document.getElementById(id + '_geoloc').style.display = 'none';
362 document.getElementById(id + '_geoloc_error').style.display = 'none';
363 document.getElementById(id + '_geoloc_valid').style.display = 'none';
af66b871 364 document.forms.prof_annu[pref + "[parsevalid]"].value = "1";
8bcadd32 365 $(document.forms.prof_annu[pref + "[text]"]).click(function() { document.forms.prof_annu[pref + "[text]"].blur(); });
46ae38a9
FB
366 document.forms.prof_annu[pref + "[text]"].className = '';
367}
368
369
370// Groups
371
372function updateGroup(type)
373{
374 var val = document.forms.prof_annu[type + '_sel'].value;
375 if (val == '0' || document.getElementById(type + '_' + val) != null) {
376 document.getElementById(type + '_add').style.display = 'none';
377 } else {
378 document.getElementById(type + '_add').style.display = '';
379 }
380}
381
382function removeGroup(cat, id)
383{
384 $('#' + cat + '_' + id).remove();
385 updateGroup(cat);
386}
387
388function addGroup(cat)
389{
390 var cb = document.forms.prof_annu[cat + '_sel'];
391 var id = cb.value;
392 var text = cb.options[cb.selectedIndex].text;
393 var html = '<tr id="' + cat + '_' + id + '">'
394 + ' <td>'
395 + ' <input type="hidden" name="' + cat + '[' + id + ']" value="' + text + '" />'
396 + ' </td>'
397 + ' <td>'
398 + ' <div style="float: left; width: 70%">'
399 + text
400 + ' </div>'
401 + ' <a href="javascript:removeGroup(\'' + cat + '\', ' + id + ')">'
402 + ' <img src="images/icons/cross.gif" alt="cross" title="Supprimer ce groupe" />'
403 + ' </a>'
404 + ' </td>'
405 + '</tr>';
406 $('#' + cat).after(html);
407 updateGroup(cat);
408}
409
410function updateGroupSubLink(cb)
411{
412 var href = cb.value ? cb.value : "http://www.polytechnique.net";
413 document.getElementById("groupesx_sub").href = href;
414}
415
416
417// Medals
418
419function updateMedal()
420{
421 var val = document.forms.prof_annu['medal_sel'].value;
422 if (val == '' || document.getElementById('medal_' + val) != null) {
423 document.getElementById('medal_add').style.display = 'none';
424 } else {
425 document.getElementById('medal_add').style.display = '';
426 }
427}
428
429function getMedalName(id)
430{
431 document.getElementById('medal_name_' + id).innerHTML = names[id];
432}
433
434function buildGrade(id, current)
435{
436 var grade;
437 var subg = subgrades[id];
438 var obj = $('#medal_grade_' + id);
439 if (!subg) {
440 obj.prepend('<input type="hidden" name="medals[' + id + '][grade]" value="0" />');
441 } else {
442 var html = 'Agrafe : <select name="medals[' + id + '][grade]">';
443 html += '<option value="0">Non précisée</option>';
444 for (grade = 0 ; grade < subg.length ; grade++) {
445 html += '<option value="' + subg[grade][0] + '"';
446 if (subg[grade][0] == current) {
447 html += ' selected="selected"';
448 }
449 html += '>' + subg[grade][1] + '</option>';
450 }
451
452 html += '</select>';
453 obj.prepend(html);
454 }
455}
456
457function makeAddProcess(id)
458{
459 return function(data)
460 {
461 $('#medals').after(data);
462 updateMedal();
463 getMedalName(id);
464 buildGrade(id, 0);
465 };
466}
467
468function addMedal()
469{
470 var id = document.forms.prof_annu['medal_sel'].value;
471 $.get(platal_baseurl + 'profile/ajax/medal/' + id, makeAddProcess(id));
472}
473
474function removeMedal(id)
475{
476 $("#medal_" + id).remove();
477 updateMedal();
478}
479
480
481// Jobs
482
483function removeJob(id, pref)
484{
485 document.getElementById(id + '_cont').style.display = 'none';
486 if (document.forms.prof_annu[pref + '[new]'].value == '0') {
487 document.getElementById(id + '_grayed').style.display = '';
488 document.getElementById(id + '_grayed_name').innerHTML =
489 document.forms.prof_annu[pref + "[name]"].value.replace('<', '&lt;');
490 }
491 document.forms.prof_annu[pref + "[removed]"].value = "1";
492}
493
494function restoreJob(id, pref)
495{
496 document.getElementById(id + '_cont').style.display = '';
497 document.getElementById(id + '_grayed').style.display = 'none';
498 document.forms.prof_annu[pref + "[removed]"].value = "0";
499}
500
501function updateJobSecteur(nb, id, pref, sel)
502{
503 var secteur = document.forms.prof_annu[pref + '[secteur]'].value;
504 if (secteur == '') {
505 secteur = '-1';
506 }
c7139c07
SJ
507 Ajax.update_html(id + '_ss_secteur', 'profile/ajax/secteur/' + nb + '/' + id + '/' + pref + '/' + secteur + '/' + sel);
508}
509
510function updateJobSousSecteur(nb, id, pref, sel)
511{
512 var ssecteur = document.forms.prof_annu[pref + '[ss_secteur]'].value;
513 if (ssecteur == '') {
514 ssecteur = '-1';
515 }
516 Ajax.update_html(id + '_sss_secteur', 'profile/ajax/ssecteur/' + nb + '/' + ssecteur + '/' + sel);
517}
518
b814a8b8 519function displayAllSector(id)
c7139c07 520{
b814a8b8
SJ
521 $('.sector_text_' + id).remove();
522 $('.sector_' + id).show();
46ae38a9
FB
523}
524
525function makeAddJob(id)
526{
527 return function(data)
528 {
529 $('#add_job').before(data);
16594a1a 530 registerEnterpriseAutocomplete(id);
46ae38a9
FB
531 updateSecteur('job_' + id, 'jobs[' + id + ']', '');
532 };
533}
534
535function addJob()
536{
537 var i = 0;
538 while (document.getElementById('job_' + i) != null) {
539 ++i;
540 }
541 $.get(platal_baseurl + 'profile/ajax/job/' + i, makeAddJob(i));
542}
543
b814a8b8
SJ
544function addEntreprise(id)
545{
546 $('.entreprise_' + id).toggle();
547}
46ae38a9
FB
548
549// Skills
550
551function updateSkill(cat)
552{
553 var val = document.forms.prof_annu[cat + '_sel'].value;
554 var show = true;
555 if (val == '') {
556 show = false;
557 }
558 if (document.getElementById(cat + '_' + val) != null) {
559 show = false;
560 }
561 document.getElementById(cat + '_add').style.display = show ? '' : 'none';
562}
563
564function addSkill(cat)
565{
566 var sel = document.forms.prof_annu[cat + '_sel'];
567 var val = sel.value;
568 var text = sel.options[sel.selectedIndex].text;
569 $.get(platal_baseurl + 'profile/ajax/skill/' + cat + '/' + val,
570 function(data) {
571 $('#' + cat).append(data);
572 document.getElementById(cat + '_' + val + '_title').innerHTML = text;
573 updateSkill(cat);
574 });
575}
576
577function removeSkill(cat, id)
578{
579 $('#' + cat + '_' + id).remove();
580 updateSkill(cat);
581}
582
583
584// Mentor
585
586function updateCountry()
587{
588 var val = document.forms.prof_annu.countries_sel.value;
589 var show = true;
1d414e12 590 if (val == '' || val == '00') {
46ae38a9
FB
591 show = false;
592 }
593 if (document.getElementById('countries_' + val) != null) {
594 show = false;
595 }
596 document.getElementById('countries_add').style.display = show ? '' : 'none';
597}
598
599function addCountry()
600{
601 var cb = document.forms.prof_annu.countries_sel;
602 var val = cb.value;
603 var text = cb.options[cb.selectedIndex].text;
604 var html = '<div id="countries_' + val + '" style="clear: both; margin-bottom: 0.7em">'
1d414e12 605 + ' <a href="javascript:removeCountry(\'' + val + '\')" style="display: block; float:right">'
46ae38a9
FB
606 + ' <img src="images/icons/cross.gif" alt="" title="Supprimer ce pays" />'
607 + ' </a>'
1d414e12
PC
608 + ' <div style="float: left; width: 50%">' + text + '</div>'
609 + ' <input type="hidden" name="countries[' + val + ']" value="' + text + '" />'
46ae38a9
FB
610 + '</div>';
611 $('#countries').append(html);
612 updateCountry();
613}
614
615function removeCountry(id)
616{
617 $('#countries_' + id).remove();
618 updateCountry();
619}
620function updateSSecteur()
621{
622 var s = document.forms.prof_annu.secteur_sel.value;
623 var ss = document.forms.prof_annu['jobs[-1][ss_secteur]'].value;
624 var show = true;
625 if (s == '' || ss == '') {
626 show = false;
627 }
628 if (document.getElementById('secteurs_' + s + '_' + ss) != null) {
629 show = false;
630 }
631 document.getElementById('secteurs_add').style.display = show ? 'block' : 'none';
632}
633
634function updateSecteur()
635{
636 var secteur = document.forms.prof_annu.secteur_sel.value;
637 if (secteur == '') {
638 secteur = '-1';
76a2858c
PC
639 document.getElementById('ss_secteur_sel').innerHTML = '';
640 return;
46ae38a9 641 }
5fecdf6d 642 $.get(platal_baseurl + 'profile/ajax/secteur/-1/0/0/' + secteur,
46ae38a9 643 function(data) {
5fecdf6d
SJ
644 data = '<a href="javascript:addSecteur()" style="display: none; float: right" id="secteurs_add">'
645 + ' <img src="images/icons/add.gif" alt="" title="Ajouter ce secteur" />'
646 + '</a>' + data;
647 document.getElementById('ss_secteur_sel').innerHTML = data;
648 $(document.forms.prof_annu['jobs[-1][ss_secteur]']).change(updateSSecteur);
46ae38a9
FB
649 });
650}
651
652function addSecteur()
653{
654 var scb = document.forms.prof_annu.secteur_sel;
655 var s = scb.value;
656 var st = scb.options[scb.selectedIndex].text;
657
658 var sscb = document.forms.prof_annu['jobs[-1][ss_secteur]'];
659 var ss = sscb.value;
660 var sst = sscb.options[sscb.selectedIndex].text;
661
662 var html = '<div id="secteurs_' + s + '_' + ss + '" style="clear: both; margin-top: 0.5em" class="titre">'
663 + ' <a href="javascript:removeSecteur(\'' + s + '\', \'' + ss + '\')" style="display: block; float: right">'
664 + ' <img src="images/icons/cross.gif" alt="" title="Supprimer ce secteur" />'
665 + ' </a>'
666 + ' <input type="hidden" name="secteurs[' + s + '][' + ss + ']" value="' + sst + '" />'
667 + ' ' + sst
668 + '</div>';
669 $('#secteurs').append(html);
670 updateSSecteur();
671}
672
673function removeSecteur(s, ss)
674{
675 $('#secteurs_' + s + '_' + ss).remove();
676 updateSSecteur();
677}
678
16594a1a
FB
679function registerEnterpriseAutocomplete(id)
680{
16594a1a
FB
681 $(".enterprise_name").each(
682 function() {
16594a1a
FB
683 if (id == -1 || this.name == "jobs[" + id + "][name]") {
684 $(this).autocomplete(platal_baseurl + "search/autocomplete/entreprise",
685 {
686 selectOnly:1,
687 field:this.name,
688 matchSubset:0,
689 width:$(this).width()
690 });
691 }
692 }
693 );
c7139c07
SJ
694
695 $(".sector_name").each(
696 function() {
697 if (id == -1 || this.name == "jobs[" + id + "][sss_secteur_name]") {
698 $(this).autocomplete(platal_baseurl + "search/autocomplete/sss_secteur",
699 {
700 selectOnly:1,
701 field:this.name,
702 matchSubset:0,
703 width:$(this).width()
704 });
705 }
706 }
707 );
16594a1a
FB
708}
709
46ae38a9 710// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: