<{include file="db:user_header.html"}>
<script type="text/javascript" charset="utf-8">
jQuery.noConflict();
jQuery(function(){
	var grouphidden = jQuery('#<{$dirname}>_grouphidden').val();
	var warning = jQuery('#<{$dirname}>_warning').val();
	if(warning=='' && grouphidden==1){
		hiddenClick(1);
	}
	jQuery('#<{$dirname}>_groupEditForm :button[rel^="prettyPopin"]').prettyPopin({
		width : 400, /* false/integer */
		height: 400, /* false/integer */
		opacity: 0.5, /* value from 0 to 1 */
		animationSpeed: '0', /*
		slow/medium/fast/integer */
		close : false, /* true/false */
		followScroll: false, /* true/false */
        dirname : '<{$dirname}>',
		loader_path: './images/loader.gif', /* path to your loading image */
		callback: function(id,value){
			var form=jQuery('#<{$dirname}>_groupEditForm');
			jQuery('#<{$dirname}>_op').attr('value', 'search');
			form.attr('action','index.php?action=groupEdit&adminvalue=' + value);
			form.submit();
			return false;
		} /* callback called when closing the popin */
	});
});
function deleteUser(uid){
	jQuery('#<{$dirname}>_uid'+uid).remove();
}
function deleteIcon(){
	jQuery('#<{$dirname}>_icon').attr('style','display:none');
	jQuery('#<{$dirname}>_showThumbnail').attr('value',2);
}
function hiddenClick(value){
	if(value ==1){
		jQuery('input[name="can_join"][value="0"]').attr('checked', true);
		jQuery('input[name="is_public"][value="0"]').attr('checked', true);
		jQuery('input[name="can_join"]').attr('disabled', true);
		jQuery('input[name="is_public"]').attr('disabled', true);
		jQuery('#user_groupentry').attr('value',0);
		jQuery('#user_grouppublic').attr('value',0);
	}else{
		jQuery('input[name="can_join"]').attr('disabled', false);
		jQuery('input[name="is_public"]').attr('disabled', false);
	}
}
</script>
<h3><{$smarty.const._MD_USER_LANG_GROUP_EDIT}></h3>
<{$errors}>
<form id="<{$dirname}>_groupEditForm" name="<{$dirname}>_groupEditForm" action="index.php?action=groupEdit" method="post" enctype="multipart/form-data">
<{$token_ticket}>
<input type="hidden" id="<{$dirname}>_op" name="op" value="" />
<input type="hidden" name="moderator" value="<{$moderator}>" />
<input type="hidden" name="groupid" value="<{$group.groupid}>" />
<input type="hidden" name="gname" value="<{$gname|xoops_escape}>" />
<input type="hidden" id="<{$dirname}>_groupentry" name="groupentry" value="<{$groupentry}>" />
<input type="hidden" id="<{$dirname}>_grouppublic" name="grouppublic" value="<{$grouppublic}>" />
<input type="hidden" id="<{$dirname}>_grouphidden" name="grouphidden" value="<{$grouphidden}>" />
<input type="hidden" id="<{$dirname}>_warning" name="warning" value="<{$warning}>" />
<input type="hidden" id="<{$dirname}>_showThumbnail" name="showThumbnail" value="<{$showThumbnail}>"/>
  
