<?
   global $vis_language;
   $type=array(0=>'Pipe', 1=>'POP3', 2=>'POP3 SSL', 3=>'POP3 TLS', 4=>'IMAP', 5=>'IMAP SSL', 6=>'IMAP TLS');
   ?>
<section id="breadcrumb" class="row m-b m-l-none m-r-none">
   <div class="col-sm-6">
      <h3 class="m-b-xs text-black"><? echo $operation['view_title']; ?></h3>
      <ul class="breadcrumb bg-empty no-border m-b-xxs no-padder">
         <li><a class="link" href="#/home/quick_view/<? echo $vis_language['TXTHOME']; ?>"><? echo $vis_language['TXTHOME']; ?></a></li>
         <li><a class="link" href="#/setting/setting_menu/<? echo $vis_language['TXTSETTINGS'];?>" onclick="$('#vis_workpanel_div').visExecution('load_module','<? echo $vis_language['TXTSETTINGS'];?>',{'vis_module':'setting','vis_operation':'setting_menu'});"><? echo $vis_language['TXTSETTINGS']; ?></a></li>
         <li><a  class="link" href="#/setting/view_mailqueue/<? echo $vis_language['TXTEMAILQUEUE'];?>" onclick="$('#vis_workpanel_div').visExecution('load_module','<? echo $vis_language['TXTEMAILQUEUE'];?>',{'vis_module':'setting','vis_operation':'view_mailqueue'});" class="link"><? echo $operation['view_title']; ?></a> </li>
         <li class="active"><? echo $vis_language['TXTADDMAILQUEUE'];?></li>
      </ul>
   </div>
</section>
<section class="padder">
   <section class="panel panel-default">
      <header class="panel-heading sub_header"><? echo $vis_language['TXTADDMAILQUEUE']; ?></header>
      <form class="form-horizontal" data-validate="parsley" id="vis_new_mailqueue_form" name="vis_new_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" value="" onblur="vis_queue_disp()">
               </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"';?>>
				 	 <option value="0"><? echo $vis_language['TXTSELECTDEPARTMENT']; ?></option>
                  <?
                     for($i=0;$i<count($department_details);$i++) {
                         echo '<option value="'.$department_details[$i]['department_id'].'">'.$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++) echo '<option value="'.$i.'" >'.$type[$i].'</option>'; ?></select>
               </div>
            </div>
            <div id="log_info" 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="">
               </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="">
               </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="">
               </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="">
               </div>
            </div>
            <div class="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTLEAVEACOPYONSERVER']; ?></label>
               <div class="col-sm-14">
                  <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>
                  <? echo $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>
                  <? echo $vis_language['TXTNO']; ?>
                  </label></div>
               </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="">
               </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="" >
               </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">
                  <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>
                  <? echo $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" checked="checked" value="0"/><i></i>
                  <? echo $vis_language['TXTNO']; ?>
                  </label></div>
               </div>
            </div>
            <div class="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTISFORWARDEMAIL']; ?></label>
               <div class="col-sm-14">
                  <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>
                  <? echo $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" checked="checked" value="0"/><i></i>
                  <? echo $vis_language['TXTNO']; ?>
                  </label></div>
               </div>
            </div>
            <div class="form-group" id="forword_email">
               <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=""  >
               </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">
                  <input type="checkbox" checked="checked" name="vis_status"  id="vis_status" >
                  <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':'add_mailqueue', 'vis_form':'vis_new_mailqueue_form'})"><? echo $vis_language['TXTADD']; ?></button>
               </div>
            </div>
         </div>
      </form>
   </section>
</section>
<script type="text/javascript" language="javascript" >
	if ($(vis_forward_email_flag_no).is(":checked"))
   {
    $('#forword_email').hide();
   }
	$(document).ready(function () {
	   $('#vis_forward_email_flag_yes').click(function () {
		  $('#forword_email').show();
   });
   $('#vis_forward_email_flag_no').click(function () {
		 $('#forword_email').hide();
	});
  });
   $(".selectpicker").selectpicker();
   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";
   }
   function vis_queue_disp(){
       var email = document.getElementById('vis_mailqueue').value;
       var info = new Array();
       info = email.split("@");
       var str = info[0];
       str = str[0].toUpperCase()+str.substr(1);
       document.getElementById('vis_overname').value=str;
       document.getElementById('vis_overemail').value=email;
   }
   $(".selectpicker").selectpicker();
</script>

