Changeset 1911
- Timestamp:
- 01/28/07 16:58:17 (2 years ago)
- Files:
-
- revtreeplugin/0.11/revtree/htdocs/js/svgtip.js (modified) (5 diffs)
- revtreeplugin/0.11/revtree/SVGdraw.py (modified) (6 diffs)
- revtreeplugin/0.11/revtree/svgview.py (modified) (3 diffs)
- revtreeplugin/0.11/revtree/templates/revtree.html (modified) (4 diffs)
- revtreeplugin/0.11/revtree/web_ui.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
revtreeplugin/0.11/revtree/htdocs/js/svgtip.js
r1909 r1911 6 6 * 7 7 * Badly hacked & tweaked to support XHTML/XML and SVG for the RevtreePlugin 8 * <emmanuel.blot@free.fr>8 * by Emmanuel Blot <emmanuel.blot@free.fr> 2006-2007 9 9 */ 10 10 11 11 function JT_init(){ 12 $('a[@id^=rev]') 13 .hover(function(){JT_show(this)},function(){JT_hide(this)}) 14 .click(function(){return false}); 12 $('a[@id^=rev]').hover(function(){JT_show(this)},function(){JT_hide(this)}); 15 13 } 16 14 17 15 function JT_hide(object) { 18 $('#JT').remove()16 $('#JT').remove() 19 17 } 20 18 … … 23 21 if (! jQuery.browser.opera) { href = 'xlink:' + href; } 24 22 var url = object.getAttribute(href); 23 var logurl = url.replace(/\/changeset\//, '/revtree_log/'); 25 24 var id = object.getAttribute('id'); 26 25 var title = id.replace(/^rev/, 'Changeset '); … … 34 33 var params = parseQuery( queryString ); 35 34 if(params['width'] === undefined){params['width'] = 250}; 36 if(params['link'] !== undefined){37 $(object).bind('click',function(){window.location = params['link']});38 //$(object).css('cursor','pointer');39 }40 35 41 36 if(hasArea>((params['width']*1)+box.w)){ … … 73 68 document.getElementsByTagName('body')[0].appendChild(d0); 74 69 75 // netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");76 70 $('#JT').show(); 77 $('#JT_copy').load( url);71 $('#JT_copy').load(logurl); 78 72 } 79 73 80 74 function getSvgPosition(objectId) { 75 // The following loop could be simplified to use JQuery 76 // JQuery has some trouble with XML documents for now 81 77 var svg = document.getElementsByTagName('svg')[0]; 82 78 var anodes = svg.getElementsByTagName('a'); … … 91 87 var elem; 92 88 for ( var n = 0; n < cnodes.length; n++ ) { 93 if ( cnodes[n].tagName == " g" ) {89 if ( cnodes[n].tagName == "svg:g" ) { 94 90 elem = cnodes[n] 95 91 break; revtreeplugin/0.11/revtree/SVGdraw.py
r1633 r1911 57 57 is available from www.adobe.com""" 58 58 59 __version__="1.0" 59 # Note: Emmanuel Blot, 2007: 60 # The version has been updated to reflect the small changes made to 61 # support SVG 1.1 and the hack to support inline SVG (in XHTML host document) 62 __version__="1.0a" 60 63 61 64 # there are two possibilities to generate svg: … … 253 256 self.elements.append(SVGelement) 254 257 255 def toXml(self,level,f ):258 def toXml(self,level,f,prefix=''): 256 259 f.write('\t'*level) 257 f.write('<'+ self.type)260 f.write('<'+prefix+self.type) 258 261 for attkey in self.attributes.keys(): 259 262 f.write(' '+_escape(str(attkey))+'='+_quoteattr(str(self.attributes[attkey]))) … … 269 272 f.write('\n') 270 273 for element in self.elements: 271 element.toXml(level+1,f )274 element.toXml(level+1,f,prefix) 272 275 if self.cdata: 273 276 f.write('\n'+'\t'*(level+1)+'<![CDATA[') … … 281 284 f.write(str(self.text)) 282 285 if self.elements: 283 f.write('\t'*level+'</'+ self.type+'>\n')286 f.write('\t'*level+'</'+prefix+self.type+'>\n') 284 287 elif self.text: 285 f.write('</'+ self.type+'>\n')288 f.write('</'+prefix+self.type+'>\n') 286 289 elif self.cdata: 287 f.write('\t'*level+'</'+ self.type+'>\n')290 f.write('\t'*level+'</'+prefix+self.type+'>\n') 288 291 else: 289 292 f.write('/>\n') … … 871 874 d.toXml() 872 875 """ 873 def __init__(self,viewBox=None, width=None, height=None,**args): 876 def __init__(self,viewBox=None, width=None, height=None, 877 svgns=None,**args): 874 878 SVGelement.__init__(self,'svg',**args) 879 self._svgns = svgns 875 880 if viewBox<>None: 876 881 self.attributes['viewBox']=_viewboxlist(viewBox) … … 879 884 if height<>None: 880 885 self.attributes['height']=height 881 #self.namespace="http://www.w3.org/2000/svg"882 self.namespace = { 'xmlns': "http://www.w3.org/2000/svg",886 ns = svgns and 'xmlns:svg' or 'xmlns' 887 self.namespace = { ns: "http://www.w3.org/2000/svg", 883 888 'xmlns:xlink': "http://www.w3.org/1999/xlink" } 889 890 def toXml(self,level,f): 891 SVGelement.toXml(self,level,f,self._svgns and 'svg:' or '') 884 892 885 893 class drawing: revtreeplugin/0.11/revtree/svgview.py
r1908 r1911 280 280 self._textcolor.rgb() 281 281 widgets.append(title) 282 283 282 g = SVG.group('grp%d' % self._revision, elements=widgets) 284 285 link = "%s/revtree_log/?rev=%d&link=%s/changeset/%d" \ 286 % (self._parent.urlbase(), self._revision, 287 self._parent.urlbase(), self._revision) 283 link = "%s/changeset/%d" % (self._parent.urlbase(), self._revision) 288 284 self._link = SVG.link(link, elements=[g]) 289 285 if self._revision: … … 762 758 763 759 def _get_name(self, color, head): 764 return 'arrow_%s_%s' % (head and 'head' or 'tail', color) 760 fcolor = str(color) 761 if fcolor.startswith('#'): 762 fcolor = fcolor[1:] 763 return 'arrow_%s_%s' % (head and 'head' or 'tail', fcolor) 765 764 766 765 def create(self, color, head): … … 967 966 """Render the revision tree""" 968 967 self._svg = SVG.svg((0,0,self._extent[0],self._extent[1]), 969 scale*self._extent[0], scale*self._extent[1]) 968 scale*self._extent[0], scale*self._extent[1], 969 True) 970 970 self._arrows.render() 971 971 # FIXME: only two levels for enhancers (background, foreground) revtreeplugin/0.11/revtree/templates/revtree.html
r1909 r1911 1 1 <!DOCTYPE html 2 PUBLIC "-//W3C//DTD XHTML 1. 0 Strict//EN"3 "http://www.w3.org/ TR/xhtml1/DTD/xhtml1-strict.dtd">2 PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" 3 "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd"> 4 4 <html xmlns="http://www.w3.org/1999/xhtml" 5 5 xmlns:xi="http://www.w3.org/2001/XInclude" … … 8 8 <xi:include href="macros.html" /> 9 9 <head> 10 <!-- This document conforms to XHTML + SVG + MathML 11 However, a tiny issue in Trac (#4614) prevents the validation of 12 the RevtreePlugin documents. 13 --> 10 14 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 11 15 <title>${rt.title}</title> … … 30 34 <h1>${rt.title}</h1> 31 35 <div id="settings"> 32 <form id="prefs" method=" GET" action="">36 <form id="prefs" method="get" action=""> 33 37 <div class="revprops"> 34 38 <fieldset id="properties"> … … 130 134 </div> 131 135 <div py:otherwise="" class="svg"> 132 <!-- Inline SVG breaks the XHTML 1.0 strict conformance133 XHTML + SVG + MathML document type does not help ... -->134 136 ${rt.svg} 135 137 </div> revtreeplugin/0.11/revtree/web_ui.py
r1908 r1911 151 151 152 152 def match_request(self, req): 153 match = re.match(r'/revtree(_log)? /?', req.path_info)153 match = re.match(r'/revtree(_log)?(?:/([^/]+))?', req.path_info) 154 154 if match: 155 155 if match.group(1): 156 req.args['log '] = True156 req.args['logrev'] = match.group(2) 157 157 return True 158 158 … … 160 160 req.perm.assert_permission('REVTREE_VIEW') 161 161 162 if req.args.has_key('log '):162 if req.args.has_key('logrev'): 163 163 return self._process_log(req) 164 164 else: … … 206 206 """Handle AJAX log requests""" 207 207 try: 208 rev = int(req.args[' rev'])208 rev = int(req.args['logrev']) 209 209 repos = self.env.get_repository(req.authname) 210 210 chgset = repos.get_changeset(rev)
