Пример #1
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("PublishmentSystemID");

            if (!IsPostBack)
            {
                BreadCrumb(AppManager.Cms.LeftMenu.IdCreate, "生成内容页", AppManager.Cms.Permission.WebSite.Create);

                var listitem = new ListItem("所有选中的栏目", "All");
                ChooseScope.Items.Add(listitem);
                listitem = new ListItem("一个月内更新的内容", "Month");
                ChooseScope.Items.Add(listitem);
                listitem = new ListItem("一天内更新的内容", "Day");
                ChooseScope.Items.Add(listitem);
                listitem = new ListItem("2小时内更新的内容", "2Hour");
                ChooseScope.Items.Add(listitem);

                NodeManager.AddListItems(NodeIDList.Items, PublishmentSystemInfo, false, true, Body.AdministratorName);
                DeleteAllContentButton.Attributes.Add("onclick", "return confirm(\"此操作将删除所有已生成的内容页面,确定吗?\");");
            }
        }
Пример #2
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("PublishmentSystemID");

            if (Body.IsQueryExists("NodeID"))
            {
                nodeID          = int.Parse(Body.GetQueryString("NodeID"));
                startDateString = Body.GetQueryString("StartDateString");
                endDateString   = Body.GetQueryString("EndDateString");
            }
            else
            {
                nodeID          = PublishmentSystemId;
                startDateString = string.Empty;
                endDateString   = DateTime.Now.ToString(DateUtils.FormatStringDateOnly);
            }

            var tableName = NodeManager.GetTableName(PublishmentSystemInfo, nodeID);

            spContents.ControlToPaginate = rptContents;
            spContents.ItemsPerPage      = PublishmentSystemInfo.Additional.PageSize;
            var nodeIdList = DataProvider.NodeDao.GetNodeIdListByScopeType(nodeID, EScopeType.Self, string.Empty, string.Empty);

            spContents.SelectCommand   = BaiRongDataProvider.ContentDao.GetSelectCommend(tableName, nodeIdList, ETriState.True);
            spContents.SortField       = BaiRongDataProvider.ContentDao.GetSortFieldName();
            spContents.SortMode        = SortMode.DESC;
            rptContents.ItemDataBound += rptContents_ItemDataBound;

            if (!IsPostBack)
            {
                BreadCrumbWithItemTitle(AppManager.Cms.LeftMenu.IdFunction, AppManager.Cms.LeftMenu.Function.IdTracking, "内容流量统计", NodeManager.GetNodeNameNavigation(PublishmentSystemId, nodeID), AppManager.Cms.Permission.WebSite.Tracking);

                StartDate.Text = startDateString;
                EndDate.Text   = endDateString;

                NodeManager.AddListItems(NodeIDDropDownList.Items, PublishmentSystemInfo, true, true, Body.AdministratorName);
                ControlUtils.SelectListItems(NodeIDDropDownList, nodeID.ToString());

                var begin = DateUtils.SqlMinValue;
                if (!string.IsNullOrEmpty(startDateString))
                {
                    begin = TranslateUtils.ToDateTime(startDateString);
                }
                accessNumHashtable = DataProvider.TrackingDao.GetContentAccessNumHashtable(PublishmentSystemId, nodeID, begin, TranslateUtils.ToDateTime(endDateString));

                spContents.DataBind();
            }
        }
Пример #3
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            var nodeId = Body.GetQueryInt("NodeID", PublishmentSystemId);

            _nodeInfo    = NodeManager.GetNodeInfo(PublishmentSystemId, nodeId);
            _modelInfo   = ContentModelManager.GetContentModelInfo(PublishmentSystemInfo, _nodeInfo.ContentModelId);
            _tableStyle  = EAuxiliaryTableTypeUtils.GetTableStyle(_modelInfo.TableType);
            _redirectUrl = GetRedirectUrl(PublishmentSystemId, nodeId);

            _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, nodeId);

            if (!IsPostBack)
            {
                BreadCrumb(AppManager.Cms.LeftMenu.IdConfigration, AppManager.Cms.LeftMenu.Configuration.IdConfigurationContentModel, "内容字段管理", AppManager.Cms.Permission.WebSite.Configration);

                //删除样式
                if (Body.IsQueryExists("DeleteStyle"))
                {
                    DeleteStyle();
                }
                else if (Body.IsQueryExists("SetTaxis"))
                {
                    SetTaxis();
                }

                InfoMessage(
                    $"在此编辑内容模型字段,子栏目默认继承父栏目字段设置; 辅助表:{BaiRongDataProvider.TableCollectionDao.GetTableCnName(_modelInfo.TableName)}({_modelInfo.TableName}); 内容模型:{_modelInfo.ModelName}");
                NodeManager.AddListItems(NodeIDDropDownList.Items, PublishmentSystemInfo, false, true, true, Body.AdministratorName);
                ControlUtils.SelectListItems(NodeIDDropDownList, nodeId.ToString());

                var styleInfoList = TableStyleManager.GetTableStyleInfoList(_tableStyle, _modelInfo.TableName, _relatedIdentities);

                dgContents.DataSource     = styleInfoList;
                dgContents.ItemDataBound += dgContents_ItemDataBound;
                dgContents.DataBind();

                AddStyle.Attributes.Add("onclick", ModalTableStyleAdd.GetOpenWindowString(PublishmentSystemId, 0, _relatedIdentities, _modelInfo.TableName, string.Empty, _tableStyle, _redirectUrl));
                AddStyles.Attributes.Add("onclick", ModalTableStylesAdd.GetOpenWindowString(PublishmentSystemId, _relatedIdentities, _modelInfo.TableName, _tableStyle, _redirectUrl));
                Import.Attributes.Add("onclick", ModalTableStyleImport.GetOpenWindowString(_modelInfo.TableName, _tableStyle, PublishmentSystemId, nodeId));
                Export.Attributes.Add("onclick", ModalExportMessage.GetOpenWindowStringToSingleTableStyle(_tableStyle, _modelInfo.TableName, PublishmentSystemId, nodeId));
            }
        }
Пример #4
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _tableName = DataProvider.NodeDao.TableName;
            var nodeId = Body.GetQueryInt("NodeID", PublishmentSystemId);

            _nodeInfo    = NodeManager.GetNodeInfo(PublishmentSystemId, nodeId);
            _redirectUrl = GetRedirectUrl(PublishmentSystemId, nodeId);

            _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, nodeId);

            if (!IsPostBack)
            {
                BreadCrumb(AppManager.Cms.LeftMenu.IdConfigration, AppManager.Cms.LeftMenu.Configuration.IdConfigurationContentModel, "栏目字段管理", AppManager.Cms.Permission.WebSite.Configration);

                //删除样式
                if (Body.IsQueryExists("DeleteStyle"))
                {
                    DeleteStyle();
                }
                else if (Body.IsQueryExists("SetTaxis"))
                {
                    SetTaxis();
                }

                NodeManager.AddListItems(DdlNodeIdDropDownList.Items, PublishmentSystemInfo, false, true, true, Body.AdministratorName);
                ControlUtils.SelectListItems(DdlNodeIdDropDownList, nodeId.ToString());

                var styleInfoList = TableStyleManager.GetTableStyleInfoList(ETableStyle.Channel, _tableName, _relatedIdentities);

                DgContents.DataSource     = styleInfoList;
                DgContents.ItemDataBound += DgContents_ItemDataBound;
                DgContents.DataBind();

                BtnAddStyle.Attributes.Add("onclick", ModalTableStyleAdd.GetOpenWindowString(PublishmentSystemId, 0, _relatedIdentities, _tableName, string.Empty, ETableStyle.Channel, _redirectUrl));
                BtnAddStyles.Attributes.Add("onclick", ModalTableStylesAdd.GetOpenWindowString(PublishmentSystemId, _relatedIdentities, _tableName, ETableStyle.Channel, _redirectUrl));
                BtnImport.Attributes.Add("onclick", ModalTableStyleImport.GetOpenWindowString(_tableName, ETableStyle.Channel, PublishmentSystemId, nodeId));
                BtnExport.Attributes.Add("onclick", ModalExportMessage.GetOpenWindowStringToSingleTableStyle(ETableStyle.Channel, _tableName, PublishmentSystemId, nodeId));
            }
        }
