<?php 
defined('IN_HS') or exit('Access Denied');
include admintpl('header');
?>
<style>
.selecton{BORDER-RIGHT: #e6cf87 1px dashed; PADDING-RIGHT: 20px; BORDER-TOP: #e6cf87 1px dashed; DISPLAY: block; PADDING-LEFT: 20px; FONT-SIZE: 12px; BORDER-LEFT: #e6cf87 1px dashed; PADDING-TOP: 0px; BORDER-BOTTOM: #e6cf87 1px dashed
}
</style>
<body>
<table cellpadding="0" cellspacing="0" border="0" width="100%" height="10">
  <tr>
    <td ></td>
  </tr>
</table>
<table cellpadding="2" cellspacing="1" class="tableborder" width=100%>
<form method="get" name="search" action="?">
  <tr>
    <td width=15%><strong>道具搜索</strong></td>
    <td width=60%>道具代码：
      <input name='words' type='text' size='30' value='<?=$words?>'>
   <select name="action" style="background:#eee;font-size:14px;color:#900">
   <option value="sfso" <?php if($action == "sfso") { ?> selected<? } ?>>- 角色背包 -</option>
   <option value="sban" <?php if($action == "sban") { ?> selected<? } ?>>- 帐号仓库 -</option>
   </select>
	  </td>
	<td width=25% style="text-align:left">
<input name='mod' type='hidden' value='<?=$mod?>'>
<input name='file' type='hidden' value='<?=$file?>'>
<input name='idserver' type='hidden' value='<?=$idserver?>'>
<input name='submit' type='submit' class='btn' value=' 搜索 '></td>
</tr>
</form>
</table>
<table cellpadding="0" cellspacing="0" border="0" width="100%" height="30">
  <tr>
    <td style="text-align:center;color:darkgreen;font-size:14px;font-weight:bold">当前分区：<font color="blue"><?=$servername?></font> 共找到 <font color=red><?=$sumnums?></font> 条数据!
   <br>
   <span style="color:#555;font-size:12px">提示：单击ID链接可打开该角色的帐号，存在非法就冻结帐号！</span></td>
  </tr>
</table>

<table cellpadding="2" cellspacing="1" class="tableborder" width=100%>
<tr align="center">
<td width="10%" class="tablerowhighlight" style="font-size:14px;text-align:center;font-weight:bold">ID</td>
<td width="25%" class="tablerowhighlight" style="font-size:14px;font-weight:bold"><?php if($action == "sfso") { ?>角色名<?php }elseif($action == "sban"){ ?>帐号名<?php }else{ ?> <? } ?></td>
<td class="tablerowhighlight" style="font-size:14px;text-align:center;font-weight:bold">装备数据(要先检查角色是否在线才可进行修改！)</td>
</tr>
<?php 
if(is_array($members))
{
foreach($members as $member){ ?>

<tr align="center" id="trline_<?=$member['ID']?>" value="closes">
<td style="text-align:center"><?php if($action == "sfso") { ?><a style="TEXT-DECORATION: underline" href="?mod=<?=$mod?>&file=acclist&action=manage&idserver=<?=$idserver?>&idx=<?=$member['AccountID']?>" target="_blank"  title="打开该角色帐号"><?=$member['ID']?></a><?php }elseif($action == "sban"){ ?><a style="TEXT-DECORATION: underline" href="?mod=<?=$mod?>&file=acclist&action=manage&idserver=<?=$idserver?>&idx=<?=$member['AccountID']?>" target="_blank"  title="打开该角色帐号"><?=$member['AccountID']?></a><?php }else{ ?> <? } ?></td>
<td style="font-weight:bold;">
<?php if($action == "sfso") { ?>
<?=$member['Name']?>
<br>
<a style="TEXT-DECORATION: underline;color:orange" href="?mod=<?=$mod?>&file=fsolist&action=manage&idserver=<?=$idserver?>&ID=<?=$member['ID']?>" target="_blank" title="打开该角色日志">[编辑角色]</a>

<a style="TEXT-DECORATION: underline;color:orange" href="?mod=<?=$mod?>&file=loglist&action=manage&idserver=<?=$idserver?>&userID=<?=$member['ID']?>" target="_blank" title="打开该角色日志">[角色日志]</a><br>
<input style="color:#f00" name="button" type="button" class="btn" onClick="checkfsoonline('<?=$idserver?>','<?=$member[ID]?>')" value=" 检查是否在线 "><br>
<span id="yesedit_<?=$member['ID']?>" style="text-align:center;color:darkgreen;display:none">此列已修改</span>
<?php }elseif($action == "sban"){ ?>
<?=$member['username']?><br>
<a style="TEXT-DECORATION: underline;color:orange" href="?mod=<?=$mod?>&file=fsolist&action=manage&idserver=<?=$idserver?>&AccountID=<?=$member['AccountID']?>" target="_blank" title="打开该角色日志">[查看下属角色]</a>
<br>
<input style="color:#f00" name="button" type="button" class="btn" onClick="checkacconline('<?=$idserver?>','<?=$member[AccountID]?>')" value=" 检查帐号在线 "><br>
<span id="yesedit_<?=$member['AccountID']?>" style="text-align:center;color:darkgreen;display:none">此列已修改</span>
<?php }else{ ?> <? } ?>


</td>
<td style="text-align:center">
<?php if($action == "sfso") { ?>
<textarea type="text" id="Items_<?=$member[ID]?>" style="width:500px;height:100px;ime-mode:disabled" disabled><?=$member['Items']?></textarea><br>
<span id="button_<?=$member[ID]?>" style="display:none" value="savebutton"><input style="color:#333" name="button" type="button" class="btn" onClick="savefsocontents('<?=$member[ID]?>','<?=$idserver?>')" value=" 保存修改数据 "></span>
<?php }elseif($action == "sban"){ ?>
<textarea type="text" id="Items_<?=$member[AccountID]?>" style="width:500px;height:100px;ime-mode:disabled" disabled><?=$member['Items']?></textarea><br>
<span id="button_<?=$member[AccountID]?>" style="display:none" value="savebutton"><input style="color:#333" name="button" type="button" class="btn" onClick="savebancontents('<?=$member[AccountID]?>','<?=$idserver?>')" value=" 保存修改数据 "></span>
<?php }else{ ?> <? } ?>

</td>
</tr>
<?php } 
}
?>

