9 Replies Latest reply: Sep 1, 2009 7:25 AM by Doctor Phil
jjschultz Level 1 (0 points)
We'd like to change the "Wiki" and "Blog" links in the header of the our school wikis to "Home" and "News" respectively.

We've successfully created a new template and modified CSS and plists but we're at a loss as to how to change the links in the header.

I gather it has something to do with the XSL files but I'm stuck as to the specifics.

Any help would be appreciated.

MacTel xServe, Mac OS X (10.5.8)
  • Doctor Phil Level 1 (15 points)
    If you just want to change the words that are used, I would think you could change the localization file. If you look here...

    /Library/Application Support/Apple/WikiServer

    ...you'll find some localization folders, each ending in "lproj." Assuming your site is using the English localization file, here's what I would do.

    First, make a backup of the en.lproj folder. Open terminal, CD to the folder above, and use the ditto command as root to make an exact copy. Like this...

    sudo ditto en.lproj en.lproj.backup

    Now that you have a backup of this folder, open the en.lproj folder, then open the default.strings folder in a text editor (that can authenticate as root) or run pico as root like so...

    sudo pico en.lproj

    Now just find the strings you want to change. To change the words in the header, scroll down to the nav string section, and change these lines...

    /* nav strings */

    /* nav strings */

    Save the file, reboot the web service, and you should see the changes take affect. You can look around in side of this file for other strings you might want to change, such as the string "Other Wikis" that appears in the footer.

    Hope this helps!
  • Macinator0102 Level 1 (0 points)
    Thanks for asking this question jjschultz because I've been fighting with the same problem for 2 days now.

    Great fix Doctor Phil, btw: I love your show!, but I have a bit of a problem with this fix because it changes the links for all of the groups. I treat one group as an entirely different wiki. Is there anyway to change these links for only 1 group do you think or is there another solution?

  • Doctor Phil Level 1 (15 points)
    The method I suggested earlier will indeed change the localization strings for all of your wikis. If you want to change just some of your wikis, you need to create a custom theme, with custom XSL files. This can be rather tedious, but I'll try to walk you through the steps.

    In /Library/Application Support/Apple/WikiServer/Themes/ find a theme you want to base your custom theme upon. Apple recommends using the Wireframe theme as a starting point in their "Extending Your Wiki Server" manual, and that's probably a good one to use. Using the ditto command as root, make an exact copy like this...

    sudo ditto wireframe.wikitheme/ customthemename.wikitheme/

    Of course, replace "customthemename" with a descriptive name of your choice (no spaces). If you have the "Extending Your Wiki Server" manual handy, you might want to refer to page 12 for more information about creating a custom them. There you'll see that an important step is to remove some lines from the theme.plist file so that your new custom theme can be selectable in the wiki settings. So inside of your new customthemename.wikitheme folder, edit the theme.plist file (as root) and remove these lines...

    <!-- remove this selectable key from your theme -->

    Save the file, then reboot the wiki server by issuing this command in a terminal window...

    sudo serveradmin stop teams; sudo serveradmin start teams;

    Alternatively, just issue the stop command, wait for confirmation, then issue the start command. Once the wiki (teams) service has restarted, go into a wiki that you want to change to the new theme. Login, go to settings, click the cute little pencil icon, then click the "choose themes" button. If all went well, your new custom theme should be available in the list. Select it and click OK.

    Now here's where the fun begins. You now have a custom theme, but there's only so much you can do with it. What you really want is to create custom XSL files. Apple's default XSL files for the wiki server are here...


    You might not need to customize all of these templates, but it's probably best to make an exact copy of all of them anyway and put them into your custom theme folder. You can use the ditto command (or any method that allows you to make an exact copy without changing the owner and user privileges).

    Once you've copied over all of these XSL files, you then need to edit the include lines in these files so that they point to the correct files. For example, in the all_settings.xsl file, you'll see this line...

    <xsl:include href="/usr/share/wikid/lib/apple_templates/default.xsl"/>

    You need to change that so that it points to the custom file...

    <xsl:include href="/Library/Application%20Support/Apple/WikiServer/Themes/customthemename/de fault.xsl"/>

    Note that you can't have a space in this path, so you have to replace the space between "Application" and "Support" with %20 so that the path resolves.

    At this point, I would suggest that you save the file, restart the wiki server, and make sure the wiki you set to the custom theme still works. If you make one wrong move in this process, the wiki server will reject the custom theme and revert your wiki back to the default theme. It's probably a good idea to restart the wiki server a few times while you are making these changes just to make sure you can retrace your steps if you make a mistake.

    Assuming all is well, now go through each and every one of the XSL files in your custom folder to correct the include statements. You can just copy and paste the path, or I suppose you could use an editor like BBedit to help streamline this. Note that not all of these XSL files have an include statement, and not all of them reference the same include file.

    Once you have all of the include statements pointing to the correct custom paths, now you can edit the default.xsl file to produce the desired behavior. To change the links in the navbar, comment out the toolbar links...

    <!-- toolbar links -->
    <xsl:for-each select="context/webAppToolbarLinks/item">
    <li id="{id}"><a href="{url}" class="{class}"><xsl:value-of select="name"/></a></li>

    And then add the code that changes the names of the links...

    <li id="linkWik"><a href="{context/link}wiki/" class="selected">Customlabel</a></li>
    <li id="linkBlo"><a href="{context/link}blog/" class="">Customlabel</a></li>

    Putting whatever you want in place of Customlabel. Note that you should use {context/link} in the url here, as this will substitute the correct path of the wiki.

    Save the file, restart the wiki server, and with any luck, you'll see the results of your labors. Then take a break and have a beer.

    Message was edited by: Doctor Phil
  • Macinmypocket Level 1 (0 points)
    Is it possible to use a similar process to the one provided by Dr Phil to change where the links "Wiki" and "Blog" Point? My ultimate goal is to have "Wiki" point to one groups wiki, and "Blog" point to another groups blog, and I'm looking for this to apply to every page, between the groups.

    Is there any way to do this?

    I would greatly appreciate any help accomplishing this.
  • Macinator0102 Level 1 (0 points)
    That last recommendation worked great Doctor Phil, thanks! The little arrow does not move over the page you are viewing, but that's not important to me at least.
  • Doctor Phil Level 1 (15 points)
    I believe the downward pointing triangle (arrow) that you may be referring to is part of the CSS definition for the "webapptoolbar a.selected" class, which is defined in the Block theme's CSS file "header.css" found in /usr/share/collaboration/themes/block/screen/header.css. The actual triangle image is found in the image subdirectory in that foder (it's called norgie.png).

    If you study the CSS file, you should be able to figure out how to add a similar style to your customized Wireframe style (which doesn't appear to have a "webapptoolbar a.selected" class definition. If you do so, you might want to recolor norgie.png as needed to enhance visibility.
  • Doctor Phil Level 1 (15 points)
    I don't see why you couldn't do this. Once you've defined a custom theme with your own XSL files, you are pretty much in control. Just point the links in the webapptoolbar section where you want.

    I'd suggest that you first add the links to the webapptoolbar, just to make sure you don't lose any needed functionality by replacing them. And remember, the customizations you make to a theme only applies to those pages that use that theme. So if you want to enforce customizations site-wide, just make sure your users are only able to select themes that you've customized.
  • Stefannn Level 1 (0 points)
    Is there generally a way to put in new links in the navigation bar? I've been searching through all the files, but I did not find anything.

    Next to "Updates Wikis Blogs calendar mail" I would like to have some other links.

    Any help is appreciated!

    Thanks, Stefan
  • Doctor Phil Level 1 (15 points)
    Yes, using the method I outline above. Once you have a custom template with your own custom XSL files, you are in control of what appears on this line (and for that matter, pretty much the entire page). Please see my discussion above, where I describe this process in great detail.