Пример #5
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            var permissions = PermissionsManager.GetPermissions(Body.AdministratorName);

            _jsMethod = Body.GetQueryString("jsMethod");

            PageUtils.CheckRequestParameter("PublishmentSystemID");
            var nodeId = Body.GetQueryInt("NodeID");

            if (nodeId == 0)
            {
                nodeId = PublishmentSystemId;
            }
            _nodeInfo           = NodeManager.GetNodeInfo(PublishmentSystemId, nodeId);
            _tableStyle         = NodeManager.GetTableStyle(PublishmentSystemInfo, _nodeInfo);
            _tableName          = NodeManager.GetTableName(PublishmentSystemInfo, _nodeInfo);
            _relatedIdentities  = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, _nodeInfo.NodeId);
            _tableStyleInfoList = TableStyleManager.GetTableStyleInfoList(_tableStyle, _tableName, _relatedIdentities);

            spContents.ControlToPaginate = rptContents;
            if (string.IsNullOrEmpty(Body.GetQueryString("NodeID")))
            {
                spContents.SelectCommand = DataProvider.ContentDao.GetSelectCommend(_tableStyle, _tableName, PublishmentSystemId, _nodeInfo.NodeId, permissions.IsSystemAdministrator, ProductPermissionsManager.Current.OwningNodeIdList, SearchType.SelectedValue, Keyword.Text, DateFrom.Text, DateTo.Text, true, ETriState.True, !IsDuplicate.Checked, false);
            }
            else
            {
                spContents.SelectCommand = DataProvider.ContentDao.GetSelectCommend(_tableStyle, _tableName, PublishmentSystemId, _nodeInfo.NodeId, permissions.IsSystemAdministrator, ProductPermissionsManager.Current.OwningNodeIdList, Body.GetQueryString("SearchType"), Body.GetQueryString("Keyword"), Body.GetQueryString("DateFrom"), Body.GetQueryString("DateTo"), true, ETriState.True, !Body.GetQueryBool("IsDuplicate"), true);
            }
            spContents.ItemsPerPage    = PublishmentSystemInfo.Additional.PageSize;
            spContents.SortField       = ContentAttribute.Id;
            spContents.SortMode        = SortMode.DESC;
            spContents.OrderByString   = ETaxisTypeUtils.GetOrderByString(_tableStyle, ETaxisType.OrderByIdDesc);
            rptContents.ItemDataBound += rptContents_ItemDataBound;

            if (!IsPostBack)
            {
                NodeManager.AddListItems(NodeIDDropDownList.Items, PublishmentSystemInfo, false, true, true, EContentModelType.Content, Body.AdministratorName);

                if (_tableStyleInfoList != null)
                {
                    foreach (var styleInfo in _tableStyleInfoList)
                    {
                        if (styleInfo.IsVisible)
                        {
                            var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName);
                            SearchType.Items.Add(listitem);
                        }
                    }
                }

                //添加隐藏属性
                SearchType.Items.Add(new ListItem("内容ID", ContentAttribute.Id));
                SearchType.Items.Add(new ListItem("添加者", ContentAttribute.AddUserName));
                SearchType.Items.Add(new ListItem("最后修改者", ContentAttribute.LastEditUserName));

                if (Body.IsQueryExists("NodeID"))
                {
                    if (PublishmentSystemId != _nodeInfo.NodeId)
                    {
                        ControlUtils.SelectListItems(NodeIDDropDownList, _nodeInfo.NodeId.ToString());
                    }
                    IsDuplicate.Checked = Body.GetQueryBool("IsDuplicate");
                    ControlUtils.SelectListItems(SearchType, Body.GetQueryString("SearchType"));
                    Keyword.Text  = Body.GetQueryString("Keyword");
                    DateFrom.Text = Body.GetQueryString("DateFrom");
                    DateTo.Text   = Body.GetQueryString("DateTo");
                }

                spContents.DataBind();
            }
        }
Пример #6
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("PublishmentSystemId");
            _isMultiple = TranslateUtils.ToBool(Request.QueryString["isMultiple"]);
            _jsMethod   = Request.QueryString["jsMethod"];
            _itemIndex  = TranslateUtils.ToInt(Request.QueryString["itemIndex"]);

            _isKeywordAdd = TranslateUtils.ToBool(Request.QueryString["isKeywordAdd"]);
            _keywordId    = TranslateUtils.ToInt(Request.QueryString["keywordID"]);

            if (!string.IsNullOrEmpty(Request.QueryString["NodeID"]))
            {
                _nodeId = int.Parse(Request.QueryString["NodeID"]);
            }
            else
            {
                _nodeId = PublishmentSystemId;
            }
            _nodeInfo   = NodeManager.GetNodeInfo(PublishmentSystemId, _nodeId);
            _tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, _nodeInfo);
            var tableName = NodeManager.GetTableName(PublishmentSystemInfo, _nodeInfo);

            _attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(NodeManager.GetContentAttributesOfDisplay(PublishmentSystemId, _nodeId));
            _relatedIdentities   = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, _nodeId);
            _tableStyleInfoList  = TableStyleManager.GetTableStyleInfoList(_tableStyle, tableName, _relatedIdentities);

            SpContents.ControlToPaginate = RptContents;
            if (string.IsNullOrEmpty(Request.QueryString["NodeID"]))
            {
                var pm        = PermissionsManager.GetPermissions(Body.AdministratorName);
                var stateType = ETriStateUtils.GetEnumType(State.SelectedValue);
                SpContents.SelectCommand = DataProvider.ContentDao.GetSelectCommend(_tableStyle, tableName, PublishmentSystemId, _nodeId, pm.IsSystemAdministrator, ProductPermissionsManager.Current.OwningNodeIdList, SearchType.SelectedValue, Keyword.Text, DateFrom.Text, DateTo.Text, true, stateType, !IsDuplicate.Checked, false);
            }
            else
            {
                var pm        = PermissionsManager.GetPermissions(Body.AdministratorName);
                var stateType = ETriStateUtils.GetEnumType(Request.QueryString["State"]);
                SpContents.SelectCommand = DataProvider.ContentDao.GetSelectCommend(_tableStyle, tableName, PublishmentSystemId, _nodeId, pm.IsSystemAdministrator, ProductPermissionsManager.Current.OwningNodeIdList, Request.QueryString["SearchType"], Request.QueryString["Keyword"], Request.QueryString["DateFrom"], Request.QueryString["DateTo"], true, stateType, !TranslateUtils.ToBool(Request.QueryString["IsDuplicate"]), false);
            }
            SpContents.ItemsPerPage    = PublishmentSystemInfo.Additional.PageSize;
            SpContents.SortField       = ContentAttribute.Id;
            SpContents.SortMode        = SortMode.DESC;
            SpContents.OrderByString   = ETaxisTypeUtils.GetOrderByString(_tableStyle, ETaxisType.OrderByIdDesc);
            RptContents.ItemDataBound += rptContents_ItemDataBound;

            if (!IsPostBack)
            {
                NodeManager.AddListItems(NodeIdDropDownList.Items, PublishmentSystemInfo, true, true, Body.AdministratorName);

                if (_tableStyleInfoList != null)
                {
                    foreach (var styleInfo in _tableStyleInfoList)
                    {
                        if (styleInfo.IsVisible)
                        {
                            var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName);
                            SearchType.Items.Add(listitem);
                        }
                    }
                }

                ETriStateUtils.AddListItems(State, "全部", "已审核", "待审核");

                //添加隐藏属性
                SearchType.Items.Add(new ListItem("内容ID", ContentAttribute.Id));
                SearchType.Items.Add(new ListItem("添加者", ContentAttribute.AddUserName));
                SearchType.Items.Add(new ListItem("最后修改者", ContentAttribute.LastEditUserName));

                if (!string.IsNullOrEmpty(Request.QueryString["NodeID"]))
                {
                    if (PublishmentSystemId != _nodeId)
                    {
                        ControlUtils.SelectListItems(NodeIdDropDownList, _nodeId.ToString());
                    }
                    ControlUtils.SelectListItems(State, Request.QueryString["State"]);
                    IsDuplicate.Checked = TranslateUtils.ToBool(Request.QueryString["IsDuplicate"]);
                    ControlUtils.SelectListItems(SearchType, Request.QueryString["SearchType"]);
                    Keyword.Text  = Request.QueryString["Keyword"];
                    DateFrom.Text = Request.QueryString["DateFrom"];
                    DateTo.Text   = Request.QueryString["DateTo"];
                }

                SpContents.DataBind();
            }
        }
