Info_content.aspx.cs 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882
  1. /*******************************************************************************
  2. * iNethinkCMS - 网站内容管理系统
  3. * Copyright (C) 2012-2013 inethink.com
  4. *
  5. * @author jackyang <69991000@qq.com>
  6. * @website http://cms.inethink.com
  7. * @version 1.3.6.0 (2013-08-14)
  8. *
  9. * This is licensed under the GNU LGPL, version 3.0 or later.
  10. * For details, see: http://www.gnu.org/licenses/gpl-3.0.html
  11. *******************************************************************************/
  12. using System;
  13. using System.Collections.Generic;
  14. using System.Web;
  15. using System.Web.UI;
  16. using System.Web.UI.WebControls;
  17. using System.Data;
  18. using System.Data.SqlClient;
  19. using System.Text.RegularExpressions;
  20. using iNethinkCMS.Helper;
  21. using iNethinkCMS.Command;
  22. using iNethinkCMS.Web.UI;
  23. namespace iNethinkCMS.Web.UserCenter
  24. {
  25. public partial class Info_content : Admin_BasePage
  26. {
  27. iNethinkCMS.BLL.BLL_iNethinkCMS_Content bll = new iNethinkCMS.BLL.BLL_iNethinkCMS_Content();
  28. iNethinkCMS.BLL.BLL_iNethinkCMS_Channel bll_column = new iNethinkCMS.BLL.BLL_iNethinkCMS_Channel();
  29. iNethinkCMS.BLL.BLL_iNethinkCMS_Special bll_special = new iNethinkCMS.BLL.BLL_iNethinkCMS_Special();
  30. iNethinkCMS.BLL.BLL_iNethinkCMS_Upload bll_upload = new iNethinkCMS.BLL.BLL_iNethinkCMS_Upload();
  31. iNethinkCMS.BLL.BLL_iNethinkCMS_Channel_CustomFields bll_customfields = new BLL.BLL_iNethinkCMS_Channel_CustomFields();
  32. iNethinkCMS.Model.Model_iNethinkCMS_Content model = new iNethinkCMS.Model.Model_iNethinkCMS_Content();
  33. private string vNavInfo = "当前位置:";
  34. private string vAct = "";
  35. private int vPage = 1;
  36. private string vSQL = "";
  37. private string vKeyType = "";
  38. private string vKey = "";
  39. public string v_ViewList = "0";//是否为只读列表视图
  40. public string v_pCID="";//当前模块父ID
  41. private string v_sCID="";
  42. private string v_sSID;
  43. private string v_sDisplay;
  44. private string v_sCommend;
  45. private string v_sIsComment;
  46. public int vID = 0;
  47. public int vCid;
  48. private int vSid;
  49. private string vTitle;
  50. private string vSubTitle;
  51. private string vTitle_Color;
  52. private string vTitle_Style;
  53. private string vAuthor;
  54. private string vSource;
  55. private string vJumpurl;
  56. private string vKeywords;
  57. private string vDescription;
  58. private string vIndexpic;
  59. private int vViews=0;
  60. private int vDiggNumber=0;
  61. private int vCommend;
  62. private int vIsComment;
  63. private int vIsDigg;
  64. private int vDisplay;
  65. private DateTime vCreatetime;
  66. private DateTime vModifytime;
  67. private int vOrderNum=0;
  68. private string vContents;
  69. private string vFieldsInfo;
  70. private string vBlockName = "内容信息";
  71. private string vBlockCIDs = "";//当前模块下的所有子栏目ID
  72. /// <summary>
  73. /// 当前栏目自定义字段列表
  74. /// </summary>
  75. DataTable TbCustomfields = null;
  76. /// <summary>
  77. /// 获取当前用户权限的所有栏目列表
  78. /// </summary>
  79. DataTable TbChannelDataTable = null;
  80. protected void Page_Load(object sender, EventArgs e)
  81. {
  82. CheckUserPower("a");
  83. #region
  84. TbChannelDataTable = GetTbChannelDataTable();
  85. vAct = Request.QueryString["Act"] != null ? Request.QueryString["Act"] : "";
  86. if (Request.QueryString["Page"] != null && Request.QueryString["Page"].Trim() != "")
  87. {
  88. if (!int.TryParse(Request.QueryString["Page"], out vPage))
  89. {
  90. vPage = 1;
  91. }
  92. }
  93. vKeyType = Request.QueryString["sKeyType"] != null ? Request.QueryString["sKeyType"] : "";
  94. vKey = Request.QueryString["sKey"] != null ? Request.QueryString["sKey"] : "";
  95. vKey = vKey.Replace("'", "");
  96. if (Request.QueryString["ID"] != null && Request.QueryString["ID"].Trim() != "")
  97. {
  98. if (!int.TryParse(Request.QueryString["ID"], out vID))
  99. {
  100. Response.Write("ID Error");
  101. Response.End();
  102. }
  103. }
  104. v_ViewList = Request.QueryString["ViewList"] != null ? Request.QueryString["ViewList"] : "0";
  105. v_pCID = Request.QueryString["pcid"] != null ? Request.QueryString["pcid"] : "";
  106. if (v_pCID.Trim().Length > 0)
  107. {
  108. iNethinkCMS.Model.Model_iNethinkCMS_Channel channelModel= bll_column.GetModel(Convert.ToInt32(v_pCID));
  109. if (channelModel != null && channelModel.ID > 0)
  110. {
  111. this.vBlockName = channelModel.Name;
  112. }
  113. TbCustomfields = getTbCustomfields(v_pCID);
  114. }
  115. vSQL = "1=1";
  116. //栏目权限控制
  117. if (String.IsNullOrEmpty(SysRegisteredUsersChannelPower))
  118. {
  119. vSQL += " And [CID] = 0";
  120. }
  121. else if (SysRegisteredUsersChannelPower != "0")
  122. {
  123. vSQL += " And [CID] In (" + SysRegisteredUsersChannelPower + ")";
  124. }
  125. if (vKey.Length > 0)
  126. {
  127. if (vKeyType == "ID")
  128. {
  129. if (iNethinkCMS.Command.Command_Validate.IsNumber(vKey) == true)
  130. {
  131. vSQL += " And " + vKeyType + " = " + vKey + "";
  132. }
  133. else
  134. {
  135. vKey = "";
  136. }
  137. }
  138. else
  139. {
  140. vSQL += " And " + vKeyType + " Like '%" + vKey + "%'";
  141. }
  142. }
  143. v_sCID = Request.QueryString["sCID"] != null ? Request.QueryString["sCID"] : "";
  144. v_sSID = Request.QueryString["sSID"] != null ? Request.QueryString["sSID"] : "";
  145. v_sDisplay = Request.QueryString["sDisplay"] != null ? Request.QueryString["sDisplay"] : "";
  146. v_sCommend = Request.QueryString["sCommend"] != null ? Request.QueryString["sCommend"] : "";
  147. v_sIsComment = Request.QueryString["sIsComment"] != null ? Request.QueryString["sIsComment"] : "";
  148. if (v_sCID.Length > 0)
  149. {
  150. //vSQL += " And [CID] = " + v_sCID;
  151. DataRow[] tempRows = TbChannelDataTable.Select("FatherID=" + v_sCID);
  152. string myChildIDs = GetChannelChildIDs(v_sCID, tempRows);
  153. if (myChildIDs.Trim().Length > 0)
  154. {
  155. vSQL += " And [CID] in (" + myChildIDs + ")";
  156. }
  157. else
  158. {
  159. vSQL += " And [CID] = " + v_sCID;
  160. }
  161. }
  162. if (v_sSID.Length > 0)
  163. {
  164. vSQL += " And [SID] = " + v_sSID;
  165. }
  166. if (v_sDisplay.Length > 0)
  167. {
  168. vSQL += " And [Display] = " + v_sDisplay;
  169. }
  170. if (v_sCommend.Length > 0)
  171. {
  172. vSQL += " And [Commend] = " + v_sCommend;
  173. }
  174. if (v_sIsComment.Length > 0)
  175. {
  176. vSQL += " And [IsComment] = " + v_sIsComment;
  177. }
  178. if (SysLoginUserType != 1 && v_ViewList.Trim() != "1")
  179. {
  180. vSQL += " And [CreatorID] = " + SysLoginUserID;
  181. }
  182. #endregion
  183. this.mainID.Visible = false;
  184. this.guideID.Visible = false;
  185. switch (vAct)
  186. {
  187. case "guide":
  188. this.guideID.Visible = true;
  189. if (vID == 0)
  190. {
  191. this.navInfoID.InnerText = vNavInfo + this.vBlockName + "添加";
  192. this.Button_Submit.Click += new EventHandler(Button_Submit_Click_Add);
  193. }
  194. else
  195. {
  196. this.navInfoID.InnerText = vNavInfo + this.vBlockName + "修改";
  197. this.Button_Submit.Click += new EventHandler(Button_Submit_Click_Edit);
  198. }
  199. if (!IsPostBack)
  200. {
  201. if (Request.UrlReferrer != null)
  202. {
  203. ViewState["reJumpUrl"] = Request.UrlReferrer.AbsoluteUri;
  204. }
  205. Fun_SetValue(vID); //获取frm基本信息
  206. }
  207. break;
  208. case "delete":
  209. Fun_Delete(vID);
  210. break;
  211. case "deletes": //批量删除
  212. Fun_Deletes();
  213. break;
  214. case "audit": //批量审核
  215. Fun_Audit();
  216. break;
  217. case "move": //批量移动
  218. Fun_Move();
  219. break;
  220. default:
  221. this.navInfoID.InnerText = vNavInfo + this.vBlockName+"管理";
  222. this.mainID.Visible = true;
  223. if (!IsPostBack)
  224. {
  225. BindDropdownList(this.sCID);
  226. BindDropdownList_Special(this.sSID);
  227. BindDropdownList(this.moveCID);
  228. this.sKeyType.SelectedValue = vKeyType;
  229. this.sKey.Text = vKey;
  230. this.sCID.SelectedValue = v_sCID;
  231. this.sSID.SelectedValue = v_sSID;
  232. this.sDisplay.SelectedValue = v_sDisplay;
  233. this.sCommend.SelectedValue = v_sCommend;
  234. this.sIsComment.SelectedValue = v_sIsComment;
  235. this.sKeyType.SelectedValue = vKeyType;
  236. this.sKey.Text = vKey;
  237. }
  238. PageListInfo();
  239. break;
  240. }
  241. this.txtCid.Attributes.Add("onchange", "ajax_content_customfields2(" + vID + ");");
  242. this.txtTitle.Attributes.Add("onblur", "ajax_content_checktitle(" + vID + ");");
  243. this.txtCreatetime.Attributes.Add("onfocus", "WdatePicker({startDate:this.value,dateFmt:'yyyy/M/d H:mm:ss',isShowClear:false,errDealMode:1,autoPickDate:true,readOnly:true})");
  244. }
  245. #region mainID 列表
  246. protected void PageListInfo()
  247. {
  248. int vPageSize = int.Parse(siteConfig.PageListNum);
  249. int vRecordCount = bll.GetRecordCount(vSQL);
  250. Repeater.DataSource = bll.GetListByPage(vSQL, "ID Desc", (vPage - 1) * vPageSize, vPage * vPageSize);
  251. Repeater.DataBind();
  252. string pTemp = "";
  253. int vPageCount = 1;
  254. if (vRecordCount > 0)
  255. {
  256. vPageCount = (int)Math.Ceiling((double)vRecordCount / (double)vPageSize);
  257. pTemp = WebUI_PageList.GetPagingInfo_Manage(vPageCount, vRecordCount, vPage, vPageSize);
  258. }
  259. this.pagelist.InnerHtml = pTemp;
  260. this.iNoInfo.Visible = vRecordCount == 0 ? true : false;
  261. }
  262. protected void Button_Search_Click(object sender, EventArgs e)
  263. {
  264. Response.Redirect(Request.Path + "?pcid=" + this.v_pCID + "&ViewList="+this.v_ViewList+"&skeytype=" + this.sKeyType.SelectedValue + "&skey=" + this.sKey.Text);
  265. }
  266. #endregion
  267. #region guideID 信息修改/添加
  268. private void Fun_SetValue(int byID)
  269. {
  270. if (siteConfig.DisplayTitleRule == "true")
  271. {
  272. this.txtTitle.CssClass = "int int_rule";
  273. this.txtSubTitle.CssClass = "int int_rule";
  274. }
  275. BindDropdownList(this.txtCid);
  276. BindDropdownList(this.sCID);
  277. BindDropdownList_Special(this.txtSid);
  278. BindDropdownList_Special(this.sSID);
  279. if (byID == 0)
  280. {
  281. this.txtCid.Text = "0";
  282. this.txtSid.Text = "0";
  283. this.txtTitle.Text = "";
  284. this.txtSubTitle.Text = "";
  285. this.txtTitle_Color.Text = "";
  286. this.txtTitle_Style.Text = "";
  287. this.txtAuthor.Text = "";
  288. this.txtSource.Text = "";
  289. this.txtJumpurl.Text = "";
  290. this.txtKeywords.Text = "";
  291. if (seoConfig.AutoDescription == "1")
  292. {
  293. this.txtAutoGetDescription.Checked = true;
  294. //this.txtDescription.Visible = false;
  295. }
  296. this.txtDescription.Text = "";
  297. this.txtIndexpic.Value = "";
  298. this.txtViews.Text = "0";
  299. this.txtDiggNumber.Text = "0";
  300. this.txtCommend.Checked = false;
  301. this.txtIsComment.Checked = true;
  302. this.txtDisplay.Checked = true;
  303. this.txtIsDigg.Checked = false;
  304. this.txtCreatetime.Text = DateTime.Now.ToString();
  305. this.txtModifytime.Text = DateTime.Now.ToString();
  306. this.txtOrderNum.Text = "0";
  307. this.txtContents.Text = "";
  308. }
  309. else
  310. {
  311. model = bll.GetModel(byID);
  312. this.txtCid.Text = model.Cid.ToString();
  313. this.txtSid.Text = model.Sid.ToString();
  314. this.txtTitle.Text = model.Title;
  315. this.txtSubTitle.Text = model.SubTitle;
  316. this.txtTitle_Color.Text = model.Title_Color;
  317. this.txtTitle_Style.Text = model.Title_Style;
  318. this.txtAuthor.Text = model.Author;
  319. this.txtSource.Text = model.Source;
  320. this.txtJumpurl.Text = model.Jumpurl;
  321. this.txtKeywords.Text = model.Keywords;
  322. if (seoConfig.AutoDescription == "1")
  323. {
  324. this.txtAutoGetDescription.Checked = true;
  325. //this.txtDescription.Visible = false;
  326. }
  327. this.txtDescription.Text = model.Description;
  328. this.txtIndexpicTemp.DataSource = bll_upload.GetList("UpType = 1 And Aid = " + byID);
  329. this.txtIndexpicTemp.DataValueField = "Dir";
  330. this.txtIndexpicTemp.DataTextField = "Dir";
  331. this.txtIndexpicTemp.DataBind();
  332. this.txtIndexpicTemp.Items.Insert(0, new ListItem("不指定形象图", ""));
  333. this.txtIndexpicTemp.Value = model.Indexpic;
  334. this.txtIndexpic.Value = model.Indexpic;
  335. this.txtViews.Text = model.Views.ToString();
  336. this.txtDiggNumber.Text = this.model.DiggNumber.ToString();
  337. if (model.Commend == 1)
  338. {
  339. this.txtCommend.Checked = true;
  340. }
  341. if (model.IsComment == 1)
  342. {
  343. this.txtIsComment.Checked = true;
  344. }
  345. if (this.model.IsDigg == 1)
  346. {
  347. this.txtIsDigg.Checked = true;
  348. }
  349. if (model.Display == 1)
  350. {
  351. this.txtDisplay.Checked = true;
  352. }
  353. this.txtCreatetime.Text = model.Createtime.ToString();
  354. this.txtModifytime.Text = model.Modifytime.ToString();
  355. this.txtOrderNum.Text = model.OrderNum.ToString();
  356. this.txtContents.Text = model.Contents;
  357. }
  358. }
  359. private bool Fun_GetValue()
  360. {
  361. if (this.txtCid.Text.Trim() == "0")
  362. {
  363. MessageBox.Show(this, "请选择所属栏目!");
  364. return false;
  365. }
  366. if (this.txtTitle.Text.Trim().Length == 0)
  367. {
  368. MessageBox.Show(this, "请输入标题!");
  369. return false;
  370. }
  371. if (this.txtContents.Text.Trim().Length == 0)
  372. {
  373. MessageBox.Show(this, "请输入内容!");
  374. return false;
  375. }
  376. if (!Command_Validate.IsNumber(this.txtOrderNum.Text.Trim()))
  377. {
  378. MessageBox.Show(this, "排序权重只能输入数字!");
  379. return false;
  380. }
  381. if (!Command_Validate.IsNumber(this.txtViews.Text.Trim()))
  382. {
  383. MessageBox.Show(this, "访问次数只能输入数字!");
  384. return false;
  385. }
  386. if (!Command_Validate.IsNumber(this.txtDiggNumber.Text.Trim()))
  387. {
  388. MessageBox.Show(this, "投票数量只能输入数字!");
  389. return false;
  390. }
  391. vCid = int.Parse(this.txtCid.Text);
  392. vSid = int.Parse(this.txtSid.Text);
  393. vTitle = this.txtTitle.Text.Trim();
  394. vSubTitle = this.txtSubTitle.Text.Trim();
  395. vTitle_Color = this.txtTitle_Color.Text;
  396. vTitle_Style = this.txtTitle_Style.Text;
  397. vAuthor = this.txtAuthor.Text.Trim();
  398. vSource = this.txtSource.Text.Trim();
  399. vJumpurl = this.txtJumpurl.Text;
  400. vKeywords = this.txtKeywords.Text;
  401. if (this.txtAutoGetDescription.Checked == true)
  402. {
  403. vDescription = Command_StringPlus.Left(Command_StringPlus.LostHTML(this.txtContents.Text), 500);
  404. }
  405. else
  406. {
  407. vDescription = Command_StringPlus.LostHTML(this.txtDescription.Text);
  408. }
  409. vIndexpic = this.txtIndexpic.Value;
  410. vViews = int.Parse(this.txtViews.Text);
  411. vCommend = this.txtCommend.Checked == true ? 1 : 0;
  412. this.vDiggNumber = int.Parse(this.txtDiggNumber.Text);
  413. vIsComment = this.txtIsComment.Checked == true ? 1 : 0;
  414. this.vIsDigg = (this.txtIsDigg.Checked ? 1 : 0);
  415. vDisplay = this.txtDisplay.Checked == true ? 1 : 0;
  416. vCreatetime = DateTime.Parse(this.txtCreatetime.Text);
  417. vModifytime = DateTime.Now;
  418. vOrderNum = int.Parse(this.txtOrderNum.Text);
  419. vContents = this.txtContents.Text;
  420. vFieldsInfo = "";
  421. //string vSQL_CustomFields = "[Display] = 1 And CharIndex('," + vCid + ",' , ',' + CAST([CIDList] AS varchar(8000)) + ',') > 0";
  422. DataTable dt = getTbCustomfields(vCid.ToString());// bll_customfields.GetList(0, vSQL_CustomFields, "OrderNum Desc,ID Desc").Tables[0];
  423. for (int i = 0; i < dt.Rows.Count; i++)
  424. {
  425. string vCustomFieldsKey = dt.Rows[i]["CustomFieldsKey"].ToString();
  426. string vFieldsInfoTmp = Request.Form["" + vCustomFieldsKey + ""];
  427. if (!String.IsNullOrEmpty(vFieldsInfoTmp))
  428. {
  429. // vFieldsInfoTmp = Command_Validate.Decode(vFieldsInfoTmp);
  430. if (dt.Rows[i]["CustomFieldsRequired"].ToString() == "1")
  431. {
  432. MessageBox.Show(this, "请输入" + dt.Rows[i]["CustomFieldsName"].ToString());
  433. return false;
  434. }
  435. }
  436. vFieldsInfoTmp = "<" + vCustomFieldsKey + ">" + vFieldsInfoTmp + "</" + vCustomFieldsKey + ">";
  437. vFieldsInfo += vFieldsInfoTmp;
  438. }
  439. return true;
  440. }
  441. /// <summary>
  442. /// 获取自定义字段列表数据
  443. /// </summary>
  444. /// <param name="byCid"></param>
  445. /// <returns></returns>
  446. DataTable getTbCustomfields(string byCid)
  447. {
  448. string vSQL_CustomFields = "[Display] = 1 And CharIndex('," + byCid + ",' , ',' + CAST([CIDList] AS varchar(8000)) + ',') > 0";
  449. DataTable dt = bll_customfields.GetList(0, vSQL_CustomFields, "OrderNum Desc,ID Desc").Tables[0];
  450. return dt;
  451. }
  452. protected void Button_Submit_Click_Add(object sender, EventArgs e)
  453. {
  454. if (Fun_GetValue() == true)
  455. {
  456. if (bll.GetRecordCount("Title = '" + vTitle + "'") > 0)
  457. {
  458. MessageBox.Show(this, "标题名称 [" + vTitle + "] 已经存在!");
  459. return;
  460. }
  461. model.Cid = vCid;
  462. model.Sid = vSid;
  463. model.Title = vTitle;
  464. model.SubTitle = vSubTitle;
  465. model.Title_Color = vTitle_Color;
  466. model.Title_Style = vTitle_Style;
  467. model.Author = vAuthor;
  468. model.Source = vSource;
  469. model.Jumpurl = vJumpurl;
  470. model.Keywords = vKeywords;
  471. model.Description = vDescription;
  472. model.Indexpic = vIndexpic;
  473. model.Views = vViews;
  474. this.model.DiggNumber = this.vDiggNumber;
  475. model.Commend = vCommend;
  476. model.IsComment = vIsComment;
  477. this.model.IsDigg = this.vIsDigg;
  478. model.Display = vDisplay;
  479. model.Createtime = vCreatetime;
  480. model.Modifytime = vModifytime;
  481. model.OrderNum = vOrderNum;
  482. model.Contents = vContents;
  483. model.FieldsInfo = vFieldsInfo;
  484. model.CreatorID = SysLoginUserID;
  485. model.ModifyID = SysLoginUserID;
  486. bll.Add(model);
  487. int maxID = bll.GetMaxID();
  488. bll_upload.UpdateUploadFile(vContents, 1, maxID, vCid);
  489. bll_upload.UpdateUploadFile(vFieldsInfo, 1, maxID, vCid);
  490. Response.Redirect(ViewState["reJumpUrl"].ToString());
  491. }
  492. }
  493. protected void Button_Submit_Click_Edit(object sender, EventArgs e)
  494. {
  495. if (Fun_GetValue() == true)
  496. {
  497. if (bll.GetRecordCount("ID <> " + vID + " And Title = '" + vTitle + "'") > 0)
  498. {
  499. MessageBox.Show(this, "标题名称 [" + vTitle + "] 已经存在!");
  500. return;
  501. }
  502. model = bll.GetModel(vID);
  503. model.ID = vID;
  504. model.Cid = vCid;
  505. // model.Sid = vSid;
  506. model.Title = vTitle;
  507. model.SubTitle = vSubTitle;
  508. model.Title_Color = vTitle_Color;
  509. model.Title_Style = vTitle_Style;
  510. model.Author = vAuthor;
  511. model.Source = vSource;
  512. model.Jumpurl = vJumpurl;
  513. model.Keywords = vKeywords;
  514. model.Description = vDescription;
  515. model.Indexpic = vIndexpic;
  516. // model.Views = vViews;
  517. // this.model.DiggNumber = this.vDiggNumber;
  518. model.Commend = vCommend;
  519. model.IsComment = vIsComment;
  520. this.model.IsDigg = this.vIsDigg;
  521. model.Display = vDisplay;
  522. model.Createtime = vCreatetime;
  523. model.Modifytime = vModifytime;
  524. model.OrderNum = vOrderNum;
  525. model.Contents = vContents;
  526. model.FieldsInfo = vFieldsInfo;
  527. // model.CreatorID = SysLoginUserID;
  528. model.ModifyID = SysLoginUserID;
  529. bll.Update(model);
  530. bll_upload.UpdateUploadFile_Reset(1, vID, vCid); //重置上传表中的数据
  531. bll_upload.UpdateUploadFile(vContents, 1, vID, vCid);
  532. bll_upload.UpdateUploadFile(vFieldsInfo, 1, vID, vCid);
  533. Response.Redirect(ViewState["reJumpUrl"].ToString());
  534. }
  535. }
  536. #endregion
  537. #region Delete 数据删除
  538. protected void Fun_Delete(int byID)
  539. {
  540. if (v_ViewList.Trim() != "1")
  541. {
  542. int byCID = int.Parse(bll.GetModel(byID).Cid.ToString());
  543. if (bll.Delete(byID) == true)
  544. {
  545. bll_upload.UpdateUploadFile_Reset(1, byID, byCID); //重置上传表中的数据
  546. Response.Redirect(Request.UrlReferrer.AbsoluteUri);
  547. }
  548. }
  549. else {
  550. Response.Redirect(Request.UrlReferrer.AbsoluteUri);
  551. }
  552. }
  553. #endregion
  554. #region 数据批量操作
  555. protected void Fun_Deletes()
  556. {
  557. if (v_ViewList.Trim() != "1")
  558. {
  559. string vIDs;
  560. vIDs = Request.Form["ids"].ToString();
  561. if (bll.DeleteList(vIDs) == true)
  562. {
  563. //标记上传表中的数据
  564. Helper.SQLHelper.ExecuteSql("update [iNethinkCMS_Upload] set [UpType]=0 ,[Aid]=0 ,[Cid]=0 Where [Aid] In (" + vIDs + ") And [UpType]=1");
  565. Response.Redirect(Request.UrlReferrer.AbsoluteUri);
  566. }
  567. }
  568. else
  569. {
  570. Response.Redirect(Request.UrlReferrer.AbsoluteUri);
  571. }
  572. }
  573. protected string Fun_GetLockImg(object byLocking)
  574. {
  575. if (byLocking != null && byLocking.ToString() == "1")
  576. {
  577. return "<img alt=\"锁定\" src=\"../admin/skin/images/lock_48px.png\" width=\"16\" style=\" float:left;\" />";
  578. }
  579. else
  580. {
  581. return "";
  582. }
  583. }
  584. protected string Fun_GetOperateHtml(object byID, object byLocking,object byUID)
  585. {
  586. if (v_ViewList.Trim() != "1")
  587. {
  588. if (byLocking != null && byLocking.ToString() == "1")
  589. {
  590. return "编辑&nbsp;&nbsp;删除";
  591. }
  592. else
  593. {
  594. return "<a href=\"?act=guide&pcid=" + this.v_pCID + "&id=" + byID.ToString() + "\">编辑</a>&nbsp;&nbsp;" +
  595. "<a href=\"javascript:if(confirm('您确定要删除这条记录吗?')){goJump('?act=delete&id=" + byID.ToString() + "');}\">删除</a>";
  596. }
  597. }
  598. else {
  599. return iNethinkCMS.BLL.BLL_iNethinkCMS_User.GetIDToUserTrueName(Convert.ToInt32(byUID.ToString()));
  600. }
  601. }
  602. protected void Fun_Audit()
  603. {
  604. string vIDs;
  605. vIDs = Request.Form["ids"].ToString();
  606. if (bll.AuditList(vIDs) == true)
  607. {
  608. Response.Redirect(Request.UrlReferrer.AbsoluteUri);
  609. }
  610. }
  611. protected void Fun_Move()
  612. {
  613. int vMoveCid;
  614. string vIDs;
  615. vMoveCid = int.Parse(this.moveCID.Text);
  616. vIDs = Request.Form["ids"].ToString();
  617. if (bll.MoveList(vMoveCid, vIDs) == true)
  618. {
  619. Helper.SQLHelper.ExecuteSql("update [iNethinkCMS_Upload] set [Cid]=" + vMoveCid + " Where [UpType]=1 And [Aid] In (" + vIDs + ")");
  620. Response.Redirect(Request.UrlReferrer.AbsoluteUri);
  621. }
  622. }
  623. #endregion
  624. #region 转换/获取相关信息
  625. //栏目名称
  626. protected string Fun_ChannleInfo(object byCID)
  627. {
  628. byCID = Convert.ToInt32(byCID);
  629. DataTable dt = bll_column.GetList("Cid=" + byCID).Tables[0];
  630. if (dt != null && dt.Rows.Count > 0)
  631. {
  632. return dt.Rows[0]["Name"].ToString();
  633. }
  634. else
  635. {
  636. return "";
  637. }
  638. }
  639. //专题名称
  640. protected string Fun_SpecialInfo(object bySID)
  641. {
  642. bySID = Convert.ToInt32(bySID);
  643. DataTable dt = bll_special.GetList("ID=" + bySID).Tables[0];
  644. if (dt != null && dt.Rows.Count > 0)
  645. {
  646. return "<span title=\"" + dt.Rows[0]["SpecialName"].ToString() + "\">[专]</span>";
  647. }
  648. else
  649. {
  650. return "";
  651. }
  652. }
  653. protected string Fun_ShowCustomFieldsTitle()
  654. {
  655. //v_pCID
  656. string retShowCustomFieldsTitle = "";
  657. if (TbCustomfields != null && TbCustomfields.Rows.Count>0)
  658. {
  659. for (int i = 0; i < TbCustomfields.Rows.Count; i++)
  660. {
  661. string vCustomTitleShow = TbCustomfields.Rows[i]["AtTitleShow"].ToString();
  662. if (vCustomTitleShow.Trim() == "1")
  663. {
  664. retShowCustomFieldsTitle += "<td width=\"120\">" + TbCustomfields.Rows[i]["CustomFieldsName"].ToString() + "</td>";
  665. }
  666. }
  667. }
  668. return retShowCustomFieldsTitle;
  669. }
  670. protected string Fun_ShowCustomFields(object byFieldsInfo)
  671. {
  672. string retShowCustomFieldsValue = "";
  673. if (TbCustomfields != null && TbCustomfields.Rows.Count > 0)
  674. {
  675. for (int i = 0; i < TbCustomfields.Rows.Count; i++)
  676. {
  677. string vCustomTitleShow = TbCustomfields.Rows[i]["AtTitleShow"].ToString();
  678. if (vCustomTitleShow.Trim() == "1")
  679. {
  680. retShowCustomFieldsValue += "<td>" + Web.UI.WebUI_Function.Fun_GetFieldsInfo(TbCustomfields.Rows[i]["CustomFieldsKey"].ToString()+"_Text", byFieldsInfo.ToString()) + "</td>";
  681. }
  682. }
  683. }
  684. return retShowCustomFieldsValue;
  685. }
  686. protected string Fun_DisplayInfo(object byDisplay)
  687. {
  688. return byDisplay.ToString() == "0" ? "<font color=\"#ff0000\">未发布</font>" : "发布";
  689. }
  690. protected string Fun_ExpanInfo(object byCommend, object byIsComment)
  691. {
  692. string tmpInfo = "";
  693. tmpInfo = byCommend.ToString() == "1" ? "<img alt=\"推荐\" src=\"/admin/skin/images/ico_01.gif\" />" : "";
  694. //tmpInfo += byIsComment.ToString() == "1" ? "&nbsp;[评]" : "";
  695. return tmpInfo;
  696. }
  697. #endregion
  698. #region 扩展搜索功能
  699. protected void Do_ExtSearch(object sender, EventArgs e)
  700. {
  701. v_sCID = Request.Form["sCID"] != null ? Request.Form["sCID"] : "";
  702. v_sSID = Request.Form["sSID"] != null ? Request.Form["sSID"] : "";
  703. v_sDisplay = Request.Form["sDisplay"] != null ? Request.Form["sDisplay"] : "";
  704. v_sCommend = Request.Form["sCommend"] != null ? Request.Form["sCommend"] : "";
  705. v_sIsComment = Request.Form["sIsComment"] != null ? Request.Form["sIsComment"] : "";
  706. 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);
  707. }
  708. #endregion
  709. #region 专题下拉列表输出
  710. protected void BindDropdownList_Special(DropDownList byDropDownList)
  711. {
  712. DataTable dt = bll_special.GetList(0, "[Display] = 1", "OrderNum Desc").Tables[0];
  713. for (int i = 0; i < dt.Rows.Count; i++)
  714. {
  715. byDropDownList.Items.Add(new ListItem(dt.Rows[i]["SpecialName"].ToString(), dt.Rows[i]["ID"].ToString()));
  716. }
  717. }
  718. #endregion
  719. #region 栏目下拉列表输出
  720. /// <summary>
  721. /// 获取指定栏目ID下的所以子栏目ID 以“,”号分隔
  722. /// </summary>
  723. /// <param name="byCid"></param>
  724. /// <returns></returns>
  725. string GetChannelChildIDs(string byCid, DataRow[] byRows)
  726. {
  727. string reChilds = "";
  728. foreach (DataRow row in byRows)
  729. {
  730. if (row["FatherID"].ToString().Trim() == byCid.Trim())//绑定根节点
  731. {
  732. reChilds += row["Cid"].ToString().Trim() + ",";
  733. DataRow[] tempRows = TbChannelDataTable.Select("FatherID=" + row["Cid"].ToString());
  734. if (tempRows != null && tempRows.Length > 0)
  735. {
  736. reChilds += GetChannelChildIDs(row["Cid"].ToString(), tempRows);
  737. }
  738. }
  739. }
  740. return reChilds.Trim(',');
  741. }
  742. DataTable GetTbChannelDataTable()
  743. {
  744. string vSqlWhere = "[Mold] = 1";
  745. if (String.IsNullOrEmpty(SysRegisteredUsersChannelPower))
  746. {
  747. vSqlWhere += " And [ID] = 0";
  748. }
  749. else if (SysRegisteredUsersChannelPower != "0")
  750. {
  751. vSqlWhere += " And [ID] In (" + SysRegisteredUsersChannelPower + ")";
  752. }
  753. DataTable dt = bll_column.GetList(0, vSqlWhere, "OrderNum Desc").Tables[0];
  754. return dt;
  755. }
  756. /// <summary>
  757. /// 绑定DropDownList;
  758. /// </summary>
  759. protected void BindDropdownList(DropDownList byDropDownList)
  760. {
  761. /* string vSqlWhere = "[Mold] = 1";
  762. if (String.IsNullOrEmpty(SysRegisteredUsersChannelPower))
  763. {
  764. vSqlWhere += " And [ID] = 0";
  765. }
  766. else if (SysRegisteredUsersChannelPower != "0")
  767. {
  768. vSqlWhere += " And [ID] In (" + SysRegisteredUsersChannelPower + ")";
  769. }*/
  770. DataTable dt = TbChannelDataTable; //bll_column.GetList(0, vSqlWhere, "OrderNum Desc").Tables[0];
  771. //this.txtCid.Items.Insert(0, new ListItem("请选择所属栏目", "0"));
  772. if (dt.Rows.Count > 0)
  773. {
  774. this.vBlockCIDs = v_pCID;
  775. foreach (DataRow row in dt.Rows)
  776. {
  777. if (row["FatherID"].ToString().Trim() == v_pCID)//绑定根节点
  778. {
  779. this.vBlockCIDs += "," + row["CID"].ToString();
  780. byDropDownList.Items.Add(new ListItem(row["Name"].ToString(), row["CID"].ToString()));
  781. this.bindChildItem(byDropDownList, dt, row["CID"].ToString(), 1);
  782. }
  783. }
  784. this.vSQL = " [CID] in (" + this.vBlockCIDs + ") and (" + this.vSQL + ")";
  785. }
  786. else
  787. {
  788. if (byDropDownList.ID == "txtCid")
  789. {
  790. byDropDownList.Items.Add(new ListItem("尚未添加任何栏目/无栏目管理权限!", "0"));
  791. }
  792. }
  793. }
  794. protected void bindChildItem(DropDownList byDropDownList, DataTable dt, string id, int length)
  795. {
  796. DataRow[] rows = dt.Select("FatherID=" + id + "", "OrderNum Desc");
  797. for (int i = 0; i < rows.Length; i++)
  798. {
  799. byDropDownList.Items.Add(new ListItem(WebUI_Function.SpaceLength(length) + "├ " + rows[i]["Name"].ToString(), rows[i]["CID"].ToString()));
  800. this.bindChildItem(byDropDownList, dt, rows[i]["CID"].ToString(), length + 1);
  801. }
  802. }
  803. #endregion
  804. }
  805. }