<!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>
</head>

<body>
	<div class="wrapper">
    	<?# header ?>
    	<div class="wrap">
        	<?# sidePage ?>
            <div class="contentMain">
            	<h3>相本列表</h3>
                <div class="article">
                	<form id="form1" name="form1" action="bookList.php" method="get">
                    	<fieldset style="width: 960px;">
                        	<div class="abbNew" style="width: 125px; float: left; margin: 10px;"><a class="add" href="bookEdit.php?pUrl=<?# encodeUrl ?>">新增相本</a></div>
                            <p style="width: 800px; margin: 15px auto;">相本分類：
                                <select id="cid" name="cid">
                                    <option value="0" style="#000">全部分類</option>
                                        <php:repeater id="listC">
                                            <template>
                                                <option value="<?# CategoryID ?>"<?# opStyle ?>><?# CategoryName ?></option>
                                            </template>
                                        </php:repeater>
                                </select>
                                <input type="button" id="btnOK" name="btnOK" value="搜尋" />
                            </p>
                            <div class="titleTyp" style=" width: 960px;">
                                <div class="visible">序號</div>
                                <div class="visible">啟用</div>
                                <div class="visible">首頁</div>
                                <div class="loginName" style="width: 280px;">相本名稱</div>
                                <div class="userName">相本分類</div>
                                <div class="visible">排序</div>
                                <div class="operating">操作</div>
                            </div>
                            <php:repeater id="list">
                                <template>
                                    <div class="listTyp" style=" width: 960px;">
                                        <div class="visible"><?# BookID ?></div>
                                        <div class="visible"><?# Visible ?></div>
                                        <div class="visible"><?# IsIndex ?></div>
                                        <div class="loginName" style="width: 280px;"><a href="/<?# htLink ?>-<?# BookID ?>.html" target="_blank"><img src="<?# Image ?>" style="max-width:50px; max-height:50px; border:0;" /></a><?# BookName ?></div>
                                        <div class="userName"><?# CategoryName ?></div>
                                        <div class="visible"><?# OrderNO ?></div>
                                        <div class="operating">
                                            <div class="modification"><a href="bookEdit.php?id=<?# BookID ?>&pUrl=<?# encodedUrl ?>"><span></span>修改</a></div>
                                            <div class="delete"><a data-action="delItem" data-id="<?# BookID ?>" href="javascript:void(0);"><span></span>刪除</a></div>
                                        </div>
                                    </div>
                                </template>
                            </php:repeater>
                            <p>
                            	<?# pagtxt ?>&nbsp; &nbsp;
                            	每頁&nbsp;<input type="text" id="pz" name="pz" value="<?# pz ?>" style="width:20px;" />&nbsp;筆資料，跳到第&nbsp;<input type="text" id="p" name="p" value="<?# p ?>" style="width:20px;" />&nbsp;頁&nbsp;<input type="button" id="btnGO" name="btnGO" value="GO" />
                            </p>
                        </fieldset>
                    </form>
                </div>
            </div>
        </div>
        <?# footer ?>
    </div>
<script>
<!--
	$(function(){
		$('#cid').val('<?# cid ?>');
		$('#btnOK').click(function(){
			$('#p').val('1');
			$('#form1').submit();
		});
		$('a[data-action="delItem"]').click(function(){
			if(!confirm('刪除相本資料將連同相本中的相片一同刪除!是否確定要刪除此相本資料?')){
				return false;
			}else{
				if(!confirm('刪除資料後將無法恢復!請仔細確定要刪除此相本資料?')){
					return false;
				}else{
					$.ajax({
						url: 'ajax/book.php',
						async: false,
						type: 'POST',
						data: {'do':'del','id':$(this).data('id')},
						dataType: "text",
						context: $(this).parent('div').parent('div').parent('div'),
						success: function(msg){
							if(msg == '1'){
								$(this).remove();
							}else{
								alert('刪除失敗!\r\n'+msg);
							}
						},
						error: function(){
							alert('系統異常!!');
						}
					});
				}
			}
		});
		$('a[data-action="goPage"]').click(function(){
			$('#p').val($(this).data('id'));
			$('#form1').submit();
		});
		$('#btnGO').click(function(){
			$('#form1').submit();
		});
	});
//-->
</script>
</body>
</html>