OSDN Git Service

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