Improves educations\'s implementation
authorStéphane Jacob <jacou@melix.net>
Sun, 10 Aug 2008 14:04:13 +0000 (16:04 +0200)
committerStéphane Jacob <jacou@melix.net>
Sun, 10 Aug 2008 20:04:34 +0000 (22:04 +0200)
htdocs/javascript/profile.js
modules/profile/general.inc.php
templates/profile/general.tpl

index dafdeae..3ce7b6a 100644 (file)
@@ -24,10 +24,10 @@ function wizPage_onLoad(id)
 {
     switch (id) {
       case 'general':
-        fillType(document.forms.prof_annu['appli1[type]'], document.forms.prof_annu['appli1[id]'].selectedIndex-1);
-        selectType(document.forms.prof_annu['appli1[type]'], document.forms.prof_annu['appli1_tmp'].value);
-        fillType(document.forms.prof_annu['appli2[type]'], document.forms.prof_annu['appli2[id]'].selectedIndex-1);
-        selectType(document.forms.prof_annu['appli2[type]'], document.forms.prof_annu['appli2_tmp'].value);
+        fillType(document.forms.prof_annu['edu_0[type]'], document.forms.prof_annu['edu_0[id]'].selectedIndex-1);
+        selectType(document.forms.prof_annu['edu_0[type]'], document.forms.prof_annu['edu_0_tmp'].value);
+        fillType(document.forms.prof_annu['edu_1[type]'], document.forms.prof_annu['edu_1[id]'].selectedIndex-1);
+        selectType(document.forms.prof_annu['edu_1[type]'], document.forms.prof_annu['edu_1_tmp'].value);
         break;
       case 'poly':
         updateGroupSubLink(document.forms.prof_annu.groupesx_sub);
index c64f3a3..5d4135e 100644 (file)
@@ -93,7 +93,7 @@ class ProfileAppli implements ProfileSetting
 
     public function save(ProfilePage &$page, $field, $new_value)
     {
-        $index = ($field == 'appli1' ? 0 : 1);
+        $index = ($field == 'edu_0' ? 0 : 1);
         if ($new_value['id'] > 0) {
             XDB::execute("REPLACE INTO  applis_ins
                                    SET  uid = {?}, aid = {?}, type = {?}, ordre = {?}",
@@ -250,11 +250,11 @@ class ProfileGeneral extends ProfilePage
                                   = new ProfileEmailDirectory();
         $this->settings['networking'] = new ProfileNetworking();
         $this->settings['tels'] = new ProfilePhones('user', 0);
-        $this->settings['appli1']
-                                  = $this->settings['appli2']
+        $this->settings['edu_0']
+                                  = $this->settings['edu_1']
                                   = new ProfileAppli();
         $this->watched= array('nom' => true, 'freetext' => true, 'tels' => true,
-                              'networking' => true, 'appli1' => true, 'appli2' => true,
+                              'networking' => true, 'edu_0' => true, 'edu_1' => true,
                               'nationalite' => true, 'nationalite2' => true,
                               'nationalite3' => true, 'nick' => true);
     }
@@ -268,8 +268,8 @@ class ProfileGeneral extends ProfilePage
                                    d.email_directory as email_directory,
                                    q.profile_freetext as freetext, q.profile_freetext_pub as freetext_pub,
                                    q.profile_nick as nick, q.profile_from_ax as synchro_ax, u.matricule_ax,
-                                   IF(a1.aid IS NULL, -1, a1.aid) as appli_id1, a1.type as appli_type1,
-                                   IF(a2.aid IS NULL, -1, a2.aid) as appli_id2, a2.type as appli_type2,
+                                   IF(a1.aid IS NULL, -1, a1.aid) as edu_id1, a1.type as edu_type1,
+                                   IF(a2.aid IS NULL, -1, a2.aid) as edu_id2, a2.type as edu_type2,
                                    n.yourself, n.display AS display_name, n.sort AS sort_name,
                                    n.tooltip AS tooltip_name
                              FROM  auth_user_md5         AS u
@@ -283,14 +283,14 @@ class ProfileGeneral extends ProfilePage
         $this->values = $res->fetchOneAssoc();
 
         // Reformat formation data
-        $this->values['appli1'] = array('id'    => $this->values['appli_id1'],
-                                        'type'  => $this->values['appli_type1']);
-        unset($this->values['appli_id1']);
-        unset($this->values['appli_type1']);
-        $this->values['appli2'] = array('id'    => $this->values['appli_id2'],
-                                        'type'  => $this->values['appli_type2']);
-        unset($this->values['appli_id2']);
-        unset($this->values['appli_type2']);
+        $this->values['edu_0'] = array('id'    => $this->values['edu_id1'],
+                                       'type'  => $this->values['edu_type1']);
+        unset($this->values['edu_id1']);
+        unset($this->values['edu_type1']);
+        $this->values['edu_1'] = array('id'    => $this->values['edu_id2'],
+                                       'type'  => $this->values['edu_type2']);
+        unset($this->values['edu_id2']);
+        unset($this->values['edu_type2']);
 
         // Retreive photo informations
         $res = XDB::query("SELECT  pub
index 90c9356..4804bbf 100644 (file)
       <a href="javascript:delNationality('3');">{icon name=cross title="Supprimer cette nationalité"}</a>
     </td>
   </tr>
-  <tr class="pair">
-    <td>
-      <span class="titre">Application</span><br />
-      <span class="comm">(4e année de l'X)</span>
-    </td>
-    <td>
-      <select name="appli1[id]" onchange="fillType(this.form['appli1[type]'], this.selectedIndex-1);">
-        {applis_options selected=$appli1.id}
-      </select>
-      <br />
-      <input type="hidden" name="appli1_tmp" value="{$appli1.type}" />
-      <select name="appli1[type]">
-        <option value=""></option>
-      </select>
+  <tr>
+    <td colspan="2">
+      <span class="titre">Application</span>
     </td>
+    <td></td>
   </tr>
-  <tr class="pair">
-    <td>
-      <span class="titre">Post-application</span>
-    </td>
-    <td>
-      <select name="appli2[id]" onchange="fillType(this.form['appli2[type]'], this.selectedIndex-1);">
-        {applis_options selected=$appli2.id}
-      </select>
-      <br />
-      <input type="hidden" name="appli2_tmp" value="{$appli2.type}" />
-      <select name="appli2[type]">
-        <option value=""></option>
-      </select>
+  <tr>
+    <!--<td colspan="2">
+      {foreach from=$tels key=telid item=tel}
+        <div id="tels_{$telid}" style="clear: both; padding-top: 4px; padding-bottom: 4px">
+          {include file="profile/phone.tpl" prefname='tels' prefid='tels' telid=$telid tel=$tel}
+        </div>
+      {/foreach}
+      {if $tels|@count eq 0}
+        <div id="tels_0" style="clear: both; padding-top: 4px; padding-bottom: 4px">
+          {include file="profile/phone.tpl" prefname='tels' preid='tels' telid=0 tel=0}
+        </div>
+      {/if}
+      <div id="tels_add" class="center" style="clear: both; padding-top: 4px;">
+        <a href="javascript:addTel('tels', 'tels');">
+          {icon name=add title="Ajouter un téléphone"}Ajouter un téléphone
+        </a>
+      </div>
+    </td>-->
+    <td colspan="2">
+      <!--{foreach from=$edus key=eduid item=edu}
+        <div id="edus_{$eduid}" style="clear: both; padding-top: 4px; padding-bottom: 4px">
+          {include file="profile/phone.tpl" prefname='edus' prefid='edus' eduid=$eduid edu=$edu}
+        </div>
+      {/foreach}
+      {if $edus|@count eq 0}
+        <div id="edus_0" style="clear: both; padding-top: 4px; padding-bottom: 4px">
+          {include file="profile/phone.tpl" prefname='edus' preid='edus' eduid=0 edu=0}
+        </div>
+      {/if}-->
+        <div id="edus_0" style="clear: both; padding-top: 4px; padding-bottom: 4px">
+          {include file="profile/edu.tpl" eduid=0 edus=$edu_0}
+        </div>
+        <div id="edus_1" style="clear: both; padding-top: 4px; padding-bottom: 4px">
+          {include file="profile/edu.tpl" eduid=1 edus=$edu_1}
+        </div>
+
+      <div id="edus_add" class="center" style="clear: both; padding-top: 4px;">
+        <a href="javascript:addEdu('edus', 'edus');">
+          {icon name=add title="Ajouter une formation"}Ajouter une formation
+        </a>
+      </div>
     </td>
   </tr>
   <tr class="pair">