<rdoc:include file="head.htm" />

<!-- BEGIN PAGE CONTENT-->			
<div class="row">
		<div class="col-md-12">
			<div class="portlet box default">
			<div class="portlet-title">
				<div class="caption">
					<i class="fa fa-gift"></i>$sys_component_name
				</div>
				<div class="actions">
			        <div class="btn-group">

			            
			        </div>
			    </div>
			</div>
			<div class="portlet-body">
				<ul class="nav nav-tabs">
					<li class="$navtab0[active]">
						<a href="#tab_1_1" data-toggle="tab" data-id="$navtab0[id]" >
						许可证基本信息 </a>
					</li>

					<li class="$navtab1[active]">
						<a href="#tab_1_2" data-toggle="tab" data-id="$navtab1[id]" >
						许可证详细</a>
					</li>
					
					<li class="$navtab2[active]">
						<a href="#tab_1_3" data-toggle="tab" data-id="$navtab2[id]" >
						许可证升级</a>
					</li>
				</ul>

					<!-- BEGIN TAB CONENT -->
					<div class="tab-content">
						<div class="tab-pane $navtab0[in]" id="tab_1_1">
							<div class="portlet-body form">
								<!-- BEGIN FORM-->
		                        <form action="$_base" name='ruiform' method="POST" class="form-horizontal" id="bindingLicenseForm">
		                            <input type="hidden" name="sbt" value="$sbt">
		                            <input type="hidden" name="component" value="$component">
		                            <input type="hidden" name="task" value="bindingAccount">
                            		<input type="hidden" name="params[action]" value="3">

									<!-- 许可证基本信息 -->
									<div class="panel panel-default">
										<!-- Default panel contents -->
										<div class="panel-heading">
											<h3 class="panel-title">许可证基本信息</h3>
										</div>
										<!-- List group -->
										
										<ul class="list-group">
										    <li class="list-group-item">
											    <label class="list-label">许可证ID :</label>
												    <span class="list-cotent clickcopy">
												    $linfo[sn]</span>
										    </li>
										    
										    <li class="list-group-item">
												<label class="list-label">产品ID :</label>
													<span class="list-cotent clickcopy">
													$sys_product_id </span>
											</li>
											<li class="list-group-item">
												<label class="list-label">许可证状态 
												<span>                            
                                                    <i class="fa  fa-question-circle  tooltips" 
                                                        data-style="default" data-placement="bottom" 
                                                        data-container="body" data-original-title="许可证状态，激活前先绑邮箱，已激活状态可以通过升级越升到更高级版"></i>                            
                                                </span> :</label>
													<span class="list-cotent">
													$linfo[_status] </span>
													
											</li>
											<li class="list-group-item">										
												<label class="list-label">授权方式 :</label>
													<span class="list-cotent">$linfo[_auth]</span> 
											</li>
											
											<li class="list-group-item">										
												<label class="list-label">升级服务 :</label>
													<span class="list-cotent">$linfo[_upgrade]</span> 
											</li>
											

											<li class="list-group-item">										
												<label class="list-label">绑定帐户 :</label>
													<!--#if ($linfo['uid'] > 0) { #-->
			                                        <span class="list-cotent form-control-static">$linfo[email]($linfo[_uid])</span>
			                                        <label class="form-control-static font-green"> <a href='#' id="unbindingAccount"> 解绑 </a></label>			                                        
			                                        <!--# } else {#-->
				                                        <span class="form-group">
					                                            <div class="input-icon">
					                                                <i class="fa fa-envelope"></i>
					                                                <input type="text" class='form-control  placeholder-no-fix input-large'  name="params[account]" value="$linfo[email]" id='param_account' placeholder="@t[Email]" autocomplete="off"/>                                            
					                                              </div>
					                                               <span class="form-control-static"><a href="$registerUrl?account=$linfo[email]" target="_blank">申请新帐户</a></span> 
					                                    </span>

			                                        <!--# } #-->

											</li>

											<li class="list-group-item">										
												<label class="list-label"></label>
													<span class="list-cotent">
													<!--# if ($linfo['uid'] > 0) { #-->
													<button type="button" class="btn default" id="updateLicense">更新许可证</button>
													<!--# } else { #-->	
													<button type="submit" class="btn default" id="bindingLicense">绑定许可证</button>
													<!--# } #-->
													</span>
											</li>
											
										</ul>
									</div>
								</form>

							</div>
						</div>
						<div class="tab-pane $navtab1[in]" id="tab_1_2">
						
						    <div class="portlet-body">
									<!-- 许可证基本信息 -->
									<div class="panel panel-default">
										<!-- Default panel contents -->
										<div class="panel-heading">
											<h3 class="panel-title">许可证基本信息</h3>
										</div>
										<!-- List group -->
										<ul class="list-group">
										    <li class="list-group-item">
												<label class="list-label">许可证ID :</label>
													<span class="list-cotent">
													$linfo[sn]</span>
											</li>
											
										    
											<li class="list-group-item">
												<label class="list-label">产品ID :</label>
													<span class="list-cotent clickcopy">
													$linfo[product_id] </span>
											</li>
											
											<li class="list-group-item">
												<label class="list-label">许可证状态 <span>                            
                                                    <i class="fa  fa-question-circle  tooltips" 
                                                        data-style="default" data-placement="bottom" 
                                                        data-container="body" data-original-title="许可证状态，激活前先绑邮箱，已激活状态可以通过升级越升到更高级版"></i>                            
                                                </span>:</label>
													<span class="list-cotent">
													$linfo[_status]</span>
											</li>
											<li class="list-group-item">										
												<label class="list-label">授权方式 :</label>
													<span class="list-cotent">
													$linfo[_auth]</span>
											</li>
											
											<li class="list-group-item">										
												<label class="list-label">升级服务 :</label>
													<span class="list-cotent">
													$linfo[_upgrade]</span>
											</li>
											<li class="list-group-item">										
												<label class="list-label">绑定帐户 :</label>
													<span class="list-cotent form-control-static">$linfo[email]($linfo[_uid])</span>

											</li>

											
										</ul>
									</div>
									<!-- TYPE -->
									
									<!-- BEGIN 许可证安装应用列表 -->
									<div class="panel panel-default">
										<div class="panel-heading">
											<h3 class="panel-title">许可订购证扩展应用列表</h3>
										</div>
										
										<div class="portlet-body"">
										    <table class="table table-hover table-light">
                                            <thead>
                                                <tr>
                                                    <th> ID</th>
                                                    <th> 名称</th>
                                                    <th> 应用</th>
                                                    <th> 版本 </th>
                                                    <th> 有效期 </th>
                                                </tr>
                                            </thead>
                                            <!--# foreach($linfo['odb'] as $key=>$v) { #-->
                                            <tr>
                                                <td class="fit">
                                                    <label > $v[id] </label>
                                                </td>
                                                <td> $v[_name]</td>
                                                <td> $v[name]</td>
                                                <td> $v[version]</td>
                                                <td> $v[_expired] </td>
                                            </tr>
                                            <!--# } #-->
                                            
                                        </table>
                                        
										</div>
									</div>
									<!-- END 许可证安装应用列表 -->
									

									<!-- BEGIN 性能许可 -->
									<div class="panel panel-default">
										<!-- Default panel contents -->
										<div class="panel-heading">
											<h3 class="panel-title">性能许可</h3>
										</div>
										<!-- List group -->
										<ul class="list-group">
											<li class="list-group-item">
												<label class="list-label">TCP新建 :</label>
													<span class="list-cotent">
													不限 </span>
											</li>
											<li class="list-group-item">
												<label class="list-label">TCP最大连接数 :</label>
													<span class="list-cotent">
													不限 </span>
											</li>
											<li class="list-group-item">
												<label class="list-label">HTTP事务 :</label>
													<span class="list-cotent">
													不限 </span>
											</li>
											<li class="list-group-item">
												<label class="list-label">HTTPS事务 :</label>
													<span class="list-cotent">
													不限 </span>
											</li>
											<li class="list-group-item">
												<label class="list-label">HTTP最大连接数 :</label>
													<span class="list-cotent">
													不限 </span>
											</li>											
										</ul>
									</div>
									<!-- END 性能许可 -->
									<!-- BEGIN 安全功能许可 -->
									<div class="panel panel-default">
										<!-- Default panel contents -->
										<div class="panel-heading">
											<h3 class="panel-title">安全功能许可</h3>
										</div>
										<!-- List group -->
										<ul class="list-group">
																					
											<li class="list-group-item">
												<label class="list-label">WAF支持 :</label>
													<span class="list-cotent">
													否 </span>
											</li>

											<li class="list-group-item">
												<label class="list-label">抗DDOS支持 :</label>
													<span class="list-cotent">
													否 </span>
											</li>

											<li class="list-group-item">
												<label class="list-label">防篡改支持 :</label>
													<span class="list-cotent">
													否 </span>
											</li>

											<li class="list-group-item">
												<label class="list-label">扫描器支持 :</label>
													<span class="list-cotent">
													否 </span>
											</li>

											<li class="list-group-item">
												<label class="list-label">规则库自动支持 :</label>
													<span class="list-cotent">
													否 </span>
											</li>

											<li class="list-group-item">
												<label class="list-label">HTTPS支持 :</label>
													<span class="list-cotent">
													是 </span>
											</li>
											<li class="list-group-item">
												<label class="list-label">IPv6支持 :</label>
													<span class="list-cotent">
													是 </span>
											</li>

											<li class="list-group-item">
												<label class="list-label">集群部署支持 :</label>
													<span class="list-cotent">
													否 </span>
											</li>

											<li class="list-group-item">
												<label class="list-label">支持负载均衡 :</label>
													<span class="list-cotent">
													否 </span>
											</li>


											<li class="list-group-item">
												<label class="list-label">最大主机数量 :</label>
													<span class="list-cotent">
													不限 </span>
											</li>

											<li class="list-group-item">
												<label class="list-label">最大站点数量 :</label>
													<span class="list-cotent">
													不限 </span>
											</li>

											<li class="list-group-item">
												<label class="list-label">最大规则数量 :</label>
													<span class="list-cotent">
													不限 </span>
											</li>

											<li class="list-group-item">
												<label class="list-label">最大策略数量 :</label>
													<span class="list-cotent">
													不限 </span>
											</li>

											
										</ul>
									</div>

									<!-- END 安全功能许可 -->


									<!-- BEGIN 网络许可 -->
									<div class="panel panel-default">
										<!-- Default panel contents -->
										<div class="panel-heading">
											<h3 class="panel-title">网络许可</h3>
										</div>
										<!-- List group -->
										<ul class="list-group">
											<li class="list-group-item">
												<label class="list-label">网络接口数量 :</label>
													<span class="list-cotent">
													不限 </span>
											</li>

											<li class="list-group-item">
												<label class="list-label">网桥接口数量 :</label>
													<span class="list-cotent">
													不限 </span>
											</li>
										</ul>
									</div>
									<!-- END 管理功能许可 -->
							</div>
						              

						</div>
						<div class="tab-pane $navtab2[in]" id="tab_1_3">						
							<h5>无法连网时可以选择通过上传许可证文件来更新许可证：</h5>
							  <div class="btn btn-group tileupload" 
				                data-url="$_base/upload"
				                data-sbt="$sbt"
				                data-tpl="fileselectbutton"
				                data-model="aa"
				                data-oid="1"
				                data-donereload="true"
				                data-uptype="key|txt|lic|doc">
                                </div>
						</div>

						

					</div>
					<!-- END TAB CONENT  -->
				</div>
				<!-- END TAB -->

		</div>
		
	</div>
