<%@ Page Title="轮播广告" Language="C#" MasterPageFile="~/Masters/Sys.Master" AutoEventWireup="true" CodeBehind="Banners.aspx.cs" Inherits="yueyaCMS.Admin.Site.Banners" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<style type="text/css">
    #masonry_container{min-height:600px}
    #masonry{position:relative;padding:0;margin:0 auto}
    #masonry .thumbnail{float:left;width:330px;margin:20px;padding:0;border-width:1px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,0.175);box-shadow:0 6px 12px rgba(0,0,0,0.175)}
    #masonry .thumbnail:hover{border:solid 1px #ff6a00;}
    #masonry .thumbnail .imgs{padding:10px;height:200px;line-height:200px;overflow:hidden}
    #masonry .thumbnail .imgs img{margin-bottom:5px;width:100%}
    #masonry .thumbnail .caption{background-color:#fff;padding-top:0;font-size:13px;padding-top:5px;border-top:solid 1px #eee;background-color:#efefef}
    #masonry .thumbnail .caption .title{font-size:13px;font-weight:bold;margin:5px 0;text-align:left}
    #masonry .thumbnail .caption .author{font-size:11px;text-align:right}
    #masonry .thumbnail .caption .author span{ float:left; line-height:2.3;margin-left:5px;}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<ul class="breadcrumb">
<li><i class="icon-tags"></i> 您当前的位置：<a href="/Admin/Site/Default.aspx">系统首页</a></li>
<li><span class="divider">/</span> <span>广告管理</span></li>
</ul>

<form id="form2" runat="server">
<div id="myModal" class="modal hide fade" style="width:350px;left:60%;">
    <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h3>添加广告图</h3>
    </div>
    <div class="modal-body" style="padding:0px 15px;">
         <p>
              <div class="input-prepend">
                  <span class="add-on"><i class="icon-edit"></i> 广告标题</span>
                  <asp:TextBox ID="BannerTitle" runat="server" />
              </div>
          </p>


          <p>
              <div class="input-prepend">
                  <span class="add-on"><i class="icon-globe"></i> 链接地址</span>
                  <asp:TextBox ID="BannerHref" runat="server" ToolTip="无需连接请填写“#”" Text="#" />
              </div>
          </p>

           <p>
              <div class="input-prepend input-append">
                  <span class="add-on"><i class="icon-picture"></i> 选择图片</span>
                  <a href="javascript:;" onclick="showImgUpload();" class="btn btn-success">上传</a>
                  <asp:FileUpload ID="FileUpload1" runat="server" style="display:none" />
              </div>
          </p>
    </div>
    <div class="modal-footer">
    <a href="#" class="btn" onclick="showModal(0);">关闭</a>
    <asp:Button ID="Button1" runat="server" CssClass="btn btn-primary" Text="确认添加" onclick="Button1_Click" />
    </div>
    </div>


    <%if(!String.IsNullOrEmpty(errorMsg)){ %><div class="alert alert-error"><p><%=errorMsg %></p></div><%} %>

    <div>  <a href="Banners.aspx" class="btn btn-warning">查看全部</a>&nbsp;
    <a href="javascript:void(0)" class="btn btn-success" onclick="showModal(1);">添加广告</a></div>
    <div id="masonry_container">
<div id="masonry"><% Int32 i = 1; foreach (var v in DBView){ %>
<div class="thumbnail">
<div class="imgs"><a href="<%=v.ImgPath%>" target="_blank"><img src="<%=v.ImgPath %>" /></a></div>
<div class="caption">
<div class="title"><a href="<%=v.Href %>" target="_blank"><%=v.Title %></a></div>
<div class="author"><span><%=v.CreateDate.ToString("yyyy-MM-dd HH:mm:ss") %></span><a href="<%=v.ImgPath %>" target="_blank" class="btn btn-mini btn-warning">预览</a>&nbsp;&nbsp;<a href="javascript:void(0)" onclick="if(confirm('是否确认删除？')){window.location.href='/Admin/Site/Banners.aspx?action=del&id=<%=v.ID %>';}" class="btn btn-mini">删除</a></div>
</div>
</div><% i++; } %>
</div>
</div>
</form>

<script src="/Scripts/imagesloaded.pkgd.min.js"></script>
<script src="/Scripts/masonry.pkgd.min.js"></script>
<script type="text/javascript">
    function showImgUpload() {
        $("#<%=FileUpload1.ClientID%>").click();
    }
    function showModal(_s) {
        if (_s == 0) { $("#myModal").modal("hide"); }
        else {
            $("#myModal").modal({ show: true, backdrop: true });
        }
    }
    $(function () {
        var masonryNode = $('#masonry');
        masonryNode.imagesLoaded(function () {
            masonryNode.masonry({ itemSelector: '.thumbnail', isFitWidth: true });
        });
    });
    </script>
</asp:Content>