Пример #7
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            var permissions = PermissionsManager.GetPermissions(Body.AdministratorName);

            PageUtils.CheckRequestParameter("PublishmentSystemID");
            _nodeId = Body.GetQueryInt("NodeID");
            if (_nodeId == 0)
            {
                _nodeId = PublishmentSystemId;
            }
            var nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, this._nodeId);

            _tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, nodeInfo);
            var tableName = NodeManager.GetTableName(PublishmentSystemInfo, nodeInfo);

            _relatedIdentities  = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, this._nodeId);
            _tableStyleInfoList = TableStyleManager.GetTableStyleInfoList(_tableStyle, tableName, _relatedIdentities);

            spContents.ControlToPaginate = rptContents;
            if (string.IsNullOrEmpty(Body.GetQueryString("NodeID")))
            {
                if (TranslateUtils.ToInt(PageNum.SelectedValue) == 0)
                {
                    spContents.ItemsPerPage = PublishmentSystemInfo.Additional.PageSize;
                }
                else
                {
                    spContents.ItemsPerPage = TranslateUtils.ToInt(PageNum.SelectedValue);
                }
                spContents.SelectCommand = DataProvider.ContentDao.GetSelectCommend(_tableStyle, tableName, PublishmentSystemId, _nodeId, permissions.IsSystemAdministrator, ProductPermissionsManager.Current.OwningNodeIdList, SearchType.SelectedValue, Keyword.Text, DateFrom.Text, DateTo.Text, true, ETriState.All, false, true);
            }
            else
            {
                if (Body.GetQueryInt("PageNum") == 0)
                {
                    spContents.ItemsPerPage = PublishmentSystemInfo.Additional.PageSize;
                }
                else
                {
                    spContents.ItemsPerPage = Body.GetQueryInt("PageNum");
                }
                spContents.SelectCommand = DataProvider.ContentDao.GetSelectCommend(_tableStyle, tableName, PublishmentSystemId, _nodeId, permissions.IsSystemAdministrator, ProductPermissionsManager.Current.OwningNodeIdList, Body.GetQueryString("SearchType"), Body.GetQueryString("Keyword"), Body.GetQueryString("DateFrom"), Body.GetQueryString("DateTo"), true, ETriState.All, false, true);
            }
            spContents.OrderByString   = ETaxisTypeUtils.GetOrderByString(_tableStyle, ETaxisType.OrderByIdDesc);
            rptContents.ItemDataBound += rptContents_ItemDataBound;

            if (!IsPostBack)
            {
                BreadCrumb(AppManager.Cms.LeftMenu.IdContent, "内容回收站", AppManager.Cms.Permission.WebSite.ContentTrash);

                if (Body.IsQueryExists("IsDeleteAll"))
                {
                    BaiRongDataProvider.ContentDao.DeleteContentsByTrash(PublishmentSystemId, tableName);
                    Body.AddSiteLog(PublishmentSystemId, "清空回收站");
                    SuccessMessage("成功清空回收站!");
                    AddWaitAndRedirectScript(PageUrl);
                    return;
                }
                else if (Body.IsQueryExists("IsRestore"))
                {
                    var idsDictionary = ContentUtility.GetIDsDictionary(Request.QueryString);
                    foreach (var nodeID in idsDictionary.Keys)
                    {
                        var contentIDArrayList = idsDictionary[nodeID];
                        DataProvider.ContentDao.TrashContents(PublishmentSystemId, NodeManager.GetTableName(PublishmentSystemInfo, nodeID), contentIDArrayList);
                    }
                    Body.AddSiteLog(PublishmentSystemId, "从回收站还原内容");
                    SuccessMessage("成功还原内容!");
                    AddWaitAndRedirectScript(PageUrl);
                    return;
                }
                else if (Body.IsQueryExists("IsRestoreAll"))
                {
                    DataProvider.ContentDao.RestoreContentsByTrash(PublishmentSystemId, tableName);
                    Body.AddSiteLog(PublishmentSystemId, "从回收站还原所有内容");
                    SuccessMessage("成功还原所有内容!");
                    AddWaitAndRedirectScript(PageUrl);
                    return;
                }
                NodeManager.AddListItems(NodeIDDropDownList.Items, PublishmentSystemInfo, true, false, Body.AdministratorName);

                if (_tableStyleInfoList != null)
                {
                    foreach (var styleInfo in _tableStyleInfoList)
                    {
                        if (styleInfo.IsVisible)
                        {
                            var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName);
                            SearchType.Items.Add(listitem);
                        }
                    }
                }
                //添加隐藏属性
                SearchType.Items.Add(new ListItem("内容ID", ContentAttribute.Id));
                SearchType.Items.Add(new ListItem("添加者", ContentAttribute.AddUserName));
                SearchType.Items.Add(new ListItem("最后修改者", ContentAttribute.LastEditUserName));

                if (Body.IsQueryExists("NodeID"))
                {
                    if (PublishmentSystemId != _nodeId)
                    {
                        ControlUtils.SelectListItems(NodeIDDropDownList, _nodeId.ToString());
                    }
                    ControlUtils.SelectListItems(PageNum, Body.GetQueryString("PageNum"));
                    ControlUtils.SelectListItems(SearchType, Body.GetQueryString("SearchType"));
                    Keyword.Text  = Body.GetQueryString("Keyword");
                    DateFrom.Text = Body.GetQueryString("DateFrom");
                    DateTo.Text   = Body.GetQueryString("DateTo");
                }

                spContents.DataBind();
            }

            if (!HasChannelPermissions(this._nodeId, AppManager.Cms.Permission.Channel.ContentDelete))
            {
                Delete.Visible    = false;
                DeleteAll.Visible = false;
            }
            else
            {
                Delete.Attributes.Add("onclick", PageContentDelete.GetRedirectClickStringForMultiChannels(PublishmentSystemId, true, PageUrl));
                DeleteAll.Attributes.Add("onclick", PageUtils.GetRedirectStringWithConfirm(PageUtils.AddQueryString(PageUrl, "IsDeleteAll", "True"), "确实要清空回收站吗?"));
            }
            Restore.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValue(PageUtils.AddQueryString(PageUrl, "IsRestore", "True"), "IDsCollection", "IDsCollection", "请选择需要还原的内容!"));
            RestoreAll.Attributes.Add("onclick", PageUtils.GetRedirectStringWithConfirm(PageUtils.AddQueryString(PageUrl, "IsRestoreAll", "True"), "确实要还原所有内容吗?"));
        }
