Location: PHPKode > projects > MembersGear > membersgear/templates/admin_admin_m.tpl
{$ADMIN_HEADER}

  {*---------------------Change functionality of check box --------------------------*}
  {literal} 
 <script language="JavaScript" type="text/javascript">
   function usernamevalidation()
 {   
      document.getElementById("username").removeAttribute('readonly','readonly'); 
      document.getElementById("username").focus();
      document.getElementById("btnuser").style.display='none';
      document.getElementById("usercheck").value="false";
      document.getElementById("spnusernameavailablelink").innerHTML='';       
      
 }        
 function Emailvalidation()
 {   
      document.getElementById("email").removeAttribute('readonly','readonly'); 
      document.getElementById("email").focus();
      document.getElementById("btnEmail").style.display='none';
      document.getElementById("emailcheck").value="false";   
      document.getElementById("spnemailavailablelink").innerHTML=''
      
 }          
        
        
 var $rn = jQuery.noConflict();  
    $rn(document).ready(function() {
        var isedit='{/literal}{$IsEdit}{literal}';
        $rn('#btnuser').click(function(){usernamevalidation()});
        $rn('#btnEmail').click(function(){Emailvalidation()});
    
        $rn('#username').blur(function(){
           var dataString = 'username='+ $rn('#username').val()+'&from=' + 'adminrequest' ;
           var username=$rn('#username').val();
           
           var mem_login_min_length='{/literal}{$MEMBER_LOGIN_MIN_LENGTH}{literal}';
           var mem_login_max_length='{/literal}{$MEMBER_LOGIN_MAX_LENGTH}{literal}';
           var web_url='{/literal}{$WEB_URL}{literal}';
           var generate_user='{/literal}{$MEMBER_GENERATE_USERNAME}{literal}';    
           var user_exist='{/literal}{$MESSAGE_USER_EXIST}{literal}';
           var userchk=$rn("#usercheck").val();
           var chkattUser=$rn("#username").attr("readonly");
           
           if(chkattUser==false &&  ltrim(rtrim(username))!="")
            {
                   $rn.ajax({
                       type: "POST",
                       url: web_url+"/includes/ctl_isusernameavailable.php",
                       datatype: 'html',
                       data: dataString,
                       success: function(msg){
                           msg=ltrim(rtrim(msg));
                           
                           if(msg=='yes') 
                            {
                               $rn('#usercheck').val('true');
                               $rn('#btnuser').css('display','');
                               $rn('#username').attr('readonly','true');
                               $rn('#spnusernameavailablelink').html('Congratulations!! <b>'+ ltrim(rtrim(username)) + '</b> is available');
                           }
                           else if(msg=='user_exist')
                           {
                               
                               $rn('#usercheck').val('false');   
                               $rn('#spnusernameavailablelink').html('<font color=red><b>'+ ltrim(rtrim(username)) + '</b> '+ user_exist + '</font>');
                               $rn('#btnuser').css('display','none');     
                               
                           
                           } 
                           else if(msg=='not_in_length')
                            {
                            
                               $rn('#usercheck').val('false');    
                               $rn('#spnusernameavailablelink').html('<font color=red>Username length must in between ' + mem_login_min_length + ' to ' + mem_login_max_length +' character</font>');
                               $rn('#btnuser').css('display','none');
                               
                                     
                            
                            }
                          else if(msg=='not_in_length_admin')
                          {
                               $rn('#usercheck').val('false');    
                               $rn('#spnusernameavailablelink').html('<font color=red>Username length must in between 5 to 45 character</font>');
                               $rn('#btnuser').css('display','none');
                          
                          
                          }  
                          else if(msg=='invalid_username')
                           {
                              $rn('#usercheck').val('false');    
                              $rn('#spnusernameavailablelink').html('<font color=red><b>' + username + '</b> is invalid username.</font>');
                              $rn('#btnuser').css('display','none'); 
                           
                           
                           }
                          else
                           {
                               $rn('#btnuser').css('display','none');  
                               $rn('#usercheck').val('false'); 
                               $rn('#spnusernameavailablelink').html('');
                           
                           }    
                         
                       }
                   });  
               
              }   
            
        });          
              
              
        if(isedit=='yes')
         {      
              $rn('#email').change(function(){
               var dataString = 'email='+ $rn('#email').val() + '&uid=' + $rn('#uid').val() ;
               var email=$rn('#email').val();
               var web_url='{/literal}{$WEB_URL}{literal}';
               var email_exist='{/literal}{$MESSAGE_DUPLICATE_EMAIL}{literal}';
               var unique_email='{/literal}{$MEMBER_UNIQUE_EMAIL}{literal}';  
               var emailchk=$rn("#emailcheck").val();
               var chkAttr=$rn("#email").attr("readonly");

               if( chkAttr==false && ltrim(rtrim(email))!='')
                {
                           $rn.ajax({
                               type: "POST",
                               url: web_url+"/includes/ctl_isemailavailable.php",
                               datatype: 'html',
                               data: dataString,
                               success: function(msg){
                                   msg=ltrim(rtrim(msg));
                                   if(msg=='yes') 
                                    {
                                       $rn('#emailcheck').val('true');
                                       $rn('#btnEmail').css('display','');
                                       $rn('#email').attr('readonly','true');
                                       $rn('#spnemailavailablelink').html('Congratulations!! <b>'+ ltrim(rtrim(email)) + '</b> is available');
                                   }
                                   else if(msg=='already_exist')
                                   {
                                       $rn('#emailcheck').val('false');   
                                       $rn('#spnemailavailablelink').html('<font color=red><b>'+ ltrim(rtrim(email)) + '</b> '+ email_exist + '</font>');
                                       $rn('#btnEmail').css('display','none');  
                                       $rn('#email').focus();    
                                   
                                   } 
                                  else if(msg=='invalid_email')
                                   {
                                      $rn('#emailcheck').val('false');  
                                      $rn('#spnemailavailablelink').html('<font color=red><b>' + ltrim(rtrim(email)) + '</b> is invalid Email address.</font>');
                                      $rn('#btnEmail').css('display','none'); 
                                      $rn('#email').focus();
                                   
                                   }
                                  else
                                   {
                                        $rn('#btnEmail').css('display','none'); 
                                        $rn('#emailcheck').val('false');  
                                        $rn('#spnemailavailablelink').html('');
                                   
                                   }    
                                 
                               }
                           });  
                           
                           
                  }     
                        
            });
        
         }
        else
         {
         
              $rn('#email').blur(function(){
               var dataString = 'email='+ $rn('#email').val() + '&uid=' + $rn('#uid').val() ;
               var email=$rn('#email').val();
               var web_url='{/literal}{$WEB_URL}{literal}';
               var email_exist='{/literal}{$MESSAGE_DUPLICATE_EMAIL}{literal}';
               var unique_email='{/literal}{$MEMBER_UNIQUE_EMAIL}{literal}';  
               var emailchk=$rn("#emailcheck").val();
               var chkAttr=$rn("#email").attr("readonly");

               if( chkAttr==false && ltrim(rtrim(email))!='')
                {
                           $rn.ajax({
                               type: "POST",
                               url: web_url+"/includes/ctl_isemailavailable.php",
                               datatype: 'html',
                               data: dataString,
                               success: function(msg){
                                   msg=ltrim(rtrim(msg));
                                   if(msg=='yes') 
                                    {
                                       $rn('#emailcheck').val('true');
                                       $rn('#btnEmail').css('display','');
                                       $rn('#email').attr('readonly','true');
                                       $rn('#spnemailavailablelink').html('Congratulations!! <b>'+ ltrim(rtrim(email)) + '</b> is available');
                                   }
                                   else if(msg=='already_exist')
                                   {
                                       $rn('#emailcheck').val('false');   
                                       $rn('#spnemailavailablelink').html('<font color=red><b>'+ ltrim(rtrim(email)) + '</b> '+ email_exist + '</font>');
                                       $rn('#btnEmail').css('display','none'); 
                                       $rn('#email').focus();        
                                   
                                   } 
                                  else if(msg=='invalid_email')
                                   {
                                      $rn('#emailcheck').val('false');  
                                      $rn('#spnemailavailablelink').html('<font color=red><b>' + ltrim(rtrim(email)) + '</b> is invalid Email address.</font>');
                                      $rn('#btnEmail').css('display','none'); 
                                      $rn('#email').focus();   
                                   
                                   }
                                  else
                                   {
                                        $rn('#btnEmail').css('display','none'); 
                                        $rn('#emailcheck').val('false');  
                                        $rn('#spnemailavailablelink').html('');
                                   
                                   }    
                                 
                               }
                           });  
                           
                           
                  }     
                        
            });
        
         }   
                 
        
   });  
    
    $rn(document).ajaxStart($rn.blockUI).ajaxStop($rn.unblockUI);
              
