##<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
##<html xmlns="http://www.w3.org/1999/xhtml">
##<head>
##	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
##	<title>WorkStyle</title>
##	<link type="text/css" rel="stylesheet" href="resources/skin/default/basic.css"/>
##	<script src="resources/prototype.js" language="JavaScript"></script>
##	<script src="resources/jkl-parsexml.js" language="JavaScript"></script>
##	<script src="resources/script.js" language="JavaScript"></script>
##	<script src="resources/local.js" language="JavaScript"></script>
##</head>
##<body onload="init()">
##<p id="header"><a href="TaskList.html"><img src="resources/skin/default/image/logo.png" alt="WorkStyle" /></a></p>
##
##<ul class="nav">
##	<li><a href="TaskList.html">タスク一覧</a></li>
##	<li><a href="TagList.html">タグ管理</a></li>
##</ul>
##
##<h1 id="pageTitle">Task List</h1>
##
##<div id="content"> 
##<div id="content-body"> 

#set ($page_title = 'Unlinked Task List')
#set ($init_js = '')

	<script language="JavaScript" type="text/JavaScript">
	<!--
	function linkTask(fromTaskId, toTaskId, elementId) {
		ajaxLinkTask(fromTaskId, toTaskId, elementId, processLinkTaskResult);
	}
	function processLinkTaskResult(result, request) {
		Element.remove(request.element);
	}
	//-->
	</script>

	<div id="menu"> 
		<h2>Menu</h2>
		<ul>
			<li><a href='$link.setRelative("/$unlinkedTaskQuery.unlinkedTaskId/")'><img src="$link.setRelative('/resources/skin/default/image/icon/view.png')"/>タスク詳細に戻る</a></li>
		</ul>

		<h2>Search</h2>
		<form id="searchForm" action='$link.setRelative("/$unlinkedTaskQuery.unlinkedTaskId/searchUnlinked")' method="get" onmouseover="activateForm(this)">
			<input type="hidden" name="order" value="$unlinkedTaskQuery.order"/>
			<input type="hidden" name="limit" value="$unlinkedTaskPager.limit"/>
			<input type="text" class="text" name="keyword" value="$unlinkedTaskQuery.keyword"/>
			<input type="submit" class="submit" value="検索"/>
			<script type="text/javascript" charset="utf-8">
				<!--
				function toggleQuery(target, id) {
					var elmOption = $(target + 'Option' + id);
					elmOption.selected = !elmOption.selected;
					var cls = elmOption.selected ? 'search-on' : 'search-off';
					Element.classNames(target + 'Item'+id).set(cls)
					$('searchForm').submit();
				}
				-->
			</script>
			<h3 class="accordion-header-close" onclick="toggleAccordion(this, 'searchStatus')">状態</h3>
			<ul id="searchStatus" class="searchStatus accordion-close">
#foreach($status in $statusList)
				<li id="searchStatusItem${status.statusId}" class="$utils.decode($unlinkedTaskQuery.hasStatus($status.statusId), 'search-on', 'search-off')"><a class="status${status.statusId}" href="javascript:toggleQuery('searchStatus', ${status.statusId});">$status.name</a></li>
#end
			</ul>
			<select multiple="true" name="status" class="hidden">
#foreach($status in $statusList)
				<option id="searchStatusOption$status.statusId" $utils.decode($unlinkedTaskQuery.hasStatus($status.statusId), 'selected="selected"', '')>$status.statusId</option>
#end
			</select>
			<h3 class="accordion-header-close" onclick="toggleAccordion(this, 'includeTagList');">このタグをすべて含む</h3>
			<ul class="accordion-close" id="includeTagList">
#foreach($tag in $tagList)
			<li id="includeTagItem${tag.tagId}" class="$utils.decode($unlinkedTaskQuery.hasTag($tag.name), 'search-on', 'search-off')"><a href="javascript:toggleQuery('includeTag', $tag.tagId);">$tag.name</a></li>
#end
			</ul>
			<select multiple="true" name="tag" class="hidden">
#foreach($tag in $tagList)
				<option id="includeTagOption${tag.tagId}" $utils.decode($unlinkedTaskQuery.hasTag($tag.name), 'selected="selected"', '')>$tag.name</option>