Пример #8
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("PublishmentSystemID", "NodeID", "ReturnUrl");
            _nodeId    = Body.GetQueryInt("NodeID");
            _returnUrl = StringUtils.ValueFromUrl(PageUtils.FilterSqlAndXss(Body.GetQueryString("ReturnUrl")));
            //if (!base.HasChannelPermissions(this.nodeID, AppManager.CMS.Permission.Channel.ChannelAdd))
            //{
            //    PageUtils.RedirectToErrorPage("您没有添加栏目的权限!");
            //    return;
            //}

            var parentNodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, _nodeId);

            if (parentNodeInfo.Additional.IsChannelAddable == false)
            {
                PageUtils.RedirectToErrorPage("此栏目不能添加子栏目!");
                return;
            }

            channelControl = (ChannelAuxiliaryControl)FindControl("ControlForAuxiliary");

            if (!IsPostBack)
            {
                BreadCrumb(AppManager.Cms.LeftMenu.IdContent, "添加栏目", string.Empty);

                NodeManager.AddListItems(ParentNodeID.Items, PublishmentSystemInfo, true, true, true, Body.AdministratorName);
                ControlUtils.SelectListItems(ParentNodeID, _nodeId.ToString());

                var contentModelInfoList = ContentModelManager.GetContentModelInfoList(PublishmentSystemInfo);
                foreach (var modelInfo in contentModelInfoList)
                {
                    ContentModelID.Items.Add(new ListItem(modelInfo.ModelName, modelInfo.ModelId));
                }
                ControlUtils.SelectListItems(ContentModelID, parentNodeInfo.ContentModelId);

                channelControl.SetParameters(null, false, IsPostBack);

                NavigationPicPath.Attributes.Add("onchange", GetShowImageScript("preview_NavigationPicPath", PublishmentSystemInfo.PublishmentSystemUrl));

                var showPopWinString = ModalFilePathRule.GetOpenWindowString(PublishmentSystemId, _nodeId, true, ChannelFilePathRule.ClientID);
                CreateChannelRule.Attributes.Add("onclick", showPopWinString);

                showPopWinString = ModalFilePathRule.GetOpenWindowString(PublishmentSystemId, _nodeId, false, ContentFilePathRule.ClientID);
                CreateContentRule.Attributes.Add("onclick", showPopWinString);

                showPopWinString = ModalSelectImage.GetOpenWindowString(PublishmentSystemInfo, NavigationPicPath.ClientID);
                SelectImage.Attributes.Add("onclick", showPopWinString);

                showPopWinString = ModalUploadImage.GetOpenWindowString(PublishmentSystemId, NavigationPicPath.ClientID);
                UploadImage.Attributes.Add("onclick", showPopWinString);

                IsChannelAddable.Items[0].Value = true.ToString();
                IsChannelAddable.Items[1].Value = false.ToString();
                IsContentAddable.Items[0].Value = true.ToString();
                IsContentAddable.Items[1].Value = false.ToString();

                ELinkTypeUtils.AddListItems(LinkType);

                NodeGroupNameCollection.DataSource = DataProvider.NodeGroupDao.GetDataSource(PublishmentSystemId);
                ChannelTemplateID.DataSource       = DataProvider.TemplateDao.GetDataSourceByType(PublishmentSystemId, ETemplateType.ChannelTemplate);
                ContentTemplateID.DataSource       = DataProvider.TemplateDao.GetDataSourceByType(PublishmentSystemId, ETemplateType.ContentTemplate);

                DataBind();

                ChannelTemplateID.Items.Insert(0, new ListItem("<未设置>", "0"));
                ChannelTemplateID.Items[0].Selected = true;

                ContentTemplateID.Items.Insert(0, new ListItem("<未设置>", "0"));
                ContentTemplateID.Items[0].Selected = true;
                Content.SetParameters(PublishmentSystemInfo, NodeAttribute.Content, null, false, IsPostBack);
            }
            else
            {
                channelControl.SetParameters(Request.Form, false, IsPostBack);
            }
        }
