templates/coal/graph.tmpl
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
Sun, 09 Nov 2008 12:15:32 +0100
changeset 7349 f711b8e0d2b3
parent 7345 55651328dfcc
child 7408 f031a12dfc31
permissions -rw-r--r--
fix test-export portability (issue1383) wc outputs with leading spaces on *BSD
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6691
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
     1
{header}
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
     2
<title>{repo|escape}: revision graph</title>
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
     3
<link rel="alternate" type="application/atom+xml"
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
     4
   href="{url}atom-log" title="Atom feed for {repo|escape}: log">
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
     5
<link rel="alternate" type="application/rss+xml"
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
     6
   href="{url}rss-log" title="RSS feed for {repo|escape}: log">
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
     7
<!--[if IE]><script type="text/javascript" src="{staticurl}excanvas.js"></script><![endif]-->
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
     8
</head>
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
     9
<body>
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    10
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    11
<div class="container">
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    12
<div class="menu">
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    13
<div class="logo">
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    14
<a href="http://www.selenic.com/mercurial/">
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    15
<img src="{staticurl}hglogo.png" width=75 height=90 border=0 alt="mercurial"></a>
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    16
</div>
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    17
<ul>
6775
54ccf41761c9 coal: include current node in log, graph menu links
Brendan Cully <brendan@kublai.com>
parents: 6733
diff changeset
    18
<li><a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">log</a></li>
6691
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    19
<li class="active">graph</li>
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    20
<li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li>
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    21
</ul>
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    22
<ul>
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    23
<li><a href="{url}rev/{node|short}{sessionvars%urlparameter}">changeset</a></li>
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    24
<li><a href="{url}file/{node|short}{path|urlescape}{sessionvars%urlparameter}">browse</a></li>
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    25
</ul>
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    26
</div>
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    27
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    28
<div class="main">
7331
650e9d6988cb Keep sessionvars with repository links added in a0843c82d1a2
Thomas Arendsen Hein <thomas@intevation.de>
parents: 7327
diff changeset
    29
<h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2>
6691
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    30
<h3>graph</h3>
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    31
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    32
<form class="search" action="{url}log">
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    33
{sessionvars%hiddenformentry}
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    34
<p><input name="rev" id="search1" type="text" size="30"></p>
7327
a1758089ee35 Kill trailing whitespace in templates
Thomas Arendsen Hein <thomas@intevation.de>
parents: 7314
diff changeset
    35
<span>find changesets by author, revision,
7299
288dda59233c coal/paper: show a search tip when hovering over search box
Benoit Allard <benoit@aeteurope.nl>
parents: 7124
diff changeset
    36
files, or words in the commit message</span>
6691
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    37
</form>
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    38
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    39
<div class="navigate">
7345
55651328dfcc hgweb: fix up the less/more links on the graph page
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 7333
diff changeset
    40
<a href="{url}graph/{rev}{lessvars%urlparameter}">less</a>
55651328dfcc hgweb: fix up the less/more links on the graph page
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 7333
diff changeset
    41
<a href="{url}graph/{rev}{morevars%urlparameter}">more</a>
7333
ee12d9dc5cbb hgweb: show revision number in the graph pagination
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 7331
diff changeset
    42
| rev {rev}: {changenav%navgraphentry}
6691
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    43
</div>
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    44
7124
63579aa36c8e graph: replace the blinking no javascript message
Benoit Allard <benoit@aeteurope.nl>
parents: 6905
diff changeset
    45
<noscript>The revision graph only works with JavaScript-enabled browsers.</noscript>
6691
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    46
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    47
<div id="wrapper">
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    48
<ul id="nodebgs"></ul>
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    49
<canvas id="graph" width="224" height="{canvasheight}"></canvas>
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    50
<ul id="graphnodes"></ul>
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    51
</div>
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    52
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    53
<script type="text/javascript" src="{staticurl}graph.js"></script>
6905
248e54a9456e coal/paper: make output well-formed and fix css syntax error breaking rendering
Rocco Rutte <pdmef@gmx.net>
parents: 6775
diff changeset
    54