#end
			</select>
			<h3 class="accordion-header-close" onclick="toggleAccordion(this, 'excludeTagList');">このタグを含まない</h3>
			<ul class="accordion-close" id="excludeTagList">
#foreach($tag in $tagList)
			<li id="excludeTagItem${tag.tagId}" class="$utils.decode($unlinkedTaskQuery.hasExcludeTag($tag.name), 'search-on', 'search-off')"><a href="javascript:toggleQuery('excludeTag', $tag.tagId);">$tag.name</a></li>
#end
			</ul>
			<select multiple="true" name="excludeTag" class="hidden">
				#foreach($tag in $tagList)
				<option id="excludeTagOption${tag.tagId}" $utils.decode($unlinkedTaskQuery.hasExcludeTag($tag.name), 'selected="selected"', '')>$tag.name</option>
				#end
			</select>
#set ($hasPriority = $unlinkedTaskQuery.hasPriorityFrom() || $unlinkedTaskQuery.hasPriorityTo())
			<h3 class="$utils.decode($hasPriority, 'accordion-header-open', 'accordion-header-close')" onclick="toggleAccordion(this, 'searchPriority')">優先度</h3>
			<p id="searchPriority" style="$utils.decode($hasPriority, '', 'display:none;')">
				<script type="text/javascript" charset="utf-8">
					<!--
					function searchPriority(elementId, priority) {
						$(elementId).value = priority;
						$(elementId).form.submit();
					}
					-->
				</script>
				<input type="hidden" id="priorityFrom" name="priorityFrom" value="$unlinkedTaskQuery.priorityFrom">
				<input type="hidden" id="priorityTo" name="priorityTo" value="$unlinkedTaskQuery.priorityTo">
				<label for="priorityFrom">from:</label>
				<span id="priorityFromIcon" class="priority${unlinkedTaskQuery.priorityFrom}">
				<div class="horizontal-priority-set" onmouseout="updatePriorityIcon('priorityFromIcon', $('priorityFrom').value);">
					<img class="icon-priority0" onmouseover="updatePriorityIcon('priorityFromIcon', 0)" onclick="searchPriority('priorityFrom', 0)" src="$link.setRelative('/resources/skin/default/image/spacer.gif')"/>
					<img class="icon-priority1" onmouseover="updatePriorityIcon('priorityFromIcon', 1)" onclick="searchPriority('priorityFrom', 1)" src="$link.setRelative('/resources/skin/default/image/spacer.gif')"/>
					<img class="icon-priority2" onmouseover="updatePriorityIcon('priorityFromIcon', 2)" onclick="searchPriority('priorityFrom', 2)" src="$link.setRelative('/resources/skin/default/image/spacer.gif')"/>
					<img class="icon-priority3" onmouseover="updatePriorityIcon('priorityFromIcon', 3)" onclick="searchPriority('priorityFrom', 3)" src="$link.setRelative('/resources/skin/default/image/spacer.gif')"/>
					<img class="icon-priority4" onmouseover="updatePriorityIcon('priorityFromIcon', 4)" onclick="searchPriority('priorityFrom', 4)" src="$link.setRelative('/resources/skin/default/image/spacer.gif')"/>
					<img class="icon-priority5" onmouseover="updatePriorityIcon('priorityFromIcon', 5)" onclick="searchPriority('priorityFrom', 5)" src="$link.setRelative('/resources/skin/default/image/spacer.gif')"/>
				</div>
				</span>
				<label for="priorityTo">to:</label>
				<span id="priorityToIcon" class="priority${unlinkedTaskQuery.priorityTo}">
				<div class="horizontal-priority-set" onmouseout="updatePriorityIcon('priorityToIcon', $('priorityTo').value)">
					<img class="icon-priority0" onmouseover="updatePriorityIcon('priorityToIcon', 0)" onclick="searchPriority('priorityTo', 0)" src="$link.setRelative('/resources/skin/default/image/spacer.gif')"/>
					<img class="icon-priority1" onmouseover="updatePriorityIcon('priorityToIcon', 1)" onclick="searchPriority('priorityTo', 1)" src="$link.setRelative('/resources/skin/default/image/spacer.gif')"/>
					<img class="icon-priority2" onmouseover="updatePriorityIcon('priorityToIcon', 2)" onclick="searchPriority('priorityTo', 2)" src="$link.setRelative('/resources/skin/default/image/spacer.gif')"/>
					<img class="icon-priority3" onmouseover="updatePriorityIcon('priorityToIcon', 3)" onclick="searchPriority('priorityTo', 3)" src="$link.setRelative('/resources/skin/default/image/spacer.gif')"/>
					<img class="icon-priority4" onmouseover="updatePriorityIcon('priorityToIcon', 4)" onclick="searchPriority('priorityTo', 4)" src="$link.setRelative('/resources/skin/default/image/spacer.gif')"/>
					<img class="icon-priority5" onmouseover="updatePriorityIcon('priorityToIcon', 5)" onclick="searchPriority('priorityTo', 5)" src="$link.setRelative('/resources/skin/default/image/spacer.gif')"/>
				</div>
				</span>
			</p>
