<?php
require(dirname(__FILE__) .'/check.php');
$skin->CheckIframe();

/* **** 版权所有 ****

 程序开发：网钛科技
 网钛CMS官网：http://otcms.com
 网钛IDC官网：http://idccms.com
 ＱＱ：877873666
 微信：QQ877873666
 邮箱：877873666@qq.com

 **** 版权所有 **** */


//打开用户表，并检测用户是否登录
$MB->Open('','login');

$skin->WebTop();


echo('
<script language="javascript" type="text/javascript" src="js/share.js?v='. OT_VERSION .'"></script>
');


switch($mudi){
	case 'infoSet':
		$MB->IsSecMenuRight('alertBack',525,$dataType);
		InfoSet();
		break;

	default:
		die('err');
}

$skin->WebBottom();

$MB->Close();
$DB->Close();





// 参数设置
function InfoSet(){
	global $DB,$skin,$mudi,$dataType,$dataTypeCN,$sysAdminArr;

	$dataMode	= OT::GetStr('dataMode');
	$backURL	= OT::GetStr('backURL');

	/*
	$fieldArr = Area::TabFieldArr($dataMode,'value');	// 获取dataMode类型的数组
		if (empty($fieldArr) || count($fieldArr) == 0){
			JS::AlertBackEnd('类型不存在（'. $dataMode .'）');
		}

	$fieldStr = '';
		$fieldStr .= '<input type="checkbox" name="fieldArr[]" checked="checked" value="'. $key .'" />';
		<div style="display:;">'. $fieldStr .'</div>none
	print_r($fieldArr);
	*/
	if (! in_array($dataMode, array('apiUsers','onePage'))){
		die('tabField类型错误');
	}
	$fieldArr = Area::TabFieldRow($dataMode);	// 获取dataMode类型的数组

	switch ($dataMode){
		case 'apiUsers':
			$apiUrl	= Area::TabFieldVal($fieldArr, 'apiUrl');
			$content = '
				<tr>
					<td align="right" valign="top" style="padding-top:6px;">api目录绑定的网址：</td>
					<td>
						<input type="text" id="apiUrl" name="apiUrl" style="width:500px;" value="'. $apiUrl .'" />
						<div class="font3_2">（如没用独立域名绑定，请留空。）</div>
					</td>
				</tr>
				';
			break;
	
		case 'onePage':
			$siteUrl		= Area::TabFieldVal($fieldArr, 'siteUrl');
			$endTimeMode	= Area::TabFieldVal($fieldArr, 'endTimeMode', 0);
			$userRevArea	= Area::TabFieldVal($fieldArr, 'userRevArea');
			$isRevAudit		= Area::TabFieldVal($fieldArr, 'isRevAudit');
			$content = '
				<tr>
					<td align="right" valign="top" style="padding-top:6px;">onePage目录绑定的网址：</td>
					<td>
						<input type="text" id="siteUrl" name="siteUrl" style="width:500px;" value="'. $siteUrl .'" />
						<div class="font3_2">（如没用独立域名绑定，请留空。）</div>
					</td>
				</tr>
				<tr>
					<td align="right" valign="top" style="padding-top:6px;">到期后操作：</td>
					<td>
						<label><input type="radio" id="endTimeMode0" name="endTimeMode" value="0" '. Is::Checked($endTimeMode, 0) .' />提示框再跳转网址</label>&ensp;&ensp;
						<label><input type="radio" id="endTimeMode1" name="endTimeMode" value="1" '. Is::Checked($endTimeMode, 1) .' />直接跳转网址</label>&ensp;&ensp;
						<label><input type="radio" id="endTimeMode2" name="endTimeMode" value="2" '. Is::Checked($endTimeMode, 2) .' />提示框，终止运行</label>&ensp;&ensp;
						<label><input type="radio" id="endTimeMode3" name="endTimeMode" value="3" '. Is::Checked($endTimeMode, 3) .' />提示框，继续显示页面</label>&ensp;&ensp;
						<div style="padding-top:3px;">提示框内容：<input type="text" id="endTimeAlert" name="endTimeAlert" style="width:420px;" value="'. Area::TabFieldVal($fieldArr, 'endTimeAlert') .'" />&ensp;&ensp;（换行符\n）</div>
						<div style="padding-top:3px;">&ensp;&ensp;跳转网址：<input type="text" id="endTimeUrl" name="endTimeUrl" style="width:420px;" value="'. Area::TabFieldVal($fieldArr, 'endTimeUrl') .'" /></div>
					</td>
				</tr>
				<tr>
					<td align="right">前台会员禁止修改范围：</td>
					<td>
						<label><input type="checkbox" name="userRevArea[]" value="|themeNoRev|" '. Is::InstrChecked($userRevArea,'|themeNoRev|') .' />标题</label>&ensp;&ensp;
						<label><input type="checkbox" name="userRevArea[]" value="|titleNoRev|" '. Is::InstrChecked($userRevArea,'|titleNoRev|') .' />网站名称</label>&ensp;&ensp;
						<label><input type="checkbox" name="userRevArea[]" value="|webKeyNoRev|" '. Is::InstrChecked($userRevArea,'|webKeyNoRev|') .' />网站关键字</label>&ensp;&ensp;
						<label><input type="checkbox" name="userRevArea[]" value="|webDescNoRev|" '. Is::InstrChecked($userRevArea,'|webDescNoRev|') .' />网站描述</label>&ensp;&ensp;
						<label><input type="checkbox" name="userRevArea[]" value="|contentNoRev|" '. Is::InstrChecked($userRevArea,'|contentNoRev|') .' />内容</label>&ensp;&ensp;
						<label><input type="checkbox" name="userRevArea[]" value="|announ1NoRev|" '. Is::InstrChecked($userRevArea,'|announ1NoRev|') .' />页头公告</label>&ensp;&ensp;
						<label><input type="checkbox" name="userRevArea[]" value="|announ2NoRev|" '. Is::InstrChecked($userRevArea,'|announ2NoRev|') .' />页尾公告</label>&ensp;&ensp;
						<label><input type="checkbox" name="userRevArea[]" value="|copyrightNoRev|" '. Is::InstrChecked($userRevArea,'|copyrightNoRev|') .' />网站版权</label>
					</td>
				</tr>
				<tr>
					<td align="right" valign="top" style="padding-top:6px;">前台会员修改审核：</td>
					<td>
						<label><input type="radio" name="isRevAudit" value="1" '. Is::Checked($isRevAudit, 1) .' />启用</label>&ensp;&ensp;
						<label><input type="radio" name="isRevAudit" value="0" '. Is::Checked($isRevAudit, 0) .' />禁用</label>&ensp;&ensp;
					</td>
				</tr>
				';
			break;
	
	}

	echo(
	AdmArea::TopBackBtn($backURL, '返回 '. StrCN::TabFieldType($dataMode)) .'

	<form id="dealForm" name="dealForm" method="post" action="tabField_deal.php?mudi='. $mudi .'" onsubmit="return CheckForm()">
	<input type="hidden" id="dataType" name="dataType" value="'. $dataType .'" />
	<input type="hidden" id="dataTypeCN" name="dataTypeCN" value="'. $dataTypeCN .'" />
	<input type="hidden" id="type" name="type" value="'. $dataMode .'" />
	'. Area::BackUrlInput($backURL) .'

	<div class="tabMenu">
	<ul>
		<li rel="tabBase" class="selected">参数设置</li>
	</ul>
	</div>

	<div class="tabMenuArea">
		<table id="tabBase" cellpadding="0" cellspacing="0" summary="" class="padd3">
		<tr><td class="tabLeftWidth"></td><td></td></tr>
		'. $content .'
		</table>

		<div class="tabMenuSubmit"><input type="image" src="'. AdmTpl::ImgSrc('button_save') .'" /></div>
	</div>

	</form>
	');


	/*
		foreach ($fieldArr as $row){
			$isWriteStr = $boxStr = $descStr = '';
			if (strlen($row['TF_value']) == 0){ $row['TF_value'] = $row['TF_defValue']; }
			switch ($row['TF_class']){
				case '多行文本框':
					$boxStr = '<textarea id="'. $row['TF_name'] .'" name="'. $row['TF_name'] .'" style="width:401px;height:60px;">'. $row['TF_value'] .'</textarea>';
					break;
			
				case '单选':
					$iArr = Str::SplitBr($row['TF_optionStr']);
					foreach ($iArr as $val){
						$val = Str::Filter($val,'eol');
						if (! empty($val)){
							$boxStr .= '<label><input type="radio" name="'. $row['TF_name'] .'" value="'. $val .'" '. Is::Checked($row['TF_value'],$val) .' />'. $val .'</label>&ensp;&ensp;&ensp;';
						}
					}
					break;

				case '多选':
					$iArr = Str::SplitBr($row['TF_optionStr']);
					foreach ($iArr as $val){
						$val = Str::Filter($val,'eol');
						if (! empty($val)){
							$boxStr .= '<label><input type="checkbox" name="'. $row['TF_name'] .'[]" value="'. $val .'" '. Is::Checked($row['TF_value'],$val) .' />'. $val .'</label>&ensp;&ensp;&ensp;';
						}
					}
					break;
			
				case '下拉':
					$iArr = Str::SplitBr($row['TF_optionStr']);
					$boxStr = '<select id="'. $row['TF_name'] .'" name="'. $row['TF_name'] .'" style="width:409px;">';
					foreach ($iArr as $val){
						$val = Str::Filter($val,'eol');
						if (! empty($val)){
							$boxStr .= '<option value="'. $val .'" '. Is::Selected($row['TF_value'],$val) .'>'. $val .'</option>';
						}
					}
					$boxStr .= '</select>';
					break;

				case '图片':
					$boxStr = '<input type="text" id="'. $row['TF_name'] .'" name="'. $row['TF_name'] .'" style="width:333px;" value="'. $row['TF_value'] .'" /><input type="button" onclick=\'OT_OpenUpImg("input","'. $row['TF_name'] .'","images","")\' value="上传图片" />';
					break;

				case '整数':
					$boxStr = '<input type="text" id="'. $row['TF_name'] .'" name="'. $row['TF_name'] .'" style="width:50px;" value="'. $row['TF_value'] .'" onkeyup="if (this.value!=FiltInt(this.value)){this.value=FiltInt(this.value)}" />';
					break;

				case '小数':
					$boxStr = '<input type="text" id="'. $row['TF_name'] .'" name="'. $row['TF_name'] .'" style="width:50px;" value="'. $row['TF_value'] .'" onkeyup="if (this.value!=FiltDecimal(this.value)){this.value=FiltDecimal(this.value)}" />';
					break;

				case '日期':
					$boxStr = '<input type="text" id="'. $row['TF_name'] .'" '. $row['TF_name'] .'="time" size="22" style="width:120px;" value="'. $row['TF_value'] .'" onfocus=\'WdatePicker({dateFmt:"yyyy-MM-dd"})\' class="Wdate" />';
					break;

				case '日期时间':
					$boxStr = '<input type="text" id="'. $row['TF_name'] .'" '. $row['TF_name'] .'="time" size="22" style="width:170px;" value="'. $row['TF_value'] .'" onfocus=\'WdatePicker({dateFmt:"yyyy-MM-dd HH:mm:ss"})\' class="Wdate" />';
					break;

				case '编辑器':
					$boxStr = '
						<textarea id="'. $row['TF_name'] .'" name="'. $row['TF_name'] .'" style="width:650px;height:200px;" class="text" onclick=\'LoadEditor("'. $row['TF_name'] .'",0,0,"");\' title="点击开启编辑器模式">'. Str::MoreReplace($row['TF_value'],'textarea') .'</textarea>
						<script language="javascript" type="text/javascript">LoadEditor("'. $row['TF_name'] .'",0,0,"");</script>
						';
					break;
				
				default :
					$boxStr = '<input type="text" id="'. $row['TF_name'] .'" name="'. $row['TF_name'] .'" style="width:400px;" value="'. $row['TF_value'] .'" />';
					break;
			}

			if ($row['TF_isWrite'] == 1){ $isWriteStr = '<span style="color:red;">*</span>&ensp;'; }
			if (strlen($row['TF_desc']) > 0){ $descStr = '&ensp;<span style="color:red;">（'. $row['TF_desc'] .'）</span>'; }
			echo('
			<tr>
				<td align="right">
					<span style="display:none;">
						<input type="checkbox" name="selDataID[]" value="'. $row['TF_ID'] .'" checked="checked" />
						<input type="hidden" id="class'. $row['TF_ID'] .'" name="class'. $row['TF_ID'] .'" value="'. $row['TF_class'] .'" />
						<input type="hidden" id="isWrite'. $row['TF_ID'] .'" name="isWrite'. $row['TF_ID'] .'" value="'. $row['TF_isWrite'] .'" />
						<input type="hidden" id="name'. $row['TF_ID'] .'" name="name'. $row['TF_ID'] .'" value="'. $row['TF_name'] .'" />
					</span>
					'. $isWriteStr . $row['TF_title'] .'：
				</td>
				<td>'. $boxStr . $descStr . '</td>
			</tr>
			');
		}
	*/

}

?>