]> git.sur5r.net Git - bacula/bacula/blob - gui/baculum/protected/Web/Portlets/Users.tpl
baculum: Fix redundant loading users portlet
[bacula/bacula] / gui / baculum / protected / Web / Portlets / Users.tpl
1 <a class="big" href="javascript:void(0)" id="add_user_btn"><img src="/themes/Baculum-v1/add.png" alt="Add"><%[ Add new user ]%></a>
2 <div id="add_user" style="display: none">
3         <p><%[ Username: ]%><input id="newuser" type="text" /><%[ Password: ]%><input id="newpwd" type="password" />
4         <a href="javascript:void(0)" onclick="Users.addUser()">
5                 <img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/icon_ok.png" alt="<%[ Save ]%>" title="<%[ Save ]%>"/>
6         </a>
7         <a href="javascript:void(0)" onclick="Users.cancelAddUser()">
8                 <img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/icon_err.png" alt="<%[ Close ]%>" title="<%[ Close ]%>" />
9         </a></p>
10 </div>
11 <com:TActiveRepeater ID="UsersList" OnLoad="setUsers" ActiveControl.EnableUpdate="false">
12         <prop:HeaderTemplate>
13         <table id="users_list" class="window-section-detail-smallrow">
14                 <tr>
15                         <th><%[ User name ]%></th>
16                         <th><%[ Role ]%></th>
17                         <th><%[ API host ]%></th>
18                         <th><%[ Actions ]%></th>
19                 </tr>
20         </prop:HeaderTemplate>
21         <prop:ItemTemplate>
22                 <tr class="slide-window-element">
23                         <td><%=$this->DataItem['user']%></td>
24                         <td><%=$this->DataItem['admin'] ? Prado::localize('Administrator') :  Prado::localize('Normal user')%></td>
25                         <td>
26                                 <com:TPanel Visible="<%=$this->DataItem['admin']%>" Style="line-height: 29px">
27                                         Main
28                                 </com:TPanel>
29                                 <com:TPanel Visible="<%=!$this->DataItem['admin']%>">
30                                                 <select rel="user_host" onchange="Users.set_host('<%=$this->DataItem['user']%>', this);">
31                                                         <com:TRepeater OnInit="SourceTemplateControl.initHosts">
32                                                                 <prop:HeaderTemplate>
33                                                         <option value=""><%[ Select host ]%></option>
34                                                                 </prop:HeaderTemplate>
35                                                                 <prop:ItemTemplate>
36                                                         <option value="<%=$this->DataItem%>" <%=(array_key_exists('users', $this->SourceTemplateControl->web_config) && array_key_exists($this->Parent->Parent->Parent->DataItem['user'], $this->SourceTemplateControl->web_config['users']) && $this->SourceTemplateControl->web_config['users'][$this->Parent->Parent->Parent->DataItem['user']] === $this->DataItem) ? 'selected' : ''%>><%=$this->DataItem%></option>
37                                                                 </prop:ItemTemplate>
38                                                         </com:TRepeater>
39                                                 </select>
40                                                 <img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/ajax-loader-arrows.gif" rel="user_host_img" alt="" style="visibility: hidden" />
41                                 </com:TPanel>
42                         </td>
43                         <td>
44                                 <a href="javascript:void(0)" <%=$this->DataItem['admin'] ? 'style="visibility: hidden"' : ''%> onclick="Users.rmUser('<%=$this->DataItem['user']%>')"><img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/user-del.png"> <%[ Remove user ]%></a>
45                                 <a href="javascript:void(0)" onclick="Users.showChangePwd(this)" rel="chpwd_btn">
46                                         <img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/key.png" alt="" />
47                                         <%[ Change password ]%>
48                                 </a>
49                                 <span style="display: none;" rel="chpwd">
50                                         <input type="password" onkeydown="event.keyCode == 13 ? Users.changePwd(this, '<%=$this->DataItem['user']%>') : (event.keyCode == 27 ? Users.cancelChangePwd(this.nextElementSibling.nextElementSibling) : '');" />
51                                         <a href="javascript:void(0)" onclick="Users.changePwd(this.prevousElementSibling, '<%=$this->DataItem['user']%>')">
52                                                 <img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/icon_ok.png" alt="<%[ Save ]%>" title="<%[ Save ]%>"/>
53                                         </a>
54                                         <a href="javascript:void(0)" onclick="Users.cancelChangePwd(this)">
55                                                 <img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/icon_err.png" alt="<%[ Close ]%>" title="<%[ Close ]%>" />
56                                         </a>
57                                 </span>
58                         </td>
59                 </tr>
60         </prop:ItemTemplate>
61         <prop:FooterTemplate>
62                 </table>
63         </prop:FooterTemplate>
64 </com:TActiveRepeater>
65 <com:TCallback ID="UserAction" OnCallback="TemplateControl.userAction" ClientSide.OnComplete="Users.hide_loader();" />
66 <script type="text/javascript">
67         var send_user_action = function(action, param, value) {
68                 Users.current_action = action;
69                 if (!value) {
70                         value = '';
71                 }
72                 var user_action_callback = <%=$this->UserAction->ActiveControl->Javascript%>;
73                 user_action_callback.setCallbackParameter([action, param, value].join(';'));
74                 user_action_callback.dispatch();
75         };
76         Users.txt = {
77                 enter_login: '<%[ Please enter login. ]%>',
78                 invalid_login: '<%[ Invalid login value. Login may contain a-z A-Z 0-9 characters. ]%>',
79                 invalid_pwd: '<%[ Password must be longer than 4 chars. ]%>'
80         };
81         Users.action_callback = send_user_action;
82         Users.validators = { user_pattern: new RegExp('^<%=BasicUserConfig::USER_PATTERN%>$') };
83         Users.init();
84 </script>