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
239 lines
11 KiB
<%@ 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: "微軟正黑體" , "儷黑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="報告"></asp:ListItem>
|
|
<asp:ListItem Value="Sys" Text="系統"></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">
|
|
<!--查詢結果區開始 -->
|
|
<table style="display: none;">
|
|
<tr>
|
|
<td>
|
|
<table id="tbHeader" runat="server">
|
|
<tr>
|
|
<td colspan="4" align="center">
|
|
參數類別資料
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="4" align="right">
|
|
<asp:Literal ID="ltrNowTime" runat="server" Text="20121008"></asp:Literal>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<!--查詢結果區開始 -->
|
|
</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);
|
|
/********************************************
|
|
* 函數名稱:CallPageMethod(UrlAspx, MethodName, JsonData)
|
|
* 目的:使用Ajax呼叫後台Method
|
|
* 作者:Gary
|
|
* 時間:2015/05/20
|
|
*********************************************/
|
|
function CallPageMethod(UrlAspx, MethodName, Data, callback) {
|
|
callback = callback || function () { };
|
|
$.ajax({
|
|
type: 'Post',
|
|
url: UrlAspx + MethodName,
|
|
data: JSON.stringify(Data), //傳送區域參數
|
|
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();
|
|
//});
|
|
|
|
//設定當點選DropDownList時,傳true值到MainPage.aspx的hidValue。
|
|
//hidValue 是用來判斷Drop Down List 是否為點選。
|
|
//用意是避免IE瀏覽測當選到DropDownList時會直接縮滑動畫面。 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>
|