#set ($hasDeadEndDate = $unlinkedTaskQuery.hasDeadEndDateFrom() || $unlinkedTaskQuery.hasDeadEndDateTo())
			<h3 class="$utils.decode($hasDeadEndDate, 'accordion-header-open', 'accordion-header-close')" onclick="toggleAccordion(this, 'deadEndDate');">〆切</h3>
			<p id="deadEndDate" style="$utils.decode($hasDeadEndDate, '', 'display:none;')">
				<label for="deadEndDateFrom">from:</label> <input type="text" class="text" id="deadEndDateFrom" name="deadEndDateFrom" value="$utils.formatDate($unlinkedTaskQuery.deadEndDateFrom)">
				<label for="deadEndDateTo">to:</label> <input type="text" class="text" id="deadEndDateTo" name="deadEndDateTo" value="$utils.formatDate($unlinkedTaskQuery.deadEndDateTo)">
			</p>
#set ($hasUpdateDate = $unlinkedTaskQuery.hasUpdateDateFrom() || $unlinkedTaskQuery.hasUpdateDateTo())
			<h3 class="$utils.decode($hasUpdateDate, 'accordion-header-open', 'accordion-header-close')" onclick="toggleAccordion(this, 'updateDate');">更新日</h3>
			<p id="updateDate" style="$utils.decode($hasUpdateDate, '', 'display:none;')">
				<label for="updateDateFrom">from:</label> <input type="text" class="text" id="updateDateFrom" name="updateDateFrom" value="$utils.formatDate($unlinkedTaskQuery.updateDateFrom)">
				<label for="updateDateTo">to:</label> <input type="text" class="text" id="updateDateTo" name="updateDateTo" value="$utils.formatDate($unlinkedTaskQuery.updateDateTo)">
			</p>
#set ($hasCreateDate = $unlinkedTaskQuery.hasCreateDateFrom() || $unlinkedTaskQuery.hasCreateDateTo())
			<h3 class="$utils.decode($hasCreateDate, 'accordion-header-open', 'accordion-header-close')" onclick="toggleAccordion(this, 'createDate');">作成日</h3>
			<p id="createDate" style="$utils.decode($hasCreateDate, '', 'display:none;')">
				<label for="createDateFrom">from:</label> <input type="text" class="text" id="createDateFrom" name="createDateFrom" value="$utils.formatDate($unlinkedTaskQuery.createDateFrom)">
				<label for="createDateTo">to:</label> <input type="text" class="text" id="createDateTo" name="createDateTo" value="$utils.formatDate($unlinkedTaskQuery.createDateTo)">
			</p>
			<input type="submit" class="submit" value="検索"/>
		</form>
	</div>
    <!-- menu -->
	<div id="main">
#set ($action = $link.setRelative("/$unlinkedTaskQuery.unlinkedTaskId/searchUnlinked"))
#prepareSearchTaskActionPlain($action $unlinkedTaskQuery)
#pagerMarkup($action $unlinkedTaskPager)
		<table class="list" width="99%">
		<tr> 
#set ($action = $link.setRelative("/$unlinkedTaskQuery.unlinkedTaskId/searchUnlinked"))
#if(!$unlinkedTaskQuery.hasOrder(1))
#prepareSearchTaskActionForOrder($action $unlinkedTaskQuery $unlinkedTaskPager 1)
#else
#prepareSearchTaskActionForOrder($action $unlinkedTaskQuery $unlinkedTaskPager 2)
#end
			<th nowrap="nowrap"><a href="$action">状態#sortImage($unlinkedTaskQuery 1 2)</a></th>
