openrat-cms

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

commit 87e3d651da30dbb91f5e5a71c7f515472055f3a7
parent ec3f2e4904f0faec5871c3bed0d788ed397e641f
Author: dankert <devnull@localhost>
Date:   Wed, 24 Nov 2004 22:28:36 +0100

"Verschieben" entfernt

Diffstat:
actionClasses/LinkAction.class.php | 416++++++++++++++++++++++++++++++++++----------------------------------------------
themes/default/pages/html/link/prop.tpl.php | 160++++++++++++++++++++++++++++++++-----------------------------------------------
2 files changed, 240 insertions(+), 336 deletions(-)

diff --git a/actionClasses/LinkAction.class.php b/actionClasses/LinkAction.class.php @@ -1,242 +1,178 @@ -<?php -// --------------------------------------------------------------------------- -// $Id$ -// --------------------------------------------------------------------------- -// OpenRat Content Management System -// Copyright (C) 2002-2004 Jan Dankert, cms@jandankert.de -// -// 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. -// --------------------------------------------------------------------------- +<?php +// --------------------------------------------------------------------------- +// $Id$ +// --------------------------------------------------------------------------- +// OpenRat Content Management System +// Copyright (C) 2002-2004 Jan Dankert, cms@jandankert.de +// +// 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. +// --------------------------------------------------------------------------- // $Log$ -// Revision 1.3 2004-05-02 14:49:37 dankert -// Einfügen package-name (@package) -// -// Revision 1.2 2004/04/30 20:31:47 dankert -// Berechtigungen anzeigen -// -// Revision 1.1 2004/04/24 15:14:52 dankert -// Initiale Version -// -// --------------------------------------------------------------------------- - - -/** - * Action-Klasse für Verknüpfungen - * @version $Id$ - * @author $Author$ - * @package openrat.actions - */ -class LinkAction extends Action -{ - var $link; - var $defaultSubAction = 'prop'; - - /** - * Konstruktor - */ - function LinkAction() - { - $this->link = new Link( $this->getSessionVar('objectid') ); - $this->link->load(); - } - - - /** - * Verschieben der Verknüpfung - */ - function move() - { - $this->objectMove(); - $this->link->load(); - - $this->callSubAction('prop'); - } - - - function addACL() - { - $this->objectAddACL(); - - $this->callSubAction('rights'); - } - - - function delACL() - { - $this->objectDelACL(); - - $this->callSubAction('rights'); - } - - - /** - * Abspeichern der Eigenschaften - */ - function save() - { - // Wenn Name gefüllt, dann Datenbank-Update - if ( $this->getRequestVar('name') != '' ) - { - if ( $this->getRequestVar('delete') != '' ) - { - // Verknuepfung löschen - $this->link->delete(); - - $this->getRequestVar('tree_refresh',true); - $this->forward('blank'); - } - else - { - // Eigenschaften speichern - $this->link->name = $this->getRequestVar('name'); - $this->link->desc = $this->getRequestVar('desc'); - - if ( $this->getRequestVar('type') == 'link' ) - { - $this->link->isLinkToObject = true; - $this->link->isLinkToUrl = false; - $this->link->linkedObjectId = $this->getRequestVar('linkobjectid'); - } - else - { - $this->link->isLinkToObject = false; - $this->link->isLinkToUrl = true; - $this->link->url = $this->getRequestVar('url'); - } - - $this->link->save(); - } - } - - $this->getRequestVar('tree_refresh',true); - - $this->callSubAction('prop'); - } - - - function prop() - { - $this->setTemplateVars( $this->link->getProperties() ); - - if ( is_numeric($this->link->lastchange_userid) ) - { - $user = new User( $this->link->lastchange_userid ); - $user->load(); - $this->setTemplateVar('lastchange_user',array('name'=>$user->name, - 'url' =>Html::url(array('action'=>'user', - 'userid'=>$user->userid)))); - } - else - { - $this->setTemplateVar('lastchange_user',array('name'=>lang('UNKNOWN'))); - } - - if ( is_numeric($this->link->create_userid) ) - { - $user = new User( $this->link->create_userid ); - $user->load(); - $this->setTemplateVar('create_user',array('name'=>$user->name, - 'url' =>Html::url(array('action'=>'user', - 'userid'=>$user->userid)))); - } - else - { - $this->setTemplateVar('create_user',array('name'=>lang('UNKNOWN'))); - } - - - - // Typ der Verknüpfung - $this->setTemplateVar('type' ,$this->link->getType() ); - $this->setTemplateVar('act_linkobjectid',$this->link->linkedObjectId); - $this->setTemplateVar('url' ,$this->link->url ); - - // Alle verlinkbaren Objekte anzeigen - $list = array(); - - foreach( Object::getAllObjectIds() as $oid ) - { - $o = new Object( $oid ); - $o->load(); - - if ( $o->isFile || - $o->isPage ) - { - $folder = new Folder( $o->parentid ); - $folder->linknames = false; - $folder->load(); - $list[$oid] = lang( $o->getType() ); - $list[$oid] .= implode(' &raquo; ',$folder->parentObjectNames( false,true ) ); - $list[$oid] .= ' &raquo; '.$o->name; - } - } - asort( $list ); - $this->setTemplateVar('objects',$list); - - - // Alle Ordner ermitteln - $this->setTemplateVar('act_objectid',$this->link->parentid); - $list = array(); - - $f = new Folder( $this->link->parentid ); - foreach( $f->getOtherFolders() as $oid ) - { - $folder = new Folder( $oid ); - $list[$oid] = implode(' &raquo; ',$folder->parentObjectNames( true,true ) ); - } - asort( $list ); - $this->setTemplateVar('folder',$list); - $this->forward('link_prop'); - } - - - function rights() - { - global $SESS; - global $conf_php; - if ($SESS['user']['is_admin'] != '1') die('nice try'); - - $acllist = array(); - foreach( $this->link->getAllInheritedAclIds() as $aclid ) - { - $acl = new Acl( $aclid ); - $acl->load(); - $key = 'au'.$acl->username.'g'.$acl->groupname.'a'.$aclid; - $acllist[$key] = $acl->getProperties(); - } - - foreach( $this->link->getAllAclIds() as $aclid ) - { - $acl = new Acl( $aclid ); - $acl->load(); - $key = 'bu'.$acl->username.'g'.$acl->groupname.'a'.$aclid; - $acllist[$key] = $acl->getProperties(); - $acllist[$key]['delete_url'] = Html::url(array('subaction'=>'delACL','aclid'=>$aclid)); - } - ksort( $acllist ); - - $this->setTemplateVar('acls',$acllist ); - - $this->setTemplateVar('users' ,User::listAll() ); - $this->setTemplateVar('groups' ,Group::getAll() ); - - $languages = Language::getAll(); - $languages[0] = lang('ALL_LANGUAGES'); - $this->setTemplateVar('languages',$languages); - - $this->forward('link_rights'); - } - +// Revision 1.4 2004-11-24 21:28:36 dankert +// "Verschieben" entfernt +// +// Revision 1.3 2004/05/02 14:49:37 dankert +// Einf?gen package-name (@package) +// +// Revision 1.2 2004/04/30 20:31:47 dankert +// Berechtigungen anzeigen +// +// Revision 1.1 2004/04/24 15:14:52 dankert +// Initiale Version +// +// --------------------------------------------------------------------------- + + +/** + * Action-Klasse f?r Verkn?pfungen + * @version $Id$ + * @author $Author$ + * @package openrat.actions + */ +class LinkAction extends ObjectAction +{ + var $link; + var $defaultSubAction = 'prop'; + + /** + * Konstruktor + */ + function LinkAction() + { + $this->link = new Link( $this->getSessionVar('objectid') ); + $this->link->load(); + } + + + /** + * Verschieben der Verkn?pfung + */ + function move() + { + $this->objectMove(); + $this->link->load(); + + $this->callSubAction('prop'); + } + + + + /** + * Abspeichern der Eigenschaften + */ + function save() + { + // Wenn Name gef?llt, dann Datenbank-Update + if ( $this->getRequestVar('name') != '' ) + { + if ( $this->getRequestVar('delete') != '' ) + { + // Verknuepfung l?schen + $this->link->delete(); + + $this->getRequestVar('tree_refresh',true); + $this->forward('blank'); + } + else + { + // Eigenschaften speichern + $this->link->name = $this->getRequestVar('name'); + $this->link->desc = $this->getRequestVar('desc'); + + if ( $this->getRequestVar('type') == 'link' ) + { + $this->link->isLinkToObject = true; + $this->link->isLinkToUrl = false; + $this->link->linkedObjectId = $this->getRequestVar('linkobjectid'); + } + else + { + $this->link->isLinkToObject = false; + $this->link->isLinkToUrl = true; + $this->link->url = $this->getRequestVar('url'); + } + + $this->link->save(); + } + } + + $this->getRequestVar('tree_refresh',true); + + $this->callSubAction('prop'); + } + + + function prop() + { + $this->setTemplateVars( $this->link->getProperties() ); + + if ( is_numeric($this->link->lastchange_userid) ) + { + $user = new User( $this->link->lastchange_userid ); + $user->load(); + $this->setTemplateVar('lastchange_user',array('name'=>$user->name, + 'url' =>Html::url(array('action'=>'user', + 'userid'=>$user->userid)))); + } + else + { + $this->setTemplateVar('lastchange_user',array('name'=>lang('UNKNOWN'))); + } + + if ( is_numeric($this->link->create_userid) ) + { + $user = new User( $this->link->create_userid ); + $user->load(); + $this->setTemplateVar('create_user',array('name'=>$user->name, + 'url' =>Html::url(array('action'=>'user', + 'userid'=>$user->userid)))); + } + else + { + $this->setTemplateVar('create_user',array('name'=>lang('UNKNOWN'))); + } + + + + // Typ der Verkn?pfung + $this->setTemplateVar('type' ,$this->link->getType() ); + $this->setTemplateVar('act_linkobjectid',$this->link->linkedObjectId); + $this->setTemplateVar('url' ,$this->link->url ); + + // Alle verlinkbaren Objekte anzeigen + $list = array(); + + foreach( Object::getAllObjectIds() as $oid ) + { + $o = new Object( $oid ); + $o->load(); + + if ( $o->isFile || + $o->isPage ) + { + $folder = new Folder( $o->parentid ); + $folder->linknames = false; + $folder->load(); + $list[$oid] = lang( $o->getType() ); + $list[$oid] .= implode(' &raquo; ',$folder->parentObjectNames( false,true ) ); + $list[$oid] .= ' &raquo; '.$o->name; + } + } + asort( $list ); + $this->setTemplateVar('objects',$list); + + $this->forward('link_prop'); + } } \ No newline at end of file diff --git a/themes/default/pages/html/link/prop.tpl.php b/themes/default/pages/html/link/prop.tpl.php @@ -1,97 +1,65 @@ -<?php include( $tpl_dir.'header.tpl.php') ?> - -<!-- $Id$ --> -<center> - -<form action="<?php echo $self ?>" method="post" target="_self"> - -<input type="hidden" name="action" value="link"> -<input type="hidden" name="subaction" value="save"> - -<table class="main" width="90%" cellspacing="0" cellpadding="4"> - -<tr> - <th colspan="2"><?php echo lang('PROP') ?></th> -</tr> - - <tr> - <td width="50%" class="f1" rowspan="2"><?php echo lang('name') ?></a></td> - <td width="50%" class="f1"><input type="text" class="name" name="name" size="50" value="<?php echo $name ?>"></td> - </tr> - <tr> - <td width="50%" class="help"><?php echo lang('HELP_NAME') ?></td> - </tr> - <tr> - <td width="50%" class="f2"><?php echo lang('description') ?></a></td> - <td width="50%" class="f2"><textarea class="desc" cols="40" rows="10" name="desc"><?php echo $desc ?></textarea></td> - </tr> - <tr> - <td class="f1"><input type="radio" name="type" value="link"<?php if ($type=='link') echo ' checked="checked"'; ?>><?php echo lang('target') ?></a></td> - <td class="f1"><?php echo Html::selectBox('linkobjectid',$objects,$act_linkobjectid) ?></td> - </tr> - <tr> - <td class="f1"><input type="radio" name="type" value="url"<?php if ($type=='url') echo ' checked="checked"'; ?>><?php echo lang('url') ?></a></td> - <td class="f1"><input type="text" name="url" size="50" maxlength="255" value="<?php echo $url; ?>"></td> - </tr> - <tr> - <td width="50%" class="f2"><?php echo lang('created') ?></a></td> - <td width="50%" class="f2"><?php echo date(lang('DATE_FORMAT'),$create_date) ?>, <?php if (isset($create_user['url'])) echo'<a href="'.$create_user['url'].'" target="cms_main">' ?><?php echo $create_user['name'] ?><?php if (isset($create__user['url'])) echo'</a>' ?></td> - </tr> - <tr> - <td width="50%" class="f2"><?php echo lang('lastchange') ?></a></td> - <td width="50%" class="f2"><?php echo date(lang('DATE_FORMAT'),$lastchange_date) ?>, <?php if (isset($lastchange_user['url'])) echo'<a href="'.$lastchange_user['url'].'" target="cms_main">' ?><?php echo $lastchange_user['name'] ?><?php if (isset($lastchange_user['url'])) echo'</a>' ?></td> - </tr> - <tr> - <td class="f1" rowspan="2"><?php echo lang('DELETE') ?></a></td> - <td class="f1"><input type="checkbox" name="delete" value="1"></td> - </tr> - <tr> - <td class="help"><?php echo lang('LINK_DELETE_DESC') ?></td> - </tr> - <tr> - <td class="act" colspan="2"><input type="submit" class="submit" value="<?php echo lang('SAVE') ?>"></td> - </tr> - -</table> - -</form> - - -<form action="<?php echo $action ?>" method="post" target="_self"> - -<input type="hidden" name="<?php echo session_name() ?>" value="<?php echo session_id() ?>"> -<input type="hidden" name="linkaction" value="move"> - -<table class="main" width="90%" cellspacing="0" cellpadding="4"> - -<tr> - <th colspan="2"><?php echo lang('MOVE') ?></th> -</tr> - -<tr> -<td width="50%" class="f1"><?php echo lang('FOLDER') ?></a></td> -<td width="50%" class="f1"><?php echo Html::selectBox('movetoobjectid',$folder,$act_objectid) ?></td> -</tr> -<!-- -<tr> -<td width="50%" class="f2">&nbsp;</td> -<td width="50%" class="f2"><input type="checkbox" name="copy" value="1"> <?php echo lang('COPY_INSTEAD_OF_MOVE') ?></td> -</tr> ---> - -<tr> -<td class="act" colspan="2"><input type="submit" class="submit" value="<?php echo lang('MOVE') ?>"></td> -</tr> - -</table> - -</form> - - -</center> - -<script name="JavaScript" type="text/javascript"><!-- -document.forms[0].name.focus(); -//--></script> - +<?php include( $tpl_dir.'header.tpl.php') ?> + +<!-- $Id$ --> +<center> + +<form action="<?php echo $self ?>" method="post" target="_self"> + +<input type="hidden" name="action" value="link"> +<input type="hidden" name="subaction" value="save"> + +<table class="main" width="90%" cellspacing="0" cellpadding="4"> + +<tr> + <th colspan="2"><?php echo lang('PROP') ?></th> +</tr> + + <tr> + <td width="50%" class="f1" rowspan="2"><?php echo lang('name') ?></a></td> + <td width="50%" class="f1"><input type="text" class="name" name="name" size="50" value="<?php echo $name ?>"></td> + </tr> + <tr> + <td width="50%" class="help"><?php echo lang('HELP_NAME') ?></td> + </tr> + <tr> + <td width="50%" class="f2"><?php echo lang('description') ?></a></td> + <td width="50%" class="f2"><textarea class="desc" cols="40" rows="10" name="desc"><?php echo $desc ?></textarea></td> + </tr> + <tr> + <td class="f1"><input type="radio" name="type" value="link"<?php if ($type=='link') echo ' checked="checked"'; ?>><?php echo lang('target') ?></a></td> + <td class="f1"><?php echo Html::selectBox('linkobjectid',$objects,$act_linkobjectid) ?></td> + </tr> + <tr> + <td class="f1"><input type="radio" name="type" value="url"<?php if ($type=='url') echo ' checked="checked"'; ?>><?php echo lang('url') ?></a></td> + <td class="f1"><input type="text" name="url" size="50" maxlength="255" value="<?php echo $url; ?>"></td> + </tr> + <tr> + <td width="50%" class="f2"><?php echo lang('created') ?></a></td> + <td width="50%" class="f2"><?php echo date(lang('DATE_FORMAT'),$create_date) ?>, <?php if (isset($create_user['url'])) echo'<a href="'.$create_user['url'].'" target="cms_main">' ?><?php echo $create_user['name'] ?><?php if (isset($create__user['url'])) echo'</a>' ?></td> + </tr> + <tr> + <td width="50%" class="f2"><?php echo lang('lastchange') ?></a></td> + <td width="50%" class="f2"><?php echo date(lang('DATE_FORMAT'),$lastchange_date) ?>, <?php if (isset($lastchange_user['url'])) echo'<a href="'.$lastchange_user['url'].'" target="cms_main">' ?><?php echo $lastchange_user['name'] ?><?php if (isset($lastchange_user['url'])) echo'</a>' ?></td> + </tr> + <tr> + <td class="f1" rowspan="2"><?php echo lang('DELETE') ?></a></td> + <td class="f1"><input type="checkbox" name="delete" value="1"></td> + </tr> + <tr> + <td class="help"><?php echo lang('LINK_DELETE_DESC') ?></td> + </tr> + <tr> + <td class="act" colspan="2"><input type="submit" class="submit" value="<?php echo lang('SAVE') ?>"></td> + </tr> + +</table> + +</form> + + + +</center> + +<?php Html::focusField('name') ?> + <?php include( $tpl_dir.'footer.tpl.php') ?> \ No newline at end of file