
<script type="text/javascript">
    $(document).ready(function(){
        $('.attach_li img').each(function(){

                var sn=$(this).attr('fn').split('.')[1].substring(0,3).toLowerCase();
                console.log(sn);
                
                var s='/static/images/file_icon/';               
                if(sn=='xls') {
                    s=s+'Excel-icon.png';                        
                }else if (sn=='doc'){
                    s=s+'MS-Word-2-icon.png';   
                }else if (sn=='pdf') {
                    s=s+'document-pdf-icon.png';   
                }else if (sn=='csv') {
                    s=s+'Office-excel-csv-icon.png';   
                }else if (sn=='ppt' || sn=='pps') {
                    s=s+'PowerPoint-icon.png';  
                }else if (sn=='rar' || sn=='zip') {
                    s=s+'document-compress-icon.png';   
                }else if (sn=='jpg'||sn=='jpe'||sn=='png'||sn=='bmp'||sn=='gif'||sn=='bmp'){
                    s=s+'Pictures-icon.png';   
                }else{
                    s=s+'Document-icon.png';   
                };
                $(this).attr('src',s);
                
        });



        $('#data-content .ft a').click(function(){
            event.preventDefault();
            $.RefreshContent($(this).attr('href'));     
        });



    });
</script>


<style>
    .attachments a{
        color: #00579c;
        text-decoration: none;
        cursor:pointer;
    }
    .attachments a:hover{       
        font-weight:bold;        
    }
    .attach_li{
        list-style:none;
        display:inline-block;
        padding:0px 10px;
    }
    .attach_li img,.attach_li a{
        clear: both;
        display: block;
      
    }
    #data-content .tt{
        margin:10px;
        font-size:20px;
        color:black;
    }
    #data-content .ft span{
        font-size:13px;
        margin-right:20px;
    }
</style>

<div>
    <ol class="breadcrumb">
        <li>公司管理</li>
        <li>公告信息</li>
    </ol>
</div>

<div class="x_panel">
    <div class='tt'>{{obj.subject}}</div>
    <div class='content'>
        {% if obj.content %}
            {{ obj.content|safe }}
        {% else %}
            <span style='font-size:16px;margin:10px;'>正文 (空白)</span>
        {% endif %}
    </div>
</div>

<div class='ft'>
    <span>发布人：{{obj.user.username}}</span>
    <span>发布时间：{{obj.tm|date:'Y-m-d H:i:s'}}</span>
    <span>
        {% ifequal user.company.level_id 1 %}
            {% if perms.company.sys_admin %}    
                <a class='btn btn-xs btn-primary' href="/company/bulletinboard/{{obj.id}}/">修改</a>
            {% endif %}
        {% endifequal %}
    </span>
</div>

<div class='attachment'>
    {% for a in obj.bulletinboardattach_set.all %}
        <li class='attach_li'>
            <a  href="/media/{{a.attachment.name}}" download="{{a.get_name}}">
                <img fn='{{a.get_name|safe}}'></img>{{a.get_name|safe}}
            </a>
        </li>
    {% endfor %}
</div>
