]> git.sur5r.net Git - bacula/bacula/commitdiff
baculum: Support for mobile web browsers in restore wizard
authorMarcin Haba <marcin.haba@bacula.pl>
Sun, 5 Jul 2015 18:49:06 +0000 (20:49 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 13 Aug 2015 06:51:50 +0000 (08:51 +0200)
gui/baculum/protected/Lang/en/messages.mo
gui/baculum/protected/Lang/en/messages.po
gui/baculum/protected/Lang/pl/messages.mo
gui/baculum/protected/Lang/pl/messages.po
gui/baculum/protected/Pages/RestoreWizard.page
gui/baculum/protected/Pages/RestoreWizard.php
gui/baculum/themes/Baculum-v1/wizard.css

index 6bf2bb9bfb3f8fefb8e70eb3e12abbcf62138142..90eeef88abaeb5dbb5b21e2aea687613fe03a712 100644 (file)
Binary files a/gui/baculum/protected/Lang/en/messages.mo and b/gui/baculum/protected/Lang/en/messages.mo differ
index 2a63ba9a4bb72c0e2ab5a5360319bc1957df69c0..84dd8cb8761a6c71873dab5fedbde64b08523055 100644 (file)
@@ -470,11 +470,11 @@ msgstr "Step 3 - select files to restore"
 msgid "Files"
 msgstr "Files"
 
-msgid "For see a file versions please double click file on the left files browser."
-msgstr "For see a file versions please double click file on the left files browser."
+msgid "For see a file versions please click file on the left files browser."
+msgstr "For see a file versions please click file on the left files browser."
 
-msgid "For add a file to restore please drag a file from frame on left or from above frame and drop it here"
-msgstr "For add a file to restore please drag a file from frame on left or from above frame and drop it here"
+msgid "For add a file to restore please click 'Add' link or drag a file from frame on left or from above frame and drop it here"
+msgstr "For add a file to restore please click 'Add' link or drag a file from frame on left or from above frame and drop it here"
 
 msgid "It seems that there is no files for choosing or file records in database for this job has been purged (file retention period expired)"
 msgstr "It seems that there is no files for choosing or file records in database for this job has been purged (file retention period expired)"
@@ -1010,3 +1010,6 @@ msgstr "Running jobs:"
 msgid "Finished jobs:"
 msgstr "Finished jobs:"
 
+msgid "Add"
+msgstr "Add"
+
index 417ecba3fa3ba78d2888d7dfc2863eba3c75e3f8..26b5ca220338d7dec9eca129d5634417bd3e50c4 100644 (file)
Binary files a/gui/baculum/protected/Lang/pl/messages.mo and b/gui/baculum/protected/Lang/pl/messages.mo differ
index 51e1cfe8d83018cef495ff247d745d363e590211..761e21bf98d4ee40f9d5b1d2fbed5f98bef844d6 100644 (file)
@@ -419,11 +419,11 @@ msgstr "Uruchom"
 msgid "It seems that there is no files for choosing or file records in database for this job has been purged (file retention period expired)"
 msgstr "Wygląda na to, że nie ma żadnych plików do przywrócenia lub rekordy plików w bazie danych dla tego wybranego backupu zostały wyczyszczone (miała zastosowanie retencja plików)"
 
-msgid "For see a file versions please double click file on the left files browser."
-msgstr "Aby zobaczyć wersje pliku proszę podwójnie klinąć plik z przeglądarki plików po lewej stronie."
+msgid "For see a file versions please click file on the left files browser."
+msgstr "Aby zobaczyć wersje pliku proszę klinąć plik z przeglądarki plików po lewej stronie."
 
-msgid "For add a file to restore please drag a file from frame on left or from above frame and drop it here"
-msgstr "Aby dodać plik do przywrócenia proszę złapać plik z panelu po lewej lub z panelu powyżej, przeciągnąć go tutaj i upuścić go"
+msgid "For add a file to restore please click 'Add' link or drag a file from frame on left or from above frame and drop it here"
+msgstr "Aby dodać plik do przywrócenia proszę kliknąć link 'Dodaj' lub złapać plik z panelu po lewej lub z panelu powyżej, przeciągnąć go tutaj i upuścić go"
 
 msgid "Source parameters"
 msgstr "Parametry źródła"
@@ -1011,3 +1011,6 @@ msgstr "Uruchomione zadania:"
 msgid "Finished jobs:"
 msgstr "Zakończone zadania:"
 
+msgid "Add"
+msgstr "Dodaj"
+
index 63b79bd94ad9505482a773c2a39c67914630260f..b79d1266fe3814a8b75c13bbc4f0d3ca622bd57a 100644 (file)
                        <table id="restore-browser">
                                <tr>
                                        <td rowspan="2">
+                                               <div id="restore-browser-files-loading" style="display: none"></div>
                                                <div id="restore-browser-files">
                                                        <com:TActiveDataGrid
                                                                ID="DataGridFiles"
                                                                                <prop:ItemTemplate>
                                                                                        <com:TDraggable ID="FileElementLeft" Revert="false" Handle="<%=$this->FileElementLeft->ClientID%>" Ghosting="true" CssClass="draggable">
                                                                                                <img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/<%=($this->getParent()->Data['type'] == 'dir' ? 'directory-icon' : 'file-icon')%>.png" alt="<%=$this->getParent()->Data['type'] == 'dir' ? 'directory' : 'file' %>" /> <%=($this->getParent()->Data['name'] != '/') ? preg_replace('/\/$/', '', $this->getParent()->Data['name']) : '/'%>
+                                                                                                               <com:TActiveLinkButton CssClass="link" Style="float: right;" OnCallback="Page.addFileToRestore" ActiveControl.CallbackParameter="<%=isset($this->getParent()->Data['fileid']) ? $this->getParent()->Data['fileid'] : null%>" ActiveControl.EnableUpdate="false" Visible="<%=!in_array($this->getParent()->Data['name'], $this->getPage()->excludedElementsFromAdd)%>" Text="<%[ Add ]%>" />
                                                                                        </com:TDraggable>
                                                                                        <com:TCallback ID="FileElementCall" OnCallback="Page.getVersions" ActiveControl.CallbackParameter="<%=$this->getParent()->Data['name'] . '|' . @$this->getParent()->Data['pathid'] . '|' . @$this->getParent()->Data['filenameid'] . '|' . @$this->getParent()->Data['jobid']%>">
+                                                                                               <prop:ClientSide.OnLoading>
+                                                                                                       $('restore-browser-files-loading').show();
+                                                                                               </prop:ClientSide.OnLoading>
                                                                                                <prop:ClientSide.OnComplete>
-                                                                                                       <%=$this->getPage()->UniqueID%>_lock = false;
+                                                                                                       $('restore-browser-files-loading').hide();
                                                                                                </prop:ClientSide.OnComplete>
                                                                                        </com:TCallback>
                                                                                        <script type="text/javascript">
-                                                                                               $('<%=$this->FileElementLeft->ClientID%>').observe('mouseup', function(event) {
-                                                                                                       event.findElement('div').setStyle({'position' : 'static', 'top' : '0', 'left' : '0'});
-                                                                                                       $('<%=$this->FileElementLeft->ClientID%>').setStyle({'position' : 'static', 'top' : '0', 'left' : '0'});
+                                                                                               document.getElementById('<%=$this->FileElementLeft->ClientID%>').addEventListener('mouseup', function(event) {
+                                                                                                       event.findElement('div').setStyle({'position' : 'static', 'top' : '-1px', 'left' : '-1px'});
+                                                                                                       $('<%=$this->FileElementLeft->ClientID%>').setStyle({'position' : 'static', 'top' : '-1px', 'left' : '-1px'});
                                                                                                });
                                                                                                
-                                                                                               var <%=$this->getPage()->UniqueID%>_lock;
-                                                                                               
-                                                                                               $('<%=$this->FileElementLeft->ClientID%>').up('tr').observe('dblclick', function(event) {
-                                                                                                       if(<%=$this->getPage()->UniqueID%>_lock){
+                                                                                               document.getElementById('<%=$this->FileElementLeft->ClientID%>').addEventListener('click', function(event) {
+                                                                                                       var el = event.target || event.srcElement;
+                                                                                                       var vposition = $(el).getStyle('left');
+                                                                                                       if(vposition == null || vposition == '0px'){
                                                                                                                event.stop();
                                                                                                        } else {
                                                                                                                var request = <%=$this->FileElementCall->ActiveControl->Javascript %>;
                                                                                                                request.dispatch();
-                                                                                                               <%=$this->getPage()->UniqueID%>_lock = true;
                                                                                                        }
-                                                                                               }.bind(<%=$this->getPage()->UniqueID%>_lock));
+                                                                                               });
                                                                                        </script>
                                                                                </prop:ItemTemplate>
                                                                        </com:TActiveTemplateColumn>
                                                        >
                                                                <prop:EmptyTemplate>
                                                                        <div class="file-browser-watermark">
-                                                                               <%[ For see a file versions please double click file on the left files browser. ]%>
+                                                                               <%[ For see a file versions please click file on the left files browser. ]%>
                                                                        </div>
                                                                </prop:EmptyTemplate>
                                                                <com:TActiveTemplateColumn>
                                                                        <prop:ItemTemplate>
-                                                                               <com:TDraggable ID="FileElementToRestore" Revert="false" Handle="<%=$this->FileElementToRestore->ClientID%>" Ghosting="true" CssClass="draggable">
+                                                                               <com:TDraggable ID="FileElementToRestore" Revert="false" Handle="<%=$this->FileElementToRestore->ClientID%>" Ghosting="true" CssClass="draggable" Style="float: left">
                                                                                        <img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/<%=($this->getParent()->Data['type'] == 'dir' ? 'directory-icon' : 'file-icon')%>.png" alt="<%=$this->getParent()->Data['type'] == 'dir' ? 'directory' : 'file'%>" />
                                                                                        <com:TLabel Text="<%=$this->getParent()->Data['name']%>" Width="50%" /> <%=is_array($this->getParent()->Data['lstat']) && array_key_exists('mtime', $this->getParent()->Data['lstat']) ? date("Y-m-d H:i:s", $this->getParent()->Data['lstat']['mtime']) : ''%>
                                                                                </com:TDraggable>
+                                                                               <com:TActiveLinkButton CssClass="link" Style="float: right;" OnCallback="Page.addFileToRestore" ActiveControl.CallbackParameter="<%=isset($this->getParent()->Data['fileid']) ? $this->getParent()->Data['fileid'] : false%>" ActiveControl.EnableUpdate="false" Text="<%[ Add ]%>"/>
                                                                                <script type="text/javascript">
                                                                                        $('<%=$this->FileElementToRestore->ClientID%>').observe('mouseup', function(event) {
                                                                                                event.findElement('div').setStyle({'position' : 'static', 'top' : '0', 'left' : '0'});
                                                                        >
                                                                        <prop:EmptyTemplate>
                                                                                <div class="file-browser-watermark" style="padding: 50px 10px">
-                                                                                       <%[ For add a file to restore please drag a file from frame on left or from above frame and drop it here ]%>
+                                                                                       <%[ For add a file to restore please click 'Add' link or drag a file from frame on left or from above frame and drop it here ]%>
                                                                                </div>
                                                                        </prop:EmptyTemplate>
                                                                                <com:TActiveTemplateColumn>
index b9223eecd1dedeeb8d7ad82ec3104ad473d478a7..0f19f873a7d1a42afc84b4dc34078ef386ba0a40 100644 (file)
@@ -20,6 +20,7 @@
 Prado::using('System.Exceptions.TException');
 Prado::using('System.Web.UI.ActiveControls.TActiveDropDownList');
 Prado::using('System.Web.UI.ActiveControls.TActivePanel');
+Prado::using('System.Web.UI.ActiveControls.TActiveLinkButton');
 Prado::using('System.Web.UI.ActiveControls.TActiveImageButton');
 Prado::using('System.Web.UI.ActiveControls.TDropContainer');
 Prado::using('System.Web.UI.ActiveControls.TDraggable');
@@ -37,6 +38,8 @@ class RestoreWizard extends BaculumPage
        private $browserRootDir = array('name' => '.', 'type' => 'dir');
        private $browserUpDir = array('name' => '..', 'type' => 'dir');
 
+       public $excludedElementsFromAdd = array('.', '..');
+
        const BVFS_PATH_PREFIX = 'b2';
 
        public function onInit($param) {
@@ -67,14 +70,24 @@ class RestoreWizard extends BaculumPage
        }
 
        public function addFileToRestore($sender, $param) {
-               $control=$param->getDroppedControl();
-        $item=$control->getNamingContainer();
-               list(, , , $dragElementID, , ) = explode('_', $param->getDragElementID(), 6); // I know that it is ugly.
-               if($dragElementID == $this->VersionsDataGrid->ID) {
-                       $fileid = $this->VersionsDataGrid->getDataKeys()->itemAt($item->getItemIndex());
+               $fileid = null;
+               if (isset($param->callbackParameter)) {
+                       list(, , , $sourceElementID, , ) = explode('_', $sender->ClientID, 6);
+                       $fileid = $param->callbackParameter;
+               } else {
+                       $control = $param->getDroppedControl();
+                       $item = $control->getNamingContainer();
+                       list(, , , $sourceElementID, , ) = explode('_', $param->getDragElementID(), 6); // I know that it is ugly.
+               }
+               if($sourceElementID == $this->VersionsDataGrid->ID) {
+                       if (is_null($fileid)) {
+                               $fileid = $this->VersionsDataGrid->getDataKeys()->itemAt($item->getItemIndex());
+                       }
                        $fileProperties = $this->getFileVersions($fileid);
                } else {
-                       $fileid = $this->DataGridFiles->getDataKeys()->itemAt($item->getItemIndex());
+                       if (is_null($fileid)) {
+                               $fileid = $this->DataGridFiles->getDataKeys()->itemAt($item->getItemIndex());
+                       }
                        $fileProperties = $this->getBrowserFile($fileid);
                }
                if($fileProperties['name'] != $this->browserRootDir['name'] && $fileProperties['name'] != $this->browserUpDir['name']) {
index 4d0dd7a03316949616bf312a221b240d6c67cf7d..39025c55e5b0291620d27f4bc1f8d040d606d79d 100644 (file)
        height: 206px;
 }
 
+#restore-browser-files-loading {
+       position: absolute;
+       z-index: 10;
+       width: 347px;
+       height: 438px;
+       border-radius: 4px;
+       background: rgba(182,182,182,0.7) url('progress.gif') no-repeat center center;
+}
+
 .file-browser-watermark {
        padding: 64px 10px;
        text-align: center;
@@ -152,3 +161,13 @@ div.button-cancel {
 div.button-prev-next {
        margin-left: 84px
 }
+
+a.link {
+       color: #3f4449;
+       font-weight: bold;
+       text-decoration: none;
+}
+
+a.link:hover {
+       text-decoration: underline;
+}