]> git.sur5r.net Git - bacula/bacula/blobdiff - gui/baculum/protected/Pages/Home.page
Update ReleaseNotes + ChangeLog
[bacula/bacula] / gui / baculum / protected / Pages / Home.page
index 3923aa6fe3c4a2fdb17450cdb6ede16d6c224e9b..e0e473d0d6111e876302d3ef9ad46c4bc12a9d30 100644 (file)
@@ -1,17 +1,87 @@
 <%@ MasterClass="Application.Layouts.Main" Theme="Baculum-v1"%>
 <com:TContent ID="Main">
        <div id="top">
-               <img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/logo.png" alt="Baculum" />
-               <div id="directors"><com:TLabel ForControl="Director" Text="<%[ Director: ]%>" />
-                       <com:TActiveDropDownList ID="Director" OnTextChanged="director" />
+               <div id="topbar">
+                       <div id="directors"><com:TLabel ForControl="Director" Text="<%[ Director: ]%>" />
+                               <com:TActiveDropDownList ID="Director" OnTextChanged="director" />
+                       </div>
+                       <div id="panel_switcher">
+                               <img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/dashboard.png" alt="" onclick="$('<%=$this->Dashboard->ClientID%>').click()" />
+                               <com:TActiveLinkButton ID="Dashboard" Text="<%[ Dashboard ]%>" Attributes.onclick="PanelWindow.show('dashboard'); return false;" />
+                               <img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/workspace.png" alt="" onclick="$('<%=$this->Workspace->ClientID%>').click()"/>
+                               <com:TActiveLinkButton ID="Workspace" Text="<%[ Workspace ]%>" Attributes.onclick="PanelWindow.show('container'); return false;" />
+                               <img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/graphs.png" alt="" onclick="$('<%=$this->Graphs->ClientID%>').click()" />
+                               <com:TActiveLinkButton ID="Graphs" Text="<%[ Graphs ]%>" Attributes.onclick="PanelWindow.show('graphs'); return false;" />
+                               <img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/users.png" alt="" onclick="$('<%=$this->Users->ClientID%>').click()" <%=$this->User->getIsAdmin() === false ? ' style="display: none;"' : ''%>/>
+                               <com:TActiveLinkButton ID="Users" Text="<%[ Users ]%>" Attributes.onclick="PanelWindow.show('users'); return false;" />
+                               <img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/logout.png" alt="" onclick="$('<%=$this->Logout->ClientID%>').click()" />
+                               <com:TActiveLinkButton ID="Logout" Text="<%[ Logout ]%>" OnClick="logout" ClientSide.OnComplete="document.location.href = document.location.protocol + '//' + document.location.host;" />
+                       </div>
+               <com:Application.Portlets.TrayBar ID="TrayBar" />
                </div>
