openrat-cms

# OpenRat Content Management System
git clone http://git.code.weiherhei.de/openrat-cms.git
Log | Files | Refs

TextAction.class.php (2461B)


      1 <?php
      2 
      3 namespace {
      4 
      5     define('OR_FILE_FILTER_LESS',1);
      6 }
      7 
      8 namespace cms\action
      9 {
     10     use cms\model\BaseObject;
     11 
     12     use cms\model\Text;
     13     use \Html;
     14 
     15 // OpenRat Content Management System
     16 // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de
     17 //
     18 // This program is free software; you can redistribute it and/or
     19 // modify it under the terms of the GNU General Public License
     20 // as published by the Free Software Foundation; either version 2
     21 // of the License, or (at your option) any later version.
     22 //
     23 // This program is distributed in the hope that it will be useful,
     24 // but WITHOUT ANY WARRANTY; without even the implied warranty of
     25 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     26 // GNU General Public License for more details.
     27 //
     28 // You should have received a copy of the GNU General Public License
     29 // along with this program; if not, write to the Free Software
     30 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
     31 
     32 
     33     /**
     34      * Action-Klasse zum Bearbeiten einer Datei
     35      * @author Jan Dankert
     36      * @package openrat.actions
     37      */
     38     class TextAction extends FileAction
     39     {
     40         public $security = Action::SECURITY_USER;
     41 
     42         private $text;
     43 
     44         /**
     45          * Konstruktor
     46          */
     47         function __construct()
     48         {
     49             parent::__construct();
     50         }
     51 
     52 
     53         public function init()
     54         {
     55 
     56             $text = new Text($this->getRequestId());
     57             $text->load();
     58 
     59             $this->setBaseObject( $text );
     60         }
     61 
     62 
     63 
     64 		protected function setBaseObject( $text ) {
     65 
     66 			$this->text = $text;
     67 
     68 			parent::setBaseObject( $text );
     69 		}
     70 
     71 
     72 		public function valuePost()
     73         {
     74             $this->text->value = $this->getRequestVar('value', OR_FILTER_RAW);
     75             $this->text->saveValue();
     76 
     77             $this->addNotice($this->text->getType(), $this->text->name, 'VALUE_SAVED', 'ok');
     78             $this->text->setTimestamp();
     79         }
     80 
     81 
     82 		/**
     83 		 * Only needed because there is a special template for text nodes.
     84 		 */
     85         public function valueView()
     86         {
     87             parent::valueView();
     88         }
     89 
     90 
     91 		/**
     92 		 * Only needed because there is a special template for text nodes.
     93 		 */
     94         public function showView() {
     95 
     96             parent::showView();
     97         }
     98 
     99 		/**
    100 		 * Only needed because there is a special template for text nodes.
    101 		 */
    102         public function previewView()
    103         {
    104             parent::previewView();
    105         }
    106     }
    107 }