|
21 | 21 | */ |
22 | 22 | Date: function (oDate) { |
23 | 23 | return [ |
24 | | - ('0' + (oDate.getMonth() + 1)).slice(-2), |
25 | | - ('0' + oDate.getDate()).slice(-2), |
26 | | - oDate.getFullYear() |
27 | | - ].join('/') + |
| 24 | + ('0' + (oDate.getMonth() + 1)).slice(-2), |
| 25 | + ('0' + oDate.getDate()).slice(-2), |
| 26 | + oDate.getFullYear() |
| 27 | + ].join('/') + |
28 | 28 | ' ' + |
29 | 29 | [ |
30 | 30 | ('0' + oDate.getHours() % 12 || 12).slice(-2), |
|
47 | 47 | html = html.replace(/<b>/g, safePrefix + '_0').replace(/<\/b>/g, safePrefix + '_1'); |
48 | 48 | html = $('<div />').text(html).text(); |
49 | 49 | html = html.replace(new RegExp(safePrefix + '_0', 'g'), '<b>'). |
50 | | - replace(new RegExp(safePrefix + '_1', 'g'), '</b>'); |
| 50 | + replace(new RegExp(safePrefix + '_1', 'g'), '</b>'); |
51 | 51 | } |
52 | 52 | return $('<div />').addClass('snippet').html(html); |
53 | 53 | }, |
|
99 | 99 | $('<tr />').html([ |
100 | 100 | $('<td class="d-none d-sm-table-cell" />').text(i + 1), |
101 | 101 | $('<td />'). |
102 | | - html(oItem.IsFolder() ? '<span class="fas fa-folder">' + locked + |
103 | | - '</span>' : locked), |
| 102 | + html(oItem.IsFolder() ? '<span class="fas fa-folder">' + locked + |
| 103 | + '</span>' : locked), |
104 | 104 | this._RenderDisplayName(oItem), |
105 | 105 | $('<td class="d-none d-sm-table-cell" />').text(oItem.IsFolder() ? 'Folder' : ('File ' + Formatters.GetFileExtension(oItem.DisplayName))), |
106 | 106 | $('<td />'). |
107 | | - text(!oItem.IsFolder() ? Formatters.FileSize(oItem.ContentLength) : ''). |
108 | | - css('text-align', 'right'), |
| 107 | + text(!oItem.IsFolder() ? Formatters.FileSize(oItem.ContentLength) : ''). |
| 108 | + css('text-align', 'right'), |
109 | 109 | $('<td class="d-none d-sm-table-cell" />').text(Formatters.Date(oItem.LastModified)), |
110 | 110 | $('<td class="column-action" />').html(this._RenderActions(oItem)) |
111 | 111 | ]), |
|
118 | 118 | }, |
119 | 119 |
|
120 | 120 | /** |
121 | | - * @param {ITHit.WebDAV.Client.HierarchyItem} oItem |
122 | | - **/ |
| 121 | + * @param {ITHit.WebDAV.Client.HierarchyItem} oItem |
| 122 | + **/ |
123 | 123 | _RenderDisplayName: function (oItem) { |
124 | 124 | var oElement = oItem.IsFolder() ? |
125 | 125 | $('<td class="ellipsis" />').html($('<a />').text(oItem.DisplayName).attr('href', oItem.Href)) : |
|
151 | 151 |
|
152 | 152 | if (oItem.IsFolder()) { |
153 | 153 | actions.push($('<button class="btn btn-transparent browse-lnk" type="button"/>'). |
154 | | - html('<span class="fas fa-hdd"></span> <span class="d-none d-md-inline">Browse</span>'). |
155 | | - attr('title', 'Open this folder in Operating System file manager.'). |
156 | | - on('click', function () { |
157 | | - oWebDAV.OpenFolderInOsFileManager(oItem.Href); |
158 | | - }).prop("disabled", !isDavProtocolSupported)); |
| 154 | + html('<span class="fas fa-hdd"></span> <span class="d-none d-md-inline">Browse</span>'). |
| 155 | + attr('title', 'Open this folder in Operating System file manager.'). |
| 156 | + on('click', function () { |
| 157 | + oWebDAV.OpenFolderInOsFileManager(oItem.Href); |
| 158 | + }).prop("disabled", !isDavProtocolSupported)); |
159 | 159 | } else { |
160 | 160 | actions.push($('<button class="btn btn-transparent"/>'). |
161 | | - html('<span class="fas fa-edit"></span> <span class="d-none d-md-inline">Edit</span>'). |
162 | | - attr('title', 'Edit document in associated application.'). |
163 | | - on('click', function () { |
164 | | - oWebDAV.EditDoc(oItem.Href); |
165 | | - }).prop("disabled", !isDavProtocolSupported && !isMicrosoftOfficeDocument)); |
| 161 | + html('<span class="fas fa-edit"></span> <span class="d-none d-md-inline">Edit</span>'). |
| 162 | + attr('title', 'Edit document in associated application.'). |
| 163 | + on('click', function () { |
| 164 | + oWebDAV.EditDoc(oItem.Href); |
| 165 | + }).prop("disabled", !isDavProtocolSupported && !isMicrosoftOfficeDocument)); |
166 | 166 | actions.push($('<button class="btn btn-transparent"/>') |
167 | 167 | .html('<span class="fas fa-window-maximize"></span>') |
168 | 168 | .attr('title', 'Select application to open this file with.') |
|
209 | 209 | SetDisabled: function (bIsDisabled) { |
210 | 210 | this.$el.find('button').prop('disabled', bIsDisabled); |
211 | 211 | this.$el.find('input'). |
212 | | - prop('disabled', bIsDisabled). |
213 | | - attr('placeholder', !bIsDisabled ? '' : 'The server does not support search'); |
| 212 | + prop('disabled', bIsDisabled). |
| 213 | + attr('placeholder', !bIsDisabled ? '' : 'The server does not support search'); |
214 | 214 | }, |
215 | 215 |
|
216 | 216 | GetValue: function () { |
|
406 | 406 | var className = 'ascending' |
407 | 407 | if ($(this).hasClass('ascending')) { |
408 | 408 | className = 'descending'; |
409 | | - } |
| 409 | + } |
410 | 410 |
|
411 | 411 | oWebDAV.Sort($(this).data('sort-column'), className == 'ascending'); |
412 | 412 | }) |
|
447 | 447 | }, |
448 | 448 |
|
449 | 449 | _OnPopState: function (oEvent) { |
450 | | - if (!oWebDAV.GetHashValue('search')) { |
| 450 | + if (oWebDAV.GetHashValue('search')) { |
| 451 | + oSearchForm.LoadFromHash(); |
| 452 | + } |
| 453 | + else { |
451 | 454 | var sUrl = oEvent.state && oEvent.state.Url || window.location.href.split("#")[0]; |
452 | 455 | oWebDAV.NavigateFolder(sUrl); |
453 | 456 | } |
|
569 | 572 | sPath = this.CurrentFolder.Href; |
570 | 573 | } |
571 | 574 |
|
| 575 | + //set upload url for uploader control |
| 576 | + if (typeof WebDAVUploaderGridView !== 'undefined') { |
| 577 | + WebDAVUploaderGridView.SetUploadUrl(sPath); |
| 578 | + } |
| 579 | + |
572 | 580 | if (sortColumn) { |
573 | 581 | this.CurrentSortColumn = sortColumn; |
574 | 582 | this.CurrentSortAscending = sortAscending; |
|
634 | 642 | }, |
635 | 643 |
|
636 | 644 | NavigateSearch: function (sPhrase, bIsDynamic, pageNumber, updateUrlHash, fCallback) { |
637 | | - var pageSize = this.PageSize, currentPageNumber = 1; |
| 645 | + var pageSize = this.PageSize, currentPageNumber = 1; |
638 | 646 |
|
639 | 647 | if (!this.CurrentFolder) { |
640 | 648 | fCallback && fCallback({ Items: [], TotalItems: 0 }); |
|
669 | 677 | // If ‘%’, ‘_’ or ‘\’ characters are used in search phrase they are escaped as ‘\%’, ‘\_’ and ‘\\’. |
670 | 678 | var searchQuery = new ITHit.WebDAV.Client.SearchQuery(); |
671 | 679 | searchQuery.Phrase = sPhrase.replace(/\\/g, '\\\\'). |
672 | | - replace(/\%/g, '\\%'). |
673 | | - replace(/\_/g, '\\_'). |
674 | | - replace(/\*/g, '%'). |
675 | | - replace(/\?/g, '_') + '%'; |
| 680 | + replace(/\%/g, '\\%'). |
| 681 | + replace(/\_/g, '\\_'). |
| 682 | + replace(/\*/g, '%'). |
| 683 | + replace(/\?/g, '_') + '%'; |
676 | 684 | searchQuery.EnableContains = !bIsDynamic; //Enable/disable search in file content. |
677 | 685 |
|
678 | 686 | // Get following additional properties from server in search results: snippet - text around search phrase. |
679 | 687 | searchQuery.SelectProperties = [ |
680 | 688 | this.SnippetPropertyName |
681 | 689 | ]; |
682 | 690 |
|
683 | | - this.CurrentFolder.GetSearchPageByQueryAsync(searchQuery, (currentPageNumber - 1) * pageSize, pageSize, function (oResult) { |
684 | | - /** @type {ITHit.WebDAV.Client.AsyncResult} oResult */ |
| 691 | + function _getSearchPageByQuery() { |
| 692 | + oWebDAV.CurrentFolder.GetSearchPageByQueryAsync(searchQuery, (currentPageNumber - 1) * pageSize, pageSize, function (oResult) { |
| 693 | + /** @type {ITHit.WebDAV.Client.AsyncResult} oResult */ |
685 | 694 |
|
686 | | - /** @type {ITHit.WebDAV.Client.HierarchyItem[]} aItems */ |
| 695 | + /** @type {ITHit.WebDAV.Client.HierarchyItem[]} aItems */ |
687 | 696 |
|
688 | | - fCallback && fCallback(oResult); |
689 | | - }); |
| 697 | + fCallback && fCallback(oResult); |
| 698 | + }); |
| 699 | + } |
| 700 | + |
| 701 | + if (window.location.href.split("#")[0] != this.CurrentFolder.Href) { |
| 702 | + this.WebDavSession.OpenFolderAsync(window.location.href.split("#")[0], [], function (oResponse) { |
| 703 | + oWebDAV.CurrentFolder = oResponse.Result; |
| 704 | + oBreadcrumbs.SetHierarchyItem(oWebDAV.CurrentFolder); |
| 705 | + _getSearchPageByQuery(); |
| 706 | + }); |
| 707 | + } |
| 708 | + else { |
| 709 | + _getSearchPageByQuery(); |
| 710 | + } |
| 711 | + |
| 712 | + |
690 | 713 | }, |
691 | 714 |
|
692 | 715 | Sort: function (columnName, sortAscending) { |
|
708 | 731 | }, |
709 | 732 |
|
710 | 733 | /** |
711 | | - * Opens document with. |
712 | | - * @param {string} sDocumentUrl Must be full path including domain name: https://webdavserver.com/path/file.ext |
713 | | - */ |
| 734 | + * Opens document with. |
| 735 | + * @param {string} sDocumentUrl Must be full path including domain name: https://webdavserver.com/path/file.ext |
| 736 | + */ |
714 | 737 | OpenDocWith: function (sDocumentUrl) { |
715 | 738 | ITHit.WebDAV.Client.DocManager.DavProtocolEditDocument(sDocumentUrl, this.GetMountUrl(), this._ProtocolInstallMessage.bind(this), null, webDavSettings.EditDocAuth.SearchIn, |
716 | 739 | webDavSettings.EditDocAuth.CookieNames, webDavSettings.EditDocAuth.LoginUrl, 'OpenWith'); |
717 | 740 | }, |
718 | 741 |
|
719 | 742 | /** |
720 | | - * Deletes document. |
721 | | - * @param {string} sDocumentUrl Must be full path including domain name: https://webdavserver.com/path/file.ext |
722 | | - */ |
| 743 | + * Deletes document. |
| 744 | + * @param {string} sDocumentUrl Must be full path including domain name: https://webdavserver.com/path/file.ext |
| 745 | + */ |
723 | 746 | DeleteHierarchyItem: function (oItem) { |
724 | 747 | oConfirmModal.Confirm('Are you sure want to delete ' + oItem.DisplayName + '?', function () { |
725 | 748 | oItem.DeleteAsync(null); |
|
749 | 772 | // Web Folders on Windows XP require port, even if it is a default port 80 or 443. |
750 | 773 | var port = window.location.port || (window.location.protocol == 'http:' ? 80 : 443); |
751 | 774 |
|
752 | | - return window.location.protocol + '//' + window.location.hostname + ':' + port + webDavSettings.ApplicationPath; |
| 775 | + return window.location.protocol + '//' + window.location.hostname + ':' + port + webDavSettings.ApplicationPath + '/'; |
753 | 776 | }, |
754 | 777 |
|
755 | 778 | /** |
756 | | - * Creates new folder in current folder. |
757 | | - */ |
| 779 | + * Creates new folder in current folder. |
| 780 | + */ |
758 | 781 | CreateFolder: function (sFolderName, fCallback) { |
759 | 782 | this.CurrentFolder.CreateFolderAsync(sFolderName, null, null, function (oAsyncResult) { |
760 | 783 | fCallback(oAsyncResult); |
|
772 | 795 | }, |
773 | 796 |
|
774 | 797 | /** |
775 | | - * Sets values to hash |
| 798 | + * Sets values to hash |
776 | 799 | */ |
777 | 800 | SetHashValues: function (arrayValues) { |
778 | 801 | var hashValue = ''; |
|
799 | 822 | }, |
800 | 823 |
|
801 | 824 | /** |
802 | | - * Sets value to hash |
| 825 | + * Sets value to hash |
803 | 826 | */ |
804 | 827 | SetHashValue: function (name, value) { |
805 | 828 | this.SetHashValues([{ Name: name, Value: value }]); |
|
810 | 833 | * @return {Array} |
811 | 834 | */ |
812 | 835 | _addParameterToArray: function (name, value, arrayParams) { |
813 | | - var nameExist = false; |
| 836 | + var nameExist = false; |
814 | 837 |
|
815 | 838 | for (var key in arrayParams) { |
816 | 839 | if (arrayParams.hasOwnProperty(key)) { |
|
862 | 885 | (ITHit.DetectBrowser.Browser ? ('#' + ITHit.DetectBrowser.Browser.toLowerCase()) : '') + |
863 | 886 | '">How to check that the web browser extension is enabled.</a><br/><br/>' + |
864 | 887 | 'Select OK to download the protocol installer.', function () { |
865 | | - // IT Hit WebDAV Ajax Library protocol installers path. |
866 | | - // Used to open non-MS Office documents or if MS Office is |
867 | | - // not installed as well as to open OS File Manager. |
| 888 | + // IT Hit WebDAV Ajax Library protocol installers path. |
| 889 | + // Used to open non-MS Office documents or if MS Office is |
| 890 | + // not installed as well as to open OS File Manager. |
868 | 891 |
|
869 | | - var installerFilePath = webDavSettings.ApplicationProtocolsPath + ITHit.WebDAV.Client.DocManager.GetInstallFileName(); |
870 | | - window.open(installerFilePath); |
871 | | - }, { size: 'lg' }); |
| 892 | + var installerFilePath = webDavSettings.ApplicationProtocolsPath + ITHit.WebDAV.Client.DocManager.GetInstallFileName(); |
| 893 | + window.open(installerFilePath); |
| 894 | + }, { size: 'lg' }); |
872 | 895 | } |
873 | 896 | } |
874 | 897 | }; |
|
0 commit comments