</table>
<table cellpadding="0" cellspacing="0" border="0" width="100%" height="30">
  <tr>
    <td align="center" id="pages"><?=$pages?></td>
  </tr>
</table>
<script language="javascript">
<?php
sajax_show_javascript();
?>
function checkacconline(idserver,AccountID){
    var o = document.getElementsByTagName("textarea"); 
    var l = o.length 
    for(var i=0;i<l;i++) { 
      o[i].disabled = true; 
	  o[i].style.height = "100";
    }
   var a = document.getElementsByTagName("span");
   for (var i=0; i<a.length; i++)
   if (a[i].value == "savebutton") a[i].style.display = "none";
   x_checkacconline(idserver,AccountID,checkacconline_cb)
 
 function checkacconline_cb(z){
  if(z == "unonline"){
         window.alert("该帐号无角色在线，可以进行修改！");
         document.getElementById("Items_"+AccountID).disabled=false;
		 document.getElementById("Items_"+AccountID).style.height="350";
		 document.getElementById("button_"+AccountID).style.display="block";
	}else if(z == "yesonline"){
	    if(confirm("该帐号有角色在线，修改数据可能会无效，是否继续？")){ 
         document.getElementById("Items_"+AccountID).disabled=false;
		 document.getElementById("Items_"+AccountID).style.height="350";
		 document.getElementById("button_"+AccountID).style.display="block";
        }
	}else{
	window.alert(z);
	}
 }
}

function savefsocontents(iduser,idserver){
 var Items=document.getElementById("Items_"+iduser).value;
 document.cookie="cookitems=";
 document.cookie="cookitems=" + Items;
 x_savefsocontents(iduser,idserver,savefsocontents_cb)
 
 function savefsocontents_cb(z){
  if( z == "true"){
   window.alert("更新成功！");
   document.getElementById("yesedit_"+iduser).style.display="block";
	}else{
	window.alert(z);
	}
   document.getElementById("Items_"+iduser).disabled=true;
   document.getElementById("Items_"+iduser).style.height="100";
   document.getElementById("button_"+iduser).style.display="none";
 }
}

