<!DOCTYPE html>
<!--[if IE 6 ]> <html class="ie6 lte_ie6 lte_ie7 lte_ie8 lte_ie9"> <![endif]--> 
<!--[if lte IE 6 ]> <html class="lte_ie6 lte_ie7 lte_ie8 lte_ie9"> <![endif]--> 
<!--[if lte IE 7 ]> <html class="lte_ie7 lte_ie8 lte_ie9"> <![endif]--> 
<!--[if lte IE 8 ]> <html class="lte_ie8 lte_ie9"> <![endif]--> 
<!--[if lte IE 9 ]> <html class="lte_ie9"> <![endif]--> 
<!--[if (gte IE 10)|!(IE)]><!--><html><!--<![endif]-->
 <head>
    <title><?php echo $_CONFIG->config_data('name')?></title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="<?php echo style2015;?>content/css/bootstrapadd.min.css" />
		<link rel="stylesheet" type="text/css" href="<?php echo style2015;?>content/css/bootstrap-modal.css" />
		        <link rel="stylesheet" type="text/css" href="<?php echo style2015;?>content/css/bootstrap.css"> 
				<link rel="stylesheet" type="text/css" href="<?php echo style2015;?>bootstrap/css/bootstrap-datetimepicker.css"> 
        <link rel="stylesheet" type="text/css" href="<?php echo style2015;?>content/css/base.css">
		<link rel="stylesheet" type="text/css" href="<?php echo style2015;?>content/css/style2015.css">
		<script type="text/javascript" src="<?php echo style2015;?>content/js/jquery.min.js"></script>
		<script type="text/javascript" src="<?php echo style2015;?>content/js/bootstrap.min.js"></script>
		<script type="text/javascript" src="<?php echo style2015;?>content/js/bootstrap-modal.js"></script>
		<script type="text/javascript" src="<?php echo style2015;?>content/js/bootstrap-modalmanager.js"></script>
		<script language="javascript" type="text/javascript" src="DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
<link rel="stylesheet" type="text/css" href="template/default/content/css/style2016.css">

</head>
<body class="body-wrap">
<script> 
function func_insert()
{
 for (i=0; i<document.form1.select2.options.length; i++)
 {
   if(document.form1.select2.options[i].selected)
   {
     option_text=document.form1.select2.options[i].text;
     option_value=document.form1.select2.options[i].value;
     option_style_color=document.form1.select2.options[i].style.color;
 
     var my_option = document.createElement("OPTION");
     my_option.text=option_text;
     my_option.value=option_value;
     my_option.style.color=option_style_color;
 
     pos=document.form1.select2.options.length;
     document.form1.select1.options.add(my_option,pos);
     document.form1.select2.remove(i);
     i--;
  }
 }//for
}
 
function func_delete()
{
 for (i=0;i<document.form1.select1.options.length;i++)
 {
   if(document.form1.select1.options[i].selected)
   {
     option_text=document.form1.select1.options[i].text;
     option_value=document.form1.select1.options[i].value;
 
     var my_option = document.createElement("OPTION");
     my_option.text=option_text;
     my_option.value=option_value;
 
     if(option_text.indexOf("[必选]")>0)
        continue;//  return;
     pos=document.form1.select2.options.length;
     document.form1.select2.options.add(my_option,pos);
     document.form1.select1.remove(i);
     i--;
  }
 }//for
}
 
function func_select_all1()
{
 for (i=document.form1.select1.options.length-1; i>=0; i--)
   document.form1.select1.options[i].selected=true;
}
 
function func_select_all2()
{
 for (i=document.form1.select2.options.length-1; i>=0; i--)
   document.form1.select2.options[i].selected=true;
}
 
function func_up()
{
  sel_count=0;
  for (i=document.form1.select1.options.length-1; i>=0; i--)
  {
    if(document.form1.select1.options[i].selected)
       sel_count++;
  }
 
  if(sel_count==0)
  {
     alert("调整桌面模块的顺序时，请选择其中一项！");
     return;
  }
  else if(sel_count>1)
  {
     alert("调整桌面模块的顺序时，只能选择其中一项！");
     return;
  }
 
  i=document.form1.select1.selectedIndex;
 
  if(i!=0)
  {
    var my_option = document.createElement("OPTION");
    my_option.text=document.form1.select1.options[i].text;
    my_option.value=document.form1.select1.options[i].value;
 
    document.form1.select1.options.add(my_option,i-1);
    document.form1.select1.remove(i+1);
    document.form1.select1.options[i-1].selected=true;
  }
}
 
function func_down()
{
  sel_count=0;
  for (i=document.form1.select1.options.length-1; i>=0; i--)
  {
    if(document.form1.select1.options[i].selected)
       sel_count++;
  }
 
  if(sel_count==0)
  {
     alert("调整桌面模块的顺序时，请选择其中一项！");
     return;
  }
  else if(sel_count>1)
  {
     alert("调整桌面模块的顺序时，只能选择其中一项！");
     return;
  }
 
  i=document.form1.select1.selectedIndex;
 
  if(i!=document.form1.select1.options.length-1)
  {
    var my_option = document.createElement("OPTION");
    my_option.text=document.form1.select1.options[i].text;
    my_option.value=document.form1.select1.options[i].value;
 
    document.form1.select1.options.add(my_option,i+2);
    document.form1.select1.remove(i);
    document.form1.select1.options[i+1].selected=true;
  }
}
 
