<!--#include file="Content_Fun.asp" -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="<%=sitepath%>css/bootstrap.min.css" rel="stylesheet">
<link href="<%=sitepath%>css/font-awesome.min.css" rel="stylesheet">
<link href="<%=sitepath%>plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
<link href="<%=sitepath%>css/animate.min.css" rel="stylesheet">
<link href="<%=sitepath%>css/style.min.css" rel="stylesheet">
<link href="<%=sitepath&adminpath%>css/adminstyle.css" rel="stylesheet">
<script src="<%=sitepath%>js/jquery.min.js"></script>
<!--[if lte IE 9]>
<script src="<%=sitepath%>js/respond.min.js"></script>
<script src="<%=sitepath%>js/html5.js"></script>
<![endif]-->
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content">
<div class="ibox float-e-margins">
<div class="row row-lg">
<div class="col-md-6">
							<div class="panel">
								<div class="panel-heading">
									<h3 class="panel-title"><%=STypename%>管理</h3>
									<div class="panel-aj">
										<button type="button" class="btn-toggle-collapse"><i class="fa fa-chevron-down"></i></button>
										<button type="button" class="btn-remove"><i class="fa fa-times"></i></button>
									</div>
								</div>
<div class="panel-body">
<div class="panel-body no-padding">		
<div class="ibox-content">

          <div class="row">
            <div id="toolbar">
              <div class="col-sm-lm2">
                <div class="input-group">
                  <input type="text" placeholder="请输入关键词" id="keys" value="<%=keyword%>" class="input-sm form-control">
                  <span class="input-group-btn">
                  <button type="button" id="search"  class="btn btn-primary2"> 搜索</button>
                  </span> </div>
              </div>
              <div class="col-sm-5 text-right">              
                <button onClick="opennew('<%=sitepath&adminpath%>cms_content/Content/Content_Add.asp?Stype=<%=Stype%>&Sid=<%=sid%>')" class="btn btn-primary addcontent" type="button"><i class="fa fa-plus"></i> 添加</button>
                <button onClick="parent.$('#custom a').click()" class="btn" type="button"><i class="fa fa-sliders"></i> 参数管理</button>
                <button onClick="location.reload()" class="btn btn-primary1" type="button"><i class="fa fa-refresh"></i> 刷新</button>
                <button onClick="location=('<%=sitepath&adminpath%>cms_content/Content/Content_List.asp?Stype=<%=Stype%>')" class="btn btn-primary1" type="button"><i class="fa fa-rotate-left"></i> 返回</button>
              </div>
            </div>
          </div>
          <div class="table-responsive">
            <table class="table table-striped">
              <thead>
                <tr>
                  <th><input  id="SelectAll" type="checkbox"></th>
                  <th class="orderby" id="byCID" order="CID" desc='<%=ordsc%>' >ID</th>
                  <th class="orderby" id="byC_title" order="C_title" desc='<%=ordsc%>' >标题</th>
                  <th>分类</th>
                  <th class="orderby" id="byC_AddTime" order="C_AddTime" desc='<%=ordsc%>' >时间</th>
                  <th class="orderby" id="byC_Order" order="C_Order" desc='<%=ordsc%>' >排序</th>
                  <th  class="orderby" id="byC_OnOff" order="C_OnOff" desc='<%=ordsc%>' >开关</th>
                  <th style="width:85px;">操　作</th>
                </tr>
              </thead>
              <tbody>
                <% call listContent%>
              </tbody>
            </table>
          </div>

</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

<div class="modal inmodal fade" id="myModal6" tabindex="-1" role="dialog" aria-hidden="true">
  <div class="modal-dialog modal-sm">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span> </button>
        <h4 class="modal-title">复制内容到分类</h4>
      </div>
      <div class="modal-body">
        <select class="form-control m-b"  id="copySortID">         
        </select>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
        <button type="button" id="copyid" class="btn btn-primary">复制</button>
      </div>
    </div>
  </div>
</div>
<div class="modal inmodal fade" id="myModal5" tabindex="-1" role="dialog" aria-hidden="true">
  <div class="modal-dialog modal-sm">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span> </button>
        <h4 class="modal-title">移动内容到分类</h4>
      </div>
      <div class="modal-body">
        <select class="form-control m-b"  id="moveSortID">
        </select>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
        <button type="button" id="moveid" class="btn btn-primary">移动</button>
      </div>
    </div>
  </div>
