OSDN Git Service

add reset-button lock function.
[feedblog/feedgenerator.git] / erbtemp / reset.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">
7             /**
8              * ページのロード時に呼ばれるメソッド
9              */
10             function loadexec(){
11                 changeOpacity("initButton", 50);
12             }
13             
14             /**
15              * 対象のエレメントの半透明度を変更するメソッド
16              * @param {string} id 対象エレメントのID
17              * @param {int} alpha 半透明度(0~100で指定)
18              */
19             function changeOpacity(id, alpha){
20                 if (alpha < 0 || alpha > 100) {
21                     return false;
22                 }
23                 
24                 var targetElement = document.getElementById(id);
25                 targetElement.style.filter = "alpha(opacity=" + alpha + ")";
26                 targetElement.style.mozOpacity = alpha / 100;
27                 targetElement.style.opacity = alpha / 100;
28                 return true;
29             }
30             
31             function beforeexec(form, action){
32                 // 「OK」時の処理開始 + 確認ダイアログの表示
33                 if (window.confirm('本当に処理を実行しますか?')) {
34                     document.getElementsByName("action").item(0).value = action;
35                     form.submit();
36                 }
37                 else {
38                     return false;
39                 }
40             }
41             
42             function unlock(id){
43                 // ロックされた初期化ボタンを解除する
44                 if (document.getElementById(id).disabled) {
45                     alert('初期化ボタンをアンロックします。');
46                     var resetButton = document.getElementById(id);
47                     resetButton.disabled = false;
48                     changeOpacity(id, 100);
49                 }
50                 else {
51                     return false;
52                 }
53             }
54         </script>
55     </head>
56     <body onload="loadexec()">
57         <br>
58         <%= menu %>
59         <br>
60         <% db.transaction do %>
61         <div class="divstyle" style="width: <%= TABLEWIDTH %>px;">
62             <form action="<%= cgi.script_name %>" method="POST">
63                 <table align="center" style="width: <%= (TABLEWIDTH - 20) %>px;">
64                     <tbody>
65                         <tr>
66                             <td class="formnavi" style="text-align: left;">
67                                 <span style="font-weight: bold;">
68                                 ■ 初期化機能</a>
69                             </td>
70                         </tr>
71                         <tr>
72                             <td class="forminput" style="text-align: left;">
73                                 <span style="font-weight: bold;">[ 説明 ]</span>
74                                 <br>
75                                  この機能を使用することで、日記に関するデータ全てを消去することができます。
76                                 <br>
77                                  初期化処理を行うと、ディレクトリ [ <%= XMLPATH %>] の中のファイルを全て消去します。その後空のdiary.xmlとloglist.xmlを生成して設置します。消去前のAtom Feedの情報は一切保持されませんので気をつけてください。
78                                 <br>
79                                 <table align="center" style="width: 80%; margin-top: 8px; margin-bottom: 8px;">
80                                     <tbody>
81                                         <tr>
82                                             <td class="formnavi" style="text-align: center; padding: 3px;">
83                                                 [ <%= XMLPATH %>] ディレクトリ内部のファイル一覧
84                                             </td>
85                                         </tr>
86                                         <% db["filelist"].each do |fname| %>
87                                         <tr>
88                                             <td class="forminput" style="text-align: center; padding: 3px;">
89                                                 <a href="<%= XMLPATH %><%= fname %>" target="_blank"><%= fname %></a>
90                                             </td>
91                                         </tr>
92                                         <% end %>
93                                     </tbody>
94                                 </table>
95                             </td>
96                         </tr>
97                         <tr>
98                             <td class="forminput" style="text-align: left;">
99                                 <span style="font-weight: bold; color: #ff0000">[ 注意! ]</span>
100                                 <br>
101                                  初期化後にリセットしたデータを戻すことは出来ません!初期化を行う前に、入念に検討を行ってください。
102                                 <br>
103                             </td>
104                         </tr>
105                         <tr>
106                             <td class="forminput" style="text-align: center;">
107                                 <input type="button" value="ロック解除" onclick="unlock('initButton')"> <input type="hidden" name="mode" value="reset"><input type="hidden" name="action" value=""><input type="button" value="初期化を行う" onclick="beforeexec(this.form, 'exec')" disabled="true" id="initButton">
108                             </td>
109                         </tr>
110                     </tbody>
111                 </table>
112                 <br>
113                 <a href="<%= cgi.script_name %>">メニューに戻る</a>
114                 <br>
115             </form>
116         </div>
117         <% end %>
118         <br>
119         <div class="divstyle" style="border: none;">
120             <%= APPVERSION %>
121         </div>
122     </body>
123 </html>