templates/graph.tmpl
author Dirkjan Ochtman <dirkjan@ochtman.nl>
Thu, 30 Oct 2008 09:46:45 +0100
changeset 7294 f933076a19fc
parent 7124 63579aa36c8e
permissions -rw-r--r--
hgweb: pass more information about parent/child csets to templates
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6693
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
     1
#header#
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
     2
<title>#repo|escape#: graph</title>
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-tags" title="Atom feed for #repo|escape#: tags">
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-tags" title="RSS feed for #repo|escape#: tags">
6733
936a9073bb73 graph: fix JavaScript issues to make it work on IE
Benoit Allard <benoit@aeteurope.nl>
parents: 6729
diff changeset
     7
<!--[if IE]><script type="text/javascript" src="#staticurl#excanvas.js"></script><![endif]-->
6693
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
     8
</head>
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
     9
<body>
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    10
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    11
<div class="buttons">
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    12
<a href="#url#log{sessionvars%urlparameter}">changelog</a>
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    13
<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
    14
<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
    15
<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
    16
</div>
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    17
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    18
<h2>graph</h2>
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    19
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    20
<form action="#url#log">
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    21
{sessionvars%hiddenformentry}
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    22
<p>
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    23
<label for="search1">search:</label>
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    24
<input name="rev" id="search1" type="text" size="30">
6701
bf72e756c98b templates: fix navigation links for graph entries
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6693
diff changeset
    25
navigate: <small class="navigate">#changenav%navgraphentry#</small>
6693
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    26
</p>
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    27
</form>
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    28
7124
63579aa36c8e graph: replace the blinking no javascript message
Benoit Allard <benoit@aeteurope.nl>
parents: 6905
diff changeset
    29
<noscript>The revision graph only works with JavaScript-enabled browsers.</noscript>
6693
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    30
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    31
<div id="wrapper">
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    32
<ul id="nodebgs"></ul>
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    33
<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
    34
<ul id="graphnodes"></ul>
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    35
</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
<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: 6733
diff changeset
    38
<script type="text/javascript">
6729
855851eae70f graph: improve script hiding tricks
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6728
diff changeset
    39
<!-- hide script content
6693
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    40
6733
936a9073bb73 graph: fix JavaScript issues to make it work on IE
Benoit Allard <benoit@aeteurope.nl>
parents: 6729
diff changeset
    41
var data = {jsdata|json};
936a9073bb73 graph: fix JavaScript issues to make it work on IE
Benoit Allard <benoit@aeteurope.nl>
parents: 6729
diff changeset
    42
var graph = new Graph();
6693
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    43
graph.scale({bg_height});
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    44
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    45
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
    46
	
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    47
	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
    48
	this.ctx.beginPath();
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    49
	this.ctx.moveTo(x0, y0);
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    50
	this.ctx.lineTo(x1, y1);
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    51
	this.ctx.stroke();
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
}
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
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
    56
revlink += '<a href="{url}rev/_NODEID{sessionvars%urlparameter}" title="_NODEID">_DESC</a>';
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    57
revlink += '</span><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
    58
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    59
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
    60
	
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    61
	this.ctx.beginPath();
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    62
	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
    63
	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
    64
	this.ctx.fill();
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    65
	
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    66
	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
    67
	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
    68
	var nstyle = 'padding-left: ' + left + 'px;';
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    69
	var item = revlink.replace(/_STYLE/, nstyle);
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    70
	item = item.replace(/_PARITY/, 'parity' + parity);
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    71
	item = item.replace(/_NODEID/, cur[0]);
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    72
	item = item.replace(/_NODEID/, cur[0]);
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    73
	item = item.replace(/_DESC/, cur[3]);
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    74
	item = item.replace(/_USER/, cur[4]);
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    75
	item = item.replace(/_DATE/, cur[5]);
6728
84294e3710b8 graph: optimize rendering by appending all nodes at once
Augie Fackler <durin42@gmail.com>
parents: 6702
diff changeset
    76
	
84294e3710b8 graph: optimize rendering by appending all nodes at once
Augie Fackler <durin42@gmail.com>
parents: 6702
diff changeset
    77
	return [bg, item];
6693
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    78
	
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    79
}
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    80
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    81
graph.render(data);
6729
855851eae70f graph: improve script hiding tricks
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6728
diff changeset
    82
855851eae70f graph: improve script hiding tricks
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6728
diff changeset
    83
// stop hiding script -->
6693
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    84
</script>
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    85
6702
af7b26b0f884 templates: graph lacked bottom search in default style
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6701
diff changeset
    86
<form action="#url#log">
af7b26b0f884 templates: graph lacked bottom search in default style
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6701
diff changeset
    87
{sessionvars%hiddenformentry}
af7b26b0f884 templates: graph lacked bottom search in default style
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6701
diff changeset
    88
<p>
af7b26b0f884 templates: graph lacked bottom search in default style
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6701
diff changeset
    89
<label for="search1">search:</label>
af7b26b0f884 templates: graph lacked bottom search in default style
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6701
diff changeset
    90
<input name="rev" id="search1" type="text" size="30">
af7b26b0f884 templates: graph lacked bottom search in default style
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6701
diff changeset
    91
navigate: <small class="navigate">#changenav%navgraphentry#</small>
af7b26b0f884 templates: graph lacked bottom search in default style
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6701
diff changeset
    92
</p>
af7b26b0f884 templates: graph lacked bottom search in default style
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6701
diff changeset
    93
</form>
6693
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    94
7f58dec6aeb7 hgweb: Fix up non-coal styles to support graph.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    95
#footer#