Added imagemap feature to CvsGraph. Now can click on the image to go to that

particular revision, tag, or diff.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@225 8cb11bc2-c004-0410-86c3-e597b4017df7
remotes/tags/V0_8
timcera 2001-10-12 05:17:00 +00:00
parent 620307a64c
commit 0268b877e5
5 changed files with 120 additions and 38 deletions

25
INSTALL
View File

@ -149,27 +149,26 @@ there are some additional steps required to get the database working.
CVSGRAPH CONFIGURATION
----------------------
CvsGraph is a program that can develop a graphical tree of files
in a CVS repository.
CvsGraph is a program that can develop a clickable, graphical tree
of files in a CVS repository.
1) Install viewcvs according to instructions in 'INSTALLING VIEWCVS'.
The installation directory is where the 'viewcvs-install' script
copied and configured the viewcvs programs.
1) Install viewcvs according to instructions in 'INSTALLING
VIEWCVS' section above. The installation directory is where
the 'viewcvs-install' script copied and configured the viewcvs
programs.
2) Download CvsGraph from http://www.akhphd.au.dk/~bertho/cvsgraph/
3) Configure and compile per instructions with CvsGraph. I had
problems with 'configure' finding the gd library. Had to create
a link from libgd.so to libgd.do.4.0.0. The biggest problem is
that configure was failing to find a gd library, but it still
made a Makefile.
a link from libgd.so to libgd.do.4.0.0.
4) Place 'cvsgraph' executable in the viewcvs installation
directory.
4) Place the 'cvsgraph' executable in the viewcvs installation
directory.
5) Copy 'cvsgraphwrapper.cgi' from the <install-root>/cgi/ directory
to your web server's cgi-bin. For detailed instructions see the
'INSTALLING VIEWCVS' section.
5) Copy 'cvsgraphwrapper.cgi' and 'cvsgraphmkimg.cgi' from the
<install-root>/cgi/ directory to your web server's cgi-bin.
For detailed instructions see the 'INSTALLING VIEWCVS' section.
6) Set the 'use_cvsgraph' option in viewcvs.conf.

View File

@ -172,10 +172,10 @@ image_quality = 75;
# These are the href= and alt= attributes in the <area>
# tags of html. The strings are expanded (see above).
map_name = "MyMapName";
map_branch_href = "href=\"%9cvsweb_graph.cgi/%m%p?only_with_tag=%t%8\"";
map_branch_href = "href=\"%9viewcvs.cgi/%m%F?only_with_tag=%t%8\"";
map_branch_alt = "alt=\"%0 %t (%B)\"";
map_rev_href = "href=\"%9cvsweb_graph.cgi/%m%p%F?rev=%R&content-type=text/x-cvsweb-markup%8\"";
map_rev_href = "href=\"%9viewcvs.cgi/%m%F#rev%R\"";
map_rev_alt = "alt=\"%1 %t (%R)\"";
map_diff_href = "href=\"%9cvsweb_graph.cgi/%m%p%F.diff?r1=%P&r2=%R%8\"";
map_diff_href = "href=\"%9viewcvs.cgi/%m%F.diff?r1=%P&r2=%R%8\"";
map_diff_alt = "alt=\"%2 %P &lt;-&gt; %R\"";

62
cgi/cvsgraphmkimg.cgi Executable file
View File

@ -0,0 +1,62 @@
#!/usr/bin/python
# -*-python-*-
#
# Copyright (C) 1999-2001 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewCVS
# distribution or at http://viewcvs.sourceforge.net/license-1.html.
#
# Contact information:
# Greg Stein, PO Box 760, Palo Alto, CA, 94302
# gstein@lyra.org, http://viewcvs.sourceforge.net/
#
# -----------------------------------------------------------------------
#
# cvsgraphwrapper.cgi: Wrapper to run cvsgraph from viewcvs.
#
# -----------------------------------------------------------------------
import cgi
import os
import sys
# Set during install process.
LIBRARY_DIR = None
# I was going to pass this from viewcvs, but thought that the path printed
# out in the URL would be insecure. Is that true?
# Put cvsgraph executable in the viewcvs install directory.
path_to_cvsgraph = os.path.dirname(LIBRARY_DIR) + '/cvsgraph'
path_to_cvsgraph_conf = os.path.dirname(LIBRARY_DIR) + '/cvsgraph.conf'
form = cgi.FieldStorage()
# Defaults not used right now...
defaults = {'r': '',
'm': '',
'f': ''}
for key in defaults.keys():
try:
exec '%s = form["%s"].value' % (key,key)
except KeyError:
exec '%s = "%s"' % (key,defaults[key])
# For debugging interaction with cvsgraph, it is sometimes useful to
# change 'Content-type: image/png' to 'Content-type: text/plain'.
# You might then see any error message from cvsgraph, or your browser
# will crash. YMMV.
print 'Content-type: image/png'
print ''
# This statement is very important! Otherwise you can't garantee the order
# that things get printed out to the browser!
sys.stdout.flush()
# Required only if cvsgraph needs to find it's supporting libraries.
# Uncomment and set accordingly if required.
#os.environ['LD_LIBRARY_PATH'] = '/usr/lib:/usr/local/lib'
os.system('%s -c %s -r %s -m %s %s' % (path_to_cvsgraph, path_to_cvsgraph_conf, r,m,f))

View File

@ -23,38 +23,58 @@ import sys
# Set during install process.
LIBRARY_DIR = None
# I was going to pass this from viewcvs, but thought that the path printed
# I was going to pass this from viewcvs, but thought that the path printed
# out in the URL would be insecure. Is that true?
# Put cvsgraph executable in the viewcvs install directory.
path_to_cvsgraph = LIBRARY_DIR(:-3) + 'cvsgraph'
path_to_cvsgraph_conf = LIBRARY_DIR(:-3) + 'cvsgraph.conf'
path_to_cvsgraph = os.path.dirname(LIBRARY_DIR) + '/cvsgraph'
path_to_cvsgraph_conf = os.path.dirname(LIBRARY_DIR) + '/cvsgraph.conf'
form = cgi.FieldStorage()
# For debugging interaction with cvsgraph, it is sometimes useful to
# change 'Content-type: image/png' to 'Content-type: text/plain'.
# You might then see any error message from cvsgraph, or your browser
# will crash. YMMV.
print 'Content-type: image/png'
print ''
# This statement is very important! Otherwise you can't garantee the order
# that things get printed out to the browser!
sys.stdout.flush()
defaults = {'f': ''}
# Defaults not used right now...
defaults = {'r': '',
'm': '',
'f': ''}
for key in defaults.keys():
try:
exec '%s = form["%s"].value' % (key,key)
except KeyError:
exec '%s = "%s"' % (key,defaults[key])
# Start the web page
print """Content-Type: text/html
<html>
<head>
<title>Revisions of %s</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="generator" content="handcrafted">
</head>
<body bgcolor="#f0f0f0">
<center>
<title>Revisions of %s</title>""" % (f,f)
# This statement is very important! Otherwise you can't garantee the order
# that things get printed out to the browser!
sys.stdout.flush()
# Required only if cvsgraph needs to find it's supporting libraries.
# Uncomment and set accordingly if required.
#os.environ['LD_LIBRARY_PATH'] = '/usr/lib:/usr/local/lib'
os.system('%s -c %s -r "" -m "" %s' % (path_to_cvsgraph, path_to_cvsgraph_conf, f))
# Create an image map
os.system('%s -i -c %s -r %s -m %s %s' % (path_to_cvsgraph, path_to_cvsgraph_conf,r,m,f))
print """<img border="0"
usemap="#MyMapName"
src="cvsgraphmkimg.cgi?c=%s&r=%s&m=%s&f=%s"
alt="Revisions of %s">""" % (path_to_cvsgraph_conf,r,m,f,f)
print '</center>'
print '</body>'
print '</html>'

View File

@ -1086,7 +1086,8 @@ def view_directory(request):
template = ezt.Template()
### get the template fname from the .conf file
template.parse_file('../templates/directory.ezt')
template.parse_file(os.path.dirname(CONF_PATHNAME) +
'/templates/directory.ezt')
# prepare the data that will be passed to the template
data = {
@ -1328,8 +1329,8 @@ def view_directory(request):
if cfg.options.use_cvsgraph:
### the URL to the wrapper should not be hard-coded
row.graph_href = '/cgi-bin/cvsgraphwrapper.cgi?f=%s/%s/%s,v' % \
(request.cvsroot, request.module, file)
row.graph_href = '/cgi-bin/cvsgraphwrapper.cgi?&r=%s&m=%s&f=%s,v' % \
(request.cvsroot, request.where, file)
if cfg.options.show_author:
row.author = info[3]