<!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="管理後臺" />
<link href="/css/font-awesome.css" rel="stylesheet">
<link href="/css/32/fontawesome-stars.css" rel="stylesheet">
<script src="/jquery/jquery-1.8.2.min.js"></script>
<script src="/jquery/jquery.barrating.js"></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>
<!-- 日曆效果 -->
<script type="text/javascript" src="/js/My97DatePicker/WdatePicker.js"></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="commentAdd.php" method="post">
                        <fieldset style="width: 100%; padding:0;">
                        	<div class="titleTyp"><p>評論資訊</p></div>
                            <div style=" background: rgba(75, 141, 248, 0.07); padding: 10px 0;">
                                <p>
                                    <label>會員</label>
                                    <select id="CustomerID" name="CustomerID">
                                    	<option value="0">請選擇</option>
                                        <php:repeater id="listC">
                                        <template>
                                        <option value="<?# CustomerID ?>"><?# CustomerName ?><?# Level ?></option>
                                        </template>
                                        </php:repeater>
                                    </select>
                                </p>
                                <p>
                                    <label>產品</label>
                                    <select id="ProductID" name="ProductID">
                                    	<option value="0">請選擇</option>
                                        <php:repeater id="listP">
                                        <template>
                                        <option value="<?# ProductID ?>"><?# ProductName ?> - <?# AverageStar ?>分</option>
                                        </template>
                                        </php:repeater>
                                    </select>
                                </p>
                                <div class="writList">
                                	<label style="float: left;">評分</label>
                                    <div class="ckeList stars stars-example-fontawesome">
                                        <select id="Stars" name="Stars">
                                            <option value="1">1</option>
                                            <option value="2">2</option>
                                            <option value="3">3</option>
                                            <option value="4">4</option>
                                            <option value="5">5</option>
                                        </select>
                                    </div>
                                </div>
                                <p>
                                    <label style="float: left;">圖片</label>
                                    <a id="aIImg" class="fancybox" href="" style="float: left; margin: 0 10px;"><img id="imgIImg" src="" style="width:50px; height:50px; border:0; display:none;" /></a>
                                    <input type="text" id="Image" name="Image" value="<?# Image ?>" />
                                    <input type="button" id="btnIImg" name="btnIImg" value="瀏覽" />
                                </p>
                                <p>
                                    <label>評論</label>
                                    <textarea style="width:540px; height:100px;" id="Content" name="Content"><?# Content ?></textarea>
                                </p>
                                <p>
                                    <label>上線時間</label>
                                    <input type="text" id="CreatedTime" name="CreatedTime" value="" onfocus="WdatePicker()" style="width: 300px;" />
                                </p>
                            </div>
                            <p>
                                <input type="button" id="btnOK" name="btnOK" value="確 定" />
                                <input type="button" id="btnCancel" value="返 回" />
                            </p>
                            <input type="hidden" id="pUrl" name="pUrl" value="<?# pUrl ?>" />
                        </fieldset>
                    </form>
                </div>
            </div>
        </div>
        <?# footer ?>
    </div>

<script>
<!--
	function SetFileField(fileUrl,data){
		$('#'+data["selectActionData"]).val(fileUrl);
		$('#'+data["selectActionData"]).change();
	}
	$(function(){
		$(".fancybox").fancybox();
		$('#ProductID').val('<?# pid ?>');
		$('#Stars').barrating({
			theme: 'fontawesome-stars',
			showSelectedRating: false
		});
		$('#Image').change(function(){
			if($(this).val() == ''){
				$('#imgIImg').attr('src','');
				$('#imgIImg').css('display','none');
				$('#aIImg').attr('href','');
			}else{
				$('#imgIImg').attr('src',$(this).val());
				$('#imgIImg').css('display','block');
				$('#aIImg').attr('href',$(this).val());
			}
		})
		$('#Image').change();

		$('#btnIImg').click(function(){
			var finder = new CKFinder();
			finder.basePath = 'ckfinder/';
			finder.resourceType = 'Images';
			finder.selectActionFunction = SetFileField;
			finder.selectActionData = 'Image';
			finder.popup();
		});
		
		$('#btnOK').click(function(){
			if($('#CustomerID').val() == '' || $('#CustomerID').val() == '0'){
				alert('請選擇會員!');
				$('#CustomerID').focus();
				return false;
			}
			if($('#ProductID').val() == '' || $('#ProductID').val() == '0'){
				alert('請選擇產品!');
				$('#ProductID').focus();
				return false;
			}
			if($('#Stars').val() == '' || $('#Stars').val() == '0'){
				alert('請選擇星級!');
				$('#Stars').focus();
				return false;
			}
			if($('#Content').val() == ''){
				alert('請輸入評論內容!');
				$('#Content').focus();
				return false;
			}
			$('#form1').submit();
		});
		$('#btnCancel').click(function(){
			if($('#pUrl').val() == '')
				location.href = 'productList.php';
			else
				location.href = $('#pUrl').val();
		});
	});
//-->
</script>
</body>
</html>