Working HTML part of the job tab
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Sat, 8 Sep 2007 18:35:10 +0000 (20:35 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Sat, 8 Sep 2007 18:35:10 +0000 (20:35 +0200)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
include/fonction.emploi.inc.php [deleted file]
include/secteur.emploi.inc.php [deleted file]
modules/profile.php
modules/profile/jobs.inc.php
templates/include/flags.radio.tpl
templates/profile/adresses.address.tpl
templates/profile/base.tpl
templates/profile/jobs.job.tpl
templates/profile/jobs.secteur.tpl [new file with mode: 0644]
templates/profile/jobs.tpl

diff --git a/include/fonction.emploi.inc.php b/include/fonction.emploi.inc.php
deleted file mode 100644 (file)
index ee67115..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2007 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                *
- ***************************************************************************/
-
-function select_fonction($fonction){
-    $html = "<option value='' ". (($fonction == '0')?"selected='selected'":"") .">&nbsp;</option>\n";
-
-    $res = XDB::iterRow("SELECT id, fonction_fr, FIND_IN_SET('titre', flags) from fonctions_def ORDER BY id");
-    while(list($fid, $flabel, $ftitre) = $res->next()){
-       if($ftitre)
-           $html.= "<option value='$fid' " . (($fonction == $fid)?"selected='selected'":"") . ">$flabel</option>\n";
-       else
-           $html .= "<option value=\"$fid\" " . (($fonction == $fid)?"selected='selected'":"") . ">* $flabel</option>\n";
-    }
-    return $html;
-}
-
-function _select_fonction_smarty($params){
-    return select_fonction($params['fonction']);
-}
-
-$page->register_function('select_fonction', '_select_fonction_smarty');
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
diff --git a/include/secteur.emploi.inc.php b/include/secteur.emploi.inc.php
deleted file mode 100644 (file)
index 4f2d48b..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2007 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                *
- ***************************************************************************/
-
-
-function select_secteur($secteur){
-    if ($secteur == '') {
-        $secteur = -1;
-    }
-    $html = "<option value=\"\" ". (($secteur == '')?"selected='selected'":"") .">&nbsp;</option>\n";
-    $res  = XDB::iterRow("SELECT id, label FROM emploi_secteur");
-    while (list($tmp_id, $tmp_label) = $res->next()) {
-       $html .= "<option value=\"$tmp_id\" " . (($secteur == $tmp_id)?"selected='selected'":"") . ">$tmp_label</option>\n";
-    }
-    return $html;
-}
-
-function select_ss_secteur($secteur,$ss_secteur){
-    if ($secteur) {
-       $html = "<option value=\"\">&nbsp;</option>\n";
-       $res  = XDB::iterRow("SELECT id, label FROM emploi_ss_secteur WHERE secteur = {?}", $secteur);
-       while (list($tmp_id, $tmp_label) = $res->next()){
-           $html .= "<option value=\"$tmp_id\" ". (($ss_secteur == $tmp_id)?"selected='selected'":"") .">$tmp_label</option>\n";
-       }
-       return $html;
-    }
-    else{
-       return "<option value=\"\" selected='selected'>&nbsp;</option>\n";
-    }
-}
-
-//fonctions pour smarty
-function _select_secteur_smarty($params){
-    return select_secteur($params['secteur']);
-}
-
-function _select_ss_secteur_smarty($params){
-    return select_ss_secteur($params['secteur'], $params['ss_secteur']);
-}
-$page->register_function('select_secteur', '_select_secteur_smarty');
-$page->register_function('select_ss_secteur', '_select_ss_secteur_smarty');
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
index 2e4d29e..ccbd047 100644 (file)
@@ -33,8 +33,10 @@ class ProfileModule extends PLModule
             'profile/ax'       => $this->make_hook('ax',         AUTH_COOKIE, 'admin'),
             'profile/edit'     => $this->make_hook('p_edit',     AUTH_MDP),
             'profile/ajax/address' => $this->make_hook('ajax_address', AUTH_COOKIE, 'user', NO_AUTH),
-            'profile/ajax/tel'     => $this->make_hook('ajax_tel', AUTH_COOKIE, 'user', NO_AUTH),
-            'profile/ajax/medal'   => $this->make_hook('ajax_medal', AUTH_COOKIE, 'user', NO_AUTH),
+            'profile/ajax/tel'     => $this->make_hook('ajax_tel',     AUTH_COOKIE, 'user', NO_AUTH),
+            'profile/ajax/medal'   => $this->make_hook('ajax_medal',   AUTH_COOKIE, 'user', NO_AUTH),
+            'profile/ajax/job'     => $this->make_hook('ajax_job',     AUTH_COOKIE, 'user', NO_AUTH),
+            'profile/ajax/secteur' => $this->make_hook('ajax_secteur', AUTH_COOKIE, 'user', NO_AUTH),
             'profile/medal'    => $this->make_hook('medal', AUTH_PUBLIC),
             'profile/orange'   => $this->make_hook('p_orange',   AUTH_MDP),
             'profile/usage'    => $this->make_hook('p_usage',    AUTH_MDP),
@@ -371,6 +373,26 @@ class ProfileModule extends PLModule
         $page->assign('ajaxdeco', true);
     }
 
