<? global $vis_language;
   $registratered=($mailqueue_details['registered_client'] == 1)?'<div class="radio i-checks m-r-lg pull-left m"><label><input type="radio" name="vis_register" checked="checked" id="vis_register_yes" value="1" /><i></i>'.$vis_language['TXTYES'].'</label></div> <div class="radio i-checks m-r-lg pull-left m"><label><input type="radio" name="vis_register" id="vis_register_no" value="0" /><i></i>'.$vis_language['TXTNO'].'</label></div>':'<div class="radio i-checks m-r-lg pull-left m"><label><input type="radio" name="vis_register" id="vis_register_yes" value="1" /><i></i>'.$vis_language['TXTYES'].'</label></div> <div class="radio i-checks m-r-lg pull-left m"><label><input type="radio" name="vis_register" id="vis_register_no" value="0" checked="checked" /><i></i>'.$vis_language['TXTNO'].'</label></div>';
   $can_delete=($mailqueue_details['can_delete']==0)?'<div class="radio i-checks m-r-lg pull-left m"><label><input type="radio" name="vis_candelete" checked="checked" id="vis_candelete_yes" value="0" /><i></i>'.$vis_language['TXTYES'].'</label></div> <div class="radio i-checks m-r-lg pull-left m"><label><input type="radio" name="vis_candelete" id="vis_candelete_no" value="1" /><i></i>'.$vis_language['TXTNO'].'</label></div>':'<div class="radio i-checks m-r-lg pull-left m"><label><input type="radio" name="vis_candelete" id="vis_candelete_yes" value="0" /><i></i>'.$vis_language['TXTYES'].'</label></div> <div class="radio i-checks m-r-lg pull-left m"><label><input type="radio" name="vis_candelete" id="vis_candelete_no" value="1" checked="checked" /><i></i>'.$vis_language['TXTNO'].'</label></div>';
   $forwardmail=($mailqueue_details['forward_email_flag'] == 1)?'<div class="radio i-checks m-r-lg pull-left m"><label><input type="radio" name="vis_forward_email_flag" checked="checked" id="vis_forward_email_flag_yes" value="1" /><i></i>'.$vis_language['TXTYES'].'</label> </div><div class="radio i-checks m-r-lg pull-left m"><label><input type="radio" name="vis_forward_email_flag" id="vis_forward_email_flag_no" value="0" /><i></i>'.$vis_language['TXTNO'].'</label></div>':'<div class="radio i-checks m-r-lg pull-left m"><label><input type="radio" name="vis_forward_email_flag" id="vis_forward_email_flag_yes" value="1" /><i></i>'.$vis_language['TXTYES'].'</label></div> <div class="radio i-checks m-r-lg pull-left m"><label><input type="radio" name="vis_forward_email_flag" id="vis_forward_email_flag_no" value="0" checked="checked" /><i></i>'.$vis_language['TXTNO'].'</label></div>';
   $type=array(0=>'Pipe', 1=>'POP3', 2=>'POP3 SSL', 3=>'POP3 TLS', 4=>'IMAP', 5=>'IMAP SSL',6=>'IMAP TLS'); ?>
