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),
|
||||
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();
|
||||
|
@ -73,9 +73,15 @@ namespace WebsitePanel.WebDav.Core.Managers
|
|||
|
||||
OpenFolder(folder);
|
||||
|
||||
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)
|
||||
{
|
||||
path = path.TrimEnd('/');
|
||||
|
||||
if (string.IsNullOrEmpty(path) || !path.Contains('/'))
|
||||
{
|
||||
return string.Empty;
|
||||
|
@ -187,13 +195,15 @@ namespace WebsitePanel.WebDav.Core.Managers
|
|||
|
||||
string fileName = path.Split('/').Last();
|
||||
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;
|
||||
}
|
||||
|
||||
private string GetResourceName(string path)
|
||||
{
|
||||
path = path.TrimEnd('/');
|
||||
|
||||
if (string.IsNullOrEmpty(path) || !path.Contains('/'))
|
||||
{
|
||||
return string.Empty;
|
||||
|
|
|
@ -48,6 +48,12 @@ namespace WebsitePanel.WebDavPortal
|
|||
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(
|
||||
name: FileSystemRouteNames.FilePath,
|
||||
url: "{org}/{*pathPart}",
|
||||
|
|
|
@ -85,22 +85,15 @@ namespace WebsitePanel.WebDavPortal.Controllers
|
|||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult ShowAdditionalContent(string path)
|
||||
public ActionResult ShowAdditionalContent(string path = "", int resourseRenderCount = 0)
|
||||
{
|
||||
if (Session[WebDavAppConfigManager.Instance.SessionKeys.ResourseRenderCount] != null)
|
||||
{
|
||||
var renderedElementsCount = (int)Session[WebDavAppConfigManager.Instance.SessionKeys.ResourseRenderCount];
|
||||
path = path.Replace(WspContext.User.OrganizationId, "").Trim('/');
|
||||
|
||||
IEnumerable<IHierarchyItem> children = _webdavManager.OpenFolder(path);
|
||||
|
||||
var result = children.Skip(renderedElementsCount).Take(WebDavAppConfigManager.Instance.ElementsRendering.AddElementsCount);
|
||||
|
||||
Session[WebDavAppConfigManager.Instance.SessionKeys.ResourseRenderCount] = renderedElementsCount + WebDavAppConfigManager.Instance.ElementsRendering.AddElementsCount;
|
||||
var result = children.Skip(resourseRenderCount).Take(WebDavAppConfigManager.Instance.ElementsRendering.AddElementsCount);
|
||||
|
||||
return PartialView("_ResourseCollectionPartial", result);
|
||||
}
|
||||
|
||||
return new HttpStatusCodeResult(HttpStatusCode.NoContent);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -14,8 +14,8 @@ var oldResourcesDivHeight = $('#resourcesDiv').height();
|
|||
function GetResources() {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/FileSystem/ShowAdditionalContent',
|
||||
data: { path: window.location.pathname },
|
||||
url: '/show-additional-content',
|
||||
data: { path: window.location.pathname, resourseRenderCount: $(".element-container").length },
|
||||
dataType: "html",
|
||||
success: function (result) {
|
||||
var domElement = $(result);
|
||||
|
|
|
@ -8,5 +8,6 @@ namespace WebsitePanel.WebDavPortal.UI.Routes
|
|||
public class FileSystemRouteNames
|
||||
{
|
||||
public const string FilePath = "FilePathRoute";
|
||||
public const string ShowAdditionalContent = "ShowAdditionalContentRoute";
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue