|
|
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Menu.aspx.cs" Inherits="OT.Web.Menu" %>
<%@ Import Namespace="System.Data" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <meta http-equiv="Content-Type" content="text/html; charset=big5" /> <title id="Title1" runat="server"></title> <style type="text/css"> .accordion, .accordion ul, .accordion li, .accordion a { list-style: none; text-decoration: none; font-size: 14px; } .accordion { margin-top: 20px;} .accordion li ul {display:none;} .accordion li { width: 220px; padding: 3px 0 3px 10px; } .accordion li a { height: 48px; clip: height; padding: 5px 35px 13px 0px; margin-bottom: 15px; color: #354979; } .accordion li a:hover, .accordion li .active { text-decoration: none; color: #F90; }
.sub-menu li { background: none; width: 180px; height: 20px; line-height: 18px; margin: 1px 0 0 0px; list-style: none; } .sub-menu li a { padding: 5px 10px 8px 5px; color: #339966; } .sub-menu li a:hover, .sub-menu li .active { text-decoration: none; color: #F90; width: auto; height: 48px; } .accordion .sub-menu { background: none; display: none; } .accordion li:target .sub-menu { background: none; display: block; } .havechild{ background:url(App_Themes/Default/images/havesun.png) left no-repeat; padding-left:16px !important;}
/*Dropdownlist �Ҳտ���*/ .tt { margin-top: 10px; margin-left: 0px; } #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; } #ddlModuleLists option { background: url(App_Themes/Default/images/option_02.gif) no-repeat top; color: #555; width: 150px; height: 48px; text-align: center; } select::-ms-expand { display: none; } /*IE10 ddl arrow disapear*/ </style> </head> <body style="background-color: transparent;" class="no-bg"> <form id="Form1" runat="server"> <div id="leftmenu"> <span class="tt"> <asp:DropDownList ID="ddlModuleList" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlModuleList_SelectedIndexChanged" onchange="runModule(this)"> <asp:ListItem Value="Cus" Text="�Ȥ��Ҳ�"></asp:ListItem> <asp:ListItem Value="Rpt" Text="���i"></asp:ListItem> <asp:ListItem Value="Sys" Text="�t��"></asp:ListItem> </asp:DropDownList> </span> <ul class="accordion"> <%--<asp:Repeater ID="parentRepeater" runat="server"> <ItemTemplate> <li><a id="trycss" class="<%#((DataBinder.Eval(Container.DataItem, "[\"ImgPath\"]").ToString() == "folder") ? "havechild": "li2").ToString().Trim(' ')%>" href="javascript:void(0);" onclick="if('<%# DataBinder.Eval(Container.DataItem, "AccountNameSort")%>'!='') parent.OpenPageTab('<%# DataBinder.Eval(Container.DataItem, "[\"ModuleID\"]")%>','ModuleDefault'); if('<%# DataBinder.Eval(Container.DataItem, "AccountNameSort")%>'=='') parent.OpenPageTab('<%# DataBinder.Eval(Container.DataItem, "[\"ModuleID\"]")%>');"> <%# DataBinder.Eval(Container.DataItem, "ModuleName")%></a> <ul class="sub-menu"> <asp:Repeater ID="childRepeater" runat="server" DataSource='<%# ((DataRowView)Container.DataItem).Row.GetChildRows("myreleation") %>'> <ItemTemplate> <li><a href="javascript:void(0);" onclick=" parent.OpenPageTab('<%# DataBinder.Eval(Container.DataItem, "[\"ProgramID\"]")%>');"> <%# DataBinder.Eval(Container.DataItem, "[\"ProgramName\"]")%></a> <br /> </li> </ItemTemplate> </asp:Repeater> </ul> </li> </ItemTemplate> </asp:Repeater>--%> </ul> <br class="clear" /> </div> <div> <tr> <td class="inner-block3"> </td> <td class="inner-block4"> <!--�d�ߵ��G�϶}�l --> <table style="display: none;"> <tr> <td> <table id="tbHeader" runat="server"> <tr> <td colspan="4" align="center"> �Ѽ����O���� </td> </tr> <tr> <td colspan="4" align="right"> <asp:Literal ID="ltrNowTime" runat="server" Text="20121008"></asp:Literal> </td> </tr> </table> </td> </tr> </table> <!--�d�ߵ��G�϶}�l --> </td> </tr> </div> <div id="ProgramList" runat="server" style="display: none"> </div> </form> </body> </html> <script type="text/javascript"> var PageTag = 'Menu'; var User; var Json = { List: [], Area: {}, Session: [] }; var UrlAspx = PageTag + '.aspx/'; var Method = { GetMenu: 'GetMenu', GetSession: 'GetSession' }; CallPageMethod(UrlAspx, Method.GetSession, { strKey: 'gstrUserId' }, GetSessionDone); /******************************************** * ���ƦW�١GCallPageMethod(UrlAspx, MethodName, JsonData) * �ت��G�ϥ�Ajax�I�s���xMethod * �@�̡GGary * �ɶ��G2015/05/20 *********************************************/ function CallPageMethod(UrlAspx, MethodName, Data, callback) { callback = callback || function () { }; $.ajax({ type: 'Post', url: UrlAspx + MethodName, data: JSON.stringify(Data), //�ǰe�ϰ��Ѽ� contentType: 'application/json; charset=utf-8', dataType: 'json', success: callback, error: function (res, status) { if (status === "error") { var errorMessage = $.parseJSON(res.responseText); console.log(errorMessage.Message); } } }); } function GetSessionDone(msg) { User = msg.d; var ModuleID = document.getElementById('ddlModuleList').value; CallPageMethod(UrlAspx, Method.GetMenu, { strModuleID: ModuleID, strUser:User }, GetGetMenuDone); } function GetGetMenuDone(msg) { var Json = JSON.parse(msg.d); var JModule = Json.Module; var JProgram = Json.Program; var JModuleWord = {}; $.each(JModule, function (Index, JObj) { JModuleWord[JObj.ModuleID] = JObj; }) $.each(JModule, function (Index, JObj) { var Sort; if (JObj.ModuleIDSort) { Sort = JObj.ModuleIDSort.split('/'); Sort = Sort.splice(1, Sort.length); var Parent = ''; $.each(Sort, function (SubIndex, Value) { var First = (Parent === ''); if ($('#li' + Value).length === 0) { Parent = Parent || $('ul.accordion'); var a = $('<a>', { 'class': 'havechild', href: 'javascript:void(0);', text: JModuleWord[Value].ModuleName, click: function () { $(this).toggleClass('active'); if ($(this).hasClass('active')) { $('#ulSub' + Value + ',#li' + Value + '>ul').css('display', 'block'); } else { $('#ulSub' + Value + ',#li' + Value + '>ul').css('display', 'none'); } } }); var Li = $('<li>', { id: 'li' + Value, html: [a] }); var BaseUL = $('<ul>', { id: 'ulSub' + Value, 'class': 'sub-menu' }) var Ul = (First) ? [Li, BaseUL] : $('<ul>', { id: 'ul' + Value, html: [Li, BaseUL] }); Parent.append(Ul); } Parent = (First) ? $('#li' + Value) : $('#li' + Value); }) } else { Parent = Parent || $('ul.accordion'); if ($('#li' + JObj.ModuleID).length === 0) { var $li = $('<li />').attr('id', 'li' + JObj.ModuleID).appendTo(Parent); var $a = $('<a />').html(JObj.ModuleName).css('cursor', 'pointer').click(function () { parent.OpenPageTab(JObj.ModuleID); }).appendTo($li); } } }) $.each(JProgram, function (Index, JObj) { var a = $('<a>', { href: 'javascript:void(0);', text: JObj.ProgramName, click: function () { parent.OpenPageTab(JObj.ProgramID); } }); var Li = $('<li>', { html: [a] }); $('#ulSub' + JObj.ModuleID).append(Li); }) runModule(); } //$(document).ready(function () { // //console.log('hi') // var accordion_head = $('.accordion > li > a'), // accordion_body = $('.accordion li > .sub-menu');
// accordion_head.eq(0).addClass('active').next().slideDown('normal'); // Open the first tab on load
// accordion_head.click(function (event) { // Click function // // Show and hide the tabs on click // if ($(this).attr('class') != 'active') { // accordion_body.slideUp('normal'); // $(this).next().stop(true, true).slideToggle('normal'); // accordion_head.removeClass('active'); // $(this).addClass('active'); // }
// }); // runModule(); //});
//�]�w���I��DropDownList�ɡA��true�Ȩ�MainPage.aspx��hidValue�C //hidValue �O�ΨӧP�_Drop Down List �O�_���I���C //�ηN�O�קKIE�s����������DropDownList�ɷ|�����Y�ưʵe���C by Gary 2013/12/31 // $('#ddlModuleList').live('click', function () { // window.top.$('#hidValue').val("true"); // });
function runModule() { var o = document.getElementById("ddlModuleList").value; parent.OpenPageTab(o, 'ModuleDefault'); window.top.$('#hidValue').val("false"); } </script>
|