#set ($action = $link.setRelative("/$unlinkedTaskQuery.unlinkedTaskId/searchUnlinked"))
#if(!$unlinkedTaskQuery.hasOrder(12))
#prepareSearchTaskActionForOrder($action $unlinkedTaskQuery $unlinkedTaskQuery 12)
#else
#prepareSearchTaskActionForOrder($action $unlinkedTaskQuery $unlinkedTaskQuery 11)
#end
			<th nowrap="nowrap"><a href="$action"><img src="$link.setRelative('resources/skin/default/image/icon/star-off.gif')" alt="優先度"/>#sortImage($unlinkedTaskQuery 12 11)</a></th>
			<th nowrap="nowrap">タスク</th>
#set ($action = $link.setRelative("/$unlinkedTaskQuery.unlinkedTaskId/searchUnlinked"))
#if(!$unlinkedTaskQuery.hasOrder(9))
#prepareSearchTaskActionForOrder($action $unlinkedTaskQuery $unlinkedTaskPager 9)
#else
#prepareSearchTaskActionForOrder($action $unlinkedTaskQuery $unlinkedTaskPager 10)
#end
			<th nowrap="nowrap"><a href="$action">〆切#sortImage($taskQuery 9 10)</a></th>
#set ($action = $link.setRelative("/$unlinkedTaskQuery.unlinkedTaskId/searchUnlinked"))
#if(!$unlinkedTaskQuery.hasOrder(7))
#prepareSearchTaskActionForOrder($action $unlinkedTaskQuery $unlinkedTaskPager 7)
#else
#prepareSearchTaskActionForOrder($action $unlinkedTaskQuery $unlinkedTaskPager 8)
#end
			<th nowrap="nowrap"><a href="$action">更新日#sortImage($unlinkedTaskQuery 7 8)</a></th>
		</tr>
#foreach($task in $taskList)
		<tr id="task-${task.taskId}"> 
			<td class="statusIcon">
				<img id="statusIcon-${task.taskId}" class="status${task.statusId}-icon" src="$link.setRelative('/resources/skin/default/image/spacer.gif')" alt="$task.statusBean.name"/>
			</td>
			<td class="priority$task.priority">
				<div class="vertical-priority-view">
					<img class="icon-priority1" src="$link.setRelative('/resources/skin/default/image/spacer.gif')"/>
					<img class="icon-priority2" src="$link.setRelative('/resources/skin/default/image/spacer.gif')"/>
					<img class="icon-priority3" src="$link.setRelative('/resources/skin/default/image/spacer.gif')"/>
					<img class="icon-priority4" src="$link.setRelative('/resources/skin/default/image/spacer.gif')"/>
					<img class="icon-priority5" src="$link.setRelative('/resources/skin/default/image/spacer.gif')"/>
				</div>
			</td>
			<td class="text">
#if($task.tagList.length() > 0)
				<ul class="tagList">
#foreach($tag in $task.tagAsList)
					<li class="$tagMap.get($tag).tagTypeBean.styleClass">$tag</li>
#end
				</ul>
#end
				$utils.formatHtmlSimple($task.contents)
				<ul class="actionList">
					<li><a class="unlinkAction" href="javascript:linkTask($unlinkedTaskQuery.unlinkedTaskId,$task.taskId,'task-${task.taskId}')">リンクする</a></li>
				</ul>
				<p class="note">ID: $task.taskId, 見積: $task.estimatedManHour, 作成日: $utils.formatDate($task.createDate)</p>
			</td>
			<td>$utils.formatDate($task.deadEndDate)</td>
			<td id="updateDate-${task.taskId}">$utils.formatTimestamp($task.updateDate)</td>
		</tr>
#end
		</table>
#set ($action = $link.setRelative("/$unlinkedTaskQuery.unlinkedTaskId/searchUnlinked"))
#prepareSearchTaskActionPlain($action $unlinkedTaskQuery)
#pagerMarkup($action $unlinkedTaskPager)
	</div>
##	<!-- main -->
##	<hr class="bot" />
##</div>
##<!-- content-body -->
##</div>
##<!-- content -->
##<div id="footer"/>
##</body>
## </html>
