//发布 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 btnSave_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.ddlcolname.SelectedValue; 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(); if (this.txtstatus.Text == "") { JpArticle.status = "编辑"; } else { JpArticle.status = this.txtstatus.Text; } //JpArticle.ifindexdisplay = ""; string lsfilename = FileUpload1.FileName; string lspath = "", lsurl = "", lsurl2 = "", str_path = "", str_path2 = ""; if (lsfilename != "") //attsize { lsfilename = this.txtguid.Text + "_" + lsfilename; //SaveCommon(ls_path, ls_attsize, lsguid); //将附件上传到服务器目录下 lspath = Server.MapPath("~/"); //虚拟目录的位置 lsurl = "/upload/indexpic_yt"; //原图存放的文件夹 lsurl2 = "/upload/indexpic"; //缩略图存放的文件夹 Directory.CreateDirectory(lspath + "/" + lsurl); Directory.CreateDirectory(lspath + "/" + lsurl2); str_path = lspath + "/" + lsurl + "/" + lsfilename; str_path2 = lspath + "/" + lsurl2 + "/" + lsfilename; FileUpload1.SaveAs(str_path); //压缩图片处理 MakeThumbnail(str_path, str_path2, 600, 600, "HW"); JpArticle.indexdisplaypicpath = lsurl2 + "/" + 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.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 = System.Int32.Parse(this.txthits.Text); JpArticle.goodnum = System.Int32.Parse(this.txtgoodnum.Text); if (txtcid_url.Text.Substring(0, 3) == "003" && txtcid_url.Text != "003004") { if (radlist.SelectedValue == "否") { JpArticle.sfzwd = radlist.SelectedValue; JpArticle.zwdid = ddlwz.SelectedValue; } else { JpArticle.sfzwd = radlist.SelectedValue; JpArticle.zwdid = ""; } } else { JpArticle.sfzwd = "否"; 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(); } //变化了栏目ID,返回路径也要变掉 if (this.ddlcolname.SelectedValue != this.txtcid_url.Text) { this.txturl.Value = this.txturl.Value.Replace(this.txtcid_url.Text, this.ddlcolname.SelectedValue); } Response.Write("<script>alert('" + ls_tip + "');window.location='" + this.txturl.Value + "'</script>"); }