From: x2003bruneau Date: Fri, 20 Apr 2007 14:44:47 +0000 (+0000) Subject: Post xnet announces on the forum of the group X-Git-Tag: xorg/0.9.14~70 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=e219710aa66342ed9e7593e68a77f2049dbbf6d7;p=platal.git Post xnet announces on the forum of the group classes/miniwiki.php | 11 ++++++----- modules/xnetgrp.php | 31 +++++++++++++++++++++---------- templates/xnetgrp/asso.tpl | 2 +- templates/xnetgrp/form.announce.tpl | 9 ++++++++- upgrade/0.9.14/03_evenements.sql | 4 ++++ 5 files changed, 40 insertions(+), 17 deletions(-) git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1720 839d8a87-29fc-0310-9880-83ba4fa771e5 --- diff --git a/classes/miniwiki.php b/classes/miniwiki.php index 02f1ca4..f8ceecd 100644 --- a/classes/miniwiki.php +++ b/classes/miniwiki.php @@ -32,6 +32,11 @@ class MiniWiki // retours à la ligne avec \\ MiniWiki::Markup("/\\\\(?".">(\\\\*))\n/e", "str_repeat('
\n',strlen('$1'))", "str_repeat('\n',strlen('$1'))", "ligne1\\\\\nligne2"); + // * unordered list + MiniWiki::Markup("/(^|\n)\*(([^\n]*(\n|$))(\*[^\n]*(\n|$))*)/se", "''", "$0", "* element1\n* element2\n* element3"); + // # unordered list + MiniWiki::Markup("/(^|\n)#(([^\n]*(\n|$))(#[^\n]*(\n|$))*)/se", "'
  1. '.str_replace(\"\\n#\",'
  2. ','$2').'
