<!--<?php
if (!defined('AJAX')){
include_once PrintEot('left');
}print<<<EOT
-->
<style type="text/css">
.cate_search{}
.cate_search span{float:left;height:30px;line-height:30px;margin-right:10px;}
.cate_search span input{ vertical-align:middle;margin:0 3px;}
.cate_search span select{margin:0 3px;}
</style>
<!--
EOT;
if (empty($action)) {print <<<EOT
-->
<div class="nav3 mb10">
  <ul class="cc">
    <li class="current"><a href="$basename">團購</a></li>
    <li><a href="$basename&action=postcate">內容管理</a></li>
    <li><a href="$basename&action=rightset">權限管理</a></li>
  </ul>
</div>
<div class="admin_info mb10">
  <h3 class="h1">提示信息</h3>
  <div class="legend">
    <ol>
      <li>本功能必須與版塊綁定使用，否則會員將不能看到團購信息。請到 <a href="javascript:;" onclick="parent.PW.Dialog({id:'setforum',url:'$admin_file?adminjob=setforum',name:'管理版塊'});">管理版塊</a> 中進行關聯綁定</li>
      <li>本功能必須由會員權限支持，否則會員將不能發布團購帖。請到 <a href="javascript:;" onclick="parent.PW.Dialog({id:'level',url:'$admin_file?adminjob=level',name:'會員組權限'});">會員組權限</a> 中設定</
    </ol>
  </div>
</div>
<form action="$basename" method="post">
  <input type="hidden" name="action" value="postcatelist" />
  <h2 class="h1">主題管理</h2>
  <div class="admin_table mb10">
    <table cellspacing="0" cellpadding="0" width="100%">
      <tr class="tr2">
        <td width="24">啟用</td>
        <td style="width:80px;">順序</td>
        <td style="width:80px;">主題名稱</td>
        <td>所屬版塊</td>
        <td style="width:200px">操作</td>
      </tr>
<!--
EOT;
if (empty($postcatedb)) {print <<<EOT
-->
<tr><td class="p10" colspan="5"><div class="admin_tips">啊哦，沒有你要的信息！</div></td></tr>
<!--
EOT;
}else{
foreach($postcatedb as $key => $value){
$ifable = '';
if ($value[ifable]) $ifable = 'checked';
if ($value[pcid] == 2) $disabled = 'disabled';
print <<<EOT
-->
      <tr class="tr1 vt">
        <td class="td2"><input type="checkbox" name="selid[$value[pcid]]" value="$value[ifable]" $ifable $disabled></td>
        <td class="td2"><input type="text" class="input input_wc" name="vieworder[$value[pcid]]" value="$value[vieworder]"></td>
        <td class="td2">$value[name]</td>
        <td class="td2">$value[forum]</td>
        <td class="td2">
			<a href="javascript:;" onclick="sendmsg('$ajax_basename_editpostcate','&pcid=$key',this.id);" id="editpostcate" class="mr20">[編輯主題]</a>
			<a href="$basename&action=editmodel&pcid=$key">[編輯模板]</a>
		</td>
      </tr>
<!--
EOT;
}}print <<<EOT
-->
    </table>
  </div>
  <div class="mb10 tac"> <span class="btn"><span>
    <button type="submit" value="提 交">提 交</button>
    </span></span> </div>
</form>
<!--
EOT;
} elseif ($action == 'postcate') {print <<<EOT
-->
<div class="nav3 mb10">
    <ul class="cc">
      <li><a href="$basename">團購</a></li>
      <li class="current"><a href="$basename&action=postcate">內容管理</a></li>
      <li><a href="$basename&action=rightset">權限管理</a></li>
    </ul>
</div>
<h2 class="h1 mb10">選擇分類模板
  <select name="pcid" onchange="tovalue(this.value)" class="select_wa">
<!--
EOT;
foreach($postcatedb as $val){
$selected = '';
$val[pcid] == $pcid && $selected = 'selected';
print<<<EOT
-->
    <option value="$val[pcid]" $selected>$val[name]</option>
<!--
EOT;
}print <<<EOT
-->
  </select>
</h2>
<script type="text/javascript">
function tovalue(pcid) {
	window.location.href = '$admin_file?adminjob=postcate&action=postcate&pcid='+pcid;
}
</script>
<!--
EOT;
if($pcid){print<<<EOT
-->
<form action="$basename" method="post">
  <input type="hidden" name="action" value="postcate" />
  <input type="hidden" name="step" value="search" />
  <input type="hidden" name="pcid" value="$pcid" />
  <h2 class="h1">搜索內容</h2>
  <div class="cate_search mb10 cc">$searchhtml<b id="asearch" style="display:none;font-weight:normal;">$asearchhtml</b></div>
  <div class="mb10 tac">
    <span class="btn mr5"><span><button type="submit"  value="提 交">提 交</button></span></span>
    <a id="show" href="javascript:;" onclick="showasearch()">高級搜索</a>
</div>
</form>
<script type="text/javascript">
function showasearch(id){
	if (getObj('asearch').style.display == 'none') {
		getObj('asearch').style.display = '';
	} else {
		getObj('asearch').style.display = 'none';
	}
}
</script>
<!--
EOT;
}print<<<EOT
-->
<h2 class="h1">搜索結果</h2>
<form action="$basename" method="post" name="FORM">
  <input type="hidden" name="action" value="delthreads" />
  <input type="hidden" name="alltids" value="$alltids" />
  <input type="hidden" name="pcid" value="$pcid" />
<div class="admin_table mb10">
	<table cellpadding="0" cellspacing="0" width="100%">
    <tr class="tr2">
	  <td width="30"><span onclick="CheckAll(document.FORM)" class="cp">全選</span></td>
      <td>名稱</td>
      <td>關聯模板</td>
      <td>所屬版塊</td>
      <td>發布者</td>
      <td>發布時間</td>
      <td>操作</td>
    </tr>
<!--
EOT;
if (empty($catedb)) {print <<<EOT
-->
<tr><td class="p10" colspan="7"><div class="admin_tips">啊哦，沒有你要的信息！</div></td></tr>
<!--
EOT;
}else{
foreach($catedb as $key => $value){print <<<EOT
-->
    <tr class="tr1 vt">
      <td class="td2"><input type="checkbox" name="selid[]" value="$value[tid]"></td>
      <td class="td2"><a href="read.php?tid=$value[tid]" target="_blank">$value[subject]</a></td>
      <td class="td2">{$postcatedb[$pcid][name]}</td>
      <td class="td2"><a href="thread.php?fid=$value[fid]" target="blank">{$forum[$value[fid]][name]}</a></td>
      <td class="td2"><a href="{$db_userurl}$value[authorid]" target="_blank">$value[author]</a></td>
      <td class="td2">$value[postdate]</td>
      <td class="td2"><a href="$basename&action=delthreads&selid=$value[tid]&pcid=$pcid" onclick="if(!confirm('是否確認刪除該帖子？')){return false;}">[刪除]</a></td>
    </tr>
<!--
EOT;
}}print <<<EOT
-->
  </table>
 </div>
  <div class="cc mb10">$pages</div>
  <div class="mb10 tac">
	<span class="bt2"><span><button type="button" onclick="CheckAll(document.FORM)">全 選</button></span></span>
	<input type="submit" onclick="return hasChecked(document.FORM);" value="刪 除" class="bt3" />
	<input type="submit" name="sendmsg" onclick='CheckAll(this.form)' value="群發消息" class="bt3" />

  	<!--span class="bt"><span><button type="button" name="chkall" onclick='CheckAll(this.form)'>全 選</button></span></span>
    <span class="btn"><span><button type="submit" >刪 除</button></span></span>
    <span class="bt"><span><button type="submit" name="sendmsg" value="1">群發消息</button></span></span-->
</div>
</form>
<script>
function hasChecked(obj) {
	var flag = false;
	for (var i=0; i<obj.elements.length-1; i++){
		var e = obj.elements[i];
		if(e.type=='checkbox' && e.checked == true) flag = true;
	}
	if (flag == false) {
		showDialog('error', '沒有選擇操作對象', 2);
		return false;
	} else {
		return confirm('是否確認刪除帖子？');
	}
}
</script>
<!--
EOT;
}elseif($_POST['sendmsg']){print<<<EOT
-->
<div class="nav3 mb10">
    <ul class="cc">
      <li><a href="$basename">團購</a></li>
      <li><a href="$basename&action=postcate">內容管理</a></li>
      <li><a href="$basename&action=rightset">權限管理</a></li>
      <li class="current"><a href="javascript:;">群發消息</a></li>
    </ul>
</div>
<form name='FORM' action="$basename" method="post">
  <input type="hidden" name="action" value="sendmsg" />
  <input type="hidden" name="step" value="2" />
  <input type="hidden" name="uids" value="$uids" />
  <h2 class="h1">消息群發</h2>
  <div class="admin_table mb10">
	<table cellpadding="0" cellspacing="0" width="100%">
    <tr class="tr1 vt">
      <td class="td1">主題</td>
      <td class="td2"><input type="text" class="input input_wb" name="subject" /></td>
    </tr>
    <tr class="tr1 vt">
      <td class="td1">內容</td>
      <td class="td2">
<!--
EOT;
require_once PrintEot('wysiwyg_editor_common');
print <<<EOT
-->
      </td>
    </tr>
  </table>
  </div>

<script type="text/javascript" src="js/pw_ajax.js"></script>
<script type="text/javascript" src="js/post.js"></script>
<script type="text/javascript" src="js/global.js"></script>

<div id="menu_face" class="menu" style="display:none;"></div>
<div id="menu_generalface" class="menu" style="display:none;"></div>

  <div class="mb10 tac">
        <span class="btn"><span><button type="submit">提 交</button></span></span>
   </div>
</form>
<!--
EOT;
}elseif($action == 'editpostcate'){print<<<EOT
-->
<form name="FORM" method="post" action="$ajax_basename_editpostcate" onsubmit="return false;">
<input type="hidden" name="pcid" value="$pcid">
<input type="hidden" name="step" value="2">
<h2 class="h1" style="cursor:move" onmousedown="read.move(event);">編輯主題</h2>
<div class="admin_table mb10">
	<table cellpadding="0" cellspacing="0" width="100%">
		<tr class="tr1 vt">
			<td class="td2">主題名稱</td>
			<td class="td2"><input name="name" id="cate_name" class="input input_wa" value="$name">
			<span id="cate_name_warn">最多14個字節</span></td>
		</tr>
		<tr class="tr1 vt">
			<td class="td2">是否開啟</td>
			<td class="td2">
				<div class="list_A list_80">
					<ul class="cc">
						<li><input type="radio" name="ifable" value="1" $ifable_Y />開啟</li>
						<li><input type="radio" name="ifable" value="0"  $ifable_N />關閉</li>
					</ul>
				</div>
			</td>
		</tr>
		<tr class="tr1 vt">
			<td class="td2">順序</td>
			<td class="td2"><input name="vieworder" class="input input_wa" value="$vieworder"></td>
		</tr>
	</table>
</div>
<div class="tac mb10">
	<span class="btn2"><span><button type="button" onclick="ajax.submit(this.form,ajax.guide)">提 交</button></span></span>
	<span class="bt2"><span><button type="button" onclick="closep();">取 消</button></span></span>
</div>
</form>
<!--
EOT;
}elseif($action == 'editmodel'){print<<<EOT
-->
<div class="nav3 mb10">
    <ul class="cc">
      <li class="current"><a href="$basename">團購</a></li>
      <li><a href="$basename&action=postcate">內容管理</a></li>
      <li><a href="$basename&action=rightset">權限管理</a></li>
    </ul>
</div>
<div class="admin_info mb10">
	<h3 class="h1">提示信息</h3>
    <div class="legend">
        <ol>
            <li>編輯字段時，可以在名稱中加入{#}（兩個花括號加上一個井號），表示發表和閱讀帖子時，標記前後的文字可以分別顯示在字段的前後</li>
            <li>當顯示順序數字相同且不為0時，發表和閱讀帖子時也會在同一行顯示</li>
            <li>結合以上兩點，可以靈活的編輯字段顯示格式。比如“戶型:*室*廳*衛*陽台”，可以編輯成相同順序的4個字段，字段名稱分別為“戶型:{#}室”、“{#}廳”、“{#}衛”、“{#}陽台” </li>
            <li>如果字段通過前台發帖存在數據，將無法編輯變量</li>
            <li>系統默認字段，將無法關閉和刪除，也無法編輯字段類型；其中報名限制、支付方式將無法編輯選項內容</li>
            <li>上傳（upload）類型必填限制無效</li>
        </ol> 
    </div>
</div>
<h3 class="h1"><span class="fl mr10">修改 <span class="s2">{$postcatedb[$pcid][name]}</span> 字段</span><a href="javascript:;" onclick="sendmsg('$ajax_basename_add','pcid=$pcid',this.id);" id="addfield" class="btn_add fl"><i>添加字段</i></a></h3>

<script type="text/javascript" src="js/global.js"></script>
<script type="text/javascript" src="js/pw_ajax.js"></script>
<!--
EOT;
if(empty($step)){print<<<EOT
-->
<form method="post" action="$basename&" name="FORM">
  <input name="action" type="hidden" value="editmodel">
  <input name="pcid" id="pcid" type="hidden" value="$pcid">
  <input name="step" type="hidden" value="2">
  <div class="admin_table mb10">
	<table cellpadding="0" cellspacing="0" width="100%">
    <tr class="tr2">
		<td width="30"><span onclick="CheckIfable(document.FORM,'ifable')" class="cp">啟用</span></td>
		<td width="25">順序</td>
		<td>名稱</td>
		<td width="50"><span onclick="CheckIfable(document.FORM,'ifsearch')" class="cp">默認查詢</span></td>
		<td width="50"><span onclick="CheckIfable(document.FORM,'ifasearch')" class="cp">高級查詢</span></td>
		<td width="50"><span onclick="CheckIfable(document.FORM,'threadshow')" class="cp">列表顯示</span></td>
		<td width="50"><span onclick="CheckIfable(document.FORM,'ifmust')" class="cp">是否必須</span></td>
		<td width="80">框體顯示長度</td>
		<td width="160">操作</td>
    </tr>
<!--
EOT;
if (empty($fielddb)) {print <<<EOT
-->
<tr><td class="p10" colspan="9"><div class="admin_tips">啊哦，沒有你要的信息！</div></td></tr>
<!--
EOT;
}else{
foreach($fielddb as $k=>$v){print <<<EOT
-->
    <tr id="col_$k" class="tr1 vt">
<!--
EOT;
if($v[ifdel]){print <<<EOT
-->
      <td class="td2">ˇ</td>
<!--
EOT;
}else{print <<<EOT
-->
      <td class="td2"><input type="checkbox" name="ifable[$k]" id="ifable[$k]" value="1" $v[ifable_checked]></td>
<!--
EOT;
}print <<<EOT
-->
      <td class="td2"><input name="vieworder[$k][$v[fieldname]]" id="vieworder[$k]" value="$v[vieworder]" class="input input_wd"></td>
      <td class="td2">$v[name1]
<!--
EOT;
if($v[name2]){print<<<EOT
-->
		/ $v[name2] 
<!--
EOT;
}print<<<EOT
-->
<!--<p class="gray">$v[descrip]</p>-->
      </td>
      <td class="td2"><input type="checkbox" name="ifsearch[$k]" value="1" $v[ifsearch_checked]></td>
      <td class="td2"><input type="checkbox" name="ifasearch[$k]" value="1" $v[ifasearch_checked]></td>
      <td class="td2"><input type="checkbox" name="threadshow[$k]" value="1" $v[threadshow_checked]></td>
      <td class="td2"><input type="checkbox" name="ifmust[$k]" value="1" $v[ifmust_checked]></td>
      <td class="td2">
<!--
EOT;
if(in_array($v['type'],array('number','text','textarea','calendar','email','url','img','upload'))){print<<<EOT
-->
        <input type="text" name="textsize[$k]" value="$v[textsize]" class="input input_wc">
<!--
EOT;
}print<<<EOT
-->
      </td>
      <td class="td2"><a href="javascript:;" class="mr10" onclick="sendmsg('$ajax_basename_edit','fieldid=$k&pcid=$pcid',this.id);" id="editfield_$k">[編輯]</a>
<!--
EOT;
if(!$v['ifdel']){print<<<EOT
-->
        <a href="javascript:;" class="mr10" onclick="delfield($k)">[刪除]</a>
<!--
EOT;
}print<<<EOT
-->
<!--
EOT;
if($v['indexstate'] == 1){print<<<EOT
-->
        <a href="javascript:;" onclick="editIndex($pcid,$k,'del');">[刪除索引]</a>
<!--
EOT;
}elseif($v['indexstate'] == 0 && $v['ifindex']){print<<<EOT
-->
        <a href="javascript:;" onclick="editIndex($pcid,$k,'add');">[添加索引]</a>
<!--
EOT;
}else{print<<<EOT
-->
<!--
EOT;
}print<<<EOT
-->
    </tr>
<!--
EOT;
}}print<<<EOT
-->
  </table>
  </div>
<div class="mb10 tac">
    <span class="btn"><span><button type="submit" name="delete">提 交</button></span></span>
	<span class="bt"><span><button type="button" onclick="window.location.href = '$basename'+'&action=editmodel&step=3&pcid='+'$pcid'">預覽</button></span></span>
</div>
</form>
<!--
EOT;
}elseif($step==3){print<<<EOT
-->
<div class="admin_table mb10">
<table cellpadding="0" cellspacing="0" width="100%">
$topichtml
</table>
</div>
<div class="mb10 tac">
	 <span class="btn"><span><button type="button" onclick="window.location.href = '$basename'+'&action=editmodel&step=&pcid='+'$pcid'">返回編輯</button></span></span>
</div>
<!--
EOT;
}print<<<EOT
-->
<script type="text/javascript">
var basename = '$basename';
var pcid = '$pcid';
var ajax_basename_edit = '$ajax_basename_edit';
var ajax_basename_add = '$ajax_basename_add';
var ajax_basename_delfield = '$ajax_basename_delfield';
var ajax_basename_editindex = '$ajax_basename_editindex';

function CheckIfable(form,name){
	var ifcheck = null;
	for (var i=0;i<form.elements.length-2;i++){
		var e = form.elements[i];
		if(e.type=='checkbox' && e.name.indexOf(name) != -1){
			if (ifcheck === null) ifcheck = !e.checked;
			e.checked = ifcheck;
			if (typeof e.onclick == 'function') e.onclick();
		}
	}
	return ifcheck;
}

function delfield(id) {
	if(confirm('刪除字段將同時刪除帖子關聯數據，確認刪除？')) {
		ajax.send(ajax_basename_delfield,'fieldid='+id+'&pcid='+pcid,function(){
				var str = ajax.request.responseText.split("\t");
				if (str[0] == 'success'){
					delElement('col_'+id);
				}else{
					showDialog('error','刪除失敗');
				}
			}
		);
	}
}

function editIndex(pcid,fieldid,type) {
	if (type == 'del') {
		var info = '確認刪除索引？';
	} else if (type == 'add') {
		var info = '添加索引可以提高分類信息帖子的查詢速度，但如果添加索引的字段過多，\\r\\n效果會下降。建議將常用查詢建立索引。確認添加？';
	}
	if (confirm(info)){
		ajax.send(ajax_basename_editindex,'pcid='+pcid+'&fieldid='+fieldid+'&type='+type,function(){
				var str = ajax.request.responseText.split("\t");
				if (str[0] == 'success'){
					showDialog('success','索引操作成功！');
					window.location.href = basename+'&action=editmodel&pcid='+str[1];
				} else {
					ajax.guide();
				}
			}
		);
	}
}

function ShowType(id){
	try {
		if(id == 'radio' || id == 'checkbox' || id == 'select') {
			getObj('content_des').innerHTML = '在“選項內容”中設置選項，一個選項一行，格式為“1=***” ，“=”後為要顯示的內容，確保“=”前的數字不是相同的';
		} else if(id == 'number') {
			getObj('content_des').innerHTML = '數值範圍表示發表帖子時，輸入框中填寫的數字必須在此設置的範圍內，留空則不限制';
		} else if(id == 'calendar') {
			getObj('content_des').innerHTML = '發帖和搜索時彈出日期選擇框';
		} else if(id == 'text') {
			getObj('content_des').innerHTML = '輸入框，最大字節長度為255';
		} else if(id == 'url') {
			getObj('content_des').innerHTML = '該字段內容瀏覽時會顯示成超鏈接，最大字節長度為255';
		} else if(id == 'email') {
			getObj('content_des').innerHTML = '可以控制輸入內容符合電子郵件格式，最大字節長度為255';
		} else if(id == 'textarea') {
			getObj('content_des').innerHTML = '文本輸入框，最大字節長度為6500';
		} else if (id == 'img') {
			getObj('content_des').innerHTML = '可以輸入圖片鏈接，瀏覽時將在圖片播放器中顯示，最大字節長度為255';
		} else if (id == 'upload') {
			getObj('content_des').innerHTML = '可上傳圖片，瀏覽時將在圖片播放器中顯示';
		} else if(id == 'range') {
			getObj('content_des').innerHTML = '發帖時表現形式為文本框，但搜索時顯示為兩個文本框，輸入最大值和最小值後，可以搜索出範圍內的記錄。比如發帖時輸入100，搜索時輸入“1-150”可以查詢到結果';
		}

		getObj('content_box').style.display = '';

		if (id == 'radio' || id == 'checkbox' || id == 'select'){
			getObj('content_rules').style.display = '';
			getObj('content_number').style.display = 'none';
		} else if (id == 'number'){
			getObj('content_rules').style.display = 'none';
			getObj('content_number').style.display = '';
		} else {
			getObj('content_rules').style.display = 'none';
			getObj('content_number').style.display = 'none';
		}

		for (var i=0;i<getObj('fieldtype').options.length ; i++ ){
			if(id==getObj('fieldtype').options[i].value) {
				getObj('fieldtype').options[i].selected = true;
			}
		}
	} catch(e){}
}
</script>
<!--
EOT;
}elseif($action == 'rightset'){print<<<EOT
-->
<div class="nav3 mb10">
    <ul class="cc">
      <li><a href="$basename">團購</a></li>
      <li><a href="$basename&action=postcate">內容管理</a></li>
      <li class="current"><a href="$basename&action=rightset">權限管理</a></li>
    </ul>
</div>
<div class="admin_info mb10">
	<h3 class="h1">提示信息</h3>
    <div class="legend">
    	瀏覽權限:可查看團購帖的報名信息。報名者不受此權限影響<br />
        管理權限:在瀏覽權限的基礎上，可對報名信息進行群發短信等管理操作<br />
		注意:<ol>
            <li>創始人與團購發起人不受以上權限的限制</li>
            <li>當管理權限開啟論壇版主時，論壇版主只有在本版內才有管理權限。其他用戶組則不受此限制</li>
                    </ol> 
    </div>
</div>
<h3 class="h1">權限設置</h3>
<form method="POST" action="$basename&action=rightset">
<input type="hidden" name="step" value="2">
<input type="hidden" name="pcid" value="$pcid">
<div class="admin_table mb10">
	<table cellpadding="0" cellspacing="0" width="100%">
	<tr class="tr1 vt">
		<td class="td1">瀏覽權限</td>
		<td class="td2">
			<ul class="list_A list_120 cc">
<!--
EOT;
foreach($groupdb as $key => $value){
if ($key == '1' || $key == '2') continue;
$checked = '';
$checked = strpos($postcate['viewright'],','.$key.',') !== false ? 'checked' : '';
print <<<EOT
-->
				<li><input type="checkbox" name="viewright[]" value="$key" $checked>$value[grouptitle]</li>
<!--
EOT;
}print <<<EOT
-->
			</ul>
		</td>
	</tr>
	<tr class="tr1 vt">
		<td class="td1">管理權限</td>
		<td class="td2">
			<ul class="list_A list_120 cc">
<!--
EOT;
foreach($groupdb as $key => $value){
if ($key == '1' || $key == '2') continue;
$checked = '';
$checked = strpos($postcate['adminright'],','.$key.',') !== false ? 'checked' : '';
if ($value['gptype'] == 'system') {
print <<<EOT
-->
				<li><input type="checkbox" name="adminright[]" value="$key" $checked>$value[grouptitle]</li>
<!--
EOT;
}}print <<<EOT
-->
			</ul>
		</td>
	</tr>
  </table>
 </div>
  <div class="mb10 tac">
    <select name="pcid" onchange="tovalue(this.value)">
<!--
EOT;
foreach($postcatedb as $val){
$selected = '';
$val[pcid] == $pcid && $selected = 'selected';
print<<<EOT
-->
      <option value="$val[pcid]" $selected>$val[name]</option>
<!--
EOT;
}print <<<EOT
-->
    </select>
    <span class="bt"><span><button type="button" name="chkall" value="全 選" onclick='CheckAll(this.form)'>全 選</button></span></span>
    <span class="btn"><span><button type="submit">提 交</button></span></span>
  </div>
</form>
<script type="text/javascript">
function tovalue(pcid) {
	window.location.href = '$admin_file?adminjob=postcate&action=rightset&pcid='+pcid;
}
</script>
<!--
EOT;
}elseif($action == 'addfield'){print<<<EOT
-->
<form method="post" action="$ajax_basename_add"  onsubmit="return false;">
  <input type="hidden" name="step" value="2">
  <input type="hidden" name="pcid" value="$pcid">
  <div class="addcate">
    <ul class="cc">
      <li class="h1" style="cursor:move" onmousedown="read.move(event);">添加字段</li>
    </ul>
    <div class="admin_table mb10">
        <table cellpadding="0" cellspacing="0" width="100%">
          <tr class="tr1 vt">
            <td class="td2">名稱︰</td>
            <td class="td2"><input class="input input_wa" type="text" name="name" id="name"/>
            </td>
          </tr>
          <tr class="tr1 vt">
            <td class="td2">描述︰</td>
            <td class="td2"><textarea name="descrip"  id="descrip" style="height:50px;width:150px;"></textarea>
            </td>
          </tr>
          <tr class="tr1 vt">
            <td class="td2">&nbsp;</td>
            <td class="td2"><select name="fieldtype" id="fieldtype" onchange="ShowType(this.value);"  class="select_wa">
                <option value="0">選擇字段類型</option>
                <option value="number">數字（number）</option>
                <option value="text">字串（text）</option>
                <option value="radio">單選（radio）</option>
                <option value="checkbox">多選（checkbox）</option>
                <option value="textarea">文本（textarea）</option>
                <option value="select">選擇（select）</option>
                <option value="calendar">日歷（calendar）</option>
                <option value="email">電子郵件（email）</option>
                <option value="url">超鏈接（url）</option>
                <option value="img">圖片（img）</option>
                <option value="upload">上傳（upload）</option>
                <option value="range">取值範圍（range）</option>
              </select>
            </td>
          </tr>
          <tr id="content_number"  style="display:none;"  class="tr1 vt">
            <td class="td2">數值範圍:</td>
            <td class="td2"><input type="text" class="input input_wc" name="rule_min" id="rule_min" value="">
              -
              <input type="text" class="input input_wc" name="rule_max" id="rule_max" value="">
            </td>
          </tr>
          <tr id="content_rules"  style="display:none;"  class="tr1 vt">
            <td class="td2">選項內容:</td>
            <td class="td2"><textarea name="rules" style="height:50px;width:150px;"></textarea>
            </td>
          </tr>
          <tr id="content_box" style="display:none;"  class="tr1 vt">
            <td class="td2">提示信息:</td>
            <td class="td2">&nbsp;</td>
          </tr>
        </table>
  </div>
   <div class="mb10 tac">
    <span class="btn2"><span><button name="" type="button"  value="添加" onclick="ajax.submit(this.form,ajax.guide)">添 加</button></span></span>
    <span class="bt2"><span><button type="button" value="取 消" onclick="closep();">取 消</button></span></span>
    </div>
  </div>
</form>
<!--
EOT;
}elseif($action == 'editfield'){print<<<EOT
-->
<form method="post" action="$ajax_basename_edit"  onsubmit="return false;">
  <input type="hidden" name="step" value="2">
  <input type="hidden" name="fieldid" value="$fieldid">
  <input type="hidden" name="pcid" value="$pcid">
    <h2 class="h1" style="cursor:move" onmousedown="read.move(event);">編輯字段</h2>
    <div class="admin_table mb10" style="width:350px;">
    <table width="100%">
      <tr class="tr1 vt">
        <td style="width:80px;" class="td2">名稱:</td>
        <td class="td2"><input class="input input_wa" type="text" name="name" id="name" value="$fielddb[name]"/>
        </td>
      </tr>
      <tr class="tr1 vt">
        <td class="td2">描述:</td>
        <td class="td2"><textarea name="descrip"  id="descrip" class="textarea"  style="width:153px;">$fielddb[descrip]</textarea>
        </td>
      </tr>
<!--
EOT;
if($ifhidden==1){
$selectdb = array(
	'number'=>'數字（number）',
	'text'=>'字串（text）',
	'radio'=>'單選（radio）',
	'checkbox'=>'多選（checkbox）',
	'textarea'=>'文本（textarea）',
	'select'=>'選擇（select）',
	'calendar'=>'日歷（calendar）',
	'email'=>'電子郵件（email）',
	'url'=>'超鏈接（url）',
	'img'=>'圖片（img）',
	'upload'=>'上傳（upload）',
	'range'=>'取值範圍（range）'
);
print<<<EOT
-->
      <tr class="tr1 vt">
        <td class="td2"></td>
        <td class="td2"><select id="fieldtype" name="fieldtype" onchange="ShowType(this.value);" class="select_wa">
            <option value="$fielddb[type]">{$selectdb[$fielddb[type]]}</option>
          </select>
        </td>
      </tr>
<!--
EOT;
}else{print<<<EOT
-->
      <tr class="tr1 vt">
        <td class="td2"></td>
        <td class="td2"><select name="fieldtype" id="fieldtype" onchange="ShowType(this.value);" class="select_wa">
            <option value="0">選擇字段類型</option>
            <option value="number">數字（number）</option>
            <option value="text">字串（text）</option>
            <option value="radio">單選（radio）</option>
            <option value="checkbox">多選（checkbox）</option>
            <option value="textarea">文本（textarea）</option>
            <option value="select">選擇（select）</option>
            <option value="calendar">日歷（calendar）</option>
            <option value="email">電子郵件（email）</option>
            <option value="url">超鏈接（url）</option>
            <option value="img">圖片（img）</option>
            <option value="upload">上傳（upload）</option>
            <option value="range">取值範圍（range）</option>
          </select>
        </td>
      </tr>
<!--
EOT;
}if($areaifhidden==1){print<<<EOT
-->
      <tr class="tr1 vt">
        <td class="td2"></td>
        <td class="td2"><div id="type_input_box">
            <input type="hidden" name="rules" value="$rule_content">
            $rule_content </div></td>
      </tr>
<!--
EOT;
}else{print<<<EOT
-->
      <tr id="content_number"  style="display:none;" class="tr1 vt">
        <td class="td2">數值範圍:</td>
        <td class="td2"><input type="text" name="rule_min" id="rule_min" class="input input_wc" value="$minnum">
          -
          <input type="text" name="rule_max" id="rule_max" class="input input_wc" value="$maxnum">
        </td>
      </tr>
      <tr id="content_rules"  style="display:none;" class="tr1 vt">
        <td class="td2">選項內容:</td>
        <td class="td2"><textarea name="rules" class="textarea" style="width:153px;">$rule_content</textarea>
        </td>
      </tr>
<!--
EOT;
}print<<<EOT
-->
      <tr id="content_box" style="display:none;" class="tr1 vt">
        <td class="td2">提示信息:</td>
        <td class="td2"><div id="content_des"></div></td>
      </tr>
    </table>
   </div>
   <div class="tac mb10">
    <span class="btn2"><span><button type="button" value="修改" onclick="ajax.submit(this.form,ajax.guide)">修 改</button></span></span>
    <span class="bt2"><span><button type="button" onclick="closep();">取 消</button></span></span>
</div>
</form>
<script type="text/javascript">
var type = '$type';
setTimeout(function(){ShowType(type);},300);
</script>
<!--
EOT;
}if(!defined('AJAX')){
include_once PrintEot('adminbottom');
}
?>-->
