Make addFirefoxEngine global
[platal.git] / modules / newsletter.php
index 87ba7a1..8ede54a 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2006 Polytechnique.org                              *
+ *  Copyright (C) 2003-2007 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -75,7 +75,10 @@ class NewsletterModule extends PLModule
 
         require_once 'newsletter.inc.php';
 
-        if (Post::has('see')) {
+        if (Post::has('see') || (Post::has('valid') && (!trim(Post::v('title')) || !trim(Post::v('body'))))) {
+            if (!Post::has('see')) {
+                $page->trig("L'article doit avoir un titre et un contenu");
+            }
             $art = new NLArticle(Post::v('title'), Post::v('body'), Post::v('append'));
             $page->assign('art', $art);
         } elseif (Post::has('valid')) {
@@ -85,6 +88,7 @@ class NewsletterModule extends PLModule
             $art->submit();
             $page->assign('submited', true);
         }
+        $page->addCssLink('nl.css');
     }
 
     function handler_admin_nl(&$page, $new = false) {
@@ -154,8 +158,7 @@ class NewsletterModule extends PLModule
         $table_editor->describe('titre','intitulé',true);
         $table_editor->describe('pos','position',true);
         $table_editor->apply($page, $action, $id);
-    }    
-    
+    }
 }
 
 ?>