Template4.jsp 14.7 KB
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ page import="weaver.hrm.*"%>
<%@ page import="java.util.*"%>
<%@ page import="weaver.general.*"%>
<jsp:useBean id="cmutil" class="weaver.km.util.CommonTransUtil" scope="page" />
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<%
    User user = HrmUserVarify.getUser (request , response) ;
    if (user == null){
        response.sendRedirect("/login/Login.jsp");
        return;
    }
    String userId = user.getUID()+"";
    String mapId = Util.null2String(request.getParameter("mapId"));
    String name = "";
    String remark = "";
    rs.executeSql("select name,remark from KT_Map where deleted=0 and id="+mapId);
    if(rs.next()){
        name = Util.null2String(rs.getString("name"));
        remark = Util.toHtmlMode(rs.getString("remark"));
    }
    int mprogress = Util.getIntValue((String)cmutil.getMapStatus(userId,mapId),0);
    String detailPage = "/knowledgeMap/template/TemplateDetail1.jsp?mId="+mapId;
%>
<!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>
    <title><%=name %></title>
    <script type=text/javascript src="/js/jquery/jquery_wev8.js"></script>
    <link href="../js/zDialog/zDialog_e8_wev8.css" type=text/css rel=stylesheet>
    <link href="../js/zDialog/e8_zDialog_btn_wev8.css" type=text/css rel=stylesheet>
    <script language="javascript" src="../js/zDialog/zDialog_wev8.js"></script>
    <script language="javascript" src="../js/weaver_lang_7_wev8.js"></script>
    <style>
        html,body{
            margin:0px;
            height:100%;
            background: #f3f3f3 url(/knowledgeMap/images/step_bg.png) repeat;
            min-height:700px;
            min-width:900px;
        }
        #left-cover{
            left:0;
            background:url(/knowledgeMap/images/left-cover-edge.png) right top repeat-y;
            background-color:#f8f8f8;
            float:left;
            position:relative;
            width:20%;
            height:100%;
            opacity:.90;
            filter:alpha(opacity=90);
            z-index:1;
            cursor:pointer;
            visibility:hidden;
        }
        #left-cover:hover{
            background-color: #ebebeb;
        }
        #left-cover:hover #previous-arrow {
            background-position: -40px -280px;
        }
        #previous-arrow {
            width: 16px;
            height: 29px;
            top: 45%;
            right: 15%;
            position: absolute;
            background:url(/knowledgeMap/images/steppage_head.png) 0 -280px;
        }
        #step-play-container{
            float:left;
            width:800px;
            height:100%;
            position:relative;
        }

        .right-cover{
            right:0;
            background:url(/knowledgeMap/images/right-cover-edge.png) left top repeat-y;
            background-color: #f8f8f8;
            float:left;
            position:relative;
            height:100%;
            opacity:.90;
            filter:alpha(opacity=90);
            cursor:pointer;
        }
        #right-cover:hover{
            background-color: #ebebeb;
        }
        #right-cover:hover #next-arrow{
            background-position: -40px -280px;
        }
        #next-arrow:hover{
            background-position: -40px -280px;
        }
        .next-arror{
            width: 16px;
            height: 29px;
            top: 45%;
            left: 20%;
            position: absolute;
            -moz-transform:scaleX(-1);
            -webkit-transform:scaleX(-1);
            -o-transform:scaleX(-1);
            transform:scaleX(-1);
            /*IE*/
            filter:FlipH;
            background:url(/knowledgeMap/images/steppage_head.png) 0 -280px;
        }

        .step-item-container {
            width: 800px;
            height: 100%;
            display: inline-block;
            float: left;
        }
        .testImg{
            width:100%;
            height:100%;
        }
        #step-pager-list{
            list-style:none;
            font-family: "宋体";
            text-align:center;
            height:40px;
            margin:10px auto 0 auto;
        }
        #step-pager-list li{
            float: left;
            margin-right: 10px;
            position: relative;
            height:35px;
            color: #fff;
        }
        #step-pager-list li a{
            color: #fff;
            background: url(/knowledgeMap/images/steppage_head.png) -120px -50px no-repeat;
            display: inline-block;
            width: 25px;
            height: 25px;
            text-align: center;
            line-height: 25px;
            font-size:14px;
            text-decoration: none;
        }
        aVisited{
            background-position: -120px -140px;
        }
        aHover{
            background-position: -120px -80px;
        }
        #step-pager-list li a:hover{
            background-position: -120px -80px;
        }
        .reatCls{
            line-height:10px;
            font-size:10px;
            color:#f19115;
        }
        .knowledgeTitle{
            font-family:"微软雅黑";
            color:#e1f2ff;
            padding-left:10px;
            text-align:left;
            height:30px;
            line-height:30px;
            font-size:16px;
            background:url(/knowledgeMap/images/bg_contenttop.png) repeat-x
        }

    </style>
