<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: 			*/
// +----------------------------------------------------------------------+
// | PHP version 4/5                                                      |
// +----------------------------------------------------------------------+
// | Copyright (c) 2004-2010 ARMIA INC                                    |
// +----------------------------------------------------------------------+
// | This source file is a part of iScripts VistaCart                     |
// +----------------------------------------------------------------------+
// | Authors: Jipson<jipson.thomas@armiasystems.com>             		  |
// +----------------------------------------------------------------------+
?>
<?php	echo $javascript->link('jquery.js'); ?>
<script language="javascript" type="text/javascript">
function chk(thisform){	
	var i=0;
	var fcs_fld=new Array();	
	var illegalChars = /\W/; /* For User name validtion*/
	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;   /* For Email Address*/
	var errorstr = '';
	var msgstr = "Sorry, we cannot complete your request.\nKindly provide us the missing or incorrect information enclosed below.\n\n";
		
	if ($.trim($('#AdminAdminName').val())=='') { errorstr += "- Please Enter User Name.\n";  fcs_fld[i]='AdminAdminName'; i++;}
    if ($.trim($('#AdminAdminName').val())!='') 
	{
       if ($.trim($('#AdminAdminName').val()).length < 5) { errorstr += "- Username should contain atleast 5 characters.\n";   fcs_fld[i]='AdminAdminName'; i++;}
	}
	if (illegalChars.test($('#AdminAdminName').val())) { errorstr += "- The username contains illegal characters.\n";   fcs_fld[i]='AdminAdminName'; i++;}
		
	if ($.trim($('#AdminEmail').val()) == '') { errorstr += "- Please enter Email Address.\n";  fcs_fld[i]='AdminEmail'; i++;}
	if ($.trim($('#AdminEmail').val())!='') 
		{
		 if(reg.test($.trim($('#AdminEmail').val())) == false) { errorstr += "- Invalid Email Address.\n";   fcs_fld[i]='AdminEmail'; i++;}
		}		
	
	if (errorstr != '')
	{
		msgstr = msgstr + errorstr;
		alert(msgstr);
		$('#'+fcs_fld[0]+'').focus();$('#'+fcs_fld[0]+'').select();
		return false;
	}
	else
	{
		thisform.submit();
		return true;
	}
} 
</script>
<div align="left" class="main_body">
		<!--mainbody area start -->
		<div  class="loginbg_signup admin_edit_add_sec"> 
				<div class="login_userbox">
				<?php echo $form->create('Admin',array('name'=>'Admin')); ?>
					<div>
							<div class="loginhead_admin">Edit Admin User</div>
							<div class="invalid_user">
				          <?php $session->flash(); ?></div>
							<div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
					  </div>
							
				            <!--items display area start -->
