<{strip}>
<{* アンケート質問一覧画面用テンプレート *}>
<div class="outerdiv">
	<div class="bold">
		<{$action.questionnaire.questionnaire_name}>
	</div>

	<div class="top_description">
		<{$lang.questionnaire_question_list_text}>
	</div>

	<{if $action.questionnaire.status == QUESTIONNAIRE_STATUS_INACTIVE_VALUE}>
		<div class="align-right">
			<a class="syslink" href="#" title="<{$lang.questionnaire_add_question_title}>" onclick="questionnaireCls['<{$id}>'].showQuestionEntry(event, null);return false;">
				<img class="icon" src="<{"add.gif"|get_themes_image}>" alt="" />
				<{$lang.questionnaire_add_question}>
			</a>
		</div>
	<{/if}>

	<table id="questionnaire_question_list<{$id}>" class="questionnaire_question_list" summary="<{$lang.questionnaire_question_list_summary}>">
		<{foreach from=$action.questions item=question name="question"}>
			<tr id="questionnaire_question_row<{$question.question_id}><{$id}>">
				<td class="comp_draganddrop">
				</td>

				<td class="questionnaire_question_list_value">
					<div class="questionnaire_question_list_value">
						<{$question.question_value|smarty:nodefaults|wysiwig_convert_url}>
					</div>
				</td>

				<td class="questionnaire_question_list_manage" >
					<a class="syslink" href="#" title="<{$lang.questionnaire_edit_question_title|sprintf:$question.question_value|smarty:nodefaults}>" onclick="questionnaireCls['<{$id}>'].showQuestionEntry(event, '<{$question.question_id}>');return false;">
						<{$lang._edit|smarty:nodefaults}>
					</a>
					<{if $action.questionnaire.status == QUESTIONNAIRE_STATUS_INACTIVE_VALUE}>
						<{$lang._separator|smarty:nodefaults}>
						<a class="syslink" href="#" title="<{$lang.questionnaire_delete_question_title|sprintf:$question.question_value|smarty:nodefaults}>" onclick="questionnaireCls['<{$id}>'].deleteQuestion('<{$question.question_id}>', '<{$lang._del_confirm|sprintf:$lang.questionnaire_question_delete_message|sprintf:$smarty.foreach.question.iteration}>');return false;">
							<{$lang._delete|smarty:nodefaults}>
						</a>
					<{/if}>
				</td>
			</tr>
		<{/foreach}>
	</table>

	<div class="btn-bottom">
		<{if $action.questionnaire.status == QUESTIONNAIRE_STATUS_INACTIVE_VALUE && ($action.questions != null)}>
			<input class="btn-width" type="button" value="<{$lang.questionnaire_operate_start}>" onclick="questionnaireCls['<{$id}>'].startQuestion('<{$action.questionnaire.questionnaire_id}>','<{$lang.questionnaire_mes_operate_start|sprintf:$action.questionnaire.questionnaire_name|escape:"html"|escape:"javascript"}>');return false;" />
		<{/if}>
		<input class="btn-width" type="button" value="<{$lang.questionnaire_back_to_list}>" onclick="commonCls.sendView('<{$id}>', 'questionnaire_view_edit_questionnaire_list');" />
	</div>
</div>

<{include file = "../questionnaire_script.html"}>
<script class="nc_script" type="text/javascript">
	questionnaireCls["<{$id}>"].questionnaire_id = "<{$action.questionnaire.questionnaire_id}>";

	dropZone = Class.create();
	dropZone.prototype = Object.extend((new compDropzone), {
		showHover: function(event) {
			this.showChgSeqHover(event);
		},

		hideHover: function(event) {
			this.hideChgSeqHover(event);
		},

		accept: function(draggableObjects) {
			this.acceptChgSeq(draggableObjects);
		},

		save: function(draggableObjects) {
			if(this.ChgSeqPosition == null) {
				return false;
			}
	    	var drag = draggableObjects[0].getHTMLElement();
	    	var drop = this.getHTMLElement();

			var id = this.getParams();
			questionnaireCls[id].changeQuestionSequence(drag.id, drop.id, this.ChgSeqPosition);
			return true;
		}
	});

	var dragArea = $("questionnaire_question_list<{$id}>");
	dragDrop = new compDragAndDrop();
	dragDrop.registerDraggableRange(dragArea);
	var rows = dragArea.getElementsByTagName("tr");
	for (var i = 0; i < rows.length; i++) {
		dragDrop.registerDraggable(new compDraggable(rows[i], rows[i].firstChild));
		dragDrop.registerDropZone(new dropZone(rows[i], "<{$id}>"));
	}

	dropZone = null;
	dragArea = null;
	dragDrop = null;
	rows = null;
</script>
<{/strip}>