//发布 protected void btnFB_Click(object sender, EventArgs e) { if (this.Session["uid"].ToString() == "") this.Response.Redirect("../login.aspx"); string ls_tip = "发布成功!"; //新文档时 TPortalClass.JpArticle JpArticle = new TPortalClass.JpArticle(); TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); JpArticle.cid = this.txtcid.Text; JpArticle.title = this.txttitle.Text; JpArticle.subhead = this.txttitle2.Text; JpArticle.ht_content = this.content1.Value; if (this.txtsummary.Text == "") { JpArticle.summary = JpCommon.OutPicGetStr(this.content1.Value, 150); } else { JpArticle.summary = this.txtsummary.Text; } JpArticle.author = this.Session["uname"].ToString(); JpArticle.status = "发布"; //JpArticle.ifindexdisplay = ""; string lsfilename = FileUpload1.FileName; string lspath = ""; string lsurl = ""; string str_path = ""; if (lsfilename != "") //attsize { //SaveCommon(ls_path, ls_attsize, lsguid); //将附件上传到服务器目录下 lspath = Server.MapPath("~/");//虚拟目录的位置 lsurl = "/upload/indexpic"; //存放的文件夹 Directory.CreateDirectory(lspath + "/" + lsurl); str_path = lspath + "/" + lsurl + "/" + lsfilename; FileUpload1.SaveAs(str_path); JpArticle.indexdisplaypicpath = lsurl + "/" + lsfilename; } else { this.txtpic.Value = JpCommon.GetImg(this.content1.Value); JpArticle.indexdisplaypicpath = this.txtpic.Value; } if (this.txtseotitle.Text == "") { JpArticle.seotitle = this.txttitle.Text; } else { JpArticle.seotitle = this.txtseotitle.Text; } if (this.txtseokeywords.Text == "") { JpArticle.seokeywords = this.txttitle.Text; } else { JpArticle.seokeywords = this.txtseokeywords.Text; } if (this.txtseodescription.Text == "") { JpArticle.seodescription = JpCommon.OutPicGetStr(this.content1.Value, 150); } else { JpArticle.seodescription = this.txtseodescription.Text; } JpArticle.asort = System.Int32.Parse(this.txtasort.Text); JpArticle.iftop = this.ddlsfzd.SelectedValue; JpArticle.topendtime = this.txttopendtime.Value; JpArticle.ifindexdisplay = this.ddlsfsyss.SelectedValue; JpArticle.ifcomment = "0"; JpArticle.source = this.txtsource.Value; JpArticle.role_userid = this.txtrole_userid.Text; JpArticle.role_username = this.txtrole_username.Text; JpArticle.input = this.Session["uid"].ToString(); JpArticle.GUID = this.txtguid.Text; if (ddllb.SelectedValue != "请选择") { JpArticle.map_cid = ddllb.SelectedValue; } else { JpArticle.map_cid = ""; } JpArticle.map_aid = 0; JpArticle.targettype = ""; JpArticle.hits = 0; JpArticle.goodnum = 0; if (radlist.SelectedValue == "否") { JpArticle.sfzwd = radlist.SelectedValue; JpArticle.zwdid = ddlwz.SelectedValue; } else { JpArticle.sfzwd = radlist.SelectedValue; JpArticle.zwdid = ""; } if (this.txtendtime.Text != "") { JpArticle.endtime = this.txtendtime.Text; } else { JpArticle.endtime = System.DateTime.Now.AddYears(10).ToString(); } if (this.txtpubtime.Text != "") { JpArticle.pubtime = this.txtpubtime.Text; } else { JpArticle.pubtime = System.DateTime.Now.ToString(); } if (this.txtop.Value == "add") { //写系统日志 string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (userip == null || userip == "") { userip = Request.ServerVariables["REMOTE_ADDR"]; } JpCommon.WriteLog(userip, "审核新增", "审核新增文章记录[guid:" + this.txtguid.Text + "]", Session["uid"].ToString(), Session["uname"].ToString()); JpArticle.Insert(); } else { //写系统日志 string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (userip == null || userip == "") { userip = Request.ServerVariables["REMOTE_ADDR"]; } JpCommon.WriteLog(userip, "审核修改", "审核修改组织记录[id:" + this.txtguid.Text + "]", Session["uid"].ToString(), Session["uname"].ToString()); JpArticle.aid = System.Int32.Parse(this.txtaid.Text); JpArticle.Update(); } //静态发布 TPortalClass.JpSite JpSite = new TPortalClass.JpSite(); string ls_html = JpSite.fax; if (ls_html == "开启") { DataTable dt = JpArticle.GetArticleByGUID(this.txtguid.Text); if (dt.Rows.Count > 0) { JpArticle.PubAll("," + dt.Rows[0]["aid"].ToString() + ",", this.txtpubtime.Text, this.txtendtime.Text); } } Response.Write("<script>alert('" + ls_tip + "');window.location='" + this.txturl.Value + "'</script>"); }
//发布 protected void btnpubart_Click(object sender, EventArgs e) { TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); TPortalClass.JpArticle JpArticle = new TPortalClass.JpArticle(); string ls_tip = "发布成功!"; TPortalClass.JpSite JpSite = new TPortalClass.JpSite(); string ls_html = JpSite.fax; for (int i = 0; i < rptList.Items.Count; i++) { //int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); string id = ((HiddenField)rptList.Items[i].FindControl("hidId")).Value; CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { if (ls_html == "开启") { JpArticle.PubAll("," + id + ",", this.txtpubtime.Value, this.txtendtime.Value); //静态发布时使用 } else { JpArticle.PubAllNoHtml("," + id + ",", this.txtpubtime.Value, this.txtendtime.Value);//非静态发布时使用 } } } string pageUrl = ""; pageUrl = JpCommon.CombUrlTxt("list_article_fb.aspx", "page={0}&rnd={1}&cid={2}", "" + this.txtPage.Text + "", "" + System.Guid.NewGuid().ToString() + "", "" + this.txtcid.Text + ""); //写系统日志 string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (userip == null || userip == "") { userip = Request.ServerVariables["REMOTE_ADDR"]; } JpCommon.WriteLog(userip, "发布", "批量发布文章记录", Session["uid"].ToString(), Session["uname"].ToString()); Response.Write("<script>alert('" + ls_tip + "');window.location='" + pageUrl + "';</script>"); }
//批量转移 protected void btnplzy_Click(object sender, EventArgs e) { TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); TPortalClass.JpArticle JpArticle = new TPortalClass.JpArticle(); string ls_tip = "批量转移成功!"; TPortalClass.JpSite JpSite = new TPortalClass.JpSite(); string ls_html = JpSite.fax; string ls_ids = ""; for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); //string id = ((HiddenField)rptList.Items[i].FindControl("hidId")).Value; CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { if (ls_ids == "") { ls_ids = id.ToString(); } else { ls_ids = ls_ids + "," + id.ToString(); } string ls_cids = this.txtcheckcid.Text; string[] lv_cids = ls_cids.Split('+'); for (int j = 0; j < lv_cids.Length; j++) { if (lv_cids[j] != "") { JpArticle.aid = id; JpArticle.cid = lv_cids[j]; JpArticle.UpdatePlzylm(); } } } } string pageUrl = ""; pageUrl = JpCommon.CombUrlTxt("list_article_fb.aspx", "page={0}&rnd={1}&cid={2}", "" + this.txtPage.Text + "", "" + System.Guid.NewGuid().ToString() + "", "" + this.txtcid.Text + ""); if (ls_ids != "") { string ls_pubtime = System.DateTime.Now.ToString(); string ls_endtime = System.DateTime.Now.AddYears(10).ToString(); if (ls_html == "开启") { JpArticle.PubAll("," + ls_ids + ",", ls_pubtime, ls_endtime); } //写系统日志 string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (userip == null || userip == "") { userip = Request.ServerVariables["REMOTE_ADDR"]; } JpCommon.WriteLog(userip, "转移", "批量转移文章ID:" + ls_ids, Session["uid"].ToString(), Session["uname"].ToString()); } else { ls_tip = "批量转移失败!请选中复制源文章和选择一个目标栏目。"; } Response.Write("<script>alert('" + ls_tip + "');window.location='" + pageUrl + "';</script>"); }
//全部复制 protected void btnallfz_Click(object sender, EventArgs e) { TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); TPortalClass.JpArticle JpArticle = new TPortalClass.JpArticle(); string ls_tip = "全部复制成功!"; TPortalClass.JpSite JpSite = new TPortalClass.JpSite(); string ls_html = JpSite.fax; string ls_ids = ""; //根据栏目ID得到该栏目下所有文章 DataTable dt = JpArticle.GetArticlesByCid_fb(this.txtcid.Text); for (int i = 0; i < dt.Rows.Count; i++) { int id = (int)dt.Rows[i]["aid"]; string ls_cids = this.txtcheckcid.Text; string[] lv_cids = ls_cids.Split('+'); for (int j = 0; j < lv_cids.Length; j++) { if (lv_cids[j] != "") { JpArticle.cid = lv_cids[j]; JpArticle.title = dt.Rows[i]["title"].ToString(); JpArticle.subhead = dt.Rows[i]["subhead"].ToString(); JpArticle.ht_content = dt.Rows[i]["ht_content"].ToString(); JpArticle.summary = dt.Rows[i]["summary"].ToString(); JpArticle.author = dt.Rows[i]["author"].ToString(); JpArticle.status = dt.Rows[i]["status"].ToString(); JpArticle.indexdisplaypicpath = dt.Rows[i]["indexdisplaypicpath"].ToString(); JpArticle.seotitle = dt.Rows[i]["seotitle"].ToString(); JpArticle.seokeywords = dt.Rows[i]["seokeywords"].ToString(); JpArticle.seodescription = dt.Rows[i]["seodescription"].ToString(); JpArticle.asort = (int)dt.Rows[i]["asort"]; JpArticle.iftop = dt.Rows[i]["iftop"].ToString(); JpArticle.topendtime = dt.Rows[i]["topendtime"].ToString(); JpArticle.ifindexdisplay = dt.Rows[i]["ifindexdisplay"].ToString(); JpArticle.ifcomment = dt.Rows[i]["ifcomment"].ToString(); JpArticle.source = dt.Rows[i]["source"].ToString(); JpArticle.role_userid = dt.Rows[i]["role_userid"].ToString(); JpArticle.role_username = dt.Rows[i]["role_username"].ToString(); JpArticle.input = dt.Rows[i]["input"].ToString(); JpArticle.GUID = System.Guid.NewGuid().ToString(); JpArticle.map_cid = dt.Rows[i]["map_cid"].ToString(); JpArticle.map_aid = (int)dt.Rows[i]["map_aid"]; JpArticle.targettype = dt.Rows[i]["targettype"].ToString(); JpArticle.endtime = dt.Rows[i]["endtime"].ToString(); JpArticle.pubtime = dt.Rows[i]["pubtime"].ToString(); int ls_newaid = JpArticle.Insert(); if (ls_ids == "") { ls_ids = ls_newaid.ToString(); } else { ls_ids = ls_ids + "," + ls_newaid.ToString(); } } } } string pageUrl = ""; pageUrl = JpCommon.CombUrlTxt("list_article_fb.aspx", "page={0}&rnd={1}&cid={2}", "" + this.txtPage.Text + "", "" + System.Guid.NewGuid().ToString() + "", "" + this.txtcid.Text + ""); if (ls_ids != "") { //静态发布时使用 string ls_pubtime = System.DateTime.Now.ToString(); string ls_endtime = System.DateTime.Now.AddYears(10).ToString(); if (ls_html == "开启") { JpArticle.PubAll("," + ls_ids + ",", ls_pubtime, ls_endtime); } //写系统日志 string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (userip == null || userip == "") { userip = Request.ServerVariables["REMOTE_ADDR"]; } JpCommon.WriteLog(userip, "全部复制", "全部复制文章栏目ID:" + this.txtcid.Text, Session["uid"].ToString(), Session["uname"].ToString()); } else { ls_tip = "全部复制失败!请选中复制源栏目和选择目标栏目。"; } Response.Write("<script>alert('" + ls_tip + "');window.location='" + pageUrl + "';</script>"); }
//批量复制 protected void btnplfz_Click(object sender, EventArgs e) { TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); TPortalClass.JpArticle JpArticle = new TPortalClass.JpArticle(); string ls_tip = "批量复制成功!"; TPortalClass.JpSite JpSite = new TPortalClass.JpSite(); string ls_html = JpSite.fax; string ls_ids = ""; for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); if (ls_ids == "") { ls_ids = id.ToString(); } else { ls_ids = ls_ids + "," + id.ToString(); } //string id = ((HiddenField)rptList.Items[i].FindControl("hidId")).Value; CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { TPortalClass.JpArticle article = new TPortalClass.JpArticle(id); string ls_cids = this.txtcheckcid.Text; string[] lv_cids = ls_cids.Split('+'); for (int j = 0; j < lv_cids.Length; j++) { if (lv_cids[j] != "") { JpArticle.cid = lv_cids[j]; JpArticle.title = article.title; JpArticle.subhead = article.subhead; JpArticle.ht_content = article.ht_content; JpArticle.summary = article.summary; JpArticle.author = article.author; JpArticle.status = article.status; JpArticle.indexdisplaypicpath = article.indexdisplaypicpath; JpArticle.seotitle = article.seotitle; JpArticle.seokeywords = article.seokeywords; JpArticle.seodescription = article.seodescription; JpArticle.asort = article.asort; JpArticle.iftop = article.iftop; JpArticle.topendtime = article.topendtime; JpArticle.ifindexdisplay = article.ifindexdisplay; JpArticle.ifcomment = article.ifcomment; JpArticle.source = article.source; JpArticle.role_userid = article.role_userid; JpArticle.role_username = article.role_username; JpArticle.input = article.input; JpArticle.GUID = System.Guid.NewGuid().ToString(); JpArticle.map_cid = article.map_cid; JpArticle.map_aid = article.map_aid; JpArticle.targettype = article.targettype; JpArticle.endtime = article.endtime; JpArticle.pubtime = article.pubtime; int ls_newaid = JpArticle.Insert(); if (ls_ids == "") { ls_ids = ls_newaid.ToString(); } else { ls_ids = ls_ids + "," + ls_newaid.ToString(); } } } } } string pageUrl = ""; pageUrl = JpCommon.CombUrlTxt("list_article_fb.aspx", "page={0}&rnd={1}&cid={2}", "" + this.txtPage.Text + "", "" + System.Guid.NewGuid().ToString() + "", "" + this.txtcid.Text + ""); if (ls_ids != "") { //静态发布时使用 string ls_pubtime = System.DateTime.Now.ToString(); string ls_endtime = System.DateTime.Now.AddYears(10).ToString(); if (ls_html == "开启") { JpArticle.PubAll("," + ls_ids + ",", ls_pubtime, ls_endtime); } //写系统日志 string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (userip == null || userip == "") { userip = Request.ServerVariables["REMOTE_ADDR"]; } JpCommon.WriteLog(userip, "复制", "批量复制文章ID:" + ls_ids, Session["uid"].ToString(), Session["uname"].ToString()); } else { ls_tip = "批量复制失败!请选中复制源文章和选择目标栏目。"; } Response.Write("<script>alert('" + ls_tip + "');window.location='" + pageUrl + "';</script>"); }
//全部转移 protected void btnallzy_Click(object sender, EventArgs e) { TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); TPortalClass.JpArticle JpArticle = new TPortalClass.JpArticle(); string ls_tip = "批量转移成功!"; TPortalClass.JpSite JpSite = new TPortalClass.JpSite(); string ls_html = JpSite.fax; string ls_ids = ""; //根据栏目ID得到该栏目下所有文章 DataTable dt = JpArticle.GetArticlesByCid_fb(this.txtcid.Text); for (int i = 0; i < dt.Rows.Count; i++) { int id = (int)dt.Rows[i]["aid"]; if (ls_ids == "") { ls_ids = id.ToString(); } else { ls_ids = ls_ids + "," + id.ToString(); } string ls_cids = this.txtcheckcid.Text; string[] lv_cids = ls_cids.Split('+'); for (int j = 0; j < lv_cids.Length; j++) { if (lv_cids[j] != "") { JpArticle.aid = id; JpArticle.cid = lv_cids[j]; JpArticle.UpdatePlzylm(); } } } string pageUrl = ""; pageUrl = JpCommon.CombUrlTxt("list_article_fb.aspx", "page={0}&rnd={1}&cid={2}", "" + this.txtPage.Text + "", "" + System.Guid.NewGuid().ToString() + "", "" + this.txtcid.Text + ""); if (ls_ids != "") { string ls_pubtime = System.DateTime.Now.ToString(); string ls_endtime = System.DateTime.Now.AddYears(10).ToString(); if (ls_html == "开启") { JpArticle.PubAll("," + ls_ids + ",", ls_pubtime, ls_endtime); } //写系统日志 string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (userip == null || userip == "") { userip = Request.ServerVariables["REMOTE_ADDR"]; } JpCommon.WriteLog(userip, "全部转移", "将栏目ID:" + this.txtcid.Text + "全部转移到栏目ID:" + this.txtcheckcid.Text, Session["uid"].ToString(), Session["uname"].ToString()); } else { ls_tip = "全部转移失败!请选中复制源栏目和选择一个目标栏目。"; } Response.Write("<script>alert('" + ls_tip + "');window.location='" + pageUrl + "';</script>"); }