openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit b5316336e6b0352c580d575aa4043ffd9d44eea1
parent 9fdb7d640973cdaf524d20e462601701f92cbbf4
Author: dankert <devnull@localhost>
Date:   Sun, 29 Jan 2006 18:18:59 +0100

Steuerung der Aktionsklasse ?ber .ini-Datei, dazu umbenennen einzelner Methoden

Diffstat:
actionClasses/ElementAction.class.php | 173+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------
actionClasses/ElementAction.ini.php | 34+++++++++++++++++++++++++++++++++-
actionClasses/FileAction.class.php | 121+++++++++++++++++++++++++++++++++++++++++--------------------------------------
actionClasses/FileAction.ini.php | 63+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
actionClasses/FolderAction.class.php | 301++++++++++++++++++++++++++++++++++++-------------------------------------------
actionClasses/FolderAction.ini.php | 66++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
actionClasses/LanguageAction.class.php | 14+++++++++-----
actionClasses/LanguageAction.ini.php | 36+++++++++++++++++++++++++++++++++++-
actionClasses/LinkAction.class.php | 61++++++++++++++++++++++++++++++++++++++++---------------------
actionClasses/LinkAction.ini.php | 47++++++++++++++++++++++++++++++++++++++++++++++-
actionClasses/MainmenuAction.class.php | 55++++++++++++++++++++++++-------------------------------
actionClasses/MainmenuAction.ini.php | 15+++++++++++++++
actionClasses/ModelAction.class.php | 59++++++++++++++++++++++++++++++++++++++++-------------------
actionClasses/ModelAction.ini.php | 37+++++++++++++++++++++++++++++++++++++
actionClasses/PageAction.class.php | 84+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------
actionClasses/PageAction.ini.php | 54++++++++++++++++++++++++++++++++++++++++++++++++++++--
actionClasses/PageelementAction.class.php | 710++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
actionClasses/PageelementAction.ini.php | 77+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
actionClasses/TemplateAction.class.php | 278++++++++++++++++++++++++++++++++-----------------------------------------------
actionClasses/TemplateAction.ini.php | 76+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------
20 files changed, 1832 insertions(+), 529 deletions(-)