Пример #9
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("PublishmentSystemID");
            isMultiple = TranslateUtils.ToBool(Request.QueryString["isMultiple"]);
            jsMethod   = Request.QueryString["jsMethod"];
            itemIndex  = TranslateUtils.ToInt(Request.QueryString["itemIndex"]);

            isKeywordAdd = TranslateUtils.ToBool(Request.QueryString["isKeywordAdd"]);
            keywordID    = TranslateUtils.ToInt(Request.QueryString["keywordID"]);

            if (!string.IsNullOrEmpty(Request.QueryString["NodeID"]))
            {
                nodeID = int.Parse(Request.QueryString["NodeID"]);
            }
            else
            {
                nodeID = PublishmentSystemID;
            }
            nodeInfo   = NodeManager.GetNodeInfo(PublishmentSystemID, nodeID);
            tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, nodeInfo);
            var tableName = NodeManager.GetTableName(PublishmentSystemInfo, nodeInfo);

            attributesOfDisplay     = TranslateUtils.StringCollectionToStringCollection(NodeManager.GetContentAttributesOfDisplay(PublishmentSystemID, nodeID));
            relatedIdentities       = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemID, nodeID);
            tableStyleInfoArrayList = TableStyleManager.GetTableStyleInfoArrayList(tableStyle, tableName, relatedIdentities);

            spContents.ControlToPaginate = rptContents;
            spContents.ConnectionString  = BaiRongDataProvider.ConnectionString;
            if (string.IsNullOrEmpty(Request.QueryString["NodeID"]))
            {
                var stateType = ETriStateUtils.GetEnumType(State.SelectedValue);
                spContents.SelectCommand = DataProvider.ContentDAO.GetSelectCommend(tableStyle, tableName, PublishmentSystemID, nodeID, PermissionsManager.Current.IsSystemAdministrator, ProductPermissionsManager.Current.OwningNodeIDList, SearchType.SelectedValue, Keyword.Text, DateFrom.Text, DateTo.Text, true, stateType, !IsDuplicate.Checked, false);
            }
            else
            {
                var stateType = ETriStateUtils.GetEnumType(Request.QueryString["State"]);
                spContents.SelectCommand = DataProvider.ContentDAO.GetSelectCommend(tableStyle, tableName, PublishmentSystemID, nodeID, PermissionsManager.Current.IsSystemAdministrator, ProductPermissionsManager.Current.OwningNodeIDList, Request.QueryString["SearchType"], Request.QueryString["Keyword"], Request.QueryString["DateFrom"], Request.QueryString["DateTo"], true, stateType, !TranslateUtils.ToBool(Request.QueryString["IsDuplicate"]), false);
            }
            spContents.ItemsPerPage    = PublishmentSystemInfo.Additional.PageSize;
            spContents.SortField       = ContentAttribute.Id;
            spContents.SortMode        = SortMode.DESC;
            spContents.OrderByString   = ETaxisTypeUtils.GetOrderByString(tableStyle, ETaxisType.OrderByIDDesc);
            rptContents.ItemDataBound += new RepeaterItemEventHandler(rptContents_ItemDataBound);

            if (!IsPostBack)
            {
                BreadCrumb(AppManager.CMS.LeftMenu.ID_Content, "内容搜索", string.Empty);

                NodeManager.AddListItems(NodeIDDropDownList.Items, PublishmentSystemInfo, true, true);

                if (tableStyleInfoArrayList != null)
                {
                    foreach (TableStyleInfo styleInfo in tableStyleInfoArrayList)
                    {
                        if (styleInfo.IsVisible)
                        {
                            var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName);
                            SearchType.Items.Add(listitem);
                        }
                    }
                }

                ETriStateUtils.AddListItems(State, "全部", "已审核", "待审核");

                //添加隐藏属性
                SearchType.Items.Add(new ListItem("内容ID", ContentAttribute.Id));
                SearchType.Items.Add(new ListItem("添加者", ContentAttribute.AddUserName));
                SearchType.Items.Add(new ListItem("最后修改者", ContentAttribute.LastEditUserName));

                if (!string.IsNullOrEmpty(Request.QueryString["NodeID"]))
                {
                    if (PublishmentSystemID != nodeID)
                    {
                        ControlUtils.SelectListItems(NodeIDDropDownList, nodeID.ToString());
                    }
                    ControlUtils.SelectListItems(State, Request.QueryString["State"]);
                    IsDuplicate.Checked = TranslateUtils.ToBool(Request.QueryString["IsDuplicate"]);
                    ControlUtils.SelectListItems(SearchType, Request.QueryString["SearchType"]);
                    Keyword.Text  = Request.QueryString["Keyword"];
                    DateFrom.Text = Request.QueryString["DateFrom"];
                    DateTo.Text   = Request.QueryString["DateTo"];
                }

                spContents.DataBind();
            }
        }
Пример #10
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            var permissions = PermissionsManager.GetPermissions(Body.AdministratorName);

            PageUtils.CheckRequestParameter("PublishmentSystemID");
            if (Body.IsQueryExists("NodeID"))
            {
                _nodeId = Body.GetQueryInt("NodeID");
            }
            else
            {
                _nodeId = PublishmentSystemId;
            }

            _isWritingOnly = Body.GetQueryBool("isWritingOnly");

            var administratorName = string.Empty;

            _isSelfOnly = Body.GetQueryBool("isSelfOnly");
            if (!_isSelfOnly)
            {
                administratorName = AdminUtility.IsViewContentOnlySelf(Body.AdministratorName, PublishmentSystemId, _nodeId) ? Body.AdministratorName : string.Empty;
            }

            _nodeInfo   = NodeManager.GetNodeInfo(PublishmentSystemId, _nodeId);
            _tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, _nodeInfo);
            var tableName = NodeManager.GetTableName(PublishmentSystemInfo, _nodeInfo);

            _attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(NodeManager.GetContentAttributesOfDisplay(PublishmentSystemId, _nodeId));
            _relatedIdentities   = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, _nodeId);
            _tableStyleInfoList  = TableStyleManager.GetTableStyleInfoList(_tableStyle, tableName, _relatedIdentities);

            spContents.ControlToPaginate = rptContents;
            if (string.IsNullOrEmpty(Body.GetQueryString("NodeID")))
            {
                var stateType = ETriStateUtils.GetEnumType(State.SelectedValue);
                spContents.SelectCommand = DataProvider.ContentDao.GetSelectCommend(_tableStyle, tableName, PublishmentSystemId, _nodeId, permissions.IsSystemAdministrator, ProductPermissionsManager.Current.OwningNodeIdList, SearchType.SelectedValue, Keyword.Text, DateUtils.GetDateString(DateTime.Now.AddMonths(-1)), DateUtils.GetDateString(DateTime.Now), true, stateType, !IsDuplicate.Checked, false, _isWritingOnly, administratorName);
            }
            else
            {
                var stateType = ETriStateUtils.GetEnumType(Body.GetQueryString("State"));
                spContents.SelectCommand = DataProvider.ContentDao.GetSelectCommend(_tableStyle, tableName, PublishmentSystemId, _nodeId, permissions.IsSystemAdministrator, ProductPermissionsManager.Current.OwningNodeIdList, Body.GetQueryString("SearchType"), Body.GetQueryString("Keyword"), Body.GetQueryString("DateFrom"), Body.GetQueryString("DateTo"), true, stateType, !Body.GetQueryBool("IsDuplicate"), false, _isWritingOnly, administratorName);
            }
            spContents.ItemsPerPage    = PublishmentSystemInfo.Additional.PageSize;
            spContents.SortField       = ContentAttribute.Id;
            spContents.SortMode        = SortMode.DESC;
            spContents.OrderByString   = ETaxisTypeUtils.GetOrderByString(_tableStyle, ETaxisType.OrderByIdDesc);
            rptContents.ItemDataBound += rptContents_ItemDataBound;

            if (!IsPostBack)
            {
                var pageTitle = _isSelfOnly ? "我的内容" : "内容搜索";
                if (_isWritingOnly)
                {
                    pageTitle = "投稿内容";
                }
                BreadCrumb(AppManager.Cms.LeftMenu.IdContent, pageTitle, string.Empty);

                NodeManager.AddListItems(NodeIDDropDownList.Items, PublishmentSystemInfo, true, true, Body.AdministratorName);

                if (_tableStyleInfoList != null)
                {
                    foreach (var styleInfo in _tableStyleInfoList)
                    {
                        if (styleInfo.IsVisible && styleInfo.AttributeName != ContentAttribute.AddDate)
                        {
                            var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName);
                            SearchType.Items.Add(listitem);
                        }
                    }
                }

                ETriStateUtils.AddListItems(State, "全部", "已审核", "待审核");

                //添加隐藏属性
                SearchType.Items.Add(new ListItem("内容ID", ContentAttribute.Id));
                SearchType.Items.Add(new ListItem("添加者", ContentAttribute.AddUserName));
                SearchType.Items.Add(new ListItem("最后修改者", ContentAttribute.LastEditUserName));

                if (Body.IsQueryExists("NodeID"))
                {
                    if (PublishmentSystemId != _nodeId)
                    {
                        ControlUtils.SelectListItems(NodeIDDropDownList, _nodeId.ToString());
                    }
                    ControlUtils.SelectListItems(State, Body.GetQueryString("State"));
                    IsDuplicate.Checked = Body.GetQueryBool("IsDuplicate");
                    ControlUtils.SelectListItems(SearchType, Body.GetQueryString("SearchType"));
                    Keyword.Text  = Body.GetQueryString("Keyword");
                    DateFrom.Text = Body.GetQueryString("DateFrom");
                    DateTo.Text   = Body.GetQueryString("DateTo");
                }
                else
                {
                    DateFrom.Text = DateUtils.GetDateString(DateTime.Now.AddMonths(-1));
                    DateTo.Text   = DateUtils.GetDateString(DateTime.Now);
                }

                spContents.DataBind();

                var showPopWinString = ModalAddToGroup.GetOpenWindowStringToContentForMultiChannels(PublishmentSystemId);
                AddToGroup.Attributes.Add("onclick", showPopWinString);

                showPopWinString = ModalSelectColumns.GetOpenWindowStringToContent(PublishmentSystemId, _nodeId, true);
                SelectButton.Attributes.Add("onclick", showPopWinString);

                if (AdminUtility.HasChannelPermissions(Body.AdministratorName, PublishmentSystemId, PublishmentSystemId, AppManager.Cms.Permission.Channel.ContentCheck))
                {
                    showPopWinString = ModalContentCheck.GetOpenWindowStringForMultiChannels(PublishmentSystemId, PageUrl);
                    Check.Attributes.Add("onclick", showPopWinString);
                }
                else
                {
                    CheckPlaceHolder.Visible = false;
                }

                ltlColumnHeadRows.Text  = ContentUtility.GetColumnHeadRowsHtml(_tableStyleInfoList, _attributesOfDisplay, _tableStyle, PublishmentSystemInfo);
                ltlCommandHeadRows.Text = ContentUtility.GetCommandHeadRowsHtml(Body.AdministratorName, _tableStyle, PublishmentSystemInfo, _nodeInfo);
            }

            if (!HasChannelPermissions(_nodeId, AppManager.Cms.Permission.Channel.ContentAdd))
            {
                AddContent.Visible = false;
            }
            if (!HasChannelPermissions(_nodeId, AppManager.Cms.Permission.Channel.ContentTranslate))
            {
                Translate.Visible = false;
            }
            else
            {
                Translate.Attributes.Add("onclick", PageContentTranslate.GetRedirectClickStringForMultiChannels(PublishmentSystemId, PageUrl));
            }

            if (!HasChannelPermissions(_nodeId, AppManager.Cms.Permission.Channel.ContentDelete))
            {
                Delete.Visible = false;
            }
            else
            {
                Delete.Attributes.Add("onclick", PageContentDelete.GetRedirectClickStringForMultiChannels(PublishmentSystemId, false, PageUrl));
            }
        }
