<!DOCTYPE html> 
<html>
	<head>
#parse( "azkaban/webapp/servlet/velocity/style.vm" )
		<script type="text/javascript" src="${context}/js/jquery/jquery.js"></script>    
		<script type="text/javascript" src="${context}/js/namespace.js"></script>
		<script type="text/javascript" src="${context}/js/underscore-1.2.1-min.js"></script>
		<script type="text/javascript" src="${context}/js/backbone-0.5.3-min.js"></script>
		<script type="text/javascript" src="${context}/js/jquery.simplemodal.js"></script>
		<script type="text/javascript" src="${context}/js/azkaban.nav.js"></script>
		<script type="text/javascript" src="${context}/js/azkaban.main.view.js"></script>
		<script type="text/javascript">
			var contextURL = "${context}";
			var currentTime = ${currentTime};
			var timezone = "${timezone}";
			var errorMessage = ${error_message};
			var successMessage = ${success_message};
		</script>
	</head>
	<body>
		#set($current_page="all")
#parse( "azkaban/webapp/servlet/velocity/nav.vm" )
		<div class="messaging"><p id="messageClose">X</p><p id="message"></p></div>  

		<div class="content">
			<div id="all-jobs-content">
				<div class="section-hd">
#if ($allProjects)
					<h2>All Projects</h2>
					<div class="section-sub-hd">
						<h4><a href="${context}/">My Projects</a></h4>
					</div>
#else
					<h2>My Projects</h2>
					<div class="section-sub-hd">
						<h4><a href="${context}/?all">All Projects</a></h4>
					</div>
#end
					<form method="get">
						<input type="hidden" name="action" value="search">
						<input type="submit" value="Search" class="search-btn">
						<input id="searchtextbox" type="text" placeholder="by job name or wildcard" value="" class="search-input" name="job">
					</form>
			
					<a id="create-project-btn" class="btn1 createproject" href="#">Create Project</a>
				</div><!-- end .section-hd -->
			</div>
			<table id="all-jobs" class="all-jobs job-table">
				<thead>
					<tr>
						<th class="tb-name">Name</th>
						<th class="tb-up-date">Modified Date</th>
						<th class="tb-owner">Modified By</th>
						<th class="tb-action last">Actions</th>
					</tr>
				</thead>
				<tbody>
#if($projects)
#foreach($project in $projects)
					<tr class="row">
						<td class="tb-name">
							<div class="jobfolder expand" id="${project.name}">
								<span class="state-icon"></span>
								<a href="${context}/manager?project=${project.name}">$project.name</a>
							</div>
						</td>
						<td class="tb-up-date">$utils.formatDate($project.lastModifiedTimestamp)</td>
						<td class="tb-owner">$project.lastModifiedUser</td>
						<td class="tb-action last"></td>
					</tr>
					<tr class="childrow" id="${project.name}-child" style="display: none;">
						<td class="expandedFlow">
							<table class="innerTable">
								<thead>
									<tr><th class="tb-name">Flows</th></tr>
								</thead>
								<tbody id="${project.name}-tbody">
								</tbody>
							</table>
						</td>
					</tr>
#end
#else
					<tr><td class="last">No viewable projects found.</td></tr>
#end
				</tbody>
			</table>
		</div>

		<!-- modal content -->
		<div id="create-project" class="modal">
			<h3>Create Project</h3>
			<div id="errorMsg" class="box-error-message">$errorMsg</div>
			
			<div class="message">
				<fieldset>
					<dl>
						<dt><label for="path">Project Name</label></dt>
						<dd><input id="path" name="project" type="text" size="20" title="The project name."/></dd>
						<dt>Description</dt>
						<dd><textarea id="description" name="description" rows="2" cols="40"></textarea></dd>
					
						<input name="action" type="hidden" value="create" />
						<input name="redirect" type="hidden" value="$!context/" />
					</dl>
				</fieldset>
			</div>
			<div class="actions">
				<a class="yes btn2" id="create-btn" href="#">Create Project</a>
				<a class="no simplemodal-close btn3" href="#">Cancel</a>
			</div>
			<div id="invalid-session" class="modal">
				<h3>Invalid Session</h3>
				<p>Session has expired. Please re-login.</p>
				<div class="actions">
					<a class="yes btn2" id="login-btn" href="#">Re-login</a>
				</div>
			</div>
		</div>
	</body>
</html>


