#468: can edit nl, events and payment requests before validation
authorx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Wed, 27 Sep 2006 13:57:31 +0000 (13:57 +0000)
committerx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Wed, 27 Sep 2006 13:57:31 +0000 (13:57 +0000)
git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@918 839d8a87-29fc-0310-9880-83ba4fa771e5

ChangeLog
include/validations.inc.php
include/validations/evts.inc.php
include/validations/nl.inc.php
include/validations/paiements.inc.php
templates/admin/valider.tpl
templates/include/form.valid.edit-evts.tpl [new file with mode: 0644]
templates/include/form.valid.edit-nl.tpl [new file with mode: 0644]
templates/include/form.valid.edit-paiements.tpl [new file with mode: 0644]
templates/include/form.valid.evts.tpl

index f3a8b85..a60352a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,12 @@
 ================================================================================
-VERSION 0.9.11                                                        ?? ?? 2006
+VERSION 0.9.12                                                        ?? ?? 2006
 
-From 0.9.10 branch:
+Bug/Wish:
+
+    * Admin:
+        - #468: Can edit requests before validation                        -FRU
+
+From 0.9.11 branch:
 
     * Payment:
         - #482: fix action in the form.                                     -MC
index b3dddb1..4415ebc 100644 (file)
@@ -67,6 +67,7 @@ class Validate
     var $unique;
     // enable the refuse button
     var $refuse = true;
+    
     var $type;
     var $comments = Array();
     // the validations rules : comments for admins
@@ -156,6 +157,16 @@ class Validate
             return true;
         }
 
+        // mise à jour des informations
+        if (Env::has('edit')) {
+            if ($this->handle_editor()) {
+                $this->update();
+                $this->trig('requête mise à jour');
+                return true;
+            }
+            return false;
+        }
+
         // ajout d'un commentaire
         if (Env::has('hold') && Env::has('comm')) {
             $formid = Env::i('formid');
@@ -300,6 +311,13 @@ class Validate
     { return null; }
 
     // }}}
+    // {{{ function editor()
+
+    /** nom du formulaire d'édition */
+    function editor()
+    { return null; }
+
+    // }}}
     // {{{ function answers()
 
     /** automatic answers table for this type of validation */
index 3d7f5fc..01c5658 100644 (file)
@@ -53,6 +53,25 @@ class EvtReq extends Validate
     { return 'include/form.valid.evts.tpl'; }
 
     // }}}
+    // {{{ functon editor()
+
+    function editor()
+    { return 'include/form.valid.edit-evts.tpl'; }
+
+    // }}}
+    // {{{ function handle_editor()
+
+    function handle_editor()
+    {
+        $this->titre      = Env::v('titre');
+        $this->texte      = Env::v('texte');
+        $this->pmin       = Env::i('promo_min');
+        $this->pmax       = Env::i('promo_max');
+        $this->peremption = Env::v('peremption');
+        return true;
+    }
+
+    // }}}
     // {{{ function _mail_subj
     
     function _mail_subj()
index bd27e71..447c199 100644 (file)
@@ -47,6 +47,25 @@ class NLReq extends Validate
     }
 
     // }}}
+    // {{{ function editor()
+
+    function editor()
+    {
+        return 'include/form.valid.edit-nl.tpl';
+    }
+
+    // }}}
+    // {{{ function handle_editor()
+
+    function handle_editor()
+    {
+        $this->art->_body   = Env::v('nl_body');
+        $this->art->_title  = Env::v('nl_title');
+        $this->art->_append = Env::v('nl_append');
+        return true;
+    }
+
+    // }}}
     // {{{ function _mail_subj
     
     function _mail_subj()
index 4bb591b..02f1cbe 100644 (file)
@@ -94,6 +94,28 @@ class PayReq extends Validate
     { return 'include/form.valid.paiements.tpl'; }
 
     // }}}
+    // {{{ function editor()
+
+    function editor()
+    {
+        return 'include/form.valid.edit-paiements.tpl';
+    }
+
+    // }}}
+    // {{{ function handle_editor()
+
+    function handle_editor()
+    {
+        $this->titre       = Env::v('pay_titre');
+        $this->site        = Env::v('pay_site');
+        $this->montant     = Env::i('pay_montant');
+        $this->montant_min = Env::i('pay_montant_min');
+        $this->montant_max = Env::i('pay_montant_max');
+        $this->msg_reponse = Env::v('pay_msg_reponse');
+        return true;
+    }
+
+    // }}}
     // {{{ function _mail_subj
 
     function _mail_subj()
