<!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>
<!-- 瀏覽用燈箱片效果 -->
<link rel="stylesheet" href="/jquery/fancybox/source/jquery.fancybox.css?v=2.1.5" type="text/css" media="screen" />
<script type="text/javascript" src="/jquery/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
</head>
<body>
	<div class="wrapper">
    	<?# header ?>
    	<div class="wrap">
        	<?# sidePage ?>
            <div class="contentMain">
            	<h3><?# editTitle ?></h3>
                <div class="article" style="width: 100%;">
                    <form id="form1" name="form1" action="articleEdit.php" method="post">
                        <fieldset style="width: 100%;">
                        	<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="Title" name="Title" value="<?# Title ?>" maxlength="128" style="width: 300px;" />
                                </p>
                                <p>
                                    <label>文章分類</label>
                                    <php:repeater id="listC">
                                        <template>
                                            <input type="radio" name="CategoryID" value="<?# CategoryID ?>"<?# checked ?> /><?# CategoryName ?>
                                        </template>
                                    </php:repeater>
                                </p>
                                <p>
                                    <label>文章路徑</label>
                                    <input type="text" id="PathName" name="PathName" value="<?# PathName ?>" maxlength="128" style="width: 300px;" />
                                </p>
                                <div class="writList">
                                	<label style="float: left;">文章圖片</label>
                                    <a id="aImg" class="fancybox" style="float: left; margin: 0 10px;"><img id="imgImg" style="width:50px; height:50px; border:0; display:none;" /></a>
                                    <input type="text" id="Image" name="Image" value="<?# Image ?>" />
                                    <input type="button" id="btnImg" name="btnImg" value="瀏覽" />
                                </div>
                                <div class="writList">
                                    <label style="float: left;">文章內容</label>
                                    <div class="ckeList"><textarea class="ckeditor" id="Description" name="Description"><?# Description ?></textarea></div>
                                </div>
                                <p>
                                    <label>圖片顯示</label>
                                    <input type="radio" name="Structure" value="1" />圖片顯示
                                    <input type="radio" name="Structure" value="2" />圖片不顯示
                                </p>
                                <p>
                                    <label>啟用</label>
                                    <input type="radio" name="Visible" value="1" />啟用
                                    <input type="radio" name="Visible" value="0" />不啟用
                                </p>
                                <p>
                                    <label>排序</label>
                                    <input type="text" id="OrderNO" name="OrderNO" value="<?# OrderNO ?>" onkeypress="if (event.keyCode < 48 || event.keyCode >57) event.returnValue = false;" style="width: 300px;" />
                                </p>
                            </div>
                            <div class="titleTyp" style="background: #66CC96; margin: 5px 0 0;"><p>SEO設定</p></div>
                            <div style="background: rgba(102, 204, 150, 0.11); padding: 10px 0;">
                                <p>
                                    <label>頁面標題</label>
                                    <input type="text" id="WebTitle" name="WebTitle" value="<?# WebTitle ?>" maxlength="128" style="width: 300px;" />
                                </p>
                                <p>
                                    <label>頁面關鍵字</label>
                                    <input type="text" id="WebKeyword" name="WebKeyword" value="<?# WebKeyword ?>" maxlength="256" style="width: 300px;" />
                                </p>
                                <p>
                                    <label>頁面描述</label>
                                    <textarea style="width:540px; height:100px;" id="WebDescription" name="WebDescription"><?# WebDescription ?></textarea>
                                </p>
                            </div>
                            <p>
                                <input type="button" id="btnOK" name="btnOK" value="確 定" />
								<input type="button" id="btnCancel" value="返 回" />
                            </p>
                            <input type="hidden" id="id" name="id" value="<?# id ?>" />
                        </fieldset>
                    </form>
                </div>
            </div>
        </div>
        <?# footer ?>
    </div>
<script>
<!--
	function SetFileField(fileUrl,data){
		$('#'+data["selectActionData"]).val(fileUrl);
		$('#'+data["selectActionData"]).change();
	}
	$(function(){
		$(".fancybox").fancybox();

		$('input:radio[name="CategoryID"][value="<?# CategoryID ?>"]').attr('checked',true);
		$('input:radio[name="Structure"][value="<?# Structure ?>"]').attr('checked',true);
		$('input:radio[name="Visible"][value="<?# Visible ?>"]').attr('checked',true);

		$('#Image').change(function(){
			if($(this).val() == ''){
				$('#imgImg').attr('src','');
				$('#imgImg').css('display','none');
				$('#aImg').attr('href','');
			}else{
				$('#imgImg').attr('src',$(this).val());
				$('#imgImg').css('display','block');
				$('#aImg').attr('href',$(this).val());
			}
		});
		$('#Image').change();

		$('#btnImg').click(function(){
			var finder = new CKFinder();
			finder.basePath = 'ckfinder/';
			finder.resourceType = 'Images';
			finder.selectActionFunction = SetFileField;
			finder.selectActionData = 'Image';
			finder.popup();
		});
		$('#btnOK').click(function(){
			if($('#Title').val() == ''){
				alert('文章名稱不可空白!');
				$('#Title').focus();
				return false;
			}
			if($('input:radio[name="CategoryID"]:checked').size() == 0){
				alert('請選擇文章分類!');
				return false;
			}
			if($('#PathName').val() == ''){
				alert('文章路徑不可空白!');
				$('#PathName').focus();
				return false;
			}
			if($('input:radio[name="Structure"]:checked').size() == 0){
				alert('請選擇圖片位置!');
				return false;
			}
			if($('input:radio[name="Visible"]:checked').size() == 0){
				alert('請選擇是否啟用此文章!');
				return false;
			}
			$('#form1').submit();
		});
		$('#btnCancel').click(function(){
			location.href = 'articleList.php';
		});
	});
//-->
</script>
</body>
</html>