123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882 |
- /*******************************************************************************
- * iNethinkCMS - 网站内容管理系统
- * Copyright (C) 2012-2013 inethink.com
- *
- * @author jackyang <69991000@qq.com>
- * @website http://cms.inethink.com
- * @version 1.3.6.0 (2013-08-14)
- *
- * This is licensed under the GNU LGPL, version 3.0 or later.
- * For details, see: http://www.gnu.org/licenses/gpl-3.0.html
- *******************************************************************************/
- using System;
- using System.Collections.Generic;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Data;
- using System.Data.SqlClient;
- using System.Text.RegularExpressions;
- using iNethinkCMS.Helper;
- using iNethinkCMS.Command;
- using iNethinkCMS.Web.UI;
- namespace iNethinkCMS.Web.UserCenter
- {
- public partial class Info_content : Admin_BasePage
- {
- iNethinkCMS.BLL.BLL_iNethinkCMS_Content bll = new iNethinkCMS.BLL.BLL_iNethinkCMS_Content();
- iNethinkCMS.BLL.BLL_iNethinkCMS_Channel bll_column = new iNethinkCMS.BLL.BLL_iNethinkCMS_Channel();
- iNethinkCMS.BLL.BLL_iNethinkCMS_Special bll_special = new iNethinkCMS.BLL.BLL_iNethinkCMS_Special();
- iNethinkCMS.BLL.BLL_iNethinkCMS_Upload bll_upload = new iNethinkCMS.BLL.BLL_iNethinkCMS_Upload();
- iNethinkCMS.BLL.BLL_iNethinkCMS_Channel_CustomFields bll_customfields = new BLL.BLL_iNethinkCMS_Channel_CustomFields();
- iNethinkCMS.Model.Model_iNethinkCMS_Content model = new iNethinkCMS.Model.Model_iNethinkCMS_Content();
- private string vNavInfo = "当前位置:";
- private string vAct = "";
- private int vPage = 1;
- private string vSQL = "";
- private string vKeyType = "";
- private string vKey = "";
- public string v_ViewList = "0";//是否为只读列表视图
- public string v_pCID="";//当前模块父ID
- private string v_sCID="";
- private string v_sSID;
- private string v_sDisplay;
- private string v_sCommend;
- private string v_sIsComment;
- public int vID = 0;
- public int vCid;
- private int vSid;
- private string vTitle;
- private string vSubTitle;
- private string vTitle_Color;
- private string vTitle_Style;
- private string vAuthor;
- private string vSource;
- private string vJumpurl;
- private string vKeywords;
- private string vDescription;
- private string vIndexpic;
- private int vViews=0;
- private int vDiggNumber=0;
- private int vCommend;
- private int vIsComment;
- private int vIsDigg;
- private int vDisplay;
- private DateTime vCreatetime;
- private DateTime vModifytime;
- private int vOrderNum=0;
- private string vContents;
- private string vFieldsInfo;
- private string vBlockName = "内容信息";
- private string vBlockCIDs = "";//当前模块下的所有子栏目ID
- /// <summary>
- /// 当前栏目自定义字段列表
- /// </summary>
- DataTable TbCustomfields = null;
- /// <summary>
- /// 获取当前用户权限的所有栏目列表
- /// </summary>
- DataTable TbChannelDataTable = null;
- protected void Page_Load(object sender, EventArgs e)
- {
- CheckUserPower("a");
- #region
- TbChannelDataTable = GetTbChannelDataTable();
- vAct = Request.QueryString["Act"] != null ? Request.QueryString["Act"] : "";
- if (Request.QueryString["Page"] != null && Request.QueryString["Page"].Trim() != "")
- {
- if (!int.TryParse(Request.QueryString["Page"], out vPage))
- {
- vPage = 1;
- }
- }
- vKeyType = Request.QueryString["sKeyType"] != null ? Request.QueryString["sKeyType"] : "";
- vKey = Request.QueryString["sKey"] != null ? Request.QueryString["sKey"] : "";
- vKey = vKey.Replace("'", "");
- if (Request.QueryString["ID"] != null && Request.QueryString["ID"].Trim() != "")
- {
- if (!int.TryParse(Request.QueryString["ID"], out vID))
- {
- Response.Write("ID Error");
- Response.End();
- }
- }
- v_ViewList = Request.QueryString["ViewList"] != null ? Request.QueryString["ViewList"] : "0";
- v_pCID = Request.QueryString["pcid"] != null ? Request.QueryString["pcid"] : "";
- if (v_pCID.Trim().Length > 0)
- {
- iNethinkCMS.Model.Model_iNethinkCMS_Channel channelModel= bll_column.GetModel(Convert.ToInt32(v_pCID));
- if (channelModel != null && channelModel.ID > 0)
- {
- this.vBlockName = channelModel.Name;
- }
- TbCustomfields = getTbCustomfields(v_pCID);
- }
-
- vSQL = "1=1";
- //栏目权限控制
- if (String.IsNullOrEmpty(SysRegisteredUsersChannelPower))
- {
- vSQL += " And [CID] = 0";
- }
- else if (SysRegisteredUsersChannelPower != "0")
- {
- vSQL += " And [CID] In (" + SysRegisteredUsersChannelPower + ")";
- }
- if (vKey.Length > 0)
- {
- if (vKeyType == "ID")
- {
- if (iNethinkCMS.Command.Command_Validate.IsNumber(vKey) == true)
- {
- vSQL += " And " + vKeyType + " = " + vKey + "";
- }
- else
- {
- vKey = "";
- }
- }
- else
- {
- vSQL += " And " + vKeyType + " Like '%" + vKey + "%'";
- }
- }
-
- v_sCID = Request.QueryString["sCID"] != null ? Request.QueryString["sCID"] : "";
- v_sSID = Request.QueryString["sSID"] != null ? Request.QueryString["sSID"] : "";
- v_sDisplay = Request.QueryString["sDisplay"] != null ? Request.QueryString["sDisplay"] : "";
- v_sCommend = Request.QueryString["sCommend"] != null ? Request.QueryString["sCommend"] : "";
- v_sIsComment = Request.QueryString["sIsComment"] != null ? Request.QueryString["sIsComment"] : "";
- if (v_sCID.Length > 0)
- {
- //vSQL += " And [CID] = " + v_sCID;
- DataRow[] tempRows = TbChannelDataTable.Select("FatherID=" + v_sCID);
- string myChildIDs = GetChannelChildIDs(v_sCID, tempRows);
- if (myChildIDs.Trim().Length > 0)
- {
- vSQL += " And [CID] in (" + myChildIDs + ")";
- }
- else
- {
- vSQL += " And [CID] = " + v_sCID;
- }
- }
- if (v_sSID.Length > 0)
- {
- vSQL += " And [SID] = " + v_sSID;
- }
- if (v_sDisplay.Length > 0)
- {
- vSQL += " And [Display] = " + v_sDisplay;
- }
- if (v_sCommend.Length > 0)
- {
- vSQL += " And [Commend] = " + v_sCommend;
- }
- if (v_sIsComment.Length > 0)
- {
- vSQL += " And [IsComment] = " + v_sIsComment;
- }
- if (SysLoginUserType != 1 && v_ViewList.Trim() != "1")
- {
- vSQL += " And [CreatorID] = " + SysLoginUserID;
- }
- #endregion
- this.mainID.Visible = false;
- this.guideID.Visible = false;
- switch (vAct)
- {
- case "guide":
- this.guideID.Visible = true;
- if (vID == 0)
- {
- this.navInfoID.InnerText = vNavInfo + this.vBlockName + "添加";
- this.Button_Submit.Click += new EventHandler(Button_Submit_Click_Add);
- }
- else
- {
- this.navInfoID.InnerText = vNavInfo + this.vBlockName + "修改";
- this.Button_Submit.Click += new EventHandler(Button_Submit_Click_Edit);
- }
- if (!IsPostBack)
- {
- if (Request.UrlReferrer != null)
- {
- ViewState["reJumpUrl"] = Request.UrlReferrer.AbsoluteUri;
- }
- Fun_SetValue(vID); //获取frm基本信息
- }
- break;
- case "delete":
- Fun_Delete(vID);
- break;
- case "deletes": //批量删除
- Fun_Deletes();
- break;
- case "audit": //批量审核
- Fun_Audit();
- break;
- case "move": //批量移动
- Fun_Move();
- break;
- default:
- this.navInfoID.InnerText = vNavInfo + this.vBlockName+"管理";
- this.mainID.Visible = true;
- if (!IsPostBack)
- {
- BindDropdownList(this.sCID);
- BindDropdownList_Special(this.sSID);
- BindDropdownList(this.moveCID);
- this.sKeyType.SelectedValue = vKeyType;
- this.sKey.Text = vKey;
- this.sCID.SelectedValue = v_sCID;
- this.sSID.SelectedValue = v_sSID;
- this.sDisplay.SelectedValue = v_sDisplay;
- this.sCommend.SelectedValue = v_sCommend;
- this.sIsComment.SelectedValue = v_sIsComment;
- this.sKeyType.SelectedValue = vKeyType;
- this.sKey.Text = vKey;
- }
- PageListInfo();
- break;
- }
-
- this.txtCid.Attributes.Add("onchange", "ajax_content_customfields2(" + vID + ");");
- this.txtTitle.Attributes.Add("onblur", "ajax_content_checktitle(" + vID + ");");
- this.txtCreatetime.Attributes.Add("onfocus", "WdatePicker({startDate:this.value,dateFmt:'yyyy/M/d H:mm:ss',isShowClear:false,errDealMode:1,autoPickDate:true,readOnly:true})");
- }
- #region mainID 列表
- protected void PageListInfo()
- {
- int vPageSize = int.Parse(siteConfig.PageListNum);
- int vRecordCount = bll.GetRecordCount(vSQL);
- Repeater.DataSource = bll.GetListByPage(vSQL, "ID Desc", (vPage - 1) * vPageSize, vPage * vPageSize);
- Repeater.DataBind();
- string pTemp = "";
- int vPageCount = 1;
- if (vRecordCount > 0)
- {
- vPageCount = (int)Math.Ceiling((double)vRecordCount / (double)vPageSize);
- pTemp = WebUI_PageList.GetPagingInfo_Manage(vPageCount, vRecordCount, vPage, vPageSize);
- }
- this.pagelist.InnerHtml = pTemp;
- this.iNoInfo.Visible = vRecordCount == 0 ? true : false;
- }
- protected void Button_Search_Click(object sender, EventArgs e)
- {
- Response.Redirect(Request.Path + "?pcid=" + this.v_pCID + "&ViewList="+this.v_ViewList+"&skeytype=" + this.sKeyType.SelectedValue + "&skey=" + this.sKey.Text);
- }
- #endregion
- #region guideID 信息修改/添加
- private void Fun_SetValue(int byID)
- {
- if (siteConfig.DisplayTitleRule == "true")
- {
- this.txtTitle.CssClass = "int int_rule";
- this.txtSubTitle.CssClass = "int int_rule";
- }
- BindDropdownList(this.txtCid);
- BindDropdownList(this.sCID);
- BindDropdownList_Special(this.txtSid);
- BindDropdownList_Special(this.sSID);
- if (byID == 0)
- {
- this.txtCid.Text = "0";
- this.txtSid.Text = "0";
- this.txtTitle.Text = "";
- this.txtSubTitle.Text = "";
- this.txtTitle_Color.Text = "";
- this.txtTitle_Style.Text = "";
- this.txtAuthor.Text = "";
- this.txtSource.Text = "";
- this.txtJumpurl.Text = "";
- this.txtKeywords.Text = "";
- if (seoConfig.AutoDescription == "1")
- {
- this.txtAutoGetDescription.Checked = true;
- //this.txtDescription.Visible = false;
- }
- this.txtDescription.Text = "";
- this.txtIndexpic.Value = "";
- this.txtViews.Text = "0";
- this.txtDiggNumber.Text = "0";
- this.txtCommend.Checked = false;
- this.txtIsComment.Checked = true;
- this.txtDisplay.Checked = true;
- this.txtIsDigg.Checked = false;
- this.txtCreatetime.Text = DateTime.Now.ToString();
- this.txtModifytime.Text = DateTime.Now.ToString();
- this.txtOrderNum.Text = "0";
- this.txtContents.Text = "";
- }
- else
- {
- model = bll.GetModel(byID);
- this.txtCid.Text = model.Cid.ToString();
- this.txtSid.Text = model.Sid.ToString();
- this.txtTitle.Text = model.Title;
- this.txtSubTitle.Text = model.SubTitle;
- this.txtTitle_Color.Text = model.Title_Color;
- this.txtTitle_Style.Text = model.Title_Style;
- this.txtAuthor.Text = model.Author;
- this.txtSource.Text = model.Source;
- this.txtJumpurl.Text = model.Jumpurl;
- this.txtKeywords.Text = model.Keywords;
- if (seoConfig.AutoDescription == "1")
- {
- this.txtAutoGetDescription.Checked = true;
- //this.txtDescription.Visible = false;
- }
- this.txtDescription.Text = model.Description;
- this.txtIndexpicTemp.DataSource = bll_upload.GetList("UpType = 1 And Aid = " + byID);
- this.txtIndexpicTemp.DataValueField = "Dir";
- this.txtIndexpicTemp.DataTextField = "Dir";
- this.txtIndexpicTemp.DataBind();
- this.txtIndexpicTemp.Items.Insert(0, new ListItem("不指定形象图", ""));
- this.txtIndexpicTemp.Value = model.Indexpic;
- this.txtIndexpic.Value = model.Indexpic;
- this.txtViews.Text = model.Views.ToString();
- this.txtDiggNumber.Text = this.model.DiggNumber.ToString();
- if (model.Commend == 1)
- {
- this.txtCommend.Checked = true;
- }
- if (model.IsComment == 1)
- {
- this.txtIsComment.Checked = true;
- }
- if (this.model.IsDigg == 1)
- {
- this.txtIsDigg.Checked = true;
- }
- if (model.Display == 1)
- {
- this.txtDisplay.Checked = true;
- }
- this.txtCreatetime.Text = model.Createtime.ToString();
- this.txtModifytime.Text = model.Modifytime.ToString();
- this.txtOrderNum.Text = model.OrderNum.ToString();
- this.txtContents.Text = model.Contents;
- }
- }
- private bool Fun_GetValue()
- {
- if (this.txtCid.Text.Trim() == "0")
- {
- MessageBox.Show(this, "请选择所属栏目!");
- return false;
- }
- if (this.txtTitle.Text.Trim().Length == 0)
- {
- MessageBox.Show(this, "请输入标题!");
- return false;
- }
- if (this.txtContents.Text.Trim().Length == 0)
- {
- MessageBox.Show(this, "请输入内容!");
- return false;
- }
- if (!Command_Validate.IsNumber(this.txtOrderNum.Text.Trim()))
- {
- MessageBox.Show(this, "排序权重只能输入数字!");
- return false;
- }
- if (!Command_Validate.IsNumber(this.txtViews.Text.Trim()))
- {
- MessageBox.Show(this, "访问次数只能输入数字!");
- return false;
- }
- if (!Command_Validate.IsNumber(this.txtDiggNumber.Text.Trim()))
- {
- MessageBox.Show(this, "投票数量只能输入数字!");
- return false;
- }
- vCid = int.Parse(this.txtCid.Text);
- vSid = int.Parse(this.txtSid.Text);
- vTitle = this.txtTitle.Text.Trim();
- vSubTitle = this.txtSubTitle.Text.Trim();
- vTitle_Color = this.txtTitle_Color.Text;
- vTitle_Style = this.txtTitle_Style.Text;
- vAuthor = this.txtAuthor.Text.Trim();
- vSource = this.txtSource.Text.Trim();
- vJumpurl = this.txtJumpurl.Text;
- vKeywords = this.txtKeywords.Text;
- if (this.txtAutoGetDescription.Checked == true)
- {
- vDescription = Command_StringPlus.Left(Command_StringPlus.LostHTML(this.txtContents.Text), 500);
- }
- else
- {
- vDescription = Command_StringPlus.LostHTML(this.txtDescription.Text);
- }
- vIndexpic = this.txtIndexpic.Value;
- vViews = int.Parse(this.txtViews.Text);
- vCommend = this.txtCommend.Checked == true ? 1 : 0;
- this.vDiggNumber = int.Parse(this.txtDiggNumber.Text);
- vIsComment = this.txtIsComment.Checked == true ? 1 : 0;
- this.vIsDigg = (this.txtIsDigg.Checked ? 1 : 0);
- vDisplay = this.txtDisplay.Checked == true ? 1 : 0;
- vCreatetime = DateTime.Parse(this.txtCreatetime.Text);
- vModifytime = DateTime.Now;
- vOrderNum = int.Parse(this.txtOrderNum.Text);
- vContents = this.txtContents.Text;
- vFieldsInfo = "";
- //string vSQL_CustomFields = "[Display] = 1 And CharIndex('," + vCid + ",' , ',' + CAST([CIDList] AS varchar(8000)) + ',') > 0";
- DataTable dt = getTbCustomfields(vCid.ToString());// bll_customfields.GetList(0, vSQL_CustomFields, "OrderNum Desc,ID Desc").Tables[0];
- for (int i = 0; i < dt.Rows.Count; i++)
- {
- string vCustomFieldsKey = dt.Rows[i]["CustomFieldsKey"].ToString();
- string vFieldsInfoTmp = Request.Form["" + vCustomFieldsKey + ""];
- if (!String.IsNullOrEmpty(vFieldsInfoTmp))
- {
- // vFieldsInfoTmp = Command_Validate.Decode(vFieldsInfoTmp);
- if (dt.Rows[i]["CustomFieldsRequired"].ToString() == "1")
- {
- MessageBox.Show(this, "请输入" + dt.Rows[i]["CustomFieldsName"].ToString());
- return false;
- }
- }
- vFieldsInfoTmp = "<" + vCustomFieldsKey + ">" + vFieldsInfoTmp + "</" + vCustomFieldsKey + ">";
- vFieldsInfo += vFieldsInfoTmp;
- }
- return true;
- }
- /// <summary>
- /// 获取自定义字段列表数据
- /// </summary>
- /// <param name="byCid"></param>
- /// <returns></returns>
- DataTable getTbCustomfields(string byCid)
- {
- string vSQL_CustomFields = "[Display] = 1 And CharIndex('," + byCid + ",' , ',' + CAST([CIDList] AS varchar(8000)) + ',') > 0";
- DataTable dt = bll_customfields.GetList(0, vSQL_CustomFields, "OrderNum Desc,ID Desc").Tables[0];
- return dt;
- }
- protected void Button_Submit_Click_Add(object sender, EventArgs e)
- {
- if (Fun_GetValue() == true)
- {
- if (bll.GetRecordCount("Title = '" + vTitle + "'") > 0)
- {
- MessageBox.Show(this, "标题名称 [" + vTitle + "] 已经存在!");
- return;
- }
- model.Cid = vCid;
- model.Sid = vSid;
- model.Title = vTitle;
- model.SubTitle = vSubTitle;
- model.Title_Color = vTitle_Color;
- model.Title_Style = vTitle_Style;
- model.Author = vAuthor;
- model.Source = vSource;
- model.Jumpurl = vJumpurl;
- model.Keywords = vKeywords;
- model.Description = vDescription;
- model.Indexpic = vIndexpic;
- model.Views = vViews;
- this.model.DiggNumber = this.vDiggNumber;
- model.Commend = vCommend;
- model.IsComment = vIsComment;
- this.model.IsDigg = this.vIsDigg;
- model.Display = vDisplay;
- model.Createtime = vCreatetime;
- model.Modifytime = vModifytime;
- model.OrderNum = vOrderNum;
- model.Contents = vContents;
- model.FieldsInfo = vFieldsInfo;
- model.CreatorID = SysLoginUserID;
- model.ModifyID = SysLoginUserID;
- bll.Add(model);
- int maxID = bll.GetMaxID();
- bll_upload.UpdateUploadFile(vContents, 1, maxID, vCid);
- bll_upload.UpdateUploadFile(vFieldsInfo, 1, maxID, vCid);
- Response.Redirect(ViewState["reJumpUrl"].ToString());
- }
- }
- protected void Button_Submit_Click_Edit(object sender, EventArgs e)
- {
- if (Fun_GetValue() == true)
- {
- if (bll.GetRecordCount("ID <> " + vID + " And Title = '" + vTitle + "'") > 0)
- {
- MessageBox.Show(this, "标题名称 [" + vTitle + "] 已经存在!");
- return;
- }
- model = bll.GetModel(vID);
- model.ID = vID;
- model.Cid = vCid;
- // model.Sid = vSid;
- model.Title = vTitle;
- model.SubTitle = vSubTitle;
- model.Title_Color = vTitle_Color;
- model.Title_Style = vTitle_Style;
- model.Author = vAuthor;
- model.Source = vSource;
- model.Jumpurl = vJumpurl;
- model.Keywords = vKeywords;
- model.Description = vDescription;
- model.Indexpic = vIndexpic;
- // model.Views = vViews;
- // this.model.DiggNumber = this.vDiggNumber;
- model.Commend = vCommend;
- model.IsComment = vIsComment;
- this.model.IsDigg = this.vIsDigg;
- model.Display = vDisplay;
- model.Createtime = vCreatetime;
- model.Modifytime = vModifytime;
- model.OrderNum = vOrderNum;
- model.Contents = vContents;
- model.FieldsInfo = vFieldsInfo;
- // model.CreatorID = SysLoginUserID;
- model.ModifyID = SysLoginUserID;
- bll.Update(model);
- bll_upload.UpdateUploadFile_Reset(1, vID, vCid); //重置上传表中的数据
- bll_upload.UpdateUploadFile(vContents, 1, vID, vCid);
- bll_upload.UpdateUploadFile(vFieldsInfo, 1, vID, vCid);
- Response.Redirect(ViewState["reJumpUrl"].ToString());
- }
- }
- #endregion
- #region Delete 数据删除
- protected void Fun_Delete(int byID)
- {
- if (v_ViewList.Trim() != "1")
- {
- int byCID = int.Parse(bll.GetModel(byID).Cid.ToString());
- if (bll.Delete(byID) == true)
- {
- bll_upload.UpdateUploadFile_Reset(1, byID, byCID); //重置上传表中的数据
- Response.Redirect(Request.UrlReferrer.AbsoluteUri);
- }
- }
- else {
- Response.Redirect(Request.UrlReferrer.AbsoluteUri);
- }
- }
- #endregion
- #region 数据批量操作
- protected void Fun_Deletes()
- {
- if (v_ViewList.Trim() != "1")
- {
- string vIDs;
- vIDs = Request.Form["ids"].ToString();
- if (bll.DeleteList(vIDs) == true)
- {
- //标记上传表中的数据
- Helper.SQLHelper.ExecuteSql("update [iNethinkCMS_Upload] set [UpType]=0 ,[Aid]=0 ,[Cid]=0 Where [Aid] In (" + vIDs + ") And [UpType]=1");
- Response.Redirect(Request.UrlReferrer.AbsoluteUri);
- }
- }
- else
- {
- Response.Redirect(Request.UrlReferrer.AbsoluteUri);
- }
- }
-
- protected string Fun_GetLockImg(object byLocking)
- {
- if (byLocking != null && byLocking.ToString() == "1")
- {
- return "<img alt=\"锁定\" src=\"../admin/skin/images/lock_48px.png\" width=\"16\" style=\" float:left;\" />";
- }
- else
- {
- return "";
- }
- }
- protected string Fun_GetOperateHtml(object byID, object byLocking,object byUID)
- {
- if (v_ViewList.Trim() != "1")
- {
- if (byLocking != null && byLocking.ToString() == "1")
- {
- return "编辑 删除";
- }
- else
- {
- return "<a href=\"?act=guide&pcid=" + this.v_pCID + "&id=" + byID.ToString() + "\">编辑</a> " +
- "<a href=\"javascript:if(confirm('您确定要删除这条记录吗?')){goJump('?act=delete&id=" + byID.ToString() + "');}\">删除</a>";
- }
- }
- else {
- return iNethinkCMS.BLL.BLL_iNethinkCMS_User.GetIDToUserTrueName(Convert.ToInt32(byUID.ToString()));
- }
- }
-
- protected void Fun_Audit()
- {
- string vIDs;
- vIDs = Request.Form["ids"].ToString();
- if (bll.AuditList(vIDs) == true)
- {
- Response.Redirect(Request.UrlReferrer.AbsoluteUri);
- }
- }
- protected void Fun_Move()
- {
- int vMoveCid;
- string vIDs;
- vMoveCid = int.Parse(this.moveCID.Text);
- vIDs = Request.Form["ids"].ToString();
- if (bll.MoveList(vMoveCid, vIDs) == true)
- {
- Helper.SQLHelper.ExecuteSql("update [iNethinkCMS_Upload] set [Cid]=" + vMoveCid + " Where [UpType]=1 And [Aid] In (" + vIDs + ")");
- Response.Redirect(Request.UrlReferrer.AbsoluteUri);
- }
- }
- #endregion
- #region 转换/获取相关信息
- //栏目名称
- protected string Fun_ChannleInfo(object byCID)
- {
- byCID = Convert.ToInt32(byCID);
- DataTable dt = bll_column.GetList("Cid=" + byCID).Tables[0];
- if (dt != null && dt.Rows.Count > 0)
- {
- return dt.Rows[0]["Name"].ToString();
- }
- else
- {
- return "";
- }
- }
- //专题名称
- protected string Fun_SpecialInfo(object bySID)
- {
- bySID = Convert.ToInt32(bySID);
- DataTable dt = bll_special.GetList("ID=" + bySID).Tables[0];
- if (dt != null && dt.Rows.Count > 0)
- {
- return "<span title=\"" + dt.Rows[0]["SpecialName"].ToString() + "\">[专]</span>";
- }
- else
- {
- return "";
- }
- }
- protected string Fun_ShowCustomFieldsTitle()
- {
- //v_pCID
- string retShowCustomFieldsTitle = "";
- if (TbCustomfields != null && TbCustomfields.Rows.Count>0)
- {
- for (int i = 0; i < TbCustomfields.Rows.Count; i++)
- {
- string vCustomTitleShow = TbCustomfields.Rows[i]["AtTitleShow"].ToString();
- if (vCustomTitleShow.Trim() == "1")
- {
- retShowCustomFieldsTitle += "<td width=\"120\">" + TbCustomfields.Rows[i]["CustomFieldsName"].ToString() + "</td>";
- }
- }
- }
- return retShowCustomFieldsTitle;
- }
- protected string Fun_ShowCustomFields(object byFieldsInfo)
- {
- string retShowCustomFieldsValue = "";
- if (TbCustomfields != null && TbCustomfields.Rows.Count > 0)
- {
- for (int i = 0; i < TbCustomfields.Rows.Count; i++)
- {
- string vCustomTitleShow = TbCustomfields.Rows[i]["AtTitleShow"].ToString();
- if (vCustomTitleShow.Trim() == "1")
- {
- retShowCustomFieldsValue += "<td>" + Web.UI.WebUI_Function.Fun_GetFieldsInfo(TbCustomfields.Rows[i]["CustomFieldsKey"].ToString()+"_Text", byFieldsInfo.ToString()) + "</td>";
- }
- }
- }
- return retShowCustomFieldsValue;
- }
- protected string Fun_DisplayInfo(object byDisplay)
- {
- return byDisplay.ToString() == "0" ? "<font color=\"#ff0000\">未发布</font>" : "发布";
- }
- protected string Fun_ExpanInfo(object byCommend, object byIsComment)
- {
- string tmpInfo = "";
- tmpInfo = byCommend.ToString() == "1" ? "<img alt=\"推荐\" src=\"/admin/skin/images/ico_01.gif\" />" : "";
- //tmpInfo += byIsComment.ToString() == "1" ? " [评]" : "";
- return tmpInfo;
- }
- #endregion
- #region 扩展搜索功能
- protected void Do_ExtSearch(object sender, EventArgs e)
- {
- v_sCID = Request.Form["sCID"] != null ? Request.Form["sCID"] : "";
- v_sSID = Request.Form["sSID"] != null ? Request.Form["sSID"] : "";
- v_sDisplay = Request.Form["sDisplay"] != null ? Request.Form["sDisplay"] : "";
- v_sCommend = Request.Form["sCommend"] != null ? Request.Form["sCommend"] : "";
- v_sIsComment = Request.Form["sIsComment"] != null ? Request.Form["sIsComment"] : "";
- Response.Redirect(Request.Path + "?pcid=" + this.v_pCID + "&ViewList=" + this.v_ViewList + "&scid=" + this.sCID.SelectedValue + "&ssid=" + this.sSID.SelectedValue + "&sdisplay=" + this.sDisplay.Text + "&scommend=" + this.sCommend.Text + "&siscomment=" + this.sIsComment.Text);
- }
- #endregion
- #region 专题下拉列表输出
- protected void BindDropdownList_Special(DropDownList byDropDownList)
- {
- DataTable dt = bll_special.GetList(0, "[Display] = 1", "OrderNum Desc").Tables[0];
- for (int i = 0; i < dt.Rows.Count; i++)
- {
- byDropDownList.Items.Add(new ListItem(dt.Rows[i]["SpecialName"].ToString(), dt.Rows[i]["ID"].ToString()));
- }
- }
- #endregion
- #region 栏目下拉列表输出
- /// <summary>
- /// 获取指定栏目ID下的所以子栏目ID 以“,”号分隔
- /// </summary>
- /// <param name="byCid"></param>
- /// <returns></returns>
- string GetChannelChildIDs(string byCid, DataRow[] byRows)
- {
- string reChilds = "";
- foreach (DataRow row in byRows)
- {
- if (row["FatherID"].ToString().Trim() == byCid.Trim())//绑定根节点
- {
- reChilds += row["Cid"].ToString().Trim() + ",";
- DataRow[] tempRows = TbChannelDataTable.Select("FatherID=" + row["Cid"].ToString());
- if (tempRows != null && tempRows.Length > 0)
- {
- reChilds += GetChannelChildIDs(row["Cid"].ToString(), tempRows);
- }
- }
- }
- return reChilds.Trim(',');
- }
- DataTable GetTbChannelDataTable()
- {
- string vSqlWhere = "[Mold] = 1";
- if (String.IsNullOrEmpty(SysRegisteredUsersChannelPower))
- {
- vSqlWhere += " And [ID] = 0";
- }
- else if (SysRegisteredUsersChannelPower != "0")
- {
- vSqlWhere += " And [ID] In (" + SysRegisteredUsersChannelPower + ")";
- }
- DataTable dt = bll_column.GetList(0, vSqlWhere, "OrderNum Desc").Tables[0];
- return dt;
- }
- /// <summary>
- /// 绑定DropDownList;
- /// </summary>
- protected void BindDropdownList(DropDownList byDropDownList)
- {
- /* string vSqlWhere = "[Mold] = 1";
- if (String.IsNullOrEmpty(SysRegisteredUsersChannelPower))
- {
- vSqlWhere += " And [ID] = 0";
- }
- else if (SysRegisteredUsersChannelPower != "0")
- {
- vSqlWhere += " And [ID] In (" + SysRegisteredUsersChannelPower + ")";
- }*/
- DataTable dt = TbChannelDataTable; //bll_column.GetList(0, vSqlWhere, "OrderNum Desc").Tables[0];
- //this.txtCid.Items.Insert(0, new ListItem("请选择所属栏目", "0"));
- if (dt.Rows.Count > 0)
- {
- this.vBlockCIDs = v_pCID;
- foreach (DataRow row in dt.Rows)
- {
- if (row["FatherID"].ToString().Trim() == v_pCID)//绑定根节点
- {
- this.vBlockCIDs += "," + row["CID"].ToString();
- byDropDownList.Items.Add(new ListItem(row["Name"].ToString(), row["CID"].ToString()));
- this.bindChildItem(byDropDownList, dt, row["CID"].ToString(), 1);
- }
- }
- this.vSQL = " [CID] in (" + this.vBlockCIDs + ") and (" + this.vSQL + ")";
- }
- else
- {
- if (byDropDownList.ID == "txtCid")
- {
- byDropDownList.Items.Add(new ListItem("尚未添加任何栏目/无栏目管理权限!", "0"));
- }
- }
- }
- protected void bindChildItem(DropDownList byDropDownList, DataTable dt, string id, int length)
- {
- DataRow[] rows = dt.Select("FatherID=" + id + "", "OrderNum Desc");
- for (int i = 0; i < rows.Length; i++)
- {
- byDropDownList.Items.Add(new ListItem(WebUI_Function.SpaceLength(length) + "├ " + rows[i]["Name"].ToString(), rows[i]["CID"].ToString()));
- this.bindChildItem(byDropDownList, dt, rows[i]["CID"].ToString(), length + 1);
- }
- }
- #endregion
- }
- }
|