Exemplo n.º 1
0
 public ChannelInfo(int id, string channelName, int siteId, string contentModelPluginId, string contentRelatedPluginIds, int parentId, string parentsPath, int parentsCount, int childrenCount, bool isLastNode, string indexName, string groupNameCollection, int taxis, DateTime addDate, string imageUrl, string content, int contentNum, string filePath, string channelFilePathRule, string contentFilePathRule, string linkUrl, ELinkType linkType, int channelTemplateId, int contentTemplateId, string keywords, string description, string extendValues)
 {
     Id                      = id;
     ChannelName             = channelName;
     SiteId                  = siteId;
     ContentModelPluginId    = contentModelPluginId;
     ContentRelatedPluginIds = contentRelatedPluginIds;
     ParentId                = parentId;
     ParentsPath             = parentsPath;
     ParentsCount            = parentsCount;
     ChildrenCount           = childrenCount;
     IsLastNode              = isLastNode;
     IndexName               = indexName;
     GroupNameCollection     = groupNameCollection;
     Taxis                   = taxis;
     AddDate                 = addDate;
     ImageUrl                = imageUrl;
     Content                 = content;
     ContentNum              = contentNum;
     FilePath                = filePath;
     ChannelFilePathRule     = channelFilePathRule;
     ContentFilePathRule     = contentFilePathRule;
     LinkUrl                 = linkUrl;
     LinkType                = ELinkTypeUtils.GetValue(linkType);
     ChannelTemplateId       = channelTemplateId;
     ContentTemplateId       = contentTemplateId;
     Keywords                = keywords;
     Description             = description;
     _extendValues           = extendValues;
 }
Exemplo n.º 2
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);
                }
            }
        }
Exemplo n.º 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(Body.GetQueryString("ReturnUrl"));

            channelControl = (ChannelAuxiliaryControl)FindControl("ControlForAuxiliary");
            if (!IsPostBack)
            {
                if (!HasChannelPermissions(_nodeId, AppManager.Cms.Permission.Channel.ChannelEdit))
                {
                    PageUtils.RedirectToErrorPage("您没有修改栏目的权限!");
                    return;
                }

                var nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, _nodeId);
                if (nodeInfo != null)
                {
                    if (nodeInfo.NodeType == ENodeType.BackgroundPublishNode)
                    {
                        LinkUrlRow.Visible           = false;
                        LinkTypeRow.Visible          = false;
                        ChannelTemplateIDRow.Visible = false;
                        FilePathRow.Visible          = false;
                    }

                    btnSubmit.Attributes.Add("onclick", "if (UE && UE.getEditor('Content', {{allowDivTransToP: false}})){ UE.getEditor('Content', {{allowDivTransToP: false}}).sync(); }");

                    if (!string.IsNullOrEmpty(PublishmentSystemInfo.Additional.ChannelEditAttributes))
                    {
                        var channelEditAttributes = TranslateUtils.StringCollectionToStringList(PublishmentSystemInfo.Additional.ChannelEditAttributes);
                        if (channelEditAttributes.Count > 0)
                        {
                            NodeNameRow.Visible = NodeIndexNameRow.Visible = LinkUrlRow.Visible = NodeGroupNameCollectionRow.Visible = LinkTypeRow.Visible = ChannelTemplateIDRow.Visible = ContentTemplateIDRow.Visible = ImageUrlRow.Visible = FilePathRow.Visible = ContentRow.Visible = KeywordsRow.Visible = DescriptionRow.Visible = false;
                            foreach (string attribute in channelEditAttributes)
                            {
                                if (attribute == NodeAttribute.ChannelName)
                                {
                                    NodeNameRow.Visible = true;
                                }
                                else if (attribute == NodeAttribute.ChannelIndex)
                                {
                                    NodeIndexNameRow.Visible = true;
                                }
                                else if (attribute == NodeAttribute.LinkUrl)
                                {
                                    LinkUrlRow.Visible = true;
                                }
                                else if (attribute == NodeAttribute.ChannelGroupNameCollection)
                                {
                                    NodeGroupNameCollectionRow.Visible = true;
                                }
                                else if (attribute == NodeAttribute.LinkType)
                                {
                                    LinkTypeRow.Visible = true;
                                }
                                else if (attribute == NodeAttribute.ChannelTemplateId)
                                {
                                    ChannelTemplateIDRow.Visible = true;
                                }
                                else if (attribute == NodeAttribute.ContentTemplateId)
                                {
                                    ContentTemplateIDRow.Visible = true;
                                }
                                else if (attribute == NodeAttribute.ImageUrl)
                                {
                                    ImageUrlRow.Visible = true;
                                }
                                else if (attribute == NodeAttribute.FilePath)
                                {
                                    FilePathRow.Visible = true;
                                }
                                else if (attribute == NodeAttribute.Content)
                                {
                                    ContentRow.Visible = true;
                                }
                                else if (attribute == NodeAttribute.Keywords)
                                {
                                    KeywordsRow.Visible = true;
                                }
                                else if (attribute == NodeAttribute.Description)
                                {
                                    DescriptionRow.Visible = true;
                                }
                            }
                        }
                    }

                    if (channelControl.Visible)
                    {
                        //List<string> displayAttributes = null;
                        //if (!string.IsNullOrEmpty(PublishmentSystemInfo.Additional.ChannelEditAttributes))
                        //{
                        //    displayAttributes = TranslateUtils.StringCollectionToStringList(PublishmentSystemInfo.Additional.ChannelEditAttributes);
                        //}
                        channelControl.SetParameters(nodeInfo.Additional.Attributes, true, IsPostBack);
                    }

                    if (LinkTypeRow.Visible)
                    {
                        ELinkTypeUtils.AddListItems(LinkType);
                    }

                    if (NodeGroupNameCollectionRow.Visible)
                    {
                        NodeGroupNameCollection.DataSource = DataProvider.NodeGroupDao.GetDataSource(PublishmentSystemId);
                    }
                    if (ChannelTemplateIDRow.Visible)
                    {
                        ChannelTemplateID.DataSource = DataProvider.TemplateDao.GetDataSourceByType(PublishmentSystemId, ETemplateType.ChannelTemplate);
                    }
                    if (ContentTemplateIDRow.Visible)
                    {
                        ContentTemplateID.DataSource = DataProvider.TemplateDao.GetDataSourceByType(PublishmentSystemId, ETemplateType.ContentTemplate);
                    }

                    DataBind();

                    if (ChannelTemplateIDRow.Visible)
                    {
                        ChannelTemplateID.Items.Insert(0, new ListItem("<未设置>", "0"));
                        ControlUtils.SelectListItems(ChannelTemplateID, nodeInfo.ChannelTemplateId.ToString());
                    }

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

                    if (NodeNameRow.Visible)
                    {
                        NodeName.Text = nodeInfo.NodeName;
                    }
                    if (NodeIndexNameRow.Visible)
                    {
                        NodeIndexName.Text = nodeInfo.NodeIndexName;
                    }
                    if (LinkUrlRow.Visible)
                    {
                        LinkUrl.Text = nodeInfo.LinkUrl;
                    }

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

                    if (LinkTypeRow.Visible)
                    {
                        ControlUtils.SelectListItems(LinkType, ELinkTypeUtils.GetValue(nodeInfo.LinkType));
                    }

                    if (ImageUrlRow.Visible)
                    {
                        tbImageUrl.Text             = nodeInfo.ImageUrl;
                        ltlImageUrlButtonGroup.Text = ControlUtility.GetImageUrlButtonGroupHtml(PublishmentSystemInfo, tbImageUrl.ClientID);
                    }
                    if (ContentRow.Visible)
                    {
                        var formCollection = new NameValueCollection();
                        formCollection[NodeAttribute.Content] = nodeInfo.Content;
                        Content.SetParameters(PublishmentSystemInfo, NodeAttribute.Content, formCollection, true, IsPostBack);

                        //this.Content.PublishmentSystemID = base.PublishmentSystemID;
                        //this.Content.Text = StringUtility.TextEditorContentDecode(nodeInfo.Content, ConfigUtils.Instance.ApplicationPath, base.PublishmentSystemInfo.PublishmentSystemUrl);
                    }
                    if (Keywords.Visible)
                    {
                        Keywords.Text = nodeInfo.Keywords;
                    }
                    if (Description.Visible)
                    {
                        Description.Text = nodeInfo.Description;
                    }
                }
            }
            else
            {
                if (channelControl.Visible)
                {
                    channelControl.SetParameters(Request.Form, true, IsPostBack);
                }
            }
        }