function mysubmit()
{
   fld_str="";
   for (i=0; i< document.form1.select1.options.length; i++)
   {
      options_value=document.form1.select1.options[i].value;
      fld_str+=options_value+"|";
    }
   location="admin.php?ac=<?php echo $ac?>&fileurl=<?php echo $fileurl?>&do=home_txt&view=edit&home_txt=" + fld_str;
}
</script>
<div class="tabbable work-nav">
				<ul id="myTab" class="nav nav-tabs">
					<li><a href="admin.php?ac=user&fileurl=member">我的信息</a></li>
					<li><a href="admin.php?ac=password&fileurl=member">密码修改</a></li>
					<li class="active"><a href="admin.php?ac=user&fileurl=member&do=home_txt">门户设置</a></li>
				</ul>
</div>

<form name="form1" method="post" action="?ac=<?php echo $ac?>&fileurl=<?php echo $fileurl?>&do=save">
<div class="search_area">
        <div class="form-search form-search-top" style="text-align:right;padding-left:10px;">
                  
           <button type="button" onClick="mysubmit();" style="margin-right:60px;" class="btn btn-danger"> 保存设置 </button>
		  
        </div>
</div>


<div style="position:absolute; left:0px;overflow:auto;height:82%;width:100%;padding-top:10px;">
<div  id='form' class="table-responsive" style="width: 1000px;margin: 10px auto;">
 <table class="TableBlock" border="0" width="50%" align="center" style="margin-top:20px;">
	<tr>
      <td width="10%" align="center" nowrap class="TableHeader"> 
      排序按钮    </td>
      <td width="40%" align="center" class="TableHeader">己选内容</td>
      <td width="10%" align="center" class="TableHeader">
	  操作按钮	  </td>
      <td width="40%" align="center" class="TableHeader">备选内容</td>
    </tr>
	<tr>
      <td width="10%" align="center" nowrap class="TableContent"> 
       <input type="button" value=" ↑ " onClick="func_up();" style="font-size:26px; height:60px;">
      <br>
      <br>
      <input type="button" style="font-size:26px; height:60px;" value=" ↓ " onClick="func_down();">    </td>
      <td width="40%" align="center" class="TableData"><select  name="select1" ondblclick="func_delete();" MULTIPLE style="width:200px;;height:280px;">
	  
	  <?php
	  
	  if($bghome['home_txt']!=''){
		  $_txt=substr($bghome['home_txt'], 0, -1);
		  $_txt=explode('|',$_txt); 
		  for($i=0;$i<sizeof($_txt);$i++){
		  ?>
		   <option value="<?php echo $_txt[$i];?>"><?php echo home_txt($_txt[$i]);?></option>
		  <?php
		  }
	  }
	  ?>
    </select>
    <!--<input type="button" value=" 全选 " onClick="func_select_all1();" class="SmallButton"> --></td>
      <td width="10%" align="center" class="TableContent">
	  <input type="button" style="font-size:26px; height:40px;" value=" ← " onClick="func_insert();">
      <br><br>
      <input type="button" style="font-size:26px; height:40px;" value=" → " onClick="func_delete();">	  </td>
      <td width="40%" align="center" class="TableData"><select  name="select2" ondblclick="func_insert();" MULTIPLE style="width:200px;;height:280px;">
	  <?php
	  $query = $db->query("SELECT * FROM 
	".DB_TABLEPRE.DB_JT."homekey  where type1=1 and (user LIKE '%,".get_realname($_USER->id).",%' or user=0) order by numbers asc");
	while ($row = $db->fetch_array($query)) {
		if(sizeof(explode($row['modname'],$bghome['home_txt']))==1){
			if($row['tables']!='0'){
				if(mysql_num_rows(mysql_query("SHOW TABLES LIKE '".DB_TABLEPRE.DB_JT.$row['tables']."'"))==1){
			  ?>
			   <option value="<?php echo $row['modname'];?>"><?php echo $row['title'];?>[<?php if($row['type']==1){
							echo '<font color=red>汇总版块</font>';
						}elseif($row['type']==2){
							echo '内容版本';
						}elseif($row['type']==3){
							echo '统计版块';
						}?>]</option>
			  <?php
			  } 
			  }else{
			  ?>
			  <option value="<?php echo $row['modname'];?>"><?php echo $row['title'];?>[<?php if($row['type']==1){
							echo '<font color=red>汇总版块</font>';
						}elseif($row['type']==2){
							echo '内容版本';
						}elseif($row['type']==3){
							echo '统计版块';
						}?>]</option>
			  <?php
			  }
		}
	}?>
    </select></td>
    </tr>
 </table>
</div>



</div>




</form>

</body>
</html>