<table class="outer" cellspacing="1" cellpadding="4">
 <tr>
  <td width="40%" class="head"><{$smarty.const._MD_USER_LANG_GROUP_NAME}><span style="color: red;">*</span></td>
  <td width="60%" class="<{cycle name="oddeven" values="odd,even"}>">
 	<input type="text" name="name" size="50" value="<{$group.name|xoops_escape}>"/>
  </td>
 </tr>
 <tr>
  <td class="head"><{$smarty.const._MD_USER_LANG_GROUP_DESCRIPTION}></td>
  <td class="<{cycle name="oddeven"}>">
  	<textarea name="description" rows="5" cols="50" style="width:400px;"><{$group.description|xoops_escape}></textarea>
  </td>
 </tr>
 <tr>
  <td class="head"><{$smarty.const._MD_USER_LANG_GROUP_ADMIN}><span style="color: red;">*</span></td>
  <td class="<{cycle name="oddeven"}>">
  	<{foreach item=admin from=$admins}>
  	 	<div id="<{$dirname}>_uid<{$admin.uid}>">
  		<input type="hidden" name="uid[]" value="<{$admin.uid}>" />
    	<{$admin.name|xoops_escape}><{if $admin.name}>(<{/if}><{$admin.uname|xoops_escape}><{if $admin.name}>)<{/if}>
    	<a href="javascript:deleteUser(<{$admin.uid}>);">
       		<img src="images/delete.gif" alt="<{$smarty.const._DELETE}>" title="<{$smarty.const._DELETE}>" />
       	</a><br />
       	</div>
 	<{/foreach}>
  	<input type="button" href="<{$smarty.const.XOOPS_URL}>/modules/<{$dirname}>/userselectsub.php?callbackid=1;1;1" rel="prettyPopin" value="<{$smarty.const._MD_USER_LANG_SEARCH}>"/> 
  </td>
 </tr>
 <tr>
  <td class="head"><{$smarty.const._MD_USER_LANG_GROUP_ICON}><br /></td>
  <td class="<{cycle name="oddeven"}>">
   <input type="file" name="filepath" size="40"><br/>
   <div id="<{$dirname}>_icon">
   <{if $showThumbnail eq 1}>
	  <img src="<{$thumbnail}>&type=<{$group.mime_type}>"/>
	  <input type="button" value="<{$smarty.const._DELETE}>" onclick="deleteIcon()"/> 
   <{/if}>
   </div>
  </td>
 </tr>
  <tr>
  <td class="head"><{$smarty.const._MD_USER_LANG_GROUP_PUBLIC}><br /></td>
  <td class="<{cycle name="oddeven"}>">
  <{if empty($warning)}>
  	 <{if $group.is_public eq 1}>
  		<input type="radio" checked name="is_public" value="1"/><{$smarty.const._MD_USER_LANG_ALL}>
  		<input type="radio" name="is_public" value="0"/><{$smarty.const._MD_USER_LANG_GROUP_ONLY}>  				
  	 <{else}>
  		<input type="radio" name="is_public" value="1"/><{$smarty.const._MD_USER_LANG_ALL}>
  		<input type="radio" checked name="is_public" value="0"/><{$smarty.const._MD_USER_LANG_GROUP_ONLY}>
  	 <{/if}><br/>
  <{else}>
  	<{if $group.is_public eq 1}>
  		<input type="radio" checked name="is_public" value="1" disabled="disabled"/><{$smarty.const._MD_USER_LANG_ALL}>
  		<input type="radio" name="is_public" value="0" disabled="disabled"/><{$smarty.const._MD_USER_LANG_GROUP_ONLY}>  				
  		<span style="color: red;">&nbsp;&nbsp;&nbsp;<{$warning}></span>
  	<{else}>
  		<input type="radio" name="is_public" value="1" disabled="disabled"/><{$smarty.const._MD_USER_LANG_ALL}>
  		<input type="radio" checked name="is_public" value="0" disabled="disabled"/><{$smarty.const._MD_USER_LANG_GROUP_ONLY}>
  		<span style="color: red;">&nbsp;&nbsp;&nbsp;<{$warning}></span>
  	<{/if}>
  <{/if}>
  </td>
 </tr>
 <tr>
  <td class="head"><{$smarty.const._MD_USER_LANG_GROUP_JOIN_REQUEST}><br /></td>
  <td class="<{cycle name="oddeven"}>">
  	<{if $group.can_join eq 1}>
  		<input type="radio" checked name="can_join" value="1"/><{$smarty.const._MD_USER_LANG_PERMIT}>
  		<input type="radio" name="can_join" value="0"/><{$smarty.const._MD_USER_LANG_NO_PERMIT}>  				
  	<{else}>
  		<input type="radio" name="can_join" value="1"/><{$smarty.const._MD_USER_LANG_PERMIT}>
  		<input type="radio" checked name="can_join" value="0"/><{$smarty.const._MD_USER_LANG_NO_PERMIT}>
  	<{/if}>
  </td>
 </tr>
 <{if $moderator}>  
  <tr>
   <td class="head"><{$smarty.const._MD_USER_LANG_GROUP_HIDDEN}><br /></td>
   <td class="<{cycle name="oddeven"}>">
    <{if empty($warning)}>
  	 <{if $group.is_hidden eq 1}>
  	  <input type="radio" name="is_hidden" value="0"  onclick="hiddenClick('0')"/><{$smarty.const._MD_USER_LANG_NO}> 	
  	  <input type="radio" checked name="is_hidden" value="1"  onclick="hiddenClick('1')"/><{$smarty.const._MD_USER_LANG_YES}> 			 		
  	 <{else}>
  	  <input type="radio" checked name="is_hidden" value="0"  onclick="hiddenClick('0')"/><{$smarty.const._MD_USER_LANG_NO}>
  	  <input type="radio" name="is_hidden" value="1"  onclick="hiddenClick('1')"/><{$smarty.const._MD_USER_LANG_YES}> 		
  	 <{/if}>
   <{/if}>
   <{if !empty($warning)}>
  	<{if $group.is_hidden eq 1}>
  	 <input type="radio" name="is_hidden" value="0" disabled="disabled"/><{$smarty.const._MD_USER_LANG_NO}> 	
  	 <input type="radio" checked name="is_hidden" value="1" disabled="disabled"/><{$smarty.const._MD_USER_LANG_YES}> 			 		
  	 <span style="color: red;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<{$warning}></span>
  	<{else}>
  	 <input type="radio" checked name="is_hidden" value="0" disabled="disabled"/><{$smarty.const._MD_USER_LANG_NO}>
  	 <input type="radio" name="is_hidden" value="1" disabled="disabled"/><{$smarty.const._MD_USER_LANG_YES}> 		
   	 <span style="color: red;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<{$warning}></span>
    <{/if}>
  <{/if}>
  </td>
 </tr>
 <{/if}>
 <tr>
  <td class="head"><{$smarty.const._MD_USER_LANG_GROUP_MEMBER_ACCEPT}><br /></td>
  <td class="<{cycle name="oddeven"}>">
   	<{if $group.member_accept eq 1}>
   		<input type="radio" checked name="member_accept" value="1"/><{$smarty.const._MD_USER_LANG_AUTO}>
  		<input type="radio" name="member_accept" value="0"/><{$smarty.const._MD_USER_LANG_MANUAL}> 		 		 		
  	<{else}>
   		<input type="radio" name="member_accept" value="1"/><{$smarty.const._MD_USER_LANG_AUTO}>
  		<input type="radio" checked name="member_accept" value="0"/><{$smarty.const._MD_USER_LANG_MANUAL}> 		 		
  	<{/if}>
  </td>
 </tr>
 <tr>
  <td class="head"><{$smarty.const._MD_USER_LANG_GROUP_ITEM_ACCEPT}><br /></td>
  <td class="<{cycle name="oddeven"}>">
  	<{if $group.item_accept eq 1}>
  		<input type="radio" checked name="item_accept" value="1"/><{$smarty.const._MD_USER_LANG_AUTO}>
  		<input type="radio" name="item_accept" value="0"/><{$smarty.const._MD_USER_LANG_MANUAL}> 		 		
	<{else}>
  		<input type="radio" name="item_accept" value="1"/><{$smarty.const._MD_USER_LANG_AUTO}>
  		<input type="radio" checked name="item_accept" value="0"/><{$smarty.const._MD_USER_LANG_MANUAL}> 	
  	<{/if}>
  </td>
 </tr>
 <{if $moderator}>  
 <tr>
  <td class="head"><{$smarty.const._MD_USER_LANG_ITEM_LIMIT}><br /><span style="font-weight: normal;"><{$smarty.const._MD_USER_LANG_LIMIT_DESC}></span></td>
  <td class="<{cycle name="oddeven"}>">
  <input type="text" name="item_number_limit" size="50" value="<{$group.item_number_limit|xoops_escape}>"/></td>
 </tr>
 <tr>
  <td class="head"><{$smarty.const._MD_USER_LANG_INDEX_LIMIT}><br /><span style="font-weight: normal;"><{$smarty.const._MD_USER_LANG_LIMIT_DESC}></span></td>
  <td class="<{cycle name="oddeven"}>">
  <input type="text" name="index_number_limit" size="50" value="<{$group.index_number_limit|xoops_escape}>"/></td>
 </tr>
 <tr>
  <td class="head"><{$smarty.const._MD_USER_LANG_ITEM_STORAGE_LIMIT}><br /><span style="font-weight: normal;"><{$smarty.const._MD_USER_LANG_LIMIT_DESC}></span></td>
  <td class="<{cycle name="oddeven"}>">
  <input type="text" name="item_storage_limit" size="50" value="<{$group.item_storage_limit|xoops_escape}>"/></td>
 </tr>
<{else}>
 	<input type="hidden" name="item_number_limit" value="<{$group.item_number_limit}>" />
 	<input type="hidden" name="index_number_limit" value="<{$group.index_number_limit}>" />
 	<input type="hidden" name="item_storage_limit" value="<{$group.item_storage_limit}>" />
 <{/if}>
</table>
<div style="text-align: center">
 <input type="button" value="<{$smarty.const._MD_USER_LANG_UPDATE}>" onclick="this.form.op.value='update';submit()"/>
 <input type="button" value="<{$smarty.const._MD_USER_LANG_BACK}>" onclick="this.form.action='index.php?action=groupList';submit()"/>
</div>
</form>
<{include file="db:user_footer.html"}>