</div>

<script language='javascript'>
jQuery(document).ready(function() {
    $('.tileupload').tileupload({ autoupload: false });



    $('#bindingLicenseForm').validate({
                errorElement: 'span', //default input error message container
                errorClass: 'help-block', // default input error message class
                focusInvalid: false, // do not focus the last invalid input
                rules: {
                    'params[account]': {
                        required: true,
                        email:true,
                    },
                },
                messages: {  
                    'params[account]': {
                        required: t("The field is required."),
                        email: t("Please enter a valid email address."),
                    },            
                },

                invalidHandler: function (event, validator) { //display error alert on form submit   
                    $('.alert-danger', $('.login-form')).show();
                },

                highlight: function (element) { // hightlight error inputs
                    $(element)
                        .closest('.form-group').addClass('has-error'); // set error class to the control group
                },

                success: function (label) {
                    label.closest('.form-group').removeClass('has-error');
                    label.remove();
                },

                errorPlacement: function (error, element) {
                    error.insertAfter(element);
                },

                submitHandler: function (form) {
                    bootbox.confirm('确定绑定许可证吗？', function(result) {
                        if (result) {
							showWaiting("请稍后。。。");                         
                           var  formData = $(form).serializeArray();
                           //console.log(formData);                       
                           $.post(form.action, formData, function(res) {
                                if (res.status == 0) {
                            	    var msg = (_.isString(res.msg) && res.msg != '')?res.msg:'操作成功';
		                            if (!_.isUndefined(res.data.msg))
		                                msg += '<br>' + res.data.msg;
                                    rui.showTSuccess(msg);
                                } else {
                                   rui.showStatus(res);  
                                }
                            }).fail(function(res){
                                  rui.showStatus(res);      
                            }).always(function(){
                                closeWaiting();
                            }); 
                        }
                    });
                }
       });


    
    //activeLicens    
    $('#activeLicense').click(function(e) {
    	e.preventDefault();  
    	var el = $(this);
    	var account = $('#param_account').val();
    	var url = G.base+'/activeLicense?account='+account;
    	showWaiting("请稍后...");
    	$.getJSON(url, function(res) {
            if (res.status == 0) {
                rui.showTSuccess('操作成功.');
            } else {
               rui.showStatus(res); 
            }
        })
        .fail(function(res) { 
            rui.showStatus(res);
        }).always(function(){
            closeWaiting();
        })   
    });   
    
    //检查远程版本
    $('#updateLicense').click(function(e) {
    	e.preventDefault();  
    	var el = $(this);
    	var account = $('#param_account').val();
    	var url = G.base+'/updateLicense';
    	if (typeof account != 'undefined')
    		url += '?account='+account;
    	
    	showWaiting("请稍后...");
    	$.getJSON(url, function(res) {
            if (res.status == 0) {
                closeWaiting();
                var msg = (_.isString(res.msg) && res.msg != '')?res.msg:'操作成功';
                if (!_.isUndefined(res.data.msg))
                    msg += '<br>' + res.data.msg;
                rui.showTSuccess(msg);
		                
                rui.refresh(1);
            } else {
                var msg = (_.isString(res.msg) && res.msg != '')?res.msg:'操作失败';
                if (!_.isUndefined(res.data.msg))
                    msg += '<br>' + res.data.msg;
                rui.showTError(msg);
                
                closeWaiting();
            }
        })
        .fail(function() { 
             rui.showTError("系统错误!");
             closeWaiting();
        });    
    });

    $('#unbindingAccount').on('click', function(e){
        e.preventDefault(); 
        bootbox.confirm('确定解绑许可证吗？', function(result) {
           if (result) {
           		var url = "$_base/unbindingAccount";
		        showWaiting("请稍后...");
		    	$.getJSON(url, function(res) {
		            if (res.status == 0) {
		                closeWaiting();
		            	var msg = (_.isString(res.msg) && res.msg != '')?res.msg:'操作成功';
		                if (!_.isUndefined(res.data.msg))
		                    msg += '<br>' + res.data.msg;
		                rui.showTSuccess(msg);
		            } else {
		                rui.showTError('操作失败:'+res.status);
		                closeWaiting();
		            }
		        })
		        .fail(function() { 
		             rui.showTError("系统错误!");
		             closeWaiting();
		        });
           }
        });
        

    });
});
 </script>

<rdoc:include file="foot.htm" />			