Advanced.aspx
上传用户:lanchensha
上传日期:2022-02-27
资源大小:7530k
文件大小:43k
源码类别:

编辑器/阅读器

开发平台:

C#

  1. <%@ Page Language="C#" AutoEventWireup="true"%>
  2. <%@ Import Namespace="DotNetTextBox" %>
  3. <%@ Import Namespace="System.IO" %>
  4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  5. <html xmlns="http://www.w3.org/1999/xhtml" >
  6. <head runat="server">
  7.     <title>上传功能高级设置</title>
  8.     <link href="stylesheet.css" rel="stylesheet" type="text/css" />
  9.     <base target="_self" />
  10.     <script runat=server language="C#">
  11.         DotNetTextBox.doctextboxdb boxdb, _db;
  12.         protected void Page_Load(object sender, EventArgs e)
  13.         {
  14.             if (!IsPostBack)
  15.             {
  16.                 bind();
  17.             }
  18.         }
  19.         protected void bind()
  20.         {
  21.             boxdb = new doctextboxdb();
  22.             _db = new doctextboxdb();
  23.             Response.Expires = -1;
  24.             System.Collections.ArrayList mylist;
  25.             if (Request.Cookies["uploadConfig"] != null)
  26.             {
  27.                 //获取配置文件内容
  28.                 mylist = boxdb.get_the_xmlmessage(Request.Cookies["uploadConfig"].Value.ToLower());
  29.             }
  30.             else
  31.             {
  32.                 mylist = boxdb.get_the_xmlmessage(HttpContext.Current.Request.PhysicalApplicationPath + "/system_dntb/uploadconfig/default.config");
  33.             }
  34.             //获取条件配置内容
  35.             System.Collections.ArrayList _list = _db.get_the_xmlmessage(Server.MapPath("Advanced.config"));
  36.             //判断上传文件夹的最大可用空间是否起用
  37.             if (_list[1].ToString().Equals("0"))
  38.             {
  39.                 this.maxAllUploadSize.Enabled = false;
  40.                 RangeValidator1.Enabled = false;
  41.                 this.Button3.Enabled = false;
  42.             }
  43.             //判断设置上传文件单个的最大尺寸是否起用
  44.             if (_list[2].ToString().Equals("0"))
  45.             {
  46.                 this.maxSingleUploadSize.Enabled = false;
  47.                 RangeValidator2.Enabled = false;
  48.                 this.Button1.Enabled = false;
  49.             }
  50.             //判断设置上传文件是否自动改名是否起用
  51.             if (_list[3].ToString().Equals("0"))
  52.             {
  53.                 this.autoname.Enabled = false;
  54.                 Button4.Enabled = false;
  55.             }
  56.             //判断设置是否允许上传是否起用
  57.             if (_list[4].ToString().Equals("0"))
  58.             {
  59.                 this.allowUpload.Enabled = false;
  60.                 this.Button5.Enabled = false;
  61.             }
  62.             //是否在上传界面启用水印选择是否起用
  63.             if (_list[5].ToString().Equals("0"))
  64.             {
  65.                 this.watermarkOption.Enabled = false;
  66.                 this.Button6.Enabled = false;
  67.             }
  68.             //判断是否启用上传图片的文字水印是否起用
  69.             if (_list[6].ToString().Equals("0"))
  70.             {
  71.                 this.watermark.Enabled = false;
  72.                 this.Button7.Enabled = false;
  73.             }
  74.             //开启文字水印后是否保留原件并新建副本是否起用
  75.             if (_list[7].ToString().Equals("0"))
  76.             {
  77.                 this.watermarkName.Enabled = false;
  78.                 this.Button8.Enabled = false;
  79.             }
  80.             //设置水印文字是否起用
  81.             if (_list[8].ToString().Equals("0"))
  82.             {
  83.                 this.watermarkText.Enabled = false;
  84.                 this.Button9.Enabled = false;
  85.             }
  86.             //是否启用上传图片的图片水印是否起用
  87.             if (_list[9].ToString().Equals("0"))
  88.             {
  89.                 this.watermarkImages.Enabled = false;
  90.                 this.Button10.Enabled = false;
  91.             }
  92.             //开启图片水印后是否保留原件并新建副本是否起用
  93.             if (_list[10].ToString().Equals("0"))
  94.             {
  95.                 this.watermarkImagesName.Enabled = false;
  96.                 this.Button11.Enabled = false;
  97.             }
  98.             if (_list[11].ToString().Equals("0"))
  99.             {
  100.                 this.watermarkImages_path.Enabled = false;
  101.                 this.FileUpload1.Enabled = false;
  102.                 this.Button2.Enabled = false;
  103.                 this.Button12.Enabled = false;
  104.             }
  105.             //是否启用缩略图是否起用
  106.             if (_list[12].ToString().Equals("0"))
  107.             {
  108.                 this.smallImages.Enabled = false;
  109.                 this.Button13.Enabled = false;
  110.             }
  111.             //开启缩略图后是否保留原件并新建副本是否起用
  112.             if (_list[13].ToString().Equals("0"))
  113.             {
  114.                 this.smallImagesName.Enabled = false;
  115.                 this.Button14.Enabled = false;
  116.             }
  117.             //缩略图缩放类型是否起用
  118.             if (_list[14].ToString().Equals("0"))
  119.             {
  120.                 this.smallImagesType.Enabled = false;
  121.                 this.Button15.Enabled = false;
  122.             }
  123.             //缩略图宽度是否起用
  124.             if (_list[15].ToString().Equals("0"))
  125.             {
  126.                 this.smallImagesW.Enabled = false;
  127.                 RangeValidator3.Enabled = false;
  128.                 this.Button16.Enabled = false;
  129.             }
  130.             //缩略图高度是否起用
  131.             if (_list[16].ToString().Equals("0"))
  132.             {
  133.                 this.smallImagesH.Enabled = false;
  134.                 RangeValidator4.Enabled = false;
  135.                 this.Button17.Enabled = false;
  136.             }
  137.             //是否允许删除文件是否起用
  138.             if (_list[17].ToString().Equals("0"))
  139.             {
  140.                 this.delete.Enabled = false;
  141.                 this.Button18.Enabled = false;
  142.             }
  143.             //是否允许文件重命名是否起用
  144.             if (_list[18].ToString().Equals("0"))
  145.             {
  146.                 this.edit.Enabled = false;
  147.                 this.Button19.Enabled = false;
  148.             }
  149.             //是否显示文件列表是否起用
  150.             if (_list[19].ToString().Equals("0"))
  151.             {
  152.                 this.fileListBox.Enabled = false;
  153.                 this.Button20.Enabled = false;
  154.             }
  155.             //上传文件功能可上传的文件类型是否起用
  156.             if (_list[20].ToString().Equals("0"))
  157.             {
  158.                 this.fileFilters.Enabled = false;
  159.                 this.Button21.Enabled = false;
  160.             }
  161.             //上传图片功能可上传的文件类型是否起用
  162.             if (_list[21].ToString().Equals("0"))
  163.             {
  164.                 this.imagesFilters.Enabled = false;
  165.                 this.Button22.Enabled = false;
  166.             }
  167.             //上传自动播放文件功能可上传的文件类型是否起用
  168.             if (_list[22].ToString().Equals("0"))
  169.             {
  170.                 this.mediaFilters.Enabled = false;
  171.                 this.Button23.Enabled = false;
  172.             }
  173.             //上传模板功能可上传的文件类型是否起用
  174.             if (_list[23].ToString().Equals("0"))
  175.             {
  176.                 this.templateFilters.Enabled = false;
  177.                 this.Button24.Enabled = false;
  178.             }
  179.             //上传文件夹的最大可用空间
  180.             this.maxAllUploadSize.Text = mylist[1].ToString();
  181.             //上传文件单个的最大尺寸
  182.             this.maxSingleUploadSize.Text = mylist[2].ToString();
  183.             //上传文件是否自动改名
  184.             for (int i = 0; i < this.autoname.Items.Count; i++)
  185.             {
  186.                 if (this.autoname.Items[i].Value.Equals(mylist[3].ToString()))
  187.                 {
  188.                     this.autoname.Items[i].Selected = true;
  189.                 }
  190.             }
  191.             //是否允许上传
  192.             for (int i = 0; i < this.allowUpload.Items.Count; i++)
  193.             {
  194.                 if (this.allowUpload.Items[i].Value.Equals(mylist[4].ToString()))
  195.                 {
  196.                     this.allowUpload.Items[i].Selected = true;
  197.                 }
  198.             }
  199.             //在上传界面启用水印选择
  200.             for (int i = 0; i < this.watermarkOption.Items.Count; i++)
  201.             {
  202.                 if (this.watermarkOption.Items[i].Value.Equals(mylist[5].ToString()))
  203.                 {
  204.                     this.watermarkOption.Items[i].Selected = true;
  205.                 }
  206.             }
  207.             //启用上传图片的文字水印
  208.             for (int i = 0; i < watermark.Items.Count; i++)
  209.             {
  210.                 if (this.watermark.Items[i].Value.Equals(mylist[6].ToString()))
  211.                 {
  212.                     this.watermark.Items[i].Selected = true;
  213.                 }
  214.             }
  215.             //开启文字水印后是否保留原件并新建副本
  216.             for (int i = 0; i < this.watermarkName.Items.Count; i++)
  217.             {
  218.                 if (this.watermarkName.Items[i].Value.Equals(mylist[7].ToString()))
  219.                 {
  220.                     this.watermarkName.Items[i].Selected = true;
  221.                 }
  222.             }
  223.             //水印文字
  224.             this.watermarkText.Text = mylist[8].ToString();
  225.             //是否启用上传图片的图片水印
  226.             for (int i = 0; i < this.watermarkImages.Items.Count; i++)
  227.             {
  228.                 if (this.watermarkImages.Items[i].Value.Equals(mylist[9].ToString()))
  229.                 {
  230.                     this.watermarkImages.Items[i].Selected = true;
  231.                 }
  232.             }
  233.             //图片水印后是否保留原件并新建副本
  234.             for (int i = 0; i < watermarkImagesName.Items.Count; i++)
  235.             {
  236.                 if (this.watermarkImagesName.Items[i].Value.Equals(mylist[10].ToString()))
  237.                 {
  238.                     this.watermarkImagesName.Items[i].Selected = true;
  239.                 }
  240.             }
  241.             //图片水印所在的位置
  242.             this.watermarkImages_path.Text = mylist[11].ToString();
  243.             //是否启用缩略图
  244.             for (int i = 0; i < this.smallImages.Items.Count; i++)
  245.             {
  246.                 if (this.smallImages.Items[i].Value.Equals(mylist[12].ToString()))
  247.                 {
  248.                     this.smallImages.Items[i].Selected = true;
  249.                 }
  250.             }
  251.             //开启缩略图后是否保留原件并新建副本
  252.             for (int i = 0; i < this.smallImagesName.Items.Count; i++)
  253.             {
  254.                 if (this.smallImagesName.Items[i].Value.Equals(mylist[13].ToString()))
  255.                 {
  256.                     this.smallImagesName.Items[i].Selected = true;
  257.                 }
  258.             }
  259.             //缩略图缩放类型,HW:指定高宽缩放(可能变形)。W:指定宽,高按比例。H:指定高,宽按比例。Cut:指定高宽裁减(不变形)
  260.             for (int i = 0; i < this.smallImagesType.Items.Count; i++)
  261.             {
  262.                 if (this.smallImagesType.Items[i].Text.Equals(mylist[14].ToString()))
  263.                 {
  264.                     this.smallImagesType.Items[i].Selected = true;
  265.                 }
  266.             }
  267.             //缩略图宽度
  268.             this.smallImagesW.Text = mylist[15].ToString();
  269.             //缩略图高度
  270.             this.smallImagesH.Text = mylist[16].ToString();
  271.             //是否允许删除文件
  272.             for (int i = 0; i < this.delete.Items.Count; i++)
  273.             {
  274.                 if (this.delete.Items[i].Value.Equals(mylist[17].ToString()))
  275.                 {
  276.                     this.delete.Items[i].Selected = true;
  277.                 }
  278.             }
  279.             //是否允许文件重命名
  280.             for (int i = 0; i < this.edit.Items.Count; i++)
  281.             {
  282.                 if (this.edit.Items[i].Value.Equals(mylist[18].ToString()))
  283.                 {
  284.                     this.edit.Items[i].Selected = true;
  285.                 }
  286.             }
  287.             //是否显示文件列表
  288.             for (int i = 0; i < this.fileListBox.Items.Count; i++)
  289.             {
  290.                 if (this.fileListBox.Items[i].Value.Equals(mylist[19].ToString()))
  291.                 {
  292.                     this.fileListBox.Items[i].Selected = true;
  293.                 }
  294.             }
  295.             //上传文件功能可上传的文件类型
  296.             this.fileFilters.Text = mylist[20].ToString();
  297.             //上传图片功能可上传的文件类型
  298.             this.imagesFilters.Text = mylist[21].ToString();
  299.             //上传自动播放文件功能可上传的文件类型
  300.             this.mediaFilters.Text = mylist[22].ToString();
  301.             //上传模板功能可上传的文件类型
  302.             this.templateFilters.Text = mylist[23].ToString();
  303.         }
  304.         /// <summary>
  305.         /// 上传图片到textbox
  306.         /// </summary>
  307.         /// <param name="sender"></param>
  308.         /// <param name="e"></param>
  309.         protected void Button2_Click(object sender, EventArgs e)
  310.         {
  311.             DirectoryInfo d = new DirectoryInfo(Path.GetFullPath(Server.MapPath(Request.Cookies["uploadFolder"].Value.ToLower())));
  312.             FileInfo[] fis = d.GetFiles();
  313.             Double Size = 0;
  314.             ArrayList showfile = new ArrayList();
  315.             string[] Filters = this.imagesFilters.Text.Split(',');
  316.             foreach (FileInfo fi in fis)
  317.             {
  318.                 Size += fi.Length;
  319.                 for (int i = 0; i <= Filters.Length - 1; i++)
  320.                 {
  321.                     if (fi.Extension.ToLower() == "." + Filters[i].ToString().ToLower())
  322.                     {
  323.                         showfile.Add(fi);
  324.                         break;
  325.                     }
  326.                 }
  327.             }
  328.             Size = Convert.ToDouble((Double)Size / 1024);
  329.             if (Size < Double.Parse(this.maxAllUploadSize.Text))
  330.             {
  331.                 if (Request.Cookies["uploadFolder"] != null)
  332.                 {
  333.                     if (this.FileUpload1.PostedFile.FileName != null && this.FileUpload1.PostedFile.FileName != "" && this.FileUpload1.PostedFile.ContentLength <= Double.Parse(this.maxSingleUploadSize.Text) * 1024)
  334.                     {
  335.                         this.FileUpload1.PostedFile.SaveAs(Server.MapPath(Request.Cookies["uploadFolder"].Value.ToLower() + "logo.gif"));
  336.                         this.watermarkImages_path.Text = Request.Cookies["uploadFolder"].Value.ToLower() + "logo.gif";
  337.                         ClientScript.RegisterStartupScript(typeof(Page), "Key", "alert('上传成功!')", true);
  338.                     }
  339.                     else
  340.                     {
  341.                         ClientScript.RegisterStartupScript(typeof(Page), "Key", "alert('上传失败,文件超过限制大小或文件名为空!')", true);
  342.                     }
  343.                 }
  344.                 else
  345.                 {
  346.                     ClientScript.RegisterStartupScript(typeof(Page), "Key", "alert('上传失败,空间已满!')", true);
  347.                 }
  348.             }
  349.         }
  350.         /// <summary>
  351.         /// 设置上传文件夹的最大可用空间(单位KB)
  352.         /// </summary>
  353.         /// <param name="sender"></param>
  354.         /// <param name="e"></param>
  355.         protected void Button3_Click(object sender, EventArgs e)
  356.         {
  357.             xml_update(Button3, "maxAllUploadSize", maxAllUploadSize.Text.Trim());
  358.         }
  359.         /// <summary>
  360.         /// 设置上传文件单个的最大尺寸(单位KB)
  361.         /// </summary>
  362.         /// <param name="sender"></param>
  363.         /// <param name="e"></param>
  364.         protected void Button1_Click(object sender, EventArgs e)
  365.         {
  366.             xml_update(Button1, "maxSingleUploadSize", maxSingleUploadSize.Text.Trim());
  367.         }
  368.         /// <summary>
  369.         /// 设置上传文件是否自动改名
  370.         /// </summary>
  371.         /// <param name="sender"></param>
  372.         /// <param name="e"></param>
  373.         protected void Button4_Click(object sender, EventArgs e)
  374.         {
  375.             xml_update(Button4, "autoname", autoname.SelectedValue);
  376.         }
  377.         /// <summary>
  378.         /// 设置是否允许上传
  379.         /// </summary>
  380.         /// <param name="sender"></param>
  381.         /// <param name="e"></param>
  382.         protected void Button5_Click(object sender, EventArgs e)
  383.         {
  384.             xml_update(Button5, "allowUpload", allowUpload.SelectedValue);
  385.         }
  386.         /// <summary>
  387.         /// 通用帮助函数
  388.         /// </summary>
  389.         /// <param name="button"></param>
  390.         /// <param name="jiedianname"></param>
  391.         /// <param name="the_value"></param>
  392.         private void xml_update(Button button, string jiedianname, string the_value)
  393.         {
  394.             boxdb = new doctextboxdb();
  395.             string path;
  396.             if (Request.Cookies["uploadConfig"] != null)
  397.             {
  398.                 //获取配置文件内容
  399.                 path = Request.Cookies["uploadConfig"].Value.ToLower();
  400.             }
  401.             else
  402.             {
  403.                 path = HttpContext.Current.Request.PhysicalApplicationPath + "/system_dntb/uploadconfig/default.config";
  404.             }
  405.             bool check = boxdb.update_xml(path, "configuration", jiedianname, the_value);
  406.             if (check) { button.Text = "更新成功"; } else { button.Text = "更新失败,点击重新更新"; }
  407.             ClientScript.RegisterStartupScript(typeof(Page), "Key", "alert('更新成功!')", true);
  408.         }
  409.         /// <summary>
  410.         /// 是否在上传界面启用水印选择的选项on为开启,off为关闭
  411.         /// </summary>
  412.         /// <param name="sender"></param>
  413.         /// <param name="e"></param>
  414.         protected void Button6_Click(object sender, EventArgs e)
  415.         {
  416.             xml_update(Button6, "watermarkOption", watermarkOption.SelectedValue);
  417.             if (watermarkOption.SelectedItem.Text == "否")
  418.             {
  419.                 watermark.Enabled = false;
  420.                 watermarkName.Enabled = false;
  421.                 watermarkText.Enabled = false;
  422.                 watermarkImages.Enabled = false;
  423.                 watermarkImagesName.Enabled = false;
  424.                 watermarkImages_path.Enabled = false;
  425.                 this.FileUpload1.Enabled = false;
  426.                 Button2.Enabled = false;
  427.                 imagesFilters.Enabled = false;
  428.                 this.Button7.Enabled = false;
  429.                 this.Button8.Enabled = false;
  430.                 this.Button9.Enabled = false;
  431.                 this.Button10.Enabled = false;
  432.                 this.Button11.Enabled = false;
  433.                 this.Button12.Enabled = false;
  434.                 this.Button22.Enabled = false;
  435.             }
  436.             else
  437.             {
  438.                 watermark.Enabled = true;
  439.                 watermarkName.Enabled = true;
  440.                 watermarkText.Enabled = true;
  441.                 watermarkImages.Enabled = true;
  442.                 watermarkImagesName.Enabled = true;
  443.                 watermarkImages_path.Enabled = true;
  444.                 this.FileUpload1.Enabled = true;
  445.                 Button2.Enabled = true;
  446.                 imagesFilters.Enabled = true;
  447.                 this.Button7.Enabled = true;
  448.                 this.Button8.Enabled = true;
  449.                 this.Button9.Enabled = true;
  450.                 this.Button10.Enabled = true;
  451.                 this.Button11.Enabled = true;
  452.                 this.Button12.Enabled = true;
  453.                 this.Button22.Enabled = true;
  454.             }
  455.         }
  456.         /// <summary>
  457.         /// 是否启用上传图片的文字水印
  458.         /// </summary>
  459.         /// <param name="sender"></param>
  460.         /// <param name="e"></param>
  461.         protected void Button7_Click(object sender, EventArgs e)
  462.         {
  463.             xml_update(Button7, "watermark", watermark.SelectedValue);
  464.             if (watermark.SelectedItem.Text == "否")
  465.             {
  466.                 watermarkName.Enabled = false;
  467.                 watermarkText.Enabled = false;
  468.             }
  469.             else
  470.             {
  471.                 watermarkName.Enabled = true;
  472.                 watermarkText.Enabled = true;
  473.             }
  474.         }
  475.         /// <summary>
  476.         /// 开启文字水印后是否保留原件并新建副本,false为不新建,false以外的字符则新建副本,副本名称以该字符加原文件名命名
  477.         /// </summary>
  478.         /// <param name="sender"></param>
  479.         /// <param name="e"></param>
  480.         protected void Button8_Click(object sender, EventArgs e)
  481.         {
  482.             xml_update(Button8, "watermarkName", watermarkName.SelectedValue);
  483.         }
  484.         /// <summary>
  485.         /// 设置水印文字
  486.         /// </summary>
  487.         /// <param name="sender"></param>
  488.         /// <param name="e"></param>
  489.         protected void Button9_Click(object sender, EventArgs e)
  490.         {
  491.             xml_update(Button9, "watermarkText", watermarkText.Text.Trim());
  492.         }
  493.         /// <summary>
  494.         /// 是否启用上传图片的图片水印
  495.         /// </summary>
  496.         /// <param name="sender"></param>
  497.         /// <param name="e"></param>
  498.         protected void Button10_Click(object sender, EventArgs e)
  499.         {
  500.             xml_update(Button10, "watermarkImages", watermarkImages.SelectedValue);
  501.             if (watermarkImages.SelectedItem.Text == "否")
  502.             {
  503.                 watermarkImagesName.Enabled = false;
  504.                 watermarkImages_path.Enabled = false;
  505.                 this.Button2.Enabled = false;
  506.                 this.FileUpload1.Enabled = false;
  507.             }
  508.             else
  509.             {
  510.                 watermarkImagesName.Enabled = true;
  511.                 watermarkImages_path.Enabled = true;
  512.                 this.FileUpload1.Enabled = true;
  513.                 this.Button2.Enabled = true;
  514.             }
  515.         }
  516.         /// <summary>
  517.         /// 开启图片水印后是否保留原件并新建副本,false为不新建,false以外的字符则新建副本,副本名称以该字符加原文件名命名
  518.         /// </summary>
  519.         /// <param name="sender"></param>
  520.         /// <param name="e"></param>
  521.         protected void Button11_Click(object sender, EventArgs e)
  522.         {
  523.             xml_update(Button11, "watermarkImagesName", watermarkImagesName.SelectedValue);
  524.         }
  525.         /// <summary>
  526.         /// 设置图片水印所在的位置
  527.         /// </summary>
  528.         /// <param name="sender"></param>
  529.         /// <param name="e"></param>
  530.         protected void Button12_Click(object sender, EventArgs e)
  531.         {
  532.             xml_update(Button12, "watermarkImages_path", watermarkImages_path.Text.Trim());
  533.         }
  534.         /// <summary>
  535.         /// 是否启用缩略图
  536.         /// </summary>
  537.         /// <param name="sender"></param>
  538.         /// <param name="e"></param>
  539.         protected void Button13_Click(object sender, EventArgs e)
  540.         {
  541.             xml_update(Button13, "smallImages", smallImages.SelectedValue);
  542.             if (smallImages.SelectedItem.Text == "否")
  543.             {
  544.                 smallImagesName.Enabled = false;
  545.                 smallImagesType.Enabled = false;
  546.                 smallImagesW.Enabled = false;
  547.                 smallImagesH.Enabled = false;
  548.             }
  549.             else
  550.             {
  551.                 smallImagesName.Enabled = true;
  552.                 smallImagesType.Enabled = true;
  553.                 smallImagesW.Enabled = true;
  554.                 smallImagesH.Enabled = true;
  555.             }
  556.         }
  557.         /// <summary>
  558.         /// 开启缩略图后是否保留原件并新建副本,false为不新建,false以外的字符则新建副本,副本名称以该字符加原文件名命名
  559.         /// </summary>
  560.         /// <param name="sender"></param>
  561.         /// <param name="e"></param>
  562.         protected void Button14_Click(object sender, EventArgs e)
  563.         {
  564.             xml_update(Button14, "smallImagesName", smallImagesName.SelectedValue);
  565.         }
  566.         /// <summary>
  567.         /// 缩略图缩放类型,HW:指定高宽缩放(可能变形)。W:指定宽,高按比例。H:指定高,宽按比例。Cut:指定高宽裁减(不变形)
  568.         /// </summary>
  569.         /// <param name="sender"></param>
  570.         /// <param name="e"></param>
  571.         protected void Button15_Click(object sender, EventArgs e)
  572.         {
  573.             xml_update(Button15, "smallImagesType", smallImagesType.SelectedItem.Text);
  574.         }
  575.         /// <summary>
  576.         /// 缩略图宽度
  577.         /// </summary>
  578.         /// <param name="sender"></param>
  579.         /// <param name="e"></param>
  580.         protected void Button16_Click(object sender, EventArgs e)
  581.         {
  582.             xml_update(Button16, "smallImagesW", smallImagesW.Text.Trim());
  583.         }
  584.         /// <summary>
  585.         /// 缩略图高度
  586.         /// </summary>
  587.         /// <param name="sender"></param>
  588.         /// <param name="e"></param>
  589.         protected void Button17_Click(object sender, EventArgs e)
  590.         {
  591.             xml_update(Button17, "smallImagesH", smallImagesH.Text.Trim());
  592.         }
  593.         /// <summary>
  594.         /// 是否允许删除文件
  595.         /// </summary>
  596.         /// <param name="sender"></param>
  597.         /// <param name="e"></param>
  598.         protected void Button18_Click(object sender, EventArgs e)
  599.         {
  600.             xml_update(Button18, "delete", delete.SelectedValue);
  601.         }
  602.         /// <summary>
  603.         /// 是否允许文件重命名
  604.         /// </summary>
  605.         /// <param name="sender"></param>
  606.         /// <param name="e"></param>
  607.         protected void Button19_Click(object sender, EventArgs e)
  608.         {
  609.             xml_update(Button19, "edit", edit.SelectedValue);
  610.         }
  611.         /// <summary>
  612.         /// 是否显示文件列表
  613.         /// </summary>
  614.         /// <param name="sender"></param>
  615.         /// <param name="e"></param>
  616.         protected void Button20_Click(object sender, EventArgs e)
  617.         {
  618.             xml_update(Button20, "fileListBox", fileListBox.SelectedValue);
  619.         }
  620.         /// <summary>
  621.         /// 传文件功能可上传的文件类型
  622.         /// </summary>
  623.         /// <param name="sender"></param>
  624.         /// <param name="e"></param>
  625.         protected void Button21_Click(object sender, EventArgs e)
  626.         {
  627.             xml_update(Button21, "fileFilters", fileFilters.Text.Trim());
  628.         }
  629.         /// <summary>
  630.         /// 上传图片功能可上传的文件类型
  631.         /// </summary>
  632.         /// <param name="sender"></param>
  633.         /// <param name="e"></param>
  634.         protected void Button22_Click(object sender, EventArgs e)
  635.         {
  636.             xml_update(Button22, "imagesFilters", imagesFilters.Text.Trim());
  637.         }
  638.         /// <summary>
  639.         /// 上传自动播放文件功能可上传的文件类型
  640.         /// </summary>
  641.         /// <param name="sender"></param>
  642.         /// <param name="e"></param>
  643.         protected void Button23_Click(object sender, EventArgs e)
  644.         {
  645.             xml_update(Button23, "mediaFilters", mediaFilters.Text.Trim());
  646.         }
  647.         /// <summary>
  648.         /// 上传自动播放文件功能可上传的文件类型
  649.         /// </summary>
  650.         /// <param name="sender"></param>
  651.         /// <param name="e"></param>
  652.         protected void Button24_Click(object sender, EventArgs e)
  653.         {
  654.             xml_update(Button24, "templateFilters", templateFilters.Text.Trim());
  655.         }
  656.         </script>
  657. </head>
  658. <body leftmargin=5 topmargin=5>
  659.     <form id="form1" runat="server">
  660.         <table border="1" cellpadding="0" cellspacing="0" width="95%">
  661.     <tr>
  662.         <td style="height: 20px;" colspan="2">
  663.             设置上传文件夹最大的可用空间(单位KB)</td>
  664.     </tr>
  665.     <tr >
  666.         <td style=" height: 20px; width: 90%;">
  667.             <asp:TextBox ID="maxAllUploadSize" runat="server" Width="329px"></asp:TextBox>
  668.       <asp:RangeValidator ID="RangeValidator1" runat="server" BackColor="White" BorderColor="Red"
  669.                 BorderWidth="1px" ControlToValidate="maxAllUploadSize" MaximumValue="99999999999999" ErrorMessage="必须是整数,而且最小0"
  670.                 MinimumValue="0" Type="Double"></asp:RangeValidator></td>
  671. <td style="height: 20px; text-align: right;">
  672.             <asp:Button ID="Button3" runat="server" Text="更新" Width="112px" BorderColor="#E0E0E0"  Height="24px" OnClick="Button3_Click"  /></td>
  673.     </tr>
  674.     <tr >
  675.         <td style="height: 25px" colspan="2">
  676.             设置上传文件单个的最大尺寸(单位KB)</td>
  677.     </tr>
  678.     <tr >
  679.         <td style=" height: 25px; width: 90%;">
  680.             <asp:TextBox ID="maxSingleUploadSize" runat="server" Width="328px"></asp:TextBox>
  681.       <asp:RangeValidator ID="RangeValidator2" runat="server" BackColor="White" BorderColor="Red"
  682.                 BorderWidth="1px" ControlToValidate="maxSingleUploadSize" MaximumValue="99999999999999" ErrorMessage="必须是整数,而且最小0"
  683.                 MinimumValue="0" Type="Double"></asp:RangeValidator></td>
  684.       <td style="height: 25px; text-align: right;"><asp:Button ID="Button1" runat="server" Text="更新" Width="112px" BorderColor="#E0E0E0" Height="24px" OnClick="Button1_Click" /></td>
  685.     </tr>
  686.     <tr >
  687.         <td style="height: 25px" colspan="2">
  688.             
  689.             设置上传文件是否自动改名</td>
  690.     </tr>
  691.     <tr >
  692.         <td style=" height: 25px; width: 90%;">
  693.             <asp:RadioButtonList ID="autoname" runat="server" BackColor="White" RepeatDirection="Horizontal"
  694.                 Width="328px">
  695.                 <asp:ListItem Value="false">否</asp:ListItem>
  696.                 <asp:ListItem Value="true">是</asp:ListItem>
  697.       </asp:RadioButtonList></td>
  698.       <td style="height: 25px; text-align: right;"><asp:Button ID="Button4" runat="server" Text="更新" Width="112px" BorderColor="#E0E0E0" Height="24px" OnClick="Button4_Click" /></td>
  699.     </tr>
  700.     <tr >
  701.         <td style="height: 25px" colspan="2">
  702.             
  703.             设置是否允许上传</td>
  704.     </tr>
  705.     <tr >
  706.         <td style=" height: 25px; width: 90%;">
  707.             <asp:RadioButtonList ID="allowUpload" runat="server" BackColor="White" RepeatDirection="Horizontal"
  708.                 Width="328px">
  709.                 <asp:ListItem Value="false">否</asp:ListItem>
  710.                 <asp:ListItem Value="true">是</asp:ListItem>
  711.       </asp:RadioButtonList></td>
  712.       <td style="height: 25px; text-align: right;"><asp:Button ID="Button5" runat="server" Text="更新" Width="112px" BorderColor="#E0E0E0" Height="24px" OnClick="Button5_Click" /></td>
  713.     </tr>
  714.     <tr >
  715.         <td style="height: 25px" colspan="2">
  716.             
  717.             是否在上传界面启用水印选择</td>
  718.     </tr>
  719.     <tr >
  720.         <td style=" height: 25px; width: 90%;">
  721.             <asp:RadioButtonList ID="watermarkOption" runat="server" BackColor="White" RepeatDirection="Horizontal"
  722.                 Width="328px">
  723.                 <asp:ListItem Value="off">否</asp:ListItem>
  724.                 <asp:ListItem Value="on">是</asp:ListItem>
  725.       </asp:RadioButtonList></td>
  726.       <td style="height: 25px; text-align: right;"><asp:Button ID="Button6" runat="server" Text="更新" Width="112px" BorderColor="#E0E0E0" Height="24px" OnClick="Button6_Click" /></td>
  727.     </tr>
  728.     <tr >
  729.         <td style="height: 25px" colspan="2">
  730.             
  731.             是否启用上传图片的文字水印</td>
  732.     </tr>
  733.     <tr >
  734.         <td style=" height: 25px; width: 90%;">
  735.             <asp:RadioButtonList ID="watermark" runat="server" BackColor="White" RepeatDirection="Horizontal"
  736.                 Width="328px">
  737.                 <asp:ListItem Value="false">否</asp:ListItem>
  738.                 <asp:ListItem Value="true">是</asp:ListItem>
  739.       </asp:RadioButtonList></td>
  740.       <td style="height: 25px; text-align: right;"><asp:Button ID="Button7" runat="server" Text="更新" Width="112px" BorderColor="#E0E0E0" Height="24px" OnClick="Button7_Click" /></td>
  741.     </tr>
  742.     <tr >
  743.         <td style="height: 25px" colspan="2">
  744.             
  745.             开启文字水印后是否保留原件并新建副本</td>
  746.     </tr>
  747.     <tr >
  748.         <td style=" height: 25px; width: 90%;">
  749.             <asp:RadioButtonList ID="watermarkName" runat="server" BackColor="White" RepeatDirection="Horizontal"
  750.                 Width="328px">
  751.                 <asp:ListItem Value="false">否</asp:ListItem>
  752.                 <asp:ListItem Value="true">是</asp:ListItem>
  753.       </asp:RadioButtonList></td>
  754.       <td style="height: 25px; text-align: right;"><asp:Button ID="Button8" runat="server" Text="更新" Width="112px" BorderColor="#E0E0E0" Height="24px" OnClick="Button8_Click" /></td>
  755.     </tr>
  756.     <tr >
  757.         <td style="height: 25px" colspan="2">
  758.             
  759.             设置水印文字</td>
  760.     </tr>
  761.     <tr >
  762.         <td style=" height: 25px; width: 90%;">
  763.             <asp:TextBox ID="watermarkText" runat="server" Width="325px"></asp:TextBox>&nbsp;
  764.       <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" BackColor="White"
  765.                 BorderColor="Red" BorderWidth="1px" ControlToValidate="watermarkText" ErrorMessage="不能为空"
  766.                 Width="107px"></asp:RequiredFieldValidator></td>
  767.       <td style="height: 25px; text-align: right;"><asp:Button ID="Button9" runat="server" Text="更新" Width="112px" BorderColor="#E0E0E0" Height="24px" OnClick="Button9_Click" /></td>
  768.     </tr>
  769.     <tr >
  770.         <td style="height: 25px" colspan="2">
  771.             
  772.             是否启用上传图片的图片水印</td>
  773.     </tr>
  774.     <tr >
  775.         <td style=" height: 25px; width: 90%;">
  776.             <asp:RadioButtonList ID="watermarkImages" runat="server" BackColor="White" RepeatDirection="Horizontal"
  777.                 Width="328px">
  778.                 <asp:ListItem Value="false">否</asp:ListItem>
  779.                 <asp:ListItem Value="true">是</asp:ListItem>
  780.       </asp:RadioButtonList></td>
  781.       <td style="height: 25px; text-align: right;"><asp:Button ID="Button10" runat="server" Text="更新" Width="112px" BorderColor="#E0E0E0" Height="24px" OnClick="Button10_Click" /></td>
  782.     </tr>
  783.     <tr >
  784.         <td style="height: 25px" colspan="2">
  785.             
  786.             开启图片水印后是否保留原件并新建副本</td>
  787.     </tr>
  788.     <tr >
  789.         <td style=" height: 25px; width: 90%;">
  790.             <asp:RadioButtonList ID="watermarkImagesName" runat="server" BackColor="White" RepeatDirection="Horizontal"
  791.                 Width="328px">
  792.                 <asp:ListItem Value="false">否</asp:ListItem>
  793.                 <asp:ListItem Value="true">是</asp:ListItem>
  794.       </asp:RadioButtonList></td>
  795.       <td style="height: 25px; text-align: right;"><asp:Button ID="Button11" runat="server" Text="更新" Width="112px" BorderColor="#E0E0E0" Height="24px" OnClick="Button11_Click" /></td>
  796.     </tr>
  797.     <tr >
  798.         <td style="height: 25px" colspan="2">
  799.             设置图片水印所在的位置(自动存为logo.gif)</td>
  800.     </tr>
  801.     <tr >
  802.         <td style=" height: 25px; width: 90%;">
  803.             <asp:TextBox ID="watermarkImages_path" runat="server" Width="326px"></asp:TextBox><br />
  804.             <asp:FileUpload ID="FileUpload1" runat="server" Width="326px" />
  805.       <asp:Button ID="Button2" runat="server" Height="19px" OnClick="Button2_Click" Text="上传"
  806.                 Width="71px" /></td>
  807.       <td style="height: 25px; text-align: right;"><asp:Button ID="Button12" runat="server" Text="更新" Width="112px" BorderColor="#E0E0E0" Height="24px" OnClick="Button12_Click" /></td>
  808.     </tr>
  809.     <tr >
  810.         <td style="height: 25px" colspan="2">
  811.             
  812.             是否启用缩略图</td>
  813.     </tr>
  814.     <tr >
  815.         <td style=" height: 25px; width: 90%;">
  816.             <asp:RadioButtonList ID="smallImages" runat="server" BackColor="White" RepeatDirection="Horizontal"
  817.                 Width="328px">
  818.                 <asp:ListItem Value="false">否</asp:ListItem>
  819.                 <asp:ListItem Value="true">是</asp:ListItem>
  820.       </asp:RadioButtonList></td>
  821.       <td style="height: 25px; text-align: right;"><asp:Button ID="Button13" runat="server" Text="更新" Width="112px" BorderColor="#E0E0E0" Height="24px" OnClick="Button13_Click" /></td>
  822.     </tr>
  823.     <tr >
  824.         <td style="height: 25px" colspan="2">
  825.             
  826.             开启缩略图后是否保留原件并新建副本</td>
  827.     </tr>
  828.     <tr >
  829.         <td style=" height: 25px; width: 90%;">
  830.             <asp:RadioButtonList ID="smallImagesName" runat="server" BackColor="White" RepeatDirection="Horizontal"
  831.                 Width="328px">
  832.                 <asp:ListItem Value="false">否</asp:ListItem>
  833.                 <asp:ListItem Value="true">是</asp:ListItem>
  834.       </asp:RadioButtonList></td>
  835.       <td style="height: 25px; text-align: right;"><asp:Button ID="Button14" runat="server" Text="更新" Width="112px" BorderColor="#E0E0E0" Height="24px" OnClick="Button14_Click" /></td>
  836.     </tr>
  837.     <tr >
  838.         <td style="height: 25px" colspan="2">
  839.             
  840.             缩略图缩放类型,HW:指定高宽缩放(可能变形)。W:指定宽,高按比例。H:指定高,宽按比例。Cut:指定高宽裁减(不变形)</td>
  841.     </tr>
  842.     <tr >
  843.         <td style=" height: 25px; width: 90%;">
  844.             <asp:RadioButtonList ID="smallImagesType" runat="server" BackColor="White" RepeatDirection="Horizontal"
  845.                 Width="324px">
  846.                 <asp:ListItem>HW</asp:ListItem>
  847.                 <asp:ListItem>W</asp:ListItem>
  848.                 <asp:ListItem>H</asp:ListItem>
  849.                 <asp:ListItem>CUT</asp:ListItem>
  850.       </asp:RadioButtonList></td>
  851.       <td style="height: 25px; text-align: right;"><asp:Button ID="Button15" runat="server" Text="更新" Width="112px" BorderColor="#E0E0E0" Height="24px" OnClick="Button15_Click" /></td>
  852.     </tr>
  853.     <tr >
  854.         <td style="height: 25px" colspan="2">
  855.             
  856.             缩略图宽度</td>
  857.     </tr>
  858.     <tr >
  859.         <td style=" height: 25px; width: 90%;">
  860.             <asp:TextBox ID="smallImagesW" runat="server" Width="323px"></asp:TextBox>
  861.       <asp:RangeValidator ID="RangeValidator3" runat="server" BackColor="White" BorderColor="Red"
  862.                 BorderWidth="1px" ControlToValidate="smallImagesW" ErrorMessage="必须是整数,不能为负数"
  863.                 MinimumValue="0" MaximumValue="9999" Type="Double"></asp:RangeValidator></td>
  864.       <td style="height: 25px; text-align: right;"><asp:Button ID="Button16" runat="server" Text="更新" Width="112px" BorderColor="#E0E0E0" Height="24px" OnClick="Button16_Click" /></td>
  865.     </tr>
  866.     <tr >
  867.         <td style="height: 25px" colspan="2">
  868.             
  869.             缩略图高度</td>
  870.     </tr>
  871.     <tr >
  872.         <td style=" height: 25px; width: 90%;">
  873.             <asp:TextBox ID="smallImagesH" runat="server" Width="322px"></asp:TextBox>
  874.       <asp:RangeValidator ID="RangeValidator4" runat="server" BackColor="White" BorderColor="Red"
  875.                 BorderWidth="1px" ControlToValidate="smallImagesH" ErrorMessage="必须是整数,不能为负数"
  876.                 MinimumValue="0" MaximumValue="9999" Type="Double"></asp:RangeValidator></td>
  877.       <td style="height: 25px; text-align: right;"><asp:Button ID="Button17" runat="server" Text="更新" Width="112px" BorderColor="#E0E0E0" Height="24px" OnClick="Button17_Click" /></td>
  878.     </tr>
  879.     <tr >
  880.         <td style="height: 25px" colspan="2">
  881.             
  882.             是否允许删除文件</td>
  883.     </tr>
  884.     <tr >
  885.         <td style=" height: 25px; width: 90%;">
  886.             <asp:RadioButtonList ID="delete" runat="server" BackColor="White" RepeatDirection="Horizontal"
  887.                 Width="328px">
  888.                 <asp:ListItem Value="false">否</asp:ListItem>
  889.                 <asp:ListItem Value="true">是</asp:ListItem>
  890.       </asp:RadioButtonList></td>
  891.       <td style="height: 25px; text-align: right;"><asp:Button ID="Button18" runat="server" Text="更新" Width="112px" BorderColor="#E0E0E0" Height="24px" OnClick="Button18_Click" /></td>
  892.     </tr>
  893.     <tr >
  894.         <td style="height: 25px" colspan="2">
  895.             
  896.             是否允许文件重命名</td>
  897.     </tr>
  898.     <tr >
  899.         <td style=" height: 25px; width: 90%;">
  900.             <asp:RadioButtonList ID="edit" runat="server" BackColor="White" RepeatDirection="Horizontal"
  901.                 Width="328px">
  902.                 <asp:ListItem Value="false">否</asp:ListItem>
  903.                 <asp:ListItem Value="true">是</asp:ListItem>
  904.       </asp:RadioButtonList></td>
  905.       <td style="height: 25px; text-align: right;"><asp:Button ID="Button19" runat="server" Text="更新" Width="112px" BorderColor="#E0E0E0" Height="24px" OnClick="Button19_Click" /></td>
  906.     </tr>
  907.     <tr >
  908.         <td style="height: 25px" colspan="2">
  909.             
  910.             是否显示文件列表</td>
  911.     </tr>
  912.     <tr >
  913.         <td style=" height: 25px; width: 90%;">
  914.             <asp:RadioButtonList ID="fileListBox" runat="server" BackColor="White" RepeatDirection="Horizontal"
  915.                 Width="328px">
  916.                 <asp:ListItem Value="false">否</asp:ListItem>
  917.                 <asp:ListItem Value="true">是</asp:ListItem>
  918.       </asp:RadioButtonList></td>
  919.       <td style="height: 25px; text-align: right;"><asp:Button ID="Button20" runat="server" Text="更新" Width="112px" BorderColor="#E0E0E0" Height="24px" OnClick="Button20_Click" /></td>
  920.     </tr>
  921.     <tr >
  922.         <td style="height: 25px" colspan="2">
  923.             
  924.             上传文件功能可上传的文件类型</td>
  925.     </tr>
  926.     <tr >
  927.         <td style=" height: 25px; width: 90%;">
  928.             <asp:TextBox ID="fileFilters" runat="server" Width="328px"></asp:TextBox></td>
  929.       <td style="height: 25px; text-align: right;"><asp:Button ID="Button21" runat="server" Text="更新" Width="112px" BorderColor="#E0E0E0" Height="24px" OnClick="Button21_Click" /></td>
  930.     </tr>
  931.     <tr >
  932.         <td style="height: 25px" colspan="2">
  933.             
  934.             上传图片功能可上传的文件类型</td>
  935.     </tr>
  936.     <tr >
  937.         <td style=" height: 25px; width: 90%;">
  938.             <asp:TextBox ID="imagesFilters" runat="server" Width="328px"></asp:TextBox></td>
  939.       <td style="height: 25px; text-align: right;"><asp:Button ID="Button22" runat="server" Text="更新" Width="112px" BorderColor="#E0E0E0" Height="24px" OnClick="Button22_Click" /></td>
  940.     </tr>
  941.     <tr >
  942.         <td style="height: 25px" colspan="2">
  943.             
  944.             上传自动播放文件功能可上传的文件类型</td>
  945.     </tr>
  946.     <tr >
  947.         <td style=" height: 25px; width: 90%;">
  948.             <asp:TextBox ID="mediaFilters" runat="server" Width="328px"></asp:TextBox></td>
  949.       <td style="height: 25px; text-align: right;"><asp:Button ID="Button23" runat="server" Text="更新" Width="112px" BorderColor="#E0E0E0" Height="24px" OnClick="Button23_Click" /></td>
  950.     </tr>
  951.             <tr >
  952.                 <td colspan="2" style="height: 25px; text-align: left">
  953.                     上传模板功能可上传的文件类型</td>
  954.             </tr>
  955.             <tr >
  956.                 <td style=" height: 25px; width: 90%;">
  957.                     <asp:TextBox ID="templateFilters" runat="server" Width="328px"></asp:TextBox></td>
  958.                 <td style="height: 25px; text-align: right">
  959.                     <asp:Button ID="Button24" runat="server" Text="更新" Width="112px" BorderColor="#E0E0E0" Height="24px" OnClick="Button24_Click" /></td>
  960.             </tr>
  961. </table>
  962. </form>
  963. </body>
  964. <script language=javascript>
  965. var userAgent = navigator.userAgent.toLowerCase();
  966. var is_ie = (userAgent.indexOf('msie') != -1);
  967. if(is_ie)
  968. {
  969. document.body.bgColor="ButtonFace";
  970. }
  971. else
  972. {
  973. document.body.bgColor="#E0E0E0";
  974. document.body.onunload=window.opener.location.reload();
  975. }
  976. </script>
  977. </html>