diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/EnterpriseStorageProxy.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/EnterpriseStorageProxy.cs
index 3cc19dab..87682b0f 100644
--- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/EnterpriseStorageProxy.cs
+++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/EnterpriseStorageProxy.cs
@@ -1029,10 +1029,10 @@ namespace WebsitePanel.EnterpriseServer {
///
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/SearchFiles", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
- public SystemFile[] SearchFiles(int itemId, string searchPath, string searchText, string userPrincipalName, bool recursive) {
+ public SystemFile[] SearchFiles(int itemId, string[] searchPaths, string searchText, string userPrincipalName, bool recursive) {
object[] results = this.Invoke("SearchFiles", new object[] {
itemId,
- searchPath,
+ searchPaths,
searchText,
userPrincipalName,
recursive});
@@ -1040,10 +1040,10 @@ namespace WebsitePanel.EnterpriseServer {
}
///
- public System.IAsyncResult BeginSearchFiles(int itemId, string searchPath, string searchText, string userPrincipalName, bool recursive, System.AsyncCallback callback, object asyncState) {
+ public System.IAsyncResult BeginSearchFiles(int itemId, string[] searchPaths, string searchText, string userPrincipalName, bool recursive, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("SearchFiles", new object[] {
itemId,
- searchPath,
+ searchPaths,
searchText,
userPrincipalName,
recursive}, callback, asyncState);
@@ -1056,18 +1056,18 @@ namespace WebsitePanel.EnterpriseServer {
}
///
- public void SearchFilesAsync(int itemId, string searchPath, string searchText, string userPrincipalName, bool recursive) {
- this.SearchFilesAsync(itemId, searchPath, searchText, userPrincipalName, recursive, null);
+ public void SearchFilesAsync(int itemId, string[] searchPaths, string searchText, string userPrincipalName, bool recursive) {
+ this.SearchFilesAsync(itemId, searchPaths, searchText, userPrincipalName, recursive, null);
}
///
- public void SearchFilesAsync(int itemId, string searchPath, string searchText, string userPrincipalName, bool recursive, object userState) {
+ public void SearchFilesAsync(int itemId, string[] searchPaths, string searchText, string userPrincipalName, bool recursive, object userState) {
if ((this.SearchFilesOperationCompleted == null)) {
this.SearchFilesOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSearchFilesOperationCompleted);
}
this.InvokeAsync("SearchFiles", new object[] {
itemId,
- searchPath,
+ searchPaths,
searchText,
userPrincipalName,
recursive}, this.SearchFilesOperationCompleted, userState);
diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/EnterpriseStorage/EnterpriseStorageController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/EnterpriseStorage/EnterpriseStorageController.cs
index f2f94ed2..d7fbc832 100644
--- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/EnterpriseStorage/EnterpriseStorageController.cs
+++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/EnterpriseStorage/EnterpriseStorageController.cs
@@ -172,7 +172,7 @@ namespace WebsitePanel.EnterpriseServer
return ObjectUtils.FillObjectFromDataReader(DataProvider.GetWebDavAccessTokenByAccessToken(accessToken));
}
- public static SystemFile[] SearchFiles(int itemId, string searchPath, string searchText, string userPrincipalName, bool recursive)
+ public static SystemFile[] SearchFiles(int itemId, string[] searchPaths, string searchText, string userPrincipalName, bool recursive)
{
try
{
@@ -192,23 +192,7 @@ namespace WebsitePanel.EnterpriseServer
EnterpriseStorage es = GetEnterpriseStorage(serviceId);
- var rootFolders = GetRootFolders(userPrincipalName).ToList();
-
- var searchResult = es.Search(Path.Combine(org.OrganizationId, searchPath ?? string.Empty), searchText, userPrincipalName, recursive);
-
- var result = new List();
-
- foreach (var systemFile in searchResult)
- {
- if (rootFolders.All(x => !systemFile.FullName.Contains(x.FullName)))
- {
- continue;
- }
-
- result.Add(systemFile);
- }
-
- return result.ToArray();
+ return es.Search(org.OrganizationId, searchPaths, searchText, userPrincipalName, recursive);
}
catch (Exception ex)
{
diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esEnterpriseStorage.asmx.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esEnterpriseStorage.asmx.cs
index 28d0ffaa..6668b40b 100644
--- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esEnterpriseStorage.asmx.cs
+++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esEnterpriseStorage.asmx.cs
@@ -171,9 +171,9 @@ namespace WebsitePanel.EnterpriseServer
}
[WebMethod]
- public SystemFile[] SearchFiles(int itemId, string searchPath, string searchText, string userPrincipalName, bool recursive)
+ public SystemFile[] SearchFiles(int itemId, string[] searchPaths, string searchText, string userPrincipalName, bool recursive)
{
- return EnterpriseStorageController.SearchFiles(itemId, searchPath, searchText, userPrincipalName, recursive);
+ return EnterpriseStorageController.SearchFiles(itemId, searchPaths, searchText, userPrincipalName, recursive);
}
#region Directory Browsing
diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/EnterpriseStorage/IEnterpriseStorage.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/EnterpriseStorage/IEnterpriseStorage.cs
index 980581be..892864a9 100644
--- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/EnterpriseStorage/IEnterpriseStorage.cs
+++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/EnterpriseStorage/IEnterpriseStorage.cs
@@ -46,6 +46,6 @@ namespace WebsitePanel.Providers.EnterpriseStorage
bool SetFolderWebDavRules(string organizationId, string folder, WebDavSetting setting, WebDavFolderRule[] rules);
WebDavFolderRule[] GetFolderWebDavRules(string organizationId, string folder, WebDavSetting setting);
bool CheckFileServicesInstallation();
- SystemFile[] Search(string searchPath, string searchText, string userPrincipalName, bool recursive);
+ SystemFile[] Search(string organizationId, string[] searchPaths, string searchText, string userPrincipalName, bool recursive);
}
}
diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.EnterpriseStorage.Windows2012/Windows2012.cs b/WebsitePanel/Sources/WebsitePanel.Providers.EnterpriseStorage.Windows2012/Windows2012.cs
index 1363acab..d339b384 100644
--- a/WebsitePanel/Sources/WebsitePanel.Providers.EnterpriseStorage.Windows2012/Windows2012.cs
+++ b/WebsitePanel/Sources/WebsitePanel.Providers.EnterpriseStorage.Windows2012/Windows2012.cs
@@ -285,23 +285,27 @@ namespace WebsitePanel.Providers.EnterpriseStorage
#endregion
- public SystemFile[] Search(string searchPath, string searchText, string userPrincipalName, bool recursive)
+ public SystemFile[] Search(string organizationId, string[] searchPaths, string searchText, string userPrincipalName, bool recursive)
{
var settings = GetWebDavSetting(null);
var result = new List();
+ var isRootSearch = false;
+
+ if (searchPaths.Any(string.IsNullOrEmpty))
+ {
+ isRootSearch = true;
+ searchPaths = searchPaths.Where(x => !string.IsNullOrEmpty(x)).ToArray();
+ }
using (new WindowsIdentity(userPrincipalName).Impersonate())
{
using (var conn = new OleDbConnection("Provider=Search.CollatorDSO;Extended Properties='Application=Windows';"))
{
- var searchDirectory = Path.Combine(settings.LocationDrive + ":\\", settings.HomeFolder);
- searchDirectory = Path.Combine(searchDirectory, searchPath);
-
- var searchDirectoryUrl = new Uri(searchDirectory).AbsoluteUri;
-
- var wsSql = string.Format(@"SELECT System.FileName, System.DateModified, System.Size, System.Kind, System.ItemPathDisplay, System.ItemType FROM SYSTEMINDEX WHERE System.FileName LIKE '%{0}%' AND {1} = '{2}'",
- searchText, recursive ? "SCOPE" : "DIRECTORY", searchDirectoryUrl);
+ var rootFolder = Path.Combine(settings.LocationDrive + ":\\", settings.HomeFolder);
+ rootFolder = Path.Combine(rootFolder, organizationId);
+ var wsSql = string.Format(@"SELECT System.FileName, System.DateModified, System.Size, System.Kind, System.ItemPathDisplay, System.ItemType FROM SYSTEMINDEX WHERE System.FileName LIKE '%{0}%' AND ({1})",
+ searchText, string.Join(" OR ", searchPaths.Select(x => string.Format("{0} = '{1}'", recursive ? "SCOPE" : "DIRECTORY", Path.Combine(rootFolder, x))).ToArray()));
conn.Open();
@@ -325,7 +329,19 @@ namespace WebsitePanel.Providers.EnterpriseStorage
}
file.FullName = (reader[4] as string ?? string.Empty);
- file.RelativeUrl = file.FullName.Replace(searchDirectory, string.Empty).Trim('\\');
+
+ if (isRootSearch)
+ {
+ file.RelativeUrl = file.FullName.Replace(rootFolder, "").Trim('\\');
+ }
+ else
+ {
+ foreach (var searchPath in searchPaths)
+ {
+ file.RelativeUrl = file.FullName.Replace(Path.Combine(rootFolder, searchPath), "").Trim('\\');
+ }
+ }
+
result.Add(file);
}
diff --git a/WebsitePanel/Sources/WebsitePanel.Server.Client/EnterpriseStorageProxy.cs b/WebsitePanel/Sources/WebsitePanel.Server.Client/EnterpriseStorageProxy.cs
index 1775fa5c..f43357e6 100644
--- a/WebsitePanel/Sources/WebsitePanel.Server.Client/EnterpriseStorageProxy.cs
+++ b/WebsitePanel/Sources/WebsitePanel.Server.Client/EnterpriseStorageProxy.cs
@@ -410,9 +410,10 @@ namespace WebsitePanel.Providers.EnterpriseStorage {
///
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/Search", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
- public SystemFile[] Search(string searchPath, string searchText, string userPrincipalName, bool recursive) {
+ public SystemFile[] Search(string organizationId, string[] searchPaths, string searchText, string userPrincipalName, bool recursive) {
object[] results = this.Invoke("Search", new object[] {
- searchPath,
+ organizationId,
+ searchPaths,
searchText,
userPrincipalName,
recursive});
@@ -420,9 +421,10 @@ namespace WebsitePanel.Providers.EnterpriseStorage {
}
///
- public System.IAsyncResult BeginSearch(string searchPath, string searchText, string userPrincipalName, bool recursive, System.AsyncCallback callback, object asyncState) {
+ public System.IAsyncResult BeginSearch(string organizationId, string[] searchPaths, string searchText, string userPrincipalName, bool recursive, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("Search", new object[] {
- searchPath,
+ organizationId,
+ searchPaths,
searchText,
userPrincipalName,
recursive}, callback, asyncState);
@@ -435,17 +437,18 @@ namespace WebsitePanel.Providers.EnterpriseStorage {
}
///
- public void SearchAsync(string searchPath, string searchText, string userPrincipalName, bool recursive) {
- this.SearchAsync(searchPath, searchText, userPrincipalName, recursive, null);
+ public void SearchAsync(string organizationId, string[] searchPaths, string searchText, string userPrincipalName, bool recursive) {
+ this.SearchAsync(organizationId, searchPaths, searchText, userPrincipalName, recursive, null);
}
///
- public void SearchAsync(string searchPath, string searchText, string userPrincipalName, bool recursive, object userState) {
+ public void SearchAsync(string organizationId, string[] searchPaths, string searchText, string userPrincipalName, bool recursive, object userState) {
if ((this.SearchOperationCompleted == null)) {
this.SearchOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSearchOperationCompleted);
}
this.InvokeAsync("Search", new object[] {
- searchPath,
+ organizationId,
+ searchPaths,
searchText,
userPrincipalName,
recursive}, this.SearchOperationCompleted, userState);
diff --git a/WebsitePanel/Sources/WebsitePanel.Server/EnterpriseStorage.asmx.cs b/WebsitePanel/Sources/WebsitePanel.Server/EnterpriseStorage.asmx.cs
index c5a9f699..ecd4878c 100644
--- a/WebsitePanel/Sources/WebsitePanel.Server/EnterpriseStorage.asmx.cs
+++ b/WebsitePanel/Sources/WebsitePanel.Server/EnterpriseStorage.asmx.cs
@@ -176,12 +176,12 @@ namespace WebsitePanel.Server
}
[WebMethod, SoapHeader("settings")]
- public SystemFile[] Search(string searchPath, string searchText, string userPrincipalName, bool recursive)
+ public SystemFile[] Search(string organizationId, string[] searchPaths, string searchText, string userPrincipalName, bool recursive)
{
try
{
Log.WriteStart("'{0}' Search", ProviderSettings.ProviderName);
- var searchResults = EnterpriseStorageProvider.Search(searchPath, searchText, userPrincipalName, recursive);
+ var searchResults = EnterpriseStorageProvider.Search(organizationId, searchPaths, searchText, userPrincipalName, recursive);
Log.WriteEnd("'{0}' Search", ProviderSettings.ProviderName);
return searchResults;
}
diff --git a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Managers/WebDavManager.cs b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Managers/WebDavManager.cs
index d837bbe4..98ea32ec 100644
--- a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Managers/WebDavManager.cs
+++ b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Managers/WebDavManager.cs
@@ -80,28 +80,23 @@ namespace WebsitePanel.WebDav.Core.Managers
{
pathPart = (pathPart ?? string.Empty).Replace("/","\\");
- var items = WspContext.Services.EnterpriseStorage.SearchFiles(itemId, pathPart, searchValue, uesrPrincipalName, recursive);
+ SystemFile[] items;
- var resources = Convert(items, new Uri(WebDavAppConfigManager.Instance.WebdavRoot).Append(WspContext.User.OrganizationId, pathPart));
if (string.IsNullOrWhiteSpace(pathPart))
{
- var rootItems = ConnectToWebDavServer().ToArray();
+ var rootItems = ConnectToWebDavServer().Select(x => x.Name).ToList();
+ rootItems.Insert(0, string.Empty);
- foreach (var resource in resources)
- {
- var rootItem = rootItems.FirstOrDefault(x => x.Name == resource.DisplayName);
-
- if (rootItem == null)
- {
- continue;
- }
-
- resource.ContentLength = rootItem.Size;
- resource.AllocatedSpace = rootItem.FRSMQuotaMB;
- resource.IsRootItem = true;
- }
+ items = WspContext.Services.EnterpriseStorage.SearchFiles(itemId, rootItems.ToArray(), searchValue, uesrPrincipalName, recursive);
}
+ else
+ {
+ items = WspContext.Services.EnterpriseStorage.SearchFiles(itemId, new []{pathPart}, searchValue, uesrPrincipalName, recursive);
+ }
+
+ var resources = Convert(items, new Uri(WebDavAppConfigManager.Instance.WebdavRoot).Append(WspContext.User.OrganizationId, pathPart));
+
return FilterResult(resources);
}
diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Scripts/appScripts/fileBrowsing.js b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Scripts/appScripts/fileBrowsing.js
index f17d9672..10478859 100644
--- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Scripts/appScripts/fileBrowsing.js
+++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Scripts/appScripts/fileBrowsing.js
@@ -81,7 +81,7 @@ WspFileBrowser.prototype = {
initDataTable: function (tableId, ajaxUrl) {
this.table = $(tableId).dataTable({
"ajax": ajaxUrl,
- "processing": true,
+ "processing": false,
"serverSide": true,
"columnDefs": [
{
@@ -113,6 +113,15 @@ WspFileBrowser.prototype = {
],
"createdRow": function(row, data, index) {
$(row).addClass('element-container');
+ },
+ "fnPreDrawCallback": function () {
+ // gather info to compose a message
+ wsp.dialogs.showProcessDialog();
+ return true;
+ },
+ "fnDrawCallback": function () {
+ // in case your overlay needs to be put away automatically you can put it here
+ wsp.dialogs.hideProcessDialog();
}
});