Moved from Ideas#


FrancoisParlant (19.10.2003) -- insert header (javascript and meta)#

On a very limited number of pages, I need to insert script in header, or a special meta tag. I've added a little snippet in the head of viewtemplate.jsp, but I'm sure there are betters ways. If someone had an idea ?

Private Way#

The headers are not wiki pages: they are stored in template directory.
<% 
String pagereq2 = ((com.ecyrd.jspwiki.WikiContext)pageContext.getAttribute
  ("jspwiki.context", PageContext.REQUEST_SCOPE)).getPage().getName(); 
String pagereqHead = pagereq2 + "_head.jsp";
java.io.File file = new java.io.File(application.getRealPath
  ("templates/default/" + pagereqHead));
out.print(file.getPath());
if( file.exists())
{
    %>
         <jsp:include page="<%=pagereqHead%>" flush="true"/>
<%
    }
else {}
%>

Public Way#

The headers are wiki page, editable and addable by visitors:
 <% 
String pagereq2 = ((com.ecyrd.jspwiki.WikiContext)pageContext.getAttribute
("jspwiki.context", PageContext.REQUEST_SCOPE)).getPage().getName(); 
String pagereqHead = pagereq2 + "Head";
%>
<wiki:PageExists page="<%=pagereqHead%>">
<wiki:InsertPage page="<%=pagereqHead%>" />
</wiki:PageExists>  
ATTENTION: you need to escape square brackets in your javascript by double opening bracket document.form[[2].option


Just a few totally unimportant ideas:
  • I've put my old ideas in OldIdeas1 (If it wasn't a good idea, please flame me by email ;-))

--FrancoisParlant (14sept2003)


05.09.2003 -- Prefix to wikipages#

It's just an idea: maybe the wikipages, the docs, shipped with the software could be differenciated by a prefix let's say: all starting by "jw" or whatever. After just a few weeks of creating pages, I can't distinguish anymore which are the docs pages and how to browse them.

On the same way, all these pages could have a link to a [Category Wikipages], itself calling the referring Plugin.

I've tried something of this kind, on the latest sources, changing all the links inside by looping (hmm, not a real success). And I'm worried about line feed and carriage return issues on documents modified by an ms-dos batching ("never fits too well with unix LF" says two years correcting the start.bat on tomcat and cocoon)

-- FrancoisParlant

Actually, JSPWiki could not care less whether the pages are with UNIX or MS-DOS linefeeds. We use the MSDOS CRLF line feeds on all files, but that's just simply because one convention had to be chosen, and that is what HTTP uses. The only possible danger here is if you edit the pages using a text editor on an MSDOS machine, then move them across to an UNIX machine, without doing the conversion, it is possible that you start getting double linefeeds.

The official documentation pages should have (since 2.1 anyway) have links to Category Official Documentation.

-- JanneJalkanen


25.08.2003 -- Complete adress $getrequestcontext#

There is a $basename and a $baseurl variables, but I'm missing a $context variable because the jsp CheckRequestContext doesn't work in entry pages. It would help me to construct the current adress. JanneJalkanen gave the answer:
<%  String requestcontext = pageContext.getAttribute
WikiTagBase.ATTR_CONTEXT,PageContext.REQUEST_SCOPE)
.getRequestContext(); %>
or use the CheckRequestContextTag

--FrancoisParlant

This is a good idea. I'll add it.

-- JanneJalkanen

The $requestcontext variable is now in 2.1.70.


25.08.2003 -- Excluded html tags#

It seems to me that more and more bits of wiki language are getting replaced by html: links, anchors, images, ... Therefore it's easier to enable html than creating translation from wiki to html. Nevertheless, html (and then all the tag languages) is a security leak, and it might be good to make sure some tags are not allowed, especially, "script" tags, wich would be replaced by the translater.

--FrancoisParlant

Well, certainly JSPWiki is not adding any new components to the WikiMarkup - I'm really trying not to (aside from the double-percent sign styles in 2.1).

But some sort of HTML filtering would be useful in conjunction with jspwiki.allowHTML. Any takers?

--JanneJalkanen

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-14) was last changed on 06-Jun-2005 08:32 by Administrator