<include: file="header_init.html">
<BODY  style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px">
<style>

div.titleholder {
	font-family: ms sans serif, arial;
	font-size: 8pt;
	width: 300;
	text-overflow: ellipsis;
	margin: 0px;
	overflow: hidden;
	white-space: nowrap;			
}		
div.subtitleholder {
	font-family: ms sans serif, arial;
	font-size: 8pt;
	
	text-overflow: ellipsis;
	margin: 0px;
	overflow: hidden;
	white-space: nowrap;			
}
div.timeholder {
	font-family: ms sans serif, arial;
	font-size: 8pt;
	width: 90;
	text-overflow: ellipsis;
	margin: 0px;
	overflow: hidden;
	white-space: nowrap;			
}	
</style>
<script language='JavaScript'>
var doImage = doImage;
var TType = TType;

function mhHover(tbl, idx, cls)
{
	var t, d;
	if (document.getElementById)
		t = document.getElementById(tbl);
	else
		t = document.all(tbl);
	if (t == null) return;
	if (t.getElementsByTagName)
		d = t.getElementsByTagName("TD");
	else
		d = t.all.tags("TD");
	if (d == null) return;
	if (d.length <= idx) return;
	d[idx].className = cls;
}

</script>
<SCRIPT>
var elo;
var loadmenuok=false;
var type = 'main';
var CateID = '[$CateInfo.CateID]';
function initrightmenu(){
	loadmenuok = true;
}


function doing(action, CollectionID) {
	switch(action) {
		case 'display_record':
			parent.mainFrame.location = "[$base_url]&o=content_list&type=main&CateID=" + CateID + "&offset=" + document.documentlist.offset.value;
			break;

		case 'viewSrc':
			eval('var mPath = URL_' + CollectionID + '.href');
			window.open(mPath,"","")

			break;
		case 'edit':
			var leftPos = (screen.availWidth-800) / 2
			var topPos = (screen.availHeight-600) / 2 
			 window.open('[$base_url]type=main&o=content_editor_frameset&extra=edit&CateID='+CateID  + '&CollectionID=' + CollectionID,'','width=800,height=600,scrollbars=no,resizable=yes,titlebar=0,top=' + topPos + ',left=' + leftPos);

			break;
		case 'del':
			if(confirm("{lang::global:confirm_del}")) {
				var oBao = new ActiveXObject("Microsoft.XMLHTTP");
				var returnValue;
				oBao.open("POST","[$base_url]&o=del&CateID="+CateID+"&CollectionID=" + CollectionID,false);
				oBao.send();
				returnValue = unescape(oBao.responseText);

				if(returnValue == '1') {
					alert("{lang::global:del_ok}");
					window.location.reload();
					return true;
					
				} else {
					alert("{lang::global:del_fail}");
				
				}
				
			}
			break;
		case 'view':
			var leftPos = (screen.availWidth-800) / 2
			var topPos = (screen.availHeight-600) / 2 
			 window.open('[$base_url]o=view&CateID='+CateID  + '&CollectionID=' + CollectionID,'','width=800,height=600,scrollbars=yes,resizable=yes,titlebar=0,top=' + topPos + ',left=' + leftPos);

			break;
		case 'cut':
			var targetCateID = showMeDialog("admin_select.php?sId=[$sId]&o=targetNodeWindow","color","dialogWidth:324px;dialogHeight:331px;help:0;status:0;scroll:no");
			
			if(targetCateID != null && targetCateID != '') {
				document.documentlist.referer.value = document.location;
				document.documentlist.action = '[$base_url]' + 'o=' + action + '&type=' + type + '&CollectionID=' + CollectionID + '&CateID=' + CateID + '&targetCateID=' + targetCateID  ;
				document.documentlist.submit();
			
			}

			break;
		case 'import':
				var targetNodeID = showMeDialog("admin_select.php?sId=[$sId]&o=targetNodeWindow","color","dialogWidth:324px;dialogHeight:331px;help:0;status:0;scroll:no");
				
				if(targetNodeID != null && targetNodeID != '') {
					var oBao = new ActiveXObject("Microsoft.XMLHTTP");
					var returnValue;
					oBao.open("POST",'[$base_url]' + 'o=' + action + '&CollectionID='+ CollectionID +'&CateID=' + CateID + '&multi=1&targetNodeID=' + targetNodeID,false);
					oBao.send();
					returnValue = unescape(oBao.responseText);
					//alert(returnValue);
					if(returnValue == '0') {
						alert("{lang:import_fail}");
						
					} else {
						alert("{lang:import_ok}");
					
					}
				

					//alert(CollectionID + '-' + targetCateID)
				}

				break;


		case 'refresh':
			document.documentlist.referer.value = document.location;
			document.documentlist.action = '[$base_url]' + 'o=' + action + '&type=' + type + '&CollectionID=' + CollectionID + '&CateID=' + CateID + '&targetCateID=' + targetCateID  ;
			document.documentlist.submit();
			break;
		default:
			document.location = document.location;

	}
	//sId=6891856b84ee23f2330ee8359cd3f60d&o=view&pId=41&cId=4
}



