OSDN Git Service

85bc022108157ed304936b48f2d8a2e31477d1f6
[karesansui/karesansui.git] / karesansui / templates / default / hostby1networkstorage / hostby1networkstorage.input
1 <%doc>Copyright (C) 2009-2010 HDE, Inc.</%doc>
2 <%inherit file="../include/common.part" />
3
4 <script type="text/javascript">
5 <!--
6 function validates_network_storage(){
7     var check = true;
8     ERROR_MSG = "";
9
10     check = check_domainname(
11                 $("#network_storage_host_name"),
12                 CHECK_EMPTY | CHECK_VALID,
13                 "${_('Host_Name')}"
14             ) && check;
15
16     check = check_number(
17                 $("#network_storage_port_number"),
18                 CHECK_VALID | CHECK_MIN | CHECK_MAX,
19                 "${_('Port Number')}",
20                 PORT_MIN_NUMBER,
21                 PORT_MAX_NUMBER
22             ) && check;
23
24     if ($("input:radio[name='network_storage_authentication']:checked").val() == "CHAP") {
25         check = check_string(
26             $("#network_storage_user"),
27             CHECK_EMPTY | CHECK_ONLYSPACE,
28             "${_('Authentication User')}",
29             null,
30             CHAP_USER_MIN_LENGTH,
31             CHAP_USER_MAX_LENGTH
32         ) && check;
33
34         check = check_password(
35             $("#network_storage_password"),
36             $("#network_storage_password"),
37             CHECK_LENGTH | CHECK_VALID | CHECK_EMPTY,
38             "${_('Authentication Password')}",
39             CHAP_PASSWORD_MIN_LENGTH,
40             CHAP_PASSWORD_MAX_LENGTH
41         ) && check;
42     }
43
44     if (!check) {
45         show_alert_msg("${_('Please input correct value.')}\n" + ERROR_MSG);
46     }
47
48     return check;
49 };
50
51 $(document).ready(function(){
52     ajax_post_event(
53         "#add_network_storage_button",
54         "${ctx.homepath}/host/${host_id}/networkstorage",
55         "#input_network_storage :input",
56         validates_network_storage
57         );
58
59     $("input:radio[name='network_storage_authentication']").click(function(){
60         if($(this).val() == "None") {
61             $("#auth-section").hide();
62         } else if ($(this).val() == "CHAP") {
63             $("#auth-section").show();
64         }
65     });
66
67     // help
68     // TRANSLATORS:
69     //  自前で適当な英語と日本語を入れてあるので、修正をお願いします
70     helptip("#network_storage_type_help",
71         "${_('Device Type')}",
72         "${_(r'Type of the network storage to add. Choose \"iSCSI\" to add a new iSCSI device to the host.')}");
73
74     helptip("#network_storage_host_name_help",
75         "${_('Host Name')}",
76         "${_('Network storage target. Please input either of the host name or IP address.')}");
77
78     helptip("#network_storage_port_number_help",
79         "${_('Port Number')}",
80         "${_('Network storage target port number. When nothing is input, it becomes 3260 number of the iSCSI defaults.')}");
81
82     helptip("#network_storage_authentication_help",
83         "${_('Authentication')}",
84         "${_('iSCSI authentication type. Please do not authentication or select either of the CHAP authentication.')}");
85
86     helptip("#network_storage_user_help",
87         "${_('User')}",
88         "${_('iSCSI authentication user name. Please input the alphanumeric character up to 256 characters.')}");
89
90     helptip("#network_storage_password_help",
91         "${_('Password')}",
92         "${_('iSCSI authentication password. Please input the alphanumeric character up to 256 characters. ')}");
93
94     helptip("#network_storage_auto_start_help",
95         "${_('Autostart')}",
96         "${_('When checked, the connection automatically at startup.')}");
97 });
98 -->
99 </script>
100
101 <div id="input_network_storage">
102     <form method="post" action="" id="input_network_storage_form" name="input_network_storage_form">
103         <div class="grayout-head">
104             <span class="grayout-title">
105                 <a href="#" id="server" class="path-a"><img src="${ctx.homepath}/static/images/settings-title.gif">${_('Add Network_Storage')}</a>
106             </span>
107             <br style="clear: both;"/>
108         </div>
109 <!--
110     TRANSLATORS:
111     hostby1networkstorage.part(一覧表示の画面)と表記を統一してください
112 -->
113         <div class="grayout-contents">
114             <div class="grayout-param">${_('Device Type')}<span id="network_storage_type_help" /></div>
115             <div class="grayout-value grayout-form">
116                 <select name="network_storage_type" id="network_storage_type">
117                     <option id="network_storage_type_iscsi" value="iscsi">${_('iSCSI')}</option>
118                 </select>
119             </div>
120
121             <div class="grayout-param">${_('Target host name')}<span id="network_storage_host_name_help" /></div>
122             <div class="grayout-value grayout-form">
123                     <input type="text" name="network_storage_host_name" id="network_storage_host_name" value="${info['hostname'] | h}" size="40" maxlength="256" />
124                 <span class="require-text">${_('Require')}</span>
125             </div>
126
127            <div class="grayout-param">${_('Port Number')}<span id="network_storage_port_number_help" /></div>
128             <div class="grayout-value grayout-form">
129                     <input type="text" name="network_storage_port_number" id="network_storage_port_number" value="${info['port'] | h}" size="5" maxlength="5" />
130             </div>
131
132             <div class="grayout-param">${_('Authentication')}<span id="network_storage_authentication_help" /></div>
133             <div class="grayout-value grayout-form">
134                 <input type="radio" name="network_storage_authentication" id="network_storage_auth_chap" value="CHAP" checked/>${_('CHAP')}
135                 <input type="radio" name="network_storage_authentication" id="network_storage_auth_none" value="None" />${_('None')}
136             </div>
137
138             <div id="auth-section">
139                 <div class="grayout-param">${_('Authentication user name')}<span id="network_storage_user_help" /></div>
140                 <div class="grayout-value grayout-form">
141                         <input type="text" name="network_storage_user" id="network_storage_user" value="${info['user'] | h}" size="40" maxlength="256" />
142                     <span class="require-text">${_('Require')}</span>
143                 </div>
144
145                 <div class="grayout-param">${_('Authentication password')}<span id="network_storage_password_help" /></div>
146                 <div class="grayout-value grayout-form">
147                     <input type="password" name="network_storage_password" id="network_storage_password" value="" size="40" maxlength="256" />
148                     <span class="require-text">${_('Require')}</span>
149                 </div>
150             </div>
151
152             <div class="grayout-param">${_('Autostart')}<span id="network_storage_auto_start_help" /></div>
153             <div class="grayout-value grayout-form">
154 % if info['autostart'] == 1:
155                     <input type="checkbox" name="network_storage_auto_start" id="network_storage_auto_start" value="auto_start" checked />${_('Enable Autostart')}
156 % else:
157                     <input type="checkbox" name="network_storage_auto_start" id="network_storage_auto_start" value="auto_start" /> ${_('Enable Autostart')}
158 % endif
159             </div>
160
161             <div class="grayout-footer">
162                 <a href="#" name="add_network_storage_button" id="add_network_storage_button" class="button">
163                     <span class="button-left">&nbsp;</span><span class="button-right">${_('Add')}</span>
164                 </a>
165                 <br style="clear: both;"/>
166             </div>
167             <br style="clear: both;"/>
168         </div>
169     </form>
170 </div>