function savebancontents(iduser,idserver){
 var Items=document.getElementById("Items_"+iduser).value;
 document.cookie="cookitems=";
 document.cookie="cookitems=" + Items;
 x_savebancontents(iduser,idserver,savebancontents_cb)
 
 function savebancontents_cb(z){
  if( z == "true"){
   window.alert("更新成功！");
   document.getElementById("yesedit_"+iduser).style.display="block";
	}else{
	window.alert(z);
	}
   document.getElementById("Items_"+iduser).disabled=true;
   document.getElementById("Items_"+iduser).style.height="100";
   document.getElementById("button_"+iduser).style.display="none";
 }
}

function checkfsoonline(idserver,AccountID){
    var o = document.getElementsByTagName("textarea"); 
    var l = o.length 
    for(var i=0;i<l;i++) { 
      o[i].disabled = true; 
	  o[i].style.height = "100";
    }
   var a = document.getElementsByTagName("span");
   for (var i=0; i<a.length; i++)
   if (a[i].value == "savebutton") a[i].style.display = "none";
   x_checkfsoonline(idserver,AccountID,checkfsoonline_cb)
 
 function checkfsoonline_cb(z){
  if(z == "unonline"){
         window.alert("该角色不在线，可以进行修改！");
         document.getElementById("Items_"+AccountID).disabled=false;
		 document.getElementById("Items_"+AccountID).style.height="350";
		 document.getElementById("button_"+AccountID).style.display="block";
	}else if(z == "yesonline"){
	    if(confirm("该角色在线，修改数据可能会无效，是否继续？")){ 
         document.getElementById("Items_"+AccountID).disabled=false;
		 document.getElementById("Items_"+AccountID).style.height="350";
		 document.getElementById("button_"+AccountID).style.display="block";
        }
	}else{
	window.alert(z);
	}
 }
}

</script>

<script type="text/javascript"> 

     onload=function(){ 
         fHl(document.body, '<?=$words?>'); 
         
     } 

     function fHl(o, flag, rndColor, url){ 
         var bgCor=fgCor=''; 
         if(rndColor){ 
             bgCor=fRndCor(10, 20); 
             fgCor=fRndCor(230, 255); 
         } else { 
             bgCor='red'; 
             fgCor='white'; 
         } 
         var re=new RegExp(flag, 'i'); 
         for(var i=0; i<o.childNodes.length; i++){     
             var o_=o.childNodes[i]; 
             var o_p=o_.parentNode; 
             if(o_.nodeType==1) { 
                 fHl(o_, flag, rndColor, url);                 
              } else if (o_.nodeType==3) { 
                 if(!(o_p.nodeName=='A')){ 
                     if(o_.data.search(re)==-1)continue; 
                     var temp=fEleA(o_.data, flag); 
                     o_p.replaceChild(temp, o_); 
                 } 
             }  
         } 
       
         function fEleA(text, flag){ 
             var style=' style="background-color:'+bgCor+';color:'+fgCor+';" ' 
             var o=document.createElement('span'); 
             var str=''; 
             var re=new RegExp('('+flag+')', 'gi'); 
             if(url){ 
                 str=text.replace(re, '<a href="'+url+ 
                 '"'+style+'>$1</a>'); 
             } else { 
                 str=text.replace(re, '<span '+style+'>$1</span>'); 
             } 
             o.innerHTML=str; 
             return o; 
         }   
        
         function fRndCor(under, over){ 
             if(arguments.length==1){ 
                 var over=under; 
                     under=0; 
             }else if(arguments.length==0){ 
                 var under=0; 
                 var over=255; 
             } 
             var r=fRandomBy(under, over).toString(16); 
                 r=padNum(r, r, 2); 
             var g=fRandomBy(under, over).toString(16); 
                 g=padNum(g, g, 2); 
             var b=fRandomBy(under, over).toString(16); 
                 b=padNum(b, b, 2); 
                 
             return '#'+r+g+b; 
             function fRandomBy(under, over){ 
                 switch(arguments.length){ 
                     case 1: return parseInt(Math.random()*under+1); 
                     case 2: return parseInt(Math.random()*(over-under+1) + under); 
                     default: return 0; 
                 } 
             } 
             function padNum(str, num, len){ 
                 var temp='' 
                 for(var i=0; i<len;temp+=num, i++); 
                 return temp=(temp+=str).substr(temp.length-len); 
             }
         } 
     } 
</script> 
</body>
</html>
