<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>管理後臺</title>
<meta name="keywords" content="管理後臺" />
<meta name="description" content="管理後臺" />
<script src="/jquery/jquery-1.8.2.min.js"></script>
<script src="ckeditor/ckeditor.js" type="text/javascript"></script>
<script type="text/javascript" src="ckfinder/ckfinder.js"></script>
</head>
<body>
	<div class="wrapper">
		<?# header ?>
		<div class="wrap">
			<?# sidePage ?>
			<div class="contentMain">
		    	<h3>網站資訊</h3>
				<div class="article">
					<form id="form1" name="form1" action="webbaseSet.php" method="post">
						<fieldset>
							<div class="titleTyp"><p>網站資訊</p></div>
							<div style=" background: rgba(75, 141, 248, 0.07); padding: 10px 0;">
								<p>
									<label>網站名稱</label>
									<input type="text" id="webName" name="webName" value="<?# webName ?>" maxlength="50" />
								</p>
								<p>
									<label>客服信箱 : </label>
									<input type="text" id="webEmail" name="webEmail" value="<?# webEmail ?>" maxlength="128" style="width: 300px;" />
									<input type="checkbox" id="webEmailisShow" name="webEmailisShow" value="1" />內頁顯示
								</p>
								<p>
									<label>聯絡地址 : </label>
									<input type="text" id="webAddress" name="webAddress" value="<?# webAddress ?>" maxlength="256" style="width: 300px;" />
									<input type="checkbox" id="webAddressisShow" name="webAddressisShow" value="1" />內頁顯示
								</p>
								<p>
									<label>聯絡電話 : </label>
									<input type="text" id="webPhone" name="webPhone" value="<?# webPhone ?>" maxlength="20" style="width: 300px;" />
									<input type="checkbox" id="webPhoneisShow" name="webPhoneisShow" value="1" />內頁顯示
								</p>
								<p>
									<label>手機 : </label>
									<input type="text" id="webMobile" name="webMobile" value="<?# webMobile ?>" maxlength="20" style="width: 300px;" /> <strong style="color:#F00; font-size:12px;">手機版可以直接撥打專線</strong>
								</p>
								<p>
									<label>聯絡傳真 : </label>
									<input type="text" id="webFax" name="webFax" value="<?# webFax ?>" maxlength="20" style="width: 300px;" />
									<input type="checkbox" id="webFaxisShow" name="webFaxisShow" value="1" />內頁顯示
								</p>
								<div class="writList">
                                    <label style="float: left;">彈跳視窗內容</label>
                                    <div class="ckeList"><textarea class="ckeditor" id="webPopUpBox" name="webPopUpBox"><?# webPopUpBox ?></textarea></div>
                                </div>
							</div>
							<div class="titleTyp" style="background: #66CC96; margin: 5px 0 0;"><p>網站設定</p></div>
							<div style="background: rgba(102, 204, 150, 0.11); padding: 10px 0;">
								<div class="writList">
									<label>網站類型</label>
									<div class="ckeList" style="line-height: 250%;">
										<input type="radio" name="webType" value="10" />形象網站<br />
										<input type="radio" name="webType" value="20" />簡易型購物網站<br />
										運費：<input type="text" id="transPrice" name="transPrice" value="<?# transPrice ?>" style="margin: 10px 0;" /><br />
										免運金額：<input type="text" id="transFreePrice" name="transFreePrice" value="<?# transFreePrice ?>" />
									</div>
								</div>
                                <p>
                                    <label>台灣IP</label>
                                    <input type="radio" name="TIPClose" value="1" />封鎖&nbsp;&nbsp;&nbsp;&nbsp;
									<input type="radio" name="TIPClose" value="0" />不封鎖
                                </p>
								<p>
									<label>系統信箱一 : </label>
									<input type="text" id="systemEmail1" name="systemEmail1" value="<?# systemEmail1 ?>" maxlength="128" style="width: 300px;" />
								</p>
								<p>
									<label>系統信箱二 : </label>
									<input type="text" id="systemEmail2" name="systemEmail2" value="<?# systemEmail2 ?>" maxlength="128" style="width: 300px;" />
								</p>
								<p>
									<label>系統信箱三 : </label>
									<input type="text" id="systemEmail3" name="systemEmail3" value="<?# systemEmail3 ?>" maxlength="128" style="width: 300px;" />
								</p>
								<p>
									<label>系統信箱四 : </label>
									<input type="text" id="systemEmail4" name="systemEmail4" value="<?# systemEmail4 ?>" maxlength="128" style="width: 300px;" />
								</p>
								<p>
									<label>系統信箱五 : </label>
									<input type="text" id="systemEmail5" name="systemEmail5" value="<?# systemEmail5 ?>" maxlength="128" style="width: 300px;" />
								</p>
								<p>
									<label>Line分享開關 : </label>
									<input type="radio" name="LineOpen" value="0" />close&nbsp;&nbsp;&nbsp;&nbsp;
									<input type="radio" name="LineOpen" value="1" />open
								</p>
							</div>
							<div class="titleTyp" style="margin: 5px 0 0;"><p>寄件信箱設定</p></div>
							<div style="background: rgba(75, 141, 248, 0.07); padding: 10px 0;">
								<div class="writList">
									<label>信箱類型</label>
									<select id="sendMailType" name="sendMailType">
										<option value="">不啟用</option>
										<option value="1">預設</option>
										<option value="2">GMail</option>
										<option value="3">Yahoo!</option>
										<option value="4">Outlook</option>
										<option value="0">其他</option>
									</select>
								</div>
								<p>
									<label>信箱 : </label>
									<input type="text" id="sendMailAddress" name="sendMailAddress" value="<?# sendMailAddress ?>" maxlength="128" style="width: 300px;" />
								</p>
								<p>
									<label>密碼 : </label>
									<input type="text" id="sendMailPassword" name="sendMailPassword" value="<?# sendMailPassword ?>" maxlength="50" style="width: 300px;" />
								</p>
								<p>
									<label>主機位置 : </label>
									<input type="text" id="sendMailHost" name="sendMailHost" value="<?# sendMailHost ?>" maxlength="128" style="width: 300px;" />
								</p>
								<p>
									<label>通訊埠 : </label>
									<input type="text" id="sendMailPort" name="sendMailPort" value="<?# sendMailPort ?>" maxlength="10" style="width: 300px;" />
								</p>
								<p>
									<label>加密方式 : </label>
									<select id="sendMailSMTPSecure" name="sendMailSMTPSecure">
										<option value="">不加密</option>
										<option value="ssl">SSL</option>
										<option value="tls">TLS</option>
									</select>
								</p>
								<p>
									<label>安全驗證 : </label>
									<input type="checkbox" id="sendMailSMTPAuth" name="sendMailSMTPAuth" value="1" />開啟
								</p>
								<p>
									<label>測試 : </label>
									<input type="button" id="btnT" name="btnT" value="測 試" />
								</p>
							</div>
							<p>
								<input type="button" id="btnOK" name="btnOK" value="確 定" />
							</p>
						</fieldset>
					</form>
				</div>
			</div>
		</div>
		<?# footer ?>
	</div>
