From: Stéphane Jacob Date: Sat, 28 Mar 2009 16:46:40 +0000 (+0100) Subject: Displays alternate sector names in profile edition. X-Git-Tag: xorg/1.0.0~332^2~337^2~7 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=07e725823c24e0b0c2e0787110f2d083027f9757;p=platal.git Displays alternate sector names in profile edition. --- diff --git a/htdocs/javascript/profile.js b/htdocs/javascript/profile.js index 01d0069..bfd2059 100644 --- a/htdocs/javascript/profile.js +++ b/htdocs/javascript/profile.js @@ -48,6 +48,7 @@ function wizPage_onLoad(id) 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; } @@ -474,6 +475,14 @@ function updateJobSubSector(id, sel) 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(); diff --git a/modules/profile.php b/modules/profile.php index 7d57cd8..3556ec8 100644 --- a/modules/profile.php +++ b/modules/profile.php @@ -40,6 +40,7 @@ class ProfileModule extends PLModule '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), @@ -517,6 +518,23 @@ class ProfileModule extends PLModule $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'); diff --git a/templates/profile/jobs.alternates.tpl b/templates/profile/jobs.alternates.tpl new file mode 100644 index 0000000..f8b5fb5 --- /dev/null +++ b/templates/profile/jobs.alternates.tpl @@ -0,0 +1,26 @@ +{**************************************************************************} +{* *} +{* 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 *} +{* *} +{**************************************************************************} + + +({$alternates}) + +{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *} diff --git a/templates/profile/jobs.job.tpl b/templates/profile/jobs.job.tpl index 3077711..f1a1d82 100644 --- a/templates/profile/jobs.job.tpl +++ b/templates/profile/jobs.job.tpl @@ -121,7 +121,7 @@ - Secteur d'activité + Secteur d'activité + + + + Fonction occupée diff --git a/templates/profile/jobs.sub_sector.tpl b/templates/profile/jobs.sub_sector.tpl index b3b2106..2415b47 100644 --- a/templates/profile/jobs.sub_sector.tpl +++ b/templates/profile/jobs.sub_sector.tpl @@ -21,7 +21,7 @@ {**************************************************************************} - {iterate from=$subSubSectors item=subSubSector}