Пример #11
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            var permissions = PermissionsManager.GetPermissions(Body.AdministratorName);

            PageUtils.CheckRequestParameter("PublishmentSystemID");
            _nodeId = Body.GetQueryInt("NodeID");
            if (_nodeId == 0)
            {
                _nodeId = PublishmentSystemId;
            }
            var nodeInfo   = NodeManager.GetNodeInfo(PublishmentSystemId, _nodeId);
            var tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, nodeInfo);
            var tableName  = NodeManager.GetTableName(PublishmentSystemInfo, nodeInfo);

            ArchiveManager.CreateArchiveTableIfNotExists(PublishmentSystemInfo, tableName);
            var tableNameOfArchive = TableManager.GetTableNameOfArchive(tableName);

            _relatedIdentities  = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, _nodeId);
            _tableStyleInfoList = TableStyleManager.GetTableStyleInfoList(tableStyle, tableName, _relatedIdentities);

            spContents.ControlToPaginate = rptContents;
            if (string.IsNullOrEmpty(Body.GetQueryString("NodeID")))
            {
                if (TranslateUtils.ToInt(PageNum.SelectedValue) == 0)
                {
                    spContents.ItemsPerPage = PublishmentSystemInfo.Additional.PageSize;
                }
                else
                {
                    spContents.ItemsPerPage = TranslateUtils.ToInt(PageNum.SelectedValue);
                }
                spContents.SelectCommand = DataProvider.ContentDao.GetSelectCommend(tableStyle, tableNameOfArchive, PublishmentSystemId, _nodeId, permissions.IsSystemAdministrator, ProductPermissionsManager.Current.OwningNodeIdList, SearchType.SelectedValue, Keyword.Text, DateFrom.Text, DateTo.Text, true, ETriState.All);
            }
            else
            {
                if (Body.GetQueryInt("PageNum") == 0)
                {
                    spContents.ItemsPerPage = PublishmentSystemInfo.Additional.PageSize;
                }
                else
                {
                    spContents.ItemsPerPage = Body.GetQueryInt("PageNum");
                }
                spContents.SelectCommand = DataProvider.ContentDao.GetSelectCommend(tableStyle, tableNameOfArchive, PublishmentSystemId, _nodeId, permissions.IsSystemAdministrator, ProductPermissionsManager.Current.OwningNodeIdList, Body.GetQueryString("SearchType"), Body.GetQueryString("Keyword"), Body.GetQueryString("DateFrom"), Body.GetQueryString("DateTo"), true, ETriState.All);
            }
            spContents.SortField       = ContentAttribute.LastEditDate;
            spContents.SortMode        = SortMode.DESC;
            rptContents.ItemDataBound += rptContents_ItemDataBound;

            if (!IsPostBack)
            {
                BreadCrumb(AppManager.Cms.LeftMenu.IdFunction, "内容归档管理", AppManager.Cms.Permission.WebSite.Archive);

                if (Body.IsQueryExists("IsDelete"))
                {
                    var contentIdList = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("ContentIDCollection"));
                    BaiRongDataProvider.ContentDao.DeleteContentsArchive(PublishmentSystemId, tableNameOfArchive, contentIdList);
                    Body.AddSiteLog(PublishmentSystemId, "删除内容归档");
                    SuccessMessage("成功删除内容归档!");
                    AddWaitAndRedirectScript(PageUrl);
                    return;
                }
                else if (Body.IsQueryExists("IsDeleteAll"))
                {
                    var contentIdList = BaiRongDataProvider.ContentDao.GetContentIdListByPublishmentSystemId(tableNameOfArchive, PublishmentSystemId);
                    BaiRongDataProvider.ContentDao.DeleteContentsArchive(PublishmentSystemId, tableNameOfArchive, contentIdList);
                    SuccessMessage("成功清空内容归档!");
                    Body.AddSiteLog(PublishmentSystemId, "清空内容归档");
                    AddWaitAndRedirectScript(PageUrl);
                    return;
                }
                else if (Body.IsQueryExists("IsRestore"))
                {
                    var contentIdList = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("ContentIDCollection"));
                    foreach (var contentId in contentIdList)
                    {
                        var contentInfo = DataProvider.ContentDao.GetContentInfo(tableStyle, tableNameOfArchive, contentId);
                        DataProvider.ContentDao.Insert(tableName, PublishmentSystemInfo, contentInfo);
                    }
                    BaiRongDataProvider.ContentDao.DeleteContentsArchive(PublishmentSystemId, tableNameOfArchive, contentIdList);
                    SuccessMessage("成功取消归档内容!");
                    Body.AddSiteLog(PublishmentSystemId, "取消内容归档");
                    AddWaitAndRedirectScript(PageUrl);
                    return;
                }
                else if (Body.IsQueryExists("IsRestoreAll"))
                {
                    var contentIdList = BaiRongDataProvider.ContentDao.GetContentIdListByPublishmentSystemId(tableNameOfArchive, PublishmentSystemId);
                    foreach (var contentId in contentIdList)
                    {
                        var contentInfo = DataProvider.ContentDao.GetContentInfo(tableStyle, tableNameOfArchive, contentId);

                        DataProvider.ContentDao.Insert(tableName, PublishmentSystemInfo, contentInfo);
                    }
                    BaiRongDataProvider.ContentDao.DeleteContentsArchive(PublishmentSystemId, tableNameOfArchive, contentIdList);

                    SuccessMessage("成功取消归档所有内容!");
                    Body.AddSiteLog(PublishmentSystemId, "取消归档所有内容");
                    AddWaitAndRedirectScript(PageUrl);
                    return;
                }
                NodeManager.AddListItems(NodeIDDropDownList.Items, PublishmentSystemInfo, true, false, Body.AdministratorName);

                if (_tableStyleInfoList != null)
                {
                    foreach (var styleInfo in _tableStyleInfoList)
                    {
                        if (styleInfo.IsVisible)
                        {
                            var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName);
                            SearchType.Items.Add(listitem);
                        }
                    }
                }
                //添加隐藏属性
                SearchType.Items.Add(new ListItem("内容ID", ContentAttribute.Id));
                SearchType.Items.Add(new ListItem("添加者", ContentAttribute.AddUserName));
                SearchType.Items.Add(new ListItem("最后修改者", ContentAttribute.LastEditUserName));

                if (Body.IsQueryExists("NodeID"))
                {
                    if (PublishmentSystemId != _nodeId)
                    {
                        ControlUtils.SelectListItems(NodeIDDropDownList, _nodeId.ToString());
                    }
                    ControlUtils.SelectListItems(PageNum, Body.GetQueryString("PageNum"));
                    ControlUtils.SelectListItems(SearchType, Body.GetQueryString("SearchType"));
                    Keyword.Text  = Body.GetQueryString("Keyword");
                    DateFrom.Text = Body.GetQueryString("DateFrom");
                    DateTo.Text   = Body.GetQueryString("DateTo");
                }

                spContents.DataBind();
            }

            if (!HasChannelPermissions(_nodeId, AppManager.Cms.Permission.Channel.ContentDelete))
            {
                Delete.Visible    = false;
                DeleteAll.Visible = false;
            }
            else
            {
                Delete.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(PageUtils.AddQueryString(PageUrl, "IsDelete", "True"), "ContentIDCollection", "ContentIDCollection", "请选择需要删除的内容!", "确实要删除所选内容吗?"));
                DeleteAll.Attributes.Add("onclick", PageUtils.GetRedirectStringWithConfirm(PageUtils.AddQueryString(PageUrl, "IsDeleteAll", "True"), "确实要清空内容归档吗?"));
            }
            Restore.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValue(PageUtils.AddQueryString(PageUrl, "IsRestore", "True"), "ContentIDCollection", "ContentIDCollection", "请选择需要取消归档的内容!"));
            RestoreAll.Attributes.Add("onclick", PageUtils.GetRedirectStringWithConfirm(PageUtils.AddQueryString(PageUrl, "IsRestoreAll", "True"), "确实要取消归档所有内容吗?"));
        }
