<!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 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>小廣告設置</h3>
                <div class="article">
                    <form id="form1" name="form1" action="small_pictureSet.php" method="post">
                        <fieldset>
                        	<div class="titleTyp" style="width: 1190px;"><p>小廣告設置</p></div>
                            <div style=" background: rgba(75, 141, 248, 0.07); padding: 10px 0; width: 1210px;">
                            	<p>
                                    <label>內頁顯示</label>
                                    <input type="checkbox" name="smallPictureShow[]" value="30" />首頁
                                    <input type="checkbox" name="smallPictureShow[]" value="40" />文章
                                    <input type="checkbox" name="smallPictureShow[]" value="50" />產品
                                    <input type="checkbox" name="smallPictureShow[]" value="60" />最新消息
                                    <input type="checkbox" name="smallPictureShow[]" value="70" />問與答
                                    <input type="checkbox" name="smallPictureShow[]" value="80" />相本
                                    <input type="checkbox" name="smallPictureShow[]" value="90" />聯絡表單
                                    <input type="checkbox" name="smallPictureShow[]" value="100" />訂單
                                </p>
                            </div>
                            <div style="overflow: hidden;">
                            <php:repeater id="listP">
                                <template>
                                    <div class="list" style="height: 225px;">
                                        <div class="titleTyp" style="background: #66CC96;"><p>小廣告<?# NO ?></p></div>
                                        <div style=" background: rgba(102, 204, 150, 0.11); padding: 10px 0;">
                                            <div class="writList">
                                                <label style="float: left;">圖片</label>
                                                <a data-id="<?# NO ?>" class="fancybox"><img data-id="<?# NO ?>" style="width:50px; height:50px; border:0; display:none;" /></a>
                                                <input type="text" data-action="Image" data-id="<?# NO ?>" id="Image<?# NO ?>" name="Image<?# NO ?>" value="<?# Image ?>" />
                                                <input type="button" id="btnImg" data-action="btnImg" data-id="<?# NO ?>" name="btnImg<?# NO ?>" value="瀏覽" />
                                            </div>
                                            <p>
                                                <label>標題</label>
                                                <input type="text" id="Title<?# NO ?>" name="Title<?# NO ?>" value="<?# Title ?>" style="width: 300px;" />
                                            </p>
                                            <p>
                                                <label>超連結</label>
                                                <input type="text" id="Link<?# NO ?>" name="Link<?# NO ?>" value="<?# Link ?>" style="width: 300px;" />
                                            </p>
                                        </div>
                                    </div>
                                </template>
                            </php:repeater>
                            </div>
                            <p>
	                            <input type="button" id="btnOK" name="btnOK" value="確 定" />
							</p>
                        </fieldset>
                    </form>
                </div>
            </div>
        </div>
        <?# footer ?>
    </div>
<script>
<!--
	function SetFileField(fileUrl,data){
		$('#'+data["selectActionData"]).val(fileUrl);
		$('#'+data["selectActionData"]).change();
	}
	$(function(){
		$(".fancybox").fancybox();
		
		<php:repeater id="listSP">
			<template>
				$('input:checkbox[name="smallPictureShow[]"][value="<?# Value ?>"]').attr('checked',true);
			</template>
		</php:repeater>

		$('input:text[data-action="Image"]').change(function(){
			if($(this).val() == ''){
				$('img[data-id="'+$(this).data("id")+'"]').attr('src','');
				$('img[data-id="'+$(this).data("id")+'"]').css('display','none');
				$('a[data-id="'+$(this).data("id")+'"]').attr('href','');
			}else{
				$('img[data-id="'+$(this).data("id")+'"]').attr('src',$(this).val());
				$('img[data-id="'+$(this).data("id")+'"]').css('display','block');
				$('a[data-id="'+$(this).data("id")+'"]').attr('href',$(this).val());
			}
		});
		for(var i=1;i<5;i++){
			$('#Image'+i).change();
		}

		$('input:button[data-action="btnImg"]').click(function(){
			var finder = new CKFinder();
			finder.basePath = 'ckfinder/';
			finder.resourceType = 'Images';
			finder.selectActionFunction = SetFileField;
			finder.selectActionData = 'Image'+$(this).data("id");
			finder.popup();
		});

		$('#btnOK').click(function(){
			$('#form1').submit();
		});
	});
//-->
</script>
</body>
</html>