<div align="left" class="inner_content_area">
						   <div align="right" id="inner_rightcontent">
						    
						       <span class="toplinks">
							   <?php echo $form->input('admin_name', array('label' => '','class' => 'box2_admin','size' => 27,'value' => $admin["Admin"]["admin_name"] )); ?>
						      
						       </span>					        
					       </div>
		<!--form area start -->
		
				<div align="left" id="login_leftcontent">
				  <p class="maintext_admin">User Name *</p> 
				</div>
				<div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
				 <div align="right" id="inner_rightcontent">
						    
						       <span class="toplinks">
						       <?php echo $form->input('email', array('label' => '','class' => 'box2_admin','size' => 27,'value' => $admin["Admin"]["email"] )); ?>
						       </span>					       
					       </div>
						  
			<div align="left" id="login_leftcontent">
				  <p class="maintext_admin">Email *</p> 
				</div>
				
				
						  
						   <div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
						      <div align="left" id="login_leftcontent">
				  <p class="maintext_admin">Edit Privilege</p> 
				</div>
				
				
				<div align="right" id="inner_rightcontent">
						    <span class="maintext_admin">
								<span>
									<?php if($admin["Admin"]["settings"] == 1){
										echo $form->checkbox('settings',array('checked' => 1)); 
									}else{
										echo $form->checkbox('settings');
									}
									?>Settings
								</span>
							
								<span>
									<?php if($admin["Admin"]["custom"] == 1){
										echo $form->checkbox('custom',array('checked' => 1)); 
									}else{
										echo $form->checkbox('custom');
									}
									?>
									Custom fields
								</span>
							
								<span>								
								<?php if($admin["Admin"]["category"] == 1){
									echo $form->checkbox('category',array('checked' => 1)); 
								}else{
									echo $form->checkbox('category');
								}
								?>
								Categories
								</span>
						    </span>					       
			 </div>
						    <div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
							<div align="right" id="inner_rightcontent">
						    <span class="maintext_admin">
								<span>
								<?php if($admin["Admin"]["products"] == 1){
									echo $form->checkbox('products',array('checked' => 1)); 
								}else{
									echo $form->checkbox('products');
								}
								?>
								Products
								</span>
							
								<span>
								<?php if($admin["Admin"]["adminusers"] == 1){
									echo $form->checkbox('adminusers',array('checked' => 1)); 
								}else{
									echo $form->checkbox('adminusers');
								}
								?>
								Admin Users
								</span>
							
								<span>
								<?php if($admin["Admin"]["homepage"] == 1){
									echo $form->checkbox('homepage',array('checked' => 1)); 
								}else{
									echo $form->checkbox('homepage');
								}
								?>
								Homepage Design
								</span>
						    </span>					       
					 </div>
						    <div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
							<div align="right" id="inner_rightcontent">
						    
						    <span class="maintext_admin">
								<span>
								<?php if($admin["Admin"]["orders"] == 1){
									echo $form->checkbox('orders',array('checked' => 1)); 
								}else{
									echo $form->checkbox('orders');
								}
								?>
								Orders
								</span>
							
								<span>
								<?php if($admin["Admin"]["refund"] == 1){
									echo $form->checkbox('refund',array('checked' => 1)); 
								}else{
									echo $form->checkbox('refund');
								}
								?>
								Refund
								</span>
							
								<span>
								<?php if($admin["Admin"]["promocodes"] == 1){
									echo $form->checkbox('promocodes',array('checked' => 1)); 
								}else{
									echo $form->checkbox('promocodes');
								}
								?>
								Promo codes
								</span>
						    </span>					       
			 </div>
						    <div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
							<div align="right" id="inner_rightcontent">
						    
						    <span class="maintext_admin">
								<span>
								<?php if($admin["Admin"]["websitecontent"] == 1){
									echo $form->checkbox('websitecontent',array('checked' => 1)); 
								}else{
									echo $form->checkbox('websitecontent');
								}
								?>
								Website contents & Emails
								</span>
								
								<span>
								<?php if($admin["Admin"]["reports"] == 1){
									echo $form->checkbox('reports',array('checked' => 1)); 
								}else{
									echo $form->checkbox('reports');
								}
								?>
								Reports
								</span>
						    </span>					       
			 </div>
						    <div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
						<div align="right" id="inner_rightcontent">
						    
						    <span class="maintext_admin">
								<span>
								<?php if($admin["Admin"]["users"] == 1){
									echo $form->checkbox('users',array('checked' => 1)); 
								}else{
									echo $form->checkbox('users');
								}
								?>
								Users
								</span>
							
								<span>
								<?php if($admin["Admin"]["help"] == 1){
									echo $form->checkbox('help',array('checked' => 1)); 
								}else{
									echo $form->checkbox('help');
								}
								?>
								Help Management
								</span>
							
								<span>
								<?php if($admin["Admin"]["feedback"] == 1){
									echo $form->checkbox('feedback',array('checked' => 1)); 
								}else{
									echo $form->checkbox('feedback');
								}
								?>
								Feedback
								</span>
						    </span>					       
			 </div>
			 
			   <div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
						<div align="right" id="inner_rightcontent">
						    
						    <span class="maintext_admin">
								<span>
								<?php if($admin["Admin"]["newsletter"] == 1){
									echo $form->checkbox('newsletter',array('checked' => 1)); 
								}else{
									echo $form->checkbox('newsletter');
								}
								?>
								Newsletters
								</span>
							
								<span>
								<?php if($admin["Admin"]["giftcards"] == 1){
									echo $form->checkbox('giftcards',array('checked' => 1)); 
								}else{
									echo $form->checkbox('giftcards');
								}
								?>
								Gift cards
								</span>
						    </span>					       
			 </div>
			 
			  <div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>   
						    <div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>   
						   <div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
						
				 <div align="right" id="inner_rightcontent">
						   
						       <span class="toplinks">
							   <input type="button" class="buttn_admin" value="Update" onClick="return chk(document.Admin);">
						      
						       </span><span class="maintext_admin"><input type="button" class="buttn_admin" value="Cancel" onClick="javascript:history.go(-1);">			         
			                   </span>
			              
					       </div>
				
				
		
			 
		
			    <div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
		
			<!--form area end -->
                         </div>
						 
						 
						 
								<div align="left" class="float_clear1"></div>
					 <?php echo $form->end(); ?>
				  </div>
				  
						<div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
		</div>
		
		
		</div>