manage.aspx.cs 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. using iNethinkCMS.Command;
  2. using iNethinkCMS.Helper;
  3. using iNethinkCMS.Web.UI;
  4. using System;
  5. using System.Web.UI.HtmlControls;
  6. using System.Web.UI.WebControls;
  7. namespace iNethinkCMS.Web.plugs.digg
  8. {
  9. public class manage : Admin_BasePage
  10. {
  11. private string vXmlPath = "/plugs/digg/setting.xml";
  12. private string vState;
  13. private string vDiggMaxPoint;
  14. private string vTimeinterval;
  15. private string vUserDisModel;
  16. private string vCookieKey;
  17. protected HtmlForm form_comment_digg;
  18. protected DropDownList txtState;
  19. protected TextBox txtDiggMaxPoint;
  20. protected TextBox txtTimeinterval;
  21. protected DropDownList txtUserDisModel;
  22. protected TextBox txtCookieKey;
  23. protected Button Button_Submit;
  24. protected void Page_Load(object sender, EventArgs e)
  25. {
  26. base.CheckUserPower("c");
  27. if (!base.IsPostBack)
  28. {
  29. if (base.Request.UrlReferrer != null)
  30. {
  31. this.ViewState["reJumpUrl"] = base.Request.UrlReferrer.AbsoluteUri;
  32. }
  33. else
  34. {
  35. this.ViewState["reJumpUrl"] = base.Request.Url.AbsoluteUri;
  36. }
  37. this.vState = XMLHelper.GetXmlAttribute(base.Server.MapPath(this.vXmlPath), "//plugs//config//key[@name=\"state\"]", "value").Value.Trim();
  38. this.vDiggMaxPoint = XMLHelper.GetXmlAttribute(base.Server.MapPath(this.vXmlPath), "//plugs//config//key[@name=\"diggmaxpoint\"]", "value").Value.Trim();
  39. this.vTimeinterval = XMLHelper.GetXmlAttribute(base.Server.MapPath(this.vXmlPath), "//plugs//config//key[@name=\"timeinterval\"]", "value").Value.Trim();
  40. this.vUserDisModel = XMLHelper.GetXmlAttribute(base.Server.MapPath(this.vXmlPath), "//plugs//config//key[@name=\"userdismodel\"]", "value").Value.Trim();
  41. this.vCookieKey = XMLHelper.GetXmlAttribute(base.Server.MapPath(this.vXmlPath), "//plugs//config//key[@name=\"cookiekey\"]", "value").Value.Trim();
  42. this.txtState.SelectedValue = this.vState;
  43. this.txtDiggMaxPoint.Text = this.vDiggMaxPoint;
  44. this.txtTimeinterval.Text = this.vTimeinterval;
  45. this.txtUserDisModel.SelectedValue = this.vUserDisModel;
  46. this.txtCookieKey.Text = this.vCookieKey;
  47. }
  48. }
  49. protected void Button_Submit_Click(object sender, EventArgs e)
  50. {
  51. this.vState = this.txtState.SelectedValue;
  52. this.vDiggMaxPoint = this.txtDiggMaxPoint.Text.Trim();
  53. this.vTimeinterval = this.txtTimeinterval.Text.Trim();
  54. this.vUserDisModel = this.txtUserDisModel.SelectedValue;
  55. this.vCookieKey = this.txtCookieKey.Text.Trim();
  56. if (!Command_Validate.IsNumber(this.vDiggMaxPoint))
  57. {
  58. MessageBox.Show(this, "投票最大分值只能为数字!");
  59. return;
  60. }
  61. if (!Command_Validate.IsNumber(this.vTimeinterval))
  62. {
  63. MessageBox.Show(this, "时间间隔只能为数字!");
  64. return;
  65. }
  66. if (this.vCookieKey == "")
  67. {
  68. MessageBox.Show(this, "请输入COOKIE标识!");
  69. return;
  70. }
  71. XMLHelper.CreateOrUpdateXmlAttributeByXPath(base.Server.MapPath(this.vXmlPath), "//plugs//config//key[@name=\"state\"]", "value", this.vState);
  72. XMLHelper.CreateOrUpdateXmlAttributeByXPath(base.Server.MapPath(this.vXmlPath), "//plugs//config//key[@name=\"diggmaxpoint\"]", "value", this.vDiggMaxPoint);
  73. XMLHelper.CreateOrUpdateXmlAttributeByXPath(base.Server.MapPath(this.vXmlPath), "//plugs//config//key[@name=\"timeinterval\"]", "value", this.vTimeinterval);
  74. XMLHelper.CreateOrUpdateXmlAttributeByXPath(base.Server.MapPath(this.vXmlPath), "//plugs//config//key[@name=\"userdismodel\"]", "value", this.vUserDisModel);
  75. XMLHelper.CreateOrUpdateXmlAttributeByXPath(base.Server.MapPath(this.vXmlPath), "//plugs//config//key[@name=\"cookiekey\"]", "value", this.vCookieKey);
  76. base.Response.Redirect(this.ViewState["reJumpUrl"].ToString());
  77. }
  78. }
  79. }