<?php die;?><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="zh-cn" />
<title><!--{$smarty.const.MICE_TITLE}--></title>
<base href="<!--{$smarty.const.MICE_URL}--><!--{$smarty.const.MICE_TPL}-->/admin/" />
<link href="css/Default.css" rel="stylesheet" type="text/css" />
<link href="css/fieldset.css" rel="stylesheet" type="text/css">
<script language="JavaScript">
var baseurl = '<!--{$smarty.const.MICE_URL}--><!--{$smarty.const.MICE_TPL}-->/admin/';
</script>
<script type="text/javascript" src="js/Main.js"></script>
<script type="text/javascript">
<!--
$(function()
{
    $(':checkbox').click(function()
    {
        // children
        $(this).parent('li').find(':checkbox').attr('checked', this.checked);
        // parent
        checkParent(this);
    });
});

function checkParent(obj)
{
    if(obj == null)
        return;
		
    if(obj.checked)
    {
        checkParent($(obj).closest('ul').prev().attr('checked', true)[0]);
    }
    else
    {
		if($(obj).closest('ul').find('>li>input:checkbox:not(:checked)').size() == 0)
			checkParent($(obj).closest('ul').prev().attr('checked', false)[0]);
    }
}

function CheckForm()
{
 if (document.form1.name.value.length == 0)
 {
  alert("组名称不能为空！");
  document.form1.name.focus();
  return false;
 } 
 if (document.form1.level.value == 0)
 {
  alert("级别必须大于0！");
  document.form1.level.focus();
  return false;
 }
 document.form1.submit();
  return true;
}

function ResetForm(){
	document.form1.reset();
}

function onTreeClick(p){
	p = $(p);
	var checked=true;
	if($("CategoryIdS["+p.$A("cid")+"]").checked){
		checked=false;
	}
	$("CategoryIdS["+p.$A("cid")+"]").checked = checked;

	var level = p.$A("level");
	var innercode = p.$A("innercode");
	var arr = $("tree1").$T("P");
	var flag = true;
	var k=0;
	for(var i=0;i<arr.length;i++){
		var c = arr[i];
		if(c.$A("cid")){

			//选择该分类后，自动选择该分类的所有父分类
			var ncid=","+c.$A("cid")+",";
			var y=innercode.indexOf(ncid);
			if(y>='0'){				
				if(checked==true){
					$("CategoryIdS["+c.$A("cid")+"]").checked = checked;
				}else{
					var check_flag = false;
					for(var j=k;j<arr.length;j++){
						if(arr[i].$A("level")<level){
							if($("CategoryIdS["+arr[j].$A("cid")+"]").checked && arr[j].$A("level")>=level && arr[j].$A("cid")!=p.$A("cid")){
								check_flag = true;
								break;
							}
						}else{
							break;
						}
					}
					$("CategoryIdS["+c.$A("cid")+"]").checked = check_flag;					
				}			
			}
						
			//选择该分类后，自动选择该分类的所有子分类
			if(c!=p&&flag){
				continue;
			}
			if(c==p){
				flag = false;
				continue;
			}
			if(c.$A("level")>level){
				$("CategoryIdS["+c.$A("cid")+"]").checked = checked;
			}else{
				break;
			}
		}
		k++;
	}

}

function onCheck(ele){
	ele = $(ele);
	//alert(ele.value);
	if(ele.type=="checkbox"){
		var p = ele.getParent("P");
		onTreeClick(p);
		return ;
		var checked = ele.checked;
		var level = p.$A("level");
		var innercode = p.$A("innercode");
		var arr = $("tree1").$T("P");
		var flag = true;
		for(var i=0;i<arr.length;i++){
			var c = arr[i];
			
			
			if(c.$A("cid")){
				//选择该分类后，自动选择该分类的所有父分类
				var ncid=","+c.$A("cid")+",";
				var y=innercode.indexOf(ncid);
				if(y>='0'){
					$("CategoryIdS["+c.$A("cid")+"]").checked = checked;
				}
				
				//选择该分类后，自动选择该分类的所有子分类
				//if(c!=p&&flag){
				//	continue;
				//}
				//if(c==p){
				//	flag = false;
				//	continue;
				//}
				//if(c.$A("level")>level){
				//	$("CategoryIdS["+c.$A("cid")+"]").checked = checked;
				//}else{
				//	break;
				//}
			}
		}
	}
}
-->
</script>
</head>