</head>

<body>
<!-- top div -->
<div style="width:100%;height:55px;text-align:center;color:#ccc;line-height:40px">
    <div style="background:#555251;font-family: 微软雅黑">
        <b><%=name %></b>
    </div>
    <div style="height:15px;width:100%"></div>
</div>
<!-- center div -->
<div id="center-part" style="width:100%;overflow:hidden;position:relative;">
    <!-- center left div -->
    <div id="left-cover">
        <div id="previous-arrow">

        </div>
    </div>
    <!-- center certer div -->
    <div id="step-play-container" style="float:left;width:800px;height:100%;position:relative;">
        <div id="step-play-list" style="height:100%;position: absolute;left:0;">
            <div class="step-item-container">
                <div style="height: 100%;background: url('/knowledgeMap/images/bg_contentbg.png') repeat;">
                    <div style="margin-left: 30px;line-height:44px;font-size: 16px;padding-top: 20px;font-weight: bold;font-family: 微软雅黑"><%=name %></div>
                    <div id="remarkComtainer" style="font-size: 12px;font-weight: normal;padding: 30px;font-family: 微软雅黑">
                        <%
                            session.setAttribute("remark_"+mapId,remark);
                        %>
                        <iframe src="/knowledgeMap/template/ShowFckEditorDesc.jsp?sessionname=remark_<%=mapId %>&seth=0" width="100%" height="100%" marginheight="0" marginwidth="0" allowTransparency="true" frameborder="0"></iframe>
                    </div>
                </div>
            </div>
            <%
                Map tsmap = cmutil.getMAllTStatus(userId,mapId);
                String detailId = null;
                double detailRate = 0;
                double themeRate = 0.0d;
                String pgtext = "";
                String detailTitle = null;
                Map<String,Object> idRateMap = null;
                List<Map<String,Object>> detailList = new ArrayList<Map<String,Object>>();
                rs.executeSql("select id,title,rate from KT_MapDetail where deleted=0 and mapId="+mapId+" order by sort,id");
                while(rs.next()){
                    detailId = Util.null2String(rs.getString("id"));
                    detailTitle = Util.null2String(rs.getString("title"));
                    themeRate = Util.getDoubleValue(rs.getString("rate"),0.0);
                    detailRate = Util.getDoubleValue((String)tsmap.get(detailId),0.0);
                    idRateMap = new HashMap<String,Object>();
                    idRateMap.put("detailId",detailId);
                    idRateMap.put("detailRate",themeRate==0.0?100:detailRate);
                    idRateMap.put("detailTitle",detailTitle);
                    detailList.add(idRateMap);
            %>
            <div class="step-item-container">
                <div class="knowledgeTitle">
                    <b><%=detailTitle %></b>
                </div>
                <div class="item-center">
                    <iframe id='contentFrame' name='contentFrame' height='100%' width='100%' allowTransparency= "true" style="background: none;"
                            marginwidth="0" marginheight="0" frameborder="0" scrolling='auto' src="<%=detailPage%>&tId=<%=detailId%>&themeRate=<%=themeRate %>"></iframe>
                </div>
            </div>
            <%}%>

        </div>
    </div>
    <!-- center right div -->
    <div class="right-cover" id="right-cover">
        <div id="next-arrow" class="next-arror">

        </div>
    </div>
</div>
<!-- foot div -->
<div style="width:100%;height:70px;text-align:center;color:#ccc;text-align:left;">
    <div style="height:10px;background:#9B9EA3;position:relative;left:0;">
        <div id="finishRate" style="height:10px;background:#FE9115;position:relative;left:0;"></div>
    </div>
    <ul id="step-pager-list">
        <li id="mapFirst"><a style="background: url(/knowledgeMap/images/steppage_head.png) -120px -140px no-repeat;" href="javascript:;"></a><br/><label class="reatCls"><%=mprogress%>%</label></li>
        <%
            for(int i=0;i<detailList.size();i++){
                idRateMap = detailList.get(i);
                detailId = (String)idRateMap.get("detailId");
                detailRate = (Double)idRateMap.get("detailRate");
                detailTitle = (String)idRateMap.get("detailTitle");
        %>
        <li id="page_<%=detailId %>" title="<%=detailTitle %>"><a href="javascript:;"><%=i+1 %></a><br/><label class="reatCls"><%=detailRate %>%</label></li>
        <%
            }

        %>
    </ul>
