simplify code, delete one include
authorx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Tue, 25 Oct 2005 22:50:07 +0000 (22:50 +0000)
committerx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Tue, 25 Oct 2005 22:50:07 +0000 (22:50 +0000)
git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@139 839d8a87-29fc-0310-9880-83ba4fa771e5

include/platal/errors.inc.php [deleted file]
include/platal/page.inc.php

diff --git a/include/platal/errors.inc.php b/include/platal/errors.inc.php
deleted file mode 100644 (file)
index ea8811f..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2004 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-// {{{ class XOrgErrors
-
-class XOrgErrors
-{
-    // {{{ properties
-    
-    var $errs    = Array();
-    var $failure = false;
-    
-    // }}}
-    // {{{ constructor
-    
-    function XOrgErrors()
-    { }
-
-    // }}}
-    // {{{ function trig
-        
-    function trig($text) {
-        $this->errs[] = $text;
-    }
-
-    // }}}
-    // {{{
-    
-    function fail($text) {
-        $this->trig($text);
-        $this->failure = true;
-    }
-
-    // }}}
-}
-
-// }}}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
-?>
index daadc3d..47a56c2 100644 (file)
@@ -20,7 +20,6 @@
  ***************************************************************************/
 
 require_once 'smarty/libs/Smarty.class.php';
-require_once 'platal/errors.inc.php';
 require_once 'platal/smarty.plugins.inc.php';
 
 // {{{ class PlatalPage
@@ -32,6 +31,7 @@ class PlatalPage extends Smarty
     var $_page_type;
     var $_tpl;
     var $_errors;
+    var $_failure;
 
     // defaults
     var $caching          = false;
@@ -61,7 +61,8 @@ class PlatalPage extends Smarty
 
         $this->_page_type = $type;
         $this->_tpl       = $tpl;
-        $this->_errors    = new XOrgErrors;
+        $this->_errors    = array();
+        $this->_failure   = false;
 
         $this->register_prefilter('at_to_globals');
         $this->register_prefilter('trimwhitespace');
@@ -108,7 +109,8 @@ class PlatalPage extends Smarty
     function _run($skin)
     {
         global $globals, $TIME_BEGIN;
-        $this->assign("xorg_error", $this->_errors);
+        $this->assign("xorg_errors", $this->_errors);
+        $this->assign("xorg_failure", $this->_failure);
         
         if ($this->_page_type == NO_SKIN) {
             $this->display($this->_tpl);
@@ -166,7 +168,7 @@ class PlatalPage extends Smarty
 
     function nb_errs()
     {
-        return count($this->_errors->errs);
+        return count($this->_errors);
     }
 
     // }}}
@@ -174,7 +176,7 @@ class PlatalPage extends Smarty
 
     function trig($msg)
     {
-        $this->_errors->trig($msg);
+        $this->_errors[] = $msg;
     }
 
     // }}}
@@ -182,7 +184,7 @@ class PlatalPage extends Smarty
 
     function trig_run($msg)
     {
-        $this->_errors->trig($msg);
+        $this->trig($msg);
         $this->run();
     }
 
@@ -191,7 +193,8 @@ class PlatalPage extends Smarty
 
     function fail($msg)
     {
-        $this->_errors->fail($msg);
+        $this->trig($msg);
+        $this->_failure = true;
     }
 
     // }}}