forum_attchemnttypes.aspx
上传用户:wenllgg125
上传日期:2020-04-09
资源大小:7277k
文件大小:6k
源码类别:

SCSI/ASPI

开发平台:

Others

  1. <%@ Page Language="c#" Inherits="Discuz.Web.Admin.forum_attchemnttypes" Codebehind="forum_attchemnttypes.aspx.cs"%>
  2. <%@ Register TagPrefix="cc2" Namespace="Discuz.Control" Assembly="Discuz.Control" %>
  3. <%@ Register TagPrefix="cc1" Namespace="Discuz.Control" Assembly="Discuz.Control" %>
  4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  5. <html>
  6. <head>
  7. <title>附件类型管理</title>
  8. <link href="../styles/datagrid.css" type="text/css" rel="stylesheet" />
  9. <script type="text/javascript" src="../js/common.js"></script>
  10. <link href="../styles/dntmanager.css" type="text/css" rel="stylesheet" />
  11. <link href="../styles/modelpopup.css" type="text/css" rel="stylesheet" />
  12. <script type="text/javascript" src="../js/modalpopup.js"></script> 
  13. <script type="text/javascript">    
  14. function getCheckboxId(thevalue)
  15. {
  16. var labels = document.getElementsByTagName("label");
  17. for(var i = 0 ; i < labels.length ; i++)
  18. {
  19. if(labels[i].childNodes[0].nodeValue.toLowerCase() == thevalue.toLowerCase())
  20. {
  21. return labels[i].getAttributeNode("for").value;
  22. }
  23. }
  24. return "";
  25. }
  26. function enabledCheckbox()
  27. {
  28. var i = 1;
  29. var extname = "";
  30. while(true)
  31. {
  32. var thetype = eval("atttype.type" + i);
  33. if(thetype == undefined)
  34. break;
  35. if(extname == "")
  36. {
  37. extname = thetype.extname;
  38. }
  39. else
  40. {
  41. if(thetype.extname != "")
  42. {
  43. extname += "," + thetype.extname;
  44. }
  45. }
  46. i++;
  47. }
  48. if(extname != "")
  49. extname = "," + extname + ",";
  50. var labels = document.getElementsByTagName("label");
  51. for(var i = 0 ; i < labels.length ; i++)
  52. {
  53. var type = labels[i].firstChild.nodeValue;
  54. if(extname.indexOf("," + type + ",") == -1)
  55. {
  56. var id = getCheckboxId(type);
  57. document.getElementById(id).disabled = false;
  58. document.getElementById(id).checked = false;
  59. }
  60. }
  61. }
  62. function disabledCheckbox()
  63. {        
  64. var labels = document.getElementsByTagName("label");
  65. for(var i = 0 ; i < labels.length ; i++)
  66. {
  67. var elemid = labels[i].getAttributeNode("for").value;
  68. document.getElementById(elemid).disabled = true;
  69. document.getElementById(elemid).checked = false;
  70. }
  71. }
  72. function checkedCheckbox(elemid,checked)
  73. {
  74. document.getElementById(elemid).disabled = document.getElementById(elemid).parentNode.disabled = !checked;
  75. document.getElementById(elemid).checked = checked;
  76. }
  77. function newAttType()
  78. {
  79. document.getElementById("typename").value = "";
  80. document.getElementById("atttypeid").value = "";
  81. disabledCheckbox();
  82. enabledCheckbox();
  83. BOX_show('neworedit');
  84. }
  85. function editAttType(typeid)
  86. {
  87. var thetype = eval("atttype.type" + typeid);
  88. extname = thetype.extname.split(",");
  89. document.getElementById("typename").value = thetype.typename;
  90. document.getElementById("atttypeid").value = typeid;
  91. disabledCheckbox();
  92. enabledCheckbox();
  93. for(var i = 0 ; i < extname.length ; i++)
  94. {
  95. elemid = getCheckboxId(extname[i]);
  96. if(elemid != "")
  97. {
  98. checkedCheckbox(elemid,true);
  99. }
  100. }
  101. BOX_show('neworedit');
  102. }
  103. function Check(form)
  104. {
  105. CheckAll(form);
  106. checkedEnabledButton(form,'typeid','DelRec')
  107. }
  108. </script>
  109. <meta http-equiv="X-UA-Compatible" content="IE=7" />
  110. </head>
  111. <body>
  112. <form id="Form1" method="post" runat="server">
  113. <cc1:DataGrid ID="DataGrid1" runat="server">
  114. <Columns>
  115. <asp:TemplateColumn HeaderText="<input title='选中/取消' onclick='Check(this.form)' type='checkbox' name='chkall' id='chkall' />">
  116. <HeaderStyle Width="20px" />
  117. <ItemTemplate>
  118. <input id="typeid" type="checkbox" onclick="checkedEnabledButton(this.form,'typeid','DelRec')" value="<%# DataBinder.Eval(Container, "DataItem.typeid").ToString() %>" name="typeid" />
  119. <%# DataGrid1.LoadSelectedCheckBox(DataBinder.Eval(Container, "DataItem.typeid").ToString())%>
  120. </ItemTemplate>
  121. </asp:TemplateColumn>
  122. <asp:TemplateColumn>
  123. <ItemStyle width="5%" />
  124. <ItemTemplate>
  125. <a href="javascript:editAttType(<%# DataBinder.Eval(Container, "DataItem.typeid").ToString() %>);">编辑</a>
  126. </ItemTemplate>
  127. </asp:TemplateColumn>
  128. <asp:BoundColumn DataField="typeid" HeaderText="id [递增]" Visible="false"></asp:BoundColumn>
  129. <asp:BoundColumn DataField="typename" HeaderText="类型名称"></asp:BoundColumn>
  130. <asp:BoundColumn DataField="extname" HeaderText="扩展名列表" readonly="true"></asp:BoundColumn>
  131. </Columns>
  132. </cc1:DataGrid>
  133. <p style="text-align:right;">
  134. <cc1:Button ID="DelRec" runat="server" Text=" 删 除 " ButtonImgUrl="../images/del.gif" Enabled="false" OnClientClick="if(!confirm('你确认要删除所选的附件分类吗?')) return false;"></cc1:Button>&nbsp;&nbsp;
  135. <button type="button" class="ManagerButton" id="Button2" onclick="newAttType()"><img src="../images/add.gif"/> 添加附件分类 </button>
  136. </p>
  137. <div id="BOX_overlay" style="background: #000; position: absolute; z-index:100; filter:alpha(opacity=50);-moz-opacity: 0.6;opacity: 0.6;"></div>
  138. <div id="neworedit" style="display: none; background :#fff; padding:10px; border:1px solid #999; width:380px;">
  139. <div class="ManagerForm">
  140. <fieldset>
  141. <legend style="background: url(../images/icons/icon59.jpg) no-repeat 6px 50%;">添加/编辑 附件分类</legend>
  142. <table width="100%">
  143. <tr><td class="item_title">分类名称</td></tr>
  144. <tr>
  145. <td class="vtop">
  146. <cc2:TextBox ID="typename" runat="server" RequiredFieldType="暂无校验" IsReplaceInvertedComma="true" MaxLength="254" Size="30"></cc2:TextBox>
  147.             <input type="hidden" name="atttypeid" id="atttypeid" />
  148. </td>
  149. </tr>
  150. <tr><td class="item_title">分类绑定</td></tr>
  151. <tr>
  152. <td class="vtop">
  153. <cc2:CheckBoxList id="attachextensions" runat="server" RepeatColumns="4"></cc2:CheckBoxList><br/>论坛上允许使用的附件类型,灰色的表示已经加入某一附件分类,可以通过编辑某分类将某一类型从中删除,使其状态成为未分类后再加入其它分类中
  154. </td>
  155. </tr>
  156. </table>
  157. <div class="Navbutton">
  158. <cc1:Button ID="AddNewRec" runat="server" Text=" 提 交 "></cc1:Button>&nbsp;&nbsp;
  159. <button type="button" class="ManagerButton" id="Button1" onclick="BOX_remove('neworedit');"><img src="../images/state1.gif"/> 取 消 </button>
  160. </div>
  161. </fieldset>
  162. </div>
  163. </div>
  164. <cc2:Hint id="Hint1" runat="server" HintImageUrl="../images"></cc2:Hint>
  165. </form>
  166. <div id="setting" />
  167. <%=footer%>
  168. </body>
  169. </html>