<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: zsy
    $Date: 2018/11/14
    $Revision: 1.0
    常用链接 微件
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure/>
    <a:view template="default" package="leaf.ui.std">
        <style>
            html,body{
                width:220px;
                height:249px;
                margin: 0;
                padding: 0;
                color:#000;
            }
            .widget_hot_link{
                box-sizing:border-box;
                width:220px;
                height:249px;
                background-color:#fff;
                position:relative;
                border:1px solid #F0F0F3;
                user-select:none;
                cursor:default;
            }
            .widget_hot_link .widget_label{
                position:absolute;
                width:40px;
                height:4px;
                top:0;
                left:16px;
                background-color:#5A7FFF;
            }
            .widget_hot_link .widget_title{
                box-sizing:border-box;
                position:relative;
                height:20px;
                line-height:20px;
                margin:16px 0 10px 0;
                font-family: PingFangSC-Medium;
                font-size: 14px;
                padding:0 24px 0 16px;
                color: rgba(75,80,90,0.85);
                letter-spacing: 0;
            }
            .widget_hot_link .widget_content{
                box-sizing:border-box;
                width:100%;
                height:205px;
                border-top:1px solid #EDEDED;
                padding:4px 15px;
            }
            .widget_hot_link .widget_content .link{
                display: block;
                width:100%;
                height:20px;
                margin-top:12px;
                text-decoration:none;
            }
            .widget_hot_link .widget_content .link:visited,
            .widget_hot_link .widget_content .link:hover,
            .widget_hot_link .widget_content .link:active{
                text-decoration:none;
                color: rgba(75,80,90,0.85);
            }
            .widget_hot_link .widget_content .link .icon{
                width:20px;
                height:20px;
            }
            .widget_hot_link .widget_content .link .link_info{
                font-family: PingFangSC-Regular;
                font-size: 12px;
                color: rgba(75,80,90,0.85);
                line-height: 20px;
                vertical-align:top;
                padding-left:0.3em;
                max-width: 150px;
                white-space: nowrap;
                overflow: hidden;
                display: inline-block;
                text-overflow: ellipsis;
            }
        </style>
        <script><![CDATA[
        $L.onReady(function(){
            var ds = $("widget_sys_hot_link_ds");
            ds.qpara={
                enable_flag:'Y'
            };
            ds.query();
        });
        function onLoad_widget_sys_hot_link_ds(ds){
            var htmlStr = '';
            var records = ds.getAll();
            var wrapper = jQuery(".widget_hot_link .widget_content");
            for(var i=0;i<records.length;i++){
                var addr = records[i].get("common_link_address");
                var reg=/(file:\/\/\/)|(FTP:\/\/)|(HTTP:\/\/)|(HTTPS:\/\/)|(mailto:)|(MMS:\/\/)|(ed2k:\/\/)|(Flashget:\/\/)|(thunder:\/\/)/i;
                if(!reg.test(addr)){
                    addr = 'http://' + addr;
                }
                htmlStr += '<a class="link" target="_blank" href="' +addr+ '">'
                +'<img class="icon" src="${/request/@context_path}/leafresource/images/widget/link.png"/>'
                +'<span class="link_info">' +records[i].get("common_link_name")+ '</span>'
                +'</a>';
            }
            wrapper.html(htmlStr);
        }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="widget_sys_hot_link_ds" model="sys.SYS002.hls_sys_common_links"
                       autoQuery="false" pageSize="5" fetchAll="false">
                <a:fields>
                    <a:field name="enable_flag" checkedValue="Y" defaultValue="Y" uncheckedValue="Y"/>
                    <a:field name="common_link_name"/>
                    <a:field name="common_link_address"/>
                </a:fields>
                <a:events>
                    <a:event name="load" handler="onLoad_widget_sys_hot_link_ds"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <div class="widget_hot_link">
            <span class="widget_label"> </span>
            <div class="widget_title">常用链接</div>
            <div class="widget_content"> </div>
        </div>
    </a:view>
</a:screen>