[Rt-devel] javascript issue making Flot plugin

Jeffrey Fearn jfearn at redhat.com
Wed Apr 14 22:15:30 EDT 2010


Hi, I am currently looking in to making a Flot, 
http://code.google.com/p/flot/, plugin for RT. ATM it uses the GD rules 
for searches, but clicking the graph button remders a Flot plot instead 
of a GD image. I'm still working out a few display issues before it's 
worth judging it's real worth.

I've hit a problem though :( When I add the Flot javascript files to the 
HTML header I get a couple of errors in the RT javascript files and some 
functions, like the handy calendar pop-up, break :(

As a simple test I am using the Modify Dates page to see if the calendar 
pop-up is rendered, rt3/Ticket/ModifyDates.html, which funnily enough 
doesn't have a graph on it, but demonstrates the problem well.

This is the diff of the HTML output with and without the extra java script:

$ diff -uBb test1.html test2.html
--- test1.html  2010-04-15 10:51:22.855382000 +1000
+++ test2.html  2010-04-15 10:51:50.246659000 +1000
@@ -26,8 +26,6 @@
  --></script>


-<script type="text/javascript" src="/rt3/NoAuth/flot/jquery.js"></script>
-<script type="text/javascript" 
src="/rt3/NoAuth/flot/jquery.flot.js"></script>
  <link rel="stylesheet" href="/rt3/NoAuth/webrtfm.css" type="text/css" />

  </head>

And here are the two java script errors generated:

Error: element.dispatchEvent is not a function
Source File: https://.../rt3/NoAuth/js/prototype/prototype.js
Line: 4071

Error: $(link).observe is not a function
Source File: https://.../rt3/NoAuth/js/util.js
Line: 159

Any pointers on where to look in to this is much appreciated.

FWIW I have put the source up [1] in case anyone wants to play with it.

CAUTION should be used though, currently it breaks stuff :) Also 
currently it just replaces the GD images, if I can get it working 
properly then I'd look in to letting the user pick how they want it 
rendered.

I find the usual RT plugin install process difficult to package as an 
RPM, so I wrote my own Build.PL file instead of using that. It defaults 
to /usr/local/lib/rt3/plugins/RT-Flot, which I believe is the standard 
RT path, you will need to override it if your RT plugin directory is in 
a different place.

e.g.

perl Build.PL --install_path plugins=/opt/foo/bar/rt3/plugins/RT-Flot
./Build
./Build install

If you use the supplied RPM spec file and are using the RT RPM from 
Fedora, you will probably need to be running RT 3.8.7 and set PluginPath 
in RT_SiteConfig.pm. Or you will need to edit the RT3_PLUGIN define in 
the spec file.

e.g

Set($PluginPath,"/usr/share/rt3/plugins");

Cheers, Jeff.

[1] http://jfearn.fedorapeople.org/files/RT-Flot-0.6.tar.gz

-- 
Jeff Fearn <jfearn at redhat.com>
Software Engineer
Engineering Operations
Red Hat, Inc
Freedom ... courage ... Commitment ... ACCOUNTABILITY


More information about the rt-devel mailing list