diff --git a/actionClasses/ElementAction.class.php b/actionClasses/ElementAction.class.php @@ -20,7 +20,10 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // --------------------------------------------------------------------------- // $Log$ -// Revision 1.12 2006-01-17 22:43:02 dankert +// Revision 1.13 2006-01-29 17:18:27 dankert +// Steuerung der Aktionsklasse ?ber .ini-Datei, dazu umbenennen einzelner Methoden +// +// Revision 1.12 2006/01/17 22:43:02 dankert // Der Einstellungsknoten hei?t nun "date-formats" statt "date_formats" // // Revision 1.11 2005/04/21 19:08:44 dankert @@ -67,7 +70,6 @@ class ElementAction extends Action { var $element; - var $defaultSubAction = 'edit'; /** * Konstruktor @@ -75,26 +77,59 @@ class ElementAction extends Action function ElementAction() { if ( $this->getRequestId() == 0 ) - die('no template-id available'); - - if ( $this->getRequestVar('elementid') == 0 ) die('no element-id available'); - $this->template = new Template( $this->getRequestId() ); - $this->template->load(); - - $this->element = new Element( $this->getRequestVar('elementid') ); + $this->element = new Element( $this->getRequestId() ); $this->element->load(); - $this->setTemplateVar( 'templateid',$this->template->templateid ); $this->setTemplateVar( 'elementid' ,$this->element->elementid ); } + + /** + * Umbenennen des Elementes + */ + function savename() + { + $this->element->name = $this->getRequestVar('name' ); + $this->element->desc = $this->getRequestVar('description'); + + $this->element->save(); + $this->element->load(); + } + + + + /** + * Umbenennen des Elementes + */ + function remove() + { + } + + + /** + * Umbenennen des Elementes + */ + function delete() + { + if ( $this->hasRequestVar('deletevalues') ) + { + $this->element->deleteValues(); + } + elseif ( $this->hasRequestVar('delete') ) + { + $this->element->delete(); + } + } + + + /** * Aendern des Element-Typs */ - function changetype() + function savetype() { if ( !$this->userIsAdmin() && $this->getRequestVar('type') == 'code' ) { @@ -105,22 +140,99 @@ class ElementAction extends Action // Neuen Typ setzen und speichern $this->element->setType( $this->getRequestVar('type') ); } + } + + + + /** + * Speichern der Element-Eigenschaften + */ + function saveproperties() + { + global $conf; + $ini_date_format = $conf['date-formats']; - $this->callSubAction('edit'); + foreach( $this->element->getRelatedProperties() as $propertyName ) + { + switch( $propertyName ) + { + case 'dateformat': + $this->element->dateformat = $ini_date_format[$this->getRequestVar('dateformat')]; + break; + + case 'subtype': + $this->element->subtype = $this->getRequestVar('subtype'); + break; + + case 'defaultText': + $this->element->defaultText = $this->getRequestVar('default_text'); + break; + + case 'wiki': + $this->element->wiki = $this->getRequestVar('wiki') != ''; + break; + + case 'html': + $this->element->html = $this->getRequestVar('html') != ''; + break; + + case 'withIcon': + $this->element->withIcon = $this->getRequestVar('with_icon') != ''; + break; + + case 'allLanguages': + $this->element->allLanguages = $this->getRequestVar('all_languages') != ''; + break; + + case 'writable': + $this->element->writable = $this->getRequestVar('writable') != ''; + break; + + case 'decimals': + $this->element->decimals = $this->getRequestVar('decimals'); + break; + + case 'decPoint': + $this->element->decPoint = $this->getRequestVar('dec_point'); + break; + + case 'thousandSep': + $this->element->thousandSep = $this->getRequestVar('thousand_sep'); + break; + + case 'folderObjectId': + $this->element->folderObjectId = $this->getRequestVar('folderobjectid' ); + break; + + case 'defaultObjectId': + $this->element->defaultObjectId = $this->getRequestVar('default_objectid'); + break; + + case 'code': + $this->element->code = $this->getRequestVar('code' ); + break; + } + } + $this->element->save(); } /** * Anzeigen des Elementes */ - function edit() + function name() { - global $conf; // Name und Beschreibung - $this->setTemplateVar('name',$this->element->name); - $this->setTemplateVar('desc',$this->element->desc); - + $this->setTemplateVar('name' ,$this->element->name); + + $this->setTemplateVar('description',$this->element->desc); + } + + + + function type() + { // Die verschiedenen Element-Typen $types = array(); @@ -133,10 +245,15 @@ class ElementAction extends Action if ( !$this->userIsAdmin() ) unset( $types['code'] ); - $this->setTemplateVar('type',$types); + $this->setTemplateVar('types',$types); - $this->setTemplateVar('default_type',$this->element->type); - + $this->setTemplateVar('type',$this->element->type); + } + + + function properties() + { + global $conf; // Abh?ngig vom aktuellen Element-Typ die Eigenschaften anzeigen $properties = $this->element->getRelatedProperties(); @@ -237,8 +354,8 @@ class ElementAction extends Action } } - $this->setTemplateVar('subtype' ,$subtypes ); - $this->setTemplateVar('act_subtype',$this->element->subtype); + $this->setTemplateVar('subtypes',$subtypes ); + $this->setTemplateVar('subtype' ,$this->element->subtype); break; @@ -248,16 +365,16 @@ class ElementAction extends Action $ini_date_format = $conf['date-formats']; $dateformat = array(); - $this->setTemplateVar('act_dateformat',''); + $this->setTemplateVar('dateformat',''); foreach($ini_date_format as $idx=>$d) { $dateformat[$idx] = date($d); if ( $d == $this->element->dateformat ) - $this->setTemplateVar('act_dateformat',$idx); + $this->setTemplateVar('dateformat',$idx); } - $this->setTemplateVar('dateformat' ,$dateformat ); + $this->setTemplateVar('dateformats',$dateformat); break; @@ -406,7 +523,7 @@ class ElementAction extends Action $this->setTemplateVar('objects',$objects); - $this->setTemplateVar('act_default_objectid',$this->element->defaultObjectId); + $this->setTemplateVar('default_objectid',$this->element->defaultObjectId); break; @@ -436,7 +553,7 @@ class ElementAction extends Action $this->setTemplateVar('folders',$folders); - $this->setTemplateVar('act_folderobjectid' ,$this->element->folderObjectId ); + $this->setTemplateVar('folderobjectid' ,$this->element->folderObjectId ); break; @@ -444,8 +561,6 @@ class ElementAction extends Action $this->message('ERROR','not an element property: '.$propertyName ); } } - - $this->forward('element'); } } diff --git a/actionClasses/ElementAction.ini.php b/actionClasses/ElementAction.ini.php @@ -1,3 +1,34 @@ [default] -goto=show +goto=name + +[name] +target=savename +menu=edit + +[type] +target=savetype +menu=edit + +[properties] +target=saveproperties +menu=edit + +[saveproperties] +goto=name + +[savename] +goto=name + +[savetype] +goto=name + +[remove] +menu=edit +target=delete + +[delete] +goto=name + +[menu] +edit=name,type,properties,remove+ \ No newline at end of file diff --git a/actionClasses/FileAction.class.php b/actionClasses/FileAction.class.php @@ -20,7 +20,10 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // --------------------------------------------------------------------------- // $Log$ -// Revision 1.17 2006-01-23 23:08:15 dankert +// Revision 1.18 2006-01-29 17:18:59 dankert +// Steuerung der Aktionsklasse ?ber .ini-Datei, dazu umbenennen einzelner Methoden +// +// Revision 1.17 2006/01/23 23:08:15 dankert // Auspacken von TAR-Archiven implementiert // // Revision 1.16 2005/11/07 22:31:08 dankert @@ -119,11 +122,10 @@ class FileAction extends ObjectAction $this->file->value = $upload->value; $this->file->saveValue(); + $this->file->setTimestamp(); //$setTemplateVar('tree_refresh',true); $this->addNotice($this->file->getType(),$this->file->name,'VALUE_SAVED','ok'); - - $this->callSubAction('edit'); } @@ -133,24 +135,36 @@ class FileAction extends ObjectAction $this->file->saveValue(); $this->addNotice($this->file->getType(),$this->file->name,'VALUE_SAVED','ok'); - $this->callSubAction('edit'); + $this->file->setTimestamp(); } - function save() + function saveprop() { - global $SESS; - // Eigenschaften speichern - $this->file->filename = $this->getRequestVar('filename' ); - $this->file->name = $this->getRequestVar('name' ); - $this->file->extension = $this->getRequestVar('extension'); - $this->file->desc = $this->getRequestVar('desc' ); + $this->file->filename = $this->getRequestVar('filename' ); + $this->file->name = $this->getRequestVar('name' ); + $this->file->extension = $this->getRequestVar('extension' ); + $this->file->desc = $this->getRequestVar('description'); - $this->addNotice($this->file->getType(),$this->file->name,'PROP_SAVED','ok'); $this->file->save(); + $this->file->setTimestamp(); + $this->addNotice($this->file->getType(),$this->file->name,'PROP_SAVED','ok'); + } + - $this->callSubAction('prop'); + function remove() + { + } + + + function delete() + { + if ( $this->hasRequestVar('delete') ) + { + $this->file->delete(); + $this->addNotice( 'Datei entfernt'); + } } @@ -252,6 +266,18 @@ class FileAction extends ObjectAction // Eigenschaften der Datei uebertragen $this->setTemplateVars( $this->file->getProperties() ); + } + + + function showprop() + { + global $conf; + + if ( $this->file->filename == $this->file->objectid ) + $this->file->filename = ''; + + // Eigenschaften der Datei uebertragen + $this->setTemplateVars( $this->file->getProperties() ); $this->setTemplateVar('full_filename',$this->file->full_filename()); @@ -270,7 +296,6 @@ class FileAction extends ObjectAction asort( $list ); $this->setTemplateVar('pages',$list); $this->setTemplateVar('edit_filename',$conf['filename']['edit']); - $this->forward( 'file_prop' ); } @@ -279,7 +304,9 @@ class FileAction extends ObjectAction */ function edit() { - $this->callSubAction('upload'); + global $conf; + // MIME-Types aus Datei lesen + $this->setTemplateVars( $this->file->getProperties() ); } @@ -288,12 +315,6 @@ class FileAction extends ObjectAction */ function upload() { - global $conf; - // MIME-Types aus Datei lesen - $this->setTemplateVars( $this->file->getProperties() ); - - $this->setWindowMenu('edit'); - $this->forward('file_replace'); } @@ -306,9 +327,6 @@ class FileAction extends ObjectAction // MIME-Types aus Datei lesen $this->setTemplateVars( $this->file->getProperties() ); $this->setTemplateVar('value',$this->file->loadValue()); - - $this->setWindowMenu('edit'); - $this->forward('file_editvalue'); } @@ -328,9 +346,6 @@ class FileAction extends ObjectAction $this->setTemplateVar('formats' ,$formats ); $this->setTemplateVar('default_format',$imageFormat); - - $this->setWindowMenu('edit'); - $this->forward('file_resize'); } @@ -368,9 +383,6 @@ class FileAction extends ObjectAction $formats[$t] = lang('compression_'.$t); $this->setTemplateVar('formats' ,$formats ); - - $this->setWindowMenu('edit'); - $this->forward('file_compress'); } @@ -578,39 +590,32 @@ class FileAction extends ObjectAction return $archiveTypes; } - function setWindowMenu( $type ) { - - global $conf; + + + function checkMenu( $name ) + { + $archiveTypes = $this->getArchiveTypes(); + $compressionTypes = $this->getCompressionTypes(); - switch( $type) + switch( $name ) { - case 'edit': - $menu = array(); - $compressionTypes = $this->getCompressionTypes(); - $archiveTypes = $this->getArchiveTypes(); + case 'uncompress': + return in_array($this->file->extension,$compressionTypes); - $menu[] = array('subaction'=>'upload','text'=>'file_replace'); - - if ($this->file->isImage() ) - $menu[] = array('subaction'=>'size','text'=>'file_resize'); - - if ( in_array($this->file->extension,$compressionTypes) ) - $menu[] = array('subaction'=>'uncompress','text'=>'file_uncompress'); + case 'compress': + return !in_array($this->file->extension,$compressionTypes); - if ( !in_array($this->file->extension,$compressionTypes) ) - $menu[] = array('subaction'=>'compress','text'=>'file_compress'); - - if ( in_array($this->file->extension,$archiveTypes) ) - $menu[] = array('subaction'=>'extract','text'=>'file_extract'); + case 'extract': + return in_array($this->file->extension,$archiveTypes); - if ( !in_array($this->file->extension,$compressionTypes) ) - $menu[] = array('subaction'=>'compress','text'=>'file_compress'); - - if ( substr($this->file->mimeType(),0,5)=='text/' ) - $menu[] = array('subaction'=>'editvalue','text'=>'file_editvalue'); - - $this->setTemplateVar('windowMenu',$menu); - break; + case 'size': + return $this->file->isImage(); + + case 'editvalue': + return substr($this->file->mimeType(),0,5)=='text/'; + + default: + return true; } } } diff --git a/actionClasses/FileAction.ini.php b/actionClasses/FileAction.ini.php @@ -5,9 +5,68 @@ goto=show [show] [edit] +menu=edit + +[editvalue] +menu=edit +target=savevalue + +[savevalue] +goto=show + +[showprop] +menu=prop [prop] +menu=prop +target=saveprop + +[saveprop] +goto=showprop + +[size] +menu=prop +target=resize + +[remove] +menu=prop +target=delete + +[delete] +goto=showprop + +[resize] +goto=showprop [pub] +target=... + +; Die Aktionen "rights", "aclform", "addacl" und "delacl" sind +; für Seiten,Ordner,Links und Dateien identisch. +[rights] +menu=rights + +[aclform] +menu=rights +target=addacl + +[addacl] +goto=rights + +[delacl] +goto=rights + + +[compress] +menu=edit + +[uncompress] +menu=edit + +[extract] +menu=edit -[rights]- \ No newline at end of file +[menu] +edit=edit,editvalue,compress,uncompress,extract +prop=showprop,prop,remove,size +rights=rights,aclform+ \ No newline at end of file diff --git a/actionClasses/FolderAction.class.php b/actionClasses/FolderAction.class.php @@ -20,7 +20,10 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // --------------------------------------------------------------------------- // $Log$ -// Revision 1.32 2006-01-23 23:08:52 dankert +// Revision 1.33 2006-01-29 17:18:58 dankert +// Steuerung der Aktionsklasse ?ber .ini-Datei, dazu umbenennen einzelner Methoden +// +// Revision 1.32 2006/01/23 23:08:52 dankert // Kl. ?nderungen beim Anlegen von Objekten // // Revision 1.31 2006/01/11 22:50:00 dankert @@ -150,81 +153,53 @@ class FolderAction extends ObjectAction } - function createnew() + + function createnewfolder() { $type = $this->getRequestVar('type' ); $name = $this->getRequestVar('name' ); $filename = $this->getRequestVar('filename' ); $description = $this->getRequestVar('description'); - // Neues Objekt in diesem Ordner anlegen - switch( $this->getRequestVar('type') ) + if ( !empty($name) ) { - case 'folder': + $f = new Folder(); + $f->name = $name; + $f->filename = $name; + $f->desc = $description; + $f->parentid = $this->folder->objectid; + + $f->add(); + $this->addNotice('folder',$f->name,'ADDED','ok'); + } - if ( $this->getRequestVar('foldername') != '' ) - { - $f = new Folder(); - $f->name = $this->getRequestVar('foldername'); - $f->filename = $this->getRequestVar('foldername'); - $f->parentid = $this->folder->objectid; + $this->folder->setTimestamp(); + } - $f->add(); - $this->addNotice('folder',$f->name,'ADDED','ok'); - } - break; - - case 'page': - if ( $this->getRequestVar('pagename') != '' ) - { - $page = new Page(); - $page->name = $this->getRequestVar('pagename' ); - $page->filename = $this->getRequestVar('pagename' ); - $page->templateid = $this->getRequestVar('templateid'); - $page->parentid = $this->folder->objectid; - - $this->addNotice('page',$page->name,'ADDED','ok'); - $page->add(); - } + function createnewfile() + { + $type = $this->getRequestVar('type' ); + $name = $this->getRequestVar('name' ); + $filename = $this->getRequestVar('filename' ); + $description = $this->getRequestVar('description'); + + $file = new File(); + $upload = new Upload(); - break; - - case 'file': + $file->desc = !empty($description)?$name:$upload->filename; + $file->filename = $upload->filename; + $file->name = !empty($name)?$name:$upload->filename; + $file->extension = $upload->extension; + $file->size = $upload->size; + $file->parentid = $this->folder->objectid; - $file = new File(); - $upload = new Upload(); - - $file->desc = !empty($description)?$name:$upload->filename; - $file->filename = $upload->filename; - $file->name = !empty($name)?$name:$upload->filename; - $file->extension = $upload->extension; - $file->size = $upload->size; - $file->parentid = $this->folder->objectid; - - $file->value = $upload->value; - - $file->add(); // Datei hinzufuegen - $this->addNotice('file',$file->name,'ADDED','ok'); - break; - - case 'link': + $file->value = $upload->value; + + $file->add(); // Datei hinzufuegen + $this->addNotice('file',$file->name,'ADDED','ok'); - if ( $this->getRequestVar('linkname') != '' ) - { - $link = new Link(); - $link->name = $this->getRequestVar('linkname'); - $link->parentid = $this->folder->objectid; - $link->isLinkToObject = false; - $link->url = $this->getRequestVar('linkname');; - $this->addNotice('link',$link->name,'ADDED','ok'); - $link->add(); - } - break; - - default: die('unknown type for creating'); - } $this->folder->setTimestamp(); $this->setTemplateVar('tree_refresh',true); @@ -232,11 +207,82 @@ class FolderAction extends ObjectAction } + + function createnewlink() + { + $type = $this->getRequestVar('type' ); + $name = $this->getRequestVar('name' ); + $filename = $this->getRequestVar('filename' ); + $description = $this->getRequestVar('description'); + + if ( !empty($name) ) + { + $link = new Link(); + $link->name = $name; + $link->desc = $description; + $link->parentid = $this->folder->objectid; + + $link->isLinkToObject = false; + $link->url = $this->getRequestVar('name'); + + $this->addNotice('link',$link->name,'ADDED','ok'); + + $link->add(); + } + + $this->folder->setTimestamp(); + } + + + + function createnewpage() + { + $type = $this->getRequestVar('type' ); + $name = $this->getRequestVar('name' ); + $filename = $this->getRequestVar('filename' ); + $description = $this->getRequestVar('description'); + + if ( $this->getRequestVar('name') != '' ) + { + $page = new Page(); + $page->name = $name; + $page->desc = $description; + $page->filename = $filename; + $page->templateid = $this->getRequestVar('templateid'); + $page->parentid = $this->folder->objectid; + + $this->addNotice('page',$page->name,'ADDED','ok'); + $page->add(); + } + + $this->folder->setTimestamp(); + } + + + /** * Abspeichern der Ordner-Eigenschaften. Ist der Schalter "delete" gesetzt, wird * der Ordner stattdessen gel?scht. */ - function save() + function saveprop() + { + // Ordnereigenschaften speichern + if ( $this->getRequestVar('name') != '' ) + $this->folder->name = $this->getRequestVar('name' ); + else $this->folder->name = $this->getRequestVar('filename'); + + $this->folder->filename = $this->getRequestVar('filename'); + $this->folder->desc = $this->getRequestVar('desc'); + $this->folder->save(); + $this->addNotice($this->folder->getType(),$this->folder->name,'PROP_SAVED','ok'); + } + + + /** + * Abspeichern der Ordner-Eigenschaften. Ist der Schalter "delete" gesetzt, wird + * der Ordner stattdessen gel?scht. + */ + function delete() { if ( $this->getRequestVar('delete') != '' ) { @@ -244,21 +290,6 @@ class FolderAction extends ObjectAction $this->folder->delete(); $this->addNotice($this->folder->getType(),$this->folder->name,lang('DELETED'),'ok'); } - else - { - // Ordnereigenschaften speichern - if ( $this->getRequestVar('name') != '' ) - $this->folder->name = $this->getRequestVar('name' ); - else $this->folder->name = $this->getRequestVar('filename'); - - $this->folder->filename = $this->getRequestVar('filename'); - $this->folder->desc = $this->getRequestVar('desc'); - $this->folder->save(); - $this->addNotice($this->folder->getType(),$this->folder->name,'PROP_SAVED','ok'); - } - - $this->setTemplateVar('tree_refresh',true); - $this->callSubAction('prop'); } @@ -566,10 +597,6 @@ class FolderAction extends ObjectAction function create() { $this->setTemplateVar('objectid' ,$this->folder->objectid ); - - $this->setWindowMenu('new'); - - $this->forward('folder_new'); } @@ -577,10 +604,6 @@ class FolderAction extends ObjectAction function createfolder() { $this->setTemplateVar('objectid' ,$this->folder->objectid ); - - $this->setWindowMenu('new'); - - $this->forward('folder_new_folder'); } @@ -588,20 +611,12 @@ class FolderAction extends ObjectAction function createfile() { $this->setTemplateVar('objectid' ,$this->folder->objectid ); - - $this->setWindowMenu('new'); - - $this->forward('folder_new_file'); } function createlink() { $this->setTemplateVar('objectid' ,$this->folder->objectid ); - - $this->setWindowMenu('new'); - - $this->forward('folder_new_link'); } @@ -609,10 +624,6 @@ class FolderAction extends ObjectAction { $this->setTemplateVar('templates' ,Template::getAll() ); $this->setTemplateVar('objectid' ,$this->folder->objectid ); - - $this->setWindowMenu('new'); - - $this->forward('folder_new_page'); } @@ -683,10 +694,6 @@ class FolderAction extends ObjectAction $this->setTemplateVar('object' ,$list ); $this->setTemplateVar('act_objectid',$this->folder->id); - - $this->setWindowMenu( 'show' ); - $this->forward('folder_show'); - } @@ -752,44 +759,25 @@ class FolderAction extends ObjectAction $this->setTemplateVar('orderbylastchange_url',Html::url('folder','reorder',0,array('type'=>'lastchange')) ); $this->setTemplateVar('object' ,$list ); $this->setTemplateVar('act_objectid',$this->folder->id); - $this->setWindowMenu( 'show' ); - - $this->forward('folder_order'); - } + + function showprop() + { + $this->setTemplateVars( $this->folder->getProperties() ); + } + + + function prop() { - if ( $this->folder->isRoot ) - $this->callSubAction('show'); - - if ( $this->folder->filename == $this->folder->objectid ) - $this->folder->filename = ''; + $this->setTemplateVars( $this->folder->getProperties() ); + } + function remove() + { $this->setTemplateVars( $this->folder->getProperties() ); - - // Alle Ordner ermitteln - $this->setTemplateVar('act_objectid',$this->folder->objectid); - - $list = array(); - $allsubfolders = $this->folder->getAllSubFolderIds(); - - foreach( $this->folder->getOtherFolders() as $id ) - { - $f = new Folder( $id ); - if ( ! in_array($id,$allsubfolders) ) - $list[$id] = implode( ' &raquo; ',$f->parentObjectNames(true,true) ); - } - asort( $list ); - $this->setTemplateVar('folder',$list); - - // Wenn Ordner leer ist, dann L?schen erm?glichen - if ( count($this->folder->getObjectIds()) == 0 ) - $this->setTemplateVar('delete',true ); - else $this->setTemplateVar('delete',false); - - $this->forward('folder_prop'); } @@ -833,42 +821,27 @@ class FolderAction extends ObjectAction - function setWindowMenu( $type ) { - - global $conf; - - switch( $type) + function checkMenu( $name ) + { + switch( $name) { - case 'new': - $menu = array(); - if ($this->folder->hasRight(ACL_CREATE_FOLDER) && count($this->folder->parentObjectIds(true,true)) < MAX_FOLDER_DEPTH ) - $menu[] = array('subaction'=>'createfolder','text'=>'folder_new_folder'); - - if ($this->folder->hasRight(ACL_CREATE_FILE)) - $menu[] = array('subaction'=>'createfile','text'=>'folder_new_file'); - - if ($this->folder->hasRight(ACL_CREATE_LINK)) - $menu[] = array('subaction'=>'createlink','text'=>'folder_new_link'); - - if ($this->folder->hasRight(ACL_CREATE_PAGE)) - $menu[] = array('subaction'=>'createpage','text'=>'folder_new_page'); + case 'createfolder': + return $this->folder->hasRight(ACL_CREATE_FOLDER) && count($this->folder->parentObjectIds(true,true)) < MAX_FOLDER_DEPTH; - $this->setTemplateVar('windowMenu',$menu); - break; + case 'createfile': + return $this->folder->hasRight(ACL_CREATE_FILE); - case 'acl': - $menu = array( array('subaction'=>'rights' ,'text'=>'show'), - array('subaction'=>'aclform','text'=>'add' ) ); - $this->setTemplateVar('windowMenu',$menu); - break; + case 'createlink': + return $this->folder->hasRight(ACL_CREATE_LINK); - case 'show': - $menu = array( array('subaction'=>'show' ,'text'=>'show'), - array('subaction'=>'order','text'=>'order' ) ); - $this->setTemplateVar('windowMenu',$menu); - break; + case 'createpage': + return $this->folder->hasRight(ACL_CREATE_PAGE); + case 'remove': + return count($this->folder->getObjectIds()) == 0; + + default: + return true; } } - } \ No newline at end of file diff --git a/actionClasses/FolderAction.ini.php b/actionClasses/FolderAction.ini.php @@ -6,22 +6,84 @@ goto=show menu=show [prop] +menu=prop +target=saveprop + +[saveprop] +goto=showprop + +[showprop] +menu=prop + +[remove] +menu=prop +target=delete + +[delete] +goto=show [order] +menu=show +; Die Aktionen "rights", "aclform", "addacl" und "delacl" sind +; für Seiten,Ordner,Links und Dateien identisch. [rights] +menu=rights + +[aclform] +menu=rights +target=addacl + +[addacl] +goto=rights + +[delacl] +goto=rights [pub] [create] +menu=new [createfolder] +target=createnewfolder +menu=new [createlink] +target=createnewlink +menu=new [createfile] +target=createnewfile +menu=new [createpage] +target=createnewpage +menu=new + +[createnewfolder] +goto=show + +[createnewfile] +goto=show + +[createnewpage] +goto=show + +[createnewlink] +goto=show + +[changesequence] +goto=order + +[settop] +goto=order + +[setbottom] +goto=order [menu] -show=show,order- \ No newline at end of file +show=show,order +new=createfolder,createfile,createpage,createlink +prop=showprop,prop,remove +rights=rights,aclform+ \ No newline at end of file diff --git a/actionClasses/LanguageAction.class.php b/actionClasses/LanguageAction.class.php @@ -20,7 +20,10 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // --------------------------------------------------------------------------- // $Log$ -// Revision 1.7 2004-12-25 20:50:13 dankert +// Revision 1.8 2006-01-29 17:18:59 dankert +// Steuerung der Aktionsklasse ?ber .ini-Datei, dazu umbenennen einzelner Methoden +// +// Revision 1.7 2004/12/25 20:50:13 dankert // Korrektur Sprach-Aenderung // // Revision 1.6 2004/12/19 14:55:00 dankert @@ -82,6 +85,11 @@ class LanguageAction extends Action */ function add() { + } + + + function addlanguage() + { global $conf; $countryList = $conf['countries']; @@ -92,8 +100,6 @@ class LanguageAction extends Action $language->isoCode = $iso; $language->name = $countryList[$iso]; $language->add(); - - $this->callSubAction( 'listing' ); } @@ -105,8 +111,6 @@ class LanguageAction extends Action function setdefault() { $this->language->setDefault(); - - $this->callSubAction( 'listing' ); } diff --git a/actionClasses/LanguageAction.ini.php b/actionClasses/LanguageAction.ini.php @@ -1,3 +1,36 @@ +[setdefault] +target=listing + +[listing] +menu=listing + [default] -goto=show +goto=listing + +[edit] +menu=edit +target=save + +[add] +menu=listing + +[remove] +menu=edit +target=delete + +[delete] +goto=listing + +[save] +goto=edit + +[addlanguage] +goto=listing + +[add] +target=addlanguage + +[menu] +listing=listing,add +edit=edit,remove+ \ No newline at end of file diff --git a/actionClasses/LinkAction.class.php b/actionClasses/LinkAction.class.php @@ -20,7 +20,10 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // --------------------------------------------------------------------------- // $Log$ -// Revision 1.7 2006-01-23 23:10:45 dankert +// Revision 1.8 2006-01-29 17:18:58 dankert +// Steuerung der Aktionsklasse ?ber .ini-Datei, dazu umbenennen einzelner Methoden +// +// Revision 1.7 2006/01/23 23:10:45 dankert // *** empty log message *** // // Revision 1.6 2004/12/20 22:04:25 dankert @@ -74,23 +77,49 @@ class LinkAction extends ObjectAction + function remove() + { + $this->setTemplateVars( $this->link->getProperties() ); + } + + + + function delete() + { + if ( $this->hasRequestVar("delete") ) + { + $this->link->delete(); + $this->addNotice('link',$this->link->name,'DELETED'); + } + } + + + /** * Abspeichern der Eigenschaften */ - function save() + function saveprop() { // Wenn Name gefuellt, dann Datenbank-Update if ( $this->getRequestVar('name') != '' ) { // Eigenschaften speichern - $this->link->name = $this->getRequestVar('name'); - $this->link->desc = $this->getRequestVar('desc'); + $this->link->name = $this->getRequestVar('name' ); + $this->link->desc = $this->getRequestVar('description'); $this->link->save(); $this->link->setTimestamp(); Session::setObject( $this->link ); } - elseif( $this->getRequestVar('type') != '' ) + } + + + /** + * Abspeichern der Eigenschaften + */ + function save() + { + if( $this->getRequestVar('type') != '' ) { if ( $this->getRequestVar('type') == 'link' ) { @@ -109,16 +138,12 @@ class LinkAction extends ObjectAction $this->link->setTimestamp(); Session::setObject( $this->link ); } - - $this->getRequestVar('tree_refresh',true); - - $this->callSubAction('prop'); } - function target() + function prop2() { -// $this->setTemplateVars( $this->link->getProperties() ); + $this->setTemplateVars( $this->link->getProperties() ); // Typ der Verkn?pfung $this->setTemplateVar('type' ,$this->link->getType() ); @@ -126,23 +151,18 @@ class LinkAction extends ObjectAction $this->setTemplateVar('url' ,$this->link->url ); $this->setTemplateVar('edittarget_url',Html::url('link','edittarget',$this->link->objectid)); - - $this->forward('link_target'); } - function prop() + function showprop() { $this->setTemplateVars( $this->link->getProperties() ); - $this->setTemplateVar('editprop_url' ,Html::url('link','editprop',$this->link->objectid)); - - $this->forward('link_prop'); } - function edittarget() + function edit() { $this->setTemplateVars( $this->link->getProperties() ); @@ -178,12 +198,11 @@ class LinkAction extends ObjectAction - function editprop() + function prop() { $this->setTemplateVars( $this->link->getProperties() ); +// print_r($this->link->getProperties()); $this->setTemplateVar('act_linkobjectid',$this->link->linkedObjectId); - - $this->forward('link_editprop'); } } \ No newline at end of file diff --git a/actionClasses/LinkAction.ini.php b/actionClasses/LinkAction.ini.php @@ -1,3 +1,47 @@ [default] -goto=show +goto=showprop + +[showprop] +menu=prop + +[saveprop] +goto=showprop + +[save] +goto=showprop + +[prop] +menu=prop +target=saveprop + +[edit] +menu=edit +target=save + +[rights] + +[delete] +goto=showprop + +[remove] +menu=prop +target=delete + +[rights] +menu=rights + +[aclform] +menu=rights +target=addacl + +[addacl] +goto=rights + +[delacl] +goto=rights + +[menu] +edit=edit,remove +prop=showprop,prop,remove +rights=rights,aclform+ \ No newline at end of file diff --git a/actionClasses/MainmenuAction.class.php b/actionClasses/MainmenuAction.class.php @@ -37,7 +37,27 @@ class MainmenuAction extends Action function element() { $this->subActionName = 'template'; - $this->callSubAction('template'); + + $element = new Element( $this->getRequestId() ); + $element->load(); + + global $REQ; + $REQ['id'] = $element->templateid; + + $template = new Template( $element->templateid ); + $template->load(); + + $this->setTemplateVar('text',$template->name ); + + $this->addSubaction('listing'); + $this->addSubaction('show' ); + $this->addSubaction('edit' ); + $this->addSubaction('el' ); + if ( $this->writable ) + $this->addSubaction('src' ); + $this->addSubaction('prop' ); + + $this->setTemplateVar('windowMenu',$this->subActionList); } @@ -73,15 +93,11 @@ class MainmenuAction extends Action $this->addSubaction('show' ); $this->addSubaction('edit' ); $this->addSubaction('el' ); - if ( $this->writable ) - $this->addSubaction('src' ); $this->addSubaction('prop' ); } $this->setTemplateVar('param' ,'templateid'); $this->setTemplateVar('windowMenu',$this->subActionList); - - $this->callSubAction('show'); } @@ -92,6 +108,8 @@ class MainmenuAction extends Action $this->callSubAction('page'); } + + function page() { $page = Session::getObject(); @@ -136,8 +154,6 @@ class MainmenuAction extends Action $this->addSubAction('rights',ACL_GRANT ); $this->setTemplateVar('windowMenu',$this->subActionList); - - $this->callSubAction('show'); } @@ -166,8 +182,6 @@ class MainmenuAction extends Action $this->setTemplateVar('windowMenu',$this->subActionList); $this->setTemplateVar('param' ,'userid' ); - - $this->callSubAction('show'); } @@ -190,7 +204,6 @@ class MainmenuAction extends Action $this->setTemplateVar('windowMenu',$this->subActionList); $this->setTemplateVar('param' ,'groupid' ); - $this->callSubAction('show'); } @@ -225,8 +238,6 @@ class MainmenuAction extends Action $this->setTemplateVar('windowMenu',$this->subActionList); $this->setTemplateVar('param','objectid'); - - $this->callSubAction('show'); } @@ -237,8 +248,6 @@ class MainmenuAction extends Action $this->setTemplateVar('windowMenu',$this->subActionList); $this->setTemplateVar('param','conf'); - - $this->callSubAction('show'); } @@ -263,14 +272,12 @@ class MainmenuAction extends Action $this->setTemplateVar('id','o'.$link->objectid); $this->obj = &$link; - $this->addSubAction('target',ACL_WRITE); + $this->addSubAction('edit' ,ACL_WRITE); $this->addSubAction('prop' ,ACL_PROP ); $this->addSubAction('rights',ACL_GRANT); $this->setTemplateVar('windowMenu',$this->subActionList); $this->setTemplateVar('param','objectid'); - - $this->callSubAction('show'); } @@ -311,8 +318,6 @@ class MainmenuAction extends Action $this->setTemplateVar('windowMenu',$this->subActionList); $this->setTemplateVar('param','objectid'); - - $this->callSubAction('show'); } @@ -337,8 +342,6 @@ class MainmenuAction extends Action $this->setTemplateVar('windowMenu',$this->subActionList); $this->setTemplateVar('param','projectid'); - - $this->callSubAction('show'); } @@ -348,8 +351,6 @@ class MainmenuAction extends Action $this->setTemplateVar('windowMenu',$this->subActionList); $this->setTemplateVar('param','languageid'); - - $this->callSubAction('show'); } @@ -359,8 +360,6 @@ class MainmenuAction extends Action $this->addSubaction('listing'); $this->setTemplateVar('windowMenu',$this->subActionList); $this->setTemplateVar('param','modelid'); - - $this->callSubAction('show'); } @@ -369,8 +368,6 @@ class MainmenuAction extends Action $this->setTemplateVar('windowMenu',array('prop' =>lang('SEARCH_PROP' ), 'content'=>lang('SEARCH_CONTENT' ) )); $this->setTemplateVar('param','objectid'); - - $this->callSubAction('show'); } @@ -378,8 +375,6 @@ class MainmenuAction extends Action { $this->addSubaction('import'); $this->setTemplateVar('windowMenu',$this->subActionList); - - $this->callSubAction('show'); } @@ -396,8 +391,6 @@ class MainmenuAction extends Action $this->setTemplateVar('type' ,$this->getRequestVar( 'subaction') ); $this->setTemplateVar('path' ,$this->path ); - - $this->forward( 'menu' ); } } diff --git a/actionClasses/MainmenuAction.ini.php b/actionClasses/MainmenuAction.ini.php @@ -3,31 +3,46 @@ goto=show [element] +goto=show [file] +goto=show [folder] +goto=show [group] +goto=show [language] +goto=show [link] +goto=show [model] +goto=show [page] +goto=show [pageelement] +goto=show [project] +goto=show [search] +goto=show [show] +goto=show [template] +goto=show [transfer] +goto=show [user] +goto=show diff --git a/actionClasses/ModelAction.class.php b/actionClasses/ModelAction.class.php @@ -20,7 +20,10 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // --------------------------------------------------------------------------- // $Log$ -// Revision 1.5 2004-12-19 14:55:27 dankert +// Revision 1.6 2006-01-29 17:18:58 dankert +// Steuerung der Aktionsklasse ?ber .ini-Datei, dazu umbenennen einzelner Methoden +// +// Revision 1.5 2004/12/19 14:55:27 dankert // Anpassung von urls // // Revision 1.4 2004/12/13 22:17:51 dankert @@ -64,39 +67,57 @@ class ModelAction extends Action function add() { + } + + + function addmodel() + { $model = new Model(); $model->projectid = $this->project->projectid; $model->name = $this->getRequestVar('name'); $model->add(); - - $this->callSubAction('listing'); + + // Wenn kein Namen eingegeben, dann einen setzen. + if ( empty($model->name) ) + { + // Name ist "Variante <id>" + $model->name = lang('GLOBAL_MODEL').' '.$model->modelid; + $model->save(); + } } + function remove() + { + } + + + function delete() + { + if ( $this->getRequestVar('delete') != '' ) + { + $this->model->delete(); + } + } + + + // Speichern eines Modells function save() { if ( $this->getRequestVar('name') != '' ) { - if ( $this->getRequestVar('delete') != '' ) - { - $this->model->delete(); - - $this->callSubAction('listing'); - } - else - { - $this->model->name = $this->getRequestVar('name'); - $this->model->save(); - - $this->callSubAction('listing'); - } + $this->model->name = $this->getRequestVar('name'); + $this->model->save(); + $this->addNotice('model',$this->model->name,'SAVED','ok'); + } + else + { + $this->addNotice('model',$this->model->name,'NOT_SAVED','error'); } // Baum aktualisieren - $this->setTemplateVar('tree_refresh',true); - - $this->callSubAction('listing'); +// $this->setTemplateVar('tree_refresh',true); } diff --git a/actionClasses/ModelAction.ini.php b/actionClasses/ModelAction.ini.php @@ -0,0 +1,36 @@ + +[default] +goto=listing + +[setdefault] +target=listing + +[listing] +menu=listing + +[edit] +menu=edit +target=save + +[add] +menu=listing + +[remove] +menu=edit +target=delete + +[delete] +goto=listing + +[save] +goto=edit + +[addmodel] +goto=listing + +[add] +target=addmodel + +[menu] +listing=listing,add +edit=edit,remove+ \ No newline at end of file diff --git a/actionClasses/PageAction.class.php b/actionClasses/PageAction.class.php @@ -297,19 +297,17 @@ class PageAction extends ObjectAction /** * Eigenschaften der Seite speichern */ - function propsave() + function saveprop() { if ( $this->getRequestVar('name')!='' ) { - $this->page->name = $this->getRequestVar('name' ); - $this->page->filename = $this->getRequestVar('filename'); - $this->page->desc = $this->getRequestVar('desc' ); + $this->page->name = $this->getRequestVar('name' ); + $this->page->filename = $this->getRequestVar('filename' ); + $this->page->desc = $this->getRequestVar('description'); $this->page->save(); $this->addNotice($this->page->getType(),$this->page->name,'PROP_SAVED','ok'); } - - $this->callSubAction('prop'); } @@ -320,7 +318,7 @@ class PageAction extends ObjectAction * Es wird ein Formualr erzeugt, in dem der Benutzer auswaehlen kann, welche Elemente * in welches Element uebernommen werden sollen */ - function replacetemplateselectelements() + function changetemplateselectelements() { $newTemplateId = intval($this->getRequestVar('templateid')); @@ -374,7 +372,7 @@ class PageAction extends ObjectAction * * Die Vorlage wird ausgetauscht, die Inhalte werden gemaess der Benutzereingaben kopiert */ - function replaceTemplate() + function replacetemplate() { $newTemplateId = intval($this->getRequestVar('newTemplateId')); $replaceElementMap = Array(); @@ -389,8 +387,6 @@ class PageAction extends ObjectAction { $this->page->replaceTemplate( $newTemplateId,$replaceElementMap ); } - - $this->callSubAction('prop'); } @@ -423,18 +419,14 @@ class PageAction extends ObjectAction $list[$id]['date' ] = date( lang('DATE_FORMAT'),$value->lastchangeTimeStamp); $list[$id]['archive_count'] = $value->getCountVersions(); $list[$id]['archive_url' ] = Html::url( 'pageelement','archive','0',array('elementid'=>$id) ); - $list[$id]['url' ] = Html::url( 'pageelement','edit' ,'0',array('elementid'=>$id) ); + $list[$id]['url' ] = Html::url( 'pageelement','edit'.$value->element->type,'0',array('elementid'=>$id) ); // Maximal 50 Stellen des Inhaltes anzeigen $list[$id]['value'] = Text::maxLaenge( 50,$value->value ); } } - $this->setWindowMenu( 'elements' ); - $this->setTemplateVar('el',$list); - $this->forward('page_element'); - } @@ -549,6 +541,9 @@ class PageAction extends ObjectAction require( $this->page->tmpfile ); unlink( $this->page->tmpfile ); + + // Inhalt ist ausgegeben... Skript beenden. + exit; } @@ -568,6 +563,8 @@ class PageAction extends ObjectAction $this->page->write(); require( $this->page->tmpfile() ); + // Inhalt ist ausgegeben... Skript beenden. + exit; } @@ -589,8 +586,6 @@ class PageAction extends ObjectAction $src = preg_replace( '|([a-zA-Z]+)="(.+)"|Us' , '<em>$1</em>=<var>"$2"</var>' , $src); //$var['src'] = htmlentities($src); $this->setTemplateVar('src',$src); - - $this->forward('page_src'); } @@ -649,6 +644,61 @@ class PageAction extends ObjectAction /** + * Die Eigenschaften der Seite anzeigen + */ + function showprop() + { + $this->page->public = true; + $this->page->load(); + $this->page->full_filename(); + + $this->setTemplateVars( $this->page->getProperties() ); + + if ( $this->userIsAdmin() ) + { + $this->setTemplateVar('template_url',Html::url('main','template',$this->page->templateid)); + } + + $template = new Template( $this->page->templateid ); + $template->load(); + $this->setTemplateVar('template_name',$template->name); + } + + + + /** + * Die Eigenschaften der Seite anzeigen + */ + function changetemplate() + { + $this->page->public = true; + $this->page->load(); + + $this->setTemplateVars( $this->page->getProperties() ); + + if ( $this->userIsAdmin() ) + { + $this->setTemplateVar('template_url',Html::url('main','template',$this->page->templateid)); + } + + $template = new Template( $this->page->templateid ); + $template->load(); + $this->setTemplateVar('template_name',$template->name); + + $templates = Array(); + foreach( Template::getAll() as $id=>$name ) + { + if ( $id != $this->page->templateid ) + $templates[$id]=$name; + } + $this->setTemplateVar('templates',$templates); + } + + + + + + /** * Seite veroeffentlichen * * Es wird ein Formular angzeigt, mit dem die Seite veroeffentlicht diff --git a/actionClasses/PageAction.ini.php b/actionClasses/PageAction.ini.php @@ -2,16 +2,66 @@ [default] goto=show +[remove] +menu=prop +target=delete + +[delete] +target=prop + [show] [edit] [el] +menu=elements +[form] +menu=elements [pub] +[saveprop] +goto=showprop + +[showprop] +menu=prop + [prop] +menu=prop +target=saveprop + +[changetemplate] +menu=prop +target=changetemplateselectelements + +[changetemplateselectelements] +menu=prop +target=replacetemplate + +[replacetemplate] +goto=showprop [src] +menu=src + +; Die Aktionen "rights", "aclform", "addacl" und "delacl" sind +; für Seiten,Ordner,Links und Dateien identisch. +[rights] +menu=rights + +[aclform] +menu=rights +target=addacl + +[addacl] +goto=rights + +[delacl] +goto=rights + -[rights]- \ No newline at end of file +[menu] +elements=el,form +rights=rights,aclform +src=src +prop=showprop,prop,changetemplate+ \ No newline at end of file diff --git a/actionClasses/PageelementAction.class.php b/actionClasses/PageelementAction.class.php @@ -20,7 +20,10 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // --------------------------------------------------------------------------- // $Log$ -// Revision 1.18 2005-01-27 00:02:47 dankert +// Revision 1.19 2006-01-29 17:18:59 dankert +// Steuerung der Aktionsklasse ?ber .ini-Datei, dazu umbenennen einzelner Methoden +// +// Revision 1.18 2005/01/27 00:02:47 dankert // Immer Objektid an das Template liefern // // Revision 1.17 2005/01/23 00:09:25 dankert @@ -134,12 +137,13 @@ class PageelementAction extends Action } + /** * Ein Element der Seite bearbeiten * * Es wird ein Formular erzeugt, mit dem der Benutzer den Inhalt bearbeiten kann. */ - function edit() + function initedit() { $language = Session::getProjectLanguage(); $this->value->languageid = $language->languageid; @@ -156,7 +160,165 @@ class PageelementAction extends Action $this->setTemplateVar('name' ,$this->value->element->name ); $this->setTemplateVar('desc' ,$this->value->element->desc ); $this->setTemplateVar('elementid',$this->value->element->elementid); + } + + + + function editdate() + { + $this->initedit(); + + $date = $this->value->date; + + // Wenn Datum nicht vorhanden, dann aktuelles Datum verwenden + if ( $date == 0 ) + $date = intval(time()/60)*60; + + $this->setTemplateVar('ansidate',date( 'Y-m-d H:i:s',$date ) ); + $this->setTemplateVar('date' ,$date); + + + + + + if ( $this->getSessionVar('pageaction') != '' ) + $this->setTemplateVar('old_pageaction',$this->getSessionVar('pageaction')); + else $this->setTemplateVar('old_pageaction','show' ); + + $this->value->page = new Page( $this->page->objectid ); + $this->value->page->languageid = $this->value->languageid; + $this->value->page->load(); + + $this->setTemplateVar( 'release',$this->value->page->hasRight(ACL_RELEASE) ); + $this->setTemplateVar( 'publish',$this->value->page->hasRight(ACL_PUBLISH) ); + + $this->setTemplateVar( 'objectid',$this->value->page->objectid ); + + $this->forward('pageelement_edit_'.$this->value->element->type); + } + + + + function editdatecalendar() + { + $this->initedit(); + + $date = $this->value->date; + + // Wenn Datum nicht vorhanden, dann aktuelles Datum verwenden + if ( $date == 0 ) + $date = time(); + + if ( $this->getRequestVar('year') != '' ) + { + $date = mktime( $this->getRequestVar('hour'), + $this->getRequestVar('minute'), + $this->getRequestVar('second'), + $this->getRequestVar('month'), + $this->getRequestVar('day'), + $this->getRequestVar('year') ); + } + $this->setTemplateVar('year' ,date('Y',$date) ); + $this->setTemplateVar('month' ,date('n',$date) ); + $this->setTemplateVar('day' ,date('j',$date) ); + $this->setTemplateVar('hour' ,date('G',$date) ); + $this->setTemplateVar('minute',date('i',$date) ); + $this->setTemplateVar('second',date('s',$date) ); + + $this->setTemplateVar('days' ,date('t',$date) ); + + $this->setTemplateVar('title' ,lang('DATE_MONTH'.date('n',$date)).' '.date('Y',$date) ); + + // Wochentag des 1. des Monats ermitteln + $wday1 = date( 'w',$date ); + $wday1 -= date('j',$date)-1; + while( $wday1 < 0 ) $wday1+=7; + $this->setTemplateVar('first_weekday',$wday1); + + $this->setTemplateVar('actdate' ,date( lang('DATE_FORMAT'),$date ) ); + $this->setTemplateVar('todayurl','?year='.date('Y').'&month='.date('m').'&day='.date('d').'&hour='.date('H').'&minute='.date('i').'&second='.date('s') ); + $this->setTemplateVar('ansidate',date( 'Y-m-d H:i:s',$date ) ); + $this->setTemplateVar('date' ,$date); + + + + if ( $this->getSessionVar('pageaction') != '' ) + $this->setTemplateVar('old_pageaction',$this->getSessionVar('pageaction')); + else $this->setTemplateVar('old_pageaction','show' ); + $this->value->page = new Page( $this->page->objectid ); + $this->value->page->languageid = $this->value->languageid; + $this->value->page->load(); + + $this->setTemplateVar( 'release',$this->value->page->hasRight(ACL_RELEASE) ); + $this->setTemplateVar( 'publish',$this->value->page->hasRight(ACL_PUBLISH) ); + + $this->setTemplateVar( 'objectid',$this->value->page->objectid ); + + $this->forward('pageelement_edit_'.$this->value->element->type); + } + + + + function editdateform() + { + $this->initedit(); + + $date = $this->value->date; + + // Wenn Datum nicht vorhanden, dann aktuelles Datum verwenden + if ( $date == 0 ) + $date = intval(time()/60)*60; + + $this->setTemplateVar('date' ,$date); + + $this->setTemplateVar('year' ,date('Y',$date) ); + $this->setTemplateVar('month' ,date('n',$date) ); + $this->setTemplateVar('day' ,date('j',$date) ); + $this->setTemplateVar('hour' ,date('G',$date) ); + $this->setTemplateVar('minute',date('i',$date) ); + $this->setTemplateVar('second',date('s',$date) ); + + $all_years = array(); + $all_months = array(); + $all_days = array(); + $all_hours = array(); + $all_minutes = array(); + for( $i=1850; $i<=2100;$i++ ) $all_years [$i] = $i; + for( $i=1; $i<=12; $i++ ) $all_months [$i] = lang('DATE_MONTH'.$i); + for( $i=1; $i<=31; $i++ ) $all_days [$i] = str_pad($i,2,'0',STR_PAD_LEFT); + for( $i=0; $i<=23; $i++ ) $all_hours [$i] = str_pad($i,2,'0',STR_PAD_LEFT); + for( $i=0; $i<=59; $i++ ) $all_minutes[$i] = str_pad($i,2,'0',STR_PAD_LEFT); + + $this->setTemplateVar('all_years' ,$all_years ); + $this->setTemplateVar('all_months' ,$all_months ); + $this->setTemplateVar('all_days' ,$all_days ); + $this->setTemplateVar('all_hours' ,$all_hours ); + $this->setTemplateVar('all_minutes',$all_minutes); + $this->setTemplateVar('all_seconds',$all_minutes); + + + + if ( $this->getSessionVar('pageaction') != '' ) + $this->setTemplateVar('old_pageaction',$this->getSessionVar('pageaction')); + else $this->setTemplateVar('old_pageaction','show' ); + + $this->value->page = new Page( $this->page->objectid ); + $this->value->page->languageid = $this->value->languageid; + $this->value->page->load(); + + $this->setTemplateVar( 'release',$this->value->page->hasRight(ACL_RELEASE) ); + $this->setTemplateVar( 'publish',$this->value->page->hasRight(ACL_PUBLISH) ); + + $this->setTemplateVar( 'objectid',$this->value->page->objectid ); + + $this->forward('pageelement_edit_'.$this->value->element->type); + } + + + + function asdfasdf() + { // Auswahl ueber alle Elementtypen switch( $this->value->element->type ) { @@ -331,6 +493,216 @@ class PageelementAction extends Action + function editlink() + { + $this->initedit(); + + $objects = array(); + + foreach( Folder::getAllObjectIds() as $id ) + { + $o = new Object( $id ); + $o->load(); + + if ( $o->getType() != 'folder' ) + { + $f = new Folder( $o->parentid ); +// $f->load(); + + $objects[ $id ] = lang( 'GLOBAL_'.$o->getType() ).': '; + $objects[ $id ] .= implode( FILE_SEP,$f->parentObjectNames(false,true) ); + $objects[ $id ] .= FILE_SEP.$o->name; + } + } + + asort( $objects ); // Sortieren + + $this->setTemplateVar('objects' ,$objects); + $this->setTemplateVar('linkobjectid',$this->value->linkToObjectId); + + if ( $this->getSessionVar('pageaction') != '' ) + $this->setTemplateVar('old_pageaction',$this->getSessionVar('pageaction')); + else $this->setTemplateVar('old_pageaction','show' ); + + $this->value->page = new Page( $this->page->objectid ); + $this->value->page->languageid = $this->value->languageid; + $this->value->page->load(); + + $this->setTemplateVar( 'release',$this->value->page->hasRight(ACL_RELEASE) ); + $this->setTemplateVar( 'publish',$this->value->page->hasRight(ACL_PUBLISH) ); + + $this->setTemplateVar( 'objectid',$this->value->page->objectid ); + + $this->forward('pageelement_edit_'.$this->value->element->type); + } + + + + function editselect() + { + $this->initedit(); + + $this->setTemplateVar( 'items',$this->value->element->getSelectItems() ); + $this->setTemplateVar( 'text' ,$this->value->text ); + + + if ( $this->getSessionVar('pageaction') != '' ) + $this->setTemplateVar('old_pageaction',$this->getSessionVar('pageaction')); + else $this->setTemplateVar('old_pageaction','show' ); + + $this->value->page = new Page( $this->page->objectid ); + $this->value->page->languageid = $this->value->languageid; + $this->value->page->load(); + + $this->setTemplateVar( 'release',$this->value->page->hasRight(ACL_RELEASE) ); + $this->setTemplateVar( 'publish',$this->value->page->hasRight(ACL_PUBLISH) ); + + $this->setTemplateVar( 'objectid',$this->value->page->objectid ); + + $this->forward('pageelement_edit_'.$this->value->element->type); + } + + + + function editlist() + { + $this->initedit(); + // Auswahl ueber alle Elementtypen + $objects = array(); + foreach( Folder::getAllFolders() as $id ) + { + $f = new Folder( $id ); + $f->load(); + + $objects[ $id ] = lang( 'GLOBAL_'.$f->getType() ).': '; + $objects[ $id ] .= implode( ' &raquo; ',$f->parentObjectNames(false,true) ); + } + + asort( $objects ); // Sortieren + + $this->setTemplateVar('objects' ,$objects); + $this->setTemplateVar('linkobjectid',$this->value->linkToObjectId); + + + if ( $this->getSessionVar('pageaction') != '' ) + $this->setTemplateVar('old_pageaction',$this->getSessionVar('pageaction')); + else $this->setTemplateVar('old_pageaction','show' ); + + $this->value->page = new Page( $this->page->objectid ); + $this->value->page->languageid = $this->value->languageid; + $this->value->page->load(); + + $this->setTemplateVar( 'release',$this->value->page->hasRight(ACL_RELEASE) ); + $this->setTemplateVar( 'publish',$this->value->page->hasRight(ACL_PUBLISH) ); + + $this->setTemplateVar( 'objectid',$this->value->page->objectid ); + + $this->forward('pageelement_edit_'.$this->value->element->type); + } + + + + function editnumber() + { + $this->initedit(); + + $this->setTemplateVar('number',$this->value->number / pow(10,$this->value->element->decimals) ); + + if ( $this->getSessionVar('pageaction') != '' ) + $this->setTemplateVar('old_pageaction',$this->getSessionVar('pageaction')); + else $this->setTemplateVar('old_pageaction','show' ); + + $this->value->page = new Page( $this->page->objectid ); + $this->value->page->languageid = $this->value->languageid; + $this->value->page->load(); + + $this->setTemplateVar( 'release',$this->value->page->hasRight(ACL_RELEASE) ); + $this->setTemplateVar( 'publish',$this->value->page->hasRight(ACL_PUBLISH) ); + + $this->setTemplateVar( 'objectid',$this->value->page->objectid ); + + $this->forward('pageelement_edit_'.$this->value->element->type); + } + + + + /** + * Ein Element der Seite bearbeiten + * + * Es wird ein Formular erzeugt, mit dem der Benutzer den Inhalt bearbeiten kann. + */ + function editlongtext() + { + $this->initedit(); + + // Ermitteln aller verlinkbaren Objekte (fuer Editor) + $objects = array(); + + foreach( Folder::getAllObjectIds() as $id ) + { + $o = new Object( $id ); + $o->load(); + + if ( $o->getType() != 'folder' ) + { + $f = new Folder( $o->parentid ); + $objects[ $id ] = lang( 'GLOBAL_'.$o->getType() ).': '; + $objects[ $id ] .= implode( FILE_SEP,$f->parentObjectNames(false,true) ); + $objects[ $id ] .= FILE_SEP.$o->name; + } + } + asort( $objects ); // Sortieren + + $this->setTemplateVar( 'objects',$objects ); + $this->setTemplateVar( 'images' ,$objects ); + + $this->setTemplateVar( 'html',$this->value->element->html ); + $this->setTemplateVar( 'wiki',$this->value->element->wiki ); + $this->setTemplateVar( 'text',$this->value->text ); + + if ( $this->getSessionVar('pageaction') != '' ) + $this->setTemplateVar('old_pageaction',$this->getSessionVar('pageaction')); + else $this->setTemplateVar('old_pageaction','show' ); + + $this->value->page = new Page( $this->page->objectid ); + $this->value->page->languageid = $this->value->languageid; + $this->value->page->load(); + + $this->setTemplateVar( 'release',$this->value->page->hasRight(ACL_RELEASE) ); + $this->setTemplateVar( 'publish',$this->value->page->hasRight(ACL_PUBLISH) ); + + $this->setTemplateVar( 'objectid',$this->value->page->objectid ); + } + + + + /** + * Ein Element der Seite bearbeiten + * + * Es wird ein Formular erzeugt, mit dem der Benutzer den Inhalt bearbeiten kann. + */ + function edittext() + { + $this->initedit(); + + $this->setTemplateVar( 'text',$this->value->text ); + + if ( $this->getSessionVar('pageaction') != '' ) + $this->setTemplateVar('old_pageaction',$this->getSessionVar('pageaction')); + else $this->setTemplateVar('old_pageaction','show' ); + + $this->value->page = new Page( $this->page->objectid ); + $this->value->page->languageid = $this->value->languageid; + $this->value->page->load(); + + $this->setTemplateVar( 'release',$this->value->page->hasRight(ACL_RELEASE) ); + $this->setTemplateVar( 'publish',$this->value->page->hasRight(ACL_PUBLISH) ); + + $this->setTemplateVar( 'objectid',$this->value->page->objectid ); + } + + + /** * Benutzen eines alten Inhaltes */ @@ -440,8 +812,8 @@ class PageelementAction extends Action */ function diff() { - $value1id = $this->getRequestVar('value1id'); - $value2id = $this->getRequestVar('value2id'); + $value1id = $this->getRequestVar('compareid'); + $value2id = $this->getRequestVar('withid' ); // Wenn Value1-Id groesser als Value2-Id, dann Variablen tauschen if ( $value1id > $value2id ) @@ -654,6 +1026,336 @@ class PageelementAction extends Action return( array($from_out,$to_out) ); } + + + + /** + * Element speichern + * + * Der Inhalt eines Elementes wird abgespeichert + */ + function savetext() + { + $value = new Value(); + $language = Session::getProjectLanguage(); + $value->languageid = $language->languageid; + $value->objectid = $this->page->objectid; + $value->pageid = Page::getPageIdFromObjectId( $this->page->objectid ); + + if ( $this->hasRequestVar('elementid') ) + $value->element = new Element( $this->getRequestVar('elementid') ); + else + $value->element = Session::getElement(); + + $value->element->load(); + $value->publish = false; + $value->load(); + + $value->text = $this->getRequestVar('text'); + + $this->afterSave($value); + } + + + + function afterSave( $value ) + { + $value->page = new Page( $value->objectid ); + $value->page->load(); + + // Inhalt sofort freigegeben, wenn + // - Recht vorhanden + // - Freigabe gewuenscht + if ( $value->page->hasRight( ACL_RELEASE ) && $this->getRequestVar('release')!='' ) + $value->publish = true; + else + $value->publish = false; + + // Inhalt speichern + + // Wenn Inhalt in allen Sprachen gleich ist, dann wird der Inhalt + // fuer jede Sprache einzeln gespeichert. + if ( $value->element->allLanguages ) + { + $project = Session::getProject(); + foreach( $project->getLanguageIds() as $languageid ) + { + $value->languageid = $languageid; + $value->save(); + } + } + else + { + // sonst nur 1x speichern (fuer die aktuelle Sprache) + $value->save(); + } + + $this->page->setTimestamp(); // "Letzte Aenderung" setzen + +// // Falls ausgewaehlt die Seite sofort veroeffentlichen +// if ( $this->hasRequestVar('publish') ) +// $this->callSubAction( 'pubnow' ); // Weiter zum veroeffentlichen +// else +// $this->callSubAction( 'el' ); // Element-Liste anzeigen + } + + + /** + * Element speichern + * + * Der Inhalt eines Elementes wird abgespeichert + */ + function savelongtext() + { + $value = new Value(); + $language = Session::getProjectLanguage(); + $value->languageid = $language->languageid; + $value->objectid = $this->page->objectid; + $value->pageid = Page::getPageIdFromObjectId( $this->page->objectid ); + + if ( $this->hasRequestVar('elementid') ) + $value->element = new Element( $this->getRequestVar('elementid') ); + else + $value->element = Session::getElement(); + + $value->element->load(); + $value->publish = false; + $value->load(); + + $value->text = $this->getRequestVar('text'); + + // Vorschau anzeigen + if ( $value->element->type=='longtext' && ($this->hasRequestVar('preview')||$this->hasRequestVar('addmarkup')) ) + { + if ( $this->hasRequestVar('preview') ) + { + $value->page = $this->page; + $value->simple = false; + $value->page->languageid = $value->languageid; + $value->page->load(); + $value->generate(); + $this->setTemplateVar('preview_text',$value->value ); + } + + if ( $this->hasRequestVar('addmarkup') ) + { + $addText = $this->getRequestVar('addtext'); + + if ( !empty($addText) ) // Nur, wenn ein Text eingegeben wurde + { + $addText = $this->getRequestVar('addtext'); + + if ( $this->hasRequestVar('strong') ) + $value->text .= '*'.$addText.'*'; + + if ( $this->hasRequestVar('emphatic') ) + $value->text .= '_'.$addText.'_'; + + if ( $this->hasRequestVar('link') ) + $value->text .= '"'.$addText.'"->"'.$this->getRequestVar('objectid').'"'; + } + + if ( $this->hasRequestVar('table') ) + $value->text .= "|$addText | |\n|$addText | |\n|$addText | |\n"; + + if ( $this->hasRequestVar('list') ) + $value->text .= "\n- ".$addText."\n".'- '.$addText."\n".'- '.$addText."\n"; + + if ( $this->hasRequestVar('numlist') ) + $value->text .= "\n# ".$addText."\n".'# '.$addText."\n".'# '.$addText."\n"; + + if ( $this->hasRequestVar('image') ) + $value->text .= '{'.$this->getRequestVar('objectid').'}'; + } + + // Ermitteln aller verlinkbaren Objekte (fuer Editor) + $objects = array(); + + foreach( Folder::getAllObjectIds() as $id ) + { + $o = new Object( $id ); + $o->load(); + + if ( $o->getType() != 'folder' ) + { + $f = new Folder( $o->parentid ); + $objects[ $id ] = lang( 'GLOBAL_'.$o->getType() ).': '; + $objects[ $id ] .= implode( FILE_SEP,$f->parentObjectNames(false,true) ); + $objects[ $id ] .= FILE_SEP.$o->name; + } + } + asort($objects); + $this->setTemplateVar( 'objects' ,$objects ); + + $this->setTemplateVar( 'release' ,$this->page->hasRight(ACL_RELEASE) ); + $this->setTemplateVar( 'publish' ,$this->page->hasRight(ACL_PUBLISH) ); + $this->setTemplateVar( 'html' ,$value->element->html ); + $this->setTemplateVar( 'wiki' ,$value->element->wiki ); + $this->setTemplateVar( 'text' ,$value->text ); + $this->setTemplateVar( 'name' ,$value->element->name ); + $this->setTemplateVar( 'desc' ,$value->element->desc ); + $this->setTemplateVar( 'objectid',$this->page->objectid ); + $this->forward( 'pageelement_edit_longtext' ); + } + + $this->afterSave($value); + } + + + /** + * Element speichern + * + * Der Inhalt eines Elementes wird abgespeichert + */ + function savedate() + { + $value = new Value(); + $language = Session::getProjectLanguage(); + $value->languageid = $language->languageid; + $value->objectid = $this->page->objectid; + $value->pageid = Page::getPageIdFromObjectId( $this->page->objectid ); + + if ( $this->hasRequestVar('elementid') ) + $value->element = new Element( $this->getRequestVar('elementid') ); + else + $value->element = Session::getElement(); + + $value->element->load(); + $value->publish = false; + $value->load(); + + // Wenn ein ANSI-Datum eingegeben wurde, dann dieses verwenden + if ( $this->getRequestVar('ansidate') != $this->getRequestVar('ansidate_orig') ) + $value->date = strtotime($this->getRequestVar('ansidate') ); + else + // Sonst die Zeitwerte einzeln zu einem Datum zusammensetzen + $value->date = mktime( $this->getRequestVar('hour' ), + $this->getRequestVar('minute'), + $this->getRequestVar('second'), + $this->getRequestVar('month' ), + $this->getRequestVar('day' ), + $this->getRequestVar('year' ) ); + + $this->afterSave($value); + } + + + + /** + * Element speichern + * + * Der Inhalt eines Elementes wird abgespeichert + */ + function saveselect() + { + $value = new Value(); + $language = Session::getProjectLanguage(); + $value->languageid = $language->languageid; + $value->objectid = $this->page->objectid; + $value->pageid = Page::getPageIdFromObjectId( $this->page->objectid ); + + if ( $this->hasRequestVar('elementid') ) + $value->element = new Element( $this->getRequestVar('elementid') ); + else + $value->element = Session::getElement(); + + $value->element->load(); + $value->publish = false; + $value->load(); + + $value->text = $this->getRequestVar('text'); + + $this->afterSave($value); + } + + + + /** + * Element speichern + * + * Der Inhalt eines Elementes wird abgespeichert + */ + function savelink() + { + $value = new Value(); + $language = Session::getProjectLanguage(); + $value->languageid = $language->languageid; + $value->objectid = $this->page->objectid; + $value->pageid = Page::getPageIdFromObjectId( $this->page->objectid ); + + if ( $this->hasRequestVar('elementid') ) + $value->element = new Element( $this->getRequestVar('elementid') ); + else + $value->element = Session::getElement(); + + $value->element->load(); + $value->publish = false; + $value->load(); + + $value->linkToObjectId = intval($this->getRequestVar('linkobjectid')); + + $this->afterSave($value); + } + + + + + /** + * Element speichern + * + * Der Inhalt eines Elementes wird abgespeichert + */ + function savelist() + { + $value = new Value(); + $language = Session::getProjectLanguage(); + $value->languageid = $language->languageid; + $value->objectid = $this->page->objectid; + $value->pageid = Page::getPageIdFromObjectId( $this->page->objectid ); + + if ( $this->hasRequestVar('elementid') ) + $value->element = new Element( $this->getRequestVar('elementid') ); + else + $value->element = Session::getElement(); + + $value->element->load(); + $value->publish = false; + $value->load(); + + $value->linkToObjectId = intval($this->getRequestVar('linkobjectid')); + + $this->afterSave($value); + } + + + + /** + * Element speichern + * + * Der Inhalt eines Elementes wird abgespeichert + */ + function savenumber() + { + $value = new Value(); + $language = Session::getProjectLanguage(); + $value->languageid = $language->languageid; + $value->objectid = $this->page->objectid; + $value->pageid = Page::getPageIdFromObjectId( $this->page->objectid ); + + if ( $this->hasRequestVar('elementid') ) + $value->element = new Element( $this->getRequestVar('elementid') ); + else + $value->element = Session::getElement(); + + $value->element->load(); + $value->publish = false; + $value->load(); + + $value->number = $this->getRequestVar('number') * pow(10,$value->element->decimals); + + $this->afterSave($value); + } + } ?> \ No newline at end of file diff --git a/actionClasses/PageelementAction.ini.php b/actionClasses/PageelementAction.ini.php @@ -1,3 +1,79 @@ [default] goto=show + +[edittext] +target=savetext +menu=text + +[editlink] +target=savelink +menu=link + +[editselect] +target=saveselect +menu=select + +[editnumber] +target=savenumber +menu=number + +[editlist] +target=savelist +menu=list + +[editlongtext] +target=savelongtext +menu=longtext + +[editdate] +target=savedate +menu=date + +[editdateform] +target=savedate +menu=date + +[editdatecalendar] +target=savedate +menu=date + +[archive] +menu=text +target=diff + +[savedate] +goto=show + +[savetext] +goto=show + +[savelongtext] +goto=show + +[savelink] +goto=show + +[savelist] +goto=show + +[saveselect] +goto=show + +[savenumber] +goto=show + +[show] +menu=text + +[diff] +menu=text + +[menu] +longtext=editlongtext,archive +text=edittext,archive +link=editlink,archive +list=editlist,archive +select=editselect,archive +number=editnumber,archive +date=editdate,editdatecalendar,editdateform,archive+ \ No newline at end of file diff --git a/actionClasses/TemplateAction.class.php b/actionClasses/TemplateAction.class.php @@ -20,7 +20,10 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // --------------------------------------------------------------------------- // $Log$ -// Revision 1.11 2006-01-23 23:10:46 dankert +// Revision 1.12 2006-01-29 17:18:59 dankert +// Steuerung der Aktionsklasse ?ber .ini-Datei, dazu umbenennen einzelner Methoden +// +// Revision 1.11 2006/01/23 23:10:46 dankert // *** empty log message *** // // Revision 1.10 2005/11/07 22:32:20 dankert @@ -91,12 +94,34 @@ class TemplateAction extends Action } - function srcsave() + function savesrc() { // Speichern des Quelltextes // $text = $this->getRequestVar('src'); + foreach( $this->template->getElementNames() as $elid=>$elname ) + { + $text = str_replace('{{'.$elname.'}}' ,'{{'.$elid.'}}',$text ); + $text = str_replace('{{->'.$elname.'}}','{{->'.$elid.'}}',$text ); + $text = str_replace('{{'.lang('TEMPLATE_SRC_IFEMPTY' ).':'.$elname.':'.lang('TEMPLATE_SRC_BEGIN').'}}','{{IFEMPTY:' .$elid.':BEGIN}}',$text ); + $text = str_replace('{{'.lang('TEMPLATE_SRC_IFEMPTY' ).':'.$elname.':'.lang('TEMPLATE_SRC_END' ).'}}','{{IFEMPTY:' .$elid.':END}}' ,$text ); + $text = str_replace('{{'.lang('TEMPLATE_SRC_IFNOTEMPTY').':'.$elname.':'.lang('TEMPLATE_SRC_BEGIN').'}}','{{IFNOTEMPTY:'.$elid.':BEGIN}}',$text ); + $text = str_replace('{{'.lang('TEMPLATE_SRC_IFNOTEMPTY').':'.$elname.':'.lang('TEMPLATE_SRC_END' ).'}}','{{IFNOTEMPTY:'.$elid.':END}}' ,$text ); + } + + $this->template->src = $text; + $this->template->save(); + $this->template->load(); + } + + + + + function srcaddelement() + { + $text = $this->template->src; + // Falls dieses Element hinzugef?gt werden soll if ( $this->hasRequestVar('addelement') ) { @@ -117,85 +142,90 @@ class TemplateAction extends Action $text .= "\n".'{{IFNOTEMPTY:'.$this->getRequestVar('ifnotemptyid').':BEGIN}} {{IFNOTEMPTY:'.$this->getRequestVar('ifnotemptyid').':END}}'; } - foreach( $this->template->getElementNames() as $elid=>$elname ) - { - $text = str_replace('{{'.$elname.'}}' ,'{{'.$elid.'}}',$text ); - $text = str_replace('{{->'.$elname.'}}','{{->'.$elid.'}}',$text ); - $text = str_replace('{{'.lang('TEMPLATE_SRC_IFEMPTY' ).':'.$elname.':'.lang('TEMPLATE_SRC_BEGIN').'}}','{{IFEMPTY:' .$elid.':BEGIN}}',$text ); - $text = str_replace('{{'.lang('TEMPLATE_SRC_IFEMPTY' ).':'.$elname.':'.lang('TEMPLATE_SRC_END' ).'}}','{{IFEMPTY:' .$elid.':END}}' ,$text ); - $text = str_replace('{{'.lang('TEMPLATE_SRC_IFNOTEMPTY').':'.$elname.':'.lang('TEMPLATE_SRC_BEGIN').'}}','{{IFNOTEMPTY:'.$elid.':BEGIN}}',$text ); - $text = str_replace('{{'.lang('TEMPLATE_SRC_IFNOTEMPTY').':'.$elname.':'.lang('TEMPLATE_SRC_END' ).'}}','{{IFNOTEMPTY:'.$elid.':END}}' ,$text ); - } - $this->template->src = $text; - // Wenn Element hinzugef?gt wurde, dann bleibt es beim Quelltext-Modus. - // Sonst wird zur Anzeige umgeschaltet - - if ( $this->hasRequestVar('addelement' ) || - $this->hasRequestVar('addicon' ) || - $this->hasRequestVar('addifempty' ) || - $this->hasRequestVar('addifnotempty') ) - { - $this->callSubAction('src'); - } - else - { - $this->template->save(); - $this->template->load(); - $this->callSubAction('show'); - } + $this->template->save(); + $this->template->load(); + } + + + // Speichern der Template-Eigenschaftens + // + function savename() + { + $this->template->name = $this->getRequestVar('name'); + $this->template->save(); } // Speichern der Template-Eigenschaftens // - function propsave() + function delete() { if ( $this->getRequestVar('delete') != '' ) { $this->template->delete(); - - $this->callSubAction('listing'); } - else - { - $this->template->name = $this->getRequestVar('name'); - $this->template->save(); + } - $this->callSubAction('show'); - } + + /** + * Entfernen der Vorlage + */ + function remove() + { } // Speichern der Dateiendung // - function extensionsave() + function saveextension() { $this->template->extension = $this->getRequestVar('extension'); $this->template->save(); - - $this->callSubAction('show'); } + function addel() + { + // Die verschiedenen Element-Typen + $types = array(); + + foreach( Element::getAvailableTypes() as $t ) + { + $types[ $t ] = lang('EL_'.$t); + } + + // Code-Element nur fuer Administratoren (da voller Systemzugriff!) + if ( !$this->userIsAdmin() ) + unset( $types['code'] ); + + $this->setTemplateVar('types',$types); + } + + + // Element hinzuf?gen // function addelement() { if ( $this->getRequestVar('name') != '' ) { - $this->template->addElement( $this->getRequestVar('name') ); + $this->template->addElement( $this->getRequestVar('name'),$this->getRequestVar('description'),$this->getRequestVar('type') ); } $this->setTemplateVar('tree_refresh',true); - - $this->callSubAction('el'); } function add() { + } + + + + function addtemplate() + { // Hinzuf?gen eines Templates if ( $this->getRequestVar('name') != '' ) { @@ -207,117 +237,18 @@ class TemplateAction extends Action $this->callSubAction('listing'); } - - /** - * Umbenennen des Elementes - */ - function elementrename() - { - if ( $this->hasRequestVar('delete') ) - { - $this->element->delete(); - } - elseif ( $this->hasRequestVar('deletevalues') ) - { - $this->element->deleteValues(); - } - else - { - $this->element->name = $this->getRequestVar('name'); - $this->element->desc = $this->getRequestVar('desc'); - $this->element->save(); - $this->element->load(); - } + function prop() + { + } - $this->setTemplateVar('tree_refresh',true); - $this->callSubAction('el'); - } - - - /** - * Speichern der Element-Eigenschaften - */ - function elementsave() - { - global $conf; - $ini_date_format = $conf['date_formats']; - foreach( $this->element->getRelatedProperties() as $propertyName ) - { - switch( $propertyName ) - { - case 'dateformat': - $this->element->dateformat = $ini_date_format[$this->getRequestVar('dateformat')]; - break; - - case 'subtype': - $this->element->subtype = $this->getRequestVar('subtype'); - break; - - case 'defaultText': - $this->element->defaultText = $this->getRequestVar('default_text'); - break; - - case 'wiki': - $this->element->wiki = $this->getRequestVar('wiki') != ''; - break; - - case 'html': - $this->element->html = $this->getRequestVar('html') != ''; - break; - - case 'withIcon': - $this->element->withIcon = $this->getRequestVar('with_icon') != ''; - break; - - case 'allLanguages': - $this->element->allLanguages = $this->getRequestVar('all_languages') != ''; - break; - - case 'writable': - $this->element->writable = $this->getRequestVar('writable') != ''; - break; - - case 'decimals': - $this->element->decimals = $this->getRequestVar('decimals'); - break; - - case 'decPoint': - $this->element->decPoint = $this->getRequestVar('dec_point'); - break; - - case 'thousandSep': - $this->element->thousandSep = $this->getRequestVar('thousand_sep'); - break; - - case 'folderObjectId': - $this->element->folderObjectId = $this->getRequestVar('folderobjectid' ); - break; - - case 'defaultObjectId': - $this->element->defaultObjectId = $this->getRequestVar('default_objectid'); - break; - - case 'code': - $this->element->code = $this->getRequestVar('code' ); - break; - } - } - $this->element->save(); - - $this->callSubAction('el'); - } - - - /** * Eigenschaften einer Vorlage anzeigen */ - function prop() + function name() { - $this->setTemplateVar('extension',$this->template->extension); $this->setTemplateVar('name' ,$this->template->name ); // von diesem Template abh?ngige Seiten ermitteln @@ -332,8 +263,17 @@ class TemplateAction extends Action $list[$oid]['url' ] = Html::url( 'main','page',$oid ); } $this->setTemplateVar('pages',$list ); + } - $this->forward('template_prop'); + + + /** + * Eigenschaften einer Vorlage anzeigen + */ + function extension() + { + $this->setTemplateVar('extension',$this->template->extension); + } @@ -440,7 +380,7 @@ class TemplateAction extends Action $element->load(); $list[$elid] = array(); - $list[$elid]['url' ] = Html::url('element','edit',$this->template->templateid,array('elementid'=>$elid)); + $list[$elid]['url' ] = Html::url('element','name',$elid); $list[$elid]['name'] = $element->name; $list[$elid]['desc'] = $element->desc; $list[$elid]['type'] = $element->type; @@ -448,20 +388,16 @@ class TemplateAction extends Action unset( $element ); } $this->setTemplateVar('el',$list); - $this->forward('template_el'); } - /** - * Anzeigen des Template-Quellcodes - */ - function src() + + function srcelement() { $elements = array(); $icon_elements = array(); $ifempty_elements = array(); $ifnotempty_elements = array(); - $text = $this->template->src; foreach( $this->template->getElementIds() as $elid ) { @@ -470,16 +406,34 @@ class TemplateAction extends Action $elements[$elid] = $element->name; - $element = new Element( $elid ); - $element->load(); - if ( $element->isWritable() ) { $icon_elements [$elid] = lang('GLOBAL_icon' ).' '.$element->name; $ifempty_elements [$elid] = lang('TEMPLATE_SRC_ifempty' ).' '.$element->name; $ifnotempty_elements[$elid] = lang('TEMPLATE_SRC_ifnotempty').' '.$element->name; } - + } + + $this->setTemplateVar('elements' ,$elements ); + $this->setTemplateVar('icon_elements' ,$icon_elements ); + $this->setTemplateVar('ifempty_elements' ,$ifempty_elements ); + $this->setTemplateVar('ifnotempty_elements',$ifnotempty_elements ); + } + + + + /** + * Anzeigen des Template-Quellcodes + */ + function src() + { + $text = $this->template->src; + + foreach( $this->template->getElementIds() as $elid ) + { + $element = new Element( $elid ); + $element->load(); + $text = str_replace('{{'.$elid.'}}', '{{'.$element->name.'}}', $text ); @@ -500,13 +454,7 @@ class TemplateAction extends Action $text ); } - $this->setTemplateVar('elements' ,$elements ); - $this->setTemplateVar('icon_elements' ,$icon_elements ); - $this->setTemplateVar('ifempty_elements' ,$ifempty_elements ); - $this->setTemplateVar('ifnotempty_elements',$ifnotempty_elements ); - $this->setTemplateVar('text' ,htmlentities($text) ); - - $this->forward('template_src'); + $this->setTemplateVar( 'src',$text ); } diff --git a/actionClasses/TemplateAction.ini.php b/actionClasses/TemplateAction.ini.php @@ -1,9 +1,71 @@ +[default] +goto=listing + [listing] -menu=list +menu=listing + +[add] +menu=listing +target=addtemplate + +[addtemplate] +goto=listing + +[edit] +menu=edit + +[show] + +[prop] +goto=name + +[el] +menu=el + +[addel] +menu=el +target=addelement + +[addelement] +goto=el + +[src] +menu=edit +target=savesrc + +[srcelement] +menu=edit +target=srcaddelement + +[srcaddelement] +goto=edit + +[savesrc] +goto=edit + +[name] +menu=prop +target=saveprop + +[saveprop] +goto=listing + +[saveextension] +goto=listing + +[extension] +menu=prop +target=saveextension + +[remove] +menu=prop +target=delete -[new] -menu=list -target=donew +[delete] +goto=name -[donew] -goto=listing- \ No newline at end of file +[menu] +listing=listing,add +prop=name,extension,remove +el=el,addel +edit=edit,src,srcelement+ \ No newline at end of file