Package org.apache.wiki

Examples of org.apache.wiki.WikiEngine


        public void preInvoke(Object context, Object instance, Method method, Object[] arguments) throws Exception {
            if (context instanceof HttpServletRequest) {
                boolean canDo = false;
                HttpServletRequest req = (HttpServletRequest) context;

                WikiEngine e = WikiEngine.getInstance(req.getSession().getServletContext(), null);

                for (Iterator i = c_globalObjects.values().iterator(); i.hasNext(); ) {
                    CallbackContainer cc = (CallbackContainer) i.next();

                    if (cc.m_object == instance) {
                        canDo = e.getAuthorizationManager().checkPermission(WikiSession.getWikiSession(e, req),
                                cc.m_permission);

                        break;
                    }
                }
View Full Code Here


        return SKIP_BODY;
    }
      
    public int doEndTag() throws JspException
    {
        WikiEngine engine = m_wikiContext.getEngine();
        EditorManager mgr = engine.getEditorManager();
       
        String editorPath = mgr.getEditorPath( m_wikiContext );
       
        try
        {
            String page = engine.getTemplateManager().findJSP( pageContext,
                                                               m_wikiContext.getTemplate(),
                                                               editorPath );
           
            if( page == null )
            {
View Full Code Here

    public int doWikiStartTag()
        throws IOException,
               ProviderException
    {
        WikiEngine engine = m_wikiContext.getEngine();
        WikiPage   page;

        if( m_pageName == null )
        {
            page = m_wikiContext.getPage();
        }
        else
        {
            page = engine.getPage( m_pageName );
        }

        // System.out.println("Checking "+page);

        if( page != null && engine.pageExists( page.getName(), page.getVersion() ) )
        {
            return SKIP_BODY;
        }

        return EVAL_BODY_INCLUDE;
View Full Code Here

        if( m_iterator != null && m_iterator.hasNext() && m_count++ < m_maxItems )
        {
            SearchResult r = (SearchResult) m_iterator.next();
           
            // Create a wiki context for the result
            WikiEngine engine = m_wikiContext.getEngine();
            HttpServletRequest request = m_wikiContext.getHttpRequest();
            Command command = PageCommand.VIEW.targetedCommand( r.getPage() );
            WikiContext context = new WikiContext( engine, request, command );
           
            // Stash it in the page context
View Full Code Here

    /**
     *  Returns a link to the given day.
     */
    private String getDayLink( Calendar day )
    {
        WikiEngine engine = m_wikiContext.getEngine();
        String result = "";

        if( m_pageFormat != null )
        {
            String pagename = m_pageFormat.format( day.getTime() );
           
            if( engine.pageExists( pagename ) )
            {
                if( m_urlFormat != null )
                {
                    String url = m_urlFormat.format( day.getTime() );

View Full Code Here

    @Override
    public final int doWikiStartTag()
        throws IOException,
               ProviderException
    {
        WikiEngine       engine   = m_wikiContext.getEngine();
        JspWriter        out      = pageContext.getOut();
        Calendar         cal      = Calendar.getInstance();
        Calendar         prevCal  = Calendar.getInstance();
        Calendar         nextCal  = Calendar.getInstance();

        //
        //  Check if there is a parameter in the request to set the date.
        //
        String calendarDate = pageContext.getRequest().getParameter( "calendar.date" );
        if( calendarDate == null )
        {
            calendarDate = pageContext.getRequest().getParameter( "weblog.startDate" );
        }
       
        if( calendarDate != null )
        {
            try
            {
                Date d = m_dateFormat.parse( calendarDate );
                cal.setTime( d );
                prevCal.setTime( d );
                nextCal.setTime( d );
            }
            catch( ParseException e )
            {
                log.warn( "date format wrong: "+calendarDate );
            }
        }

        cal.set( Calendar.DATE, 1 );     // First, set to first day of month
        prevCal.set( Calendar.DATE, 1 );
        nextCal.set( Calendar.DATE, 1 );

        prevCal.add(Calendar.MONTH, -1); // Now move to first day of previous month
        nextCal.add(Calendar.MONTH, 1)// Now move to first day of next month

        out.write( "<table class=\"calendar\">\n" );

        HttpServletRequest httpServletRequest = m_wikiContext.getHttpRequest();
        String queryString = engine.safeGetQueryString( httpServletRequest );
        out.write( "<tr>"+
                   getMonthNaviLink(prevCal,"&lt;&lt;", queryString)+
                   "<td colspan=5 class=\"month\">"+
                   getMonthLink( cal )+
                   "</td>"+
View Full Code Here

    @Override
    public final int doWikiStartTag()
        throws IOException,
               ProviderException
    {
        WikiEngine engine = m_wikiContext.getEngine();
        WikiPage   page   = m_wikiContext.getPage();

        if( page != null )
        {
            PageManager mgr = engine.getPageManager();

            PageLock lock = mgr.getCurrentLock( page );

            HttpSession session = pageContext.getSession();
View Full Code Here

     @return Empty string, if there is no change.
     */
    private static Change getChange( WikiContext context, String newText ) {
        WikiPage page = context.getPage();
        StringBuffer change = new StringBuffer();
        WikiEngine engine = context.getEngine();
        // Get current page version

        Change ch = new Change();
       
        try {
            String oldText = engine.getPureText( page.getName(), WikiProvider.LATEST_VERSION );

            String[] first  = Diff.stringToArray( oldText );
            String[] second = Diff.stringToArray( newText );
            Revision rev = Diff.diff( first, second, new MyersDiff() );

View Full Code Here

     * @param pageContext The PageContext
     * @return A HTML string which contains input fields for the SpamFilter.
     */
    public static final String insertInputFields( PageContext pageContext ) {
        WikiContext ctx = WikiContext.findContext( pageContext );
        WikiEngine engine = ctx.getEngine();

        StringBuilder sb = new StringBuilder();
        if( engine.getContentEncoding().equals( "UTF-8" ) ) {
            sb.append( "<input name='encodingcheck' type='hidden' value='\u3041' />\n" );
        }

        return sb.toString();
    }
View Full Code Here

    private List getItems()
    {
        ArrayList<Element> list = new ArrayList<Element>();
        SimpleDateFormat fmt = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss 'GMT'");

        WikiEngine engine = m_wikiContext.getEngine();
        ServletContext servletContext = null;

        if( m_wikiContext.getHttpRequest() != null )
            servletContext = m_wikiContext.getHttpRequest().getSession().getServletContext();

        for( Iterator i = m_entries.iterator(); i.hasNext(); )
        {
            Entry e = (Entry)i.next();
            WikiPage p = e.getPage();

            String url = e.getURL();

            Element item = new Element("item");

            item.addContent( new Element("link").setText(url) );

            item.addContent( new Element("title").setText( e.getTitle()) );

            item.addContent( new Element("description").setText( e.getContent()) );

            //
            //  Attachments for enclosures
            //

            if( engine.getAttachmentManager().hasAttachments(p) && servletContext != null )
            {
                try
                {
                    Collection c = engine.getAttachmentManager().listAttachments(p);

                    for( Iterator a = c.iterator(); a.hasNext(); )
                    {
                        Attachment att = (Attachment) a.next();

                        Element attEl = new Element("enclosure");
                        attEl.setAttribute( "url", engine.getURL(WikiContext.ATTACH, att.getName(), null, true ) );
                        attEl.setAttribute( "length", Long.toString(att.getSize()) );
                        attEl.setAttribute( "type", getMimeType( servletContext, att.getFileName() ) );

                        item.addContent( attEl );
                    }
View Full Code Here

TOP

Related Classes of org.apache.wiki.WikiEngine

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.