function rightMenu(pId, State, Type) {
	var toolMenu = new WebFXMenu;


		toolMenu.add(new WebFXMenuItem('{lang::global:view}','javascript:doing("view","'+ pId +'")','{lang:view_doc_content}'));
	//	toolMenu.add(new WebFXMenuItem('{lang::global:edit}','javascript:doing("edit","'+ pId +'")','{lang:edit_doc}'));
		toolMenu.add(new WebFXMenuItem('{lang::global:del}','javascript:doing("del","'+ pId +'")', '{lang:del_doc}'));
		toolMenu.add(new WebFXMenuItem('{lang::global:import}','javascript:doing("import","'+ pId +'")', '{lang:import_doc}'));
		toolMenu.add(new WebFXMenuItem('{lang:view_src}','javascript:doing("viewSrc","'+ pId +'")', '{lang:view_src}'));
	

	menudata.innerHTML = toolMenu 

	elo=window.event.srcElement;
	toolMenu.left = window.event.clientX;
	toolMenu.top = window.event.clientY+document.body.scrollTop;
	toolMenu.show();

	//initrightmenu();

}
</SCRIPT>

<SCRIPT language=JavaScript>
<!--


function CheckAll(form)  {
  for (var i=0;i<form.elements.length;i++)    {
    var e = form.elements[i];
    if (e.name != 'chkall' && e.name !='copy')       e.checked = form.chkall.checked; 
   }
  }
//-->


</script>
<script>
var mousemovecolor="#D4D4D4";
var selectcolor ="#DDDDDD";
var oldcolor;

function GetRow(oElem)
{
	while (oElem)
	{	//alert(oElem.tagName.toLowerCase())
		if (oElem.tagName.toLowerCase() == "tr" || oElem.parentElement.tagName.toLowerCase() == "tbody") 
		    return oElem;
		if (oElem.tagName.toLowerCase() == "table" || oElem.tagName.toLowerCase() == "th") return false;
		oElem = oElem.parentElement;
	}
}


function selected()
{	//alert(pid)

	var trstyle = GetRow( window.event.srcElement );
	var a;
	if( !trstyle )
		return false;

	if( trstyle.style.backgroundColor.toLowerCase() == selectcolor.toLowerCase())
	{
		trstyle.style.backgroundColor = "";
		a=eval("p_"+ trstyle.id);	
		//alert(trstyle.id)
		if (a!=null || a.checked) 
			a.checked=false
		oldcolor = "";
	}
	else
	{		
		trstyle.style.backgroundColor = selectcolor;
		a=eval("p_"+ trstyle.id);
		//alert(trstyle.id)
		if (a!=null) 
			a.checked=true
		oldcolor = selectcolor;

	
	}
}

function going(form, o)
{
	document.documentlist.referer.value = document.location;

	with(form) {
		switch(o) {
			case 'refresh':
				document.documentlist.referer.value = document.location;
				document.documentlist.action = '[$base_url]' + '&multi=1&o=' + o + '&type=' + type +  '&CateID=' + CateID  ;
				document.documentlist.submit();
				break;
			case 'import1':
				document.documentlist.referer.value = document.location;
				document.documentlist.action = '[$base_url]' + '&multi=1&o=' + o + '&type=' + type +  '&CateID=' + CateID  ;
				document.documentlist.submit();
				break;
			case 'import':
				var targetNodeID = showMeDialog("admin_select.php?sId=[$sId]&o=targetNodeWindow","color","dialogWidth:324px;dialogHeight:331px;help:0;status:0;scroll:no");
				
				if(targetNodeID != null && targetNodeID != '') {
					document.documentlist.referer.value = document.location;
					document.documentlist.action = '[$base_url]' + 'o=' + o + '&CateID=' + CateID + '&multi=1&targetNodeID=' + targetNodeID  ;
					document.documentlist.submit();
					//alert(CollectionID + '-' + targetCateID)
				}

				break;
			case 'cut':
				var targetCateID = showMeDialog("admin_select.php?sId=[$sId]&o=targetNodeWindow","color","dialogWidth:324px;dialogHeight:331px;help:0;status:0;scroll:no");
				
				if(targetCateID != null && targetCateID != '') {
					document.documentlist.referer.value = document.location;
					document.documentlist.action = '[$base_url]' + 'o=' + o + '&type=' + type + '&CateID=' + CateID + '&multi=1&targetCateID=' + targetCateID  ;
					document.documentlist.submit();
					//alert(CollectionID + '-' + targetCateID)
				}
				break;
			case 'del':
				if(confirm("{lang:confirm_multi_del}")) {
					action = action + '&o=del&multi=1';
					
					submit();
				}
				break;
			case 'createLink':
				var targetCateID = showMeDialog("admin_select.php?sId=[$sId]&o=targetNodeWindow","color","dialogWidth:324px;dialogHeight:331px;help:0;status:0;scroll:no");
				
				if(targetCateID != null && targetCateID != '') {
					document.documentlist.referer.value = document.location;
					document.documentlist.action = '[$base_url]' + 'o=' + o + '&type=' + type + '&CateID=' + CateID + '&multi=1&targetCateID=' + targetCateID  ;
					document.documentlist.submit();
					//alert(CollectionID + '-' + targetCateID)
				}
				break;
			
		}
	
	}
}
</script>
<div id="menudata"></div>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1"  class="table_border" >
  <TBODY>
  <form method="post" action="[$base_url]type=main&CateID=[$CateInfo.CateID]" name="documentlist" >

    <tr class="table_td2"> 
      <td> </td>
      <td align="center">ID</td>
