openrat-cms

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

commit 562cd54aefb4d7e4514f1ecd7531fe5e98b2035c
parent 15f3bd085238a6939897bff78ec945b912ab90df
Author: Tobias Schöne <tobias@schoenesnetz.de>
Date:   Wed, 11 Apr 2012 22:25:35 +0200

Erweiterungen:

-eine DynamicClass zum Einfügen von Sprach-Links zu einer Seite auf selbiger.
-Einfügeelement darf auch auf eine Page zeigen
-Language spezifische Seiten werden richtig generiert
-Umgehung der ContentNegotiation für generierte Seiten

Diffstat:
action/PageelementAction.class.php | 18+++++++++++++++---
dynamicClasses/LanguageLinksForPage.class.php | 71+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
model/Page.class.php | 12++++++++----
3 files changed, 94 insertions(+), 7 deletions(-)

diff --git a/action/PageelementAction.class.php b/action/PageelementAction.class.php @@ -516,6 +516,19 @@ class PageelementAction extends Action { // Auswahl ueber alle Elementtypen $objects = array(); + //Änderung der möglichen Types + $types = array('file','page','link'); + $objects[ 0 ] = lang('LIST_ENTRY_EMPTY'); // Wert "nicht ausgewählt" + //Auch Dateien dazu + foreach( Folder::getAllObjectIds($types) as $id ) + { + $f = new Folder( $id ); + $f->load(); + + $objects[ $id ] = lang( $f->getType() ).': '; + $objects[ $id ] .= implode( ' &raquo; ',$f->parentObjectNames(false,true) ); + } + foreach( Folder::getAllFolders() as $id ) { $f = new Folder( $id ); @@ -570,7 +583,7 @@ class PageelementAction extends Action // Möglicherweise ist die Ausgabevariable bereits gesetzt, wenn man bereits // einen Text eingegeben hat (Vorschaufunktion). $this->setTemplateVar( 'text',$this->linkifyOIDs( $this->value->text ) ); - + if (! $this->isEditMode() ) { $this->value->generate(); // Inhalt erzeugen. @@ -1347,4 +1360,4 @@ class PageelementAction extends Action } } -?>- \ No newline at end of file +?> diff --git a/dynamicClasses/LanguageLinksForPage.class.php b/dynamicClasses/LanguageLinksForPage.class.php @@ -0,0 +1,70 @@ +<?php +// --------------------------------------------------------------------------- +// $Id$ +// --------------------------------------------------------------------------- +// OpenRat Content Management System +// Copyright (C) 2012 Tobias Schöne tobias@schoenesnetz.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$ +// --------------------------------------------------------------------------- +/** + * Erstellen einer Liste von Language-Links auf die selbe Seite + * @author Tobias Schoene + */ +class LanguageLinksForPage extends Dynamic +{ + /** + * Bitte immer alle Parameter in dieses Array schreiben, dies ist fuer den Web-Developer hilfreich. + * @type String + */ + var $parameters = Array( + 'arrowChar'=>'String between entries' + ); + + + var $arrowChar = ' &middot; '; + + /** + * Bitte immer eine Beschreibung benutzen, dies ist fuer den Web-Developer hilfreich. + * @type String + */ + var $description = 'Creates language links to the page.'; + var $version = '$Id$'; + var $api; + + // Build the navigation links to other languages + function execute() + { + // current language + $languageId = $this->page->languageid; + + // Schleife ueber alle Inhalte des Root-Ordners + foreach( Language::getAll() as $lid=>$lname) + { + + $l = new Language( $lid ); + $l->load(); + $this->page->languageid = $l->languageid; + $filename = $this->page->full_filename(); + $filename = str_replace($this->page->path(),".",$filename); + $this->output( '<li><a href="'.$filename.'">'.strtolower($l->isoCode).'</a></li>' ); + + } + $this->page->languageid = $languageId; + } +} +?>+ \ No newline at end of file diff --git a/model/Page.class.php b/model/Page.class.php @@ -49,8 +49,10 @@ class Page extends Object var $content_negotiation = false; var $cut_index = false; var $default_language = false; - var $withLanguage = false; - var $withModel = false; +// var $withLanguage = false; + var $withLanguage = true; + var $withModel = true; +// var $withModel = false; var $link = false; var $fullFilename = ''; @@ -223,6 +225,7 @@ class Page extends Object case 'file': $f = new File( $link->linkedObjectId ); $f->load(); + $f->content_negotiation = $content_negotiation; $inhalt = $this->up_path(); $inhalt .= $f->full_filename(); break; @@ -233,6 +236,8 @@ class Page extends Object $p->modelid = $this->modelid; $p->cut_index = $cut_index; $p->content_negotiation = $content_negotiation; + $p->withLanguage = $this->withLanguage; + $p->withModel = $this->withModel; $p->load(); $inhalt = $this->up_path(); $inhalt .= $p->full_filename(); @@ -881,4 +886,4 @@ class Page extends Object } -?>- \ No newline at end of file +?>