</div>
<script type="text/javascript">
    //展示知识点顺序
    var playListIndex = 0;
    //展示列表左偏移量
    var playListLeft = 0;
    //展示区域宽度
    var playContainerWidth=800;
    //页码宽度
    var pagerListWidth=40;
    //屏幕的高宽
    var winHeight,winWidth;
    //设置中间展示div的宽度
    function setRightLeftRateWidth(isSetTime){
        winWidth = $('body').width();
        winHeight = $('body').height();
        var leftWidth = (winWidth - playContainerWidth)/2;
        var rightWidth = winWidth - playContainerWidth -leftWidth;

        //左箭头
        $("#left-cover").css({"width":leftWidth+"px"});
        //右箭头
        $("#right-cover").css({"width":rightWidth+"px"});
        //中部
        $("#center-part").css({"height":(winHeight-55-70)+"px"});
        //描述
        $("#remarkComtainer").css({"height":(winHeight-55-70-64-60)+"px"});
        //每个主题的展示区
        $("#center-part .item-center").css({"height":(winHeight-55-70-30)+"px"});
        finishRateChange(<%=mprogress%>,isSetTime);
    };
    //添加屏幕大小改变事件
    $(window).resize(function(){
        setRightLeftRateWidth(false);
    });

    /**
     * 设置完成比
     */
    function finishRateChange(rate,isSetTime){
        $("#finishRate").attr("title","所有内容已完成" + rate + "%");
        $("#finishRate").animate({"width":(winWidth*rate/100)+"px"},isSetTime?300:0);
        $("#mapFirst label").text(rate + "%");
    }

    $(document).ready(function(){
        //设置中间div宽度
        setRightLeftRateWidth(false);
        //设置中间展示区域宽度
        $("#step-play-list").css("width",($("#step-play-list").children("div").length * playContainerWidth) + "px");
        //设置页码宽度
        $("#step-pager-list").css("width",($("#step-pager-list").children("li").length * pagerListWidth+100) + "px");
        //添加下一页事件
        $("#right-cover").click(function(){
            //展示内容总宽度
            var width = parseInt($("#step-play-list").css("width"));
            //总宽度与左偏移之和大于展示区宽度则可以移动
            if((width + playListLeft) > playContainerWidth){
                playListLeft -= playContainerWidth;
                playListIndex += 1;
                setPagerStyle(playListIndex);
                $("#step-play-list").animate({"left":playListLeft+"px"},500);
                displayCover();
            }
        });
        //添加前一页事件
        $("#left-cover").click(function(){
            var width = parseInt($("#step-play-list").css("width"));
            if(playListLeft < 0){
                playListLeft += playContainerWidth;
                playListIndex -= 1;
                setPagerStyle(playListIndex);
                $("#step-play-list").animate({"left" : playListLeft+"px"},500);
                displayCover();
            }
        });
        /**
         * 是否展示箭头
         */
        function displayCover(){
            //展示内容总宽度
            var width = parseInt($("#step-play-list").css("width"));
            //如果是第一页则前一页区域隐藏
            if(playListIndex == 0){
                $("#left-cover").css({"visibility":"hidden"});
            }else{
                $("#left-cover").css({"visibility":"visible"});
            }
            //如果移到了最后一页后一页区域隐藏
            if((width + playListLeft) > playContainerWidth){
                $("#right-cover").css({"visibility":"visible"});
            }else{
                $("#right-cover").css({"visibility":"hidden"});
            }
        }
        //为页码添加事件
        $("#step-pager-list li a").each(function(inx){
            $(this).click(function(){
                playListLeft = -playContainerWidth * inx;
                playListIndex = inx;
                $("#step-play-list").animate({"left":playListLeft+"px"},500);
                displayCover();
                setPagerStyle(inx);
            });
        });

        /**
         * 设置页码样式
         */
        function setPagerStyle(index){
            $("#step-pager-list li a").css({"background-position":"-120px -50px"});
            $("#step-pager-list li a").mouseover(function(){
                $(this).css({"background-position":"-120px -80px"});
            }).mouseout(function(){
                $(this).css({"background-position":"-120px -50px"});
            });
            $("#step-pager-list li a").eq(playListIndex).css({"background-position":"-120px -140px"}).unbind("mouseover mouseout");;
        }
    });
    /**
     * 设置总进度
     */
    function setPg(_width){
        finishRateChange(_width,true);
    }
    /**
     * 设置知识点进度
     */
    function setPg2(tId,_width){
        $("#page_" + tId + " label").text(_width+"%");
    }
</script>
</body>
</html>