Skip to content
template_site.htm 14.3 KiB
Newer Older
Kristián Feldsam's avatar
Kristián Feldsam committed
<div class="form-group">
	<label for="template_name" class="col-sm-3 control-label">{tmpl_var name='template_name_txt'}</label>
	<div class="col-sm-9">
		<input type="text" name="template_name" id="template_name" value="{tmpl_var name='template_name'}" class="form-control" />
	</div>
</div>
<div class="form-group">
	<label for="server_id" class="col-sm-3 control-label">{tmpl_var name='server_id_txt'}</label>
	<div class="col-sm-9">
		<select name="web_server_id" id="server_id" class="form-control">
			{tmpl_var name='web_server_id'}
		</select>
	</div>
</div>
<div class="form-group">
	<label for="ip_address" class="col-sm-3 control-label">{tmpl_var name='ip_address_txt'}</label>
	<div class="col-sm-9">
		<select name="ip_address" id="ip_address" class="form-control">
			{tmpl_var name='ip_address'}
		</select>
	</div>
</div>
<div class="form-group">
	<label for="ipv6_address" class="col-sm-3 control-label">{tmpl_var name='ipv6_address_txt'}</label>
	<div class="col-sm-9">
		<select name="ipv6_address" id="ipv6_address" class="form-control">
			{tmpl_var name='ipv6_address'}
		</select>
	</div>
</div>
<div class="form-group">
	<label for="hd_quota" class="col-sm-3 control-label">{tmpl_var name='hd_quota_txt'}</label>
	<div class="col-sm-3">
		<input name="hd_quota" id="hd_quota" value="{tmpl_var name='hd_quota'}" size="7" maxlength="7" type="text" class="form-control" />
	</div>
	<div class="col-sm-3 input-sm">&nbsp;MB</div>
</div>
<div class="form-group">
	<label for="traffic_quota" class="col-sm-3 control-label">{tmpl_var name='traffic_quota_txt'}</label>
	<div class="col-sm-3">
		<input name="traffic_quota" id="traffic_quota" value="{tmpl_var name='traffic_quota'}" size="7" maxlength="7" type="text" class="form-control" />
	</div>
	<div class="col-sm-3 input-sm">&nbsp;MB</div>
</div>
<div class="form-group">
	<label class="col-sm-3 control-label">{tmpl_var name='cgi_txt'}</label>
	<div class="col-sm-9">
		{tmpl_var name='cgi'}
	</div>
</div>
<div class="form-group">
	<label class="col-sm-3 control-label">{tmpl_var name='ssi_txt'}</label>
	<div class="col-sm-9">
		{tmpl_var name='ssi'}
	</div>
</div>
<div class="form-group">
	<label class="col-sm-3 control-label">{tmpl_var name='suexec_txt'}</label>
	<div class="col-sm-9">
		{tmpl_var name='suexec'}
	</div>
</div>
<div class="form-group">
	<label class="col-sm-3 control-label">{tmpl_var name='errordocs_txt'}</label>
	<div class="col-sm-9">
		{tmpl_var name='errordocs'}
	</div>
</div>
<div class="form-group">
	<label for="subdomain" class="col-sm-3 control-label">{tmpl_var name='subdomain_txt'}</label>
	<div class="col-sm-9">
		<select name="subdomain" id="subdomain" class="form-control">
			{tmpl_var name='subdomain'}
		</select>	
	</div>
</div>
<div class="form-group">
	<label for="php" class="col-sm-3 control-label">{tmpl_var name='php_txt'}</label>
	<div class="col-sm-9">
		<select name="php" id="php" class="form-control">
			{tmpl_var name='php'}
		</select>
	</div>
</div>
<div class="form-group fastcgi_php_version">
	<label for="fastcgi_php_version" class="col-sm-3 control-label">{tmpl_var name='fastcgi_php_version_txt'}</label>
	<div class="col-sm-9">
		<select name="fastcgi_php_version" id="fastcgi_php_version" class="form-control" data-selected="{tmpl_var name='fastcgi_php_version'}"></select>
