<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<meta charset="UTF-8">
<meta name="Generator" content="EditPlus®">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<title>课程表</title>
</head>
<link rel="stylesheet" type="text/css" href="${StaticResourceContextPath}/lib/bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css"
href="${StaticResourceContextPath}/lib/jstree/3.2.1/dist/themes/default/style.min.css">
<link rel="stylesheet" type="text/css"
href="${StaticResourceContextPath}/lib/bootstrap-datetimepicker/default/css/bootstrap-datetimepicker.css">
<link rel="stylesheet" type="text/css" href="${StaticResourceContextPath}/school/attendance/css/index.css">
<link rel="stylesheet" type="text/css" href="${StaticResourceContextPath}/school/attendance/css/course.css">
<body class="page-header-fixed">
<%--start second tree--%>
<div class="second-trees">
<div class="second-trees-header">班级栏</div>
<div id="second-tree" class="T30"></div>
</div>
<%--end second tree--%>
<%--start right_pannel--%>
<div class="right-pannel">
<%--start right-pannel-header--%>
<div class="right-pannel-header">
<input type="button" value="添加课程" id="add_course">
</div>
<%--end right-pannel-header--%>
<div class="right-pannel-body">
<div style="margin-top:40px; margin-left:80px; height:99%;">
<span>2015-2016下学期 第
<select id="course-option" onChange="display('parent',this,0)">
<option id="1">1</option>
<option id="2">2</option>
<option id="3">3</option>
<option id="4">4</option>
<option id="5">5</option>
<option id="6">6</option>
<option id="7">7</option>
</select>
周</span>
<input type="button" value="查询" style="width: 60px;height: 25px;" id="search">
<ul style="height: 30px;margin-top: 10px;">
<li style="height: 40px">节次\星期</li>
<li style="height: 40px">星期一</li>
<li style="height: 40px">星期二</li>
<li style="height: 40px">星期三</li>
<li style="height: 40px">星期四</li>
<li style="height: 40px">星期五</li>
<li style="height: 40px">星期六</li>
<li style="height: 40px" class="border-r">星期日</li>
</ul>
<ul name="point1">
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li class="border-r"></li>
</ul>
<ul name="point2">
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li class="border-r"></li>
</ul>
<ul name="point3">
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li class="border-r"></li>
</ul>
<ul name="point4">
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li class="border-r"></li>
</ul>
<ul style="height: 30px;">
<li style="height: 40px;"></li>
<li style="height: 40px;">午休</li>
<li style="height: 40px;">午休</li>
<li style="height: 40px;">午休</li>
<li style="height: 40px;">午休</li>
<li style="height: 40px;">午休</li>
<li style="height: 40px;">午休</li>
<li style="height: 40px;" class="border-r">午休</li>
</ul>
<ul name="point5">
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li class="border-r"></li>
</ul>
<ul name="point6">
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li class="border-r"></li>
</ul>
<ul name="point7">
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li class="border-r"></li>
</ul>
<ul name="point8">
<li class="border-b"></li>
<li class="border-b"></li>
<li class="border-b"></li>
<li class="border-b"></li>
<li class="border-b"></li>
<li class="border-b"></li>
<li class="border-b"></li>
<li class="border-l"></li>
</ul>
<ul name="point9">
<li class="border-b"></li>
<li class="border-b"></li>
<li class="border-b"></li>
<li class="border-b"></li>
<li class="border-b"></li>
<li class="border-b"></li>
<li class="border-b"></li>
<li class="border-l"></li>
</ul>
<ul name="point10">
<li class="border-b"></li>
<li class="border-b"></li>
<li class="border-b"></li>
<li class="border-b"></li>
<li class="border-b"></li>
<li class="border-b"></li>
<li class="border-b"></li>
<li class="border-l"></li>
</ul>
</div>
</div>
</div>
<%--end right_pannel--%>
</body>
<script type="text/javascript" src="${StaticResourceContextPath}/lib/jquery/2.1.1/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="${StaticResourceContextPath}/lib/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script type="text/javascript" src="${StaticResourceContextPath}/lib/jstree/3.2.1/dist/jstree.min.js"></script>
<script type="text/javascript"
src="${StaticResourceContextPath}/lib/bootstrap-datetimepicker/default/js/bootstrap-datetimepicker.js"></script>
<script type="text/javascript" src="${StaticResourceContextPath}/school/attendance/js/course_json.js"></script>
<script type="text/javascript" src="${StaticResourceContextPath}/school/attendance/js/public.js"></script>
<script>
$(function () {
/*定义body-pannel高度*/
var body_pannel = window.screen.availHeight - 120;
var right_pannel_width = window.screen.availWidth - 360;
$('.second-trees').css({height: body_pannel});
$('.right-pannel').css({width: right_pannel_width});
var ip = '<%=request.getServerName()%>';
var port = '<%=request.getServerPort()%>';
var url = "http://" + ip + ":" + port;
$('#add_course').click(function () {
var pk_calender= window.localStorage.getItem(school.common.pk_calender);//校历
var wholeMonday = window.localStorage.getItem(school.common.wholeMonday);//周一的日期
var pk_deptdoc = window.sessionStorage.getItem(school.common.pk_deptdoc);//班级pk
var mondayDays = window.localStorage.getItem(school.common.totalWeeks);//获取周一的总共天数
var convertMonday = JSON.parse(wholeMonday);//周一的日期,数组
// alert(convertMonday);
// var param = [];
// convertMonday.forEach(function(everyMonday,i){
// var obj ={};
// obj.pk_deptdoc = pk_deptdoc;
// obj.pk_calender = pk_calender;
// obj.startScheme_date = everyMonday;
// param.push(obj);
// });
var obj ={};
obj.pk_deptdoc = pk_deptdoc;
obj.pk_calender = pk_calender;
obj.startScheme_date = everyMonday;
//alert(JSON.stringify(param));
$.ajax({
type: 'post',
url: url + '/root/api/getSchema',
contentType: "application/json;charset=UTF-8",
//dataType: "json",
data: obj,
success: function (data) {
alert(data);
},
error: function () {
alert("添加失败!");
}
});
});
});
/*jstree define*/
initNavigation($("#teachercode", window.parent.document).html());
function initNavigation(userCode) {
//初始化导航树
var ip = '<%=request.getServerName()%>';
var port = '<%=request.getServerPort()%>';
var url = "http://" + ip + ":" + port;
$.get(url + "/root/api/class",
{
user_code: userCode
},
function (data) //回传函数
{
$('#second-tree').jstree("destroy");
var treeChildrenData = listToTree(data);
var treeData = [{
"id": "#",
"text": "",
"children": treeChildrenData,
"state": {
"opened": true
}
}];
$('#second-tree').jstree({
"core": {
"check_callback": true,
"themes": {
"responsive": true
},
'strings': {
'Loading ...': '加载中 ...'
},
animation: 200,
"multiple": false,
'data': treeData
}
});
$('#second-tree').on('select_node.jstree', function (e, data) {
var pk_deptdoc = data.node.original.pk_deptdoc;//班级pk
window.sessionStorage.setItem(school.common.pk_deptdoc,pk_deptdoc);
//对选中的节点进行操作
});
}
);
}
/**
* @author andyzhao
* list转化为tree
* @param data
* @param selectedID 当存在selectID时,默认选中id为selectID的节点
* @returns {Array}
*/
function listToTree(data, selectedID) {
var result = [];
$.each(data, function (n, e) {
var cc = [];
if (e.children != null) {
cc = listToTree(e.children, selectedID);
}
var isChecked = false;
if (e.isChecked == "true") {
isChecked = true;
}
if (e.id == selectedID) {
isChecked = true;
}
e.children = cc;
//e.icon = "fa fa-folder icon-state-default";
e.state = {
"opened": true,
//"selected": isChecked
};
result.push(convertItem(e));
});
return result;
}
function convertItem(o) {
o.id = o.deptcode;
o.text = o.deptname;
return o;
}
/*course js*/
// $(document).ready(function () {
// $('#search').bind('click', function () {
// var option_value = document.getElementById('course-option').value;
// $.each(DataSource, function (i, n) {
// if (option_value == n.id) {
// $.each(n.data, function (j, m) {
// $.each(m.course, function (k, p) {
// $("ul[name='point" + p.pointName + "'] li").eq(0).html("<span>第" + p.pointName + "节<br/>(" + p.pointTime + ")</span>");//填充节次
// $("ul[name='point" + p.pointName + "'] li").eq(m.weekday).html("<span>" + p.courseName + "<br/>" + p.teacherName + "<br/>" + p.address + "</span>");//填充当前老师,课程,听课群组信息
// $("ul[name='point" + p.pointName + "'] li").eq(m.weekday).dblclick(function () {
// location.href = "edit_course_info.jsp";
// });//点击某个td打开另外一个界面
// });
// });
// }
// });
// });
// });
/*获取相应的周数*/
// function display(optionID) {
// var all_options = document.getElementById('course-option').options;
// for (var i = 0; i < all_options.length; i++) {
// if (all_options[i].id == optionID) {
// all_options[i].selected = true;
// }
// }
// }
// display(2);
var ip = '<%=request.getServerName()%>';
var port = '<%=request.getServerPort()%>';
var url = "http://" + ip + ":" + port;
$('#add_course').click(function () {
var pk_calender= window.localStorage.getItem(school.common.pk_calender);//校历
var wholeMonday = window.localStorage.getItem(school.common.wholeMonday);//周一的日期
var pk_deptdoc = window.sessionStorage.getItem(school.common.pk_deptdoc);//班级pk
var mondayDays = window.localStorage.getItem(school.common.totalWeeks);//获取周一的总共天数
var convertMonday = JSON.parse(wholeMonday);//周一的日期,数组
// alert(convertMonday);
// var param = [];
// convertMonday.forEach(function(everyMonday,i){
// var obj ={};
// obj.pk_deptdoc = pk_deptdoc;
// obj.pk_calender = pk_calender;
// obj.startScheme_date = everyMonday;
// param.push(obj);
// });
var obj ={};
obj.pk_deptdoc = pk_deptdoc;
obj.pk_calender = pk_calender;
obj.startScheme_date = everyMonday;
//alert(JSON.stringify(param));
$.ajax({
type: 'post',
url: url + '/root/api/getSchema',
contentType: "application/json;charset=UTF-8",
//dataType: "json",
data: obj,
success: function (data) {
alert(data);
},
error: function () {
alert("添加失败!");
}
});
});
</script>
</html>