Commit | Line | Data |
---|---|---|
0337d704 | 1 | {**************************************************************************} |
2 | {* *} | |
9f5bd98e | 3 | {* Copyright (C) 2003-2010 Polytechnique.org *} |
0337d704 | 4 | {* http://opensource.polytechnique.org/ *} |
5 | {* *} | |
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. *} | |
10 | {* *} | |
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. *} | |
15 | {* *} | |
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 *} | |
20 | {* *} | |
21 | {**************************************************************************} | |
22 | ||
23 | ||
ff3eb9b7 | 24 | {if $plset_count} |
a9cd2bab | 25 | {include core=plset.tpl} |
ff3eb9b7 | 26 | {else} |
7a3f546b | 27 | {include wiki=Docs.Emploi} |
ff3eb9b7 | 28 | {/if} |
0337d704 | 29 | |
e2c528e1 | 30 | <a id="mentors"></a> |
1d414e12 | 31 | |
0337d704 | 32 | <p> |
a7de4ef7 | 33 | Actuellement, {$mentors_number} mentors et référents se sont déclarés sur {#globals.core.sitename#}. |
0337d704 | 34 | </p> |
35 | ||
ff3eb9b7 | 36 | {javascript name=ajax} |
3ac45f10 PC |
37 | {javascript name=jquery.jstree} |
38 | {javascript name=jobtermstree} | |
ff3eb9b7 | 39 | <script type="text/javascript">//<![CDATA[ |
ff3eb9b7 | 40 | |
f4e39c19 | 41 | var baseurl = platal_baseurl + "referent/"; |
66f2b6b3 | 42 | {literal} |
ff3eb9b7 | 43 | var Ajax2 = new AjaxEngine(); |
44 | ||
459e6f81 PC |
45 | /** Hides or display tree of all job terms */ |
46 | function toggleJobTermsTree() | |
ff3eb9b7 | 47 | { |
459e6f81 PC |
48 | $('#mentoring_terms').closest('tr').toggle(); |
49 | return false; | |
50 | } | |
51 | ||
52 | /** Function called by autocomplete when a term is selected */ | |
53 | function selectJobTerm(li) | |
54 | { | |
55 | if (li.extra[1] < 0) { | |
56 | return; | |
ff3eb9b7 | 57 | } |
459e6f81 | 58 | chooseJobTermInTree(null,li.extra[1],li.selectValue); |
ff3eb9b7 | 59 | } |
60 | ||
459e6f81 PC |
61 | /** Prepares display for a jobterm in select's dropdown |
62 | * @param row the returned row from ajax : text, nb, id | |
63 | */ | |
64 | function displayJobTerm(row) | |
ff3eb9b7 | 65 | { |
459e6f81 PC |
66 | if (row[1] < 0) { |
67 | return '<em>... précise ta recherche ... <\/em>'; | |
68 | } | |
69 | return row[0]+' ('+row[1]+' camarade'+((row[1] > 1)?'s':'')+')'; | |
ff3eb9b7 | 70 | } |
71 | ||
459e6f81 PC |
72 | /** Function called by job terms tree when an item is clicked */ |
73 | function chooseJobTermInTree(treeid, jtid, full_name) | |
3ac45f10 | 74 | { |
459e6f81 PC |
75 | $('#jobtermText').val(full_name); |
76 | $('#mentoring_terms').closest('tr').hide(); | |
77 | updateJobTerm(jtid, $('#country_chg select').val()); | |
78 | } | |
79 | ||
80 | /** Changes job term and proposes the different countries linked */ | |
81 | function updateJobTerm(jtid, country) | |
82 | { | |
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) { | |
87 | if (country) { | |
88 | if (status != "error") { | |
89 | $('#country_chg select').val(country); | |
90 | } | |
91 | } | |
92 | }); | |
93 | } | |
94 | ||
95 | /** Function called when validating form */ | |
96 | function validateSearchForm(f) | |
97 | { | |
98 | if (!f.jobterm.value) { | |
99 | alert('Il faut choisir un mot clef avant de lancer la recherche.'); | |
100 | $('#jobtermText').val('').focus(); | |
101 | return false; | |
102 | } | |
103 | return true; | |
3ac45f10 PC |
104 | } |
105 | ||
ff3eb9b7 | 106 | {/literal} |
107 | //]]></script> | |
108 | ||
459e6f81 PC |
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"> | |
0337d704 | 111 | <tr class="impair"> |
112 | <td class="titre"> | |
3ac45f10 | 113 | Mot-clef : |
0337d704 | 114 | </td> |
ff3eb9b7 | 115 | <td> |
459e6f81 PC |
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}"/> | |
3ac45f10 | 118 | <a id="jobTermsTreeToggle" href="#">{icon name=table title="Tous les mots-clefs"}</a> |
0337d704 | 119 | </td> |
120 | </tr> | |
3ac45f10 PC |
121 | <tr class="impair" style="display:none"> |
122 | <td colspan="2"> | |
123 | <div id="mentoring_terms"></div> | |
0337d704 | 124 | </td> |
125 | </tr> | |
459e6f81 PC |
126 | <tr class="pair" style="display:none"> |
127 | <td class="titre"> | |
128 | Pays bien connus du référent : | |
129 | </td> | |
130 | <td id="country_chg"> | |
131 | </td> | |
132 | </tr> | |
133 | <tr class="impair" style="display:none" id="keywords"> | |
134 | <td class="titre"> | |
135 | Expertise (recherche texte) : | |
136 | </td> | |
137 | <td> | |
138 | <input type="text" value="{$smarty.request.expertise}" size="30" name="expertise" /> | |
139 | </td> | |
140 | </tr> | |
0337d704 | 141 | </table> |
142 | <div class="center" style="margin-top: 1em;"> | |
459e6f81 | 143 | <input id="search_referent" type="submit" value="Chercher" /> |
0337d704 | 144 | </div> |
145 | </form> | |
146 | ||
578aa461 | 147 | <script type="text/javascript"> |
3ac45f10 PC |
148 | {literal} |
149 | $(function() { | |
459e6f81 PC |
150 | createJobTermsTree('#mentoring_terms', 'profile/ajax/tree/jobterms/mentors', 'mentor', 'chooseJobTermInTree'); |
151 | $("#jobtermText").autocomplete(baseurl + "autocomplete", | |
3ac45f10 PC |
152 | { |
153 | "selectOnly":1, | |
459e6f81 PC |
154 | "width":$("#jobtermText").width()*2, |
155 | "onItemSelect" : selectJobTerm, | |
156 | "formatItem" : displayJobTerm, | |
157 | "matchSubset" : false | |
3ac45f10 PC |
158 | }); |
159 | $('#jobTermsTreeToggle').click(toggleJobTermsTree); | |
3ac45f10 | 160 | {/literal} |
459e6f81 PC |
161 | {if $smarty.request.jobterm} |
162 | updateJobTerm("{$smarty.request.jobterm}", "{$smarty.request.country}"); | |
163 | {/if} | |
164 | {rdelim}); | |
578aa461 | 165 | </script> |
a7de4ef7 | 166 | {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *} |