<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:py="http://genshi.edgewall.org/"
      xmlns:xi="http://www.w3.org/2001/XInclude">
  <xi:include href="layout.html" />
  <xi:include href="macros.html" />
  <head>
    <title>リストタイトル</title>
  </head>

  <body>
  	<py:if test="error!=''">
	<div id="content" class="error">
		<h2>Error:</h2>
		<div class="message">${error}</div>
	</div>
	</py:if>
	<form name="listtitle"  method="post">
	<py:if test="req.perm.has_permission('LIST_MANAGE_EDIT')">
	<div>
		<fieldset>
			<legend>リストタイトル</legend>
			<table>
			<tr><td>リストID:</td><td><input type="text" id="list_id" name="list_id" size="70" value="${list_id}"/></td></tr>
			<tr><td>リストタイトル:</td><td><input type="text" id="title" name="title" size="70" value="${title}"/></td></tr>
			<tr><td>説明:</td><td><textarea rows="3"  cols="60" name="description">${description}</textarea></td></tr>
			<!-- 親リストIDの処理はPending -->
			<!--<tr><td>親リストID:</td><td><input type="text" name="parent_list_id" size="70" value="${parent_list_id}"/></td></tr>-->
			<input type="hidden" name="parent_list_id" size="70" value="${parent_list_id}"/>
			<tr><td>WikiName:</td><td><input type="text" id="wiki_name" name="wiki_name" size="70" value="${wiki_name}"/></td></tr>
			<tr><td><input type="button" name="regist" value="登録"  onclick="eventHandler('regist');" />
			<input type="button" name="listmanage" value="戻る"  onclick="javascript:eventHandler('listmanage');" /></td></tr>
			</table>
		</fieldset>
	</div>
	</py:if>
	<input type="hidden" id="actionName"  name="actionName"/>
	<input type="hidden" id="mode"  name="mode" value="${mode}"/>
	</form>

<script type="text/javascript">
function eventHandler(actionName,list_id) {
	var f = document.forms['listtitle'];
	document.getElementById('actionName').value = actionName;
	if(actionName == "regist"){
		if(!requireCheck(document.getElementById('list_id').value)){
			alert("リストIDが未入力です。");
			return false;
		} else if(!requireCheck(document.getElementById('title').value)){
			alert("リストタイトルが未入力です。");
			return false;
		} else if(!requireCheck(document.getElementById('wiki_name').value)){
			alert("WikiNameが未入力です。");
			return false;
		}
		f.action = "${href.listmanage('edittitle')}";
	} else if(actionName == "listmanage"){
		location.href="${href.listmanage()}";
		return;
	}
	f.submit();
}
</script>
  </body>
</html>
