webdav protal bugs fixe
This commit is contained in:
parent
2beacef40e
commit
67aab39780
5 changed files with 28 additions and 18 deletions
|
@ -48,7 +48,7 @@ namespace WebsitePanel.WebDav.Core.Managers
|
||||||
_cryptography.Decrypt(WspContext.User.EncryptedPassword),
|
_cryptography.Decrypt(WspContext.User.EncryptedPassword),
|
||||||
WebDavAppConfigManager.Instance.UserDomain);
|
WebDavAppConfigManager.Instance.UserDomain);
|
||||||
|
|
||||||
_currentFolder = _webDavSession.OpenFolder(string.Format("{0}{1}/{2}",WebDavAppConfigManager.Instance.WebdavRoot, WspContext.User.OrganizationId , pathPart));
|
_currentFolder = _webDavSession.OpenFolder(string.Format("{0}{1}/{2}", WebDavAppConfigManager.Instance.WebdavRoot, WspContext.User.OrganizationId, pathPart));
|
||||||
}
|
}
|
||||||
|
|
||||||
children = _currentFolder.GetChildren();
|
children = _currentFolder.GetChildren();
|
||||||
|
@ -73,9 +73,15 @@ namespace WebsitePanel.WebDav.Core.Managers
|
||||||
|
|
||||||
OpenFolder(folder);
|
OpenFolder(folder);
|
||||||
|
|
||||||
IResource resource = _currentFolder.GetResource(resourceName);
|
try
|
||||||
|
{
|
||||||
|
IResource resource = _currentFolder.GetResource(resourceName);
|
||||||
|
|
||||||
return resource.ItemType == ItemType.Resource;
|
return true;
|
||||||
|
}
|
||||||
|
catch (Exception e){}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -180,6 +186,8 @@ namespace WebsitePanel.WebDav.Core.Managers
|
||||||
|
|
||||||
private string GetFileFolder(string path)
|
private string GetFileFolder(string path)
|
||||||
{
|
{
|
||||||
|
path = path.TrimEnd('/');
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(path) || !path.Contains('/'))
|
if (string.IsNullOrEmpty(path) || !path.Contains('/'))
|
||||||
{
|
{
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
|
@ -187,13 +195,15 @@ namespace WebsitePanel.WebDav.Core.Managers
|
||||||
|
|
||||||
string fileName = path.Split('/').Last();
|
string fileName = path.Split('/').Last();
|
||||||
int index = path.LastIndexOf(fileName, StringComparison.InvariantCultureIgnoreCase);
|
int index = path.LastIndexOf(fileName, StringComparison.InvariantCultureIgnoreCase);
|
||||||
string folder = path.Remove(index - 1, fileName.Length + 1);
|
string folder = string.IsNullOrEmpty(fileName)? path : path.Remove(index - 1, fileName.Length + 1);
|
||||||
|
|
||||||
return folder;
|
return folder;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetResourceName(string path)
|
private string GetResourceName(string path)
|
||||||
{
|
{
|
||||||
|
path = path.TrimEnd('/');
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(path) || !path.Contains('/'))
|
if (string.IsNullOrEmpty(path) || !path.Contains('/'))
|
||||||
{
|
{
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
|
|
|
@ -48,6 +48,12 @@ namespace WebsitePanel.WebDavPortal
|
||||||
defaults: new { controller = "FileSystem", action = "ShowOfficeDocument", pathPart = UrlParameter.Optional }
|
defaults: new { controller = "FileSystem", action = "ShowOfficeDocument", pathPart = UrlParameter.Optional }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
routes.MapRoute(
|
||||||
|
name: FileSystemRouteNames.ShowAdditionalContent,
|
||||||
|
url: "show-additional-content/{*path}",
|
||||||
|
defaults: new { controller = "FileSystem", action = "ShowAdditionalContent", path = UrlParameter.Optional }
|
||||||
|
);
|
||||||
|
|
||||||
routes.MapRoute(
|
routes.MapRoute(
|
||||||
name: FileSystemRouteNames.FilePath,
|
name: FileSystemRouteNames.FilePath,
|
||||||
url: "{org}/{*pathPart}",
|
url: "{org}/{*pathPart}",
|
||||||
|
|
|
@ -85,22 +85,15 @@ namespace WebsitePanel.WebDavPortal.Controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public ActionResult ShowAdditionalContent(string path)
|
public ActionResult ShowAdditionalContent(string path = "", int resourseRenderCount = 0)
|
||||||
{
|
{
|
||||||
if (Session[WebDavAppConfigManager.Instance.SessionKeys.ResourseRenderCount] != null)
|
path = path.Replace(WspContext.User.OrganizationId, "").Trim('/');
|
||||||
{
|
|
||||||
var renderedElementsCount = (int)Session[WebDavAppConfigManager.Instance.SessionKeys.ResourseRenderCount];
|
|
||||||
|
|
||||||
IEnumerable<IHierarchyItem> children = _webdavManager.OpenFolder(path);
|
IEnumerable<IHierarchyItem> children = _webdavManager.OpenFolder(path);
|
||||||
|
|
||||||
var result = children.Skip(renderedElementsCount).Take(WebDavAppConfigManager.Instance.ElementsRendering.AddElementsCount);
|
var result = children.Skip(resourseRenderCount).Take(WebDavAppConfigManager.Instance.ElementsRendering.AddElementsCount);
|
||||||
|
|
||||||
Session[WebDavAppConfigManager.Instance.SessionKeys.ResourseRenderCount] = renderedElementsCount + WebDavAppConfigManager.Instance.ElementsRendering.AddElementsCount;
|
return PartialView("_ResourseCollectionPartial", result);
|
||||||
|
|
||||||
return PartialView("_ResourseCollectionPartial", result);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new HttpStatusCodeResult(HttpStatusCode.NoContent);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -14,8 +14,8 @@ var oldResourcesDivHeight = $('#resourcesDiv').height();
|
||||||
function GetResources() {
|
function GetResources() {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: '/FileSystem/ShowAdditionalContent',
|
url: '/show-additional-content',
|
||||||
data: { path: window.location.pathname },
|
data: { path: window.location.pathname, resourseRenderCount: $(".element-container").length },
|
||||||
dataType: "html",
|
dataType: "html",
|
||||||
success: function (result) {
|
success: function (result) {
|
||||||
var domElement = $(result);
|
var domElement = $(result);
|
||||||
|
|
|
@ -8,5 +8,6 @@ namespace WebsitePanel.WebDavPortal.UI.Routes
|
||||||
public class FileSystemRouteNames
|
public class FileSystemRouteNames
|
||||||
{
|
{
|
||||||
public const string FilePath = "FilePathRoute";
|
public const string FilePath = "FilePathRoute";
|
||||||
|
public const string ShowAdditionalContent = "ShowAdditionalContentRoute";
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue