1 {**************************************************************************}
3 {* Copyright (C) 2003-2013 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=jquery.jstree}
37 {javascript name=jobtermstree}
38 <script type="text/javascript">//<![CDATA[
40 var baseurl = $.plURL("referent/");
43 /** Hides or display tree of all job terms */
44 function toggleJobTermsTree()
46 $('#mentoring_terms').closest('tr').toggle();
50 /** Function called by autocomplete when a term is selected */
51 function selectJobTerm(id, value)
56 chooseJobTermInTree(null, id, value);
59 /** Prepares display for a jobterm in select's dropdown
60 * @param row the returned row from ajax : text, nb, id
62 function displayJobTerm(row)
65 return '<em>... précise ta recherche ... <\/em>';
67 return row[0]+' ('+row[1]+' camarade'+((row[1] > 1)?'s':'')+')';
70 /** Function called by job terms tree when an item is clicked */
71 function chooseJobTermInTree(treeid, jtid, full_name)
73 $('#jobtermText').val(full_name);
74 $('#mentoring_terms').closest('tr').hide();
75 updateJobTerm(jtid, $('#country_chg select').val());
78 /** Changes job term and proposes the different countries linked */
79 function updateJobTerm(jtid, country)
81 $('#jobterm').val(jtid);
82 $('#country_chg').closest('tr').show();
83 $('#keywords').show();
84 $('#country_chg').load($.plURL('search/referent/countries/' + jtid), function(response, status, xhr) {
86 if (status != "error") {
87 $('#country_chg select').val(country);
93 /** Function called when validating form */
94 function validateSearchForm(f)
96 if (!f.jobterm.value) {
97 alert('Il faut choisir un mot clef avant de lancer la recherche.');
98 $('#jobtermText').val('').focus();
107 <form action="{$smarty.server.REQUEST_URI}" method="get" onsubmit="return validateSearchForm(this)">
108 <table cellpadding="0" cellspacing="0" summary="Formulaire de recherche de référents" class="bicol">
114 <input type="text" name="jobtermText" id="jobtermText" size="32" value="{$smarty.request.jobtermText}"/>
115 <input type="hidden" name="jobterm" id="jobterm" value="{$smarty.request.jobterm}"/>
116 <a id="jobTermsTreeToggle" href="#">{icon name=table title="Tous les mots-clefs"}</a>
119 <tr class="impair" style="display:none">
121 <div id="mentoring_terms"></div>
124 <tr class="pair" style="display:none">
126 Pays bien connus du référent :
128 <td id="country_chg">
131 <tr class="impair" style="display:none" id="keywords">
133 Expertise (recherche texte) :
136 <input type="text" value="{$smarty.request.expertise}" size="30" name="expertise" />
140 <div class="center" style="margin-top: 1em;">
141 <input id="search_referent" type="submit" value="Chercher" />
145 <script type="text/javascript">
148 createJobTermsTree('#mentoring_terms', 'profile/ajax/tree/jobterms/mentors', 'mentor', 'chooseJobTermInTree');
149 $('#jobtermText').autocomplete({
150 source: $.plURL(baseurl + 'autocomplete'),
151 select: function(event, ui) {
152 selectJobTerm(ui.item.id, ui.item.value);
154 change: function(event, ui) {
155 if (ui.item != null && ui.item.field != null) {
156 $(this).val(ui.item.field);
160 $('#jobTermsTreeToggle').click(toggleJobTermsTree);
162 {if $smarty.request.jobterm}
163 updateJobTerm("{$smarty.request.jobterm}", "{$smarty.request.country}");
167 {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}