<div class='page-header'>
	<h1><tmpl_var name="list_head_txt"></h1>
</div>
<p><tmpl_var name="list_desc_txt"></p>

<tmpl_if name="config_error_msg">
<div style="background: #ffdfdf; border: 1px solid #df7d7d; border-width: 1px 0; margin: 1.5em 0 1.5em 0; padding: 7px;">
                <p style="font-face:bold">{tmpl_var name='configuration_error_txt'}</p>
				<div>
				<div style="float:left;width:150px;">{tmpl_var name='config_error_tstamp'} :&nbsp;</div><div style="padding-left:150px;">{tmpl_var name='config_error_msg'}</div>
				</div>
</div>
</tmpl_if>


        
            <div class="form-group">
                <label for="redirect_type" class="col-sm-3 control-label">{tmpl_var name='redirect_type_txt'}</label>
                <div class="col-sm-9"><select name="redirect_type" id="redirect_type" class="form-control">
                    {tmpl_var name='redirect_type'}
                </select></div>
            </div>
            <div class="form-group">
                <label for="redirect_path" class="col-sm-3 control-label">{tmpl_var name='redirect_path_txt'}</label>
                <div class="col-sm-9"><input type="text" name="redirect_path" id="redirect_path" value="{tmpl_var name='redirect_path'}" class="form-control" /></div></div>
            <div class="form-group">
                <label for="seo_redirect" class="col-sm-3 control-label">{tmpl_var name='seo_redirect_txt'}</label>
                <div class="col-sm-9"><select name="seo_redirect" id="seo_redirect" class="form-control">
                    {tmpl_var name='seo_redirect'}
                </select></div>
            </div>
			<div class="form-group nginx">
                <label for="rewrite_rules" class="col-sm-3 control-label">{tmpl_var name='rewrite_rules_txt'}</label>
                <div class="col-sm-9"><textarea class="form-control" name="rewrite_rules" id="rewrite_rules" rows='10' cols='50'>{tmpl_var name='rewrite_rules'}</textarea></div>&nbsp;<b>{tmpl_var name="allowed_rewrite_rule_directives_txt"}</b><br><br>&nbsp;break<br>&nbsp;if<br>&nbsp;return<br>&nbsp;rewrite<br>&nbsp;set<br><br>&nbsp;<a href="http://wiki.nginx.org/HttpRewriteModule" target="_blank">http://wiki.nginx.org/HttpRewriteModule</a>
            </div>
        

        <input type="hidden" name="id" value="{tmpl_var name='id'}">

        <div class="clear"><div class="right">
            <button class="btn btn-default formbutton-success" type="button" value="{tmpl_var name='btn_save_txt'}" data-submit-form="pageForm" data-form-action="sites/web_vhost_domain_edit.php">{tmpl_var name='btn_save_txt'}</button>
            <button class="btn btn-default formbutton-default" type="button" value="{tmpl_var name='btn_cancel_txt'}" data-load-content="sites/web_vhost_domain_list.php">{tmpl_var name='btn_cancel_txt'}</button>
        </div></div>
<script language="JavaScript" type="text/javascript">
    var webId = jQuery('input[name="id"]').val();
    var serverId;
    getServerId(webId);
		
    function getServerId(webId){
        jQuery.getJSON('sites/ajax_get_json.php'+ '?' + Math.round(new Date().getTime()), {web_id : webId, type : "getserverid"}, function(data) {
            serverId = data.serverid;
            adjustForm(serverId);
        });
    }
		
    function adjustForm(serverId){
        jQuery.getJSON('sites/ajax_get_json.php'+ '?' + Math.round(new Date().getTime()), {server_id : serverId, type : "getservertype"}, function(data) {
            var selected = jQuery('#redirect_type').val();
            if(data.servertype == "nginx"){
                jQuery("#redirect_type option[value='R']").attr('disabled','disabled');
                jQuery('#redirect_type option[value="L"]').attr('disabled','disabled');
                jQuery('#redirect_type option[value="R,L"]').attr('disabled','disabled');
                jQuery('#redirect_type option[value="R=301,L"]').attr('disabled','disabled');

                jQuery('#redirect_type option[value="R"]').hide();
                jQuery('#redirect_type option[value="L"]').hide();
                jQuery('#redirect_type option[value="R,L"]').hide();
                jQuery('#redirect_type option[value="R=301,L"]').hide();
                if(selected != "no" && selected != "" && selected != "last" && selected != "break" && selected != "redirect" && selected != "permanent" && selected != "proxy") jQuery('#redirect_type option[value="no"]').attr('selected', 'selected');
				jQuery('.nginx').show();
            } else {
                jQuery('#redirect_type option[value="last"]').attr('disabled','disabled');
                jQuery('#redirect_type option[value="break"]').attr('disabled','disabled');
                jQuery('#redirect_type option[value="redirect"]').attr('disabled','disabled');
                jQuery('#redirect_type option[value="permanent"]').attr('disabled','disabled');
				jQuery('#redirect_type option[value="proxy"]').attr('disabled','disabled');
					
                jQuery('#redirect_type option[value="last"]').hide();
                jQuery('#redirect_type option[value="break"]').hide();
                jQuery('#redirect_type option[value="redirect"]').hide();
                jQuery('#redirect_type option[value="permanent"]').hide();
				jQuery('#redirect_type option[value="proxy"]').hide();
                if(selected != "no" && selected != "" && selected != "R" && selected != "L" && selected != "R,L" && selected != "R=301,L") jQuery('#redirect_type option[value="no"]').attr('selected', 'selected');
				jQuery('.nginx').hide();
            }
        });
    }
			
</script>