#277: Ergonomy of registration
authorx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Mon, 27 Nov 2006 14:40:49 +0000 (14:40 +0000)
committerx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Mon, 27 Nov 2006 14:40:49 +0000 (14:40 +0000)
git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1185 839d8a87-29fc-0310-9880-83ba4fa771e5

12 files changed:
ChangeLog
include/xorg.inc.php
modules/register.php
templates/register/breadcrumb.tpl [new file with mode: 0644]
templates/register/end.tpl
templates/register/step0.tpl
templates/register/step1.tpl
templates/register/step2.tpl
templates/register/step3.tpl
templates/register/step4.tpl
templates/register/success.tpl
templates/skin/register.tpl [new file with mode: 0644]

index a58eff6..b75144b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,11 @@
 ================================================================================
 VERSION 0.9.13                                                        ?? ?? 2007
 
+Bug/Wish:
+
+    * Register:
+        - #277: Improve ergonomy                                           -FRU
+
 From 0.9.12 branch:
 
     * Search:
index 97c8a03..cfeaab3 100644 (file)
@@ -36,9 +36,14 @@ class XorgPage extends PlatalPage
 
     function run()
     {
-        global $globals;
+        global $globals, $platal;
         $this->assign('globals', $globals);
-        $this->_run('skin/'.S::v('skin', 'default.tpl'));
+        if ($platal->path == 'register') {
+            $skin = 'register.tpl';
+        } else {
+            $skin = S::v('skin', 'default.tpl');
+        }
+        $this->_run('skin/' . $skin);
     }
 }
 
