commit 65e81dd7f07585e8026da9ee3d24c45adf37ddb9
parent affd2e820abb5634ea33073de0fb63c3b7a78e86
Author: Jan Dankert <devnull@localhost>
Date: Fri, 11 Jul 2014 01:33:43 +0200
Lustige neue Makros.
Diffstat:
4 files changed, 269 insertions(+), 0 deletions(-)
diff --git a/macro/Link.class.php b/macro/Link.class.php
@@ -0,0 +1,56 @@
+<?php
+// ---------------------------------------------------------------------------
+// $Id$
+// ---------------------------------------------------------------------------
+// OpenRat Content Management System
+// Copyright (C) 2002 Jan Dankert, jandankert@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.2 2005-01-04 19:59:55 dankert
+// Allgemeine Korrekturen, Erben von "Dynamic"-klasse
+//
+// Revision 1.1 2004/11/10 22:43:35 dankert
+// Beispiele fuer dynamische Templateelemente
+//
+// ---------------------------------------------------------------------------
+
+
+
+/**
+ * Erstellen eines Links.
+ *
+ * @author Jan Dankert
+ */
+class NextPage extends Macro
+{
+ public $targetid = 0;
+ public $classes = '';
+ public $name = '';
+ public $title = '';
+
+ function execute()
+ {
+ // Lesen des Ordners
+ $o = new Object( $this->targetid );
+ $o->load();
+
+ if ( empty($this->name ) ) $this->name = $o->name;
+ if ( empty($this->title) ) $this->title = $o->description;
+
+ $this->output( '<a href="'.$this->pathToObject($this->targetid).' title="'.$this->title.'" class="'.$this->classes.'">'.$this->name.'</a>' );
+ }
+}+
\ No newline at end of file
diff --git a/macro/TableFromFile.class.php b/macro/TableFromFile.class.php
@@ -0,0 +1,89 @@
+<?php
+// OpenRat Content Management System
+// Copyright (C) 2002-2012 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.
+
+
+
+/**
+ * Erstellt eine HTML-Tabelle aus einer CSV-Datei.
+ *
+ * @author Jan Dankert
+ */
+class TagCloud extends Macro
+{
+ /**
+ * Beschreibung dieser Klasse
+ * @type String
+ */
+ var $description = '';
+
+
+ public $fileid = 0;
+ public $separator = ',';
+ public $firstlineheader = 1;
+ public $firstcolumnheader = 1;
+ public $ignorefirstline = 0;
+ public $header = 'A,B,C';
+ public $encodeHtml = 1;
+
+
+ function execute()
+ {
+ $this->output('<table>');
+ $file = new File( $this->fileid );
+ $lines = explode("\n",$file->loadValue() );
+
+ $firstline = true;
+ foreach( $lines as $line )
+ {
+ if ( $firstline)
+ {
+ $firstline = false;
+ if ( $this->ignorefirstline)
+ continue;
+ elseif ( $this->firstlineheader )
+ $lcelltag = 'th';
+ else
+ $lcelltag = 'td';
+ }
+ else
+ $lcelltag = 'td';
+
+ $columns = explode($this->separator,$line);
+
+ $this->output('<tr>');
+ $firstcolumn = true;
+ foreach( $columns as $column )
+ {
+ if ($firstcolumn)
+ {
+ $firstcolumn = false;
+ if ( $this->firstcolumnheader )
+ $celltag = 'th';
+ else
+ $celltag = $lcelltag;
+
+ if ( $this->encodeHtml) $column = encodeHtml($column);
+ $this->output('<'.$celltag.'>'.$column.'</'.$celltag.'>');
+ }
+ }
+ $this->output('</tr>');
+ }
+ $this->output('</table>');
+ }
+
+}+
\ No newline at end of file
diff --git a/macro/TagCloud.class.php b/macro/TagCloud.class.php
@@ -0,0 +1,66 @@
+<?php
+// OpenRat Content Management System
+// Copyright (C) 2002-2012 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.
+
+
+
+/**
+ * Erstellt eine Tagcloud.
+ * @author Jan Dankert
+ */
+class TagCloud extends Macro
+{
+ /**
+ * Beschreibung dieser Klasse
+ * @type String
+ */
+ var $description = '';
+
+
+ public $keywordFolderId = 0;
+
+
+ // Erstellen des Hauptmenues
+ function execute()
+ {
+ if ( intval($this->keywordFolderId) == 0 )
+ {
+ $this->output('param keywordfolderid not set');
+ return;
+ }
+
+ $f = new Folder( $this->keywordFolderId );
+
+ foreach( $f->getObjectIdsByName() as $fid )
+ {
+ $tf = new Folder($fid);
+ if ( !$tf->isFolder)
+ continue;
+ $tf->load();
+
+ $target = $tf->getFirstPage();
+
+ if ( $target == null)
+ continue;
+ $target->load();
+
+ // Link zum Tag erzeugen
+ $this->output( '<div class="tag" style="font-size:'.(1+(sizeof($tf->getObjectIds())*0.1)).'em"><a href="'.$this->pathToObject($target->objectid).'">'.$tf->name.'</a></div>' );
+ }
+ }
+
+}+
\ No newline at end of file
diff --git a/macro/TagList.class.php b/macro/TagList.class.php
@@ -0,0 +1,54 @@
+<?php
+// OpenRat Content Management System
+// Copyright (C) 2002-2012 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.
+
+
+
+/**
+ * Erstellt eine Tagcloud.
+ * @author Jan Dankert
+ */
+class TagList extends Macro
+{
+ /**
+ * Beschreibung dieser Klasse
+ * @type String
+ */
+ var $description = '';
+
+ function execute()
+ {
+ $page = $this->getPage();
+ $linkIds = $page->getLinksToMe();
+
+ foreach( $linkIds as $linkid )
+ {
+ $l = new Link( $linkid );
+ $l->load();
+ $f = new Folder( $l->parentid );
+ $f->load();
+
+ $target = $f->getFirstPage();
+ if ( $target==null) continue;
+ $target->load();
+
+ // Link erzeugen
+ $this->output( '<div class="tag"><a href="'.$this->pathToObject($target->objectid).'">'.$f->name.'</a></div>' );
+ }
+ }
+
+}+
\ No newline at end of file