<script type="text/javascript" src="<{$mod_url}>/index.php?page=module_header&src=jquery.js"></script>
<script type="text/javascript" src="<{$mod_url}>/index.php?page=module_header&src=d3downloads.js"></script>
<h2><{$formtitle}></h2>
<{if $iserror}>
	<div style="color: #CC0000;font-size:100%;font-weight:bold;margin:5px;padding:5px;border-width:1px;border-style:solid;border-color:#808080;">
		<{$error_message}>
	</div>
<{/if}>
<form name="user_access" id="user_access" action="<{$mod_url}>/admin/index.php?page=<{$page}>" method="post">
	<{$gticket_hidden}>
	<div style="text-align:right;color:inherit;border: 1px inset #CCC;padding: 2px;font-size: small;">
		<a href="<{$mod_url}>/admin/index.php?page=categoryedit&amp;cid=0"><{$smarty.const._MD_D3DOWNLOADS_ADMIN_NEWCATEGORY}></a> |
		<a href="<{$mod_url}>/admin/index.php?page=categoryedit&amp;cid=0&amp;pid=<{$select_cid}>"><{$smarty.const._MD_D3DOWNLOADS_MAKESUBCATEGORY}></a> |
		<a href="<{$mod_url}>/admin/index.php?page=categoryedit&amp;cid=<{$select_cid}>"><{$smarty.const._MD_D3DOWNLOADS_CAT_EDIT}></a> |
		<a href="<{$mod_url}>/index.php?cid=<{$select_cid}>"><{$smarty.const._MD_D3DOWNLOADS_CAT_VISIBLE}></a> |
		<span style="font-weight: bold;"><{$smarty.const._MD_D3DOWNLOADS_SEL_CATEGORY}></span>
		<select name="category_select" onchange="submit();">
			<{html_options options=$categoryselect selected=$select_cid}>
		</select>
	</div>
	<{if $parentid != 0}>
		<br />
		<div style="color:inherit;border: 1px inset #CCC;padding: 6px;with: 80%;font-size: small;">
			<{$smarty.const._MD_D3DOWNLOADS_HELP_USERACCESS_PID}>
		</div>
		<div align="right">
			<a href="<{$mod_url}>/admin/index.php?page=<{$page}>&amp;cid=<{$maincid}>"><{$smarty.const._MD_D3DOWNLOADS_MAINCAT_USERACCESS_EDIT}></a>
		</div>
	<{/if}>
	<table class="outer">
		<tr>
			<th colspan="2" style="text-align:center;">
				<span style="font-size: small;"><{$smarty.const._MD_D3DOWNLOADS_TH_GROUPNAME}></span>
			</th>
			<th style="text-align:center;">
				<span style="font-size: small;"><{$smarty.const._MD_D3DOWNLOADS_TH_CAN_READ}></span>
				<{if $parentid == 0}>
					<input type="checkbox" onclick="col_check_on_off( this, 'gcol_1_' )">
				<{/if}>
			</th>
			<th style="text-align:center;">
				<span style="font-size: small;"><{$smarty.const._MD_D3DOWNLOADS_TH_CAN_POST}></span>
				<{if $parentid == 0}>
					<input type="checkbox" onclick="col_check_on_off( this, 'gcol_2_' )">
				<{/if}>
			</th>
			<th style="text-align:center;">
				<span style="font-size: small;"><{$smarty.const._MD_D3DOWNLOADS_TH_CAN_EDIT}></span>
				<{if $parentid == 0}>
					<input type="checkbox" onclick="col_check_on_off( this, 'gcol_3_' )">
				<{/if}>
			</th>
			<th style="text-align:center;">
				<span style="font-size: small;"><{$smarty.const._MD_D3DOWNLOADS_TH_CAN_DELETE}></span>
				<{if $parentid == 0}>
					<input type="checkbox" onclick="col_check_on_off( this, 'gcol_4_' )">
				<{/if}>
			</th>
			<th style="text-align:center;">
				<span style="font-size: small;"><{$smarty.const._MD_D3DOWNLOADS_TH_POST_AUTO_APPROVED}></span>
				<{if $parentid == 0}>
					<input type="checkbox" onclick="col_check_on_off( this, 'gcol_5_' )">
				<{/if}>
			</th>
			<th style="text-align:center;">
				<span style="font-size: small;"><{$smarty.const._MD_D3DOWNLOADS_TH_EDIT_AUTO_APPROVED}></span>
				<{if $parentid == 0}>
					<input type="checkbox" onclick="col_check_on_off( this, 'gcol_6_' )">
				<{/if}>
			</th>
			<th style="text-align:center;">
				<span style="font-size: small;"><{$smarty.const._MD_D3DOWNLOADS_TH_CAN_HTML}></span>
				<{if $parentid == 0}>
					<input type="checkbox" onclick="col_check_on_off( this, 'gcol_7_' )">
				<{/if}>
			</th>
			<th style="text-align:center;">
				<span style="font-size: small;"><{$smarty.const._MD_D3DOWNLOADS_TH_CAN_UPLOAD}></span>
				<{if $parentid == 0}>
					<input type="checkbox" onclick="col_check_on_off( this, 'gcol_8_' )">
				<{/if}>
			</th>
			<{if $parentid == 0 && $copy_select|@count > 1}>
				<th style="text-align:right;">
					<span style="font-size: small;"><{$smarty.const._MD_D3DOWNLOADS_SEL_GROUP}></span>
					<input type="checkbox" onclick="col_check_on_off( this, 'col_action_g_' )">
				</th>
			<{/if}>
		</tr>
			<{$group_trs}>
		<{if $parentid == 0}>
			<tr>
				<td colspan="11" align="center" class="head">
					<input type="submit" name="group_update" value="<{$smarty.const._SUBMIT}>" />
				</td>
			</tr>
			<{if $copy_select|@count > 1}>
				<tr>
					<th colspan="11" style="text-align:right;">
						<{$smarty.const._MD_D3DOWNLOADS_LABEL_GROUP_CHECKED}>
						<input type="submit" name="all_group_copy" id="all_group_copy" value="<{$smarty.const._MD_D3DOWNLOADS_ALL_USERACCESS_COPY}>" /> |
						<input type="submit" name="group_copy" id="group_copy" value="<{$smarty.const._MD_D3DOWNLOADS_USERACCESS_COPY}>" /> 
						<{$smarty.const._MD_D3DOWNLOADS_SEL_CATEGORY}>
						<select name="copy_select_group" id="copy_select_group">
							<{html_options options=$copy_select}>
						</select>
					</th>
				</tr>
			<{/if}>
		<{/if}>
	</table>
	<br />
	<{if $parentid == 0}>
		<div style="color:inherit;border: 1px inset #CCC;padding: 6px;with: 80%;font-size: small;">
			<{$smarty.const._MD_D3DOWNLOADS_HELP_USERACCESS}>
		</div>
		<br />
	<{/if}>
	<{if $parentid == 0 || ( $parentid != 0 && $user_trs)}>
		<table class="outer">
			<tr>
				<th style="text-align:center;"><span style="font-size: small;"><{$smarty.const._MD_D3DOWNLOADS_TH_UID}></span></th>
				<th colspan="2" style="text-align:center;"><span style="font-size: small;"><{$smarty.const._MD_D3DOWNLOADS_TH_UNAME}></span></th>
				<th style="text-align:center;">
					<span style="font-size: small;"><{$smarty.const._MD_D3DOWNLOADS_TH_CAN_READ}></span>
					<{if $parentid == 0}>
						<input type="checkbox" onclick="col_check_on_off( this, 'ucol_1_' );col_check_on_off( this, 'ncol_1_' );">
					<{/if}>
				</th>
				<th style="text-align:center;">
					<span style="font-size: small;"><{$smarty.const._MD_D3DOWNLOADS_TH_CAN_POST}></span>
					<{if $parentid == 0}>
						<input type="checkbox" onclick="col_check_on_off( this, 'ucol_2_' );col_check_on_off( this, 'ncol_2_' );">
					<{/if}>
				</th>
				<th style="text-align:center;">
					<span style="font-size: small;"><{$smarty.const._MD_D3DOWNLOADS_TH_CAN_EDIT}></span>
					<{if $parentid == 0}>
						<input type="checkbox" onclick="col_check_on_off( this, 'ucol_3_' );col_check_on_off( this, 'ncol_3_' );">
					<{/if}>
				</th>
				<th style="text-align:center;">
					<span style="font-size: small;"><{$smarty.const._MD_D3DOWNLOADS_TH_CAN_DELETE}></span>
					<{if $parentid == 0}>
						<input type="checkbox" onclick="col_check_on_off( this, 'ucol_4_' );col_check_on_off( this, 'ncol_4_' );">
					<{/if}>
				</th>
				<th style="text-align:center;">
					<span style="font-size: small;"><{$smarty.const._MD_D3DOWNLOADS_TH_POST_AUTO_APPROVED}></span>
					<{if $parentid == 0}>
						<input type="checkbox" onclick="col_check_on_off( this, 'ucol_5_' );col_check_on_off( this, 'ncol_5_' );">
					<{/if}>
				</th>
				<th style="text-align:center;">
					<span style="font-size: small;"><{$smarty.const._MD_D3DOWNLOADS_TH_EDIT_AUTO_APPROVED}></span>
					<{if $parentid == 0}>
						<input type="checkbox" onclick="col_check_on_off( this, 'ucol_6_' );col_check_on_off( this, 'ncol_6_' );">
					<{/if}>
				</th>
				<th style="text-align:center;">
					<span style="font-size: small;"><{$smarty.const._MD_D3DOWNLOADS_TH_CAN_HTML}></span>
					<{if $parentid == 0}>
						<input type="checkbox" onclick="col_check_on_off( this, 'ucol_7_' );col_check_on_off( this, 'ncol_7_' );">
					<{/if}>
				</th>
				<th style="text-align:center;">
					<span style="font-size: small;"><{$smarty.const._MD_D3DOWNLOADS_TH_CAN_UPLOAD}></span>
					<{if $parentid == 0}>
						<input type="checkbox" onclick="col_check_on_off( this, 'ucol_8_' );col_check_on_off( this, 'ncol_8_' );">
					<{/if}>
				</th>
				<{if $parentid == 0 && $copy_select|@count > 1}>
					<th style="text-align:right;">
						<span style="font-size: small;"><{$smarty.const._MD_D3DOWNLOADS_SEL_USER}></span>
						<input type="checkbox" onclick="col_check_on_off( this, 'col_action_u_' );col_check_on_off( this, 'new_col_action_u_' );">
					</th>
				<{/if}>
			</tr>
			<{$user_trs}>
			<{if $parentid == 0}>
				<{$newuser_trs}>
				<tr>
					<td colspan="12" align="center" class="head">
						<input type="submit" name="user_update" value="<{$smarty.const._SUBMIT}>" />
					</td>
				</tr>
				<{if $copy_select|@count > 1}>
					<tr>
						<th colspan="12" style="text-align:right;">
							<{$smarty.const._MD_D3DOWNLOADS_LABEL_USER_CHECKED}>
							<input type="submit" name="all_user_copy" id="all_user_copy" value="<{$smarty.const._MD_D3DOWNLOADS_ALL_USERACCESS_COPY}>" /> |
							<input type="submit" name="user_copy" id="user_copy" value="<{$smarty.const._MD_D3DOWNLOADS_USERACCESS_COPY}>" /> 
							<{$smarty.const._MD_D3DOWNLOADS_SEL_CATEGORY}>
							<select name="copy_select_user" id="copy_select_user">
								<{html_options options=$copy_select}>
							</select><br />
						</th>
					</tr>
				<{/if}>
			<{/if}>
		</table>
	<{/if}>