+    function handler_ajax_job(&$page, $id)
+    {
+        $page->changeTpl('profile/jobs.job.tpl', NO_SKIN);
+        $page->assign('i', $id);
+        $page->assign('job', array());
+        $page->assign('ajaxjob', true);
+        $page->assign('new', true);
+    }
+
+    function handler_ajax_secteur(&$page, $id, $sect, $ssect = -1)
+    {
+        $res = XDB::iterator("SELECT  id, label
+                                FROM  emploi_ss_secteur
+                               WHERE  secteur = {?}", $sect);
+        $page->changeTpl('profile/jobs.secteur.tpl', NO_SKIN);
+        $page->assign('id', $id);
+        $page->assign('ssecteurs', $res);
+        $page->assign('sel', $ssect);
+    }
+
     function handler_p_orange(&$page)
     {
         $page->changeTpl('profile/orange.tpl');
index 40628ee..05e538c 100644 (file)
@@ -27,6 +27,16 @@ class ProfileJobs extends ProfilePage
     {
         parent::__construct($wiz);
     }
+
+    public function prepare(PlatalPage &$page)
+    {
+        parent::prepare($page);
+        $page->assign('secteurs', XDB::iterator("SELECT  id, label
+                                                   FROM  emploi_secteur"));
+        $page->assign('fonctions', XDB::iterator("SELECT  id, fonction_fr, FIND_IN_SET('titre', flags) AS title
+                                                    FROM  fonctions_def
+                                                ORDER BY  id"));
+    }
 }
 
 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
index 8b59d1d..1c21d20 100644 (file)
 {**************************************************************************}
 {if $display eq "mini"}
 <td class="vert">
-  <input type="radio" name="{$name}" value="public" {if $val eq 'public'}checked="checked"{/if} />
+  <input type="radio" name="{$name}" value="public" {if $val eq 'public'}checked="checked"{/if}
+         {if $disabled}disabled="disabled"{/if} />
 </td>
 <td class="orange">
-  <input type="radio" name="{$name}" value="ax" {if $val eq 'ax'}checked="checked"{/if} />
+  <input type="radio" name="{$name}" value="ax" {if $val eq 'ax'}checked="checked"{/if}
+         {if $disabled}disabled="disabled"{/if}/>
 </td>
 <td class="rouge">
-  <input type="radio" name="{$name}" value="private" {if $val eq 'private' || !$val}checked="checked"{/if} />
+  <input type="radio" name="{$name}" value="private" {if $val eq 'private' || (!$val && !$disabled)}checked="checked"{/if}
+         {if $disabled}disabled="disabled"{/if}/>
 </td>
 {elseif $display eq "div"}
 <span class="vert">
-  <input type="radio" name="{$name}" value="public" {if $val eq 'public'}checked="checked"{/if} />
+  <input type="radio" name="{$name}" value="public" {if $val eq 'public'}checked="checked"{/if}
+         {if $disabled}disabled="disabled"{/if}/>
 </span>
 <span class="orange">
-  <input type="radio" name="{$name}" value="ax" {if $val eq 'ax'}checked="checked"{/if} />
+  <input type="radio" name="{$name}" value="ax" {if $val eq 'ax'}checked="checked"{/if}
+         {if $disabled}disabled="disabled"{/if}/>
 </span>
 <span class="rouge">
-  <input type="radio" name="{$name}" value="private" {if $val eq 'private' || !$val}checked="checked"{/if} />
+  <input type="radio" name="{$name}" value="private" {if $val eq 'private' || (!$val && !$disabled)}checked="checked"{/if}
+         {if $disabled}disabled="disabled"{/if}/>
 </span>
 {else}
   {if !$notable}
         <table class="flags" summary="Flags" cellpadding="0" cellspacing="0">
           <tr>
             <td class="vert">
-              <input type="radio" name="{$name}" value="public" {if $val eq 'public'}checked="checked"{/if} />
+              <input type="radio" name="{$name}" value="public" {if $val eq 'public'}checked="checked"{/if}
+                     {if $disabled}disabled="disabled"{/if} />
             </td>
             <td class="texte">
               site public
             </td>
             <td class="orange">
-              <input type="radio" name="{$name}" value="ax" {if $val eq 'ax'}checked="checked"{/if} />
+              <input type="radio" name="{$name}" value="ax" {if $val eq 'ax'}checked="checked"{/if}
+                     {if $disabled}disabled="disabled"{/if}/>
             </td>
             <td class="texte">
               transmis à l'AX
             </td>
             <td class="rouge">
-              <input type="radio" name="{$name}" value="private" {if $val eq 'private' || !$val}checked="checked"{/if} />
+              <input type="radio" name="{$name}" value="private" {if $val eq 'private' || (!$val && !$disabled)}checked="checked"{/if}
+                     {if $disabled}disabled="disabled"{/if} />
             </td>
             <td class="texte">
               privé
index 2f58968..1ae3caa 100644 (file)
@@ -53,8 +53,8 @@
   </tr>
   <tr>
     <td>
-      <div style="margin-bottom: 0.2em">
-        {include file="include/flags.radio.tpl" name="`$adpref`[pub]" notable=true val=$adr.pub}
+      <div style="margin-bottom: 0.2em" class="flags">
+        {include file="include/flags.radio.tpl" name="`$adpref`[pub]" notable=true val=$adr.pub display="div"}
       </div>
       <div style="clear: both"></div>
       <div style="float: left">{include file="geoloc/form.address.tpl" name=$adpref id=$adid adr=$adr}</div>
index 6be0a17..addb55b 100644 (file)
 
 <form action="{$wiz_baseurl}/{$lookup[$current]}" method="post" id="prof_annu">
   <div>
+    {icon name=information title="Voir ma fiche"} Tu peux consulter ta fiche telle que la
+    voient <a class="popup2" href="profile/{$smarty.session.forlife}">les X</a>,
+    <a class="popup2" href="profile/{$smarty.session.forlife}?view=ax">l'AX</a> ou
+    <a class="popup2" href="profile/{$smarty.session.forlife}?view=public">n'importe quel internaute</a>.
+    {include file="include/flags.radio.tpl" notable=true disabled=true name="profile_ex_pub"}
+  </div>
+  <div style="margin-top: 1em">
     {include file=$profile_page}
   </div>
   <div style="clear: both" class="center">
index 5ad21be..bfdb471 100644 (file)
 {*                                                                        *}
 {**************************************************************************}
 
+{if $ajaxjob}
+<?xml version="1.0" encoding="utf-8"?>
+{/if}
 {assign var=jobid value="job_`$i`"}
 {assign var=jobpref value="job[`$i`]"}
-<table class="bicol" cellspacing="0" cellpadding="0" summary="Entreprise n°{$i+1}">
-  <tr>
-    <th colspan="2" style="text-align: right">
-      <div class="flags" style="float: left; text-align: left">
-        {include file="include/flags.radio.tpl" notable=true display="div" name="`$jobpref`[pub]" value=$job.pub}
-      </div>
-      Entreprise n°{$i+1}&nbsp;:
-      <input type="text" size="35" maxlength="100" name="{$jobpref}[name]" value="{$job.name}" />
-    </th>
-  </tr>
-  <tr>
-    <td class="titre">Page Web</td>
-    <td><input type="text" size="35" maxlength="255" name="{$jobpref}[web]" value="{$job.web}" /></td>
-  </tr>
-  <tr>
-    <td class="titre">Secteur d'activité</td>
-    <td>
-      <select name="{$jobpref}[secteur]" onchange="this.form.submit();">
-        {select_secteur secteur=$job.secteur}
-      </select>
-    </td>
-  </tr>
-  <tr>
-    <td class="titre">Sous-Secteur d'activité</td>
-    <td>
-      <select name="{$jobpref}[ss_secteur]">
-        {select_ss_secteur secteur=$job.secteur ss_secteur=$job.ss_secteur}
-      </select>
-    </td> 
-  </tr>
-  <tr>
-    <td class="titre">Poste occupé</td>
-    <td>
-      <input type="text" size="35" maxlength="120" name="{$jobpref}[poste]" value="{$job.poste}" />
-    </td>
-  </tr>
-  <tr>
-    <td class="titre">Fonction occupée</td>
-    <td>
-      <select name="{$jobpref}[fonction]">
-        {select_fonction fonction=$job.fonction}
-      </select>
-    </td>
-  </tr>
-  <tr class="pair">
-    <td colspan="2">
-      <div style="float: left">
-        <div class="flags" style="float: right">
-          {include file="include/flags.radio.tpl" name="`$jobpref`[adr][pub]" val=$job.adr.pub display="div"}
+<div id="{$jobid}">
+  <input type="hidden" name="{$jobpref}[removed]" value="0" />
+  <input type="hidden" name="{$jobpref}[new]" value="{if $new}1{else}0{/if}" />
+  <table id="{$jobid}_grayed" class="bicol" style="display: none; margin-bottom: 1em">
+    <tr>
+      <th class="grayed">
+        <div style="float: right">
+          <a href="javascript:restoreJob('{$jobid}', '{$jobpref}')">{icon name=arrow_refresh title="Restaure l'emploi"}</a>
         </div>
-        <div class="titre">Adresse</div>
-        <div style="margin-top: 20px; clear: both">
-          {include file="geoloc/form.address.tpl" name="`$jobpref`[adr]" id="`$jobpref`_adr" adr=$job.adr}
+        Restaurer l'entreprise n°{$i+1}&nbsp;:<span id="{$jobid}_grayed_name"></span>
+      </th>
+    </tr>
+  </table>
+  <table id="{$jobid}_cont" class="bicol" summary="Entreprise n°{$i+1}" style="margin-bottom: 1em">
+    <tr>
+      <th colspan="2" style="text-align: right">
+        <div class="flags" style="float: left; text-align: left">
+          {include file="include/flags.radio.tpl" notable=true display="div" name="`$jobpref`[pub]" value=$job.pub}
         </div>
-      </div>
-      <div style="float: right; width: 50%">
-        <div class="flags" style="float: right">
-          {include file="include/flags.radio.tpl" name="`$jobpref`[tel_pub]" val=$job.tel_pub display="div"}
+        Entreprise n°{$i+1}&nbsp;:
+        <input type="text" size="35" maxlength="100" name="{$jobpref}[name]" value="{$job.name}" />
+        <a href="javascript:removeJob('{$jobid}', '{$jobpref}')">
+          {icon name=cross title="Supprimer cet emploi"}
+        </a>
+      </th>
+    </tr>
+    <tr>
+      <td class="titre">Page Web</td>
+      <td><input type="text" size="35" maxlength="255" name="{$jobpref}[web]" value="{$job.web}" /></td>
+    </tr>
+    <tr>
+      <td class="titre">Secteur d'activité</td>
+      <td>
+        <select name="{$jobpref}[secteur]" onchange="updateSecteur({$i}, '{$jobid}', '{$jobpref}', ''); return true;">
+          <option value="">&nbsp;</option>
+          {iterate from=$secteurs item=secteur}
+          <option value="{$secteur.id}" {if $secteur.id eq $job.secteur}selected="selected"{/if}>
+            {$secteur.label}
+          </option>
+          {/iterate}
+        </select>
+      </td>
+    </tr>
+    <tr>
+      <td class="titre">Sous-Secteur d'activité</td>
+      <td id="{$jobid}_ss_secteur">
+      </td> 
+    </tr>
+    <tr>
+      <td class="titre">Poste occupé</td>
+      <td>
+        <input type="text" size="35" maxlength="120" name="{$jobpref}[poste]" value="{$job.poste}" />
+      </td>
+    </tr>
+    <tr>
+      <td class="titre">Fonction occupée</td>
+      <td id=>
+        <select name="{$jobpref}[fonction]">
+          <option value="">&nbsp;</option>
+          {assign var=ingroup value=false}
+          {iterate from=$fonctions item=fonct}
+          {if $fonct.title}
+            {if $ingroup}</optgroup>{/if}
+            <optgroup label="{$fonct.fonction_fr}">
+            {assign var=ingroup value=true}
+          {/if}
+          <option value="{$fonct.id}" {if $fonct.id eq $job.fonction}selected="selected"{/if}>
+            {$fonct.fonction_fr}
+          </option>
+          {/iterate}
+          {if $ingroup}</optgroup>{/if}
+        </select>
+      </td>
+    </tr>
+    <tr class="pair">
+      <td colspan="2">
+        <span class="titre">E-mail professionnel&nbsp;:</span>
+        <input type="text" size="30" maxlength="60" name="{$jobpref}[email]" value="{$job.email}" />
+        <span class="flags">
+          {include file="include/flags.radio.tpl" name="`$jobpref`[email_pub]" val=$job.mail_pub display="div"}
+        </span>
+      </td>
+    </tr>
+    <tr class="pair">
+      <td colspan="2">
+        <div style="float: left">
+          <div class="titre">Adresse</div>
+          <div class="flags">
+            {include file="include/flags.radio.tpl" name="`$jobpref`[adr][pub]" val=$job.adr.pub display="div"}
+          </div>
+          <div style="margin-top: 20px; clear: both">
+            {include file="geoloc/form.address.tpl" name="`$jobpref`[adr]" id="`$jobpref`_adr" adr=$job.adr}
+          </div>
         </div>
-        <span class="titre">Téléphone</span>
-        <table style="clear: both">
-          <tr>
-            <td>Bureau&nbsp;:</td>
-            <td><input type="text" size="18" maxlength="18" name="{$jobpref}[tel_office]" value="{$job.tel_office}" /></td>
-          </tr>
-          <tr>
-            <td>Fax&nbsp;:</td>
-            <td><input type="text" size="18" maxlength="18" name="{$jobpref}[tel_fax]" value="{$job.tel_fax}" /></td>
-          </tr>
-          <tr>
-            <td>Mobile&nbsp;:</td>
-            <td><input type="text" size="18" maxlength="18" name="{$jobpref}[tel_mobile]" value="{$job.tel_mobile}" /></td>
-          </tr>
-        </table>
-      </div>
-    </td>
-  </tr>
-  <tr class="pair">
-    <td colspan="2">
-      <div class="flags" style="float: right">
-        {include file="include/flags.radio.tpl" name="`$jobpref`[email_pub]" val=$job.mail_pub display="div"}
-      </div>
-      <span class="titre">E-mail&nbsp;:</span>
-      <input type="text" size="30" maxlength="60" name="{$jobpref}[email]" value="{$job.email}" />
-    </td>
-  </tr>
-</table>
+        <div style="float: right; width: 50%">
+          <div class="titre">Téléphone</div>
+          <div class="flags">
+            {include file="include/flags.radio.tpl" name="`$jobpref`[tel_pub]" val=$job.tel_pub display="div"}
+          </div>
+          <table style="clear: both">
+            <tr>
+              <td>Bureau&nbsp;:</td>
+              <td><input type="text" size="18" maxlength="18" name="{$jobpref}[tel_office]" value="{$job.tel_office}" /></td>
+            </tr>
+            <tr>
+              <td>Fax&nbsp;:</td>
+              <td><input type="text" size="18" maxlength="18" name="{$jobpref}[tel_fax]" value="{$job.tel_fax}" /></td>
+            </tr>
+            <tr>
+              <td>Mobile&nbsp;:</td>
+              <td><input type="text" size="18" maxlength="18" name="{$jobpref}[tel_mobile]" value="{$job.tel_mobile}" /></td>
+            </tr>
+          </table>
+        </div>
+      </td>
+    </tr>
+  </table>
+</div>
 
 {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
diff --git a/templates/profile/jobs.secteur.tpl b/templates/profile/jobs.secteur.tpl
new file mode 100644 (file)
index 0000000..5af83dd
--- /dev/null
@@ -0,0 +1,31 @@
+{**************************************************************************}
+{*                                                                        *}
+{*  Copyright (C) 2003-2007 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"?>
+<select name="job[{$id}][ss_secteur]">
+  <option value=""></option>
+  {iterate from=$ssecteurs item=ssecteur}
+  <option value="{$ssecteur.id}" {if $ssecteur.id eq $sel}selected="selected"{/if}>{$ssecteur.label}</option>
+  {/iterate}
+</select>
+
+{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
index 69022ff..f0bfd77 100644 (file)
 {*                                                                        *}
 {**************************************************************************}
 
+<script type="text/javascript">//<![CDATA[
+{literal}
+
+function removeJob(id, pref)
+{
+  document.getElementById(id + '_cont').style.display = 'none';
+  if (document.forms.prof_annu[pref + '[new]'].value == '0') {
+    document.getElementById(id + '_grayed').style.display = '';
+    document.getElementById(id + '_grayed_name').innerHTML =
+      document.forms.prof_annu[pref + "[name]"].value.replace('<', '&lt;');
+  }
+  document.forms.prof_annu[pref + "[removed]"].value = "1";
+}
+
+function restoreJob(id, pref)
+{
+  document.getElementById(id + '_cont').style.display = '';
+  document.getElementById(id + '_grayed').style.display = 'none';
+  document.forms.prof_annu[pref + "[removed]"].value = "0";
+}
+
+function updateSecteur(nb, id, pref, sel)
+{
+  var secteur = document.forms.prof_annu[pref + '[secteur]'].value;
+  if (secteur == '') {
+    secteur = '-1';
+  }
+  Ajax.update_html(id + '_ss_secteur', 'profile/ajax/secteur/' +nb + '/' + secteur + '/' + sel);
+}
+
+function makeAddJob(id)
+{
+  return function(data)
+         {
+           $('#add_job').before(data);
+           updateSecteur('job_' + id, 'job[' + id + ']', '');
+         };
+}
+
+function addJob()
+{
+  var i = 0;
+  while (document.getElementById('job_' + i) != null) {
+    ++i;
+  }
+  $.get(platal_baseurl + 'profile/ajax/job/' + i, makeAddJob(i));
+}
+
+{/literal}
+//]]></script>
 
 {foreach from=$entreprises item=job key=i}
-<div id="{"job_`$i`_cont"}">
-{include file="profile/jobs.job.tpl" i=$i job=$job}
-</div>
+{include file="profile/jobs.job.tpl" i=$i job=$job new=false}
+<script type="text/javascript">updateSecteur({$i}, '{"job_`$i`"}', '{"job[`$i`]"}', '{$job.ss_secteur}');</script>
 {/foreach}
 {if $jobs|@count eq 0}
-<div id="job_0_cont">
-{include file="profile/jobs.job.tpl" i=0 job=0}
-</div>
+{include file="profile/jobs.job.tpl" i=0 job=0 new=true}
+<script type="text/javascript">updateSecteur(0, 'job_0', 'job[0]', '-1');</script></script>
 {/if}
 
 <div id="add_job" class="center">
   </a>
 </div>
 
-<table class="bicol" summary="CV">
+<table class="bicol" summary="CV" style="margin-top: 1.5em">
   <tr>
     <th>
-      Informations professionnelles - CV
+      Curriculum vitae
     </th>
   </tr>
   <tr>
     <td>
       <div style="float: left; width: 25%">
-        <div class="titre">Curriculum vitae&nbsp;:</div>
         <div class="flags">
           <span class="rouge"><input type="checkbox" name="accesCV" checked="checked" disabled="disabled" /></span>
           <span class="texte">privé</span>