</div>
<script type="text/javascript" src="<%=sitepath%>plugins/jedate/jquery.jedate.js"></script>
<link type="text/css" rel="stylesheet" href="<%=sitepath%>plugins/jedate/jedate.css">
<script src="<%=sitepath%>js/bootstrap.min.js"></script> 
<script src="<%=sitepath%>js/klorofil-common.js"></script>
<script src="<%=sitepath%>plugins/peity/jquery.peity.min.js"></script> 
<script src="<%=sitepath%>plugins/layer/layer.min.js"></script> 
<script src="<%=sitepath%>plugins/fancybox/jquery.fancybox.js"></script>
<link href="<%=sitepath%>plugins/fancybox/jquery.fancybox.css" rel="stylesheet">
<script src="<%=sitepath&adminPath%>js/adminjs.js"></script>
<script>
$(function() {
	$("#by<%=orderby%>").addClass("order<%=ordsc%>")		
	if("<%=sid%>"==""){$(".addcontent").attr("disabled",true).attr("title","请先添加分类")}	
});
$("#move").click(function(){
	var maxIndex=$("#moveSortID option").length
	if (maxIndex==0){
	var index = layer.load(0,{shade: [0.6,'#000']})
  $.post("content_Fun.asp?act=Loadsortlist",{"sid":"<%=sid%>","stype":"<%=stype%>"},function(data){
	 layer.close(index);	 	 
	 $("#moveSortID").append(data)	 	 
	 });
	}
})
$("#copy").click(function(){
	var maxIndex=$("#copySortID option").length
	if (maxIndex==0){
	var index = layer.load(0,{shade: [0.6,'#000']})
  $.post("content_Fun.asp?act=Loadsortlist",{"sid":"<%=sid%>","stype":"<%=stype%>"},function(data){
	 layer.close(index);	 	 
	 $("#copySortID").append(data)	 	 
	 });
	}
})
//获取class为caname的元素 
$(".caname").click(function() {
  var td = $(this);
  var id = td.attr("id")
  var txt = td.text();
  var val = td.attr("title");
  var color=  $(this).find("font").attr("color")		
  var input = $("<input type='text' style='width:80%' value='" + val + "'/>");
  td.html(input);
  input.click(function() {
	  return false;
  });
  //获取焦点 
  input.trigger("focus");
  //文本框失去焦点后提交内容，重新变为文本 
  input.blur(function() {
	  var newtxt = $(this).val();
	  if (newtxt.length>0 && newtxt != val) {
		$.post("content_Fun.asp?act=savetitle&colval="+newtxt+"&colid="+id,function(data){
			layer.msg('修改成功');
			td.html("<font  color='"+color+"'>"+data+"</font>");
			td.attr("title",newtxt);
		});
	  } else {
		  td.html("<font  color='"+color+"'>"+txt+"</font>");
	  }
	});
 });

$("#search").click(function(){
	keys=$("#keys").val()
	location.href="?Stype=<%=Stype%>&SID=<%=SID%>&keyword="+keys
	});
$(".orderby").click(function(){
	var orderby=$(this).attr("order")
	var desc=$(this).attr("desc")
	if (desc=="1"){desc="0"}else{desc="1"} 
	location.href="?Stype=<%=Stype%>&SID=<%=SID%>&keyword=<%=keyword%>&page=<%=page%>&psize=<%=psize%>&orderby="+orderby+"&ordsc="+desc	
});

$("#SelectAll").on("click",function(){
	$(".checkbox").prop("checked", $(this).prop("checked"));
	$("#remove").prop("disabled", !$(this).prop("checked"));
	$("#move").prop("disabled", !$(this).prop("checked"));
	$("#copy").prop("disabled",!$(this).prop("checked"));
	$("#order").prop("disabled",!$(this).prop("checked"));
});
$(".checkbox").click(function(){
	if($("input[type='checkbox']:checked").length>0){		
	$("#remove").removeAttr("disabled");
	$("#move").removeAttr("disabled");
	$("#copy").removeAttr("disabled");
	}
	else{
	$("#remove").attr("disabled","disabled");
	$("#move").attr("disabled","disabled");
	$("#copy").attr("disabled","disabled");		
	}
});
$("#moveid").click(function(){
	var str = "";
    $(".checkbox:checked").each(function() {
        str += $(this).val() + ",";
    })	
	var moveSortID=$("#moveSortID").val();
	$.post("Content_Fun.asp?act=moveid&moveID="+str+"&moveSortID="+moveSortID, function(data){
	$(".close").click();
	$("input:checked").attr('checked', false)
	parent.layer.msg('移动完成',{icon: 1});
	location.reload() 
	});		
});
$("#copyid").click(function(){
	var str = "";
    $(".checkbox:checked").each(function() {
        str += $(this).val() + ",";
    })		
	var copySortID=$("#copySortID").val();
	$.post("Content_Fun.asp?act=copyid&moveID="+str+"&moveSortID="+copySortID, function(data){
	$(".close").click();
	$("input:checked").attr('checked', false)
	parent.layer.msg('复制完成',{icon: 1});
	location.reload() 
	});		
});
$("#remove").click(function() {
    var str = "";
    $(".checkbox:checked").each(function() {
        str += $(this).val() + ",";
    })
    delcontent(str);
})
$(".order").blur(function() {
    var colval = $(this).val();	
    var colplace = $(this).attr('placeholder')
    var colid = $(this).attr('id').split("-")[1];
    var colname = $(this).attr('id').split("-")[0];
	 $(this).attr('placeholder', colval);
     $.post("content_Fun.asp?act=saveid",{"colval":colval,"colid":colid,"colname":colname},function(data){layer.msg('保存成功');});
});
function setjeDate(elem,id){
    $.jeDate(elem,{
        isinitVal:true,
		choosefun:function(elem, val){ $.post("content_Fun.asp?act=saveid",{"colval":val,"colid":id,"colname":"C_AddTime"},function(data){layer.msg('保存成功');});}
    });
}
</script> 
</body>
</html>