Beispiel #1
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _relatedPath = Body.GetQueryString("relatedPath");

            PageUtils.CheckRequestParameter("PublishmentSystemID", "relatedPath");

            if (ProductPermissionsManager.Current.PublishmentSystemIdList.Contains(PublishmentSystemId))
            {
                _directoryPath = PathUtility.MapPath(PublishmentSystemInfo, _relatedPath);

                if (!DirectoryUtils.IsDirectoryExists(_directoryPath))
                {
                    PageUtils.RedirectToErrorPage("文件夹不存在!");
                    return;
                }

                if (!IsPostBack)
                {
                    //BreadCrumb(AppManager.Cms.LeftMenu.IdFunction, "站点文件管理", AppManager.Cms.Permission.WebSite.FileManagement);

                    ListType.Items.Add(new ListItem("显示缩略图", "Image"));
                    ListType.Items.Add(new ListItem("显示详细信息", "List"));
                    if (Body.IsQueryExists("ListType"))
                    {
                        ControlUtils.SelectListItems(ListType, Body.GetQueryString("ListType"));
                    }

                    ltlCurrentDirectory.Text = PageUtils.Combine(PublishmentSystemInfo.PublishmentSystemDir, _relatedPath);

                    FillFileSystems(false);

                    DeleteButton.Attributes.Add("onclick", "return confirm(\"此操作将删除所选文件夹及文件,确定吗?\");");

                    var showPopWinString = ModalUploadFile.GetOpenWindowStringToList(PublishmentSystemId, EUploadType.File, _relatedPath);
                    UploadLink.Attributes.Add("onclick", showPopWinString);
                }
            }
        }
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("siteId", "RootPath", "CurrentRootPath", "HiddenClientID");

            _rootPath        = AuthRequest.GetQueryString("RootPath").TrimEnd('/');
            _currentRootPath = AuthRequest.GetQueryString("CurrentRootPath");
            _hiddenClientId  = AuthRequest.GetQueryString("HiddenClientID");

            if (string.IsNullOrEmpty(_currentRootPath))
            {
                _currentRootPath = SiteInfo.Additional.ConfigSelectFileCurrentUrl.TrimEnd('/');
            }
            else
            {
                SiteInfo.Additional.ConfigSelectFileCurrentUrl = _currentRootPath;
                DataProvider.SiteDao.Update(SiteInfo);
            }
            _currentRootPath = _currentRootPath.TrimEnd('/');

            _directoryPath = PathUtility.MapPath(SiteInfo, _currentRootPath);
            DirectoryUtils.CreateDirectoryIfNotExists(_directoryPath);
            if (!DirectoryUtils.IsDirectoryExists(_directoryPath))
            {
                PageUtils.RedirectToErrorPage("文件夹不存在!");
                return;
            }

            if (Page.IsPostBack)
            {
                return;
            }

            BtnUpload.Attributes.Add("onclick", ModalUploadFile.GetOpenWindowStringToList(SiteId, EUploadType.File, _currentRootPath));

            DdlListType.Items.Add(new ListItem("显示缩略图", "Image"));
            DdlListType.Items.Add(new ListItem("显示详细信息", "List"));
            if (AuthRequest.IsQueryExists("ListType"))
            {
                ControlUtils.SelectSingleItem(DdlListType, AuthRequest.GetQueryString("ListType"));
            }

            var previousUrls = Session["PreviousUrls"] as ArrayList ?? new ArrayList();
            var currentUrl   = GetRedirectUrl(_currentRootPath);

            if (previousUrls.Count > 0)
            {
                var url = previousUrls[previousUrls.Count - 1] as string;
                if (!string.Equals(url, currentUrl))
                {
                    previousUrls.Add(currentUrl);
                    Session["PreviousUrls"] = previousUrls;
                }
            }
            else
            {
                previousUrls.Add(currentUrl);
                Session["PreviousUrls"] = previousUrls;
            }

            var navigationBuilder   = new StringBuilder();
            var directoryNames      = _currentRootPath.Split('/');
            var linkCurrentRootPath = _rootPath;

            foreach (var directoryName in directoryNames)
            {
                if (!string.IsNullOrEmpty(directoryName))
                {
                    if (directoryName.Equals("~"))
                    {
                        navigationBuilder.Append($"<a href='{GetRedirectUrl(_rootPath)}'>根目录</a>");
                    }
                    else if (directoryName.Equals("@"))
                    {
                        navigationBuilder.Append(
                            $"<a href='{GetRedirectUrl(_rootPath)}'>{SiteManager.GetSiteInfo(SiteId).SiteDir}</a>");
                    }
                    else
                    {
                        linkCurrentRootPath += "/" + directoryName;
                        navigationBuilder.Append($"<a href='{GetRedirectUrl(linkCurrentRootPath)}'>{directoryName}</a>");
                    }
                    navigationBuilder.Append("\\");
                }
            }
            LtlCurrentDirectory.Text = navigationBuilder.ToString();

            FillFileSystems(false);
        }