templates/gitweb/graph.tmpl
changeset 9999 f91e5630ce7e
parent 9998 4a3c388f8c69
child 10000 16f49d671c7f
equal deleted inserted replaced
9998:4a3c388f8c69 9999:f91e5630ce7e
     1 {header}
       
     2 <title>{repo|escape}: Graph</title>
       
     3 <link rel="alternate" type="application/atom+xml"
       
     4    href="{url}atom-log" title="Atom feed for {repo|escape}"/>
       
     5 <link rel="alternate" type="application/rss+xml"
       
     6    href="{url}rss-log" title="RSS feed for {repo|escape}"/>
       
     7 <!--[if IE]><script type="text/javascript" src="{staticurl}excanvas.js"></script><![endif]-->
       
     8 </head>
       
     9 <body>
       
    10 
       
    11 <div class="page_header">
       
    12 <a href="http://mercurial.selenic.com/" title="Mercurial" style="float: right;">Mercurial</a><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / graph
       
    13 </div>
       
    14 
       
    15 <form action="{url}log">
       
    16 {sessionvars%hiddenformentry}
       
    17 <div class="search">
       
    18 <input type="text" name="rev"  />
       
    19 </div>
       
    20 </form>
       
    21 <div class="page_nav">
       
    22 <a href="{url}summary{sessionvars%urlparameter}">summary</a> |
       
    23 <a href="{url}shortlog{sessionvars%urlparameter}">shortlog</a> |
       
    24 <a href="{url}log/{rev}{sessionvars%urlparameter}">changelog</a> |
       
    25 graph |
       
    26 <a href="{url}tags{sessionvars%urlparameter}">tags</a> |
       
    27 <a href="{url}branches{sessionvars%urlparameter}">branches</a> |
       
    28 <a href="{url}file/{node|short}{sessionvars%urlparameter}">files</a>
       
    29 <br/>
       
    30 <a href="{url}graph/{rev}{lessvars%urlparameter}">less</a>
       
    31 <a href="{url}graph/{rev}{morevars%urlparameter}">more</a>
       
    32 | {changenav%navgraphentry}<br/>
       
    33 </div>
       
    34 
       
    35 <div class="title">&nbsp;</div>
       
    36 
       
    37 <noscript>The revision graph only works with JavaScript-enabled browsers.</noscript>
       
    38 
       
    39 <div id="wrapper">
       
    40 <ul id="nodebgs"></ul>
       
    41 <canvas id="graph" width="224" height="{canvasheight}"></canvas>
       
    42 <ul id="graphnodes"></ul>
       
    43 </div>
       
    44 
       
    45 <script type="text/javascript" src="{staticurl}graph.js"></script>
       
    46 <script>
       
    47 <!-- hide script content
       
    48 
       
    49 var data = {jsdata|json};
       
    50 var graph = new Graph();
       
    51 graph.scale({bg_height});
       
    52 
       
    53 graph.edge = function(x0, y0, x1, y1, color) {
       
    54 	
       
    55 	this.setColor(color, 0.0, 0.65);
       
    56 	this.ctx.beginPath();
       
    57 	this.ctx.moveTo(x0, y0);
       
    58 	this.ctx.lineTo(x1, y1);
       
    59 	this.ctx.stroke();
       
    60 	
       
    61 }
       
    62 
       
    63 var revlink = '<li style="_STYLE"><span class="desc">';
       
    64 revlink += '<a class="list" href="{url}rev/_NODEID{sessionvars%urlparameter}" title="_NODEID"><b>_DESC</b></a>';
       
    65 revlink += '</span> _TAGS';
       
    66 revlink += '<span class="info">_DATE ago, by _USER</span></li>';
       
    67 
       
    68 graph.vertex = function(x, y, color, parity, cur) {
       
    69 	
       
    70 	this.ctx.beginPath();
       
    71 	color = this.setColor(color, 0.25, 0.75);
       
    72 	this.ctx.arc(x, y, radius, 0, Math.PI * 2, true);
       
    73 	this.ctx.fill();
       
    74 	
       
    75 	var bg = '<li class="bg parity' + parity + '"></li>';
       
    76 	var left = (this.columns + 1) * this.bg_height;
       
    77 	var nstyle = 'padding-left: ' + left + 'px;';
       
    78 	var item = revlink.replace(/_STYLE/, nstyle);
       
    79 	item = item.replace(/_PARITY/, 'parity' + parity);
       
    80 	item = item.replace(/_NODEID/, cur[0]);
       
    81 	item = item.replace(/_NODEID/, cur[0]);
       
    82 	item = item.replace(/_DESC/, cur[3]);
       
    83 	item = item.replace(/_USER/, cur[4]);
       
    84 	item = item.replace(/_DATE/, cur[5]);
       
    85 	
       
    86 	var tagspan = '';
       
    87 	if (cur[7].length || (cur[6][0] != 'default' || cur[6][1])) {
       
    88 		tagspan = '<span class="logtags">';
       
    89 		if (cur[6][1]) {
       
    90 			tagspan += '<span class="branchtag" title="' + cur[6][0] + '">';
       
    91 			tagspan += cur[6][0] + '</span> ';
       
    92 		} else if (!cur[6][1] && cur[6][0] != 'default') {
       
    93 			tagspan += '<span class="inbranchtag" title="' + cur[6][0] + '">';
       
    94 			tagspan += cur[6][0] + '</span> ';
       
    95 		}
       
    96 		if (cur[7].length) {
       
    97 			for (var t in cur[7]) {
       
    98 				var tag = cur[7][t];
       
    99 				tagspan += '<span class="tagtag">' + tag + '</span> ';
       
   100 			}
       
   101 		}
       
   102 		tagspan += '</span>';
       
   103 	}
       
   104 	
       
   105 	item = item.replace(/_TAGS/, tagspan);
       
   106 	return [bg, item];
       
   107 	
       
   108 }
       
   109 
       
   110 graph.render(data);
       
   111 
       
   112 // stop hiding script -->
       
   113 </script>
       
   114 
       
   115 <div class="page_nav">
       
   116 <a href="{url}graph/{rev}{lessvars%urlparameter}">less</a>
       
   117 <a href="{url}graph/{rev}{morevars%urlparameter}">more</a>
       
   118 | {changenav%navgraphentry}
       
   119 </div>
       
   120 
       
   121 {footer}