#*
 * Copyright 2012 LinkedIn, Inc
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
*#

<!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/jqueryui/jquery-ui.custom.min.js"></script>
		<script type="text/javascript" src="${context}/js/jqueryui/jquery.ui.datepicker.min.js"></script>
		<script type="text/javascript" src="${context}/js/azkaban.date.utils.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/jquery.contextMenu.js"></script>
		<script type="text/javascript" src="${context}/js/azkaban.ajax.utils.js"></script>
		<script type="text/javascript" src="${context}/js/azkaban.nav.js"></script>
		<script type="text/javascript" src="${context}/js/azkaban.layout.js"></script>
		<script type="text/javascript" src="${context}/js/azkaban.flow.job.view.js"></script>
		<script type="text/javascript" src="${context}/js/azkaban.flow.graph.view.js"></script>
		<script type="text/javascript" src="${context}/js/azkaban.flow.view.js"></script>
		<script type="text/javascript" src="${context}/js/azkaban.exflow.options.view.js"></script>
		<script type="text/javascript" src="${context}/js/azkaban.schedule.options.view.js"></script>
		<script type="text/javascript" src="${context}/js/svgNavigate.js"></script>
		<script type="text/javascript">
			var contextURL = "${context}";
			var currentTime = ${currentTime};
			var timezone = "${timezone}";
			var errorMessage = null;
			var successMessage = null;
			
			var projectId = ${project.id};
			var projectName = "${project.name}";
			var flowName = "${flowid}";
			var execId = null;
		</script>
		<link rel="stylesheet" type="text/css" href="${context}/js/jqueryui/themes/custom-theme/jquery-ui.custom.css" />
		<link rel="stylesheet" type="text/css" href="${context}/css/jquery.contextMenu.custom.css" />
	</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">
#if($errorMsg)
				<div class="box-error-message">$errorMsg</div>
#else
#if($error_message != "null")
				<div class="box-error-message">$error_message</div>
#elseif($success_message != "null")
				<div class="box-success-message">$success_message</div>
#end

				<div id="all-jobs-content">
					<div class="section-hd flow-header">
						<h2><a href="${context}/manager?project=${project.name}&flow=${flowid}">Flow <span>$flowid</span></a></h2>
						<div class="section-sub-hd">
							<h4><a href="${context}/manager?project=${project.name}">Project <span>$project.name</span></a></h4>
						</div>
						
						<div id="executebtn" class="btn1">Prepare Execution</div>
						<div id="scheduleflowbtn" class="btn2 scheduleflow">Schedule Flow</div>
					</div>
					
					<div id="headertabs" class="headertabs">
						<ul>
							<li><a id="graphViewLink" href="#graph">Graph</a></li>
							<li class="lidivider">|</li>
							<li><a id="executionsViewLink" href="#executions">Executions</a></li>
						</ul>
					</div>
					<div id="graphView">
						<div class="relative">
							<div id="jobList" class="jobList">
								<div id="filterList" class="filterList">
									<input id="filter" class="filter" placeholder="  Job Filter" />
								</div>
								<div id="list" class="list">
								</div>
								<div id="resetPanZoomBtn" class="btn5 resetPanZoomBtn" >Reset Pan Zoom</div>
							</div>
							<div id="svgDiv" class="svgDiv">
								<svg id="svgGraph" class="svgGraph" xmlns="http://www.w3.org/2000/svg" version="1.1" shape-rendering="optimize-speed" text-rendering="optimize-speed" >
								</svg>
							</div>
						</div>
					</div>
					<div id="executionsView">
						<div id="executionDiv" class="all-jobs executionInfo">
							<table id="execTable">
								<thead>
									<tr>
										<th>Execution Id</th>
										<th>User</th>
										<th class="date">Start Time</th>
										<th class="date">End Time</th>
										<th class="elapse">Elapsed</th>
										<th class="status">Status</th>
										<th class="action">Action</th>
									</tr>
								</thead>
								<tbody id="execTableBody">
								</tbody>
							</table>
						</div>
					
						<div id="pageSelection">
							<ul>
								<li id="previous" class="first"><a><span class="arrow">&larr;</span>Previous</a></li>
								<li id="page1"><a href="#page1">1</a></li>
								<li id="page2"><a href="#page2">2</a></li>
								<li id="page3"><a href="#page3">3</a></li>
								<li id="page4"><a href="#page4">4</a></li>
								<li id="page5"><a href="#page5">5</a></li>
								<li id="next"><a>Next<span class="arrow">&rarr;</span></a></li>
							</ul>
						</div>
					</div>
				</div>
		<!-- modal content -->
	
				<div id="schedule-flow" class="modal">
						<h3>Schedule Flow</h3>
						<div id="errorMsg" class="box-error-message">$errorMsg</div>

						<div class="box">
										<form id="sched-form" method="post" action="${context}/">
												<div class="sched-form">
													<dl>
														<dt>Schedule Time</dt>
														<dd>
															<input id="hour" type="text" size="2" value="12"/>
															<input id="minutes" type="text" size="2" value="00"/>
															<select id="am_pm">
															  <option>pm</option>
															  <option>am</option>
															</select>
															<select id="timezone">
															  <option>PDT</option>
															  <option>UTC</option>
															</select>
														</dd>
														<dt>Schedule Date</dt><dd><input type="text" id="datepicker" /></dd>
														<dt>Recurrence</dt>
														<dd>
															<input id="is_recurring" type="checkbox" checked  />
															<span>repeat every</span>
														 	<input id="period" type="text" size="2" value="1"/>
															<select id="period_units">
															  <option value="d">Days</option>
															  <option value="h">Hours</option>
															  <option value="m">Minutes</option>
															  <option value="M">Months</option>
															  <option value="w">Weeks</option>
															</select>
														</dd>
													</dl>

												</div>

										</form>
						</div>
								
						<div class="actions">
							<a class="yes btn2" id="schedule-btn" href="#">Schedule The Flow</a>
							<a class="no simplemodal-close btn3" href="#">Cancel</a>
							<a class="btn2" id="adv-schedule-opt-btn" href="#">Advanced Schedule Options</a>
						</div>
				</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 btn3" id="login-btn" href="#">Re-login</a>
						</div>
				</div>
