for (var i = 0 ; $('#job_' + i).length != 0; ++i) {
updateJobSector(i, $('#job_' + i).find("[name='jobs[" + i + "][subSector]']").val());
updateJobSubSector(i, $('#job_' + i).find("[name='jobs[" + i + "][subSubSector]']").val());
+ updateJobAlternates(i);
}
break;
}
Ajax.update_html('job_' + id + '_subSubSector', 'profile/ajax/sub_sector/' + id + '/' + subSector + '/' + sel);
}
+function updateJobAlternates(id)
+{
+ var subSubSector = $('#job_' + id).find("[name='jobs[" + id + "][subSubSector]']").val();
+ if (subSubSector != '') {
+ Ajax.update_html('job_' + id + '_alternates', 'profile/ajax/alternates/' + id + '/' + subSubSector);
+ }
+}
+
function displayAllSector(id)
{
$('.sector_text_' + id).remove();
'profile/ajax/job' => $this->make_hook('ajax_job', AUTH_COOKIE, 'user', NO_AUTH),
'profile/ajax/sector' => $this->make_hook('ajax_sector', AUTH_COOKIE, 'user', NO_AUTH),
'profile/ajax/sub_sector' => $this->make_hook('ajax_sub_sector', AUTH_COOKIE, 'user', NO_AUTH),
+ 'profile/ajax/alternates' => $this->make_hook('ajax_alternates', AUTH_COOKIE, 'user', NO_AUTH),
'profile/ajax/skill' => $this->make_hook('ajax_skill', AUTH_COOKIE, 'user', NO_AUTH),
'profile/ajax/searchname' => $this->make_hook('ajax_searchname', AUTH_COOKIE, 'user', NO_AUTH),
'profile/ajax/buildnames' => $this->make_hook('ajax_buildnames', AUTH_COOKIE, 'user', NO_AUTH),
$page->assign('sel', $sssect);
}
+ function handler_ajax_alternates(&$page, $id, $sssect)
+ {
+ header('Content-Type: text/html; charset=utf-8');
+ $res = XDB::iterator('SELECT name
+ FROM profile_job_alternates
+ WHERE subsubsectorid = {?}
+ ORDER BY id',
+ $sssect);
+ $page->changeTpl('profile/jobs.alternates.tpl', NO_SKIN);
+ $alternate = $res->next();
+ $alternates = $alternate['name'];
+ while ($alternate = $res->next()) {
+ $alternates .= ', ' . $alternate['name'];
+ }
+ $page->assign('alternates', $alternates);
+ }
+
function handler_ajax_skill(&$page, $cat, $id)
{
header('Content-Type: text/html; charset=utf-8');
--- /dev/null
+{**************************************************************************}
+{* *}
+{* Copyright (C) 2003-2009 Polytechnique.org *}
+{* http://opensource.polytechnique.org/ *}
+{* *}
+{* This program is free software; you can redistribute it and/or modify *}
+{* it under the terms of the GNU General Public License as published by *}
+{* the Free Software Foundation; either version 2 of the License, or *}
+{* (at your option) any later version. *}
+{* *}
+{* This program is distributed in the hope that it will be useful, *}
+{* but WITHOUT ANY WARRANTY; without even the implied warranty of *}
+{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *}
+{* GNU General Public License for more details. *}
+{* *}
+{* You should have received a copy of the GNU General Public License *}
+{* along with this program; if not, write to the Free Software *}
+{* Foundation, Inc., *}
+{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *}
+{* *}
+{**************************************************************************}
+
+<?xml version="1.0" encoding="utf-8"?>
+<small>({$alternates})</small>
+
+{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
</td>
</tr>
<tr class="pair {$sector}" style="display: none">
- <td class="titre" rowspan="3">Secteur d'activité</td>
+ <td class="titre" rowspan="4">Secteur d'activité</td>
<td>
<select name="{$jobpref}[sector]" onchange="updateJobSector({$i}, '')">
<option value=""> </option>
<input type="hidden" name="{$jobpref}[subSubSector]" value="{$job.subSubSector|default:'-1'}" />
</td>
</tr>
+ <tr class="pair {$sector}" style="display: none">
+ <td id="{$jobid}_alternates">
+ </td>
+ </tr>
<tr class="pair">
<td class="titre">Fonction occupée</td>
<td>
{**************************************************************************}
<?xml version="1.0" encoding="utf-8"?>
-<select name="jobs[{$id}][subSubSector]">
+<select name="jobs[{$id}][subSubSector]" onchange="updateJobAlternates({$id})">
<option value=""></option>
{iterate from=$subSubSectors item=subSubSector}
<option value="{$subSubSector.id}" {if $subSubSector.id eq $sel}selected="selected"{/if}>{$subSubSector.name}</option>