<!DOCTYPE html>
<html>
	<head>
		<%= htmlparts["headtag"] %>
		<%= htmlparts['headjs_switchpost'] %>
		<script>
			function autocomp_feedid(){
                document.getElementsByName("feedid").item(0).value = document.getElementsByName("url").item(0).value;
            }
        </script>
	</head>
	<body>
		<form action="<%= cgi.script_name %>" method="POST">
			<div class="menu_wrapper">
				<%= htmlparts["menu"] %>
			</div>
			<%= htmlparts["selectfile"] %>
			<%= htmlparts["infoarea"] %>
			<div class="contents">
				<h1>基本情報編集</h1>
				<input type="hidden" name="target_filepath" value="<%= session["target_filepath"] %>">
                <% case params["action"]
                when "confirm" %>
                <table>
                    <tbody>
                        <% db.transaction do
                        feed = db["feed"]
                        feed.paramlist.each do |val| %>
                        <tr style="display: <%= feed.display[val] %>;">
                            <th class="small middle padding_normal">
                                <%= feed.name[val] %>
                            </th>
                            <td class="large left padding_normal">
                                <%= feed.send(val) %>
                                <input type="hidden" name="<%= val %>" value="<%= feed.send(val) %>">
                            </td>
                        </tr>
                        <tr style="display: <%= feed.display[val] %>;">
                            <td class="hr"></td>
                            <td class="hr"></td>
                        </tr>
                        <% end %>
                        <% end %>
                    </tbody>
                </table>
                <br>
                <div class="center">
                	<input type="hidden" name="mode" value="editfeed"><input type="hidden" name="action" value=""><input type="button" value="戻る" onclick="switchsubmit(this.form, 'back')">　<input type="button" value="確定" onclick="switchsubmit(this.form, 'exec')">
                </div>
                <br>
                <% else %>
                <table>
                    <tbody>
                        <% db.transaction do
                        feed = db["feed"]
                        feed.paramlist.each do |val| %>
                        <tr style="display: <%= feed.display[val] %>;">
                            <th class="small middle padding_normal">
                                <%= feed.name[val] %>
                            </th>
                            <td class="large middle padding_normal center">
                                <% date = Time.now.iso8601 %>
                                <% if val == "updated" %>
                                <input type="text" name="<%= val %>" value="<%= date %>" class="max_width"><% elsif val == "url" %>
                                <input type="text" name="<%= val %>" value="<%= feed.send(val) %>" class="max_width" onchange="autocomp_feedid();"><% elsif val == "feedid" %>
                                <input type="text" name="<%= val %>" value="<%= feed.send(val) %>" class="max_width">
                                <br>
                                <span style="font-style: italic;">通常、ウェブページのID情報は、あなたのウェブページURLと同一のものを使用することを推奨します。</span>
                                <% else %>
                                <input type="text" name="<%= val %>" value="<%= feed.send(val) %>" class="max_width"><% end %>
                            </td>
                        </tr>
                        <tr style="display: <%= feed.display[val] %>;">
                            <td class="hr"></td>
                            <td class="hr"></td>
                        </tr>
                        <% end %>
                        <% end %>
                    </tbody>
                </table>
                <br>
                <div class="center">
                	<input type="hidden" name="mode" value="editfeed"><input type="hidden" name="action" value="confirm"><input type="submit" value="確認">
                </div>
                <br>
                <% end %>
			</div>
			<div class="bottom_area">
				<%= APPVERSION %>
			</div>
		</form>
	</body>
</html>