-               <div id="panel_switcher">
-                       <com:TActiveLinkButton ID="Workspace" Text="<%[ Workspace ]%>" Attributes.onclick="PanelWindow.show('container');" />
-                       <com:TActiveLinkButton ID="Graphs" Text="<%[ Graphs ]%>" Attributes.onclick="PanelWindow.show('graphs');" />
+       </div>
+       <div id="dashboard">
+               <div>
+                       <div class="dashboard_graph">
+                               <div id="jobs_summary_graph">
+                                       <script type="text/javascript">
+                                               var oJobsStates = <%=$this->jobs_states%>;
+                                       </script>
+                               </div>
+                               <span><%[ Jobs status summary ]%></span>
+                       </div>
+                       <div id="dashboard_icons">
+                               <fieldset class="dashboard_field">
+                                       <legend><%[ Clients ]%></legend>
+                                       <img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/client.png" alt="" />
+                                       <p><span><%[ Number of clients: ]%></span><span id="clients_no"></span></p>
+                                       <p><span><%[ Most often used: ]%></span><span id="clients_most"></span></p>
+                                       <p><span><%[ Jobs count on most used: ]%></span><span id="clients_jobs"></span> <%[ jobs ]%></p>
+                               </fieldset>
+                               <fieldset class="dashboard_field">
+                                       <legend><%[ Quick job access ]%></legend>
+                                       <img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/quick-access.png" alt="" />
+                                       <p><span><%[ Jump to job (last 100): ]%></span></p><select id="jobs_to_view"></select>
+                                       <p class="right"><a href="javascript:void(0)" onclick="SlideWindow.getObj('JobWindow').quickJumpToElement($('jobs_to_view').value, '<%=$this->JobBtn->ClientID%>', PanelWindow);"><%[ View ]%></a></p>
+                               </fieldset>
+                               <fieldset class="dashboard_field">
+                                       <legend><%[ Finished jobs ]%></legend>
+                                       <img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/finished-jobs.png" alt="" />
+                                       <p><span><%[ Most often used: ]%></span><span id="jobs_most"></span></p>
+                                       <p><span><%[ Execution count most used: ]%></span><span id="jobs_most_count"></span> <%[ times ]%></p>
+                               </fieldset>
+                               <fieldset class="dashboard_field"<%=$this->User->getIsAdmin() === false ? ' style="display: none;"' : ''%>>
+                                       <legend><%[ Database ]%></legend>
+                                       <img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/database.png" alt="" />
+                                       <p><span><%[ Database type: ]%></span><span><%=$this->dbtype%></span></p>
+                                       <p><span><%[ Database size: ]%></span><span id="database_size"></span></p>
+                               </fieldset>
+                               <fieldset class="dashboard_field">
+                                       <legend><%[ Pools ]%></legend>
+                                       <img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/tapes.png" alt="" />
+                                       <p><span><%[ Number of pools: ]%></span><span id="pools_no"></span></p>
+                                       <p><span><%[ Most often used: ]%></span><span id="pools_most"></span></p>
+                                       <p><span><%[ Jobs count on most used: ]%></span><span id="pools_jobs"></span> <%[ jobs ]%></p>
+                               </fieldset>
+                               <fieldset class="dashboard_field">
+                                       <legend><%[ Job Totals ]%></legend>
+                                       <img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/jobtotals.png" alt="" />
+                                       <p><span><%[ Total bytes: ]%></span><span id="jobs_total_bytes"></span></p>
+                                       <p><span><%[ Total files: ]%></span><span id="jobs_total_files"></span></p>
+                               </fieldset>
+                               <fieldset class="dashboard_field">
+                                       <legend><%[ Restore Wizard ]%></legend>
+                                       <a class="big" href="<%=$this->Service->constructUrl('RestoreWizard')%>" style="line-height: 73px; display: block; text-align: center;"><img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/restore.png" alt="" /><%[ Perform Restore ]%></a>
+                               </fieldset>
+                               <fieldset class="dashboard_field"<%=$this->User->getIsAdmin() === false ? ' style="display: none;"' : ''%>>
+                                       <legend><%[ Configuration Wizard ]%></legend>
+                                       <a class="big" href="<%=$this->Service->constructUrl('ConfigurationWizard')%>" style="line-height: 73px; display: block; text-align: center;"><img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/setting.png" alt="" /><%[ Baculum Settings ]%></a>
+                               </fieldset>
+                       </div>
+                               <div style="clear: both"></div>
                </div>
-               <com:Application.Portlets.TrayBar ID="TrayBar" />
        </div>
-       <div id="container">
+       <div id="container" style="display: none;">
                <div id="menu-left">
                        <com:TActiveButton ID="StorageBtn" CssClass="storage-btn">
                                <prop:Attributes.onmouseover>
                                        });
                                </prop:ClientSide.OnComplete>
                        </com:TActiveButton>