<?php $td = 1;?>
<loop $DisplayItem key=key var=var>
<?php $td++;?>
		<td align="center">[$var.FieldTitle]</td>
	  </loop>
      <td align="center">{lang::global:editor}</td>
      <td align="center">{lang::global:date}</td>
      <td align="center">{lang::global:state}</td>
      <td colspan="5" align="center">{lang::global:execute_op}</td>
    </tr>

<loop $pList key=key var=var>
<!------onmouseover='this.style.backgroundColor="#FFFFFF"' 
                    onmouseout='this.style.backgroundColor=""'------>
    <tr class="table_td1" id="[$var.CollectionID]" onmouseover='this.style.backgroundColor="#FFFFFF"' 
                    onmouseout='this.style.backgroundColor=""'> 
      <td noWrap > <input type='checkbox' name='pData[]' value='[$var.CollectionID]' id="p_[$var.CollectionID]" ></td>
      <td align="center" noWrap   >[$var.CollectionID]</td>
	 <loop $DisplayItem key=keyIn var=varIn>
		<if $keyIn == 0>
      <td   noWrap  style="cursor:hand" id="[$var.pId]"><div class="titleholder">&nbsp;&nbsp;<A HREF="javascript:void(0);" onclick="doing('view','[$var.CollectionID]')" style="cursor:hand"   oncontextmenu="rightMenu('[$var.CollectionID]', '[$var.State]','[$var.Type]');return false;" title="<?php  echo    $this->_tpl_vars["var"]["{$this->_tpl_vars["varIn"]["FieldName"]}"]?>"><?php  echo    $this->_tpl_vars["var"]["{$this->_tpl_vars["varIn"]["FieldName"]}"]?> </A></div></td>

		<else>
      <td   noWrap   id="[$var.pId]"><div class="subtitleholder">&nbsp;&nbsp;<?php  echo    $this->_tpl_vars["var"]["{$this->_tpl_vars["varIn"]["FieldName"]}"]?> </div></td>

		</if>

	 </loop>
      <td align="center" noWrap  ><div class="subtitleholder" title="[$var.CreationUser]">[$var.CreationUser]</div></td>
      <td align="center" noWrap ><div class="timeholder">[@date('Y-m-d H:i',$var.CreationDate)]</div></td>
      <td align="center" noWrap  >
	  <div class="subtitleholder">
<if $var.IsImported == 0 >
{lang:unimport}
<elseif $var.IsImported == 1 >
<FONT  COLOR="#3300CC">	{lang:imported}</FONT>
</if>	  
	  </div>
	  </td>
     <td colspan="5" align="center" noWrap>
	  <A HREF="[$var.Src]" target="_blank" id="URL_[$var.CollectionID]">{lang::global:src}</A>
	 
	  <A HREF="[$base_url]&o=del&CateID=[$var.CateID]&CollectionID=[$var.CollectionID]" onclick="return confirm('{lang::global:confirm_del}')">{lang::global:del}</A> 
	  </td>
    </tr>

</loop>

    <tr class="Tablelistbg"> 
      <td colspan="<?php echo $td+12;?>" align="left" bgcolor="#F5F5F5"> <table border="0" align="center"  cellpadding="0" cellspacing="0" width="100%">
          <tr> 
            <td align=left> 
            <input type="checkbox" name="chkall" value="on" onclick="CheckAll(this.form)" id="chkall"  > 
              <label for="chkall" >{lang::global:select_all}</label>&nbsp;&nbsp;
			               
			 <select name="actionMap" id="actionMap" > 
          <option value="import">{lang::global:import}</option>
          <option value="del">{lang::global:del}</option>
			  </select>

			  <input type="button" value="{lang::global:go}" class=button onclick="going(this.form,actionMap.options[actionMap.selectedIndex].value)"> 
         
            </td>
			<td height="20" align="right" nowrap="nowrap"> <INPUT name="go_display" TYPE="button" value="{lang:display}" onclick="doing('display_record')" ></td>
	  <td   height="20" nowrap="nowrap" align="right"  width=80> &nbsp;&nbsp;<INPUT TYPE="text" NAME="offset" size=1 value=[$offset]> {lang:display_record} 
       
   </td>
          </tr>
        </table></td>
    </tr>
	<INPUT TYPE="hidden" name="referer" value ="" >
  </form>
  <tr class="table_td1"> 
    <td colspan="<?php echo $td+12;?>" >&nbsp;[@sprintf(#lang:record#, $recordInfo.recordNum, $recordInfo.from,$recordInfo.to)] [$pagelist] </td>
  </tr>
  </tbody> 
</table>

<include: file="footer.html">