function CheckRestriction(elementID)
          {
                var PermissionFor = document.getElementById(elementID);
             
                switch(elementID)
                {
                    case 'supuserper':
                            
                            var AdminPermission = document.getElementsByName('adminper[]');
                            
                            if(PermissionFor.checked)
                            {
                                 //alert(AdminPermission.length);
                                for(i=0;i<AdminPermission.length;i++)
                                {
                                    AdminPermission[i].checked = 'true';
                                }
                            }
                            else
                            {
                                for(i=0;i<AdminPermission.length;i++)
                                {
                                    AdminPermission[i].checked = '';
                                }
                            }
                            break;
                    case 'adminper':
                            var flag = 1;
                            var AdminPermission = document.getElementsByName('adminper[]');
                            var SuperUserPermission = document.getElementById('supuserper');
                            
                            for(i=0;i<AdminPermission.length;i++)
                            {
                                if(!AdminPermission[i].checked)
                                {
                                    SuperUserPermission.checked = '';
                                    i = SuperUserPermission.length;
                                    flag = 0;
                                }
                            }
                            
                            if(flag == 1)
                            {
                                SuperUserPermission.checked = 'true';
                            }
                                
                            break;
                }
                //var CheckboxElement = document.getElementById(elementID);
                //alert(Test.checked);
          }
          function confirmsuperuser(elementID)
          {
                 if(elementID=='supuserper')
                {
                     if(document.getElementById('supuserper').checked)
                     {
                        var output=confirm('Are Sure Want to become Super Admin?');
                        if(output==false)
                            document.getElementById('supuserper').checked=false;
                        return output;
                     }
                     else
                     {
                        return true;
                     }
                    
                }
          }
          
          
    </script>
    {/literal}
   {*------------------------------------------------------------------------------*}  

