Contributed Templates: The "mrg" Template#

OK, so the name isn't terribly creative (my initials), but maybe someone will like it. I tried to keep it fairly clean and I've tested it on Mozilla and IE and it looks OK (tested on JSPWiki 2.0.36, 2.0.39, and 2.0.45). This is what it looks like:

ContributedTemplate/mrgScreenshot_sm.png

See the larger screenshot at the bottom of the ContributedTemplate page for more detail (unfortunately, I cannot seem to make a link to the larger version). If you are convinced/ready, then download version 5(info) and install it.

Installation Instructions and Notes#

WARNING: Version 5 of the template replaces the UserPreferences.jsp file, which is not in the template directory, but a part of the main distribution. I modified this file to support two additional cookies (for the editor width and height) and it works with the version of JSPWiki I am running (2.0.36), but I would advise making a backup copy of your file before installing the new one.
  • Simple Instructions
    • Unpack the ZIP file (mrgTemplate.zip) in your JSPWiki installation directory.
    • Edit jspwiki.properties and change the template from "default" to "mrg".
    • Edit jspwiki.properties and search for "specialPage" in the file. You will need to add an entry like jspwiki.specialPage.SiteLogoRedirect = http://www.myHomePage.com/ in order for the site logo to take you to a home page.
  • Not-so-Simple Instructions
    • Unpack the mrgTemplate.zip file, which will give you two directories, images and templates. There is also an additional PrintFriendly.jsp file which enables the "Printer Friendly Version" links and a new UserPreferences.jsp file which adds cookies for the editor width and height (this file already exists in your JSPWiki installation).
    • Copy images/* (the files) into your JSPWiki images directory.
    • Copy templates/mrg (the directory and contents) into your JSPWiki templates directory.
    • Copy PrintFriendly.jsp into your JSPWiki installation directory (the top-level, not the template subdirectory).
    • Copy UserPreferences.jsp into your JSPWiki installation directory (the top-level, not the template subdirectory).
    • Edit jspwiki.properties and change the template from "default" to "mrg".
    • Edit jspwiki.properties and search for "specialPage" in the file. You will need to add an entry like jspwiki.specialPage.SiteLogoRedirect = http://www.myHomePage.com/ in order for the site logo to take you to a home page.

When you get annoyed with the highly annoying and trivial logo in the upper left, replace SiteLogo.gif (in the images directory) with one of your own design.

That should be about it for installing the template. If not, please edit this page and add to the installation notes. I am still making changes and tweaking things. If anyone has suggestions, please add them here.

Oh, the border color is #003366 (RGB) and should be completely contained in the CSS file. This is fairly easy to change, but you would also need to edit Corner1.gif and Corner2.gif (the rounded corners) in the images directory if you want to use a different color (which stinks).

Thanks!

--MichaelGentry

Comments, Notes, and sadly, Bug Reports#

This looks very nice. Congrats, you got to be the first :-). --JanneJalkanen

Indeed, simple and elegant. A suggestion: make the site logo a link to the home page.

--PaulDownes

I agree the site logo should be a link to a home page, but the question is, which home page? For example, what if you want it to take you to your company's home page (or a project home page) instead of the starting wiki page? What I'd prefer is to set it in jspwiki.properties (perhaps jspwiki.homePage?) and link to that location. However, I'm a newbie at JSP development and didn't know how to do it off the top of my head, so it got pushed to the back burner and I forgot about it. If anyone knows how to do it quickly, please add it here and I'll update the template. Otherwise, I'll get to it Real Soon Now. :-)

Thanks!

--MichaelGentry

I uploaded a new version (#2) of the template. The primary improvements to the original are:

  • Inclusion of the paperclip icons by recently uploaded by PaulDownes
  • Removal of borders around paperclip icons
  • Site logo now hyperlinks/redirects to a home page

To set the home page for the site logo, edit jspwiki.properties and search for "specialPage" in the file. You will need to add an entry similar to:

jspwiki.specialPage.SiteLogoRedirect = http://www.myHomePage.com/

--MichaelGentry

Consider adding the CalendarTag to the foot of the LeftMenu.

I experimented with it today, and on the CalendarTag page is a screenshot that shows what this looks like, as part of a comparison with the Coldbeans Calendar taglib.

--PaulDownes

Looks interesting, Paul. Maybe I'm just dense, but how the heck do you use the CalendarTag? I added it, but all I get is a calendar (no links, etc.), which is nice in it's own right, but would be nicer if it could link to something. If only I had access to the source here ... :-) Thanks!

--MichaelGentry

Um, sorry guys. I haven't actually documented the CalendarTag yet, since it was just something that I added ad hoc for my WebLog. I didn't realize someone else might find it interesting as well :-). (Update, the CalendarTag has now been documented in the current distro).

--JanneJalkanen

hey Michael. your template is great. the standard wiki look is not that nice. things i miss are a documentation about the css files. from my point they are a little bit skeleton,

--Heinz-Josef

Version 3 of the template has been uploaded. Only minor changes between it and version 2. The main changes being:

  • Removal of LeftFooter.jsp and SearchBox.jsp (they weren't being used).
  • LeftMenu.jsp being changed to move the "Edit This Menu" link up to be beneath the portion you would edit. The "Edit This Menu" link works like the "Edit This Page" link in that it only appears if your preferences are set (to encourage editors to set their preferences). It also displays the current JSPWiki version at the bottom now, too.
  • PreferencesContent.jsp was modified in layout and I added two fields, which are only wish-list items at the moment, but are serving as place holders (editor width and height). Janne: how hard would it be to actually implement that?
  • PreviewContent.jsp and ViewTemplate.jsp were slightly modified (nothing major).

If you are upgrading from a previous template, the images didn't change, so only update your template files.

Paul: I don't have the calendar plugin included yet -- haven't had time to figure it out, etc. If you have further suggestions/hints on that, I'd love to hear them.

Thanks,

--MichaelGentry

Some ideas on language support

I'm not very good in jsp so i just post this idea instead of develop it myself. my idea is to read all langusge specific visible text from a extra file, where variables for e.g the text [Search Wiki] are stored like search_wiki = Wiki durchsuchen. This variables (here in german) could easy be edited and devolping a language specific jspwiki would be easyier.

--Heinz-Josef Lücking

I agree. Let's continue this on Ideas - Wiki Localization.

-- Janne Jalkanen

On 26 March I installed the latest stable Wiki (2.0.36) and the latest mrg template.

There is a problem in LeftMenu.jsp

the orginal code is (starting at line 6)

<wiki:PageExists page="LeftMenu" />
  <wiki:InsertPage page="LeftMenu" />
  <wiki:UserCheck exists="true">
    <div class="footer">
      <br clear="all" />
      <wiki:EditLink page="LeftMenu">Edit This Menu</wiki:EditLink>
    </div>
  </wiki:UserCheck>
</wiki:PageExists>
The page blows up on line 14, but the real problem is line 6, the slash at the end closing the PageExists tag set should not be there.

Thanks!!!

--Foster Schucker

Indeed. I've fixed my local copy and I'll put a new template here soon (I've made a few other changes, too, so it won't be for this one issue). Thanks! --MichaelGentry

I have a site with a large number of attachements to each page. I made a few changes to the UploadTemplate.jsp file.

If there was a long list of files and the screen pops up and scrolls to the end.

line 15
<body class="upload" bgcolor="#FFFFFF"
      onLoad=location.href="#bottom">

line 60
         </td>
        <A NAME="bottom"></A>
        </table>
I also made the size of the file name box larger so the user can see the entire path.
line 54
<input type="file" name="content" size=60 maxLength=512>
--Foster Schucker

Version 4 of the template has been uploaded. The improvements, at least the ones I remember, include:

  • A "Printer Friendly Version" link/JSP, which displays a "clean" version of the page for printing.
  • Better checking of your username at various points in the templates (it really wants you to visit the UserPreferences page to enter your username, now).
  • Speaking of UserPreferences, it includes two extra (unused, currently) fields as an example/hint for JanneJalkanen. :-)
  • Includes the LeftMenu.jsp fix by FosterSchucker and also his changes to the upload template.
  • Added the JSPWiki version in the LeftMenu.
  • Probably a few other things, but ... that's all I remember at this point.

--MichaelGentry

The "Printer Friendly Version" is very cool! But, if you are running a non version file system, it gets an error. The default JSP Wiki file provider does not do versions.

Insert the try catch code about line 50 of PrintFriendly.jsp:

    if( (rev != null) )
    {
        try { version = Integer.parseInt( rev );
	} catch (NumberFormatException e) { version = -1; } 
    }

--FosterSchucker

I'm beginning to think I should send my templates to you for debugging before I upload them, Foster! ;-) Thanks for the update. I only use the versioning file provider, so I wouldn't have found that one. I've made the fix locally and it'll be included in Version 5 at some point. --MichaelGentry

I test against the basic file provider and the versioning file provider; Resin and JBoss; Win2000 and Linux; IE5 and NS4. :-) I'd be happy to test them if you want to send them my way. (BTW, I almost have it working on NS4, the table has gaps)

I also changed the code above, version -1 is the current version. For some reason I thought version 0 was the current version.

--Foster Schucker

Sorry - I tried this fix and still get an "An unknown exception java.lang.NumberFormatException was caught by Error.jsp." error, when I try print a page with call such as:

http://localhost:8080/brainbox/PrintFriendly.jsp?page=Main&version=
I am not running any version control at all (local testing) - could this be it? If so, how to fix? Or what else could it be?

Thanks!

--GamesBook

I just tried "/PrintFriendly.jsp?page=Home&version=" on my setup here and it worked fine. I'm using the VersioningFileProvider with JSPWiki 2.0.36 currently. Then I tried it on my home server (JSPWiki 2.0.39) and got this output:

 For input string: ""
So, there is clearly a difference between the two JSPWiki versions, but I do not know what currently (haven't looked into it). If you try the VersioningFileProvider, the problem may go away, but it is still something that should looked into. If you'd like, provide me with additional information about your setup. Thanks!

--MichaelGentry

I have now set the versioning provider to be "jspwiki.pageProvider = VersioningFileProvider" (but I am still concerned that the code does not work without this, which is likely to be the case on our production server until I get support to help ;-) ) and I no longer get the previous error. BTW, I am running JSPWiki 2.0.39, under Tomcat 4.04, Windows XP. Production will be a Solaris machine. Any pointers (that I can pass on to support) on how to get a versioning provider setup there? Thanks!

--GamesBook

VersioningFileProvider does not need anything special across platforms - it does everything on its own.

As for the problem mentioned above, I can't really say much at this point - I will investigate this closer.

(And someone asked about the PrintFriendly.jsp? I was really considering making either a print-CSS available to the default template, or adding a "plain" template that contains nothing extra such as the menus, or something. Then it would be easy to make a "PrintThisPageTag" or something.)

-- JanneJalkanen

Hi we use the breakTitleWithSpaces = true niceties. We noticed that with the PrintFriendly.jsp it did not strip the spaces out of the title and would therefore not display the pages. Below is a snippet we added to the jsp to make it work. Great template! Thanks for the work.

-- Shawkins

    String pagereqTmp = wiki.safeGetParameter( request, "page" );
    String skin    = wiki.safeGetParameter( request, "skin" );
    String pagereq;
    
    if( pagereqTmp == null )
    {
        pagereq = wiki.getFrontPage();
    }
    else 
    {
      StringBuffer buffer = new StringBuffer();
      String letter;
      for( int i=0; i< pagereqTmp.length(); i++ ) {
           letter = pagereqTmp.substring( i,i+1 );
           if( !(" ".equals( letter )) ) 
           {
               buffer.append( letter );
           }
      }
      pagereq = buffer.toString();
    }

I've made the fix locally and it'll be included in Version 5. Thanks! --MichaelGentry

Actually, the problem is with the link on ~PageHeader.jsp: if you want to be absolutely sure that your page name is a canonical page name (not expanded or anything), use <wiki:Variable var="pagename"/> instead of <wiki:PageName/>.

-- JanneJalkanen

An even better fix! -- Shawkins

Q - How do I solve the problem of the printer friendly version link expanding wiki words to include spaces in them? I edited the ~PageHeader.jsp file, searched for wiki:PageName/ found it x2 in the file and replaced them both with wiki:Variable var="pagename"/. I uploaded the file, then stopped and restarted Tomcat twice. I still get the space in the link for wiki words. How do I fix this? -- MatthewSimpson

    • Michael, not sure if you want to note this, or how you would want to work this, but by doing a WinZip extract targeted to /JSPWiki, the folder structure was retained, placing all files in the correct folders. I just said 'no' to calls to overwrite. -- MatthewSimpson
Matt, I think the "Simple Instructions" now include what you were talking about. Thanks! --MichaelGentry

Version 5 includes the fix for the Printer Friendly problem by replacing <wiki:PageName/> with <wiki:Variable var="pagename"/> suggested by JanneJalkanen. I don't use the "breakTitleWithSpaces" option, so if Shawkins or someone else who uses that could let me know if it works, I would appreciate it. Version 5 also fixes all the other bugs reported above (I hope!), so it's time for all new bug reports -- I'm expecting at least one from FosterSchucker! Pic/smile.png

--MichaelGentry

I just tried it. And I use break title with spaces. It works! You can see this at http://undertheoak.net:8180/wiki/ Thanks!!! I really like the links to Edit, More Info, and Attach Files in addition to the Printer Friendly. Many thanks! -- MatthewSimpson

I'm glad it works for you, but I can't see it at the link you listed. Our company firewall only allows ports 80 and 443 outbound (which sucks). I can't even sync up to the CVS repository for JSPWiki (which also sucks). Anyway, I'm glad it fixed that problem for you (and others). Hopefully it'll be stable for everyone now.

--MichaelGentry


When installed the template and go to my site it doesn't show me a page, it displays the following text instead:

/templates/msg/ViewTemplate.jsp

I am using resin on w2k and the wiki is the root application. Any ideas?

s/msg/mrg/g

--MichaelGentry


A Wish for the MRG Template#

I'm using it now, and loving it. The one thing I would wish for is a right hand margin. Any ideas about that? How could it be done? -- MatthewSimpson

Well, there is a small margin there already (8 pixels, I believe). You could increase this value in your copy of the template to give more of a right-hand margin. Look for the <td width="8"> tags (the ones right before the </tr> tag in PageHeader.jsp (such as on line 23 in Version 5) and change it to something more suitable for you. I personally don't want a big value there because if I have a preformatted code section, I run the risk of a horizontal scrollbar, which I don't like (I have a small 14" monitor on this laptop, so space is at a premium). I like to see as much as possible on the screen (I know, I should probably eliminate the left-hand menu, too, but I can always do the printer-friendly view if I really need to read something with extra space). --MichaelGentry
Should I change them all? I changed the one on line 23. Nothing changed....(later...) Now I changed them all and nothing changed. I changed the 8 to an 18. ... (later...) Okay... now I've removed all the compiled jspwiki files... that seemed to have helped. I only seemed to need to have changed the # on line 23... I changed it to a 28... at http://undertheoak.net -- Matthew Simpson

Where are the RSS icons?#

Hi. Love the template, but it doesn't show the RSS icons. Is there a way I can fix this?

Thanks, Rob

Rob, I intentionally removed the RSS icons (sorry) because I wasn't using them. I now have a more official internal server which we run our WikiWeb on, so I can probably do the RSS feeds (enable them, enable the icons, etc). I'll try to do this when I have time.

I've also added a "Create Page" option in the left menu, too, but that hasn't been released yet. Perhaps I can roll these two changes together. Thanks!

--MichaelGentry

Rob,

Try adding:

<p>
<div align="center">
  <wiki:RSSImageLink title="Aggregate the RSS feed" /><br />
  <wiki:RSSUserlandLink title="Aggregate the RSS feed in Radio Userland!" />
</div>
</p>

at the end of LeftMenu.jsp to restore the RSS icons/links.

--MichaelGentry


I installed Version 5 at schucker.org and it is working very well. Changes I made were to put the calendar and the Create new page box on the left navigation bar. I updated the template and the CSS to support early Netscape versions. I'm on the 2.0.x codebase, and it looks very solid there. --FosterSchucker


Updates for 2.1.x?#

Michael, Since I'm using your template (quite nice thanks!) and am working with the 2.1.89 version, I'm curious if you have any interest or intention to add the auth related bits to your template (Login.jsp, etc from the 'default' template)? Lazy guy that I am, I'd rather not undertake it myself. If a few other goodies that are in 2.1.89 'default' make it in, I'd be glad too (hmm, that search term highlighter is cool). I'm getting ready to start playing with the Authentication And Authorization bits in 2.1.89 on our wiki's and either need that stuff in your template, or I'll have to branch and patch myself (ick). How about let me know if this sort of upgrade is in the cards anytime soon. --JohnV, Feb 3 2004

Hi John,

To be honest, I haven't looked at the 2.1.x release at all. I got swamped at work the last 3-4 months of 2003 and am just now almost unburied from it. I suspect at some point I'd like to upgrade our internal Wiki when 2.1.x is stable (is it stable now?), which would mean updating the template, most likely. If the new authorization system allows you to password protect individual pages, I'd be all in favor of that (or even clusters of pages). I tried to set up a "Passwords" page here, but had to give up because I couldn't password protect the page (we have LOTS of passwords for our various systems and my brain isn't big enough -- hence the use of a Wiki).

If you uncover problems with my template in 2.1.x (before I get to it), please let me know and we can work out the details.

Thanks!

--MichaelGentry

Michael, We use 2.1.89 with your template and it works just fine. No issues. Furthermore 2.1.89 seems stable for all basic uses. The new SET alias and SET redirect directives seem to good for basic use too. (I think the alias bit isn't tied into the ReferenceManager quite right for some plugins, but it does work.) I've NOT tried the new ALLOW, DENY features of the login based security primarily because your template doesn't have the login bits exposed. Maybe Janne or someone could comment on the general stablity of 2.1.89 in regards to the security bit?

Your passwords example is classic for the ALLOW, DENY security model. I really need security on a per page basis for our internal wikis. Right now we run with Tomcat secrity on whole wiki's, and to give people access to bits we have to open up "too much" sometimes. When I get a chance I'll push on 2.1.89 with the default template and report how well the ALLOW, DENY model seems to hold up. Regards JohnV.

UI for the security part works and is stable. But there's a big change in the API (Ebu has found some serious issues with it), so we'll get those in before we release beta.

-- JanneJalkanen


Michael, the jspwiki.css seems to use some non-CSS properties, such as the size for HR. height would be better.

-- Heikki


I've had no luck trying to change the background color on the edit page (that pink is awful, like the rest of the template). I changed it in the css file. That didn't work. Then I looked at the js code and figured since I was on a mac, maybe I had to change it in the mac css file. Nada.

-- Rob


On JSPWiki 2.2.28 I was having a pesky NullPointerException when I attempted to execute any "Printer Friendly" link. I fixed this by changing line 78 of PrinterFriendly.jsp from:

String contentPage = "templates/"+skin+"/PrintTemplate.jsp";

...to...

// ntedesco -- Fix mgr bug
String contentPage =
    wiki.getTemplateManager().findJSP(
        pageContext,
        skin,
        "PrintTemplate.jsp" );

-- NicoleTedesco


MRG Remixed#

I created a ''remixed''(info) version of this great template that applies the MRG layout to the latest and greatest from the JSPWiki "default" template (as of 2.2.16 beta). I also added some features from BrushedTemplate that I really like: BrushedTemplateCollapse and BrushedTemplateTOC. I had to make small changes in different files to align their assumptions with the latest behavior from default. I think the user preferences handling needs some fine tuning but other then that it all seems to work fine.

Enjoy, -- NascifAbousalhNeto

The MRG remixed zip file curently available seems to be incomplete. It does not contain the necessary image files. Also it installs into the default template directory instead of its own named directory.
04-Oct-2005 tewr

I added a new .zip file. It is basically the same, but with a proper name for the template directory instead of "default" and I believe all the images. Let me know if something is still missing.
10-Oct-2005 NascifAbousalhNeto

Add new attachment

Only authorized users are allowed to upload new attachments.

List of attachments

Kind Attachment Name Size Version Date Modified Author Change note
zip
mrg-remix.zip 59.8 kB 2 06-Oct-2005 23:59 NascifAbousalhNeto
« This page (revision-57) was last changed on 27-Jul-2010 15:29 by 孙兵