1 {**************************************************************************}
3 {* Copyright (C) 2003-2010 Polytechnique.org *}
4 {* http://opensource.polytechnique.org/ *}
6 {* This program is free software; you can redistribute it and/or modify *}
7 {* it under the terms of the GNU General Public License as published by *}
8 {* the Free Software Foundation; either version 2 of the License, or *}
9 {* (at your option) any later version. *}
11 {* This program is distributed in the hope that it will be useful, *}
12 {* but WITHOUT ANY WARRANTY; without even the implied warranty of *}
13 {* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *}
14 {* GNU General Public License for more details. *}
16 {* You should have received a copy of the GNU General Public License *}
17 {* along with this program; if not, write to the Free Software *}
18 {* Foundation, Inc., *}
19 {* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *}
21 {**************************************************************************}
25 {include core=plset.tpl}
27 {include wiki=Docs.Emploi}
33 Actuellement, {$mentors_number} mentors et référents se sont déclarés sur {#globals.core.sitename#}.
36 {javascript name=ajax}
37 {javascript name=jquery.jstree}
38 {javascript name=jobtermstree}
39 <script type="text/javascript">//<![CDATA[
41 var baseurl = platal_baseurl + "referent/";
43 var Ajax2 = new AjaxEngine();
45 /** Hides or display tree of all job terms */
46 function toggleJobTermsTree()
48 $('#mentoring_terms').closest('tr').toggle();
52 /** Function called by autocomplete when a term is selected */
53 function selectJobTerm(li)
55 if (li.extra[1] < 0) {
58 chooseJobTermInTree(null,li.extra[1],li.selectValue);
61 /** Prepares display for a jobterm in select's dropdown
62 * @param row the returned row from ajax : text, nb, id
64 function displayJobTerm(row)
67 return '<em>... précise ta recherche ... <\/em>';
69 return row[0]+' ('+row[1]+' camarade'+((row[1] > 1)?'s':'')+')';
72 /** Function called by job terms tree when an item is clicked */
73 function chooseJobTermInTree(treeid, jtid, full_name)
75 $('#jobtermText').val(full_name);
76 $('#mentoring_terms').closest('tr').hide();
77 updateJobTerm(jtid, $('#country_chg select').val());
80 /** Changes job term and proposes the different countries linked */
81 function updateJobTerm(jtid, country)
83 $('#jobterm').val(jtid);
84 $('#country_chg').closest('tr').show();
85 $('#keywords').show();
86 $('#country_chg').load(platal_baseurl + 'search/referent/countries/' + jtid, function(response, status, xhr) {
88 if (status != "error") {
89 $('#country_chg select').val(country);
95 /** Function called when validating form */
96 function validateSearchForm(f)
98 if (!f.jobterm.value) {
99 alert('Il faut choisir un mot clef avant de lancer la recherche.');
100 $('#jobtermText').val('').focus();
109 <form action="{$smarty.server.REQUEST_URI}" method="get" onsubmit="return validateSearchForm(this)">
110 <table cellpadding="0" cellspacing="0" summary="Formulaire de recherche de référents" class="bicol">
116 <input type="text" name="jobtermText" id="jobtermText" size="32" value="{$smarty.request.jobtermText}"/>
117 <input type="hidden" name="jobterm" id="jobterm" value="{$smarty.request.jobterm}"/>
118 <a id="jobTermsTreeToggle" href="#">{icon name=table title="Tous les mots-clefs"}</a>
121 <tr class="impair" style="display:none">
123 <div id="mentoring_terms"></div>
126 <tr class="pair" style="display:none">
128 Pays bien connus du référent :
130 <td id="country_chg">
133 <tr class="impair" style="display:none" id="keywords">
135 Expertise (recherche texte) :
138 <input type="text" value="{$smarty.request.expertise}" size="30" name="expertise" />
142 <div class="center" style="margin-top: 1em;">
143 <input id="search_referent" type="submit" value="Chercher" />
147 <script type="text/javascript">
150 createJobTermsTree('#mentoring_terms', 'profile/ajax/tree/jobterms/mentors', 'mentor', 'chooseJobTermInTree');
151 $("#jobtermText").autocomplete(baseurl + "autocomplete",
154 "width":$("#jobtermText").width()*2,
155 "onItemSelect" : selectJobTerm,
156 "formatItem" : displayJobTerm,
157 "matchSubset" : false
159 $('#jobTermsTreeToggle').click(toggleJobTermsTree);
161 {if $smarty.request.jobterm}
162 updateJobTerm("{$smarty.request.jobterm}", "{$smarty.request.country}");
166 {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}