-                       <com:TActiveButton ID="MediaBtn" CssClass="media-btn">
+                       <com:TActiveButton ID="VolumeBtn" CssClass="media-btn">
                                <prop:Attributes.onmouseover>
                                        showTip(
                                                this,
                        <div id="content">
                                <com:Application.Portlets.StorageList ID="StorageWindow" ButtonID="<%=$this->StorageBtn->ClientID%>" WindowTitle="<%[ Storage Daemons ]%>" />
                                <com:Application.Portlets.ClientList ID="ClientWindow" ButtonID="<%=$this->ClientBtn->ClientID%>" WindowTitle="<%[ Clients ]%>" />
-                               <com:Application.Portlets.VolumeList ID="VolumeWindow" ButtonID="<%=$this->MediaBtn->ClientID%>" WindowTitle="<%[ Volumes ]%>" />
+                               <com:Application.Portlets.VolumeList ID="VolumeWindow" ButtonID="<%=$this->VolumeBtn->ClientID%>" WindowTitle="<%[ Volumes ]%>" />
                                <com:Application.Portlets.PoolList ID="PoolWindow" ButtonID="<%=$this->PoolBtn->ClientID%>" WindowTitle="<%[ Pools ]%>" />
                                <com:Application.Portlets.JobList ID="JobWindow" ButtonID="<%=$this->JobBtn->ClientID%>" WindowTitle="<%[ Jobs ]%>" />
                                <com:Application.Portlets.JobRunList ID="JobRunWindow" ButtonID="<%=$this->JobRunBtn->ClientID%>" WindowTitle="<%[ Jobs for run ]%>" />
                        var graph;
                        document.observe("dom:loaded", function() {
                                PanelWindow.onShow = function() {
-                                       if(typeof(graph) == "undefined") {
+                                       if (PanelWindow.currentWindowId === 'graphs' && typeof(graph) == "undefined") {
                                                graph = new GraphClass(jobs, graph_lang, 'graphs_content', 'legend', 'time_range', '<%=$this->DateFrom->ClientID%>', '<%=$this->DateTo->ClientID%>', '<%=$this->Clients->ClientID%>', '<%=$this->Jobs->ClientID%>');
+                                       } else if (PanelWindow.currentWindowId === 'dashboard') {
+                                               Dashboard.update_all(Statistics, TEXT);
                                        }
                                };
                        });
                <p class="right bold italic"><%[ Tip: for getting zoom, please mark area on graph. ]%></p>
                <p class="right bold italic"><%[ Tip 2: for back from zoom, please click somewhere on graph. ]%></p>
        </div>
+       <div id="users" style="display: none">
+               <div>
+                       <a href="javascript:void(0)" id="add_user_btn"><strong><%[ Add new user ]%></strong></a>
+                       <div id="add_user" style="display: none">
+                               <p><%[ Username: ]%><input id="newuser" type="text" /><%[ Password: ]%><input id="newpwd" type="password" />
+                               <a href="javascript:void(0)" onclick="Users.addUser()">
+                                       <img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/icon_ok.png" alt="<%[ Save ]%>" title="<%[ Save ]%>"/>
+                               </a>
+                               <a href="javascript:void(0)" onclick="Users.cancelAddUser()">
+                                       <img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/icon_err.png" alt="<%[ Close ]%>" title="<%[ Close ]%>" />
+                               </a></p>
+                       </div>
+                       <com:TActiveRepeater ID="UsersList">
+                               <prop:HeaderTemplate>
+                               <table id="users_list" class="window-section-detail-smallrow">
+                                       <tr>
+                                               <th><%[ User name ]%></th>
+                                               <th><%[ Role ]%></th>
+                                               <th><%[ Actions ]%></th>
+                                       </tr>
+                               </prop:HeaderTemplate>
+                               <prop:ItemTemplate>
+                                       <tr class="slide-window-element">
+                                               <td><%=$this->DataItem%></td>
+                                               <td><%=$this->User->getName() == $this->DataItem ? Prado::localize('Administrator') :  Prado::localize('Normal user')%></td>
+                                               <td>
+                                                       <a href="javascript:void(0)" <%=$this->User->getName() == $this->DataItem ? 'style="visibility: hidden"' : ''%> onclick="Users.rmUser('<%=$this->DataItem%>')"><img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/user-del.png"> <%[ Remove user ]%></a>
+                                                       <a href="javascript:void(0)" onclick="Users.showChangePwd(this)" rel="chpwd_btn">
+                                                               <img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/key.png" alt="" />
+                                                               <%[ Change password ]%>
+                                                       </a>
+                                                       <span style="display: none;" rel="chpwd">
+                                                               <input type="password" onkeydown="event.keyCode == 13 ? Users.changePwd(this, '<%=$this->DataItem%>') : (event.keyCode == 27 ? Users.cancelChangePwd(this.nextElementSibling.nextElementSibling) : '');" />
+                                                               <a href="javascript:void(0)" onclick="Users.changePwd(this.prevousElementSibling, '<%=$this->DataItem%>')">
+                                                                       <img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/icon_ok.png" alt="<%[ Save ]%>" title="<%[ Save ]%>"/>
+                                                               </a>
+                                                               <a href="javascript:void(0)" onclick="Users.cancelChangePwd(this)">
+                                                                       <img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/icon_err.png" alt="<%[ Close ]%>" title="<%[ Close ]%>" />
+                                                               </a>
+                                                       </span>
+                                               </td>
+                                       </tr>
+                               </prop:ItemTemplate>
+                               <prop:FooterTemplate>
+                                       </table>
+                               </prop:FooterTemplate>
+                       </com:TActiveRepeater>
+                       <p><em><%[ Please note that for each user (excluding administrator) there should exist separate Bconsole config file in form: ]%> <strong><com:TLabel ID="BconsoleCustomPath" /></strong></em></p>
+                       <com:TCallback ID="UserAction" OnCallback="userAction" />
+                       <script type="text/javascript">
+                               var send_user_action = function(action, param, value) {
+                                       if (!value) {
+                                               value = '';
+                                       }
+                                       var user_action_callback = <%=$this->UserAction->ActiveControl->Javascript%>;
+                                       user_action_callback.ActiveControl.CallbackParameter = [action, param, value].join(';');
+                                       user_action_callback.dispatch();
+                               };
+                               Users.txt = {
+                                       enter_login: '<%[ Please enter login. ]%>',
+                                       invalid_login: '<%[ Invalid login value. Login may contain a-z A-Z 0-9 characters. ]%>',
+                                       invalid_pwd: '<%[ Password must be longer than 4 chars. ]%>'
+                               };
+                               Users.action_callback = send_user_action;
+                               Users.validators = { user_pattern: new RegExp('^<%=$this->userPattern%>$') };
+                               Users.init();
+                       </script>
+               </div>
+       </div>
        <div id="console">
                <a id="clear_bvfs_cache" href="javascript: void(0)"><com:TActiveImageButton ID="ClearBvfsCache" OnCallback="clearBvfsCache" Attributes.onclick="return (confirm('<%=Prado::localize('This action will clear bvfs cache that was created during preparing restore files. There is not recommended use this action during restore job working. Are you sure?')%>'));" ImageUrl="<%=$this->getPage()->getTheme()->getBaseUrl()%>/trash_icon.png" AlternateText="<%[ clear bvfs cache ]%>" /><com:TLabel ForControl="ClearBvfsCache"><%[ clear bvfs cache ]%></com:TLabel></a>
                <a id="logging" href="javascript:void(0)"><com:TActiveCheckBox ID="Logging" OnCallback="setDebug" Attributes.onclick="return (this.checked === false || confirm('<%=Prado::localize('Debug files enable possibility to save most of actions executed on Baculum WebGUI. Debug functionality should be enabled if is happening shomething wrong with Baculum or something that looks like a bug. Logs can be useful for detecting a problems in Baculum working. After confirmation this message Baculum debug files will be continuously saving in /protected/Data/ directory. Are you sure?')%>'));" /><com:TLabel ForControl="Logging"><%[ Enable debug ]%></com:TLabel></a>
-               <a id="volumes_tools_launcher" href="javascript:void(0)"><img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/tape_tools_icon.png" alt="<%[ volumes tools ]%>" /><span><%[ volumes tools ]%></span></a>
+               <a id="volumes_tools_launcher" href="javascript:void(0)" <%=$this->User->getIsAdmin() === false ? ' style="display: none;"' : ''%>><img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/tape_tools_icon.png" alt="<%[ volumes tools ]%>" /><span><%[ volumes tools ]%></span></a>
                <a id="console_launcher" href="javascript:void(0)"><img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/console_icon.png" alt="<%[ Bacula console ]%>" /><span><%[ show console ]%></span></a>
                <com:Application.Portlets.VolumesTools ID="VolumesTools" />
                <com:Application.Portlets.Console ID="Console" />
        <script type="text/javascript">
                var oMonitor;
                document.observe("dom:loaded", function() {
+                       <%=(!is_null($this->initWindowId) && !is_null($this->initElementId) ?
+                               'SlideWindow.getObj("' . $this->initWindowId . 'Window").setInitElementId("' . $this->initElementId . '");'
+                       : '')%>
                        <%=(!is_null($this->openWindow) ?
-                               '$("' . $this->openWindow . '").click(); window.history.pushState("", "", "/");'
-                        : '')%>
+                               'PanelWindow.show("container");
+                               $("' . $this->openWindow . '").click();
+                               window.history.pushState("", "", "/");'
+                       : '')%>
                });
+               var TEXT = {
+                       level: '<%[ level ]%>',
+                       status: '<%[ status ]%>',
+                       starttime: '<%[ start time ]%>'
+               }
        </script>
 </com:TContent>