TouchGraph Plugin Dev
This plugin is based on
TWiki:Plugins/TouchGraphAddOn
My objective was to create a touchgraph applet as a TWiki plugin (see
TWiki:Plugins/TouchGraphAddOnDev
) with minimal modifications to the original java code.
My Modifications
build instructions
- Download the tgwb archive
.
- Modify as described above
- Compile it:
javac com/touchgraph/wikibrowser/TGWikiBrowserApplet.java
- Tie up the jar file:
jar cvmf META-INF/MainClass TGWikiBrowser.jar com/touchgraph/wikibrowser/*class com/touchgraph/graphlayout/*class images/kill.png com/touchgraph/graphlayout/graphelements/*class com/touchgraph/graphlayout/interaction/*class
- Publish the jar file e. g. at
%PUBURL%/%TWIKIWEB%/TouchGraphPlugin/
Todo
-
TouchGraphPlugin.pm replaces the %TGPOPUP% variable. Anyway this seems to be done automatically by the system?
- I kept the "tglaunch" skin for the view template that contains the applet code. This is similarily done in TWiki:Plugins/TouchGraphAddOn.
I'd rather like a normal topic (e. g. TouchGraphPopup) containing the Applet and popping up with the plain skin (like TextFormattingRules from edit mode) but I need to pass the refering web and topic to it and don't know how to do that.
- Applet:
- Follow topic transitions in the browser window by calling an applet method from JavaScript.
- Reduce the size of the button bar ( = mimimal applet size).
- Better handling of ambiguous search terms. Implement a find next?
--
ChristopherHuhn - 03 Mar 2004
I've encountered some problems, I don't know whether they are specific to my site or not. Details and continued testing
here
.
Serious problems
it pukes on the _default web; also fails on Sandbox for some reason (because of previous error?) now fixed! These
modifications for
tgdb should fix the errors processing _default (by simply skipping it).
Browser incompatibilites (Hint: specify Browser + OS +
Java Version)
- missing
toughgraph.txt crashes the FireFoxBrowser
- Pressing the OK button on the "Search Item Not Found" the dialog box that pops up also crashes Firefox/Win 0.7, Mozilla/Win 1.3a, Moz/Win 1.4b, all with J2RE1.4.0_1 on Win-XP and Win-2k
- Netscape 4 is okay -- 'cause it can't load the applet at all.
- Konqueror/Linux/J2EE 1.4.2: Applet does not initialize
- Working configurations:
- IE/Win 6 seems to be okay
- IE/Win 5.5
- Mozilla 1.4/Linux/J2EE 1.4.2
AFAICS calling the applet without existing touchgraph.txt produces an ugly NullPointerException. This should not crash the browser?!
Anyhow it's a good idea to catch it in the applet.
I have no clues why the applet does not initiallize in konqueror.
Annoyances
Following a link from the applet opens a new browser window (others might think this is a feature; if yes, should be a preference)
The applet opens all documents in a browser window named "wiki" that does not exist initially. This is solved by adding the following code to the TGPOPUP definition:
<script>window.name = 'wiki'</script>
The behaviour still occurs if the wiki page is a background tab in Mozilla.
Be nice if applet would resize with the parent browser window
Yes, that's a cool feature!
The
patch below brings resizing to IE users at least. Mozilla Firefox 0.7 (only on Windows?) sizes to fit the window horizontally but not vertically.
In Mozilla (on Linux ?) dynamic resizing of applets generally does not seem to work, so it's rather hard to implement:
- Let the popup window reload on resize and width and height of the Java Applet be calculated by JavaScript. Then the applet will be reset when you resize the window.
- Make the graph window a resizable java window that is opened by an applet contained in the main twiki widow (e.g. a button with the text "Graph"). Then Java will be loaded whenever whoever browses the wiki, even if he don't use the graph at all.
- Let the graph link open a browser window containing an (invisible?) applet that opens a resizable java window containing the graph: This seems really insane to me.
Maybe I'm going to test the first approach.
Maybe it's a good idea to make the initial size of the applet window a user preference as a backup measure for browsers where a dynamic solution is not available.
stuff to get to
- there is a new mechanism in all scripts for finding the twiki library files (see current alpha/beta releases)
- 'WebHome' is hardcoded as the default frontpage web name, should be %HOMETOPIC%
You refer to tgdb; How do I figure out the name of %HOMETOPIC% from that script? it's called $mainTopicname in lib/TWiki.cfg ,if that helps any.
- the "-q" quiet switch doesn't work
Tips
- if you put %TGPOPUP% in the WEBTOPICLIST in the preference topic(s) you don't need to customise any skins to add this to your site.
- manually force an update by going to
%SCRIPTURL%/tgdb%SCRIPTSUFFIX%
--
MattWilkie - 03-05 Mar 2004, --
ChristopherHuhn - 04 Mar 2004
I did this to make it fit the window:
diff -u templates/view.tglaunch.tmpl*
--- templates/view.tglaunch.tmpl 2004-03-07 17:09:31.000000000 -0600
+++ templates/view.tglaunch.tmpl~ 2004-03-07 17:05:52.000000000 -0600
@@ -9,7 +9,7 @@
<body style="horizontal-align: center; vertical-align: middle">
<!-- tag must be on one line for twiki! -->
- <applet name="wikiapplet" code="com.touchgraph.wikibrowser.TGWikiBrowserApplet" archive="%PUBURLPATH%/%TWIKIWEB%/TouchGraphPlugin/TGWikiBrowser.jar" width="99%" height="90%">
+ <applet name="wikiapplet" code="com.touchgraph.wikibrowser.TGWikiBrowserApplet" archive="%PUBURLPATH%/%TWIKIWEB%/TouchGraphPlugin/TGWikiBrowser.jar" width="500" height="500">
<param name="DATA_URL" value="%PUBURL%/%WEB%/touchgraph.txt"/>
<param name="WIKI_URL" value="<nop>%SCRIPTURL%/view/%WEB%/"/>
<param name="INITIAL_NODE" value="<nop>%TOPIC%"/>
--
MartinCleaver - 07 Mar 2004
I put
%TGPOPUP% into my
WebLeftBar. When I clicked on link it opens a window but main topic was always
WebLeftBar - not my current page. This is because
WebLeftBar is included topic. To solve this problem I had to change %TGPUPUP% definition: replace
%TOPIC% with
%BASETOPIC%.
--
PiotrKaminski - 20 Sep 2004
Commentary
AWESOME CHRISTOPHER! Thank you so much for turning the addon into something that really works. I'm going to bang on it some more before I provide the usual litany of 'how come it doesn't do this that or the other thing?'. I needed to get the thanks out right away though. |
--
MattWilkie - 03 Mar 2004
For Firefox/Win 0.7 this dynamically sizes to fit horizontally but not vertically.
With some experimentation I've managed to use CSS to feed each browser the intructions they honour without having to resort to browser detection
tglaunch_dyn-resize.diff. I think the code could be simplified/clarified a bit further.
I've tested it with with IE5.01, 5.5, 6; Firefox 0.7 , Moz 1.4b. all on Windows XP.
--
MattWilkie - 08 Mar 2004
I would suggest to add this nice feature to plugin distribution attached to
TouchGraphPlugin page. It would be easier to have all bugs fixed just after installation. Now I have to manually apply patches.
--
PiotrKaminski - 20 Sep 2004
Search Problems
Totally COOL !! Thanks. If nothing else does it, this plugin will help TWiki to gain acceptance in my organization.
After some further testing, I've found the following problems with the search bar :
- To press
ENTER in the search field does not submit the form, instead it opens a new window (by some name other than wiki) with the URL of the highlighted applet topic plus ?term={searchterm}
- For example, type
whatever into the search box & press ENTER
- Result is a new widow of the URL
../view/{Web-Name}/{Highlighted-Topic-Name}?term=whatever
- Search term must be one word only
- A non breaking space in the search text will not yield any results
-
Certain search terms will break the applet completely. The error The requested URL /requisite35/servlet/ was not found on this server will occur if one of the following terms are used in the search field :
-
password
-
cmd
-
mode
-
guest
-
login
As well, I'm running
JRE Standard Edition (build 1.4.2_03-b02). Some of my peers with earlier versions of java cannot see the applet.
Otherwise, Nice Work ! Very useful. Thanks.
--
KeithHelfrich - 24 Mar 2004
>
> Hi Christopher,
>
>
>
> The CVSModificationPolicy says PleaseFeelFreeToModify, however there is no version
>
> in twikiplugins-cvs. Would you like TGP checked in?
>
>
Yes, please do so. I'm sorry I was to busy to even focus on reading
>
http://twiki.org/cgi-bin/view/Plugins/UsingCVSForPluginsDevelopment
>
(that topic badly needs re-editing) during the last weeks.
>
Maybe you should not to check in the jar file? Instead I should put my
>
Java modifications into the touchgraph cvs as well.
non-maintainer update initial checkin
| Internal plugin version: |
04 Mar 2004 |
| Zip version: |
1,2 |
I elected to install the zip version as is and then remove the .jar file as this maintains an audit trail.
This means the cvs version is now ahead of the zip file.
I misunderstood Christopher's intent; he was wondering if the .jar file should be removed since it comes from a 3rd party (
AlexShapiro) and he is not the author. At least I think that's what he meant. I imagine he'll corrrect me again if I'm wrong.
I've put it back for the moment as it ia required for the plugin to function.
--
MattWilkie - 05,09 Apr 2004
I tried to install it on an Alpha installation on
SourceForge but failed to get it to work. Suggestions:
- On SF where I do not have root permission I cannot run the tgdb script as the Apache user, so data/Web/touchgraph.txt fails. Better to use the recommended place to store the cache data. Example for Sandbox web:
twiki/pub/TWiki/TouchGraphPlugin/_tgdb_Sandbox.txt. That way all db files are in the same place and it is possible to set the directory permission so that the tgdb script can be executed by a non-Apache user.
- The tgdb script uses many undocumented variables and calls. Use the official TWiki::Func interface where possible.
- Measure and document the Plugin Benchmarks
- Use the same initialization as the TWiki scripts, e.g.
require 'setlib.cfg' to find the libraries
--
PeterThoeny - 31 Oct 2004
Make sure you are running the latest version of the Java Runtime environment. Mac users may have better results with safari, see:
http://www.macupdate.com/info.php/id/16262
--
TristanLawrence - 22 Feb 2005
Moved Tristan's comment from the TWiki web to here.
--
PeterThoeny - 22 Feb 2005
Questions Asked

How can I change the default values for
E#,
Show E#, and
Expand E# ?
Thanks ! --
KeithHelfrich - 07 Apr 2004
AFAIK you can't. I also want to change these values, but they are not specified as applet parameters. I hope it is not big problem to add them in Java code.
--
PiotrKaminski - 20 Sep 2004
HTTPS-connections failed
This plugin works great... until I tried to require HTTPS connections o my TWiki site. At that point the applet isn't able to access the touchgraph.txt files... (java.IO.PermissionDenied) My best guess is that this is a Java certificate prob, but after hours fighting with keytool, I'm stumped. Anyone else using this plugin w/ SSL?
--
KenGoldenberg - 19 Apr 2004
@
KenGoldenberg: Check if the created touchgraph.txt files in /pub/%WEB belong to an appropriate goup and have access rights.
There was hardcoded "http://" in TGWikiBrowser.java. I now changed this to make it also work with https connections.
--
AndreUlrich - 01 Jul 2004
Thanks! My problem is now fixed. I also broke down and bought a "real" cert which possibly helped with some of my client-side problems.
Two other things, while I'm playing with touchgraph:
- links to topic in other webs display as URLs. Dunno if this is an HTTPS-specific thing (I have HTTP disabled at the moment) but it would be nice to display Main.FooBar in the graph instead of https://foo.example.com/twiki/bin/view/Mail/FooBar
- external links to https sites don't get picked up by tgdb (I tripped over this while trying to figure out if the above was a bug or a feature--still not sure, actually)
A simple patch for the 2nd is:
169c169
< s/(^|href\s*=|\s*)(https?:\/\/[^]> "\n ]+)/&xrf($2)/geo;
---
> s/(^|href=|\s)(https:\/\/[^]> "\n ]+)/&xrf($2)/geo;
--
KenGoldenberg - 14 Jul 2004
Links to topics in other webs
In my TWiki installation I have several webs. Topics have links to other webs very often. Unfortunatly
TouchGraphPlugin doesn't handle those links correctly. They appears as full URLs (e.g.
http://server/twiki/bin/view/Web/Topic). When I click such link it tries to add full URL to link specified as
WIKI_URL param in
view.tglaunch.tmpl file. Default value of this parameter is
http://server/twiki/bin/view/Web/ and it works very well with topics in current web. But it fails in other cases.
Did anyone observe such bug? May be the problem is in my configuration?
I thought about changing indexing script
tgdb to convert all links into
Web/Topic form (now only
Topic exists in
toughgraph.txt files). Then
WIKI_URL could be changed to
http://server/twiki/bin/view/ and all links should work. Of course external links should remain unchanged.
This would change the way topics are displayed in applet window: every topic would have its web name as preffix. For me it is OK, but it would be prettier if only links pointing to other webs have such preffix.
--
PiotrKaminski - 20 Sep 2004
Did you solve the problem with external and cross web linking Piotr? I have the plugin basically running with the latest SVN code (DEVELOP branch). Did replace some old, resp. internal function calls by proper new ones. There are two 'problems' left to make it run on Dakar:
- Fix the external links (I guess this has to be done in the
tgdb script) cause the link on the plugins home topic is broken
- Fix the call for starting the applet and adapt the template (
view.tglaunch.tmpl) to the style of PatternSkin
Did anybody else try to get this running lately (on Cairo or Dakar)?
--
FranzJosefSilli - 25 Apr 2005
The
TouchGraph no longer seems to work afer the upgrade to
CairoRelease.
--
KeithHelfrich - 10 Jun 2005
Correction : the
TouchGraph does work on my home
TWikiSite after upgrading to
CairoRelease (and subsequently re-installing the
TouchGraphPlugin)
Not sure why it was broken after the upgrade to Cairo on my work
TWikiSite. But it's too late to investigate now, since I'm no longer working there
--
KeithHelfrich - 03 Jul 2005
sync'ed
TGWikiBrowser.jar from
http://twiki.org/p/pub/Plugins/TouchGraphPlugin/TouchGraphPlugin.zip
to
CVS
--
WillNorris - 19 Jul 2005
Correction to my correction
It seems the
TouchGraph does work with
Internet Explorer. However, it does not work with the
Firefox browser.
To clarify, I am now on
CairoRelease but did not test on firefox before the upgrade -- so the firefox problem was not 'caused' by cairo.
--
KeithHelfrich - 03 Aug 2005
I've just tried installing this plugin but get a 'Bad Magic Number' error appearing in the applet. Does anyone know what I might be doing wrong?
I'm attempting to use it with Windows IE5.5.
--
DavidBaker - 29 Nov 2005
David: I ran into the same problem and realized my .jar file was incomplete. Make sure all your source files are compiled and have corresponding .class files before you
jar them (otherwise, compile them manually first).
The popup window problem described under "Annoyances" can be resolved by replacing the target window "wiki" with "_self" on line 141 of
TGWikiPanel.java. The
TouchGraph applet can then be integrated as a navigational tool on a web page, opening links in the same window.
This is successfully tested in IE 6.0, Firefox 1.5.0.1, and Opera 8.5.
--
GeirThomasAndersen - 15 Mar 2006
Running Dakar, I had to tweak tgdb a bit. getDataDir and getPubDir are now in TWiki::Func.
However, when I run tgdb, I still get one error I can't figure out:
Can't use string ("TOUCHGRAPHPLUGIN_TGPOPUP") as a HASH ref while "strict refs" in use at ../lib/TWiki/Prefs.pm line 218.
Any advice?
--
FilSalustri - 27 Mar 2006
Above error is an indication that this Plugin uses undocumented TWiki internal function calls. Look for anything
TWiki:: that is not
TWiki::Func. Cairo already has official functions for data dir, pub dir, and preferences.
To the Plugin maintainer: Please consider upgrading this Plugin so that it runs on Cairo
and Dakar codebase.
HandlingCairoDakarPluginDifferences has more.
--
PeterThoeny - 28 Mar 2006
Following up on the above:
Not wanting to step opn the Plugin maintainer's toes, I've found the following items:
TWiki::initialize,
TWiki::Store::webExists, and
TWiki::dataDir. I'm looking thru the doc, but there's lots of it, and I'm new to this.
If one were to point me at the right topics to sort out the porting, I would be appreciative....
--
FilSalustri - 28 Mar 2006
This plugin can be very easily subverted to show the parent/child tree. All you need is to expand
bin/tgdb to generates a different database. Just thought I'd mention this, in case someone feels motivated enough to fix the issues around other web links and exernal links (which I think needs changes in the Java code).
--
PankajPant - 06 Apr 2006
Ok, so I just installed the most recent version. I'm running on Linux, with TWiki 4.0.2. When I go to run /bin/tgdb I get the following errors:
Can't locate Error.pm in
@INC
(
@INC
contains: /var/www/html/twiki/lib . /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.6 /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl/5.8.4 /usr/lib/perl5/site_perl/5.8.3 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.6 /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl/5.8.4 /usr/lib/perl5/vendor_perl/5.8.3 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.6/i386-linux-thread-multi /usr/lib/perl5/5.8.6) at /var/www/html/twiki/lib/TWiki.pm line 46.
BEGIN failed--compilation aborted at /var/www/html/twiki/lib/TWiki.pm line 46.
Compilation failed in require at ./tgdb line 15.
BEGIN failed--compilation aborted at ./tgdb line 15.
Even when I add a symbolic link to Error.pm, I still get similar problems. What gives?????
--
CraigAumann - 04 May 2006