annotate templates/gitweb/graph.tmpl @ 7057:094af6eeb7d7

fix conflicting variables when no native osutil is available thanks weijun for the bug report and patch, fix issue1309
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Mon, 29 Sep 2008 11:57:27 +0200
parents 936a9073bb73
children 63579aa36c8e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6693
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
1 #header#
6727
f4b6dec99950 Fix gitweb to not say shortlog instead of graph.
Augie Fackler <durin42@gmail.com>
parents: 6720
diff changeset
2 <title>#repo|escape#: Graph</title>
6693
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
3 <link rel="alternate" type="application/atom+xml"
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
4 href="{url}atom-log" title="Atom feed for #repo|escape#"/>
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
5 <link rel="alternate" type="application/rss+xml"
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
6 href="{url}rss-log" title="RSS feed for #repo|escape#"/>
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
7 </head>
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
8 <body>
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
9
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
10 <div class="page_header">
6727
f4b6dec99950 Fix gitweb to not say shortlog instead of graph.
Augie Fackler <durin42@gmail.com>
parents: 6720
diff changeset
11 <a href="http://www.selenic.com/mercurial/" title="Mercurial" style="float: right;">Mercurial</a><a href="{url}summary{sessionvars%urlparameter}">#repo|escape#</a> / graph
6693
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
12 </div>
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
13
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
14 <form action="{url}log">
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
15 {sessionvars%hiddenformentry}
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
16 <div class="search">
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
17 <input type="text" name="rev" />
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
18 </div>
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
19 </form>
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
20 <div class="page_nav">
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
21 <a href="{url}summary{sessionvars%urlparameter}">summary</a> |
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
22 <a href="{url}shortlog{sessionvars%urlparameter}">shortlog</a> |
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
23 <a href="{url}log/#rev#{sessionvars%urlparameter}">changelog</a> |
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
24 graph |
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
25 <a href="{url}tags{sessionvars%urlparameter}">tags</a> |
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
26 <a href="{url}file/#node|short#{sessionvars%urlparameter}">files</a>
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
27 <br/>
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
28 <a href="{url}graph/{uprev}{sessionvars%urlparameter}?revcount={revcountless}">less</a>
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
29 <a href="{url}graph/{uprev}{sessionvars%urlparameter}?revcount={revcountmore}">more</a>
6701
bf72e756c98b templates: fix navigation links for graph entries
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6693
diff changeset
30 | #changenav%navgraphentry#<br/>
6693
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
31 </div>
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
32
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
33 <div class="title">&nbsp;</div>
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
34
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
35 <div id="noscript">The revision graph only works with JavaScript-enabled browsers.</div>
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
36
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
37 <div id="wrapper">
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
38 <ul id="nodebgs"></ul>
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
39 <canvas id="graph" width="224" height="#canvasheight#"></canvas>
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
40 <ul id="graphnodes"></ul>
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
41 </div>
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
42
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
43 <script type="text/javascript" src="#staticurl#graph.js"></script>
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
44 <script>
6729
855851eae70f graph: improve script hiding tricks
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6728
diff changeset
45 <!-- hide script content
6693
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
46
6729
855851eae70f graph: improve script hiding tricks
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6728
diff changeset
47 document.getElementById('noscript').style.display = 'none';
6693
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
48
6733
936a9073bb73 graph: fix JavaScript issues to make it work on IE
Benoit Allard <benoit@aeteurope.nl>
parents: 6729
diff changeset
49 var data = {jsdata|json};
936a9073bb73 graph: fix JavaScript issues to make it work on IE
Benoit Allard <benoit@aeteurope.nl>
parents: 6729
diff changeset
50 var graph = new Graph();
6693
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
51 graph.scale({bg_height});
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
52
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
53 graph.edge = function(x0, y0, x1, y1, color) {
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
54
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
55 this.setColor(color, 0.0, 0.65);
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
56 this.ctx.beginPath();
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
57 this.ctx.moveTo(x0, y0);
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
58 this.ctx.lineTo(x1, y1);
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
59 this.ctx.stroke();
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
60
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
61 }
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
62
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
63 var revlink = '<li style="_STYLE"><span class="desc">';
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
64 revlink += '<a class="list" href="{url}rev/_NODEID{sessionvars%urlparameter}" title="_NODEID"><b>_DESC</b></a>';
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
65 revlink += '</span> _TAGS';
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
66 revlink += '<span class="info">_DATE ago, by _USER</span></li>';
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
67
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
68 graph.vertex = function(x, y, color, parity, cur) {
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
69
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
70 this.ctx.beginPath();
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
71 color = this.setColor(color, 0.25, 0.75);
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
72 this.ctx.arc(x, y, radius, 0, Math.PI * 2, true);
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
73 this.ctx.fill();
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
74
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
75 var bg = '<li class="bg parity' + parity + '"></li>';
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
76 var left = (this.columns + 1) * this.bg_height;
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
77 var nstyle = 'padding-left: ' + left + 'px;';
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
78 var item = revlink.replace(/_STYLE/, nstyle);
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
79 item = item.replace(/_PARITY/, 'parity' + parity);
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
80 item = item.replace(/_NODEID/, cur[0]);
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
81 item = item.replace(/_NODEID/, cur[0]);
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
82 item = item.replace(/_DESC/, cur[3]);
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
83 item = item.replace(/_USER/, cur[4]);
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
84 item = item.replace(/_DATE/, cur[5]);
6720
084c9f1ef2bd graph: display branch name alongside tags
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6701
diff changeset
85
084c9f1ef2bd graph: display branch name alongside tags
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6701
diff changeset
86 var tagspan = '';
084c9f1ef2bd graph: display branch name alongside tags
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6701
diff changeset
87 if (cur[7].length || (cur[6][0] != 'default' || cur[6][1])) {
084c9f1ef2bd graph: display branch name alongside tags
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6701
diff changeset
88 tagspan = '<span class="logtags">';
084c9f1ef2bd graph: display branch name alongside tags
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6701
diff changeset
89 if (cur[6][1]) {
084c9f1ef2bd graph: display branch name alongside tags
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6701
diff changeset
90 tagspan += '<span class="branchtag" title="' + cur[6][0] + '">';
084c9f1ef2bd graph: display branch name alongside tags
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6701
diff changeset
91 tagspan += cur[6][0] + '</span> ';
084c9f1ef2bd graph: display branch name alongside tags
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6701
diff changeset
92 } else if (!cur[6][1] && cur[6][0] != 'default') {
084c9f1ef2bd graph: display branch name alongside tags
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6701
diff changeset
93 tagspan += '<span class="inbranchtag" title="' + cur[6][0] + '">';
084c9f1ef2bd graph: display branch name alongside tags
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6701
diff changeset
94 tagspan += cur[6][0] + '</span> ';
084c9f1ef2bd graph: display branch name alongside tags
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6701
diff changeset
95 }
084c9f1ef2bd graph: display branch name alongside tags
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6701
diff changeset
96 if (cur[7].length) {
084c9f1ef2bd graph: display branch name alongside tags
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6701
diff changeset
97 for (var t in cur[7]) {
084c9f1ef2bd graph: display branch name alongside tags
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6701
diff changeset
98 var tag = cur[7][t];
084c9f1ef2bd graph: display branch name alongside tags
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6701
diff changeset
99 tagspan += '<span class="tagtag">' + tag + '</span> ';
084c9f1ef2bd graph: display branch name alongside tags
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6701
diff changeset
100 }
6693
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
101 }
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
102 tagspan += '</span>';
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
103 }
6720
084c9f1ef2bd graph: display branch name alongside tags
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6701
diff changeset
104
6693
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
105 item = item.replace(/_TAGS/, tagspan);
6728
84294e3710b8 graph: optimize rendering by appending all nodes at once
Augie Fackler <durin42@gmail.com>
parents: 6727
diff changeset
106 return [bg, item];
6693
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
107
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
108 }
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
109
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
110 graph.render(data);
6729
855851eae70f graph: improve script hiding tricks
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6728
diff changeset
111
855851eae70f graph: improve script hiding tricks
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6728
diff changeset
112 // stop hiding script -->
6693
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
113 </script>
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
114
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
115 <div class="page_nav">
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
116 <a href="{url}graph/{uprev}{sessionvars%urlparameter}?revcount={revcountless}">less</a>
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
117 <a href="{url}graph/{uprev}{sessionvars%urlparameter}?revcount={revcountmore}">more</a>
6701
bf72e756c98b templates: fix navigation links for graph entries
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6693
diff changeset
118 | {changenav%navgraphentry}
6693
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
119 </div>
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
120
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
121 #footer#