<?php
$job = 'add';
$title = '新增项目字段';
$field_id=0;
$field_title='';
$field_desc='';
$field_type    = 0;
$field_len     = 0;
$field_width   = 0;
$field_height  = 0;
$field_option  = "";
$field_default = "";
$field_style   = 0;
$field_order = 0;
$field_cols  = 0;
$is_query    = 0;
$field_desc  = "";     

$project_id=$_REQUEST['project_id'];

if(array_key_exists("job", $_REQUEST))
	$job = $_REQUEST['job'];

if($job=='mod')
{
	$title = '修改项目字段';
	$field_id=$_REQUEST['field_id'];
	
	require_once("../module/module.project_fields.php");
	$field = new CModuleProjectFields();
	$field->InitModule($field_id);
	
	if($field->module != '')
	{
		$field_title		= $field->module->field_title;
		$field_desc			= $field->module->field_desc;
		$field_type   	= $field->module->field_type;
		$field_len    	= $field->module->field_len;
		$field_width  	= $field->module->field_width;
		$field_height 	= $field->module->field_height;
		$field_option 	= $field->module->field_option;
		$field_default	= $field->module->field_default;
		$field_style  	= $field->module->field_style;
		$field_order		= $field->module->field_order;
		$field_cols			= $field->module->field_cols;
		$is_query				= $field->module->is_query;
		$field_desc			= $field->module->field_desc;    
	}
}

?>
<input type='hidden' id='project_id' value='<?php echo $project_id?>'>
<input type='hidden' id='field_id' value='<?php echo $field_id?>'>
<table border=0 cellspacing='1' cellpadding='0' width=100% bgcolor='#ffffff'>
	<tr bgcolor="#efefef" height=20>
		<td colspan=2>
			<b><span id="project_form_desc"><?php echo $title?></span></b>
			<hr size=1>
		</td>
	</tr>
	<tr>
		<td align=right width=80>字段标题:</td>
		<td>
			<input type=text id="field_title" class=txtput value='<?php echo $field_title?>'> &nbsp;&nbsp;
			字段长度:<input type=text size=4 id="field_len" class=txtput value='<?php echo $field_len?>'>
		</td>
	<tr>
		<td align=right width=80>字段类型:</td>
		<td>
			<select id="field_type" class='txtput'>
				<?php for($i=0;$i<sizeof($Config['field_type']);$i++){?>
					<option value="<?php echo $i?>" <?php if($field_type==$i){echo "selected";}?>><?php echo $Config['field_type'][$i]?></option>
				<?php }?>
			</select>
			宽: <input type=text id="field_width" size=4 class=txtput value='<?php echo $field_width?>' value=0>
			高: <input type=text id="field_height" size=4 class=txtput value='<?php echo $field_height?>' value=0>
		</td>
	</tr>
	<tr>
		<td align=right width=80 valign=top>可选值:</td>
		<td>
			<textarea id="field_option" cols=30 rows=4 class=txtput><?php echo $field_option?></textarea>
			(用 ; 号隔开)
		</td>
	<tr>			
			<td align=right width=80>默认值:</td>
			<td><input id="field_default" type=text size=8 class=txtput value='<?php echo $field_default?>'></td>
	<tr>
		<td align=right width=80>显示格式化:</td>
		<td><input type=text size=30 id="field_style" class=txtput value='<?php echo $field_title?>'>
	<tr>
		<td align=right width=80>显示顺序:</td>
		<td><input type=text size=4 id="field_order" class=txtput value='<?php echo $field_order?>'></td>
	<tr>
		<td align=right width=80>对齐列数:</td>
		<td><input type=text size=4 id="field_cols" class=txtput value='<?php echo $field_cols?>'></td>
	</tr>
	<tr>
			<td align=right width=80>加入组合查询:</td>
			<td>
				<input type=radio name="group_query" id="is_query" value="0" <?php if(!$is_query){echo "checked";}?> >否
				<input type=radio name="group_query" id="is_query" value="1" <?php if($is_query){echo "checked";}?> >是
			</td>
	<tr height=30>
		<td align=right>字段描述:</td>
		<td><input type=text id="field_desc" class=txtput size=40 value="<?php echo $field_desc?>"></td>
	</tr>
	<tr height=40>
		<td colspan=2 bgcolor="#efefef" align=center>
				<input type=button value=" 提交 " class=button onclick="SubmitField('<?php echo $job?>')">
				&nbsp;&nbsp;&nbsp;&nbsp;
				<input type=button value=" 取消 " class=button onclick="CloseDialog(0)">
		</td>
	</tr>
</table>