Kristián Feldsam's avatar
Kristián Feldsam committed
	</div>
</div>
<div class="form-group">
	<label class="col-sm-3 control-label">{tmpl_var name='perl_txt'}</label>
	<div class="col-sm-9">
		{tmpl_var name='perl'}
	</div>
</div>
<div class="form-group">
	<label class="col-sm-3 control-label">{tmpl_var name='ruby_txt'}</label>
	<div class="col-sm-9">
		{tmpl_var name='ruby'}
	</div>
</div>
<div class="form-group">
	<label class="col-sm-3 control-label">{tmpl_var name='python_txt'}</label>
	<div class="col-sm-9">
		{tmpl_var name='python'}
	</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">
	<label class="col-sm-3 control-label">{tmpl_var name='rewrite_to_https_txt'}</label>
	<div class="col-sm-9">
		{tmpl_var name="rewrite_to_https"}
	</div>
</div>
<div class="form-group apache">
	<label for="allow_override" class="col-sm-3 control-label">{tmpl_var name='allow_override_txt'}</label>
	<div class="col-sm-9">
		<input name="allow_override" id="allow_override" value="{tmpl_var name='allow_override'}" size="30" maxlength="255" type="text" class="form-control" />
	</div>
</div>
<div class="form-group nginx">
    <label for="http_port" class="col-sm-3 control-label">{tmpl_var name='http_port_txt'}</label>
    <div class="col-sm-9"><input name="http_port" id="http_port" value="{tmpl_var name='http_port'}" type="text" class="form-control" /></div>
</div>
<div class="form-group nginx">
    <label for="https_port" class="col-sm-3 control-label">{tmpl_var name='https_port_txt'}</label>
    <div class="col-sm-9"><input name="https_port" id="https_port" value="{tmpl_var name='https_port'}" type="text" class="form-control" /></div>
</div>	
<div class="phpfpm">
	<div class="form-group">
		<label class="col-sm-3 control-label">{tmpl_var name='php_fpm_use_socket_txt'}</label>
		<div class="col-sm-9">
			{tmpl_var name='php_fpm_use_socket'}
		</div>
	</div>
	<div class="form-group">
		<label for="pm" class="col-sm-3 control-label">{tmpl_var name='pm_txt'}</label>
		<div class="col-sm-9">
			<select name="pm" id="pm" class="form-control">
				{tmpl_var name='pm'}
			</select>
		</div>
	</div>
	<div class="ctrlHolder pm_ondemand" style="background: #ffdfdf; border: 1px solid #df7d7d; border-width: 1px 0; margin: 1.5em 0 1.5em 0; padding: 7px;">
        {tmpl_var name='pm_ondemand_hint_txt'}
    </div>
	<div class="form-group">
		<label for="pm_max_children" class="col-sm-3 control-label">{tmpl_var name='pm_max_children_txt'}</label>
		<div class="col-sm-9">
			<input name="pm_max_children" id="pm_max_children" value="{tmpl_var name='pm_max_children'}" size="3" maxlength="3" type="text" class="form-control" />
		</div>
	</div>
	<div class="form-group pm_dynamic">
		<label for="pm_start_servers" class="col-sm-3 control-label">{tmpl_var name='pm_start_servers_txt'}</label>
		<div class="col-sm-9">
			<input name="pm_start_servers" id="pm_start_servers" value="{tmpl_var name='pm_start_servers'}" size="3" maxlength="3" type="text" class="form-control" />
		</div>
	</div>
	<div class="form-group pm_dynamic">
		<label for="pm_min_spare_servers" class="col-sm-3 control-label">{tmpl_var name='pm_min_spare_servers_txt'}</label>
		<div class="col-sm-9">
			<input name="pm_min_spare_servers" id="pm_min_spare_servers" value="{tmpl_var name='pm_min_spare_servers'}" size="3" maxlength="3" type="text" class="form-control" />
		</div>
	</div>
	<div class="form-group pm_dynamic">
		<label for="pm_max_spare_servers" class="col-sm-3 control-label">{tmpl_var name='pm_max_spare_servers_txt'}</label>
		<div class="col-sm-9">
			<input name="pm_max_spare_servers" id="pm_max_spare_servers" value="{tmpl_var name='pm_max_spare_servers'}" size="3" maxlength="3" type="text" class="form-control" />
		</div>
	</div>
	<div class="form-group pm_ondemand">
		<label for="pm_process_idle_timeout" class="col-sm-3 control-label">{tmpl_var name='pm_process_idle_timeout_txt'}</label>
		<div class="col-sm-9">
			<input name="pm_process_idle_timeout" id="pm_process_idle_timeout" value="{tmpl_var name='pm_process_idle_timeout'}" size="3" maxlength="6" type="text" class="form-control" />
		</div>
	</div>
	<div class="form-group">
		<label for="pm_max_requests" class="col-sm-3 control-label">{tmpl_var name='pm_max_requests_txt'}</label>
		<div class="col-sm-9">
			<input name="pm_max_requests" id="pm_max_requests" value="{tmpl_var name='pm_max_requests'}" size="3" maxlength="6" type="text" class="form-control" />
		</div>
	</div>
