The easy Weblog and Wiki Software
[ start | index | login ]
start > ThoMo

ThoMo

Created by ThoMo. Last edited by ThoMo, 2 years and 142 days ago. Viewed 3,758 times. #77
[diff] [history] [edit] [rdf]

ThoMo´s addons

!!! the addons are tested against the snipsnap-uttoxeter version 1.0b2 !!!

To use the addons just copy >>thomos-addons.jar to snipsnap application dir/*/webapp/WEB-INF/lib/

Now the addons are hosted at SnipForge, see >>http://snipforge.org/svn/thomo/addons/trunk/ .

addontypedescription
namespacesmacroDisplays the current defined/used namespaces. You can determine the depth of the namespaces to show.
snip-limittreemacroDisplays a limited snip tree. Works like the macro snip-tree but you can determine the maximum depth to show.
NEW
kiviat
graph rendererA graph renderer to produce Kiviat diagramms. Example see below.
list-of-codefiltermacroDisplays a list of all available code filter.
NEW
list-of-listformatter
macroDisplays a list of all available list formatter.
NEW
sorted
list formatterCan be used in label search to dispay a sorted result list.
xslmacroUse an attached XSL to transform an XML and display the result. Valid data sources are attached files and URLs. Example see below.
NEW: Add support of XSL transformation parameter

Macro usage

xsl macro

The macro use XSL file to transform the XML file. The output is written into the snip.

Example files:
  • macro.xml
<?xml version="1.0" encoding="UTF-8"?>
<root>
<macro name="namespaces"/>
<macro name="snip-limittree"/>
</root>
  • macro2snip.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="root">
    <xsl:text>1 ThoMos addons
</xsl:text>
    <xsl:apply-templates/>
  </xsl:template>
  <xsl:template match="macro">
    <xsl:text>
- <xsl:text>
    <xsl:value-of select="@name"/>
  </xsl:template>
</xsl:stylesheet>

If both files are attached to the snip the xsl macro

{xsl:macro.xml|macro2snip.xsl}
will generate:

1 ThoMos addons
- namespaces
- snip-limittree

Kiviat graph renderer

The Kiviat renderer generates Kiviat diagram pictures. The renderer use the graph macro. For each branch just write a line like

[branch_name,value]
in the graph macro. The given value must be 0 <= value <= 100.

You can control the output with the attributes (all are optional)

  • [@height,300] - defines the image height
  • [@gridColor,R,G,B] - set the color of the grid (0 <= R,G,B <= 255)
  • [@areaColor,R,G,B] - set the color of the polygon (0 <= R,G,B <= 255)
  • [@hideText] - hides the descriptions
{graph:kiviat}
[@height,300]
[@gridColor,0,0,0]
[@areaColor,0,0,255]
[Comments,60]
[Methods,40]
[Attributs,90]
[Complexity,20]
[Statements,95]
{graph}

will result in kiviat

Patches

I have setup my own SnipSnap branch based on SnipSnap-uttoxeter. It contains all my patches.

Latest (full list see >>here):

  • 2006-02-27
  • import latest uttoxeter changes
  • 2005-10-25
  • BUG: in xmlrpc-2.0 (Basic Authorization not work)
  • 2005-06
  • BUG: AtoZListener lists to much items
  • VerticalListener: list blog snips with their title
  • add transient labels, see >>http://bugs.snipsnap.org/browse/SNIPSNAP-432
  • PostDaemon - modified to support mail to different blogs
    New syntax of mail subject: <blogpasswd>[@<blog>] <title>
    • <blogpasswd> - password to restrict mail-to-blog
    • <blog> - blog to post to (optional, if missed the message is posted to the start blog)
    • <title> - blog title
    • Example: myBlogPass@post/to/this/blog Patch PostDaemon
Download:

helper scripts

  • copy a lib (like thomos-addons.jar) to all snipsnap applications
#! /bin/sh
APPL_DIR=/your/path/to/snipsnap/applications_dir

for i in `ls -A applications`; do cp $1 $APPL_DIR/applications/$i/webapp/WEB-INF/lib done

Icon-Comment brent, 4 years and 142 days ago. Icon-Permalink

The jar and src from the link above seems sth wrong ?

Icon-Comment ThoMo, 4 years and 141 days ago. Icon-Permalink

Seems to be a JIRA problem.
I have add the jar to the snip now. The src will follow soon.

Icon-Comment kool, 4 years and 95 days ago. Icon-Permalink

nice

Icon-Comment matt, 3 years and 335 days ago. Icon-Permalink

The snip-limittree macro was just what I was looking for thanks. I'm intrigued by the xsl macro, do you have an example of it's use?

Icon-Comment ThoMo, 3 years and 334 days ago. Icon-Permalink

Example:

foo.xml

<root>
  <person name='ThoMo'/>
  <person name='matt'/>
</root>

foo2snip.xsl

<?xml version="1.0">
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" omit-xml-declaration="yes"/>
<xsl:template match="root">
person list
</xsl:template>
<xsl:template match="person">
- <xsl:value-of select="@name"/>
</xsl:template>
</xsl:stylesheet>

Using the xsl macro (syntax see above) will displayed like this:

person list

  • ThoMo
  • matt

Icon-Comment matt, 3 years and 334 days ago. Icon-Permalink

Thanks, that's really neat. The more I discover about SnipSnap the more useful it's becoming. I've been thinking about redoing much of my own website using XML and XSL but now it looks like I may be able to do everything I want to with SnipSnap alone.

Icon-Comment scrooks, 3 years and 294 days ago. Icon-Permalink

I'm confused. The text says that the MultiLabel patch is no longer needed, but I'm finding that I can only have one label of type CategoryLabel in a snip. I would really like to be able to categorize snips with more than one category. Do I need to install this patch or what?

Icon-Comment ThoMo, 3 years and 289 days ago. Icon-Permalink

@scrooks: Yes, you are right. The patch is going away in the last snipsnap version. I will have a look at it in the next days.

Icon-Comment ThoMo, 3 years and 288 days ago. Icon-Permalink

@scrooks: Patch for uttoxeter added.

Icon-Comment ahfai, 3 years and 287 days ago. Icon-Permalink

though the AtoZ lister sorting problem is solved in the current version of snipsnap, but the new lister just show snips with the same name as one, which makes me unable to look for snips with the same name but under different namespaces :(
does the AtoZ2 lister still work for uttoxeter? if so, where should place the .jar? thx in advance :)

Icon-Comment ThoMo, 3 years and 272 days ago. Icon-Permalink

@ahfai: I have added a patch for the AtoZ lister.

Icon-Comment Victor Volle, 3 years and 268 days ago. Icon-Permalink

@ThoMo: The MultiLabel Patch just seems to have commented out the code that removes an existing label of the given name or type. Are there labels where only one should exist (e.g. a "parent" label in a strict hierarchy)? Should a label type have a flag "unique" to allow both behaviours (multiple labels and automatic removal of existing labels)?

Since the Label Type is - AFAIK - just another Snip, how could this be done?

Icon-Comment GaryPaulson, 3 years and 157 days ago. Icon-Permalink

Ok, as a noob I am guessing that these patches are only for the Java experienced? I am really suprised that these 'bugs' have not been squashed in the distro.

I would really like to get the AtoZ lister to work. And the other stuff would be nice too.

Thanks!

Icon-Comment GaryPaulson, 3 years and 156 days ago. Icon-Permalink

Well, I downloaded Apache-Ant java compiler. Figured out how to 'rebuild' the unmodified source code - and it still worked - so went ahead and made the mods for the uttoxeter patch - and it works!! Thanks so much.

Now if I can get the 'see also:' list at the bottom to show more than the first couple letters of snips that are in different namespaces I will be making even more progress.

And now I am getting bold! I have modified the CollationListFormater.java to also show the namespaces and fixed the UserSnipMacro.java to use the corrected AtoZ and Collation routines.

Icon-Comment funzel, 3 years and 97 days ago. Icon-Permalink

Do you want to host this on snipforge? Send us an email :-)

Icon-Comment phobia, 3 years and 94 days ago. Icon-Permalink

@funzel: I bet list-of-listformatter and sorted requires some items in snipsnap.api that you were uncomfortable with ;-)

Icon-Comment funzel, 3 years and 93 days ago. Icon-Permalink

I guess not all plugins can only depend on snipsnap.api :-)

Icon-Comment phobia, 3 years and 49 days ago. Icon-Permalink

ThoMo, why have you decided to fork the entire core? Do you have plans beyond patching PostDaemon?

(@funzel: Looks like PostDaemon needs to be abstracted out of the core.)

Icon-Comment ThoMo, 3 years and 48 days ago. Icon-Permalink

@phobia:
ThoMo, why have you decided to fork the entire core?
Because
  • there are some patches hanging around since some month
  • want to have a patched version public available
  • if I only publish the patches they need to be updated if the uttoxeter codebase change (and the patches are not included)
  • I want to separat the unit tests
  • add some PostDaemon tests
Do you have plans beyond patching PostDaemon?
No, not at the moment.

Icon-Comment phobia, 3 years and 48 days ago. Icon-Permalink

Mind adding in my >>outstanding patch, then? ;-)

Do you intend to weave in the ACL layer when it's released?

Icon-Comment ThoMo, 3 years and 44 days ago. Icon-Permalink

adding "transient label " patch - done.

Do you intend to weave in the ACL layer when it's released?

I would prefer to merge "my" branch with the core once released. I want to limit my effort, just to keep it running in a way I want/need it.

Icon-Comment michaelk, 2 years and 344 days ago. Icon-Permalink

@ThoMo: the above binary tgz is reported as corrupt by WinRAR and WinZip (both should know tgz). If it's my fault, please provide some help on unpacking it, otherwise I'd be happy to get a working package.

regards, Michael

Icon-Comment ThoMo, 2 years and 343 days ago. Icon-Permalink

@michaelk: I tried to refresh the file without success. So I changed the file name to ...tar.gz_ (with underline). Try it again - download it and rename it to tar.gz or tgz. Sorry.

Icon-Comment michaelk, 2 years and 343 days ago. Icon-Permalink

working now! thanks for your help.

I'll try to fetch the SVN-repository, perhaps I'll be able to contributed s/th back.

edit: any reports on if and when the ACL-layer surfaces?

Icon-Comment ThoMo, 2 years and 338 days ago. Icon-Permalink

@michaelk: I'm not involved in the official snipsnap developer team. So I don't have any news about the ACL or when it will manifest.

Icon-Comment csg, 2 years and 279 days ago. Icon-Permalink

Looking for the MultiLabel patch. Where is it now? (still using 1.0b1, is it incorporated into 1.0b2?)

Icon-Comment ThoMo, 2 years and 275 days ago. Icon-Permalink

@csg: Sorry, I don't have a backup of the patch. But you can try to replace the original 1.0b1 "src/org/snipsnap/net/StoreLabelServlet.java" with this one:

/*
 * This file is part of "SnipSnap Wiki/Weblog".
 *
 * Copyright (c) 2002 Stephan J. Schmidt, Matthias L. Jugel
 * All Rights Reserved.
 *
 * Please visit >>http://snipsnap.org/ for updates and contact.
 *
 * --LICENSE NOTICE--
 * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
 * --LICENSE NOTICE--
 */
package org.snipsnap.net;

import org.snipsnap.snip.Snip; import org.snipsnap.snip.SnipLink; import org.snipsnap.snip.SnipSpaceFactory; import org.snipsnap.snip.SnipSpace; import org.snipsnap.snip.label.Label; import org.snipsnap.snip.label.LabelManager; import org.snipsnap.config.Configuration; import org.snipsnap.app.Application; import org.snipsnap.container.Components; import org.snipsnap.net.filter.MultipartWrapper; import org.radeox.util.logging.Logger;

import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.Enumeration; import java.util.HashMap; import java.util.Map;

/** * Adding a label to a snip * * @author Stephan J. Schmidt * @version $Id: StoreLabelServlet.java,v 1.13 2004/06/03 20:37:52 leo Exp $ */ public class StoreLabelServlet extends HttpServlet {

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Configuration config = Application.get().getConfiguration(); // If this is not a multipart/form-data request continue String type = request.getHeader("Content-Type"); if (type != null && type.startsWith("multipart/form-data")) { try { request = new MultipartWrapper(request, config.getEncoding() != null ? config.getEncoding() : "UTF-8"); } catch (IllegalArgumentException e) { Logger.warn("AddLabelServlet: multipart/form-data wrapper:" + e.getMessage()); } }

doGet(request, response); }

