コード例 #1
0
        public ActionResult ContentList(string org, ModelForWebDav model, string pathPart = "")
        {
            try
            {
                if (Request.Browser.IsMobileDevice == false && model.UserSettings.WebDavViewType == FolderViewTypes.Table)
                {
                    return(PartialView("_ShowContentTable", model));
                }

                IEnumerable <IHierarchyItem> children;

                if (string.IsNullOrEmpty(model.SearchValue))
                {
                    children = _webdavManager.OpenFolder(pathPart);
                }
                else
                {
                    children = _webdavManager.SearchFiles(WspContext.User.ItemId, pathPart, model.SearchValue, WspContext.User.Login, true);
                }

                model.Items = children.Take(WebDavAppConfigManager.Instance.ElementsRendering.DefaultCount);

                return(PartialView("_ShowContentBigIcons", model));
            }
            catch (UnauthorizedException e)
            {
                throw new HttpException(404, "Not Found");
            }
        }
コード例 #2
0
        public ActionResult UploadFiles(string org, string pathPart)
        {
            var model = new ModelForWebDav
            {
                UrlSuffix = pathPart
            };

            return(View(model));
        }
コード例 #3
0
        public ActionResult SearchFiles(string org, string pathPart, string searchValue)
        {
            if (string.IsNullOrEmpty(searchValue))
            {
                return(RedirectToRoute(FileSystemRouteNames.ShowContentPath));
            }

            var model = new ModelForWebDav
            {
                UrlSuffix    = pathPart,
                Permissions  = _webDavAuthorizationService.GetPermissions(WspContext.User, pathPart),
                UserSettings = _userSettingsManager.GetUserSettings(WspContext.User.AccountId),
                SearchValue  = searchValue
            };

            return(View("ShowContentSearchResultTable", model));
        }
コード例 #4
0
        public ActionResult ShowContent(string org, string pathPart = "", string searchValue = "")
        {
            if (org != ScpContext.User.OrganizationId)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.NoContent));
            }

            if (_webdavManager.IsFile(pathPart))
            {
                var resource = _webdavManager.GetResource(pathPart);

                var mimeType = _openerManager.GetMimeType(Path.GetExtension(pathPart));

                return(new FileStreamResult(resource.GetReadStream(), mimeType));
            }

            try
            {
                var model = new ModelForWebDav
                {
                    UrlSuffix    = pathPart,
                    Permissions  = _webDavAuthorizationService.GetPermissions(ScpContext.User, pathPart),
                    UserSettings = _userSettingsManager.GetUserSettings(ScpContext.User.AccountId),
                    SearchValue  = searchValue
                };

                if (Request.Browser.IsMobileDevice)
                {
                    model.UserSettings.WebDavViewType = FolderViewTypes.BigIcons;
                }

                return(View(model));
            }
#pragma warning disable 0168
            catch (UnauthorizedException e)
#pragma warning restore 0168
            {
                throw new HttpException(404, "Not Found");
            }
        }