<body>
<table width="100%" border="0" cellspacing="6" cellpadding="0" style="border-collapse: separate; border-spacing: 6px;">
	  <form action="<!--{$formaction}-->" method="post" name="form1" id="form1" onsubmit="return CheckForm()">
      <tr valign="top">
        <td>
		<table width="100%" border="0" cellspacing="0" cellpadding="0" class="blockTable">
			
			<tr>
			  <td width="100%" style="padding:6px 10px;" class="blockTd">
			  <div style="float: left;"><img src="imgs/Icons/icon021a12.gif" /> 会员组编辑</div>
			  <div style="float: right; white-space: nowrap;vertical-align:middle;"><a href='javascript:CheckForm();' micetype='micePushBtn' class='micePushBtn' hidefocus='true' tabindex='-1' onselectstart='return false'><img src="imgs/Icons/icon001a16.gif" /><b>保存&nbsp;</b></a><a href='javascript:ResetForm();' micetype='micePushBtn' class='micePushBtn' hidefocus='true' tabindex='-1' onselectstart='return false'><img src="imgs/Icons/icon001a13.gif" /><b>重置&nbsp;</b></a><a href='javascript:history.back(-1);' micetype='micePushBtn' class='micePushBtn' hidefocus='true' tabindex='-1' onselectstart='return false'><img src="imgs/Icons/icon008a20.gif" /><b>返回&nbsp;</b></a></div>
			 </td>
            </tr>
            <tr>
              <td style="padding-top:0px;padding-left:6px;padding-right:6px;padding-bottom:8px;">

<!--内容开始-->
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0" >
	<form id="form1" name="form1" action="<!--{$formaction}-->" method="post" onsubmit="return CheckForm()">
	<tr>
		<td width="100%" valign="top">
			<fieldset class="adminform">
				<legend>用户组属性</legend>
				<table border="0" cellpadding="0" cellspacing="0" width="100%">
					<tr>
						<td width="65" class="keyred" height='20'>组　名:</td>
						<td colspan="2">
							<input name='usergroup_id' id='usergroup_id' type='hidden' value='<!--{$results->getUsergroupId()}-->'>
							&nbsp;<input name='name' id='name' type='text' size='50' value='<!--{$results->getName()}-->'>
						</td>
					</tr>
					<tr>
						<td width="65" class="keyred" height='20'>级　别:</td>
						<td colspan="2">
							&nbsp;<input name='level' id='level' type='text' size='5' value='<!--{$results->getLevel()}-->'>&nbsp;(必须为大于0的数字,级别按数字从小到大排列)
						</td>
					</tr>
					<tr>
						<td width="65" class="key" height='20'>说　明:</td>
						<td colspan="2">
							&nbsp;<input name='intro' id='intro' type='text' size='50' value='<!--{$results->getIntro()}-->'>
						</td>
					</tr>
					<tr>
						<td width="65" class="key" height='20'>管理权限:</td>
						<td colspan="2">
<div style="width:260px;height:500px;overflow:auto;border: 2px inset #FFFFFF;"  micetype='_Tree' onselectstart='stopEvent(event);' id='tree1' class='treeItem'>
		<table>
			<tr>
				<td>

<p cid="0" onclick="Tree.onItemClick(event,this);onTreeClick(this);" level="0" id="tree1__TreeRoot" parentid="" lazy="0" resizeable="0" ondblclick="Tree.onItemDblClick(event,this);"><img src='imgs/Icons/articles.gif'>全部菜单</p>
	<div>
		<!--{assign var=subsql value='WHERE parentid=0 ORDER BY orderid'}-->
		<!--{foreach key=key from='micefun'|MenuLists:$subsql:0:0 item=Category name=counter}-->

		<p cid="<!--{$Category->getMenuId()}-->" innercode="<!--{$Category->getPath()}-->" level="<!--{$Category->getDepth()}-->" name="tree1_<!--{$Category->getMenuId()}-->" id="tree1_<!--{$Category->getMenuId()}-->" parentid="<!--{$Category->getParentid()}-->" lazy="0" resizeable="0" onclick="Tree.onItemClick(event,this);onTreeClick(this);" ondblclick="Tree.onItemDblClick(event,this);" dragend="Tree.dragEnd" onmouseup="DragManager.onMouseUp(event,this)" onmouseover="DragManager.onMouseOver(event,this)" dragover="Tree.dragOver" onmouseout="DragManager.onMouseOut(event,this)" dragout="Tree.dragOut" <!--{if $smarty.foreach.counter.iteration==$childcount}-->expand="4"<!--{else}-->expand="2"<!--{/if}-->><!--{if $Category->getChildcount()>0}--><!--{if $smarty.foreach.counter.iteration==$childcount}--><img onclick='Tree.onBranchIconClick(event);' src='imgs/Icons/treeicon05.gif'><!--{else}--><img onclick='Tree.onBranchIconClick(event);' src='imgs/Icons/treeicon02.gif'><!--{/if}--><!--{else}--><!--{if $smarty.foreach.counter.iteration==$childcount}--><img src='imgs/Icons/treeicon07.gif'><!--{else}--><img src='imgs/Icons/treeicon06.gif'><!--{/if}--><!--{/if}--><img src='imgs/Icons/menu.gif'><input type="CheckBox" name="CategoryIdS[<!--{$Category->getMenuId()}-->]" id='CategoryIdS[<!--{$Category->getMenuId()}-->]' value='<!--{$Category->getTags()}-->' onClick="onCheck(this);"<!--{'micefun'|IsChecked:$Category->getMenuId():$results->getMenu()}-->><!--{$Category->getTitle()}--></p>
		
		<!--第2层开始-->
		<!--{if $Category->getChildcount()>0}-->
			<div>
			<!--{assign var=subsql2 value='WHERE parentid='|cat:$Category->getMenuId()|cat:' ORDER BY orderid'}-->
			<!--{foreach key=key from='micefun'|MenuLists:$subsql2:0:0 item=Category2 name=counter2}-->
			
			<p cid="<!--{$Category2->getMenuId()}-->" innercode="<!--{$Category2->getPath()}-->" level="<!--{$Category2->getDepth()}-->" name="tree1_<!--{$Category2->getMenuId()}-->" id="tree1_<!--{$Category2->getMenuId()}-->" parentid="<!--{$Category2->getParentid()}-->" lazy="0" resizeable="0" onclick="Tree.onItemClick(event,this);onTreeClick(this);" ondblclick="Tree.onItemDblClick(event,this);" dragend="Tree.dragEnd" onmouseup="DragManager.onMouseUp(event,this)" onmouseover="DragManager.onMouseOver(event,this)" dragover="Tree.dragOver" onmouseout="DragManager.onMouseOut(event,this)" dragout="Tree.dragOut" <!--{if $smarty.foreach.counter2.iteration==$Category->getChildcount()}-->expand="4"<!--{else}-->expand="2"<!--{/if}-->><!--{if $smarty.foreach.counter.iteration==$childcount}--><img src='imgs/Icons/treeicon08.gif'><!--{else}--><img src='imgs/Icons/treeicon03.gif'><!--{/if}--><!--{if $Category2->getChildcount()>0}--><!--{if $smarty.foreach.counter2.iteration==$Category->getChildcount()}--><img onclick='Tree.onBranchIconClick(event);' src='imgs/Icons/treeicon05.gif'><!--{else}--><img onclick='Tree.onBranchIconClick(event);' src='imgs/Icons/treeicon02.gif'><!--{/if}--><!--{else}--><!--{if $smarty.foreach.counter2.iteration==$Category->getChildcount()}--><img src='imgs/Icons/treeicon07.gif'><!--{else}--><img src='imgs/Icons/treeicon06.gif'><!--{/if}--><!--{/if}--><img src='imgs/Icons/menu.gif'><input type="CheckBox" name="CategoryIdS[<!--{$Category2->getMenuId()}-->]" id='CategoryIdS[<!--{$Category2->getMenuId()}-->]' value='<!--{$Category2->getTags()}-->' onClick="onCheck(this);" <!--{'micefun'|IsChecked:$Category2->getMenuId():$results->getMenu()}-->><!--{$Category2->getTitle()}--></p>
			
			<!--{/foreach}-->
			</div>
		<!--{/if}-->

		<!--第2层结束-->

		<!--{/foreach}-->

</div>
</td>
</tr>
</table>

</div>
							<font color='red'>&nbsp;注意:1、非管理员组，请勿设置管理权限<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2、如果指定了菜单管理权限，那么此用户组就拥有此菜单的所有子菜单的操作权限<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
							3、在设置文章浏览权限时:如果设置允许浏览的用户组级别为1,则级别大于1的用户组都有浏览权限</font>
						</td>
					</tr>
				</table>
			</fieldset>
		</td>
	</tr>
</table>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
	<tr > 
		<td height="30" valign='middle'>
			<div id='_PageBar_buttom' class="pageBarWrap" style="padding-top:6px;clear:both;bottom:0px; height:30px; line-height:30px;"><div class="pageBar" style='float:right;font-family:Tahoma'></div><div style='float:left;font-family:Tahoma'><a href='javascript:CheckForm();' micetype='micePushBtn' class='micePushBtn' hidefocus='true' tabindex='-1' onselectstart='return false'><img src="imgs/Icons/icon001a16.gif" /><b>保存&nbsp;</b></a><a href='javascript:ResetForm();' micetype='micePushBtn' class='micePushBtn' hidefocus='true' tabindex='-1' onselectstart='return false'><img src="imgs/Icons/icon001a13.gif" /><b>重置&nbsp;</b></a><a href='javascript:history.back(-1);' micetype='micePushBtn' class='micePushBtn' hidefocus='true' tabindex='-1' onselectstart='return false'><img src="imgs/Icons/icon008a20.gif" /><b>返回&nbsp;</b></a>&nbsp;&nbsp;<label><input type="checkbox" name="goon" id="goon" value="1">保存后继续添加</label></div></div>
		</td>
	</tr>
</table>

<!--内容结束-->
		</td>
		</tr>
	</table></td>
  </tr>
  </form>
</table>
</body>
</html>