<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="list.aspx.cs" Inherits="wjdhcms_SAAS.module.neilian.list" %>

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<title>信息管理</title>

    <!-- start: CSS file-->
    <!-- Vendor CSS-->
    <link href="../static/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <link href="../static/vendor/skycons/css/skycons.css" rel="stylesheet" />
    <link href="../static/vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" />

    <!-- Plugins CSS-->
    <link href="../static/plugins/bootkit/css/bootkit.css" rel="stylesheet" />     
    
    
    <!-- Page CSS -->   
    <link href="../static/css/style.css" rel="stylesheet" />
    <link href="../static/css/add-ons.min.css" rel="stylesheet" />
    <!-- end: CSS file--> 
      
    
    <!-- Head Libs -->
    <script src="../static/plugins/modernizr/js/modernizr.js"></script>
    
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="../static/js/html5shiv.min.js"></script>
      <script src="../static/js/respond.min.js"></script>
    <![endif]-->    
    

</head>

<body class="mainbody">
  <div class="container-fluid">
    <div class="row"> 
            <div class="col-lg-12">
              <div class="panel">
                <div class="panel-heading bk-bg-primary">
                  <div class="list-articles">
					<div class="col-sm-3 pull-right bk-margin-top-10">
                     <!-- <div class="input-group">
                          <input type="email" id="keywords" name="keywords" class="form-control" placeholder="输入搜索关键词">
                          <span class="input-group-btn">
                          <button type="button" class="btn btn-success" id="submit" ><i class="fa fa-search" data-toggle="tooltip" title="搜索"></i></button>
                          </span>
                        </div>-->
                    </div>
                      <a href="edit.aspx?action=add&pid=0" class="release btn btn-default"><i class="fa fa-pencil-square-o"></i>新增</a>
                     <!-- <button onclick="addlist(1);" class="release btn btn-default"><i class="fa fa-spinner"></i>新增</button>
                  <a href="edit.aspx?cid=47" class="btn btn-default"><i class="fa fa-sliders"></i>重置内链</a>
                    <button type="button" class="btn btn-default" id="selectAll"><i class="fa  fa-check-square-o"></i>全选</button>
                    <button type="button" class="btn btn-default" id="selectback"><i class="fa   fa-check-square"></i>反选</button>-->
                    <button type="button" class="bk-margin-right-15 btn btn-default" onclick="batchDelete('/ajax/success.aspx')"><i class="fa fa-trash-o"></i>删除</button>

                  </div>
                </div>
                <div class="panel-body">
                  <div class="table-responsive">
                    <table class="table table-bordered table-striped table-condensed table-hover article-list">
                      <thead>
                        <tr>
                          <th width="4%" align="center" class="text-center">选择</th>
                          <th width="20%">链接名称</th>
                          <th>链接地址</th>
                          
                          <th width="4%">排序</th> 
                          <th width="10%">操作</th>                                          
                        </tr>
                      </thead>   
                      <tbody>
                                                                   
                      </tbody>
                    </table>
                  </div>
                  <div class="pages text-right">
                    <ul class="pagination">
                      <li id="pageprev"><span>&laquo;</span></li>
                      <ul class="pagination" id="page-list"></ul>
                      <li id="pagenext"><span>&raquo;</span></li>
                    </ul>
                    <ul class="pagination">
                      <li id="pageall"><span></span></li>
                    </ul>
                  </div>
                </div>
              </div>
            </div>
          </div>  
  </div>

    <!-- start: JavaScript-->
    
    <!-- Vendor JS-->       
    <script src="../static/vendor/js/jquery-2.1.1.min.js"></script>
    <script src="../static/vendor/js/jquery-migrate-1.2.1.min.js"></script>
    <script src="../static/vendor/bootstrap/js/bootstrap.min.js"></script>
    <script src="../static/vendor/skycons/js/skycons.js"></script>    
    


    <!-- Pages JS -->

    <script src="../static/js/ajax.js"></script>
    
    <!-- end: JavaScript-->


    <script>
        $(function () {
            addlist(1);
            //点击翻页
            $('#page-list').on('click', 'li', function () {
                var that = $(this);
                var index = that.find('span').text();
                if (!that.hasClass('disabled')) {
                    addlist(index);
                }
            });
            //上一页
            $('#pageprev').on("click", function () {
                if (!$(this).hasClass('disabled')) {
                    var page = $('#page-list li[class*="active"').index();
                    addlist(page);
                    console.log(page)
                }
            })
            //下一页
            $('#pagenext').on("click", function () {
                if (!$(this).hasClass('disabled')) {
                    var page = $('#page-list li[class*="active"').index();
                    addlist(page + 2);
                    console.log(page + 2)
                }
            });
            //搜索
            $('#submit').on("click", function () {
                var val = $('#keywords').val();
                get_json('/ajax/', function () {
                    pages(data);
                })
            })
        });

        function addlist(page) {
            get_json("../../api/keys.ashx?action=list&catid=&page=" + page, function (data) {
                pages(data);
                getlist(data);
                $("[data-toggle='tooltip']").tooltip();
            })
        };
        function get_screen(url) {
            get_json(url, function (data) {
                pages(data);
                getlist(data);
                $("[data-toggle='tooltip']").tooltip();
            })
        };
        function getlist(data) {
            var list = '';
            for (var i = 0; i < data.data.list.length; i++) {
                //var add_time = data.data.list[i].add_time;
                //add_time = formatTime(add_time, "yyyy-MM-dd hh:mm:ss");
                list += '<tr id="l' + data.data.list[i].id + '">'
                        + '<td class="text-center">'
                          + '<div class="checkbox-custom checkbox-inline">'
                            + '<input type="checkbox" id="inline-checkbox' + data.data.list[i].id + '" value="' + data.data.list[i].id + '">'
                            + '<label for="inline-checkbox' + data.data.list[i].id + '"></label>'
                          + '</div>'
                        + '</td>'
                        + '<td>' + data.data.list[i].title + '</td>'
                        + '<td>' + data.data.list[i].url + '</td>'
                       // + '<td>' + data.data.list[i].weizhi + '</td>'
                        + '<td>'
                         + '<input type="text" name="listorder" class="form-control listorder" value="' + data.data.list[i].listorder + '">'
                        + '</td>'
                        + '<td>'
                          + '<a class="btn btn-success" href="edit.aspx?action=edit&id=' + data.data.list[i].id + '" data-toggle="tooltip" title="编辑">'
                            + '<i class="fa fa-edit"></i>'
                          + '</a>'
                          + '<button class="btn btn-info delete" onClick="Delete(\'../../api/keys.ashx?action=del&id=' + data.data.list[i].id + '\')" data-toggle="tooltip" title="删除">'
                            + '<i class="fa fa-trash-o"></i>'
                          + '</button>'
                        + '</td>'
                      + '</tr>'
            };
            $('.table tbody').html(list);
        }

    </script>
    
</body>

</html>