#parse( "azkaban/webapp/servlet/velocity/scheduleoptionspanel.vm" )

#parse( "azkaban/webapp/servlet/velocity/executionoptionspanel.vm" )

#end
		<ul id="jobMenu" class="contextMenu">  
			<li class="open"><a href="#open">Open...</a></li>
			<li class="openwindow"><a href="#openwindow">Open in New Window...</a></li>
		</ul>

		<ul id="disableJobMenu" class="contextMenu flowSubmenu">  
			<li class="openwindow"><a href="#openwindow">Open in New Window...</a></li>
			<li id="disable" class="disable separator"><a href="#disable">Disable</a><div id="disableArrow" class="context-sub-icon"></div></li>
			<ul id="disableSub" class="subMenu">
				<li class="disableAll"><a href="#disableAll">All</a></li>
				<li class="parents"><a href="#disableParents">Parents</a></li>
				<li class="ancestors"><a href="#disableAncestors">All Ancestors</a></li>
				<li class="children"><a href="#disableChildren">Children</a></li>
				<li class="decendents"><a href="#disableDescendents">All Descendents</a></li>
			</ul>
			<li id="enable" class="enable"><a href="#enable">Enable</a> <div id="enableArrow" class="context-sub-icon"></div></li>
			<ul id="enableSub" class="subMenu">
				<li class="enableAll"><a href="#enableAll">All</a></li>
				<li class="parents"><a href="#enableParents">Parents</a></li>
				<li class="ancestors"><a href="#enableAncestors">All Ancestors</a></li>
				<li class="children"><a href="#enableChildren">Children</a></li>
				<li class="decendents"><a href="#enableDescendents">All Descendents</a></li>
			</ul>
		</ul>

		<ul id="scheduleDisableJobMenu" class="contextMenu flowSubmenu">  
			<li class="openwindow"><a href="#scheduleOpenwindow">Open in New Window...</a></li>
			<li id="scheduleDisable" class="disable separator"><a href="#disable">Disable</a><div id="scheduleDisableArrow" class="context-sub-icon"></div></li>
			<ul id="scheduleDisableSub" class="subMenu">
				<li class="disableAll"><a href="#disableAll">All</a></li>
				<li class="parents"><a href="#disableParents">Parents</a></li>
				<li class="ancestors"><a href="#disableAncestors">All Ancestors</a></li>
				<li class="children"><a href="#disableChildren">Children</a></li>
				<li class="decendents"><a href="#disableDescendents">All Descendents</a></li>
			</ul>
			<li id="scheduleEnable" class="enable"><a href="#enable">Enable</a> <div id="scheduleEnableArrow" class="context-sub-icon"></div></li>
			<ul id="scheduleEnableSub" class="subMenu">
				<li class="enableAll"><a href="#enableAll">All</a></li>
				<li class="parents"><a href="#enableParents">Parents</a></li>
				<li class="ancestors"><a href="#enableAncestors">All Ancestors</a></li>
				<li class="children"><a href="#enableChildren">Children</a></li>
				<li class="decendents"><a href="#enableDescendents">All Descendents</a></li>
			</ul>
		</ul>

		</div>
	</body>
</html>