Exemplo n.º 4
0
        private AtomFeed ExportNodeInfo(NodeInfo nodeInfo)
        {
            var feed = AtomUtility.GetEmptyFeed();

            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.NodeId, nodeInfo.NodeId.ToString());
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.NodeName, nodeInfo.NodeName);
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.NodeType, ENodeTypeUtils.GetValue(nodeInfo.NodeType));
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.PublishmentSystemId, nodeInfo.PublishmentSystemId.ToString());
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.ContentModelId, nodeInfo.ContentModelId);
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.ParentId, nodeInfo.ParentId.ToString());
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.ParentsPath, nodeInfo.ParentsPath);
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.ParentsCount, nodeInfo.ParentsCount.ToString());
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.ChildrenCount, nodeInfo.ChildrenCount.ToString());
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.IsLastNode, nodeInfo.IsLastNode.ToString());
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.NodeIndexName, nodeInfo.NodeIndexName);
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.NodeGroupNameCollection, nodeInfo.NodeGroupNameCollection);
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.Taxis, nodeInfo.Taxis.ToString());
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.AddDate, nodeInfo.AddDate.ToLongDateString());
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.ImageUrl, nodeInfo.ImageUrl);
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.Content, AtomUtility.Encrypt(nodeInfo.Content));
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.ContentNum, nodeInfo.ContentNum.ToString());
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.FilePath, nodeInfo.FilePath);
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.ChannelFilePathRule, nodeInfo.ChannelFilePathRule);
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.ContentFilePathRule, nodeInfo.ContentFilePathRule);
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.LinkUrl, nodeInfo.LinkUrl);
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.LinkType, ELinkTypeUtils.GetValue(nodeInfo.LinkType));
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.ChannelTemplateId, nodeInfo.ChannelTemplateId.ToString());
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.ContentTemplateId, nodeInfo.ContentTemplateId.ToString());
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.Keywords, nodeInfo.Keywords);
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.Description, nodeInfo.Description);
            AtomUtility.AddDcElement(feed.AdditionalElements, NodeAttribute.ExtendValues, nodeInfo.Additional.ToString());

            if (nodeInfo.ChannelTemplateId != 0)
            {
                var channelTemplateName = TemplateManager.GetTemplateName(nodeInfo.PublishmentSystemId, nodeInfo.ChannelTemplateId);
                AtomUtility.AddDcElement(feed.AdditionalElements, ChannelTemplateName, channelTemplateName);
            }

            if (nodeInfo.ContentTemplateId != 0)
            {
                var contentTemplateName = TemplateManager.GetTemplateName(nodeInfo.PublishmentSystemId, nodeInfo.ContentTemplateId);
                AtomUtility.AddDcElement(feed.AdditionalElements, ContentTemplateName, contentTemplateName);
            }

            return(feed);
        }