</div>
<div class="form-group php">
	<label for="custom_php_ini" class="col-sm-3 control-label">{tmpl_var name='custom_php_ini_txt'}</label>
	<div class="col-sm-9">
		<textarea class="form-control" name="custom_php_ini" id="custom_php_ini" rows='10' cols='50'>{tmpl_var name='custom_php_ini'}</textarea>
	</div>
</div>
<div class="form-group apache">
	<label for="apache_directives" class="col-sm-3 control-label">{tmpl_var name='apache_directives_txt'}</label>
	<div class="col-sm-7">
		<textarea class="form-control" name="apache_directives" id="apache_directives" rows='10' cols='50'>{tmpl_var name='apache_directives'}</textarea>
	</div>
	<div class="col-sm-2">
		<b>{tmpl_var name='variables_txt'}:</b><br>
		<a href="javascript:void(0);" class="addPlaceholder">{DOCROOT}</a>
	</div>
</div>
<div class="form-group nginx">
	<label for="nginx_directives" class="col-sm-3 control-label">{tmpl_var name='nginx_directives_txt'}</label>
	<div class="col-sm-7">
		<textarea class="form-control" name="nginx_directives" id="nginx_directives" rows='10' cols='50'>{tmpl_var name='nginx_directives'}</textarea>
	</div>
	<div class="col-sm-2">
		<b>{tmpl_var name='variables_txt'}:</b><br>
		<a href="javascript:void(0);" class="addPlaceholder">{DOCROOT}</a><br>
		<a href="javascript:void(0);" class="addPlaceholder">{FASTCGIPASS}</a>
	</div>
</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="wizard/template_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="wizard/template_list.php">{tmpl_var name='btn_cancel_txt'}</button>
	</div>
</div>