<script>
<!--
	$(function(){
		$('input:checkbox[name="webEmailisShow"][value="<?# webEmailisShow ?>"]').attr('checked',true);
		$('input:checkbox[name="webAddressisShow"][value="<?# webAddressisShow ?>"]').attr('checked',true);
		$('input:checkbox[name="webPhoneisShow"][value="<?# webPhoneisShow ?>"]').attr('checked',true);
		$('input:checkbox[name="webFaxisShow"][value="<?# webFaxisShow ?>"]').attr('checked',true);
		$('input:radio[name="webType"][value="<?# webType ?>"]').attr('checked',true);
		$('input:radio[name="TIPClose"][value="<?# TIPClose ?>"]').attr('checked',true);
        $('input:radio[name="LineOpen"][value="<?# LineOpen ?>"]').attr('checked',true);
		$('#sendMailType').val('<?# sendMailType ?>');
		if('<?# sendMailType ?>' == '1'){
			$('#sendMailAddress').attr('disabled', true);
			$('#sendMailPassword').attr('disabled', true);
			$('#sendMailHost').attr('disabled', true);
			$('#sendMailPort').attr('disabled', true);
			$('#sendMailSMTPSecure').attr('disabled', true);
			$('#sendMailSMTPAuth').attr('disabled', true);
			$('#btnT').attr('disabled', true);
		}
		$('#sendMailSMTPSecure').val('<?# sendMailSMTPSecure ?>');
		if('<?# sendMailSMTPAuth ?>' == '1'){
			$('#sendMailSMTPAuth').attr('checked', true);
		}
		
		$('#sendMailType').change(function(){
			$('#sendMailAddress').attr('disabled', false);
			$('#sendMailPassword').attr('disabled', false);
			$('#sendMailHost').attr('disabled', false);
			$('#sendMailPort').attr('disabled', false);
			$('#sendMailSMTPSecure').attr('disabled', false);
			$('#sendMailSMTPAuth').attr('disabled', false);
			$('#btnT').attr('disabled', false);
			if($(this).val() == '1'){
				$('#sendMailAddress').val('');
				$('#sendMailPassword').val('');
				$('#sendMailHost').val('');
				$('#sendMailPort').val('');
				$('#sendMailSMTPSecure').val('');
				$('#sendMailSMTPAuth').attr('checked', false);
				$('#sendMailAddress').attr('disabled', true);
				$('#sendMailPassword').attr('disabled', true);
				$('#sendMailHost').attr('disabled', true);
				$('#sendMailPort').attr('disabled', true);
				$('#sendMailSMTPSecure').attr('disabled', true);
				$('#sendMailSMTPAuth').attr('disabled', true);
				$('#btnT').attr('disabled', true);
			}else if($(this).val() == '2'){
				$('#sendMailHost').val('smtp.gmail.com');
				$('#sendMailPort').val('465');
				$('#sendMailSMTPSecure').val('ssl');
				$('#sendMailSMTPAuth').attr('checked', true);
			}else if($(this).val() == '3'){
				$('#sendMailHost').val('smtp.mail.yahoo.com');
				$('#sendMailPort').val('25');
				$('#sendMailSMTPSecure').val('tls');
				$('#sendMailSMTPAuth').attr('checked', true);
			}else if($(this).val() == '4'){
				$('#sendMailHost').val('smtp-mail.outlook.com');
				$('#sendMailPort').val('25');
				$('#sendMailSMTPSecure').val('tls');
				$('#sendMailSMTPAuth').attr('checked', true);
			}
		});
		
		$('#btnT').click(function(){
			$.ajax({
				'url': 'ajax/smtp.php',
				'async': false,
				'type': 'POST',
				'data': {'ma': $('#sendMailAddress').val(), 'pa': $('#sendMailPassword').val(), 'ho': $('#sendMailHost').val(), 'po': $('#sendMailPort').val(), 'se': $('#sendMailSMTPSecure').val(), 'sm': $('#sendMailSMTPAuth').is(':checked')},
				'dataType': 'text',
				'success': function(msg){
					alert(msg);
				},
				'error': function(){
					alert('系統異常!請重新整理頁面再試一次!');
				}
			});
		});
		
		$('#btnOK').click(function(){
			if($('input:radio[name="webType"]:checked').size() == 0){
				alert('請選擇網站類型!');
				return false;
			}
			if($('input:radio[name="webType"][value="20"]').is(':checked')){
				if($('#transPrice').val() == ''){
					alert('請輸入運費!');
					$('#transPrice').focus();
					return false;
				}
			}
			$('#form1').submit();
		});
	});
//-->
</script>
</body>
</html>