private static string GetNodeIs(string nodeIds, string itemIds) { CollectionItemInfo infoById = CollectionItem.GetInfoById(DataConverter.CLng(itemIds)); if (!infoById.IsNull) { nodeIds = nodeIds + infoById.NodeId.ToString() + "," + infoById.InfoNodeId; } return(nodeIds); }
protected void Page_Load(object sender, EventArgs e) { int id = BasePage.RequestInt32("ItemId"); if (id <= 0) { AdminPage.WriteErrMsg("<li>ItemID不存在!"); } CollectionItemInfo infoById = CollectionItem.GetInfoById(id); if (infoById.IsNull) { AdminPage.WriteErrMsg("<li>当前采集项目不存在!"); } this.LblItemName.Text = infoById.ItemName; this.m_itemId = infoById.ItemId; this.m_ModelId = infoById.ModelId; this.m_NodeId = infoById.NodeId; string str = BasePage.RequestString("Action", "Add"); if (!base.IsPostBack) { this.RptModelList.DataSource = Field.GetFieldList(infoById.ModelId, false); this.RptModelList.DataBind(); if (str == "Modify") { this.BtnCancel1.Visible = true; } this.SmpNavigator.CurrentNode = string.Concat(new object[] { "<a title=\"采集项目设置\" href=\"ConfigStep1.aspx?Action=Modify&ItemId=", this.m_itemId, "&ModelId=", this.m_ModelId.ToString(), "&NodeId=", this.m_NodeId.ToString(), "\">采集项目设置</a> >> <a title=\"列表页采集设置\" href=\"ConfigStep2.aspx?Action=Modify&ItemID=", id.ToString(), "\">列表页采集设置</a> >> <span style='color:red;'>内容页采集设置</span>" }); } this.HdnAction.Value = str; CollectionCommon common = new CollectionCommon(); Uri url = new Uri(infoById.Url); string httpPage = common.GetHttpPage(url, infoById.CodeType); CollectionListRuleInfo info2 = CollectionListRules.GetInfoById(infoById.ItemId); if (info2.IsNull) { AdminPage.WriteErrMsg("<li>隶属于" + infoById.ItemName + "采集项目的列表规则不存在!"); } string code = common.GetInterceptionString(httpPage, info2.ListBeginCode, info2.ListEndCode); ArrayList list = common.GetArray(code, info2.LinkBeginCode, info2.LinkEndCode); if (list.Count < 1) { AdminPage.WriteErrMsg("<li>隶属于" + infoById.ItemName + "采集项目的链接规则设置错误无法捕捉到链接组!"); } Uri uri2 = new Uri(common.ConvertToAbsluteUrl(list[0].ToString(), infoById.Url)); this.Session["ShowCode"] = common.GetHttpPage(uri2, infoById.CodeType); }
protected void Page_Load(object sender, EventArgs e) { string str = BasePage.RequestString("Action", "Add"); if (!base.IsPostBack) { IList <ModelInfo> cacheModelList = ModelManager.GetCacheModelList(); this.DropModelId.DataSource = cacheModelList; this.DropModelId.DataBind(); this.DropModelId.SelectedValue = BasePage.RequestString("ModelId"); this.DropModelId.Attributes.Add("Onchange", "javascript:window.location='ConfigStep1.aspx?ItemId=" + BasePage.RequestInt32("ItemId").ToString() + "&ModelId='+this.options[this.selectedIndex].value +'&NodeID=" + BasePage.RequestInt32("NodeID").ToString() + "';"); this.NodeType1.NodeInfoType = 2; this.SpecialId.SpecialInfoType = 2; if (str == "Modify") { int id = BasePage.RequestInt32("ItemId"); if (id <= 0) { AdminPage.WriteErrMsg("<li>ItemID不存在!"); } CollectionItemInfo infoById = CollectionItem.GetInfoById(id); if (infoById.IsNull) { AdminPage.WriteErrMsg("<li>采集项目规则不存在!"); } if (!infoById.IsNull) { this.TxtItemName.Text = infoById.ItemName; this.TxtWebSite.Text = infoById.UrlName; this.TxtUrl.Text = infoById.Url; this.RadlCodeType.SelectedValue = infoById.CodeType; this.TxtMaxNum.Text = infoById.MaxNum.ToString(); this.RadlCodeType.SelectedValue = infoById.OrderType.ToString(); this.TxtIntro.Text = infoById.Intro; this.DropModelId.SelectedValue = infoById.ModelId.ToString(); this.NodeType1.FieldValue = infoById.NodeId.ToString(); this.SpecialId.FieldValue = infoById.SpecialId.ToString(); this.RadlAutoCreateHtml.SelectedValue = infoById.AutoCreateHtml.ToString(); this.RadlOrder.SelectedValue = infoById.OrderType.ToString(); this.HdnAction.Value = str; this.HdnItemName.Value = infoById.ItemName; this.HiddenModel.Value = infoById.ModelId.ToString(); this.DropModelId.Enabled = false; } this.SmpNavigator.CurrentNode = "<span style='color:red;'>采集项目设置</span> >> <a title=\"列表页采集设置\" href=\"ConfigStep2.aspx?Action=Modify&ItemID=" + id.ToString() + "\">列表页采集设置</a> >> <a title=\"内容页采集设置\" href=\"ConfigStep3.aspx?Action=Modify&ItemID=" + id.ToString() + "\">内容页采集设置</a>"; } } }
private void InitSpecial() { StringBuilder builder = new StringBuilder(); string specialInfoIds = ""; switch (this.m_SpecialInfoType) { case 1: { int generalId = DataConverter.CLng(HttpContext.Current.Request["GeneralId"]); if (generalId > 0) { specialInfoIds = Special.GetSpecialInfoIds(generalId); } break; } case 2: { int id = DataConverter.CLng(HttpContext.Current.Request["ItemId"]); if (id > 0) { specialInfoIds = CollectionItem.GetInfoById(id).SpecialId; } break; } } if (!string.IsNullOrEmpty(specialInfoIds)) { this.HdnSpecial.Value = specialInfoIds; string[] strArray = specialInfoIds.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 id='SpecialSpanId" + specialInfoById.SpecialId + "'>"); builder.Append(specialCategoryInfoById.SpecialCategoryName + ">>" + specialInfoById.SpecialName); builder.Append(" <input type='button' class='button' onclick=\"javascript:DelSpecial('" + specialInfoById.SpecialId + "')\" value='删除此专题' /><br /></span>"); } } if (builder.Length <= 0) { builder.Append("<span id='SpecialSpanId0'>无专题<br /></span>"); } this.UlSpecial.InnerHtml = builder.ToString(); }
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 Page_Load(object sender, EventArgs e) { this.m_ItemId = BasePage.RequestInt32("ItemId"); this.m_FieldName = BasePage.RequestString("FieldName"); this.m_FieldType = BasePage.RequestString("FieldType"); string str = BasePage.RequestString("FieldAlias"); if (this.m_ItemId <= 0) { AdminPage.WriteErrMsg("<li>ItemID不存在!"); } if (string.IsNullOrEmpty(this.m_FieldName)) { AdminPage.WriteErrMsg("<li>字段名称不存在!"); } if (string.IsNullOrEmpty(this.m_FieldType)) { AdminPage.WriteErrMsg("<li>字段类型不能为空!"); } this.LblFieldName.Text = str + "[" + this.m_FieldType + "]"; FieldType none = FieldType.None; if (Enum.IsDefined(typeof(FieldType), this.m_FieldType)) { none = (FieldType)Enum.Parse(typeof(FieldType), this.m_FieldType); } else { AdminPage.WriteErrMsg("<li>不是系统字段类型!"); } CollectionItemInfo infoById = CollectionItem.GetInfoById(this.m_ItemId); if (infoById.IsNull) { AdminPage.WriteErrMsg("<li>当前采集项目不存在!"); } CollectionListRuleInfo info2 = CollectionListRules.GetInfoById(infoById.ItemId); if (info2.IsNull) { AdminPage.WriteErrMsg("<li>隶属于" + infoById.ItemName + "采集项目的列表规则不存在!"); } CollectionCommon common = new CollectionCommon(); Uri url = new Uri(infoById.Url); string httpPage = common.GetHttpPage(url, infoById.CodeType); string code = common.GetInterceptionString(httpPage, info2.ListBeginCode, info2.ListEndCode); try { ArrayList list = common.GetArray(code, info2.LinkBeginCode, info2.LinkEndCode); if ((this.Session["ShowCode"] != null) && !string.IsNullOrEmpty(this.Session["ShowCode"].ToString())) { this.TxtShowCode.Text = this.Session["ShowCode"].ToString(); } else { Uri uri2 = new Uri(common.ConvertToAbsluteUrl(list[0].ToString(), infoById.Url)); this.TxtShowCode.Text = common.GetHttpPage(uri2, infoById.CodeType); this.Session["ShowCode"] = this.TxtShowCode.Text; } this.HdnTestContent.Value = this.TxtShowCode.Text; StringBuilder builder = new StringBuilder(); builder.Append("<select name='ArrContentUrl' onchange=\"testContentLink(this.options[this.selectedIndex].value)\">"); string str4 = ""; for (int i = 0; i < list.Count; i++) { str4 = common.ConvertToAbsluteUrl(list[i].ToString(), url.ToString()); builder.Append(" <option value='" + str4 + "'>" + str4 + "</option>"); } this.m_Url = common.ConvertToAbsluteUrl(list[0].ToString(), url.ToString()); builder.Append("</select> <a href='" + this.m_Url + "' id='contentLink' target='_blank' >查看原始网页</a>"); this.LblArrContentUrl.Text = builder.ToString(); this.m_CodeType = infoById.CodeType; } catch (ArgumentOutOfRangeException exception) { AdminPage.WriteErrMsg("<li>" + exception.Message + "</li>"); } this.ListFilterRuleID.Items.Add(new ListItem("不设置过滤", "0")); this.ListFilterRuleID.AppendDataBoundItems = true; this.ListFilterRuleID.DataSource = CollectionFilterRules.GetList(0, 0); this.ListFilterRuleID.DataBind(); if (!base.IsPostBack) { CollectionFieldRuleInfo info3 = CollectionFieldRules.GetInfoById(infoById.ItemId, this.m_FieldName); if (!info3.IsNull) { this.TxtFieldBegin.Text = info3.BeginCode; this.TxtFieldEnd.Text = info3.EndCode; this.TxtKeyWord.Text = info3.SpecialSetting; this.SavePhoto.Checked = DataConverter.CBoolean(info3.SpecialSetting); foreach (ListItem item in this.ListFilterRuleID.Items) { if (StringHelper.FoundCharInArr(info3.FilterRuleId, item.Value)) { item.Selected = true; } } foreach (ListItem item2 in this.ListFilterSelect.Items) { if (StringHelper.FoundCharInArr(info3.PrivateFilter, item2.Value)) { item2.Selected = true; } } } FieldType type2 = none; if (type2 == FieldType.KeywordType) { this.LblKeyWord.Visible = true; this.TxtKeyWord.Visible = true; this.ValeKeyWord.Visible = true; } else if (type2 == FieldType.ContentType) { this.TabTitle1.Visible = true; this.SavePhoto.Visible = true; this.RadlPaingType.Attributes.Add("onclick", "javascript:ListPaing(0);"); this.RadlPaingType1.Attributes.Add("onclick", "javascript:ListPaing(1);"); this.RadlPaingType2.Attributes.Add("onclick", "javascript:ListPaing(2);"); this.RadlPaingType3.Attributes.Add("onclick", "javascript:ListPaing(3);"); this.RadlPaingType4.Attributes.Add("onclick", "javascript:ListPaing(4);"); if (info3.UsePaging) { CollectionPagingRuleInfo info4 = CollectionPagingRules.GetInfoById(infoById.ItemId, 1); this.TxtPaingBegin.Text = info4.PagingBeginCode; this.TxtPaingEnd.Text = info4.PagingEndCode; switch (info4.PagingType) { case 0: this.RadlPaingType.Checked = true; break; case 1: this.RadlPaingType1.Checked = true; break; case 2: this.RadlPaingType2.Checked = true; break; case 3: this.RadlPaingType3.Checked = true; break; case 4: this.RadlPaingType4.Checked = true; break; default: this.RadlPaingType.Checked = true; break; } this.TxtPaingAddress.Text = info4.DesignatedUrl; this.TxtScopeBegin.Text = info4.ScopeBegin.ToString(); this.TxtScopeEnd.Text = info4.ScopeEnd.ToString(); this.TxtListPaing.Text = info4.PagingUrlList; this.TxtPaingBegin2.Text = info4.PagingBeginCode; this.TxtPaingEnd2.Text = info4.PagingEndCode; this.TxtLinkBegin2.Text = info4.LinkBeginCode; this.TxtLinkEnd2.Text = info4.LinkEndCode; this.Page.ClientScript.RegisterStartupScript(base.GetType(), "Init", "<script type='text/javascript'>ListPaing(" + DataConverter.CLng(info4.PagingType).ToString() + ");</script>"); } } this.ShowExclosionList(info3.ExclosionId, none); } }
protected void Page_Load(object sender, EventArgs e) { int id = BasePage.RequestInt32("ItemId"); if (id <= 0) { AdminPage.WriteErrMsg("<li>ItemID不存在!</li>"); } CollectionItemInfo infoById = CollectionItem.GetInfoById(id); if (infoById.IsNull) { AdminPage.WriteErrMsg("<li>当前采集项目不存在!</li>"); } this.m_CodeType = infoById.CodeType; this.m_Url = infoById.Url; this.m_itemId = infoById.ItemId; this.m_ModelId = infoById.ModelId; this.m_NodeId = infoById.NodeId; this.LblItemName.Text = infoById.ItemName; CollectionCommon common = new CollectionCommon(); Uri url = new Uri(this.m_Url); this.TxtShowCode.Text = common.GetHttpPage(url, this.m_CodeType); this.HdnTestContent.Value = this.TxtShowCode.Text; this.LblLink.Text = " <a href='" + this.m_Url + "' target='_blank'>查看原始网页</a>"; string str = BasePage.RequestString("Action", "Add"); if (!base.IsPostBack) { this.RadlPaingType.Attributes.Add("onclick", "javascript:ListPaing(0);"); this.RadlPaingType1.Attributes.Add("onclick", "javascript:ListPaing(1);"); this.RadlPaingType2.Attributes.Add("onclick", "javascript:ListPaing(2);"); this.RadlPaingType3.Attributes.Add("onclick", "javascript:ListPaing(3);"); this.RadlPaingType4.Attributes.Add("onclick", "javascript:ListPaing(4);"); if (str == "Modify") { CollectionListRuleInfo info2 = CollectionListRules.GetInfoById(infoById.ItemId); if (!info2.IsNull) { this.TxtListBegin.Text = info2.ListBeginCode; this.TxtListEnd.Text = info2.ListEndCode; this.TxtLinkBegin.Text = info2.LinkBeginCode; this.TxtLinkEnd.Text = info2.LinkEndCode; if (info2.UsePaging) { CollectionPagingRuleInfo info3 = CollectionPagingRules.GetInfoById(infoById.ItemId, 0); this.TxtPaingBegin.Text = info3.PagingBeginCode; this.TxtPaingEnd.Text = info3.PagingEndCode; switch (info3.PagingType) { case 0: this.RadlPaingType.Checked = true; break; case 1: this.RadlPaingType1.Checked = true; break; case 2: this.RadlPaingType2.Checked = true; break; case 3: this.RadlPaingType3.Checked = true; break; case 4: this.RadlPaingType4.Checked = true; break; default: this.RadlPaingType.Checked = true; break; } this.TxtPaingAddress.Text = info3.DesignatedUrl; this.TxtScopeBegin.Text = info3.ScopeBegin.ToString(); this.TxtScopeEnd.Text = info3.ScopeEnd.ToString(); this.TxtListPaing.Text = info3.PagingUrlList; this.TxtPaingBegin2.Text = info3.PagingBeginCode; this.TxtPaingEnd2.Text = info3.PagingEndCode; this.TxtLinkBegin2.Text = info3.LinkBeginCode; this.TxtLinkEnd2.Text = info3.LinkEndCode; this.Page.ClientScript.RegisterStartupScript(base.GetType(), "Init", "<script type='text/javascript'>ListPaing(" + DataConverter.CLng(info3.PagingType).ToString() + ");</script>"); } this.BtnCancel1.Visible = true; } } } this.SmpNavigator.CurrentNode = string.Concat(new object[] { "<a title=\"采集项目设置\" href=\"ConfigStep1.aspx?Action=Modify&ItemId=", this.m_itemId, "&ModelId=", this.m_ModelId.ToString(), "&NodeId=", this.m_NodeId.ToString(), "\">采集项目设置</a> >> <span style='color:red;'>列表页采集设置</span> >> <a title=\"内容页采集设置\" href=\"ConfigStep3.aspx?Action=Modify&ItemID=", id.ToString(), "\">内容页采集设置</a>" }); this.HdnAction.Value = str; }