</form>
<{if $parentid == 0}>
	<br />
	<div style="color:inherit;border: 1px inset #CCC;padding: 6px;with: 80%;font-size: small;">
		<{$smarty.const._MD_D3DOWNLOADS_HELP_USERACCESS_USER}>
	</div>
<{else}>
	<{if $user_trs}><br /><{/if}>
	<div style="color:inherit;border: 1px inset #CCC;padding: 6px;with: 80%;font-size: small;">
		<{$category_tree}>
	</div>
<{/if}>

<script type="text/javascript">
<!--//
jQuery( function($){
    $( '#all_group_copy' ).click( function(){
		infoDom_initialize() ;
		col_action_check( 'col_action_g_' ) ;
		if( validate_checked > 0 ){
			return confirm('<{$smarty.const._MD_D3DOWNLOADS_CONFIRM_ALL_USERACCESS_COPY}>') ;
		} else {
			popup_info( '<{$smarty.const._MD_D3DOWNLOADS_ERROR_SEL_GROUP}>' )
			return false ;
		}
    });

    $( '#group_copy' ).click( function(){
		infoDom_initialize() ;
		col_action_check( 'col_action_g_' ) ;
		select_check( 'copy_select_group' ) ;
		if( validate_checked > 0 && validate_selected > 0 ){
			return confirm('<{$smarty.const._MD_D3DOWNLOADS_CONFIRM_USERACCESS_COPY}>') ;
		} else {
			if( validate_checked  == 0 ) popup_info( '<{$smarty.const._MD_D3DOWNLOADS_ERROR_SEL_GROUP}>' )
			if( validate_selected == 0 ) popup_info( '<{$smarty.const._MD_D3DOWNLOADS_ERROR_SEL_CATEGORY}>' )
			return false ;
		}
    });

    $( '#all_user_copy' ).click( function(){
		infoDom_initialize() ;
		col_action_check( 'col_action_u_' , 'new_col_action_u_' ) ;
		if( validate_checked > 0 ){
			return confirm('<{$smarty.const._MD_D3DOWNLOADS_CONFIRM_ALL_USERACCESS_COPY}>') ;
		} else {
			popup_info( '<{$smarty.const._MD_D3DOWNLOADS_ERROR_SEL_USER}>' )
			return false ;
		}
    });

    $( '#user_copy' ).click( function(){
		infoDom_initialize() ;
		col_action_check( 'col_action_u_' , 'new_col_action_u_' ) ;
		select_check( 'copy_select_user' ) ;
		if( validate_checked > 0 && validate_selected > 0 ){
			return confirm('<{$smarty.const._MD_D3DOWNLOADS_CONFIRM_USERACCESS_COPY}>') ;
		} else {
			if( validate_checked  == 0 ) popup_info( '<{$smarty.const._MD_D3DOWNLOADS_ERROR_SEL_USER}>' )
			if( validate_selected == 0 ) popup_info( '<{$smarty.const._MD_D3DOWNLOADS_ERROR_SEL_CATEGORY}>' )
			return false ;
		}
    });
});
//-->
</script>