X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=templates%2Fsearch%2Freferent.tpl;h=ab57b717a2d5631d75ccc873b524603bc3ee26c6;hb=cafb410fea6f257f45da08631c6cdb5c35f86b17;hp=0da117033802e0dce928371d76a9363877854f59;hpb=9dc65790548d3ad53842a80f91227d099ed199aa;p=platal.git diff --git a/templates/search/referent.tpl b/templates/search/referent.tpl index 0da1170..ab57b71 100644 --- a/templates/search/referent.tpl +++ b/templates/search/referent.tpl @@ -42,48 +42,79 @@ var baseurl = platal_baseurl + "referent/"; {literal} var Ajax2 = new AjaxEngine(); -function setSector(sector) +/** Hides or display tree of all job terms */ +function toggleJobTermsTree() { - if (sector == '') { - document.getElementById('scat').style.display = 'none'; - document.getElementById('country').style.display = 'none'; - document.getElementById('keywords').style.display = 'none'; - document.getElementById('search_referent').disabled = 'disabled'; - } else { - Ajax.update_html('ssect_chg', baseurl + 'ssect/' + sector); - Ajax2.update_html('country_chg', baseurl + 'country/' + sector); - document.getElementById('scat').style.display = ''; - document.getElementById('country').style.display = ''; - document.getElementById('keywords').style.display = ''; - document.getElementById('search_referent').disabled = ''; + $('#mentoring_terms').closest('tr').toggle(); + return false; +} + +/** Function called by autocomplete when a term is selected */ +function selectJobTerm(li) +{ + if (li.extra[1] < 0) { + return; } + chooseJobTermInTree(null,li.extra[1],li.selectValue); } -function setSSectors() +/** Prepares display for a jobterm in select's dropdown + * @param row the returned row from ajax : text, nb, id + */ +function displayJobTerm(row) { - var sect = document.getElementById('sect_field').value; - var ssect = document.getElementById('ssect_field').value; - Ajax2.update_html('country_chg', baseurl + 'country/' + sect + '/' + ssect); + if (row[1] < 0) { + return '... précise ta recherche ... <\/em>'; + } + return row[0]+' ('+row[1]+' camarade'+((row[1] > 1)?'s':'')+')'; } -function toggleJobTermsTree() +/** Function called by job terms tree when an item is clicked */ +function chooseJobTermInTree(treeid, jtid, full_name) { - $('#mentoring_terms').closest('tr').toggle(); - return false; + $('#jobtermText').val(full_name); + $('#mentoring_terms').closest('tr').hide(); + updateJobTerm(jtid, $('#country_chg select').val()); +} + +/** Changes job term and proposes the different countries linked */ +function updateJobTerm(jtid, country) +{ + $('#jobterm').val(jtid); + $('#country_chg').closest('tr').show(); + $('#keywords').show(); + $('#country_chg').load(platal_baseurl + 'search/referent/countries/' + jtid, function(response, status, xhr) { + if (country) { + if (status != "error") { + $('#country_chg select').val(country); + } + } + }); +} + +/** Function called when validating form */ +function validateSearchForm(f) +{ + if (!f.jobterm.value) { + alert('Il faut choisir un mot clef avant de lancer la recherche.'); + $('#jobtermText').val('').focus(); + return false; + } + return true; } {/literal} //]]> -
- + +
@@ -92,24 +123,44 @@ function toggleJobTermsTree()
+ + + + + + + +
Mot-clef : - - + + {icon name=table title="Tous les mots-clefs"}
- +
{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}