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