private static void AddVirtualContent(int nodeId, int generalId)
 {
     if (!ContentManage.Exists(generalId, nodeId))
     {
         foreach (CommonModelInfo info in ContentManage.GetInfoList(generalId))
         {
             if (ContentManage.Exists(info.GeneralId, nodeId))
             {
                 return;
             }
         }
         ContentManage.AddVirtualContent(generalId, nodeId);
     }
 }
Ejemplo n.º 2
0
        private void InitInfoType()
        {
            int           num     = DataConverter.CLng(HttpContext.Current.Request["ModelID"]);
            StringBuilder builder = new StringBuilder();

            switch (this.m_NodeInfoType)
            {
            case 1:
            {
                int generalId = DataConverter.CLng(HttpContext.Current.Request["GeneralId"]);
                if (generalId > 0)
                {
                    IList <CommonModelInfo> infoList = ContentManage.GetInfoList(generalId);
                    StringBuilder           sb       = new StringBuilder();
                    foreach (CommonModelInfo info in infoList)
                    {
                        builder.Append("<span id='NodeSpanId" + info.NodeId + "'>");
                        builder.Append(EasyOne.Contents.Nodes.ShowNodesAndRootNavigation(info.NodeId));
                        builder.Append(" <input type='button' onclick=\"javascript:Del('" + info.NodeId + "')\" value='删除此节点' /><br /></span>");
                        StringHelper.AppendString(sb, info.NodeId.ToString());
                    }
                    this.SelectedNodes.InnerHtml = builder.ToString();
                    this.HdnInfoIds.Value        = sb.ToString();
                }
                break;
            }

            case 2:
            {
                int id = DataConverter.CLng(HttpContext.Current.Request["ItemId"]);
                if (id > 0)
                {
                    string infoNodeId = CollectionItem.GetInfoById(id).InfoNodeId;
                    foreach (string str2 in infoNodeId.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries))
                    {
                        builder.Append("<span id='NodeSpanId" + str2 + "'>");
                        builder.Append(EasyOne.Contents.Nodes.ShowNodesAndRootNavigation(DataConverter.CLng(str2)));
                        builder.Append(" <input type='button' onclick=\"javascript:Del('" + str2 + "')\" value='删除此节点' /><br /></span>");
                    }
                    this.SelectedNodes.InnerHtml = builder.ToString();
                    this.HdnInfoIds.Value        = infoNodeId;
                }
                break;
            }
            }
            StringBuilder builder3 = new StringBuilder();

            builder3.Append("<script type=\"text/javascript\">\n");
            builder3.Append("<!--\n");
            builder3.Append("  function AddInfo(){\n");
            builder3.Append(string.Concat(new object[] { "      var strUrl = \"", this.path, "/Contents/NodesList.aspx?ModelId=", num, "&ClientID=", this.HdnInfoIds.ClientID, "\";\n" }));
            builder3.Append("           window.open(strUrl+'&Action=AddInfo','newWin','modal=yes,width=250,height=400,resizable=yes,scrollbars=yes'); \n");
            builder3.Append("  }\n");
            builder3.Append("  function UpdateTheInfoNodes(arr){\n");
            builder3.Append("       var arrNodes=arr.split('$$$');\n");
            builder3.Append("       var hdnNodeId= document.getElementById('" + this.HdnInfoIds.ClientID + "');\n");
            builder3.Append("       var SelectedNodeId = hdnNodeId.value.split(\",\");\n");
            builder3.Append("       var isExist = false;\n");
            builder3.Append("       for(i=0;i<SelectedNodeId.length;i++) {if(SelectedNodeId[i] == arrNodes[0]){isExist = true;}}\n");
            builder3.Append("       if(!isExist){ if(hdnNodeId.value != '') {hdnNodeId.value = hdnNodeId.value + ',';} \n");
            builder3.Append("       hdnNodeId.value = hdnNodeId.value + arrNodes[0];  \n");
            builder3.Append("       var newli = document.createElement(\"SPAN\");  \n");
            builder3.Append("       newli.setAttribute(\"id\",\"NodeSpanId\"+arrNodes[0]);\n");
            builder3.Append("       newli.innerHTML =arrNodes[1] + \" \";\n");
            builder3.Append("       var newlink = document.createElement(\"INPUT\");");
            builder3.Append("       newlink.onclick = function() { Del(arrNodes[0]);};\n");
            builder3.Append("       newlink.setAttribute(\"type\", \"button\");\n");
            builder3.Append("       newlink.setAttribute(\"class\", \"button\");\n");
            builder3.Append("       newlink.setAttribute(\"value\", \"删除此节点\");\n");
            builder3.Append("       newli.appendChild(newlink);\n");
            builder3.Append("       var newbr = document.createElement(\"BR\");  \n");
            builder3.Append("       newli.appendChild(newbr);\n");
            builder3.Append("       var links = document.getElementById(\"" + this.SelectedNodes.ClientID + "\");\n");
            builder3.Append("       links.appendChild(newli);}\n");
            builder3.Append("  }\n");
            builder3.Append("  function Del(nodeId){\n");
            builder3.Append("  var li = document.getElementById(\"NodeSpanId\" + nodeId);\n");
            builder3.Append("  li.parentNode.removeChild(li);\n");
            builder3.Append("  var hdnNodeId = document.getElementById('" + this.HdnInfoIds.ClientID + "');\n");
            builder3.Append("  var SelectedNodeId = hdnNodeId.value.split(\",\");\n");
            builder3.Append("  var newselected = '';\n");
            builder3.Append("  for(i=0;i<SelectedNodeId.length;i++)\n");
            builder3.Append("  {\n");
            builder3.Append("    if(SelectedNodeId[i] != nodeId){ if(newselected != ''){newselected = newselected + ',';} newselected = newselected+SelectedNodeId[i]; }\n");
            builder3.Append("  }\n");
            builder3.Append("  hdnNodeId.value = newselected;\n");
            builder3.Append("  }\n");
            builder3.Append(" //-->\n");
            builder3.Append("</script>\n");
            if (!this.Page.ClientScript.IsClientScriptBlockRegistered("AddInfo"))
            {
                this.Page.ClientScript.RegisterClientScriptBlock(base.GetType(), "AddInfo", builder3.ToString());
            }
        }
        protected void RptContent_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if ((e.Item.ItemType == ListItemType.AlternatingItem) || (e.Item.ItemType == ListItemType.Item))
            {
                Literal       literal2;
                StringBuilder builder;
                FieldInfo     dataItem = e.Item.DataItem as FieldInfo;
                this.InitTabByFieldType(e, dataItem);
                ExtendedLiteral literal = e.Item.FindControl("LitContentText") as ExtendedLiteral;
                Panel           panel   = e.Item.FindControl("PnlContent") as Panel;
                string          status  = this.contentDataTable.Rows[0][dataItem.FieldName].ToString();
                if (dataItem.FieldType == FieldType.KeywordType)
                {
                    status = StringHelper.ReplaceChar(this.contentDataTable.Rows[0][dataItem.FieldName].ToString(), '|', ' ');
                }
                switch (dataItem.FieldType)
                {
                case FieldType.SpecialType:
                    literal2 = new Literal();
                    builder  = new StringBuilder();
                    if (this.m_GeneralId > 0)
                    {
                        string[] strArray = Special.GetSpecialInfoIds(this.m_GeneralId).Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                        for (int i = 0; i < strArray.Length; i++)
                        {
                            SpecialInfo         specialInfoById         = Special.GetSpecialInfoById(DataConverter.CLng(strArray[i]));
                            SpecialCategoryInfo specialCategoryInfoById = Special.GetSpecialCategoryInfoById(specialInfoById.SpecialCategoryId);
                            builder.Append("\n<span>");
                            builder.Append(DataSecurity.HtmlEncode(specialCategoryInfoById.SpecialCategoryName) + ">>" + DataSecurity.HtmlEncode(specialInfoById.SpecialName));
                            builder.Append("<br /></span>");
                        }
                    }
                    break;

                case FieldType.StatusType:
                    literal.Text = this.GetStatusShow(status);
                    return;

                case FieldType.ContentType:
                    literal.BeginTag = "<iframe marginwidth='0' marginheight='0' frameborder='0' name='ContentPreview' width='650px' height='500px' src='ContentPreview.aspx?GeneralID=" + this.m_GeneralId.ToString() + "&fieldName=" + base.Server.UrlEncode(dataItem.FieldName) + "'></iframe>";
                    return;

                case FieldType.NodeType:
                    literal.BeginTag = EasyOne.Contents.Nodes.ShowNodeNavigation(DataConverter.CLng(status));
                    return;

                case FieldType.InfoType:
                {
                    Literal       child    = new Literal();
                    StringBuilder builder2 = new StringBuilder();
                    if (this.m_GeneralId > 0)
                    {
                        foreach (CommonModelInfo info4 in ContentManage.GetInfoList(this.m_GeneralId))
                        {
                            builder2.Append("<span>");
                            builder2.Append(EasyOne.Contents.Nodes.ShowNodesAndRootNavigation(info4.NodeId));
                            builder2.Append("<br /></span>");
                        }
                    }
                    if (builder2.Length <= 0)
                    {
                        builder2.Append("<span>无其它节点<br /></span>");
                    }
                    literal.BeginTag = "<div style=\"margin: 0; padding: 0; float: left;\">" + builder2.ToString() + "</div>";
                    panel.Controls.Add(child);
                    return;
                }

                case FieldType.MultipleHtmlTextType:
                    literal.BeginTag = status;
                    return;

                default:
                    literal.Text = status;
                    return;
                }
                if (builder.Length <= 0)
                {
                    builder.Append("<span id='SpecialSpanId0'>无专题<br /></span>");
                }
                literal.BeginTag = "<div style=\"margin: 0; padding: 0; float: left;\">" + builder.ToString() + "</div>";
                panel.Controls.Add(literal2);
            }
        }