index a85bf6c..002b7ef 100644 (file)
@@ -85,8 +85,13 @@ class RegisterModule extends PLModule
             case 1:
                 if (Post::has('promo')) {
                     $promo = Post::i('promo');
-                    if ($promo < 1900 || $promo > date('Y')) {
-                        $err = "La promotion saisie est incorrecte !";
+                    $res = XDB::query("SELECT COUNT(*)
+                                         FROM auth_user_md5
+                                        WHERE  perms='pending' AND deces = '0000-00-00'
+                                               AND promo = {?}",
+                                      $promo);
+                    if (!$res->fetchOneCell()) {
+                        $err = "La promotion saisie est incorrecte ou tous les camardes de cette promo sont inscrits !";
                     } else {
                         $sub_state['step']  = 2;
                         $sub_state['promo'] = $promo;
@@ -177,7 +182,7 @@ class RegisterModule extends PLModule
         }
 
         $_SESSION['sub_state'] = $sub_state;
-        $page->changeTpl('register/step'.intval($sub_state['step']).'.tpl', SIMPLE);
+        $page->changeTpl('register/step'.intval($sub_state['step']).'.tpl');
         if (isset($err)) {
             $page->trig($err);
         }
@@ -193,7 +198,7 @@ class RegisterModule extends PLModule
         global $globals;
 
         $page->changeTpl('register/end.tpl');
-
+        $_SESSION['sub_state'] = array('step' => 5);
         require_once('user.func.inc.php');
 
         if ($hash) {
@@ -308,6 +313,7 @@ class RegisterModule extends PLModule
     {
         $page->changeTpl('register/success.tpl');
 
+        $_SESSION['sub_state'] = array('step' => 5);
         if (Env::has('response2'))  {
             $_SESSION['password'] = $password = Post::v('response2');
 
diff --git a/templates/register/breadcrumb.tpl b/templates/register/breadcrumb.tpl
new file mode 100644 (file)
index 0000000..d27b224
--- /dev/null
@@ -0,0 +1,32 @@
+{**************************************************************************}
+{*                                                                        *}
+{*  Copyright (C) 2003-2006 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               *}
+{*                                                                        *}
+{**************************************************************************}
+
+{assign var="step" value=$smarty.session.sub_state.step}
+<div class="descr center">
+  <strong>Procédure d'inscription :</strong>
+  {if !$step}<span class="erreur">{/if}Charte{if !$step}</span>{/if} »
+  {if $step eq 1 || $step eq 2}<span class="erreur">{/if}Identification{if $step eq 1 || $step eq 2}</span>{/if} »
+  {if $step eq 4 || $step eq 3}<span class="erreur">{/if}Pré-Inscription{if $step eq 4 || $step eq 3}</span>{/if} »
+  {if $step eq 5}<span class="erreur">{/if}Validation{if $step eq 5}</span>{/if}
+</div>
+
+{* vim:set et sw=2 sts=2 sws=2: *}
index d3f98dc..3f1d7b5 100644 (file)
@@ -20,6 +20,8 @@
 {*                                                                        *}
 {**************************************************************************}
 
+{include file="register/breadcrumb.tpl"}
+
 <h1>:'(</h1>
 
 <p class="erreur">
index b0bdc12..7364963 100644 (file)
@@ -20,6 +20,7 @@
 {*                                                                        *}
 {**************************************************************************}
 
+{include file="register/breadcrumb.tpl"}
 
 <h1>Conditions générales</h1>
 
index b325570..44a55e7 100644 (file)
@@ -20,6 +20,8 @@
 {*                                                                        *}
 {**************************************************************************}
 
+{include file="register/breadcrumb.tpl"}
+
 <h1>Identification</h1>
 
 <form action="register" method="post">
index 0029d1a..2050fae 100644 (file)
@@ -20,6 +20,8 @@
 {*                                                                        *}
 {**************************************************************************}
 
+{include file="register/breadcrumb.tpl"}
+
 <h1>Identification</h1>
 
 <p>
@@ -29,6 +31,7 @@
 <form action="register" method="post">
   <table class="bicol" summary="Identification" cellpadding="3">
     {if $smarty.session.sub_state.promo >= 1996}
+    {assign var="promo" value=$smarty.session.sub_state.promo}
     <tr>
       <th colspan="2">matricule</th>
     </tr>
     <tr class="pair">
       <td></td>
       <td>
-        6 chiffres terminant par le numéro d'entrée (ex: 960532 ou 101532)<br />
+        6 chiffres terminant par le numéro d'entrée (ex: 
+        {if $promo < 2000}
+        {math equation="promo % 100" promo=$promo}0532)<br />
+        {else}
+        {math equation="(promo % 100) + 100" promo=$promo}532)<br />
+        {/if}
         Voir sur le GU ou un bulletin de solde pour trouver cette information<br /><br />
-        Pour les élèves étrangers voie 2, il est du type :<br />
-        Promotion: 1996, Matricule: 970XXX - Promotion: 2001, Matricule 102XXX.
+        Pour les élèves étrangers voie 2, il est du type :
+        {if $promo < 1999}
+        {math equation="(promo + 1) % 100" promo=$promo}0XXX
+        {else}
+        {math equation="((promo + 1) % 100) + 100" promo=$promo}XXX
+        {/if}
       </td>
     </tr>
     {/if}
index 016a23c..c6d27d9 100644 (file)
@@ -20,6 +20,7 @@
 {*                                                                        *}
 {**************************************************************************}
 
+{include file="register/breadcrumb.tpl"}
 
 {if $smarty.session.sub_state.forlife}
 
index 8f0aee1..b582f3e 100644 (file)
@@ -20,6 +20,7 @@
 {*                                                                        *}
 {**************************************************************************}
 
+{include file="register/breadcrumb.tpl"}
 
 <h1>Pré-inscription réussie</h1>
 
index 9c63fd6..2b7aca8 100644 (file)
@@ -20,6 +20,8 @@
 {*                                                                        *}
 {**************************************************************************}
 
+{include file="register/breadcrumb.tpl"}
+
 <h1>Bravo !!!</h1>
 
 <p>
diff --git a/templates/skin/register.tpl b/templates/skin/register.tpl
new file mode 100644 (file)
index 0000000..be664cb
--- /dev/null
@@ -0,0 +1,67 @@
+{**************************************************************************}
+{*                                                                        *}
+{*  Copyright (C) 2003-2006 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="iso-8859-15"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <base href="{$globals->baseurl}/" />
+    <link rel="stylesheet" type="text/css" href="css/default.css" media="all" />
+    {include file=skin/common.header.tpl}
+    {include file=skin/common.bandeau.head.tpl}
+  </head>
+  <body>
+    {include file=skin/common.devel.tpl}
+    {if $smarty.session.suid}
+    <table id="suid" cellpadding="0" cellspacing="0">
+      <tr>
+        <td>
+          {$smarty.session.suid} ({$smarty.session.forlife})
+          [<a href="exit">exit</a>]
+        </td>
+      </tr>
+    </table>
+    {/if}
+
+  {if $simple}
+    <div id="content">
+      {include file="skin/common.content.tpl"}
+    </div>
+  {else}
+    {include file=skin/common.bandeau.tpl}
+    <table id="body" cellpadding="0" cellspacing="0">
+      <tr>
+        <td id="body-top">
+          <img src="images/skins/default_headlogo.jpg" alt="[ LOGO ]" style="display: block; float: left;" />
+          <img src="images/skins/default_ban.jpg" alt="[ Polytechnique.org ]" /><br />
+          <img src="images/skins/default_lesX.gif" alt="[LES X SUR LE WEB]" style="padding-top: 0.3em" />
+        </td>
+      </tr>
+      <tr>
+        <td id="content">
+          {include file="skin/common.content.tpl"}
+        </td>
+      </tr>
+    </table>
+  {/if}
+  </body>
+</html>
+{* vim:set et sw=2 sts=2 sws=2: *}