<script type="text/javascript">
6729
855851eae70f graph: improve script hiding tricks
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6728
diff changeset
    55
<!-- hide script content
6691
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    56
6733
936a9073bb73 graph: fix JavaScript issues to make it work on IE
Benoit Allard <benoit@aeteurope.nl>
parents: 6729
diff changeset
    57
var data = {jsdata|json};
936a9073bb73 graph: fix JavaScript issues to make it work on IE
Benoit Allard <benoit@aeteurope.nl>
parents: 6729
diff changeset
    58
var graph = new Graph();
6691
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    59
graph.scale({bg_height});
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    60
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    61
graph.edge = function(x0, y0, x1, y1, color) {
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    62
	
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    63
	this.setColor(color, 0.0, 0.65);
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    64
	this.ctx.beginPath();
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    65
	this.ctx.moveTo(x0, y0);
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    66
	this.ctx.lineTo(x1, y1);
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    67
	this.ctx.stroke();
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    68
	
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    69
}
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    70
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    71
var revlink = '<li style="_STYLE"><span class="desc">';
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    72
revlink += '<a href="{url}rev/_NODEID{sessionvars%urlparameter}" title="_NODEID">_DESC</a>';
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    73
revlink += '</span><span class="tag">_TAGS</span>';
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    74
revlink += '<span class="info">_DATE ago, by _USER</span></li>';
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    75
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    76
graph.vertex = function(x, y, color, parity, cur) {
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    77
	
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    78
	this.ctx.beginPath();
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    79
	color = this.setColor(color, 0.25, 0.75);
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    80
	this.ctx.arc(x, y, radius, 0, Math.PI * 2, true);
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    81
	this.ctx.fill();
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    82
	
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    83
	var bg = '<li class="bg parity' + parity + '"></li>';
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    84
	var left = (this.columns + 1) * this.bg_height;
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    85
	var nstyle = 'padding-left: ' + left + 'px;';
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    86
	var item = revlink.replace(/_STYLE/, nstyle);
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    87
	item = item.replace(/_PARITY/, 'parity' + parity);
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    88
	item = item.replace(/_NODEID/, cur[0]);
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    89
	item = item.replace(/_NODEID/, cur[0]);
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    90
	item = item.replace(/_DESC/, cur[3]);
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    91
	item = item.replace(/_USER/, cur[4]);
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    92
	item = item.replace(/_DATE/, cur[5]);
6720
084c9f1ef2bd graph: display branch name alongside tags
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6701
diff changeset
    93
	item = item.replace(/_TAGS/, cur[7].join('&nbsp; '));
6728
84294e3710b8 graph: optimize rendering by appending all nodes at once
Augie Fackler <durin42@gmail.com>
parents: 6720
diff changeset
    94
	
84294e3710b8 graph: optimize rendering by appending all nodes at once
Augie Fackler <durin42@gmail.com>
parents: 6720
diff changeset
    95
	return [bg, item];
6691
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    96
	
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    97
}
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    98
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
    99
graph.render(data);
6729
855851eae70f graph: improve script hiding tricks
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6728
diff changeset
   100
855851eae70f graph: improve script hiding tricks
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6728
diff changeset
   101
// stop hiding script -->
6691
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
   102
</script>
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
   103
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
   104
<div class="navigate">
7345
55651328dfcc hgweb: fix up the less/more links on the graph page
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 7333
diff changeset
   105
<a href="{url}graph/{rev}{lessvars%urlparameter}">less</a>
55651328dfcc hgweb: fix up the less/more links on the graph page
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 7333
diff changeset
   106
<a href="{url}graph/{rev}{morevars%urlparameter}">more</a>
7333
ee12d9dc5cbb hgweb: show revision number in the graph pagination
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 7331
diff changeset
   107
| rev {rev}: {changenav%navgraphentry}
6691
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
   108
</div>
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
   109
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
   110
</div>
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
   111
</div>
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
   112
0dba955c2636 add graph page to hgweb
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
   113
{footer}