This is version . It is not the current version, and thus it cannot be edited.
[Back to current version]   [Restore this version]
The insert page plugin allows you to insert the contents of one page within another.
package com.hurlbert.jspwiki.plugin;

import com.ecyrd.jspwiki.*;
import com.ecyrd.jspwiki.plugin.*;

import java.util.*;

/**
 *  Inserts a WikiPage into another WikiPage.
 *  <P>
 *  <B>Parameters</B>
 *  <UL>
 *    <LI>pageToInsert - The page to be inserted.
 *  </UL>
 */

public class InsertPagePlugin implements WikiPlugin
{
	public static final String PARAM_NAME_OF_PAGE_TO_INSERT = "pageToInsert";

    public String execute( WikiContext context, Map params )
    throws PluginException
    {
        WikiEngine engine = context.getEngine();
        //
        //  Parse parameters.
        //
        String nameOfPageToInsert = "";

        if( (nameOfPageToInsert = (String)params.get(PARAM_NAME_OF_PAGE_TO_INSERT)) == null )
        {
            return "no page found";
        }
		//
		// We should now have a page to insert.
		//        
        StringBuffer sb = new StringBuffer();
        WikiPage wpage = engine.getPage(nameOfPageToInsert);
        //
        // Lets make sure we got a page
        //
        if( wpage == null )
        	return "page not found";
        else
			return engine.getHTML( context, wpage );
    }
}

Add new attachment

Only authorized users are allowed to upload new attachments.
« This particular version was published on 10-Jun-2003 09:29 by 12.233.6.217.