In-Line Comments


It can be useful for multiple authors to be able to leave notes & comments for each other within the body of text (this happens in various word processors for example). This action is a simple commenting system that allows authors to leave notes within the body of the text. I've also modified the file (colours & indicator letter) to provide in-line "Help" information.

This action takes advantage of the wonderful little tooltip script written by Walter Zorn and available at http://www.walterzorn.com/tooltip/tooltip_e.htm

Place the tooltip script (with it's original name wz_tooltip.js) in the wiki root in a directory called scripts. Make sure to copy the .htaccess file from eg. the action folder to prevent RewriteRules from applying, or see http://wush.net/trac/wikka/browser/branches/1.1.6.2/css/.htaccess

Place the following code, in a file called tag.php, in the actions directory...
<?php
//       tag.php V1.0 copyright by G. M. Bowen & Andrew Somerville for use in wikka wiki as part of a SSHRC research project.
//  Released under GPL.
//  Useage: {{tag comment="This is a comment on this part of the paragraph!"}}
//  REQUIRES Walter Zorn's wz_tooltip.js to be placed in a directory called "scripts" in the wikka root directory
//  Note to users....there's LOTS of room for modifying this tooltip for your own uses. I've only used a few of the available features....see the original site.

echo '<span onmouseover="'.
        'this.T_FONTCOLOR=\'#000066\';'.
        'this.T_BORDERWIDTH=1;'.
        'this.T_WIDTH=\'225\';'.
        'this.T_BGCOLOR=\'#e6ecff\';'. 
        'this.T_FONTSIZE=\'12px\';'.
        'this.T_PADDING=\'5\';'.
        'this.T_TITLE=\'Comment...\';'.
        'return escape(\'' . strip_tags($comment). '\')"><sup><strong><span class=\'exttail\'>T</span></strong></sup></span>';

echo "<script language=\"JavaScript\" type=\"text/javascript\" src=\"./scripts/wz_tooltip.js\"></script>"; 
?>


I've modified and updated this handy gadget to work with Walter Zorn's latest tooltip v5.31 (the tag.php v1.0 above only works with the older tooltip version 3.45), and also added a link parameter so that clicking on the tag leads to a page that can be referenced in the tooltip. Playing around with the settings in wz_tooltip.js is worth it to make the tooltip look the way you like it.

<?php
//  tag.php v2.0 copyright by Axel Mulder for use in wikka wiki.
//  Released under GPL.
//  Useage: {{tag comment="This is a brief comment - for more info please go to WikkaPage by clicking on the link of this tag." link="WikkaPage" name="Tag name"}}
//  REQUIRES Walter Zorn's wz_tooltip.js v5.31 or higher to be placed in a directory called "scripts" in the wikka root directory
//  Make sure to copy the .htaccess file from eg. the action folder to prevent RewriteRules from applying, or see http://wush.net/trac/wikka/browser/branches/1.1.6.2/css/.htaccess
//  Note to users....there's LOTS of room for modifying this tooltip for your own uses. I've only used a few of the available features....see the original site.

if ($name == '') $name = 'Note';
if ($link == '') $link = $this->Href("",$tag,"");

echo '<span onmouseover="Tip(\'' . $comment . '\')" onmouseout="UnTip()"><sup><strong><span class=\'exttail\'><a href=\'' . $link . '\'>' . $name . '</a></span></strong></sup></span>';

echo "<script type=\"text/javascript\" src=\"./scripts/wz_tooltip.js\"></script>";
?>


/AxelMulder


CategoryUserContributions
Comments
Comment by DavidPotages
2006-09-07 22:08:17
Hi,
I really can't get this to work. After some tries, i think this is because the .js cannot be found, even though if i add a small js error handler it seems to try to load the file at the proper address. I tried several things, but really have no clue how to actually get this to work. Btw I activated mod_rewrite and use a base path.

Regards,

/David
Comment by DarTar
2006-09-08 03:34:21
David, to prevent RewriteRules from applying within a specific folder, you should add a .htaccess file like this:

http://wush.net/trac/wikka/browser/branches/1.1.6.2/css/.htaccess

Is this another candidate for F.A.Q.? Not the first time someone asks...
Comment by DavidPotages
2006-09-08 09:28:09
Actually i was trying this, but never put it into the scripts directory, i thought i had to put it into the action directory (even though i found this solution.. erm a bit ugly). Anyway got it to work.
Thanks for confirming it was related to the .htaccess, and yeah putting this to the FAQ would really save time, even though you can already find some infos in the user documentation.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki