From 2a557a092265981fcb53edfd38ed0dde353d9c24 Mon Sep 17 00:00:00 2001 From: x2003bruneau Date: Wed, 8 Nov 2006 09:07:16 +0000 Subject: [PATCH] Some improvements to [1057]: * check promotion range * fix public attribute behaviour git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1058 839d8a87-29fc-0310-9880-83ba4fa771e5 --- modules/xnetgrp.php | 24 ++++++++++--- templates/xnet/groupe/announce-edit.tpl | 63 +++++++++++++++++++-------------- templates/xnet/groupe/asso.tpl | 6 ++-- 3 files changed, 58 insertions(+), 35 deletions(-) diff --git a/modules/xnetgrp.php b/modules/xnetgrp.php index 4c624b7..c5e2dc1 100644 --- a/modules/xnetgrp.php +++ b/modules/xnetgrp.php @@ -148,7 +148,7 @@ class XnetGrpModule extends PLModule FROM groupex.announces AS a INNER JOIN auth_user_md5 AS u USING(user_id) WHERE asso_id = {?} AND peremption >= CURRENT_DATE() - AND FIND_IN_SET(u.flags, 'public')", + AND FIND_IN_SET(a.flags, 'public')", $globals->asso('id')); } @@ -897,21 +897,32 @@ class XnetGrpModule extends PLModule if (@$art['event']) { $art['contact_html'] .= "\n{$globals->baseurl}/{$platal->ns}events/sub/{$art['event']}"; } + + if (!$art['public'] && + ($art['promo_min'] > $art['promo_max'] || + ($art['promo_min'] != 0 && ($art['promo_min'] <= 1900 || $art['promo_min'] >= 2020)) || + ($art['promo_max'] != 0 && ($art['promo_max'] <= 1900 || $art['promo_max'] >= 2020)))) + { + $page->trig("L'intervalle de promotions est invalide"); + Post::kill('valid'); + } } if (Post::v('valid') == 'Enregistrer') { + $promo_min = ($art['public'] ? 0 : $art['promo_min']); + $promo_max = ($art['public'] ? 0 : $art['promo_max']); if (is_null($aid)) { XDB::query("INSERT INTO groupex.announces (user_id, asso_id, create_date, titre, texte, contacts, peremption, promo_min, promo_max, flags) VALUES ({?}, {?}, NOW(), {?}, {?}, {?}, {?}, {?}, {?}, {?})", S::i('uid'), $globals->asso('id'), $art['titre'], $art['texte'], $art['contact_html'], - $art['peremption'], $art['promo_min'], $art['promo_max'], $art['public'] ? 'public' : ''); + $art['peremption'], $promo_min, $promo_max, $art['public'] ? 'public' : ''); $aid = mysql_insert_id(); if ($art['xorg']) { require_once('validations.inc.php'); require_once('url_catcher.inc.php'); - $article = new EvtReq($art['titre'], + $article = new EvtReq("[{$globals->asso('nom')}] " . $art['titre'], url_catcher($art['texte'] . (!empty($art['contacts']) ? "\n\nContacts :\n" . $art['contacts'] : "")), $art['promo_min'], $art['promo_max'], $art['peremption'], "", S::v('uid')); $article->submit(); @@ -919,7 +930,8 @@ class XnetGrpModule extends PLModule } if ($art['nl']) { require_once('validations.inc.php'); - $article = new NLReq(S::v('uid'), $art['titre'], $art['texte'], $art['contact_html']); + $article = new NLReq(S::v('uid'), $globals->asso('nom') . " : " .$art['titre'], + $art['texte'], $art['contact_html']); $article->submit(); $page->trig("La parution dans la Lettre Mensuelle est en attente de validation"); } @@ -929,9 +941,11 @@ class XnetGrpModule extends PLModule promo_min={?}, promo_max={?}, flags={?} WHERE id={?} AND asso_id={?}", $art['titre'], $art['texte'], $art['contacts'], $art['peremption'], - $art['promo_min'], $art['promo_max'], $art['public'] ? 'public' : '', + $promo_min, $promo_max, $art['public'] ? 'public' : '', $art['id'], $globals->asso('id')); } + } + if (Post::v('valid') == 'Enregistrer' || Post::v('valid') == 'Annuler') { pl_redirect(""); } diff --git a/templates/xnet/groupe/announce-edit.tpl b/templates/xnet/groupe/announce-edit.tpl index 927b3d6..4f1da7a 100644 --- a/templates/xnet/groupe/announce-edit.tpl +++ b/templates/xnet/groupe/announce-edit.tpl @@ -20,6 +20,18 @@ {* *} {**************************************************************************} +

{$asso.nom} : Edition d'une annonce

{if $art.texte} @@ -90,31 +102,6 @@ - - - - - - - - - - - - - - - - - {/if} - + + + + + + + + + + + + + + + {if $new} diff --git a/templates/xnet/groupe/asso.tpl b/templates/xnet/groupe/asso.tpl index 7ba1550..24a9b35 100644 --- a/templates/xnet/groupe/asso.tpl +++ b/templates/xnet/groupe/asso.tpl @@ -116,12 +116,12 @@ {/iterate} -- 2.1.4
Promotions cibles
Promotion minimale : - - incluse* (ex : 1980) -
Promotion minimale : - - incluse* (ex : 2000) -
- * 0 signifie qu'il n'y a pas de limite -
Options
Date de péremption :
Visibilité : - + Rendre cette annonce publique
Promotions cibles
Promotion minimale : + + incluse* (ex : 1980) +
Promotion minimale : + + incluse* (ex : 2000) +
+ * 0 signifie qu'il n'y a pas de limite +
Demandes de publication
• {if $art.nonlu} - + {else} - + {/if} {tidy}{$art.titre}{/tidy} - {if !$art.nonlu}{/if} + {if $art.nonlu}{/if}