public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { Configuration config = Application.get().getConfiguration();

String snipName = request.getParameter("snipname");

// cancel pressed if (null != request.getParameter("cancel")) { response.sendRedirect(config.getUrl("/space/" + SnipLink.encode(snipName))); return; }

if(null == request.getParameter("back")) { Snip snip = ((SnipSpace) Components.getComponent(SnipSpace.class)).load(snipName); String labelType = request.getParameter("labeltype"); String labelName = request.getParameter("labelname"); Label label = null; // if(null != labelName) { // label = snip.getLabels().getLabel(labelName); // } // // if(null != label) { // snip.getLabels().removeLabel(label.getName(), label.getValue()); // handleLabel(label, request); // snip.getLabels().addLabel(label); // SnipSpaceFactory.getInstance().store(snip); // } else if(null != labelType) { LabelManager manager = (LabelManager)Components.getComponent(LabelManager.class); label = manager.getLabel(labelType); handleLabel(label, request); snip.getLabels().addLabel(label); SnipSpaceFactory.getInstance().store(snip); } }

response.sendRedirect(config.getUrl("/exec/labels?snipname=" + SnipLink.encode(snipName))); }

private void handleLabel(Label label, HttpServletRequest request) { Map params = new HashMap(); Enumeration enumeration = request.getParameterNames(); while (enumeration.hasMoreElements()) { String name = (String) enumeration.nextElement(); params.put(name, request.getParameter(name)); } label.handleInput(params); } }

