]> git.sur5r.net Git - bacula/bacula/blob - gui/baculum/protected/Common/Portlets/NewHost.tpl
9858d938d4379acee80fdbf0793ff29faefa5d55
[bacula/bacula] / gui / baculum / protected / Common / Portlets / NewHost.tpl
1 <div id="new_host_status" class="center">
2         <com:TActiveLabel ID="NewHostAddOk" Display="None" CssClass="validate" EnableViewState="false"><img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/icon_ok.png" alt="Validate" /> <strong><%[ Host added successfully. ]%></strong></com:TActiveLabel>
3         <com:TActiveLabel ID="NewHostAddError" Display="None" CssClass="validator" EnableViewState="false"><img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/icon_err.png" alt="" /> <strong><%[ Problem during save to config file. Please check host config file permission. ]%></strong></com:TActiveLabel>
4         <com:TActiveLabel ID="NewHostAddExists" Display="None" CssClass="validator" EnableViewState="false"><img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/icon_err.png" alt="" /> <strong><%[ Given host already exists in config file. ]%></strong></com:TActiveLabel>
5 </div>
6 <div id="new_host" style="display: none">
7         <div class="line">
8                 <div class="text"><com:TLabel ForControl="APIProtocol" Text="<%[ Protocol: ]%>" /></div>
9                 <div class="field">
10                         <com:TActiveDropDownList ID="APIProtocol" CssClass="textbox" Width="150px" CausesValidation="false">
11                                 <com:TListItem Value="http" Text="HTTP" />
12                                 <com:TListItem Value="https" Text="HTTPS" Selected="true"/>
13                         </com:TActiveDropDownList>
14                 </div>
15         </div>
16         <div class="line">
17                 <div class="text"><com:TLabel ForControl="APIAddress" Text="<%[ IP Address/Hostname: ]%>" /></div>
18                 <div class="field">
19                         <com:TActiveTextBox ID="APIAddress" CssClass="textbox" CausesValidation="false" />
20                         <com:TRequiredFieldValidator ValidationGroup="NewHostGroup" CssClass="validator-block" Display="Dynamic" ControlCssClass="invalidate" ControlToValidate="APIAddress" Text="<%[ Please enter API address. ]%>" />
21                 </div>
22         </div>
23         <div class="line">
24                 <div class="text"><com:TLabel ForControl="APIPort" Text="<%[ Port: ]%>" /></div>
25                 <div class="field">
26                         <com:TActiveTextBox ID="APIPort" CssClass="textbox" CausesValidation="false" Text="9096" Width="70px" />
27                         <com:TRequiredFieldValidator ValidationGroup="NewHostGroup" CssClass="validator-block" Display="Dynamic" ControlCssClass="invalidate" ControlToValidate="APIPort" Text="<%[ Please enter API port. ]%>" />
28                 </div>
29         </div>
30         <div class="auth_setting">
31                 <div class="line left">
32                         <com:TRadioButton
33                                 ID="AuthOAuth2"
34                                 GroupName="SelectAuth"
35                                 Attributes.onclick="$('#configure_basic_auth').hide();$('#configure_oauth2_auth').show();"
36                         />
37                         <com:TLabel
38                                 ForControl="AuthOAuth2"
39                                 CssClass="normal"
40                                 Text="<%[ Use OAuth2 for authorization and authentication ]%>"
41                         />
42                 </div>
43                 <div class="line left">
44                         <com:TRadioButton
45                                 ID="AuthBasic"
46                                 GroupName="SelectAuth"
47                                 Checked="true"
48                                 Attributes.onclick="$('#configure_oauth2_auth').hide();$('#configure_basic_auth').show();"
49                         />
50                         <com:TLabel
51                                 ForControl="AuthBasic"
52                                 CssClass="normal"
53                                 Text="<%[ Use HTTP Basic authentication ]%>"
54                         />
55                 </div>
56         </div>
57         <div id="configure_basic_auth" style="display: <%=($this->AuthBasic->Checked === true) ? '' : 'none';%>">
58                 <div class="line">
59                         <div class="text"><com:TLabel ForControl="APIBasicLogin" Text="<%[ API Login: ]%>" /></div>
60                         <div class="field">
61                                 <com:TActiveTextBox
62                                         ID="APIBasicLogin"
63                                         CssClass="textbox"
64                                         CausesValidation="false"
65                                 />
66                                 <com:TRequiredFieldValidator
67                                         CssClass="validator-block"
68                                         Display="Dynamic"
69                                         ControlCssClass="invalidate"
70                                         ControlToValidate="APIBasicLogin"
71                                         ValidationGroup="Basic"
72                                         Text="<%[ Please enter API login. ]%>"
73                                  />
74                         </div>
75                 </div>
76                 <div class="line">
77                         <div class="text"><com:TLabel ForControl="APIBasicPassword" Text="<%[ API Password: ]%>" /></div>
78                         <div class="field">
79                                 <com:TActiveTextBox
80                                         ID="APIBasicPassword"
81                                         TextMode="Password"
82                                         CssClass="textbox"
83                                         CausesValidation="false"
84                                         PersistPassword="true"
85                                 />
86                                 <com:TRequiredFieldValidator
87                                         CssClass="validator-block"
88                                         Display="Dynamic"
89                                         ControlCssClass="invalidate"
90                                         ControlToValidate="APIBasicPassword"
91                                         ValidationGroup="Basic"
92                                         Text="<%[ Please enter API password. ]%>"
93                                 />
94                         </div>
95                 </div>
96         </div>
97         <div id="configure_oauth2_auth" style="display: <%=($this->AuthOAuth2->Checked === true) ? '' : 'none';%>">
98                 <div class="line">
99                         <div class="text"><com:TLabel ForControl="APIOAuth2ClientId" Text="<%[ OAuth2 Client ID: ]%>" /></div>
100                         <div class="field">
101                                 <com:TTextBox
102                                         ID="APIOAuth2ClientId"
103                                         CssClass="textbox"
104                                         CausesValidation="false"
105                                         MaxLength="32"
106                                 />
107                                 <com:TRequiredFieldValidator
108                                         CssClass="validator-block"
109                                         Display="Dynamic"
110                                         ControlCssClass="invalidate"
111                                         ControlToValidate="APIOAuth2ClientId"
112                                         ValidationGroup="OAuth2"
113                                         Text="<%[ Please enter Client ID. ]%>"
114                                 />
115                                 <com:TRegularExpressionValidator
116                                         CssClass="validator-block"
117                                         Display="Dynamic"
118                                         ControlCssClass="invalidate"
119                                         ControlToValidate="APIOAuth2ClientId"
120                                         RegularExpression="<%=OAuth2::CLIENT_ID_PATTERN%>"
121                                         ValidationGroup="OAuth2"
122                                         Text="<%[ Invalid Client ID value. Client ID may contain a-z A-Z 0-9 - _ characters. ]%>"
123                                         />
124                                 <a style="display: <%=$this->getClientMode() ? 'none': 'inline'%>" href="javascript:void(0)" onclick="document.getElementById('<%=$this->APIOAuth2ClientId->ClientID%>').value = get_random_string('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_', 32); return false;"><%[ generate ]%></a>
125                         </div>
126                 </div>
127                 <div class="line">
128                         <div class="text"><com:TLabel ForControl="APIOAuth2ClientSecret" Text="<%[ OAuth2 Client Secret: ]%>" /></div>
129                         <div class="field">
130                                 <com:TTextBox
131                                         ID="APIOAuth2ClientSecret"
132                                         CssClass="textbox"
133                                         CausesValidation="false"
134                                         MaxLength="40"
135                                 />
136                                 <com:TRequiredFieldValidator
137                                         CssClass="validator-block"
138                                         Display="Dynamic"
139                                         ControlCssClass="invalidate"
140                                         ControlToValidate="APIOAuth2ClientSecret"
141                                         ValidationGroup="OAuth2"
142                                         Text="<%[ Please enter Client Secret. ]%>"
143                                 />
144                                 <com:TRegularExpressionValidator
145                                         CssClass="validator-block"
146                                         Display="Dynamic"
147                                         ControlCssClass="invalidate"
148                                         ControlToValidate="APIOAuth2ClientSecret"
149                                         RegularExpression="<%=OAuth2::CLIENT_SECRET_PATTERN%>"
150                                         ValidationGroup="OAuth2"
151                                         Text="<%[ Invalid Client Secret value. Client Secret may contain any character that is not a whitespace character. ]%>"
152                                 />
153                                 <a style="display: <%=$this->getClientMode() ? 'none': 'inline'%>" href="javascript:void(0)" onclick="document.getElementById('<%=$this->APIOAuth2ClientSecret->ClientID%>').value = get_random_string('ABCDEFabcdef0123456789', 40); return false;"><%[ generate ]%></a>
154                         </div>
155                 </div>
156                 <div class="line">
157                         <div class="text"><com:TLabel ForControl="APIOAuth2RedirectURI" Text="<%[ OAuth2 Redirect URI (example: https://baculumgui:9095/web/redirect): ]%>" /></div>
158                         <div class="field">
159                                 <com:TTextBox
160                                         ID="APIOAuth2RedirectURI"
161                                         CssClass="textbox"
162                                         CausesValidation="false"
163                                 />
164                                 <com:TRequiredFieldValidator
165                                         CssClass="validator-block"
166                                         Display="Dynamic"
167                                         ControlCssClass="invalidate"
168                                         ControlToValidate="APIOAuth2RedirectURI"
169                                         ValidationGroup="OAuth2"
170                                         Text="<%[ Please enter Redirect URI. ]%>"
171                                 />
172                         </div>
173                 </div>
174                 <div class="line">
175                         <div class="text"><com:TLabel ForControl="APIOAuth2Scope" Text="<%[ OAuth2 scopes (space separated): ]%>" /></div>
176                         <div class="field">
177                                 <com:TTextBox
178                                         ID="APIOAuth2Scope"
179                                         CssClass="textbox"
180                                         CausesValidation="false"
181                                         TextMode="MultiLine"
182                                 />
183                                 <com:TRequiredFieldValidator
184                                         CssClass="validator-block"
185                                         Display="Dynamic"
186                                         ControlCssClass="invalidate"
187                                         ControlToValidate="APIOAuth2Scope"
188                                         ValidationGroup="OAuth2"
189                                         Text="<%[ Please enter OAuth2 scopes. ]%>"
190                                 />
191                         </div>
192                 </div>
193                 <div class="line" style="display: <%=$this->getClientMode() ? 'none': 'block'%>">
194                         <div class="text"><com:TLabel ForControl="APIOAuth2BconsoleCfgPath" Text="<%[ Dedicated Bconsole config file path: ]%>" /></div>
195                         <div class="field">
196                                 <com:TTextBox
197                                         ID="APIOAuth2BconsoleCfgPath"
198                                         CssClass="textbox"
199                                         CausesValidation="false"
200                                 /> <%[ (optional) ]%>
201                         </div>
202                 </div>
203         </div>
204         <div class="line">
205                 <div class="text"><com:TLabel ForControl="APIConnectionTest" Text="<%[ API connection test: ]%>" /></div>
206                 <div class="field">
207                         <table border="0" cellpadding="1px" id="new_host_status">
208                                 <tr>
209                                         <td align="center" valign="middle">
210                                                 <com:TActiveButton ID="APIConnectionTest" Text="<%[ test ]%>" CausesValidation="true" OnCallback="connectionAPITest">
211                                                         <prop:ClientSide.OnLoading>
212                                                                 $('#<%=$this->APITestResultOk->ClientID%>').hide();
213                                                                 $('#<%=$this->APITestResultErr->ClientID%>').hide();
214                                                                 $('#<%=$this->APICatalogSupportYes->ClientID%>').hide();
215                                                                 $('#<%=$this->APICatalogSupportNo->ClientID%>').hide();
216                                                                 $('#<%=$this->APIConsoleSupportYes->ClientID%>').hide();
217                                                                 $('#<%=$this->APIConsoleSupportNo->ClientID%>').hide();
218                                                                 $('#<%=$this->APIConfigSupportYes->ClientID%>').hide();
219                                                                 $('#<%=$this->APIConfigSupportNo->ClientID%>').hide();
220                                                                 $('#<%=$this->APITestLoader->ClientID%>').show();
221                                                         </prop:ClientSide.OnLoading>
222                                                         <prop:ClientSide.OnComplete>
223                                                                 $('#<%=$this->APITestLoader->ClientID%>').hide();
224                                                         </prop:ClientSide.OnComplete>
225                                                 </com:TActiveButton>
226                                         </td>
227                                         <td valign="middle">
228                                                 <com:TActiveLabel ID="APITestLoader" Display="None"><img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/ajax-loader.gif" alt="<%[ Loading... ]%>" /></com:TActiveLabel>
229                                                 <com:TActiveLabel ID="APITestResultOk" Display="None" CssClass="validate" EnableViewState="false"><img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/icon_ok.png" alt="Validate" /> <%[ OK ]%></com:TActiveLabel>
230                                                 <com:TActiveLabel ID="APITestResultErr" Display="None" CssClass="validator-block" EnableViewState="false"><img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/icon_err.png" alt="Invalidate" /> <%[ Connection error ]%></com:TActiveLabel>
231                                         </td>
232                                 </tr>
233                                 <tr>
234                                         <td><%[ Catalog support ]%></td>
235                                         <td>
236                                                 <com:TActiveLabel ID="APICatalogSupportYes" Display="None" CssClass="validate" EnableViewState="false"><img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/icon_ok.png" alt="Validate" /> <strong><%[ Supported ]%></strong></com:TActiveLabel>
237                                                 <com:TActiveLabel ID="APICatalogSupportNo" Display="None" CssClass="validator-info" EnableViewState="false"><img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/icon_close.png" alt="" /> <strong><%[ Not supported ]%></strong></com:TActiveLabel>
238                                         </td>
239                                 </tr>
240                                 <tr>
241                                         <td><%[ Console support ]%></td>
242                                         <td>
243                                                 <com:TActiveLabel ID="APIConsoleSupportYes" Display="None" CssClass="validate" EnableViewState="false"><img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/icon_ok.png" alt="Validate" /> <strong><%[ Supported ]%></strong></com:TActiveLabel>
244                                                 <com:TActiveLabel ID="APIConsoleSupportNo" Display="None" CssClass="validator-info" EnableViewState="false"><img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/icon_close.png" alt="" /> <strong><%[ Not supported ]%></strong></com:TActiveLabel>
245                                         </td>
246                                 </tr>
247                                 <tr>
248                                         <td><%[ Config support ]%></td>
249                                         <td>
250                                                 <com:TActiveLabel ID="APIConfigSupportYes" Display="None" CssClass="validate" EnableViewState="false"><img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/icon_ok.png" alt="Validate" /> <strong><%[ Supported ]%></strong></com:TActiveLabel>
251                                                 <com:TActiveLabel ID="APIConfigSupportNo" Display="None" CssClass="validator-info" EnableViewState="false"><img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/icon_close.png" alt="" /> <strong><%[ Not supported ]%></strong></com:TActiveLabel>
252                                         </td>
253                                 </tr>
254                         </table>
255                 </div>
256         </div>
257         <div class="line" <%=($this->getForceHostName() ? 'style="display: none;"' : '')%>>
258                 <div class="text"><com:TLabel ForControl="APIHostName" Text="<%[ Save as: ]%>" /></div>
259                 <div class="field">
260                         <com:TActiveTextBox ID="APIHostName" CssClass="textbox" CausesValidation="false" /> <%[ (optional) ]%>
261                 </div>
262         </div>
263         <div class="center" style="width: 550px;<%=($this->getShowButtons() ? '' : 'display: none;')%>">
264                 <com:BButton
265                         Text="<%[ Cancel ]%>"
266                         CausesValidation="false"
267                         Attributes.onclick="$('#new_host').slideUp(); return false;"
268                 />
269                 <com:BActiveButton
270                         ID="NewHost"
271                         ValidationGroup="NewHostGroup"
272                         OnCommand="TemplateControl.addNewHost"
273                         Text="<%[ Add host ]%>"
274                         Attributes.onclick="return fields_validation()"
275                 >
276                         <prop:ClientSide.OnPreDispatch>
277                                 $('#<%=$this->NewHostAddOk->ClientID%>').hide();
278                                 $('#<%=$this->NewHostAddError->ClientID%>').hide();
279                                 $('#<%=$this->NewHostAddExists->ClientID%>').hide();
280                         </prop:ClientSide.OnPreDispatch>
281                         <prop:ClientSide.OnComplete>
282                                 var msg_ok = $('#<%=$this->NewHostAddOk->ClientID%>'); 
283                                 if (msg_ok.is(':visible')) {
284                                         $('#new_host').slideUp();
285                                         setTimeout(function() {
286                                                 $('#<%=$this->NewHostAddOk->ClientID%>').slideUp();
287                                         }, 5000);
288                                         $('#new_host_status').find('span').hide();
289                                 }
290                         </prop:ClientSide.OnComplete>
291                 </com:BActiveButton>
292         </div>
293 </div>
294 <script type="text/javascript">
295         var fields_validation = function() {
296                 var basic = document.getElementById('<%=$this->AuthBasic->ClientID%>');
297                 var oauth2 = document.getElementById('<%=$this->AuthOAuth2->ClientID%>');
298                 var validation_group;
299                 if (basic.checked === true) {
300                         validation_group = 'Basic';
301                 } else if (oauth2.checked === true) {
302                         validation_group = 'OAuth2';
303                 }
304                 return Prado.Validation.validate(Prado.Validation.getForm(), validation_group);
305         }
306 </script>