Commit | Line | Data |
---|---|---|
0337d704 | 1 | {**************************************************************************} |
2 | {* *} | |
5e1513f6 | 3 | {* Copyright (C) 2003-2011 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 | ||
3ac45f10 PC |
36 | {javascript name=jquery.jstree} |
37 | {javascript name=jobtermstree} | |
ff3eb9b7 | 38 | <script type="text/javascript">//<![CDATA[ |
ff3eb9b7 | 39 | |
63c89179 | 40 | var baseurl = $.plURL("referent/"); |
66f2b6b3 | 41 | {literal} |
ff3eb9b7 | 42 | |
459e6f81 PC |
43 | /** Hides or display tree of all job terms */ |
44 | function toggleJobTermsTree() | |
ff3eb9b7 | 45 | { |
459e6f81 PC |
46 | $('#mentoring_terms').closest('tr').toggle(); |
47 | return false; | |
48 | } | |
49 | ||
50 | /** Function called by autocomplete when a term is selected */ | |
658cffd4 | 51 | function selectJobTerm(id, value) |
459e6f81 | 52 | { |
658cffd4 | 53 | if (value < 0) { |
459e6f81 | 54 | return; |
ff3eb9b7 | 55 | } |
658cffd4 | 56 | chooseJobTermInTree(null, id, value); |
ff3eb9b7 | 57 | } |
58 | ||
459e6f81 PC |
59 | /** Prepares display for a jobterm in select's dropdown |
60 | * @param row the returned row from ajax : text, nb, id | |
61 | */ | |
62 | function displayJobTerm(row) | |
ff3eb9b7 | 63 | { |
459e6f81 PC |
64 | if (row[1] < 0) { |
65 | return '<em>... précise ta recherche ... <\/em>'; | |
66 | } | |
67 | return row[0]+' ('+row[1]+' camarade'+((row[1] > 1)?'s':'')+')'; | |
ff3eb9b7 | 68 | } |
69 | ||
459e6f81 PC |
70 | /** Function called by job terms tree when an item is clicked */ |
71 | function chooseJobTermInTree(treeid, jtid, full_name) | |
3ac45f10 | 72 | { |
459e6f81 PC |
73 | $('#jobtermText').val(full_name); |
74 | $('#mentoring_terms').closest('tr').hide(); | |
75 | updateJobTerm(jtid, $('#country_chg select').val()); | |
76 | } | |
77 | ||
78 | /** Changes job term and proposes the different countries linked */ | |
79 | function updateJobTerm(jtid, country) | |
80 | { | |
81 | $('#jobterm').val(jtid); | |
82 | $('#country_chg').closest('tr').show(); | |
83 | $('#keywords').show(); | |
63c89179 | 84 | $('#country_chg').load($.plURL('search/referent/countries/' + jtid), function(response, status, xhr) { |
459e6f81 PC |
85 | if (country) { |
86 | if (status != "error") { | |
87 | $('#country_chg select').val(country); | |
88 | } | |
89 | } | |
90 | }); | |
91 | } | |
92 | ||
93 | /** Function called when validating form */ | |
94 | function validateSearchForm(f) | |
95 | { | |
96 | if (!f.jobterm.value) { | |
97 | alert('Il faut choisir un mot clef avant de lancer la recherche.'); | |
98 | $('#jobtermText').val('').focus(); | |
99 | return false; | |
100 | } | |
101 | return true; | |
3ac45f10 PC |
102 | } |
103 | ||
ff3eb9b7 | 104 | {/literal} |
105 | //]]></script> | |
106 | ||
459e6f81 PC |
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"> | |
0337d704 | 109 | <tr class="impair"> |
110 | <td class="titre"> | |
3ac45f10 | 111 | Mot-clef : |
0337d704 | 112 | </td> |
ff3eb9b7 | 113 | <td> |
459e6f81 PC |
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}"/> | |
3ac45f10 | 116 | <a id="jobTermsTreeToggle" href="#">{icon name=table title="Tous les mots-clefs"}</a> |
0337d704 | 117 | </td> |
118 | </tr> | |
3ac45f10 PC |
119 | <tr class="impair" style="display:none"> |
120 | <td colspan="2"> | |
121 | <div id="mentoring_terms"></div> | |
0337d704 | 122 | </td> |
123 | </tr> | |
459e6f81 PC |
124 | <tr class="pair" style="display:none"> |
125 | <td class="titre"> | |
126 | Pays bien connus du référent : | |
127 | </td> | |
128 | <td id="country_chg"> | |
129 | </td> | |
130 | </tr> | |
131 | <tr class="impair" style="display:none" id="keywords"> | |
132 | <td class="titre"> | |
133 | Expertise (recherche texte) : | |
134 | </td> | |
135 | <td> | |
136 | <input type="text" value="{$smarty.request.expertise}" size="30" name="expertise" /> | |
137 | </td> | |
138 | </tr> | |
0337d704 | 139 | </table> |
140 | <div class="center" style="margin-top: 1em;"> | |
459e6f81 | 141 | <input id="search_referent" type="submit" value="Chercher" /> |
0337d704 | 142 | </div> |
143 | </form> | |
144 | ||
578aa461 | 145 | <script type="text/javascript"> |
3ac45f10 PC |
146 | {literal} |
147 | $(function() { | |
459e6f81 | 148 | createJobTermsTree('#mentoring_terms', 'profile/ajax/tree/jobterms/mentors', 'mentor', 'chooseJobTermInTree'); |
658cffd4 SJ |
149 | $('#jobtermText').autocomplete({ |
150 | source: $.plURL(baseurl + 'autocomplete'), | |
151 | select: function(event, ui) { | |
152 | selectJobTerm(ui.item.id, ui.item.value); | |
153 | }, | |
154 | change: function(event, ui) { | |
155 | if (ui.item != null && ui.item.field != null) { | |
156 | $(this).val(ui.item.field); | |
157 | } | |
158 | } | |
3ac45f10 PC |
159 | }); |
160 | $('#jobTermsTreeToggle').click(toggleJobTermsTree); | |
3ac45f10 | 161 | {/literal} |
459e6f81 PC |
162 | {if $smarty.request.jobterm} |
163 | updateJobTerm("{$smarty.request.jobterm}", "{$smarty.request.country}"); | |
164 | {/if} | |
165 | {rdelim}); | |
578aa461 | 166 | </script> |
a7de4ef7 | 167 | {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *} |