'", "$0", "# element1\n# element2\n# element3"); + // bold, italic and others // ''' bold ''' MiniWiki::Markup("/'''(.*?)'''/",'$1','*$1*', "'''gras'''"); @@ -61,11 +66,6 @@ class MiniWiki MiniWiki::$title_index = MiniWiki::Markup('/(\n|^)(!+)([^\n]*)/se', "'$1$3'", "'$1$3'", "!titre1\n\n!!titre2\n\n!!!titre3"); - // * unordered list - MiniWiki::Markup("/(^|\n)\*(([^\n]*(\n|$))(\*[^\n]*(\n|$))*)/se", "''", "$0", "* element1\n* element2\n* element3"); - // # unordered list - MiniWiki::Markup("/(^|\n)#(([^\n]*(\n|$))(#[^\n]*(\n|$))*)/se", "'
  1. '.str_replace(\"\\n#\",'
  2. ','$2').'
'", "$0", "# element1\n# element2\n# element3"); - // links MiniWiki::Markup('/((?:https?|ftp):\/\/(?:[\.\,\;\!\:]*[\w@~%$£µ&i#\-+=_\/\?])*)/ui', '\\0', '[\\0]'); MiniWiki::Markup('/(\s|^|\\[\\[)www\.((?:[\.\,\;\!\:]*[\w@~%$£µ&i#\-+=_\/\?])*)/iu', '\\1www.\\2', '[http://www.\\2]'); @@ -144,6 +144,7 @@ class MiniWiki $oldrule12 = MiniWiki::$replacementHTML[MiniWiki::$title_index]; MiniWiki::$replacementHTML[MiniWiki::$title_index] = "'$0'"; } + $text = trim($wiki); $text = preg_replace(MiniWiki::$patternsWiki, MiniWiki::$replacementText, trim($wiki)); if (!$title) { MiniWiki::$replacementHTML[MiniWiki::$title_index] = $oldrule12; diff --git a/modules/xnetgrp.php b/modules/xnetgrp.php index 88547d8..057bcc7 100644 --- a/modules/xnetgrp.php +++ b/modules/xnetgrp.php @@ -1015,17 +1015,28 @@ class XnetGrpModule extends PLModule $promo_min = ($art['public'] ? 0 : $art['promo_min']); $promo_max = ($art['public'] ? 0 : $art['promo_max']); if (is_null($aid)) { + $fulltext = $art['texte']; + if (!empty($art['contact_html'])) { + $fulltext .= "\n\n'''Contacts :'''\\\\\n" . $art['contact_html']; + } + $post = null; + if ($globals->asso('forum')) { + require_once 'banana/forum.inc.php'; + $banana = new ForumsBanana(S::v('forlife')); + $post = $banana->post($globals->asso('forum'), null, + $art['titre'], MiniWiki::wikiToText($fulltext, false, 0, 80)); + } XDB::query("INSERT INTO groupex.announces (user_id, asso_id, create_date, titre, texte, contacts, - peremption, promo_min, promo_max, flags) - VALUES ({?}, {?}, NOW(), {?}, {?}, {?}, {?}, {?}, {?}, {?})", + peremption, promo_min, promo_max, flags, post_id) + VALUES ({?}, {?}, NOW(), {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?})", S::i('uid'), $globals->asso('id'), $art['titre'], $art['texte'], $art['contact_html'], - $art['peremption'], $promo_min, $promo_max, $art['public'] ? 'public' : ''); + $art['peremption'], $promo_min, $promo_max, $art['public'] ? 'public' : '', $post); $aid = XDB::insertId(); if ($art['xorg']) { require_once('validations.inc.php'); $article = new EvtReq("[{$globals->asso('nom')}] " . $art['titre'], - MiniWiki::WikiToHTML($art['texte'] . (!empty($art['contact_html']) ? "\n\nContacts :\n" . $art['contact_html'] : "")), + MiniWiki::WikiToHTML($fulltext), $art['promo_min'], $art['promo_max'], $art['peremption'], "", S::v('uid')); $article->submit(); $page->trig("L'affichage sur la page d'accueil de Polytechnique.org est en attente de validation"); @@ -1087,14 +1098,14 @@ class XnetGrpModule extends PLModule $page->changeTpl('xnetgrp/announce-admin.tpl'); if (Env::has('del')) { - XDB::execute("DELETE FROM groupex.announces - WHERE id = {?} AND asso_id = {?}", + XDB::execute("DELETE FROM groupex.announces + WHERE id = {?} AND asso_id = {?}", Env::i('del'), $globals->asso('id')); } - $res = XDB::iterator("SELECT a.id, a.titre, a.peremption, a.peremption < CURRENT_DATE() AS perime - FROM groupex.announces AS a - WHERE a.asso_id = {?} - ORDER BY a.peremption DESC", + $res = XDB::iterator("SELECT a.id, a.titre, a.peremption, a.peremption < CURRENT_DATE() AS perime + FROM groupex.announces AS a + WHERE a.asso_id = {?} + ORDER BY a.peremption DESC", $globals->asso('id')); $page->assign('articles', $res); } diff --git a/templates/xnetgrp/asso.tpl b/templates/xnetgrp/asso.tpl index d29ea84..b616d7b 100644 --- a/templates/xnetgrp/asso.tpl +++ b/templates/xnetgrp/asso.tpl @@ -151,7 +151,7 @@ respectifs et sont publiées à leur initiative. L'association Polytechnique.org ne pourrait en aucun cas être tenue responsable de la nature des propos relatés sur cet espace d'expression et d'information. Elle se réserve le droit de refuser ou de retirer toute information de nature diffamante ou pouvant être -interprétée comme polémique par un membre de la communauté polytechnicienne. +interprétée comme polémique par un lecteur.

{/if} diff --git a/templates/xnetgrp/form.announce.tpl b/templates/xnetgrp/form.announce.tpl index 03d612c..ca3b565 100644 --- a/templates/xnetgrp/form.announce.tpl +++ b/templates/xnetgrp/form.announce.tpl @@ -59,14 +59,21 @@ {/if} - + +
Annonce proposée par {$art.prenom} {$art.nom} (X{$art.promo}) +
+ + {if $art.post_id} + {icon name=comments title="Discussions"}Discuter + {/if} + diff --git a/upgrade/0.9.14/03_evenements.sql b/upgrade/0.9.14/03_evenements.sql index 5c8555d..fafc2a8 100644 --- a/upgrade/0.9.14/03_evenements.sql +++ b/upgrade/0.9.14/03_evenements.sql @@ -9,4 +9,8 @@ create table evenements_photo ( primary key eid (eid) ) charset=utf8; +use groupex; +alter table announces add post_id smallint(4) unsigned default NULL; +use x4dat; + # vim:set syntax=mysql: