From e18888f4f83f8c64aa6520dfbfb3710463d6dfc2 Mon Sep 17 00:00:00 2001 From: x2001corpet Date: Sun, 30 Jul 2006 09:44:43 +0000 Subject: [PATCH] =?utf8?q?#427,=20avoir=20des=20commentaires=20de=20r?= =?utf8?q?=C3=A9ponses=20par=20d=C3=A9faut=20dans=20la=20validation?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@706 839d8a87-29fc-0310-9880-83ba4fa771e5 --- ChangeLog | 19 ++++++++++--------- include/validations.inc.php | 13 +++++++++++++ modules/admin.php | 11 +++++++++++ templates/admin/valider.tpl | 12 +++++++++++- upgrade/0.9.11/06_validations.sql | 6 ++++++ 5 files changed, 51 insertions(+), 10 deletions(-) create mode 100644 upgrade/0.9.11/06_validations.sql diff --git a/ChangeLog b/ChangeLog index 268aa1e..204fa9c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -75,11 +75,12 @@ New: Bug/Wish: * Admin: + - #390: Add date of request in validation form. -FRU + - #397: Can edit death date in user admin page. -FRU + - #427: Automatic answers for validation. -Car + - #429: Tools to administrate duplicated adresses. -FRU - #430: Specify date format on downtime admin page. -Car - - #397: Can edit death date in user admin page -FRU - - #429: Tools to administrate duplicated adresses -FRU - - #390: Add date of request in validation form -FRU - - #440: Rewrite events admin page -FRU + - #440: Rewrite events admin page. -FRU * Carnet: - #435: Calendar contains yearly events for all the contacts. -FRU @@ -90,17 +91,17 @@ Bug/Wish: - #426: Add an identification header in mails. -FRU * Lists: - - #127: Add promo in member list when sorted by name -FRU - - #423: Allow line breaks in mailing list descriptions -FRU + - #127: Add promo in member list when sorted by name. -FRU + - #423: Allow line breaks in mailing list descriptions. -FRU * Profile: - #344: Tels can be bigger (up to 30 chars). -Car - - #422: Parasitic strings in vcard -FRU + - #422: Parasitic strings in vcard. -FRU * Xnet: - #426: Add an identification header in mails. -FRU - - #384: substitution of non-X's names in mail from web interface -FRU - - #380: Add sex for non-X -FRU + - #384: Substitution of non-X's names in mail from web interface. -FRU + - #380: Add sex for non-X. -FRU From 0.9.10 Branch: diff --git a/include/validations.inc.php b/include/validations.inc.php index dc97259..9de580f 100644 --- a/include/validations.inc.php +++ b/include/validations.inc.php @@ -294,6 +294,19 @@ class Validate { return null; } // }}} + // {{{ function answers() + + /** automatic answers table for this type of validation */ + function answers() { + static $answers_table; + if (!isset($answers_table[$this->type])) { + $r = XDB::query("SELECT id, title, answer FROM requests_answers WHERE category = {?}", $this->type); + $answers_table[$this->type] = $r->fetchAllAssoc($r); + } + return $answers_table[$this->type]; + } + + // }}} } foreach (glob(dirname(__FILE__).'/validations/*.inc.php') as $file) { diff --git a/modules/admin.php b/modules/admin.php index 1e09b8a..f39dac8 100644 --- a/modules/admin.php +++ b/modules/admin.php @@ -39,6 +39,7 @@ class AdminModule extends PLModule 'admin/synchro_ax' => $this->make_hook('synchro_ax', AUTH_MDP, 'admin'), 'admin/user' => $this->make_hook('user', AUTH_MDP, 'admin'), 'admin/validate' => $this->make_hook('validate', AUTH_MDP, 'admin'), + 'admin/validate/answers' => $this->make_hook('validate_answers', AUTH_MDP, 'admin'), 'admin/wiki' => $this->make_hook('wiki', AUTH_MDP, 'admin'), ); } @@ -466,6 +467,16 @@ class AdminModule extends PLModule $page->assign('vit', new ValidateIterator()); } + function handler_validate_answers(&$page, $action = 'list', $id = null) { + require_once('../classes/PLTableEditor.php'); + $page->assign('xorg_title','Polytechnique.org - Administration - Réponses automatiques de validation'); + $page->assign('title', 'Gestion des réponses automatiques'); + $table_editor = new PLTableEditor('admin/validate/answers','requests_answers','id'); + $table_editor->describe('category','catégorie',true); + $table_editor->describe('title','titre',true); + $table_editor->describe('answer','texte',false); + $table_editor->apply($page, $action, $id); + } function handler_skins(&$page, $action = 'list', $id = null) { require_once('../classes/PLTableEditor.php'); $page->assign('xorg_title','Polytechnique.org - Administration - Skins'); diff --git a/templates/admin/valider.tpl b/templates/admin/valider.tpl index 6ad4a45..93e4000 100644 --- a/templates/admin/valider.tpl +++ b/templates/admin/valider.tpl @@ -71,9 +71,19 @@ Réponse - rules}> + rules}>
+ Réponse préremplie : + + {icon name="page_edit" title="Editer les réponses automatiques"} +
+
Ajouté dans l'email :

diff --git a/upgrade/0.9.11/06_validations.sql b/upgrade/0.9.11/06_validations.sql new file mode 100644 index 0000000..b3ca18d --- /dev/null +++ b/upgrade/0.9.11/06_validations.sql @@ -0,0 +1,6 @@ +CREATE TABLE `requests_answers` ( +`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , +`category` ENUM( 'alias', 'list', 'nomusage', 'photo', 'evt', 'marketing', 'orange', 'homonyme', 'nl', 'paiement' ) NOT NULL , +`title` VARCHAR( 50 ) NOT NULL , +`answer` TEXT NOT NULL +); -- 2.1.4