<?php
function formMoudle( $form_type , $title , $field_id , $form_set , $form_value , $form_word , $mustfill ){

switch ( $form_type ) {
    case "text"://单行文本框
			if( $mustfill == 0 ){
			
				if( empty( $form_word ) )$form_word = "";
				echo "    <tr>
      <td align=\"left\" bgcolor=\"#FFFFFF\">".$title."："."</td>
      <td align=\"left\" bgcolor=\"#FFFFFF\"><input name=\"postdb[".$field_id."]\" type=\"text\" id=\"".$field_id."\" size=\"50\" value=\"".$form_value."\" />".$form_word."</td>
    </tr>";
				
			}elseif( $mustfill == 1 ){
			
				if( empty( $form_word ) )$form_word = "";
				echo "    <tr>
      <td align=\"left\" bgcolor=\"#FFFFFF\">".$title."："."<font color=red>(必填)</font></td>
      <td align=\"left\" bgcolor=\"#FFFFFF\"><input name=\"postdb[".$field_id."]\" type=\"text\" id=\"".$field_id."\" size=\"50\" value=\"".$form_value."\" />".$form_word."</td>
    </tr>";
	
			}elseif( $mustfill == 2 ){
			
				echo "<input name=\"postdb[".$field_id."]\" type=\"hidden\" value=\"".$form_value."\">";
				
			}
	      
        break;
		
    case "textarea"://多行文本框
	
		if( $mustfill == 0 ){
			
				if( empty( $form_word ) )$form_word = "";
				echo "    <tr>
      <td align=\"left\" bgcolor=\"#FFFFFF\">".$title."："."</td>
      <td align=\"left\" bgcolor=\"#FFFFFF\"><textarea name=\"postdb[".$field_id."]\" cols=\"80\" rows=\"8\">".$form_value."</textarea>".$form_word."</td>
    </tr>";
				
			}elseif( $mustfill == 1 ){
			
				if( empty( $form_word ) )$form_word = "";
				echo "    <tr>
      <td align=\"left\" bgcolor=\"#FFFFFF\">".$title."："."<font color=red>(必填)</font></td>
      <td align=\"left\" bgcolor=\"#FFFFFF\"><textarea name=\"postdb[".$field_id."]\" cols=\"80\" rows=\"8\">".$form_value."</textarea>".$form_word."</td>
    </tr>";
	
			}
			
		break;
	
	case "select"://下拉菜单
	
		if( $mustfill == 1 ){ $str_mustfill = "<font color=red>(必选)</font>";}
		
		$detail=explode("\r\n",$form_set);
		
		$form_value =explode("/",$form_value);
		$form_value =array_flip($form_value);
			
		foreach( $detail AS $key=>$value){
			if($value===''){
				continue;
			}
			list($v1,$v2)=explode("|",$value);
			$v2 || $v2=$v1;
			$_show.="<option value=\"$v1\"";
			
			if(array_key_exists($v1, $form_value)){$_show.=" selected";}
		
			$_show.=">".$v2."</option>\n	  	";
		}
		$show="    <tr>
      <td align=\"left\" bgcolor=\"#FFFFFF\">".$title."：".$str_mustfill."</td>
      <td align=\"left\" bgcolor=\"#FFFFFF\"><select name=\"postdb[$field_id]\" id=\"$field_id\">
	  	$_show</select> $form_word</td>
    </tr>";
		echo $show;
	
		break;
		
	case "radio"://单选框
	
		if( $mustfill == 1 ){ $str_mustfill = "<font color=red>(必选)</font>";}
		
		$detail=explode("\r\n",$form_set);
		
		$form_value =explode("/",$form_value);
		$form_value =array_flip($form_value);
			
		foreach( $detail AS $key=>$value){
			if($value===''){
				continue;
			}
			list($v1,$v2)=explode("|",$value);
			$v2 || $v2=$v1;
			$_show.="<input type=\"radio\" name=\"postdb[".$field_id."]\" value=\"".$v1."\"";
			
			if(array_key_exists($v1, $form_value)){$_show.=" checked";}
		
			$_show.=">".$v2."\n	  	";
		}
		$show="    <tr>
      <td align=\"left\" bgcolor=\"#FFFFFF\">".$title."：".$str_mustfill."</td>
      <td align=\"left\" bgcolor=\"#FFFFFF\">$_show $form_word</td>
    </tr>";
		echo $show;

	
		break;
		
	case "checkbox"://复选框
		
		if( $mustfill == 1 ){ $str_mustfill = "<font color=red>(必选)</font>";}
		
		$detail=explode("\r\n",$form_set);
		
		$form_value =explode("/",$form_value);
		$form_value =array_flip($form_value);
			
		foreach( $detail AS $key=>$value){
			if($value===''){
				continue;
			}
			list($v1,$v2)=explode("|",$value);
			$v2 || $v2=$v1;
			$_show.="<input type=\"checkbox\" name=\"postdb[".$field_id."]\" value=\"".$v1."\"";
			
			if(array_key_exists($v1, $form_value)){$_show.=" checked=\"checked\"";}
		
			$_show.=">".$v2."\n	  	";
		}
		$show="    <tr>
      <td align=\"left\" bgcolor=\"#FFFFFF\">".$title."：".$str_mustfill."</td>
      <td align=\"left\" bgcolor=\"#FFFFFF\">$_show $form_word</td>
    </tr>";
		echo $show;
	
		break;
		
	case "ieedit"://可视化编辑器
	
		if( $mustfill == 1 ){ $str_mustfill = "<font color=red>(必选)</font>";}
		if( empty( $form_word ) )$form_word = "";
		echo "    <tr>
      <td align=\"left\" bgcolor=\"#FFFFFF\">".$title."：".$str_mustfill."</td>
      <td align=\"left\" bgcolor=\"#FFFFFF\"><textarea name=\"postdb[".$field_id."]\" cols=\"80\" rows=\"16\">".$form_value."</textarea>
	  <script language=\"javascript\">
		  editor_generate('postdb[".$field_id."]');
		</script>
	  ".$form_word."</td>
    </tr>";

		break;
		
	case "upfile"://文件上传
	
		if( $mustfill == 1 ){ $str_mustfill = "<font color=red>(必选)</font>";}
		if( empty( $form_word ) )$form_word = "";
		echo '    <tr>
          <td height="14" bgcolor="#FFFFFF">'.$title.'：'.$str_mustfill.'</td>
          <td bgcolor="#FFFFFF"><input name="postdb['.$field_id.']" id="'.$field_id.'" value="" size="38" />'.$form_word.'
            <a onclick="window.open(\'upfile.php?dir=upfile1&amp;label='.$field_id.'\',\'\',\'width=350,height=50,top=200,left=400\')" href="javascript:"><font color="#0000FF">点击上传图片</font></a><SCRIPT LANGUAGE="JavaScript">
<!--
function upfile(url,name,size,p){
	document.getElementById(p).value=url;
}
//-->
</SCRIPT>            </td>
        </tr>';

		break;

	case "upfile_big"://大的文件上传
	
		if( $mustfill == 1 ){ $str_mustfill = "<font color=red>(必选)</font>";}
		if( empty( $form_word ) )$form_word = "";
		echo "    <tr>
      <td align=\"left\" bgcolor=\"#FFFFFF\">".$title."：".$str_mustfill."</td>
      <td align=\"left\" bgcolor=\"#FFFFFF\">
	  <input name='postdb[".$field_id."]' type='text' id='".$field_id."' size='42' value=\"".$form_value."\" />
<input name='button' type='button' onClick='filelist.value=uploadid.selectfile();' value='选择一个文件' />
<input name='button2' type='button' onClick=\"".$field_id.".value=uploadid.uploadfile();filelist.value='';\" value='上 传' />
<input name='filelist' type='text' id='filelist' size='20' />
<br />
上传文件方法：1、点“<font color='#FF0000'>选择一个文件</font>”，在弹出框中选择一个文件，2、然后点击“<font color='#FF0000'>上传</font>”按钮即可".$form_word."</td>
    </tr>";

		break;
		
	case "upphoto"://上传图片
	
		if( $mustfill == 1 ){ $str_mustfill = "<font color=red>(必选)</font>";}
		if( empty( $form_word ) )$form_word = "";
		
		$s_b_photo_file = explode( "@@@" , $form_value );
		$s_photo_file = $s_b_photo_file['0'];
		$b_photo_file = $s_b_photo_file['1'];
		
		echo '    <tr>
          <td height="14" bgcolor="#FFFFFF">'.$title.'：'.$str_mustfill.'<br />
(您只需上传一张大图片，即可生成一张 '.$form_set.' 像素的小图片)</td>
      <td bgcolor="#FFFFFF">小图片地址(字段s_'.$field_id.')：<input name="postdb[s_'.$field_id.']" id="s_'.$field_id.'" value="'.$s_photo_file.'" size="38" /><br />
大图片地址(字段b_'.$field_id.')：<input name="postdb[b_'.$field_id.']" id="b_'.$field_id.'" value="'.$b_photo_file.'" size="38" />'.$form_word.'
            <a onclick="window.open(\'upphoto.php?dir=upphoto&label='.$field_id.'&photo_w_h='.$form_set.'\',\'\',\'width=350,height=50,top=200,left=400\')" href="javascript:"><font color="#0000FF">点击上传图片</font></a><SCRIPT LANGUAGE="JavaScript">
<!--
function upfile(url,name,size,p){
	document.getElementById(p).value=url;
}
//-->
</SCRIPT>            </td>
        </tr>';

		break;
		
}
}

	
?>