index 6e3cef7..15ecd4d 100644 (file)
     </td>
   </tr>
   {include file=$valid->formu()}
+  {if $valid->editor()}
+  <tr>
+    <td colspan="2" class="center">
+      <form action="admin/validate" method="post">
+        <div>
+          {include file=$valid->editor()}
+          <input type="hidden" name="uid"    value="{$valid->uid}" />
+          <input type="hidden" name="type"   value="{$valid->type}" />
+          <input type="hidden" name="stamp"  value="{$valid->stamp}" />
+          <br />
+          <input type="submit" name="edit"   value="Editer" />
+        </div>
+      </form>
+    </td>
+  </tr>
+  {/if}
   <tr><th colspan='2'>Commentaires</th></tr>
   {foreach from=$valid->comments item=c}
   <tr class="{cycle values="impair,pair"}">
diff --git a/templates/include/form.valid.edit-evts.tpl b/templates/include/form.valid.edit-evts.tpl
new file mode 100644 (file)
index 0000000..8b1f8ce
--- /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               *}
+{*                                                                        *}
+{**************************************************************************}
+
+<input type="text" name="titre" size="50" maxlength="200" value="{$valid->titre}" />
+<br />
+<textarea rows="10" cols="60" name="texte">{$valid->texte}</textarea>
+<br />
+<strong>Péremption&nbsp;:</strong> <input type="text" name="peremption" size="10" value="{$valid->peremption}" />
+<strong>Promos&nbsp;:&nbsp;</strong>
+min <input type="text" name="promo_min" size="4" maxlength="4" value="{$valid->pmin}" />
+&nbsp;->&nbsp;max <input type="text" name="promo_max" size="4" maxlength="4" value="{$valid->pmax}" />
+
+{* vim:set et sw=2 sts=2 sws=2: *}
diff --git a/templates/include/form.valid.edit-nl.tpl b/templates/include/form.valid.edit-nl.tpl
new file mode 100644 (file)
index 0000000..07300a7
--- /dev/null
@@ -0,0 +1,29 @@
+{**************************************************************************}
+{*                                                                        *}
+{*  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               *}
+{*                                                                        *}
+{**************************************************************************}
+
+<input type="text" name="nl_title" size="50" maxlength="200" value="{$valid->art->_title}" />
+<br />
+<textarea rows="10" cols="60" name="nl_body">{$valid->art->_body}</textarea>
+<br />
+<textarea rows="3" cols="60" name="nl_append">{$valid->art->_append}</textarea>
+
+{* vim:set et sw=2 sts=2 sws=2: *}
diff --git a/templates/include/form.valid.edit-paiements.tpl b/templates/include/form.valid.edit-paiements.tpl
new file mode 100644 (file)
index 0000000..90d27af
--- /dev/null
@@ -0,0 +1,33 @@
+{**************************************************************************}
+{*                                                                        *}
+{*  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               *}
+{*                                                                        *}
+{**************************************************************************}
+
+<input type="text" name="pay_titre" size="50" maxlength="200" value="{$valid->titre}" />
+<br />
+<textarea rows="10" cols="60" name="pay_msg_reponse">{$valid->msg_reponse}</textarea>
+<br />
+<strong>Site&nbsp;:</strong> <input type="text" name="pay_site" size="45" value="{$valid->site}" />
+<br>
+<strong>Montant&nbsp;:</strong> <input type="text" name="pay_montant" size="5" value="{$valid->montant}" /> 
+(min <input type="text" name="pay_montant_min" size="5" value="{$valid->montant_min}" />
+&nbsp;->&nbsp; max <input type="text" name="pay_montant_max" size="5" value="{$valid->montant_max}" />)
+
+{* vim:set et sw=2 sts=2 sws=2: *}
index ab5b13c..e620e6b 100644 (file)
 {**************************************************************************}
 
 
-<tr class="impair">
+<tr class="pair">
   <td class="titre">Titre</td>
   <td>{$valid->titre}</td>
 </tr>
-<tr class="impair">
+<tr class="pair">
   <td class="titre">Texte</td>
   <td>{$valid->texte|nl2br}</td>
 </tr>
-<tr class="impair">
+<tr class="pair">
   <td class="titre">Péremption</td>
   <td>{$valid->peremption|date_format}</td>
 </tr>
-<tr class="impair">
+<tr class="pair">
   <td class="titre">Promos</td>
   <td>{$valid->pmin} - {$valid->pmax}</td>
 </tr>
-<tr class="impair">
+<tr class="pair">
   <td class="titre">Commentaire</td>
   <td>{$valid->comment}</td>
 </tr>