<form class="form-horizontal" data-validate="parsley" id="vis_mailqueue_form" name="vis_mailqueue_form" method="post" >
   <div class="panel-body">
      <div class="form-group">
         <label class="col-sm-2 control-label"><? echo $vis_language['TXTEMAIL']; ?></label>
         <div class="col-sm-10">
            <input class="form-control input-sm" type="text"  name="vis_mailqueue" id="vis_mailqueue" onblur="vis_queue_disp()" value="<? echo $mailqueue_details['email']; ?>">
         </div>
      </div>
      <div class="form-group">
         <label class="col-sm-2 control-label"><? echo $vis_language['TXTDEPARTMENT']; ?></label>
         <div class="col-sm-10">
            <select name="vis_department" id="vis_department" class="form-control input-sm selectpicker" <? if(count($department_details)>10) echo 'data-live-search="true"';?>>
            <?
               for($i=0;$i<count($department_details);$i++) {
               echo '<option value="'.$department_details[$i]['department_id'].'"'.(($mailqueue_details['department_id']==$department_details[$i]['department_id'])?' selected="selected"':'').'> '.$department_details[$i]['domain_name'].' : '.$department_details[$i]['department_name'].'</option>';
               }
               ?></select>
         </div>
      </div>
      <div class="form-group">
         <label class="col-sm-2 control-label"><? echo $vis_language['TXTFETCHTYPE']; ?></label>
         <div class="col-sm-10">
            <select id="vis_fetchtype" name="vis_fetchtype" onchange="vis_change_portdetails(this.value)" class="form-control input-sm selectpicker" <? if(count($type)>10) echo 'data-live-search="true"';?> >
            <?
               for($i=0;$i<count($type);$i++) {
               if($mailqueue_details['mailqueue_type'] == $i) $selected='selected="selected"'; else $selected='';
               echo '<option value="'.$i.'" '.$selected.' >'.$type[$i].'</option>'; } ?></select>
         </div>
      </div>
       <div id="log_info" <?echo ($mailqueue_details['mailqueue_type']==0)? 'style="display:none;"' : ''; ?>>
      <div class="form-group">
         <label class="col-sm-12 setting-list">
            <h4><? echo $vis_language['TXTLOGININFORMATION']; ?>( for POP3 and IMAP)</h4>
         </label>
      </div>
      <div class="form-group">
         <label class="col-sm-2 control-label"><? echo $vis_language['TXTHOSTNAME']; ?></label>
         <div class="col-sm-10">
            <input class="form-control input-sm" type="text"  name="vis_host" id="vis_host" value="<? echo $mailqueue_details['host_name']; ?>">
         </div>
      </div>
      <div class="form-group">
         <label class="col-sm-2 control-label"><? echo $vis_language['TXTPORT']; ?></label>
         <div class="col-sm-10">
            <input class="form-control input-sm" type="text"  name="vis_port" id="vis_port" value="<? echo $mailqueue_details['port_number']; ?>">
         </div>
      </div>
      <div class="form-group">
         <label class="col-sm-2 control-label"><? echo $vis_language['TXTUSERNAME']; ?></label>
         <div class="col-sm-10">
            <input class="form-control input-sm" type="text"  name="vis_username" id="vis_username" value="<? echo $mailqueue_details['user_name']; ?>">
         </div>
      </div>
      <div class="form-group">
         <label class="col-sm-2 control-label"><? echo $vis_language['TXTPASSWORD']; ?></label>
         <div class="col-sm-10">
            <input class="form-control input-sm" type="password" name="vis_password" id="vis_password" value="<? echo password_decrypt($mailqueue_details['authentication'],VIS_PASSWORD_KEY); ?>">
         </div>
      </div>
      <div class="form-group">
         <label class="col-sm-2 control-label"><? echo $vis_language['TXTLEAVEACOPYONSERVER']; ?></label>
         <div class="col-sm-14">
            <? echo $can_delete; ?>
         </div>
      </div>
      </div>
      <div class="form-group">
         <label class="col-sm-12 setting-list">
            <h4><? echo $vis_language['TXTOVERRIDEDETAILS']; ?></h4>
         </label>
      </div>
      <div class="form-group">
         <label class="col-sm-2 control-label"><? echo $vis_language['TXTFROMNAME']; ?></label>
         <div class="col-sm-10">
            <input class="form-control input-sm" type="text"  name="vis_overname" id="vis_overname" value="<? echo $mailqueue_details['override_name']; ?>">
         </div>
      </div>
      <div class="form-group">
         <label class="col-sm-2 control-label"><? echo $vis_language['TXTFROMEMAIL']; ?></label>
         <div class="col-sm-10">
            <input class="form-control input-sm" type="text" name="vis_overemail" id="vis_overemail" value="<? echo $mailqueue_details['override_email']; ?>" >
         </div>
      </div>
      <div class="form-group">
         <label class="col-sm-12 setting-list">
            <h4><? echo $vis_language['TXTQUEUESETTING']; ?></h4>
         </label>
      </div>
      <div class="form-group">
         <label class="col-sm-2 control-label"><? echo $vis_language['TXTREGISTRATIONREQUIRED']; ?></label>
         <div class="col-sm-14">
            <? echo $registratered; ?>
         </div>
      </div>
      <div class="form-group">
         <label class="col-sm-2 control-label"><? echo $vis_language['TXTISFORWARDEMAIL']; ?></label>
         <div class="col-sm-14">
            <? echo $forwardmail; ?>
         </div>
      </div>
      <div class="form-group" id="forword_email_update">
         <label class="col-sm-2 control-label"><? echo $vis_language['TXTFORWARDEMAIL']; ?></label>
         <div class="col-sm-10">
            <input class="form-control input-sm" type="text" name="vis_forwardemail" id="vis_forwardemail" value="<? echo $mailqueue_details['forward_email']; ?>"  >
         </div>
      </div>
      <div class="form-group">
         <label class="col-sm-2 control-label"><? echo $vis_language['TXTSTATUS']; ?></label>
         <div class="col-sm-1">
            <label class="switch  <? if($mailqueue_details['is_enabled']==0) echo 'radio-no-uncheck'; ?>  ">
            <input type="checkbox"  name="vis_status"  id="vis_status" <? if($mailqueue_details['is_enabled']==1 || $mailqueue_details['is_enabled']==3) echo ' checked="checked"'; ?>   > 
            <span ></span>
            </label>
         </div>
      </div>
      <div class="line b-b line-lg pull-in"></div>
      <br/>             
      <div class="form-group">
         <div class="col-sm-4 col-sm-offset-2">
            <button type="button" class="btn btn-primary" onclick="$('#vis_workpanel_div').visExecution('submit_form',{'vis_module':'setting', 'vis_operation':'update_mailqueue', 'vis_form':'vis_mailqueue_form'})"><? echo $vis_language['TXTUPDATE']; ?></button>
         </div>
      </div>
   </div>
   <input type="hidden" name="vis_mailqueue_id" value="<? echo $mailqueue_details['mailqueue_id']; ?>" />
   <input type="hidden" name="vis_operation" value="update_mailqueue" />
   <input type="hidden" name="vis_module" value="setting" />
</form>
<script type="text/javascript" language="javascript" >
	if ($(vis_forward_email_flag_no).is(":checked"))
   {
    $('#forword_email_update').hide();
   }
	$(document).ready(function () {
	   $('#vis_forward_email_flag_yes').click(function () {
		  $('#forword_email_update').show();
   });
   $('#vis_forward_email_flag_no').click(function () {                   
		 $('#forword_email_update').hide();
	});
  });
   function vis_change_portdetails(vis_id){
       var vis_port = document.getElementById('vis_port');
        if(vis_id == 0)  $('#log_info').hide(); else $('#log_info').show();
       if(vis_id == 1) vis_port.value = "110";
       if(vis_id == 2 || vis_id == 3)  vis_port.value = "995";
       if(vis_id == 4) vis_port.value = "143";
       if(vis_id == 5 || vis_id == 6)  vis_port.value = "993";
   }

  
</script>
