web_aliasdomain_edit.htm 4.44 KB
Newer Older
latham's avatar
latham committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
<h2><tmpl_var name="list_head_txt"></h2>
<p><tmpl_var name="list_desc_txt"></p>

<div class="panel panel_web_domain">

	<div class="pnl_formsarea">
		<fieldset class="inlineLabels">
			<div class="ctrlHolder">
				<label for="domain">{tmpl_var name='domain_txt'}</label>
				<tmpl_if name="domain_option">
					<select name="domain" id="domain" class="selectInput">
					{tmpl_var name='domain_option'}
					</select>
					<tmpl_else>
						<input name="domain" id="domain" value="{tmpl_var name='domain'}" size="30" maxlength="255" type="text" class="textInput" />
				</tmpl_if>
			</div>
			<div class="ctrlHolder">
				<label for="parent_domain_id">{tmpl_var name='parent_domain_id_txt'}</label>
				<select name="parent_domain_id" id="parent_domain_id" class="selectInput">
					{tmpl_var name='parent_domain_id'}
				</select>
			</div>
			<div class="ctrlHolder">
				<label for="redirect_type">{tmpl_var name='redirect_type_txt'}</label>
				<select name="redirect_type" id="redirect_type" class="selectInput formLengthHalf">
					{tmpl_var name='redirect_type'}
				</select>
			</div>
			<div class="ctrlHolder">
				<label for="redirect_path">{tmpl_var name='redirect_path_txt'}</label>
				<input name="redirect_path" id="redirect_path" value="{tmpl_var name='redirect_path'}" size="30" maxlength="255" type="text" class="textInput" />
			</div>
			<div class="ctrlHolder">
				<label for="subdomain">{tmpl_var name='subdomain_txt'}</label>
				<select name="subdomain" id="subdomain" class="selectInput formLengthHalf">
					{tmpl_var name='subdomain'}
				</select>
			</div>
			<div class="ctrlHolder">
				<p class="label">{tmpl_var name='active_txt'}</p>
				<div class="multiField">
						{tmpl_var name='active'}
				</div>
			</div>
		</fieldset>

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

		<div class="buttonHolder buttons">
			<button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','sites/web_aliasdomain_edit.php');"><span>{tmpl_var name='btn_save_txt'}</span></button>
			<button class="negative iconstxt icoNegative" type="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="loadContent('sites/web_aliasdomain_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button>
		</div>
	</div>

</div>
57
<script language="JavaScript" type="text/javascript">
58
		var webId = jQuery('#parent_domain_id').val();
59 60
		var serverId;
		getServerId(webId);
61 62 63 64 65
		
		jQuery('#parent_domain_id').change(function(){
			webId = $(this).val();
			getServerId(webId);
		});
66 67 68 69
		
		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;
70
				adjustForm(serverId);
71 72 73 74 75 76 77 78 79 80
			});
		}
		
		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"]').hide();
					jQuery('#redirect_type option[value="L"]').hide();
					jQuery('#redirect_type option[value="R,L"]').hide();
81
					jQuery('#redirect_type option[value="R=301,L"]').hide();
82 83 84 85 86 87
					
					jQuery('#redirect_type option[value="last"]').show();
					jQuery('#redirect_type option[value="break"]').show();
					jQuery('#redirect_type option[value="redirect"]').show();
					jQuery('#redirect_type option[value="permanent"]').show();
					
88 89 90 91 92 93
					if(selected != "no" && selected != "" && selected != "last"  && selected != "break"  && selected != "redirect"  && selected != "permanent") jQuery('#redirect_type option[value="no"]').attr('selected', 'selected');
				} else {
					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();
94 95 96 97
					
					jQuery('#redirect_type option[value="R"]').show();
					jQuery('#redirect_type option[value="L"]').show();
					jQuery('#redirect_type option[value="R,L"]').show();
98
					jQuery('#redirect_type option[value="R=301,L"]').show();
99
					
100
					if(selected != "no" && selected != "" && selected != "R"  && selected != "L"  && selected != "R,L" && selected != "R=301,L") jQuery('#redirect_type option[value="no"]').attr('selected', 'selected');
101 102 103 104 105
				}
			});
		}
			
</script>