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

            PageUtils.CheckRequestParameter("PublishmentSystemID");

            if (Body.IsQueryExists("Delete"))
            {
                var modelId = Body.GetQueryString("ModelID");
                try
                {
                    BaiRongDataProvider.ContentModelDao.Delete(modelId, PublishmentSystemId);
                    Body.AddSiteLog(PublishmentSystemId, "删除内容模型", $"内容模型:{modelId}");
                    SuccessDeleteMessage();
                }
                catch (Exception ex)
                {
                    FailDeleteMessage(ex);
                }
            }

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

                dgContents.DataSource     = ContentModelManager.GetContentModelInfoList(PublishmentSystemInfo);
                dgContents.ItemDataBound += dgContents_ItemDataBound;
                dgContents.DataBind();

                AddContentModel.Attributes.Add("onclick", ModalContentModelAdd.GetOpenWindowStringToAdd(PublishmentSystemId));
            }
        }
Exemple #2
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("PublishmentSystemID", "NodeID", "ReturnUrl");

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

            _returnUrl = StringUtils.ValueFromUrl(Body.GetQueryString("ReturnUrl"));

            if (!IsPostBack)
            {
                ContentModelID.Items.Add(new ListItem("<<与父栏目相同>>", string.Empty));
                var contentModelInfoList = ContentModelManager.GetContentModelInfoList(PublishmentSystemInfo);
                foreach (var modelInfo in contentModelInfoList)
                {
                    ContentModelID.Items.Add(new ListItem(modelInfo.ModelName, modelInfo.ModelId));
                }

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

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

                divSelectChannel.Attributes.Add("onclick", ModalChannelSelect.GetOpenWindowString(PublishmentSystemId));
                ltlSelectChannelScript.Text =
                    $@"<script>selectChannel('{NodeManager.GetNodeNameNavigation(PublishmentSystemId, nodeId)}', '{nodeId}');</script>";
            }
        }
Exemple #3
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);
            }
        }