<div id="content" class="setdiv"> 
{encryptUrl enstring=$hi} 
{if $msg neq ''}  
    <br/><center><span class=errormsg >{if $msg neq ''}{$msg}{/if}</span></center>   
{/if}                        
<div id="full-contentdiv">
          <div class="righttop">
                <h2  align="center">
                   {if $IsEdit eq 'yes'}Update Admin{else}Add Admin{/if}
                </h2>
            </div>
         <div class="whole-page clear">
            <!-- Place your content here -->
             {if $IsEdit eq 'yes'}
                    {assign var="action" value="update"}
              {else}
                    {assign var="action" value="insert"}
              {/if}
              <form method="post" name="myform" action="admin_admin_m.php?action={$action}">
                 <input type="hidden" name="uid" id="uid" value="{if $IsEdit eq 'yes'}{$userdata[0].id}{/if}">   
                 <div class="formformat">
                 <table  border="0"  cellspacing="0" cellpadding="0" width="100%" >    
                  <tbody>
                            <tr>
                                <td   class="right-side-text"><label>Email <label class="star">*</label></label></td>
                                <td class="left-side-text">
                                <table  class="borderless" cellspacing="0" cellpadding="0">
                                    <tr>
                                    <td>
                                    
                                       <input  type="text"   name="email" id="email" class="" maxlength="45" size="35" 
                                       value="{if $IsEdit eq 'yes'}{$userdata[0].email}{else}{$post.email}{/if}" {if $MEMBER_UNIQUE_EMAIL eq 'true'}   {/if}>
                                       <input  type="button" class="btncss" name="btnEmail" id="btnEmail" value="Choose another Email" style="display:none" onclick="Emailvalidation()" style="width:140px!important;">
                                       <input  type="hidden"   name="emailcheck" id="emailcheck" {if $IsEdit eq 'yes'}value="true"{else}value="false"{/if}>
                                      <input  type="hidden"   name="emailhidden" id="emailhidden"  maxlength="45" size="35" 
                                       value="{if $IsEdit eq 'yes'}{$userdata[0].email}{else}{$post.email}{/if}">
                                    </td>
                                   
                                    <td class="left-side-text">
                                     {if $MEMBER_UNIQUE_EMAIL eq 'true'}  
                                       <span id="spnemailvailableload" name="spnemailvailableload"></span> 
                                     {else}
                                        &nbsp;
                                     {/if}      
                                    </td>
                                   </tr>
                                   
                                     <tr> 
                                         <td colspan="2">
                                              <div id="spnemailavailablelink" name="spnemailavailablelink"></div> 
                                         </td>    
                                     </tr>
                                
                                </table>
                                </td>

                            </tr>
                           <tr> 
                            <td valign="top"  class="right-side-text" style="width:348px"><label>Username <label class="star">*</label></label></td>
                           
                           <td class="left-side-text">
                                    <table border="0"  class="borderless" cellspacing="0" cellpadding="0">
                                      <tr>
                                        <td class="">
                                           <input  type="text"  name="username" id="username" class="" maxlength="45" size="35" value="{if $IsEdit eq 'yes'}{$userdata[0].username}{else}{$post.username}{/if}"
                                            {if $IsEdit eq 'yes'}readonly=""{/if} >
                                                   <input  type="button" class="btncss" name="btnuser" id="btnuser" value="Choose another Username" style="display:none" onclick="usernamevalidation()" style="width:140px!important;">
                                                  <input  type="hidden"   name="usercheck" id="usercheck" value="false">     
                                           
                                         </td>
                                         {if $IsEdit neq 'yes'}
                                            <td class="left-side-text"> 
                                           
                                             <span id="spnusernameavailableload" name="spnusernameavailableload"></span> 
                                             </td>
                                         {/if}      
                                        </tr>
                                         {if $IsEdit neq 'yes' }        
                                         <tr> 
                                          <td colspan="2">
                                             <div id="spnusernameavailablelink" name="spnusernameavailablelink" ></div>  
                                          </td>    
                                         </tr> 
                                        {/if}
                                      </table>
                                </td>

                        </tr>
                                
                        {if $IsEdit eq 'yes'}
                          {if ($lsloggedinusername eq 'administrator')  or ($userdata[0].username neq 'administrator' && $lsloggedinusername neq 'administrator')}
                                <tr>
                                    <td valign="top"  class="right-side-text"><label>Password <label class="star">*</label></label></td>
                                    <td class="left-side-text">
                                       <input type="password" name="password" id="password" class="txtcss" maxlength="45" size="35" 
                                       value="{if $IsEdit eq 'yes'}{$userdata[0].password}{else}{$post.password}{/if}">
                                    </td>

                                </tr>
                                 <tr>
                                    <td valign="top"  class="right-side-text"><label>Confirm Password <label class="star">*</label></label></td>
                                    <td class="left-side-text">
                                       <input type="password" name="confpassword" id="confpassword" class="txtcss" maxlength="45" size="35" value="{if $IsEdit eq 'yes'}{$userdata[0].password}{else}{$post.password}{/if}">
                                    </td>

                                </tr>
                            {/if}
                       {else}
                       {*Below two Row For Password and confirm paddword add*}
                       <tr>
                            <td valign="top"  class="right-side-text"><label>Password <label class="star">*</label></label></td>
                            <td class="left-side-text">
                               <input type="password" name="password" id="password" class="txtcss" maxlength="45" size="35" 
                               value="{if $IsEdit eq 'yes'}{$userdata[0].password}{else}{$post.password}{/if}">
                            </td>

                        </tr>
                         <tr>
                            <td valign="top"  class="right-side-text"><label>Confirm Password <label class="star">*</label></label></td>
                            <td class="left-side-text">
                               <input type="password" name="confpassword" id="confpassword" class="txtcss" maxlength="45" size="35" value="{if $IsEdit eq 'yes'}{$userdata[0].password}{else}{$post.password}{/if}">
                            </td>

                        </tr>
                            
                       
                        {/if}


                        
                        <tr>         
                            <td valign="top"  class="right-side-text" style=""><label>Super Admin<br/>
                                <div class="FieldLabelNote">Admin has complete access with no restrictions</div></label></td>
                            <td class="left-side-text">    
                            {*style="position: absolute; z-index: 1; height: 916px; width: 534px; left:362px; background-color: #ccc; opacity: 0.5; top: 129px;*height:805pt;filter:alpha(opacity:30);*top:136px">  *}
                                {*{if ($lsloggedinusername eq 'administrator')  or ($userdata[0].username neq 'administrator' && $lsloggedinusername neq 'administrator')}*}
                          
                             {foreach from=$supadminpermission item="supadminperitem"}  
                                 <input class="chkcss" type="checkbox" id="supuserper" value="{$supadminperitem.permissionid}" 
                                 name="supuserper"
                                 {if $IsEdit eq 'yes'}
                                      {foreach from=$userperdata2 item="supdataitem"}
                                        {if $supdataitem.permission eq $supadminperitem.permissionid}
                                            checked=""
                                        {/if} 
                                     {/foreach}
                                {elseif $post.supuserper eq $supadminperitem.permissionid} 
                                         checked=""
                               {/if} onclick="if(confirmsuperuser(this.id)==true)CheckRestriction(this.id);"/>{$supadminperitem.permission}
                             {/foreach}
                             
                                 {if $userdata[0].username eq 'administrator'}
                                   {if $lsloggedinusername neq 'administrator'}
                                    <div id="" style="position: absolute; z-index: 1; height: 960px; width: 534px; left:363px; background-color: #ccc; opacity: 0.5; top: 99px;height:935px;*height:815pt;filter:alpha(opacity:30);*top:115px;" class="example">
                                     {literal}
                                     <script language="javascript" type="text/javascript"> 
                                        var $rn = jQuery.noConflict();
                                        $rn("#supuserper").attr('disabled', 'disabled');
                                     </script>
                                    {/literal}
                                   {else}
                                      <div id="cover" style="" class="example">
                                     </div>
                                    {/if}
                              {/if}
                            </td>
                            
                        </tr>
                         <tr>
                            <td  class="right-side-text" valign="top"><label>Admin Permission </label></td>
                            <td class="left-side-text">
                             {foreach from=$permissionarray item="adminperitem"}      
                                 <input class="chkcss" type="checkbox" id="adminper" value="{$adminperitem.permissionid}" name="adminper[]"
                               {if $IsEdit eq 'yes'}
                                       {foreach from=$userperdata1 item="data1item"} 
                                        {if $data1item.permission eq $adminperitem.permissionid}
                                            checked=""
                                        {/if} 
                                       {/foreach}
                               {else}
                                    {foreach from=$post.adminper item="perdata1item"}
                                         {if $perdata1item eq $adminperitem.permissionid} 
                                             checked=""
                                         {/if}
                                    {/foreach}
                               {/if} onclick="CheckRestriction(this.id);"/>{$adminperitem.permission}
                                 <br/>
                                
                              {/foreach}   
                            </td>

                        </tr>
                            {if $userdata[0].username eq 'administrator'}
                                {php}
                        
                                    echo "<script language=javaScript>";
                                    echo "if(document.getElementById('supuserper')){";
                                    echo "document.getElementById('supuserper').checked = 'true';";
                                    echo "}";
                                    echo "</script>";
                        
                                {/php}        
                            {/if}
                            
                           {if $IsEdit neq ''}
                            {php}
                        
                                    echo "<script language=javaScript>";
                                    echo "if(document.getElementById('supuserper').checked){";
                                    echo "CheckRestriction('supuserper');";
                                    echo "}";
                                    echo "</script>";
                        
                            {/php}
                          {/if}
                          
                         {*<tr>
                            <td  class="right-side-text"><label>Status</label> </td>
                            <td class="left-side-text">
                             {foreach from=$status item="status"}      
                                 <input class="chkcss" type="radio" id="status" value="{$status.statusid}" name="status" 
                                 {if $IsEdit eq 'yes'}
                                        {if $userdata[0].status eq $status.statusid}
                                            checked=""
                                       {/if} 
                                 {elseif $IsEdit eq ''}
                                    {if $status.statusname eq 'Active'}
                                            checked=""
                                      {/if} 
                                 {elseif $post.status eq $status.statusid} 
                                      checked=""   
                                 {/if}/>{$status.statusname}        
                             {/foreach}   
                            </td>
                         </tr> *}
                         <tr>
                                <td  class="right-side-text"><label>Is Approved</label> </td>
                                <td class="left-side-text">
                                     <input class="chkcss" type="checkbox" id="isapproved" value="1" name="isapproved"
                                     {if $IsEdit eq 'yes'}
                                            {if $userdata[0].isapproved eq "1"}
                                                checked=""
                                           {/if} 
                                     {elseif $IsEdit eq ''}
                                                checked=""
                                     {elseif $post.isapproved eq "1"} 
                                      checked=""   
                                      {/if}/> 
                                </td>
                             </tr>
                              <tr>
                                <td  class="right-side-text"><label>Is Lockedout <label class="star">*</label></label></td>
                                <td class="left-side-text">
                                
                                {if $userdata[0].username neq 'administrator'}
                                    <select id="islockedout" name="islockedout" class="selectcss">
                                {else}
                                    <select id="islockedout"  disabled="" name="islockedout" class="selectcss"
                                        onchange="selectdropdownoption(this,'No');alert('You are not permitted to choose other option other than \'No\' for \'Admin\'.');"
                                    >
                                {/if}   
                                    <option value=''>select..</option>
                                    {foreach from=$laLockedout item="laLockedoutitem" key="k"} 
                                        <option value="{$k}"  
                                            {if $IsEdit eq 'yes'}
                                                {if $userdata[0].islockedout eq $k}
                                                   selected=""
                                           {/if} 
                                           {elseif $IsEdit eq ''}
                                                {if $k eq "0"}
                                                    selected=""
                                                {/if}
                                           {elseif $post.islockedout eq $k} 
                                                   selected=""
                                           {/if} >{$laLockedoutitem}</option>
                                    {/foreach}                                    
                                    </select>   
                                 </td>
                             </tr> 
                             {*<tr>
                                <td  class="right-side-text"><label>Unsubscribe</label> </td>
                                <td class="left-side-text">
                                     <input class="chkcss" type="checkbox" id="isUnsubscribe" value="1" name="isUnsubscribe"
                                     {if $IsEdit eq 'yes'}
                                            {if $userdata[0].isunsubscribedfromemails eq "1"}
                                                checked=""
                                           {/if} 
                                     {elseif $IsEdit eq ''}
                                                
                                     {elseif $post.isUnsubscribe eq "1"} 
                                      checked=""   
                                      {/if}/> 
                                </td>
                             </tr> *}
                          <tr>
                           
                                <td  class="right-side-text">&nbsp;</td>
                                <td  class="buttontd">  
                                    <input class="btncss" type="submit" name="submit" {if $IsEdit eq 'yes'}value="Save"{else}value="Submit"{/if}>&nbsp;&nbsp;&nbsp;
                                    <input  class="btncss" type="button" name="btnBack" value="Cancel" onclick="window.history.go(-1);"></td>
                            </tr>    
                        </tbody>
                       </table>  
               </div> 
              </form>
              </div>
              </div>
            {literal} 
          <script language="JavaScript" type="text/javascript">
           var isedit='{/literal}{$IsEdit}{literal}'; 
           var logginusername='{/literal}{$lsloggedinusername}{literal}';
           var selectedusername='{/literal}{$userdata[0].username}{literal}';
           var mem_generate_email='{/literal}{$MEMBER_UNIQUE_EMAIL}{literal}';  
           var mem_generate_user='{/literal}{$MEMBER_GENERATE_USERNAME}{literal}'; 
            var isedit='{/literal}{$IsEdit}{literal}';  
            
            function UserNameAvailableRequest()
            {
                if(document.getElementById('usercheck').value!='true' && document.getElementById('username').value!="" )
                  {
                     UserNameAvailable();
                  }
             
             }    
             
            function useravailableCheck()
               {
                        
                  if(document.getElementById('usercheck').value=='true')
                      {
                       
                            finalresult=true;
                        }
                     
                      else
                      {
                        finalresult=false;
                      }
                       
                   return  finalresult;
               }     
           function EmailAvailableRequest()
           {
             if(document.getElementById('emailcheck').value!='true' && document.getElementById('email').value!="" && isedit=='false')
              {
                 EmailAvailable();
              }
             
             else if(document.getElementById('emailcheck').value=='true' && document.getElementById('email').value!=document.getElementById('emailhidden').value)
             {
                document.getElementById('emailhidden').value=document.getElementById('email').value;
                EmailAvailable();
             }
            else if(document.getElementById('emailcheck').value!='true' && document.getElementById('email').value!='')
             {
                document.getElementById('emailhidden').value=document.getElementById('email').value;
                EmailAvailable();
             } 
                
           }

      
           function emailchecktest()
               {
                  
                
                  if(document.getElementById('emailcheck').value=='true')
                      {
                       
                       
                            finalresult=true;
                        }
                     
                      else
                      {
                        finalresult=false;
                      }
                       
                   return  finalresult;
               }
               
               
          function checkrdlnoreach(test)
          {
                var result = false;
                  
                for(i=0;i<test.length;i++)
                {  
                       
                    if(test[i].checked)
                    {  
                        result = true;
                        break;
                    }
                    
                }
              
                return result
          } 
                      
        function DoMyValidationOne()
        {
          var frm = document.forms["myform"];
          if(frm.password.value != frm.confpassword.value)
          {
            return false;
          }
          else
          {
            return true;
          }
        }
                      
        function DoMyValidationTwo()
      {
          var frm = document.forms["myform"];
          var result2;
          superadminper=frm.supuserper.checked;
             
       
          var adminper=checkrdlnoreach(frm.adminper);  
           
            if(superadminper==true || adminper==true)
            {
                result2= true;
                
            }     
            else
            {
            
                result2= false;
            }  
         
         return result2;
        }
        function DoCustomValidation()
        {
              var frm = document.forms["myform"];
              var foc=1;
              var error="";
              var focus='';
              if(isedit=='yes')
             {
                 if((logginusername == 'administrator')  || (selectedusername!= 'administrator' && logginusername != 'administrator'))
                 {
                      if(false == DoMyValidationOne())
                      {
                         //alert('The Password and Confirm password do not match!'); 
                         // document.getElementById('confpassword').focus(); 
                          error += 'The Password and Confirm Password do not match!'+'\r\n'; 
                            if(foc==1)
                            {
                               
                                focus='confpassword';
                                foc=0;
                            }
                        
                      }
                 }
             }
             else
             {
             
                    if(false == DoMyValidationOne())
                      {
                         //alert('The Password and Confirm password do not match!'); 
                         // document.getElementById('confpassword').focus(); 
                          error += 'The Password and Confirm password do not match!'+'\r\n'; 
                            if(foc==1)
                            {
                               
                                focus='confpassword';
                                foc=0;
                            }
                        
                      }
             
             }
             
              if(false == DoMyValidationTwo())
              {
                // alert('Please  Select  Super User Permission or Admin Permission');
                 //document.getElementById('supuserper').focus();
                 error += 'Please select Super Admin Permission or Admin Permission.'+'\r\n'; 
                    if(foc==1)
                    {
                       
                        focus='supuserper';
                        foc=0;
                    }  
                
              }
              
              if(isedit!='yes' )
              { 
               
                   if(useravailableCheck()==true)
                   {
                     finalresult=true;     
                   
                   }
                 else
                  {
                  
                     finalresult=false;
                     error +='The given username already taken.Please enter different username.' +'\r\n';  
                     
                      if(foc==1)
                      {
                         focus='username';
                         foc=0;
                      }  
                                 
                   } 
                           
                    
              }
              else
              {
                     
                finalresult=true;
              } 
             if(mem_generate_email=='true')
             { 
                  if(emailchecktest()==true)
                   {
                       finalresult=true;     
                   
                   }
                 else
                  {
                  
                     finalresult=false;
                     error +='The given e-mail address already taken.Please enter diffrent Email address.' +'\r\n';  
                     
                     if(foc==1)
                      {
                         focus='email'; 
                         foc=0;
                      }          
                  } 
             }
             
             
             if(error!='')
             {
                   alert(error);
                    var FocusControl = document.getElementById(focus);
                    FocusControl.focus();
                    return false;
             }
             else
             {
                    return true;
             }  
        }


                          
             var frmvalidator  = new Validator("myform");
                
              frmvalidator.EnableMsgsTogether();
              //frmvalidator.EnableOnPageErrorDisplaySingleBox();
             if(isedit!='yes')
             {
                frmvalidator.addValidation("username","req","Please enter Username.");
                frmvalidator.addValidation("username","alnum","Please enter valid Username.");  
                frmvalidator.addValidation("username","minlen=5","Min length for Username is 5.");
                frmvalidator.addValidation("username","maxlen=45","Max length for Username is 45.");
             }
             if(isedit=='yes')
             {
                 if((logginusername == 'administrator')  || (selectedusername!= 'administrator' && logginusername != 'administrator'))
                 {
                 
                    frmvalidator.addValidation("password","req","Please enter Password.");
                    frmvalidator.addValidation("password","minlen=5",    "Min length for Password is 5.");
                    frmvalidator.addValidation("password","maxlen=45",    "Max length for Password is 45.");
                    frmvalidator.addValidation("confpassword","req","Please enter Confirm Password.");
                    frmvalidator.addValidation("confpassword","minlen=5",    "Min length for Confirm Password is 5.");  
                    frmvalidator.addValidation("confpassword","maxlen=45",    "Max length for Confirm Password is 45.");
                 }
             }
             else
             {
                  frmvalidator.addValidation("password","req","Please enter Password.");
                  frmvalidator.addValidation("password","minlen=5",    "Min length for Password is 5."); 
                  frmvalidator.addValidation("password","maxlen=45",    "Max length for Password is 45.");
                  frmvalidator.addValidation("confpassword","req","Please enter Confirm Password.");
                  frmvalidator.addValidation("confpassword","minlen=5",    "Min length for Confirm Password is 5.");
                  frmvalidator.addValidation("confpassword","maxlen=45",    "Max length for Confirm Password is 45.");
             
             }
              frmvalidator.addValidation("email","req","Please enter Email Address.");  
              frmvalidator.addValidation("email","maxlen=50","Max length for Email Address is 45.");
              frmvalidator.addValidation("email","email","Please enter valid Email Address."); 
              frmvalidator.addValidation("islockedout","dontselect=''","Please select Is Lockedout."); 
              frmvalidator.setAddnlValidationFunction("DoCustomValidation"); 
             // frmvalidator.addValidation("supuserper","shouldselchk=on ","Please Select Super User Permission."); 
             
             // alert(document.getElementById('supuserper').length);
          //    frmvalidator.addValidation("adminper","shouldselchk=on ","Please Select admin  Permission.");
              
                
        
            </script>
     {/literal}   
   </div>                  
{$ADMIN_FOOTER}
Return current item: MembersGear