<script language="JavaScript" type="text/javascript">
    var serverId = jQuery('#server_id').val();
    adjustForm(true);
    reloadFastcgiPHPVersions(true);
	
	jQuery('#server_id').change(function(){
        serverId = $(this).val();
        adjustForm();
        reloadWebIP();
        reloadFastcgiPHPVersions();
    });
	
	if(jQuery('#php').val() == 'fast-cgi' || jQuery('#php').val() == 'php-fpm'){
        jQuery('.fastcgi_php_version:hidden').show();
    } else {
        jQuery('.fastcgi_php_version:visible').hide();
    }
    
    jQuery('#php').change(function(){
        reloadFastcgiPHPVersions();
        if(jQuery(this).val() == 'fast-cgi' || jQuery(this).val() == 'php-fpm'){
            jQuery('.fastcgi_php_version:hidden').show();
        } else {
            jQuery('.fastcgi_php_version:visible').hide();
        }
        
        adjustPhp();
    });
		
    var pm = jQuery('#pm').val();
    pmMode(pm);
    jQuery('#pm').change(function(){
        pm = jQuery(this).val();
        pmMode(pm);
    });
		
    function pmMode(pm){
        switch(pm){
            case "static":
                jQuery('.pm_dynamic').add('.pm_ondemand').hide();
                jQuery('.pm_static').show();
                break;
            case "dynamic":
                jQuery('.pm_static').add('.pm_ondemand').hide();
                jQuery('.pm_dynamic').show();
                break;
            case "ondemand":
                jQuery('.pm_static').add('.pm_dynamic').hide();
                jQuery('.pm_ondemand').show();
                break;
        }
    }
		
    function adjustForm(noFormChange){
        jQuery.getJSON('sites/ajax_get_json.php'+ '?' + Math.round(new Date().getTime()), {server_id : serverId, type : "getservertype"}, function(data) {
            if(data.servertype == "nginx"){
                jQuery('.nginx').show();
                jQuery('.apache').hide();
                if(selected != "no" && selected != "php-fpm" && selected != "hhvm") {
                    jQuery('#php option[value="php-fpm"]').attr('selected', 'selected').val('php-fpm');
                }
                jQuery('#php option[value="fast-cgi"]').hide();
                jQuery('#php option[value="cgi"]').hide();
                jQuery('#php option[value="mod"]').hide();
                jQuery('#php option[value="suphp"]').hide();
            } else {
                jQuery('.nginx').hide();
                jQuery('.apache').show();
                jQuery('#php option[value="fast-cgi"]').show();
                jQuery('#php option[value="cgi"]').show();
                jQuery('#php option[value="mod"]').show();
                jQuery('#php option[value="suphp"]').show();
            }
            
            if(noFormChange) {
                ISPConfig.resetFormChanged();
                jQuery('#php').addClass('no-page-form-change').change();
                jQuery('#php').removeClass('no-page-form-change');
            } else {
                jQuery('#php').change();
            }
        });
        
        adjustPhp();
    }
    
    function adjustPhp()
    {
	    var phptype = jQuery('#php').val();
        if(phptype == "php-fpm"){
            jQuery('.phpfpm').show();
        } else {
            jQuery('.phpfpm').hide();
        }
		if(phptype == "no"){
            jQuery('.php').hide();
        } else {
            jQuery('.php').show();
        }
    }
    
    function reloadWebIP() {
        ISPConfig.loadOptionInto('ip_address','sites/ajax_get_ip.php?ip_type=IPv4&server_id='+serverId);
        ISPConfig.loadOptionInto('ipv6_address','sites/ajax_get_ip.php?ip_type=IPv6&server_id='+serverId);
    }
    
    function reloadFastcgiPHPVersions(noFormChange) {
        jQuery.getJSON('sites/ajax_get_json.php'+ '?' + Math.round(new Date().getTime()), {server_id : serverId, php_type : jQuery('#php').val(), type : "getphpfastcgi"}, function(data) {
            var options = '<option value="">Default</option>';
            var phpfastcgiselected = '';
            $.each(data, function(key, val) {
                if($('#fastcgi_php_version').attr('data-selected') == key){
Kristián Feldsam's avatar
Kristián Feldsam committed
                    phpfastcgiselected = ' selected="selected"';
                } else {
                    phpfastcgiselected = '';
                }
                options += '<option value="'+key+'"'+phpfastcgiselected+'>'+val+'</option>';
            });
            $('#fastcgi_php_version').html(options).change();
            if(noFormChange) ISPConfig.resetFormChanged();
        });
    }
    
    $(".addPlaceholder").click(function(){
	    var t = $(this);
	    var el =  t.parent().prev().find("textarea");
	    var new_val = el.val() + t.text();
	    el.val(new_val).focus();
    });
</script>