OSDN Git Service

30bc1604fe7cda58fe22115673c86aae37ff696a
[feedblog/feedgenerator.git] / erbtemp / newentry.html.erb
1 <html>
2     <head>
3         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
4         <title><%= APPTITLE %></title>
5         <link rel="stylesheet" href="./erbtemp/stylesheet.css" type="text/css">
6         <% if params["action"].blank? || params["action"] == "back" %>
7         <!--[if IE]>
8             <script type="text/javascript" src="./openwysiwyg/scripts/wysiwyg.js">
9             </script>
10             <script type="text/javascript">
11             WYSIWYG.attach('contenteditor');
12             </script>
13         <![endif]--><% end %>
14         <![if !IE]>
15             <script type="text/javascript" src="./jquery/jquery.js">
16             </script>
17             <script type="text/javascript" src="./wymeditor/jquery.wymeditor.js">
18             </script>
19             <script type="text/javascript">
20                 jQuery(function(){
21                     jQuery('#contenteditor').wymeditor({
22                         updateSelector: ".wymupdate",
23                         updateSelector: "input",
24                         iframeBasePath: "main_"
25                     });
26                 });
27             </script>
28         <![endif]>
29         <script type="text/javascript">
30             function switchsubmit(form, action){
31                 document.getElementsByName("action").item(0).value = action;
32                 form.submit();
33             }
34         </script>
35     </head>
36     <body>
37         <br>
38         <%= menu %>
39         <br>
40         <div class="divstyle" style="width: <%= TABLEWIDTH %>px;">
41             <form action="<%= cgi.script_name %>" method="POST">
42                 <input type="hidden" name="target_filepath" value="<%= session["target_filepath"] %>"><% case params["action"]
43                 when "confirm" %>
44                 <table align="center" style="width: <%= (TABLEWIDTH - 20) %>px;">
45                     <tbody>
46                         <tr>
47                             <td colspan="2" class="formheader">
48                                 ■ 入力内容を確認してください
49                             </td>
50                         </tr>
51                         <% db.transaction do
52                         entry = db["newentry"]
53                         entry.paramlist.each do |val| %>
54                         <tr style="display: <%= entry.display[val] %>;">
55                             <td class="formnavi" style="width: 140px;">
56                                 <%= entry.name[val] %>
57                             </td>
58                             <td class="forminput">
59                                 <input type="hidden" name="<%= val %>" value="<%= entry.send(val) %>"><% if val != "content" %><%= entry.send(val) %><% else %><%= entry.content_for_view %><% end %>
60                             </td>
61                         </tr><% end %>
62                         <% end %>
63                     </tbody>
64                 </table>
65                 <br>
66                 <input type="hidden" name="mode" value="newentry"><input type="hidden" name="action" value=""><input type="button" value="戻る" onclick="switchsubmit(this.form, 'back')"> <input type="button" value="確定" onclick="switchsubmit(this.form, 'exec')"><% when "exec" %>
67                 <table align="center" style="width: <%= (TABLEWIDTH - 20) %>px;">
68                     <tbody>
69                         <tr>
70                             <td class="forminput" style="text-align: center;">
71                                 記事の書き込みが完了しました。
72                             </td>
73                         </tr>
74                     </tbody>
75                 </table>
76                 <br>
77                 <a href="<%= cgi.script_name %>">メニューに戻る</a>
78                 <% when "back" %>
79                 <table style="width: <%= (TABLEWIDTH - 20) %>px;">
80                     <tbody>
81                         <tr>
82                             <td colspan="2" class="formheader">
83                                 ■ 新規作成
84                                 <br>
85                             </td>
86                         </tr>
87                         <% db.transaction do
88                         if cgi["action"] == "back"
89                         entry = db["newentry"]
90                         else
91                         entry = Entry.new({})
92                         end
93                         entry.paramlist.each do |val| %>
94                         <tr style="display: <%= entry.display[val] %>;">
95                             <td class="formnavi" style="width: 140px;">
96                                 <%= entry.name[val] %>
97                             </td>
98                             <td class="forminput">
99                                 <% if val != "content" %>
100                                 <input type="text" name="<%= val %>" value="<%= entry.send(val) %>" style="width: 100%"><% else %>
101                                 <textarea name="<%= val %>" rows="10" style="width: 100%" id="contenteditor"><%= entry.content_for_generator %></textarea>
102                                 <% end %>
103                             </td>
104                         </tr>
105                         <% end %>
106                         <% end %>
107                     </tbody>
108                 </table>
109                 <br>
110                 <input type="hidden" name="mode" value="newentry"><input type="hidden" name="action" value="confirm"><input type="submit" value="確認"><% else %>
111                 <table align="center" style="width: <%= (TABLEWIDTH - 20) %>px;">
112                     <tbody>
113                         <tr>
114                             <td colspan="2" class="formheader">
115                                 ■ 新規作成
116                                 <br>
117                             </td>
118                         </tr>
119                         <% db.transaction do
120                         if cgi["action"] == "back"
121                         entry = db["newentry"]
122                         else
123                         entry = Entry.new({})
124                         end
125                         entry.paramlist.each do |val| %>
126                         <tr style="display: <%= entry.display[val] %>;">
127                             <td class="formnavi" style="width: 140px;">
128                                 <%= entry.name[val] %>
129                             </td>
130                             <td class="forminput">
131                                 <% date = Time.now.iso8601 %>
132                                 <% if val == "content" %>
133                                 <textarea name="<%= val %>" rows="10" style="width: 100%" id="contenteditor"><%= entry.content_for_generator %></textarea>
134                                 <% elsif val == "entryid" %>
135                                 <input type="text" name="<%= val %>" value="<%= db["feed"].feedid %>?<%= date %>" style="width: 100%"><% elsif val == "updated" || val == "published" %>
136                                 <input type="text" name="<%= val %>" value="<%= date %>" style="width: 100%"><% elsif val == "url" %>
137                                 <input type="text" name="<%= val %>" value="<%= db["feed"].url %>#<%= db["feed"].feedid %>?<%= date %>" style="width: 100%"><% else %>
138                                 <input type="text" name="<%= val %>" value="<%= entry.send(val) %>" style="width: 100%"><% end %>
139                             </td>
140                         </tr><% end %>
141                         <% end %>
142                     </tbody>
143                 </table>
144                 <br>
145                 <input type="hidden" name="mode" value="newentry"><input type="hidden" name="action" value="confirm"><input type="submit" class="wymupdate" value="確認"><% end %>
146             </form>
147         </div>
148         <br>
149         <div class="divstyle" style="border: none;">
150             <%= APPVERSION %>
151         </div>
152     </body>
153 </html>