Exemple #4
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("PublishmentSystemID", "NodeID", "ReturnUrl");

            _nodeId    = Body.GetQueryInt("NodeID");
            _returnUrl = StringUtils.ValueFromUrl(Body.GetQueryString("ReturnUrl"));

            if (Body.GetQueryString("CanNotEdit") == null && Body.GetQueryString("UncheckedChannel") == null)
            {
                if (!HasChannelPermissions(_nodeId, AppManager.Cms.Permission.Channel.ChannelEdit))
                {
                    PageUtils.RedirectToErrorPage("您没有修改栏目的权限!");
                    return;
                }
            }
            if (Body.IsQueryExists("CanNotEdit"))
            {
                Submit.Visible = false;
            }

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

            if (nodeInfo != null)
            {
                channelControl = (ChannelAuxiliaryControl)FindControl("ControlForAuxiliary");
                if (!IsPostBack)
                {
                    BreadCrumb(AppManager.Cms.LeftMenu.IdContent, "编辑栏目", string.Empty);

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

                    channelControl.SetParameters(nodeInfo.Additional.Attributes, true, 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"));
                    ControlUtils.SelectListItems(ChannelTemplateID, nodeInfo.ChannelTemplateId.ToString());

                    ContentTemplateID.Items.Insert(0, new ListItem("<未设置>", "0"));
                    ControlUtils.SelectListItems(ContentTemplateID, nodeInfo.ContentTemplateId.ToString());

                    NodeName.Text      = nodeInfo.NodeName;
                    NodeIndexName.Text = nodeInfo.NodeIndexName;
                    LinkUrl.Text       = nodeInfo.LinkUrl;

                    foreach (ListItem item in NodeGroupNameCollection.Items)
                    {
                        if (CompareUtils.Contains(nodeInfo.NodeGroupNameCollection, item.Value))
                        {
                            item.Selected = true;
                        }
                        else
                        {
                            item.Selected = false;
                        }
                    }
                    FilePath.Text            = nodeInfo.FilePath;
                    ChannelFilePathRule.Text = nodeInfo.ChannelFilePathRule;
                    ContentFilePathRule.Text = nodeInfo.ContentFilePathRule;

                    //NodeProperty
                    ControlUtils.SelectListItems(LinkType, ELinkTypeUtils.GetValue(nodeInfo.LinkType));
                    ControlUtils.SelectListItems(IsChannelAddable, nodeInfo.Additional.IsChannelAddable.ToString());
                    ControlUtils.SelectListItems(IsContentAddable, nodeInfo.Additional.IsContentAddable.ToString());

                    NavigationPicPath.Text = nodeInfo.ImageUrl;

                    var formCollection = new NameValueCollection();
                    formCollection[NodeAttribute.Content] = nodeInfo.Content;
                    Content.SetParameters(PublishmentSystemInfo, NodeAttribute.Content, formCollection, true, IsPostBack);

                    Keywords.Text    = nodeInfo.Keywords;
                    Description.Text = nodeInfo.Description;

                    //this.Content.PublishmentSystemID = base.PublishmentSystemID;
                    //this.Content.Text = StringUtility.TextEditorContentDecode(nodeInfo.Content, ConfigUtils.Instance.ApplicationPath, base.PublishmentSystemInfo.PublishmentSystemUrl);

                    if (nodeInfo.NodeType == ENodeType.BackgroundPublishNode)
                    {
                        LinkURLRow.Visible           = false;
                        LinkTypeRow.Visible          = false;
                        ChannelTemplateIDRow.Visible = false;
                        FilePathRow.Visible          = false;
                    }
                }
                else
                {
                    channelControl.SetParameters(Request.Form, true, IsPostBack);
                }
            }
        }
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            var isChanged = false;

            ContentModelInfo modelInfo;

            if (Body.IsQueryExists("ModelID"))
            {
                var modelId = Body.GetQueryString("ModelID");
                modelInfo = BaiRongDataProvider.ContentModelDao.GetContentModelInfo(modelId, PublishmentSystemId);

                modelInfo.ModelName   = tbModelName.Text;
                modelInfo.TableName   = ddlTableName.SelectedValue;
                modelInfo.TableType   = EAuxiliaryTableTypeUtils.GetEnumType(rblTableType.SelectedValue);
                modelInfo.IconUrl     = tbIconUrl.Text;
                modelInfo.Description = tbDescription.Text;
            }
            else
            {
                modelInfo = new ContentModelInfo
                {
                    ModelId     = tbModelID.Text,
                    SiteId      = PublishmentSystemId,
                    ModelName   = tbModelName.Text,
                    IsSystem    = false,
                    TableName   = ddlTableName.SelectedValue,
                    TableType   = EAuxiliaryTableTypeUtils.GetEnumType(rblTableType.SelectedValue),
                    IconUrl     = tbIconUrl.Text,
                    Description = tbDescription.Text
                };
            }

            if (Body.IsQueryExists("ModelID"))
            {
                try
                {
                    BaiRongDataProvider.ContentModelDao.Update(modelInfo);
                    Body.AddSiteLog(PublishmentSystemId, "修改内容模型", $"内容模型:{modelInfo.ModelName}");
                    isChanged = true;
                }
                catch (Exception ex)
                {
                    FailMessage(ex, "内容模型修改失败!");
                }
            }
            else
            {
                var isFail        = false;
                var modelInfoList = ContentModelManager.GetContentModelInfoList(PublishmentSystemInfo);
                foreach (var contentModelInfo in modelInfoList)
                {
                    if (contentModelInfo.ModelId == tbModelID.Text)
                    {
                        FailMessage("内容模型添加失败,模型标识已存在!");
                        isFail = true;
                        break;
                    }
                    else if (contentModelInfo.ModelName == tbModelName.Text)
                    {
                        FailMessage("内容模型添加失败,模型名称已存在!");
                        isFail = true;
                        break;
                    }
                }
                if (!isFail)
                {
                    try
                    {
                        BaiRongDataProvider.ContentModelDao.Insert(modelInfo);
                        Body.AddSiteLog(PublishmentSystemId, "添加内容模型", $"内容模型:{modelInfo.ModelName}");
                        isChanged = true;
                    }
                    catch (Exception ex)
                    {
                        FailMessage(ex, "内容模型添加失败!");
                    }
                }
            }

            if (isChanged)
            {
                PageUtils.CloseModalPage(Page);
            }
        }
