#set ($page_title = 'Tag List')
#set ($init_js = 'init();')
<script language="JavaScript" type="text/JavaScript">
<!--
	var tagTypes = [
#foreach($tagType in $tagTypeList)
		{tagTypeId: $tagType.tagTypeId, name: '$tagType.name', styleClass: '$tagType.styleClass'}
#if($velocityCount != $tagTypeList.size())
		,
#end
#end
	]
//-->
</script>
<script src="$link.contextPath/resources/TagList.js" language="JavaScript"></script>
	<div id="menu"> 
		<h2>Menu</h2>
		<ul>
			<li><a href="$link.setAction('/tagType/list')"><img src="$link.contextPath/resources/skin/default/image/icon/TagType.png"/>タグ種別を編集する</a></li>
		</ul>
	</div>
	<div id="main"> 
		<table id="tagList" class="list" width="99%">
		<tr> 
			<th nowrap="nowrap">&nbsp;</th>
			<th nowrap="nowrap">&nbsp;</th>
			<th nowrap="nowrap"> タグ</th>
			<th nowrap="nowrap">種別</th>
		</tr>
#foreach($tag in $tagList)
		<tr id="tag${tag.tagId}"> 
			<td class="icon"><a class="deleteAction" href="javascript:deleteTag($tag.tagId,'tag${tag.tagId}');"><img src="$link.contextPath/resources/skin/default/image/spacer.gif" width="16" height="16" /></a></td>
#if($tag.active == 1)
	#set ($action = $link.setAction('/tag/inactivate'))
	#set ($visibleIcon = 'visible-off.png')
#else
	#set ($action = $link.setAction('/tag/activate'))
	#set ($visibleIcon = 'invisible-off.png')
#end
			<td class="icon"><a id="tagActvity${tag.tagId}" class="$utils.decode($tag.activeAsBoolean, 'active', 'inactive')" href="javascript:toggleTagActivity($tag.tagId,'tagActvity${tag.tagId}')"><img src="$link.contextPath/resources/skin/default/image/spacer.gif" width="16" height="16"/></a></td>
			<td>$tag.name</td>
			<td>
				<ul id="tagTypeList-${tag.tagId}" class="tagTypeList">
#foreach($tagType in $tagTypeList)
#set ($isTagType = ($tag.tagTypeId == $tagType.tagTypeId))
				<li><a href="javascript:changeTypeOfTag($tag.tagId,$tagType.tagTypeId)" class="$utils.decode($isTagType, $tagType.styleClass, '')">$tagType.name</a></li>
#end
				</ul>
			</td>
		</tr>
#end
		</table>
		<p id="newLink">
		<a class="ajax" href="javascript:openTagForm()"/>追加</a>
		</p>
		<form id="TagForm" onsubmit="return addTag()" style="display:none">
			<fieldset>
				<label for="name">名前</label>
				<input id="name" name="name" type="text" class="text" value="" />
			</fieldset>
			<div class="action">
			<input type="submit" class="submit" value="登録"/>
			<input type="reset" class="cancel" value="キャンセル" onclick="closeTagForm()"/>
			</div>
		</form>
	</div>