Пример #12
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _serviceType = EServiceTypeUtils.GetEnumType(Body.GetQueryString("ServiceType"));
            if (!IsPostBack)
            {
                EFrequencyTypeUtils.AddListItems(FrequencyType, false);
                for (var i = 1; i < 32; i++)
                {
                    StartDay.Items.Add(new ListItem(i + "日", i.ToString()));
                }
                for (var i = 1; i < 8; i++)
                {
                    var weekName = string.Empty;
                    if (i == 1)
                    {
                        weekName = "星期一";
                    }
                    else if (i == 2)
                    {
                        weekName = "星期二";
                    }
                    else if (i == 3)
                    {
                        weekName = "星期三";
                    }
                    else if (i == 4)
                    {
                        weekName = "星期四";
                    }
                    else if (i == 5)
                    {
                        weekName = "星期五";
                    }
                    else if (i == 6)
                    {
                        weekName = "星期六";
                    }
                    else if (i == 7)
                    {
                        weekName = "星期日";
                    }
                    StartWeekday.Items.Add(new ListItem(weekName, i.ToString()));
                }
                for (var i = 0; i < 24; i++)
                {
                    StartHour.Items.Add(new ListItem(i + "点", i.ToString()));
                }

                var listItem = new ListItem("周", "5040");
                PeriodIntervalType.Items.Add(listItem);
                listItem = new ListItem("天", "720");
                PeriodIntervalType.Items.Add(listItem);
                listItem = new ListItem("小时", "12");
                PeriodIntervalType.Items.Add(listItem);
                listItem          = new ListItem("分钟", "1");
                listItem.Selected = true;
                PeriodIntervalType.Items.Add(listItem);

                if (_serviceType == EServiceType.Create)
                {
                    PlaceHolder_Create.Visible = true;

                    if (PublishmentSystemId != 0)
                    {
                        NodeManager.AddListItems(CreateChannelIDCollection.Items, PublishmentSystemInfo, false, true, Body.AdministratorName);
                    }
                    else
                    {
                        var arraylist = PublishmentSystemManager.GetPublishmentSystemIdList();
                        foreach (int publishmentSystemID in arraylist)
                        {
                            var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemID);
                            var item = new ListItem(publishmentSystemInfo.PublishmentSystemName, publishmentSystemInfo.PublishmentSystemId.ToString());
                            CreateChannelIDCollection.Items.Add(item);
                        }
                    }

                    ECreateTypeUtils.AddListItems(CreateCreateTypes);
                }
                else if (_serviceType == EServiceType.Gather)
                {
                    PlaceHolder_Gather.Visible = true;

                    if (PublishmentSystemId != 0)
                    {
                        var gatherRuleNameArrayList = DataProvider.GatherRuleDao.GetGatherRuleNameArrayList(PublishmentSystemId);
                        var gatherTypeValue         = EGatherTypeUtils.GetValue(EGatherType.Web);
                        var gatherTypeText          = EGatherTypeUtils.GetText(EGatherType.Web);
                        foreach (string gatherName in gatherRuleNameArrayList)
                        {
                            GatherListBox.Items.Add(new ListItem(gatherName + "(" + gatherTypeText + ")", gatherTypeValue + "_" + gatherName));
                        }
                        gatherRuleNameArrayList = DataProvider.GatherDatabaseRuleDao.GetGatherRuleNameArrayList(PublishmentSystemId);
                        gatherTypeValue         = EGatherTypeUtils.GetValue(EGatherType.Database);
                        gatherTypeText          = EGatherTypeUtils.GetText(EGatherType.Database);
                        foreach (string gatherName in gatherRuleNameArrayList)
                        {
                            GatherListBox.Items.Add(new ListItem(gatherName + "(" + gatherTypeText + ")", gatherTypeValue + "_" + gatherName));
                        }
                        gatherRuleNameArrayList = DataProvider.GatherFileRuleDao.GetGatherRuleNameArrayList(PublishmentSystemId);
                        gatherTypeValue         = EGatherTypeUtils.GetValue(EGatherType.File);
                        gatherTypeText          = EGatherTypeUtils.GetText(EGatherType.File);
                        foreach (string gatherName in gatherRuleNameArrayList)
                        {
                            GatherListBox.Items.Add(new ListItem(gatherName + "(" + gatherTypeText + ")", gatherTypeValue + "_" + gatherName));
                        }

                        GatherHelp.Text = "选择需要定时执行的采集名称";
                    }
                    else
                    {
                        var arraylist = PublishmentSystemManager.GetPublishmentSystemIdList();
                        foreach (int publishmentSystemID in arraylist)
                        {
                            var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemID);
                            var item = new ListItem(publishmentSystemInfo.PublishmentSystemName, publishmentSystemInfo.PublishmentSystemId.ToString());
                            GatherListBox.Items.Add(item);
                        }

                        GatherHelp.Text = "选择需要定时采集的站点";
                    }
                }
                else if (_serviceType == EServiceType.Backup)
                {
                    PlaceHolder_Backup.Visible = true;

                    if (PublishmentSystemId != 0)
                    {
                        PlaceHolder_Backup_PublishmentSystem.Visible = false;
                    }
                    else
                    {
                        PlaceHolder_Backup_PublishmentSystem.Visible = true;
                        var arraylist = PublishmentSystemManager.GetPublishmentSystemIdList();
                        foreach (int publishmentSystemID in arraylist)
                        {
                            var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemID);
                            var item = new ListItem(publishmentSystemInfo.PublishmentSystemName, publishmentSystemInfo.PublishmentSystemId.ToString());
                            BackupPublishmentSystemIDCollection.Items.Add(item);
                        }
                    }

                    EBackupTypeUtils.AddListItems(BackupType);
                }

                if (Body.IsQueryExists("TaskID"))
                {
                    var taskId   = Body.GetQueryInt("TaskID");
                    var taskInfo = DataProvider.TaskDao.GetTaskInfo(taskId);
                    if (taskInfo != null)
                    {
                        TaskName.Text    = taskInfo.TaskName;
                        TaskName.Enabled = false;

                        ControlUtils.SelectListItems(FrequencyType, EFrequencyTypeUtils.GetValue(taskInfo.FrequencyType));
                        ControlUtils.SelectListItems(StartDay, taskInfo.StartDay.ToString());
                        ControlUtils.SelectListItems(StartWeekday, taskInfo.StartWeekday.ToString());
                        ControlUtils.SelectListItems(StartHour, taskInfo.StartHour.ToString());

                        if (taskInfo.PeriodIntervalMinute % 5040 == 0)
                        {
                            PeriodInterval.Text = Convert.ToInt32(taskInfo.PeriodIntervalMinute / 5040).ToString();
                            ControlUtils.SelectListItems(PeriodIntervalType, "5040");
                        }
                        else if (taskInfo.PeriodIntervalMinute % 720 == 0)
                        {
                            PeriodInterval.Text = Convert.ToInt32(taskInfo.PeriodIntervalMinute / 720).ToString();
                            ControlUtils.SelectListItems(PeriodIntervalType, "720");
                        }
                        else if (taskInfo.PeriodIntervalMinute % 12 == 0)
                        {
                            PeriodInterval.Text = Convert.ToInt32(taskInfo.PeriodIntervalMinute / 12).ToString();
                            ControlUtils.SelectListItems(PeriodIntervalType, "12");
                        }
                        else
                        {
                            PeriodInterval.Text = taskInfo.PeriodIntervalMinute.ToString();
                            ControlUtils.SelectListItems(PeriodIntervalType, "1");
                        }

                        Description.Text = taskInfo.Description;

                        if (_serviceType == EServiceType.Create)
                        {
                            var taskCreateInfo = new TaskCreateInfo(taskInfo.ServiceParameters);
                            if (taskCreateInfo.IsCreateAll)
                            {
                                foreach (ListItem item in CreateChannelIDCollection.Items)
                                {
                                    item.Selected = true;
                                }
                                CreateIsCreateAll.Checked = true;
                            }
                            else
                            {
                                var channelIdList = TranslateUtils.StringCollectionToStringList(taskCreateInfo.ChannelIDCollection);
                                ControlUtils.SelectListItems(CreateChannelIDCollection, channelIdList);
                                CreateIsCreateAll.Checked = false;
                            }
                            var createTypeArrayList = TranslateUtils.StringCollectionToStringList(taskCreateInfo.CreateTypes);
                            foreach (ListItem item in CreateCreateTypes.Items)
                            {
                                if (createTypeArrayList.Contains(item.Value))
                                {
                                    item.Selected = true;
                                }
                                else
                                {
                                    item.Selected = false;
                                }
                            }
                        }
                        else if (_serviceType == EServiceType.Gather)
                        {
                            var taskGatherInfo = new TaskGatherInfo(taskInfo.ServiceParameters);
                            if (PublishmentSystemId != 0)
                            {
                                var webGatherNames      = TranslateUtils.StringCollectionToStringList(taskGatherInfo.WebGatherNames);
                                var databaseGatherNames = TranslateUtils.StringCollectionToStringList(taskGatherInfo.DatabaseGatherNames);
                                var fileGatherNames     = TranslateUtils.StringCollectionToStringList(taskGatherInfo.FileGatherNames);
                                foreach (ListItem item in GatherListBox.Items)
                                {
                                    var gatherType = EGatherTypeUtils.GetEnumType(item.Value.Split('_')[0]);
                                    var gatherName = item.Value.Substring(item.Value.Split('_')[0].Length + 1);
                                    if (gatherType == EGatherType.Web && webGatherNames.Contains(gatherName))
                                    {
                                        item.Selected = true;
                                    }
                                    else if (gatherType == EGatherType.Database && databaseGatherNames.Contains(gatherName))
                                    {
                                        item.Selected = true;
                                    }
                                    else if (gatherType == EGatherType.File && fileGatherNames.Contains(gatherName))
                                    {
                                        item.Selected = true;
                                    }
                                }
                            }
                            else
                            {
                                var publishmentSystemIdList = TranslateUtils.StringCollectionToStringList(taskGatherInfo.PublishmentSystemIDCollection);
                                ControlUtils.SelectListItems(GatherListBox, publishmentSystemIdList);
                            }
                        }
                        else if (_serviceType == EServiceType.Backup)
                        {
                            var taskBackupInfo = new TaskBackupInfo(taskInfo.ServiceParameters);

                            if (taskInfo.PublishmentSystemID == 0)
                            {
                                if (taskBackupInfo.IsBackupAll)
                                {
                                    foreach (ListItem item in BackupPublishmentSystemIDCollection.Items)
                                    {
                                        item.Selected = true;
                                    }
                                    BackupIsBackupAll.Checked = true;
                                }
                                else
                                {
                                    var publishmentSystemIdList = TranslateUtils.StringCollectionToStringList(taskBackupInfo.PublishmentSystemIDCollection);
                                    ControlUtils.SelectListItems(BackupPublishmentSystemIDCollection, publishmentSystemIdList);
                                    BackupIsBackupAll.Checked = false;
                                }
                            }
                            else
                            {
                                ControlUtils.SelectListItems(BackupPublishmentSystemIDCollection, taskInfo.PublishmentSystemID.ToString());
                            }

                            ControlUtils.SelectListItems(BackupType, EBackupTypeUtils.GetValue(taskBackupInfo.BackupType));
                        }
                    }
                }

                FrequencyType_SelectedIndexChanged(null, EventArgs.Empty);
            }
        }