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'));
}
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();
}
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");
}
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("");
}
{* *}
{**************************************************************************}
+<script type="text/javascript">
+{literal}
+function visibilityChange(box)
+{
+ var state = (box.checked ? 'none' : 'normal');
+ document.getElementById('promo_titre').style.display = state;
+ document.getElementById('promo_min').style.display = state;
+ document.getElementById('promo_max').style.display = state;
+ document.getElementById('promo_desc').style.display = state;
+}
+{/literal}
+</script>
<h1>{$asso.nom} : Edition d'une annonce</h1>
{if $art.texte}
<table class="tinybicol">
<tr>
- <th colspan="2">Promotions cibles</th>
- </tr>
- <tr>
- <td class="titre">Promotion minimale :</td>
- <td>
- <input type="text" size="4" maxlength="4" name="promo_min" value="{$art.promo_min|default:0}" />
- incluse* (ex : 1980)
- </td>
- </tr>
- <tr>
- <td class="titre">Promotion minimale :</td>
- <td>
- <input type="text" size="4" maxlength="4" name="promo_max" value="{$art.promo_max|default:0}" />
- incluse* (ex : 2000)
- </td>
- </tr>
- <tr class="pair">
- <td colspan="2">
- <small>* 0 signifie qu'il n'y a pas de limite</small>
- </td>
- </tr>
- <tr>
- <th colspan="2">Options</th>
- </tr>
- <tr>
<td class="titre">Date de péremption :</td>
<td>
<select name="peremption">
</td>
</tr>
{/if}
- <tr>
+ <tr>
<td class="titre">Visibilité :</td>
<td>
- <input type="checkbox" name="public" {if $art.public}checked="checked"{/if} />
+ <input type="checkbox" name="public" {if $art.public}checked="checked"{/if} onchange="visibilityChange(this)" />
Rendre cette annonce publique
</td>
</tr>
+ <tr id="promo_titre" {if $art.public}style="display: none"{/if}>
+ <th colspan="2">Promotions cibles</th>
+ </tr>
+ <tr id="promo_min" {if $art.public}style="display: none"{/if}>
+ <td class="titre">Promotion minimale :</td>
+ <td>
+ <input type="text" size="4" maxlength="4" name="promo_min" value="{$art.promo_min|default:0}" />
+ incluse* (ex : 1980)
+ </td>
+ </tr>
+ <tr id="promo_max" {if $art.public}style="display: none"{/if}>
+ <td class="titre">Promotion minimale :</td>
+ <td>
+ <input type="text" size="4" maxlength="4" name="promo_max" value="{$art.promo_max|default:0}" />
+ incluse* (ex : 2000)
+ </td>
+ </tr>
+ <tr class="pair" id="promo_desc" {if $art.public}style="display: none"{/if}>
+ <td colspan="2">
+ <small>* 0 signifie qu'il n'y a pas de limite</small>
+ </td>
+ </tr>
{if $new}
<tr>
<th colspan="2">Demandes de publication</th>