LinkAction.class.php

gehe zur Dokumentation dieser Datei
00001 <?php
00002 // ---------------------------------------------------------------------------
00003 // $Id$
00004 // ---------------------------------------------------------------------------
00005 // OpenRat Content Management System
00006 // Copyright (C) 2002-2004 Jan Dankert, cms@jandankert.de
00007 //
00008 // This program is free software; you can redistribute it and/or
00009 // modify it under the terms of the GNU General Public License
00010 // as published by the Free Software Foundation; either version 2
00011 // of the License, or (at your option) any later version.
00012 //
00013 // This program is distributed in the hope that it will be useful,
00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 // GNU General Public License for more details.
00017 //
00018 // You should have received a copy of the GNU General Public License
00019 // along with this program; if not, write to the Free Software
00020 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00021 // ---------------------------------------------------------------------------
00022 // $Log$
00023 // Revision 1.10  2009-03-22 21:49:08  dankert
00024 // Subaction "showprop" entfernt, da in "prop" mit aufgegangen.
00025 //
00026 // Revision 1.9  2006/06/02 19:49:06  dankert
00027 // Bearbeiten von Verkn?pfungen
00028 //
00029 // Revision 1.8  2006/01/29 17:18:58  dankert
00030 // Steuerung der Aktionsklasse ?ber .ini-Datei, dazu umbenennen einzelner Methoden
00031 //
00032 // Revision 1.7  2006/01/23 23:10:45  dankert
00033 // *** empty log message ***
00034 //
00035 // Revision 1.6  2004/12/20 22:04:25  dankert
00036 // kein Lesen der Benutzer
00037 //
00038 // Revision 1.5  2004/12/15 23:23:11  dankert
00039 // Anpassung an Session-Funktionen
00040 //
00041 // Revision 1.4  2004/11/24 21:28:36  dankert
00042 // "Verschieben" entfernt
00043 //
00044 // Revision 1.3  2004/05/02 14:49:37  dankert
00045 // Einf?gen package-name (@package)
00046 //
00047 // Revision 1.2  2004/04/30 20:31:47  dankert
00048 // Berechtigungen anzeigen
00049 //
00050 // Revision 1.1  2004/04/24 15:14:52  dankert
00051 // Initiale Version
00052 //
00053 // ---------------------------------------------------------------------------
00054 
00055 
00062 class LinkAction extends ObjectAction
00063 {
00064      var $link;
00065      var $defaultSubAction = 'prop';
00066 
00070      function LinkAction()
00071      {
00072           if   ( $this->getRequestId() != 0  )
00073           {
00074                $this->link = new Link( $this->getRequestId() );
00075                $this->link->load();
00076                Session::setObject( $this->link );
00077           }
00078           else
00079           {
00080                $this->link = Session::getObject();
00081           }
00082      }
00083 
00084 
00085 
00086      function remove()
00087      {
00088           $this->setTemplateVars( $this->link->getProperties() );
00089      }
00090      
00091 
00092 
00093      function delete()
00094      {
00095           if   ( $this->hasRequestVar("delete") )
00096           {
00097                $this->link->delete();
00098                $this->addNotice('link',$this->link->name,'DELETED');
00099           }
00100      }
00101      
00102 
00103 
00107      function saveprop()
00108      {
00109           // Wenn Name gefuellt, dann Datenbank-Update
00110           if   ( $this->getRequestVar('name') != '' )
00111           {
00112                // Eigenschaften speichern
00113                $this->link->name      = $this->getRequestVar('name'       );
00114                $this->link->desc      = $this->getRequestVar('description');
00115 
00116                $this->link->save();
00117                $this->link->setTimestamp();
00118                Session::setObject( $this->link );
00119           }
00120      }
00121 
00122 
00126      function save()
00127      {
00128           if( $this->getRequestVar('type') != '' )
00129           {
00130                if   ( $this->getRequestVar('type') == 'link' )
00131                {
00132                     $this->link->isLinkToObject = true;
00133                     $this->link->isLinkToUrl    = false;
00134                     $this->link->linkedObjectId = $this->getRequestVar('targetobjectid');
00135                }
00136                else
00137                {
00138                     $this->link->isLinkToObject = false;
00139                     $this->link->isLinkToUrl    = true;
00140                     $this->link->url            = $this->getRequestVar('url');
00141                }
00142                
00143                $this->link->save();
00144                $this->link->setTimestamp();
00145                Session::setObject( $this->link );
00146           }
00147      }
00148 
00149 
00150      function showprop()
00151      {
00152           $this->setTemplateVars( $this->link->getProperties() );
00153      }
00154 
00155 
00156 
00157      function edit()
00158      {
00159           $this->setTemplateVars( $this->link->getProperties() );
00160 
00161           // Typ der Verkn?pfung
00162           $this->setTemplateVar('type'            ,$this->link->getType()     );
00163           $this->setTemplateVar('targetobjectid',$this->link->linkedObjectId);
00164           $this->setTemplateVar('url'             ,$this->link->url           );
00165 
00166           // Alle verlinkbaren Objekte anzeigen
00167           $list = array();
00168           
00169           foreach( Object::getAllObjectIds() as $oid )
00170           {
00171                $o = new Object( $oid );
00172                $o->load();
00173                
00174                if   ( $o->isFile ||
00175                       $o->isPage    )
00176                {
00177                     $folder = new Folder( $o->parentid );
00178                     $folder->linknames = false;
00179                     $folder->load();
00180                     $list[$oid]  = lang( 'GLOBAL_'.$o->getType() ).': ';
00181                     $list[$oid] .= implode( FILE_SEP,$folder->parentObjectNames( false,true ) );
00182                     $list[$oid] .= FILE_SEP.$o->name;
00183                }
00184           }
00185           asort( $list );
00186           $this->setTemplateVar('objects',$list);      
00187 
00188           $this->forward('link_edittarget');
00189      }
00190 
00191 
00192 
00193      function prop()
00194      {
00195           $this->setTemplateVars( $this->link->getProperties() );
00196           $this->setTemplateVar('act_linkobjectid',$this->link->linkedObjectId);
00197      }
00198 }

Erzeugt am Thu May 14 00:55:48 2009 für OpenRat von  doxygen 1.5.8