fix a bug in the uri exploder.
authorx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Wed, 5 Jul 2006 06:50:51 +0000 (06:50 +0000)
committerx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Wed, 5 Jul 2006 06:50:51 +0000 (06:50 +0000)
use more semantic uri's in marketing (promo)

fix some typos

don't use gassign, it's broken in our context.

git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@376 839d8a87-29fc-0310-9880-83ba4fa771e5

classes/Platal.php
htdocs/images/24/first-page.png [new file with mode: 0644]
htdocs/images/24/last-page.png [new file with mode: 0644]
htdocs/images/24/next.png [new file with mode: 0644]
htdocs/images/24/previous.png [new file with mode: 0644]
modules/marketing.php
templates/marketing/private.tpl
templates/marketing/promo.tpl

index fe55885..cf888cc 100644 (file)
@@ -34,7 +34,7 @@ class Platal
 
     function Platal()
     {
-        $this->path = Get::_get('p', null);
+        $this->path = trim(Get::_get('p', null), '/');
 
         $this->__mods  = array();
         $this->__hooks = array();
@@ -74,8 +74,12 @@ class Platal
             return PL_NOT_FOUND;
         }
 
-        $args = array_merge(array(&$page),
-            explode('/', substr($this->path, strlen($p) + 1)));
+        $args = explode('/', substr($this->path, strlen($p) + 1));
+        if ($args[0] != '') {
+            array_unshift($args, &$page);
+        } else {
+            $args = array(&$page);
+        }
 
         if ($hook['auth'] > Session::get('auth', AUTH_PUBLIC)) {
             $_SESSION['session']->doAuth($page);
diff --git a/htdocs/images/24/first-page.png b/htdocs/images/24/first-page.png
new file mode 100644 (file)
index 0000000..a253e35
Binary files /dev/null and b/htdocs/images/24/first-page.png differ
diff --git a/htdocs/images/24/last-page.png b/htdocs/images/24/last-page.png
new file mode 100644 (file)
index 0000000..f346c45
Binary files /dev/null and b/htdocs/images/24/last-page.png differ
diff --git a/htdocs/images/24/next.png b/htdocs/images/24/next.png
new file mode 100644 (file)
index 0000000..31256ab
Binary files /dev/null and b/htdocs/images/24/next.png differ
diff --git a/htdocs/images/24/previous.png b/htdocs/images/24/previous.png
new file mode 100644 (file)
index 0000000..eebfcd7
Binary files /dev/null and b/htdocs/images/24/previous.png differ
index 8fbcebc..b26040e 100644 (file)
@@ -96,10 +96,10 @@ class MarketingModule extends PLModule
         if (list($nom, $prenom, $promo, $matricule) = $res->fetchOneRow()) {
             require_once('register.inc.php');
             $matricule_X = get_X_mat($matricule);
-            $page->gassign('nom');
-            $page->gassign('prenom');
-            $page->gassign('promo');
-            $page->gassign('matricule');
+            $page->assign('nom', $nom);
+            $page->assign('prenom', $prenom);
+            $page->assign('promo', $promo);
+            $page->assign('matricule', $matricule);
             $page->assign('matricule_X',$matricule_X);
         } else {
             $page->kill('uid invalide');
@@ -156,8 +156,8 @@ class MarketingModule extends PLModule
         $res = $globals->xdb->query("SELECT date, relance FROM register_pending
                                       WHERE uid = {?}", $uid);
         if (list($pending, $relance) = $res->fetchOneCell()) {
-            $page->gassign('pending');
-            $page->gassign('relance');
+            $page->assign('pending', $pending);
+            $page->assign('relance', $relance);
         }
 
         return PL_OK;
@@ -169,8 +169,8 @@ class MarketingModule extends PLModule
 
         $page->changeTpl('marketing/promo.tpl');
 
-        if (!$promo) {
-            $promo = Env::has('promo') ? Env::getInt('promo') : Session::getInt('promo');
+        if (is_null($promo)) {
+            $promo = Session::getInt('promo');
         }
         $page->assign('promo', $promo);
 
index 0549d73..11fa083 100644 (file)
@@ -96,7 +96,7 @@ sa derni
 </form>
 
 {if $rel_to}
-<form action="{rel}/{$smarty.reqeust.p}" method="post">
+<form action="{rel}/{$smarty.request.p}" method="post">
   <table class="bicol">
     <tr class="pair">
       <th colspan="2">Edition du mail de relance</th>
index 66c4b50..d0d35fc 100644 (file)
 {*                                                                        *}
 {**************************************************************************}
 
-<table style="margin-left: auto; margin-right: auto">
-  <tr>
-    <td>
-      <form action="{rel}/marketing/promo" method="get">
-        <div>
-          <input type="hidden" name="promo" value="{$promo-10}" />
-          <input type="submit" value="&lt;&lt;" />
-        </div>
-      </form>
-    </td>
-    <td>
-      <form action="{rel}/marketing/promo" method="get">
-        <div>
-          <input type="hidden" name="promo" value="{$promo-1}" />
-          <input type="submit" value="&lt;" />
-        </div>
-      </form>
-    </td>
-    <td>
-      <form action="{rel}/marketing/promo" method="get">
-        <div>
-          Promotion : <input type="text" name="promo" value="{$promo}" size="4" maxlength="4" />
-          <input type="submit" value="GO" />
-        </div>
-      </form>
-    </td>
-    <td>
-      <form action="{rel}/marketing/promo" method="get">
-        <div>
-          <input type="hidden" name="promo" value="{$promo+1}" />
-          <input type="submit" value="&gt;" />
-        </div>
-      </form>
-    </td>
-    <td>
-      <form action="{rel}/marketing/promo" method="get">
-        <div>
-          <input type="hidden" name="promo" value="{$promo+10}" />
-          <input type="submit" value="&gt;&gt;" />
-        </div>
-      </form> 
-    </td>
-  </tr>
-</table>
+<form action="{rel}/marketing/promo/" method="post" onsubmit="this.action += this.promo.value">
+  <div class="center">
+    <a href="{rel}/marketing/promo/{$promo-10}" title="-10"><img src="{rel}/images/24/first-page.png" alt="[&lt;&lt;]" /></a>
+    <a href="{rel}/marketing/promo/{$promo-1}" title="-1"><img src="{rel}/images/24/previous.png" alt="[&lt;]" /></a>
+
+    &nbsp;
+    Promo:<input type="text" name="promo" value="{$promo}" size="4" maxlength="4" /><input type="submit" value="GO" />
+    &nbsp;
+
+    <a href="{rel}/marketing/promo/{$promo+1}" title="+1"><img src="{rel}/images/24/next.png" alt="[&gt;]" /></a>
+    <a href="{rel}/marketing/promo/{$promo+10}" title="+10"><img src="{rel}/images/24/last-page.png" alt="[&gt;&gt;]" /></a>
+  </div>
+</form>
 
 <br />
 
@@ -73,6 +42,8 @@
   </a>
 </div>
 
+<br />
+
 <form action="{rel}/marketing/promo" method="post">
   <table class="bicol" summary="liste des inscriptions non confirmées">
     <tr>