<?php
$issue_id = $_REQUEST["issue_id"];
$action_id = $_REQUEST["action_id"];
$multiple = '';

require_once("../module/module.issue.php");
$issue = new CModuleIssue();
$issue->Init($issue_id);
$action_info = $issue->FindAction($action_id);

require_once('../module/module.flow_action.php');
$issue_type_id = $issue->modules[0]->issue_type_id;	
$action = new CModuleFlowAction();
$action->InitModule($action_id);
$action->InitNextActionMember($issue_type_id);
?>
<form action="../control/doaction.php" target="submit_issue"  method="post" enctype="multipart/form-data" name="issue_form">
<input type="hidden" id="action" name="action" value="do_issue">
<input type="hidden" id="job" name="job" value="work">
<input type='hidden' id='issue_id' name='issue_id' value='<?php echo $issue_id?>'>
<input type='hidden' id='project_id' name='project_id' value='<?php echo $issue->modules[0]->project_id?>'>
<input type='hidden' id='old_module_id' name='old_module_id' value='<?php echo $issue->modules[0]->module_id?>'>
<input type='hidden' id='action_id' name='action_id' value='<?php echo $action_id?>'>
<input type='hidden' id='src_status_id' name='src_status_id' value='<?php echo $action_info->src_status_id?>'>
<input type='hidden' id='status_id' name='status_id' value='<?php echo $action_info->dst_status_id?>'>
<input type='hidden' id='action_users' name='action_users' value="0">
<table border=0 cellspacing='1' cellpadding='0' width=100% bgcolor='#ffffff'>
	<tr bgcolor="#efefef">
		<td colspan=2>
			<span class='big'><?php echo $issue->modules[0]->issue_title?></span>
			<hr size=1>
		</td>
	</tr>
	<tr height=20>
		<td width=20% align=right>当前动作:&nbsp; </td>
		<td width=80%><?php echo $action_info->action_name ?></td>
	</tr>
	<tr height=20>
		<td width=20% align=right>下一状态:&nbsp; </td>
		<td width=80%><?php echo $action_info->dst_status_name ?></td>
	</tr>
	
	<?php 
		if($action->module->src_status_type == $Config['state_type_assign'] && $action->module->dst_status_type != $Config['state_type_close'] ){
		require_once("../module/module.project_module.php");
		$modules = new CModuleProjectModule();
		$modules->Init($issue->modules[0]->project_id);
	?>
	<tr height=30>
		<td align=right width=200>项目模块:&nbsp;&nbsp;</td>
		<td>			
			 <select id="project_module" name="project_module" class="box" onchange="CallModuleChange2()">
			 		<option value=0>---选择模块---</option>
				</select>
		</td>
	</tr>
	<script>CallModule2();</script>
	<?php } else {?>
		<input type=hidden name="project_module" id="project_module" value="<?php echo $issue->modules[0]->module_id?>">
	<?}?>
	<tr height=30>
		<td width=20% align=right valign=top>处理人员:&nbsp; </td>
		<td width=80% valign=top>
			<?php
				$obj_type=0; // 0 无选择用户 1 单项选择 2 多项选择
				
				if($action->module->src_status_type == $Config['state_type_examin']) //当前状态是评审类型
				{
						if($issue->modules[0]->ActionUserCount()==1) //判断是否是最后一个处理人
							$obj_type = ($action->module->dst_status_type == $Config['state_type_examin'] ? 2 : 1);
				}
				else
				{
						if(sizeof($action->module->members)>0) //下一状态必须有处理人
							$obj_type = ($action->module->dst_status_type == $Config['state_type_examin'] ? 2 : 1);
				}
								
				switch($obj_type)
				{
					case 0:
						echo "无<input type=hidden name='action_user' id='action_user' value='0'>";
					break;
					case 1:
					case 2:
						if($obj_type==1)
							echo "<select id='action_user' name='action_user' class='box'>";
						else
							echo "<select id='action_user' name='action_user' class='box' multiple='multiple' size=4>";
						for($i=0;$i<sizeof($action->module->members); $i++)
						{
							$selected='';
							if($action->module->dst_status_type == $Config['state_type_verify'] && $action->module->members[$i]->member_id == $issue->modules[0]->create_user)
								$selected = "selected";
							else if($action->module->src_status_type == $Config['state_type_verify'] && $action->module->members[$i]->member_id == $issue->modules[0]->process_user)
								$selected = "selected";
								
							echo "<option value='".$action->module->members[$i]->member_id."' ".$selected.">".$action->module->members[$i]->member_name."</option>";
						}
						echo "</select>";
					break;
				}
			?>
		</td>
	</tr>

	<tr>
		<td width=20% align=right valign=top>处理内容: </td>
		<td width=80% style="padding-left:10">
			<textarea id="issue_content" name="issue_content" cols="60" rows="8"></textarea>
							<script charset="utf-8" src="../kindeditor/kindeditor-min.js"></script>
							<script>
									var editor;
									KindEditor.ready(function(K) {
										editor = K.create('textarea[name="issue_content"]', {
											resizeType : 1,
											allowPreviewEmoticons : false,
											allowImageUpload : false,
											items : [
												'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
												'removeformat', '|', 'emoticons', '|', 
												'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist', 'insertunorderedlist']
										});
									});
						</script>
		</td>
	</tr>
	<tr>
		<td align=right valign=top>附件:</td>
		<td style="line-height:200%; padding-left:10">
			<input type="file" name="attach_file" id="attach_file" class="box" size="40">
			<br>
			<span class="small">上传文件限制大小为 10.00 Mb.</span><br>
			<span class="small"> 支持上传的文件类型 <?php for($i=0;$i<sizeof($FileInfo["ext_arr"]);$i++){echo $FileInfo["ext_arr"][$i].", ";}?> </span>
		</td>
	</tr>
	<tr height=30>
		<td colspan=2 bgcolor="#efefef" style="padding-left:100">
				<input type=button value=" 提交 " class=button onclick="SubmitIssueAction();">
				&nbsp;&nbsp;&nbsp;&nbsp;
				<input type=button value=" 取消 " class=button onclick="CloseDialog(0)">
		</td>
	</tr>
</table>
</form>
<iframe id="submit_issue" name="submit_issue" width=0 height=0>
</iframe>
