steveosoule
2/10/2016 - 12:34 AM

Miva - Code History Review

Miva - Code History Review

<mvt:if expr="g.Auth NE 'fuzzywuzzy'">
	Unauthorized
	<mvt:exit/>
</mvt:if>

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Code Review</title>
	<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha/css/bootstrap.min.css">
	<style>
		.editor{
			height: 50vh;
		}
	</style>
</head>
<body>


<div class="jumbotron">
	<div class="container">
		<h1>Code Review</h1>
	</div>
</div>

<div class="container-fluid">
	<div class="col-xs-12">
		<mvt:if expr="ISNULL g.Limit">	<mvt:assign name="g.Limit" value="10" />	</mvt:if>
		<mvt:if expr="ISNULL g.Offset">	<mvt:assign name="g.Offset" value="0" />	</mvt:if>
		<mvt:assign name="l.settings:query:query" value="'SELECT mt.id, mt.filename, DATE_FORMAT(FROM_UNIXTIME(mtv.dtstamp), \'%b %d %Y %h:%i %p\') AS formatted_dtstamp, mtv.notes, mtv.source, mtv.settings FROM s01_ManagedTemplates mt LEFT JOIN s01_ManagedTemplateVersions mtv ON mt.current_id = mtv.id WHERE mt.filename NOT REGEXP \'p[[:digit:]]+\' AND mt.filename NOT REGEXP \'c[[:digit:]]+\' ORDER BY mtv.dtstamp DESC LIMIT ? OFFSET ?'" />
		<mvt:assign name="l.settings:query:bind_parameters[1]" value="g.Limit" />
		<mvt:assign name="l.settings:query:bind_parameters[2]" value="g.Offset" />
		<mvt:item name="sql" param="l.settings:query" />

		<mvt:foreach iterator="row" array="query:results">
			<h2>&mvt:row:filename;</h2>
			<p><i>&mvt:row:formatted_dtstamp;</i></p>
			<mvt:if expr="l.settings:row:notes">
				<p class="alert alert-info">&mvt:row:notes;</p>
			</mvt:if>
			<hr>
			<pre class="editor" id="editor-&mvt:row:id;">&mvte:row:source;</pre>
			<hr>
		</mvt:foreach>

		<mvt:assign name="g.NextOffset" value="g.Offset + g.Limit" />
		<mvt:assign name="g.PrevOffset" value="g.Offset - g.Limit" />
		<nav>
			<ul class="pager">
				<mvt:if expr="g.PrevOffset GE 0">
					<li class="previous"><a href="#"><span aria-hidden="true">&larr;</span> Older</a></li>
				</mvt:if>
				<li class="next"><a href="/cs/&mvte:page:code;?Auth=&mvte:global:auth;&Limit=&mvte:global:Limit;&Offset=&mvte:global:NextOffset;">Newer <span aria-hidden="true">&rarr;</span></a></li>
			</ul>
		</nav>

	</div>
</div>

<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<script>
	(function(){
		$.getScript('//cdnjs.cloudflare.com/ajax/libs/ace/1.2.3/ace.js', function(data, textStatus) {
			$('pre').each(function(){
				var $pre = $(this);

				var editor = ace.edit($pre.attr('id'));
				editor.setTheme('ace/theme/github');
				this.style.fontSize = '16px';
				editor.getSession().setMode("ace/mode/xml");
			});
		});
	})();
</script>
</body>
</html>