Icon-Comment csg, 2 years and 269 days ago. Icon-Permalink

thanks!

Does this mean that the patch is incorporated into the main branch now? If so I might was well take a deep breath and upgrade…

Icon-Comment ThoMo, 2 years and 269 days ago. Icon-Permalink

@csg: The patches are not in uttoxeter (at least at the moment) but in my branch (see above). Of course I don't guarantee the upgrade will work. Feel free to use/try it but on your own risk.
Please login to post a comment.

What is SnipSnap?
SnipSnap is a free and easy to install weblog and wiki tool written in Java.

SnipSnap download
Current version: 1.0b3-uttoxeter
Try our >>Web Start Demo!

Resources

5567 Users and 13712 Snips. Installed 6 years and 9 days ago

Logged in Users: (1)
… and 11 Guests.

snipsnap-changed for older changes.

< July 2008 >
SunMonTueWedThuFriSat
12345
6789101112
13141516171819
20212223242526
2728293031

snipsnap
Listed on BlogShares
XHTML 1.0 validated
CSS validated
RSS 2.0 validated
RSS Feed

pico-powered

Powered by SnipSnap 1.0b3-uttoxeter
YourKit >>Java Profiler

Fraunhofer FIRST

snipsnap.org | Copyright 2000-2006 Fraunhofer FIRST