Exemple #6
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("PublishmentSystemID");

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

            _isGovPublic = Body.GetQueryBool("IsGovPublic");
            if (_isGovPublic)
            {
                nodeId = PublishmentSystemInfo.Additional.GovPublicNodeId;
                if (nodeId == 0)
                {
                    nodeId = PublishmentSystemId;
                }
            }
            _relatedIdentities   = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, nodeId);
            _nodeInfo            = NodeManager.GetNodeInfo(PublishmentSystemId, nodeId);
            _tableName           = NodeManager.GetTableName(PublishmentSystemInfo, _nodeInfo);
            _tableStyle          = NodeManager.GetTableStyle(PublishmentSystemInfo, _nodeInfo);
            _tableStyleInfoList  = TableStyleManager.GetTableStyleInfoList(_tableStyle, _tableName, _relatedIdentities);
            _attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(NodeManager.GetContentAttributesOfDisplay(PublishmentSystemId, nodeId));

            if (!IsPostBack)
            {
                BreadCrumb(AppManager.Cms.LeftMenu.IdContent, "内容审核", string.Empty);

                var checkedLevel = 5;
                var isChecked    = true;
                foreach (var owningNodeId in ProductPermissionsManager.Current.OwningNodeIdList)
                {
                    int checkedLevelByNodeId;
                    var isCheckedByNodeId = CheckManager.GetUserCheckLevel(Body.AdministratorName, PublishmentSystemInfo, owningNodeId, out checkedLevelByNodeId);
                    if (checkedLevel > checkedLevelByNodeId)
                    {
                        checkedLevel = checkedLevelByNodeId;
                    }
                    if (!isCheckedByNodeId)
                    {
                        isChecked = false;
                    }
                }

                LevelManager.LoadContentLevelToList(State, PublishmentSystemInfo, PublishmentSystemId, isChecked, checkedLevel);

                if (_isGovPublic)
                {
                    PhContentModel.Visible = false;
                }
                else
                {
                    PhContentModel.Visible = true;
                    var contentModelInfoList = ContentModelManager.GetContentModelInfoList(PublishmentSystemInfo);
                    foreach (var modelInfo in contentModelInfoList)
                    {
                        DdlContentModelId.Items.Add(new ListItem(modelInfo.ModelName, modelInfo.ModelId));
                    }
                    ControlUtils.SelectListItems(DdlContentModelId, _nodeInfo.ContentModelId);
                    //EContentModelTypeUtils.AddListItemsForContentCheck(this.ContentModelID);
                }

                if (!string.IsNullOrEmpty(Body.GetQueryString("State")))
                {
                    ControlUtils.SelectListItems(State, Body.GetQueryString("State"));
                }
                if (!string.IsNullOrEmpty(Body.GetQueryString("ModelID")))
                {
                    ControlUtils.SelectListItems(DdlContentModelId, Body.GetQueryString("ModelID"));
                }

                SpContents.ControlToPaginate = RptContents;
                SpContents.ItemsPerPage      = PublishmentSystemInfo.Additional.PageSize;

                var checkLevelArrayList = new ArrayList();

                if (!string.IsNullOrEmpty(Body.GetQueryString("State")))
                {
                    checkLevelArrayList.Add(Body.GetQueryString("State"));
                }
                else
                {
                    checkLevelArrayList = LevelManager.LevelInt.GetCheckLevelArrayList(PublishmentSystemInfo, isChecked, checkedLevel);
                }
                var tableName = NodeManager.GetTableName(PublishmentSystemInfo, DdlContentModelId.SelectedValue);
                if (_isGovPublic)
                {
                    tableName = PublishmentSystemInfo.AuxiliaryTableForGovPublic;
                }

                var owningNodeIdList = new List <int>();
                if (!permissions.IsSystemAdministrator)
                {
                    foreach (var owningNodeId in ProductPermissionsManager.Current.OwningNodeIdList)
                    {
                        if (AdminUtility.HasChannelPermissions(Body.AdministratorName, PublishmentSystemId, owningNodeId, AppManager.Cms.Permission.Channel.ContentCheck))
                        {
                            owningNodeIdList.Add(owningNodeId);
                        }
                    }
                }

                SpContents.SelectCommand = BaiRongDataProvider.ContentDao.GetSelectedCommendByCheck(tableName, PublishmentSystemId, permissions.IsSystemAdministrator, owningNodeIdList, checkLevelArrayList);

                SpContents.SortField       = ContentAttribute.LastEditDate;
                SpContents.SortMode        = SortMode.DESC;
                RptContents.ItemDataBound += rptContents_ItemDataBound;

                SpContents.DataBind();

                var showPopWinString = ModalContentCheck.GetOpenWindowStringForMultiChannels(PublishmentSystemId, PageUrl);
                BtnCheck.Attributes.Add("onclick", showPopWinString);

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

            if (!HasChannelPermissions(PublishmentSystemId, AppManager.Cms.Permission.Channel.ContentDelete))
            {
                BtnDelete.Visible = false;
            }
            else
            {
                BtnDelete.Attributes.Add("onclick", PageContentDelete.GetRedirectClickStringForMultiChannels(PublishmentSystemId, false, PageUrl));
            }
        }