You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

239 lines
11 KiB

  1. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Menu.aspx.cs" Inherits="OT.Web.Menu" %>
  2. <%@ Import Namespace="System.Data" %>
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4. <html xmlns="http://www.w3.org/1999/xhtml">
  5. <head id="Head1" runat="server">
  6. <meta http-equiv="Content-Type" content="text/html; charset=big5" />
  7. <title id="Title1" runat="server"></title>
  8. <style type="text/css">
  9. .accordion, .accordion ul, .accordion li, .accordion a { list-style: none; text-decoration: none; font-size: 14px; }
  10. .accordion { margin-top: 20px;}
  11. .accordion li ul {display:none;}
  12. .accordion li { width: 220px; padding: 3px 0 3px 10px; }
  13. .accordion li a { height: 48px; clip: height; padding: 5px 35px 13px 0px; margin-bottom: 15px; color: #354979; }
  14. .accordion li a:hover, .accordion li .active { text-decoration: none; color: #F90; }
  15. .sub-menu li { background: none; width: 180px; height: 20px; line-height: 18px; margin: 1px 0 0 0px; list-style: none; }
  16. .sub-menu li a { padding: 5px 10px 8px 5px; color: #339966; }
  17. .sub-menu li a:hover, .sub-menu li .active { text-decoration: none; color: #F90; width: auto; height: 48px; }
  18. .accordion .sub-menu { background: none; display: none; }
  19. .accordion li:target .sub-menu { background: none; display: block; }
  20. .havechild{ background:url(App_Themes/Default/images/havesun.png) left no-repeat; padding-left:16px !important;}
  21. /*Dropdownlist �Ҳտ���*/
  22. .tt { margin-top: 10px; margin-left: 0px; }
  23. #ddlModuleList { color: #999; font-family: "�L�n������" , "�׶�Pro"; font-size: 16px; background: url(App_Themes/Default/images/sel-ac.png) right no-repeat; background-color: #FFF; width: 160px; height: 37px; cursor: pointer; outline: none; padding-left: 20px; border: #999 solid 1px; -webkit-appearance: none; -moz-appearance: none; position: relative; top: 0px; left: 18px; font-weight: bold; margin: 10px 0 0px 0; }
  24. #ddlModuleLists option { background: url(App_Themes/Default/images/option_02.gif) no-repeat top; color: #555; width: 150px; height: 48px; text-align: center; }
  25. select::-ms-expand { display: none; } /*IE10 ddl arrow disapear*/
  26. </style>
  27. </head>
  28. <body style="background-color: transparent;" class="no-bg">
  29. <form id="Form1" runat="server">
  30. <div id="leftmenu">
  31. <span class="tt">
  32. <asp:DropDownList ID="ddlModuleList" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlModuleList_SelectedIndexChanged"
  33. onchange="runModule(this)">
  34. <asp:ListItem Value="Cus" Text="�Ȥ��Ҳ�"></asp:ListItem>
  35. <asp:ListItem Value="Rpt" Text="���i"></asp:ListItem>
  36. <asp:ListItem Value="Sys" Text="�t��"></asp:ListItem>
  37. </asp:DropDownList>
  38. </span>
  39. <ul class="accordion">
  40. <%--<asp:Repeater ID="parentRepeater" runat="server">
  41. <ItemTemplate>
  42. <li><a id="trycss" class="<%#((DataBinder.Eval(Container.DataItem, "[\"ImgPath\"]").ToString() == "folder") ? "havechild": "li2").ToString().Trim(' ')%>"
  43. href="javascript:void(0);" onclick="if('<%# DataBinder.Eval(Container.DataItem, "AccountNameSort")%>'!='') parent.OpenPageTab('<%# DataBinder.Eval(Container.DataItem, "[\"ModuleID\"]")%>','ModuleDefault');
  44. if('<%# DataBinder.Eval(Container.DataItem, "AccountNameSort")%>'=='') parent.OpenPageTab('<%# DataBinder.Eval(Container.DataItem, "[\"ModuleID\"]")%>');">
  45. <%# DataBinder.Eval(Container.DataItem, "ModuleName")%></a>
  46. <ul class="sub-menu">
  47. <asp:Repeater ID="childRepeater" runat="server" DataSource='<%# ((DataRowView)Container.DataItem).Row.GetChildRows("myreleation") %>'>
  48. <ItemTemplate>
  49. <li><a href="javascript:void(0);" onclick=" parent.OpenPageTab('<%# DataBinder.Eval(Container.DataItem, "[\"ProgramID\"]")%>');">
  50. <%# DataBinder.Eval(Container.DataItem, "[\"ProgramName\"]")%></a>
  51. <br />
  52. </li>
  53. </ItemTemplate>
  54. </asp:Repeater>
  55. </ul>
  56. </li>
  57. </ItemTemplate>
  58. </asp:Repeater>--%>
  59. </ul>
  60. <br class="clear" />
  61. </div>
  62. <div>
  63. <tr>
  64. <td class="inner-block3">
  65. </td>
  66. <td class="inner-block4">
  67. <!--�d�ߵ��G�϶}�l -->
  68. <table style="display: none;">
  69. <tr>
  70. <td>
  71. <table id="tbHeader" runat="server">
  72. <tr>
  73. <td colspan="4" align="center">
  74. �Ѽ����O����
  75. </td>
  76. </tr>
  77. <tr>
  78. <td colspan="4" align="right">
  79. <asp:Literal ID="ltrNowTime" runat="server" Text="20121008"></asp:Literal>
  80. </td>
  81. </tr>
  82. </table>
  83. </td>
  84. </tr>
  85. </table>
  86. <!--�d�ߵ��G�϶}�l -->
  87. </td>
  88. </tr>
  89. </div>
  90. <div id="ProgramList" runat="server" style="display: none">
  91. </div>
  92. </form>
  93. </body>
  94. </html>
  95. <script type="text/javascript">
  96. var PageTag = 'Menu';
  97. var User;
  98. var Json = {
  99. List: [],
  100. Area: {},
  101. Session: []
  102. };
  103. var UrlAspx = PageTag + '.aspx/';
  104. var Method = {
  105. GetMenu: 'GetMenu',
  106. GetSession: 'GetSession'
  107. };
  108. CallPageMethod(UrlAspx, Method.GetSession, { strKey: 'gstrUserId' }, GetSessionDone);
  109. /********************************************
  110. * ���ƦW�١GCallPageMethod(UrlAspx, MethodName, JsonData)
  111. * �ت��G�ϥ�Ajax�I�s���xMethod
  112. * �@�̡GGary
  113. * �ɶ��G2015/05/20
  114. *********************************************/
  115. function CallPageMethod(UrlAspx, MethodName, Data, callback) {
  116. callback = callback || function () { };
  117. $.ajax({
  118. type: 'Post',
  119. url: UrlAspx + MethodName,
  120. data: JSON.stringify(Data), //�ǰe�ϰ��Ѽ�
  121. contentType: 'application/json; charset=utf-8',
  122. dataType: 'json',
  123. success: callback,
  124. error: function (res, status) {
  125. if (status === "error") {
  126. var errorMessage = $.parseJSON(res.responseText);
  127. console.log(errorMessage.Message);
  128. }
  129. }
  130. });
  131. }
  132. function GetSessionDone(msg) {
  133. User = msg.d;
  134. var ModuleID = document.getElementById('ddlModuleList').value;
  135. CallPageMethod(UrlAspx, Method.GetMenu, {
  136. strModuleID: ModuleID,
  137. strUser:User
  138. }, GetGetMenuDone);
  139. }
  140. function GetGetMenuDone(msg) {
  141. var Json = JSON.parse(msg.d);
  142. var JModule = Json.Module;
  143. var JProgram = Json.Program;
  144. var JModuleWord = {};
  145. $.each(JModule, function (Index, JObj) {
  146. JModuleWord[JObj.ModuleID] = JObj;
  147. })
  148. $.each(JModule, function (Index, JObj) {
  149. var Sort;
  150. if (JObj.ModuleIDSort) {
  151. Sort = JObj.ModuleIDSort.split('/');
  152. Sort = Sort.splice(1, Sort.length);
  153. var Parent = '';
  154. $.each(Sort, function (SubIndex, Value) {
  155. var First = (Parent === '');
  156. if ($('#li' + Value).length === 0) {
  157. Parent = Parent || $('ul.accordion');
  158. var a = $('<a>', {
  159. 'class': 'havechild', href: 'javascript:void(0);', text: JModuleWord[Value].ModuleName, click: function () {
  160. $(this).toggleClass('active');
  161. if ($(this).hasClass('active')) {
  162. $('#ulSub' + Value + ',#li' + Value + '>ul').css('display', 'block');
  163. }
  164. else {
  165. $('#ulSub' + Value + ',#li' + Value + '>ul').css('display', 'none');
  166. }
  167. }
  168. });
  169. var Li = $('<li>', { id: 'li' + Value, html: [a] });
  170. var BaseUL = $('<ul>', { id: 'ulSub' + Value, 'class': 'sub-menu' })
  171. var Ul = (First) ? [Li, BaseUL] : $('<ul>', { id: 'ul' + Value, html: [Li, BaseUL] });
  172. Parent.append(Ul);
  173. }
  174. Parent = (First) ? $('#li' + Value) : $('#li' + Value);
  175. })
  176. }
  177. else {
  178. Parent = Parent || $('ul.accordion');
  179. if ($('#li' + JObj.ModuleID).length === 0) {
  180. var $li = $('<li />').attr('id', 'li' + JObj.ModuleID).appendTo(Parent);
  181. var $a = $('<a />').html(JObj.ModuleName).css('cursor', 'pointer').click(function () {
  182. parent.OpenPageTab(JObj.ModuleID);
  183. }).appendTo($li);
  184. }
  185. }
  186. })
  187. $.each(JProgram, function (Index, JObj) {
  188. var a = $('<a>', {
  189. href: 'javascript:void(0);', text: JObj.ProgramName, click: function () {
  190. parent.OpenPageTab(JObj.ProgramID);
  191. }
  192. });
  193. var Li = $('<li>', { html: [a] });
  194. $('#ulSub' + JObj.ModuleID).append(Li);
  195. })
  196. runModule();
  197. }
  198. //$(document).ready(function () {
  199. // //console.log('hi')
  200. // var accordion_head = $('.accordion > li > a'),
  201. // accordion_body = $('.accordion li > .sub-menu');
  202. // accordion_head.eq(0).addClass('active').next().slideDown('normal'); // Open the first tab on load
  203. // accordion_head.click(function (event) { // Click function
  204. // // Show and hide the tabs on click
  205. // if ($(this).attr('class') != 'active') {
  206. // accordion_body.slideUp('normal');
  207. // $(this).next().stop(true, true).slideToggle('normal');
  208. // accordion_head.removeClass('active');
  209. // $(this).addClass('active');
  210. // }
  211. // });
  212. // runModule();
  213. //});
  214. //�]�w���I��DropDownList�ɡA��true�Ȩ�MainPage.aspx��hidValue�C
  215. //hidValue �O�ΨӧP�_Drop Down List �O�_���I���C
  216. //�ηN�O�קKIE�s����������DropDownList�ɷ|�����Y�ưʵe���C by Gary 2013/12/31
  217. // $('#ddlModuleList').live('click', function () {
  218. // window.top.$('#hidValue').val("true");
  219. // });
  220. function runModule() {
  221. var o = document.getElementById("ddlModuleList").value;
  222. parent.OpenPageTab(o, 'ModuleDefault');
  223. window.top.$('#hidValue').val("false");
  224. }
  225. </script>