<?php
$job = 'edit';
$title = '修改事务';
$issue_id = $_REQUEST['issue_id'];
	
require_once("../module/module.issue.php");
$issue = new CModuleIssue();
$issue->Init($issue_id);

require_once("../module/module.flow.php");
$flow = new CModuleFlow();
$flow->InitModuleByType($issue->modules[0]->issue_type_id);

require_once("../module/module.project.php");
$project = new CModuleProject();
$project->InitModule($issue->modules[0]->issue_id);
$project->InitMember($issue->modules[0]->issue_type_id);
?>
<form action="../control/doaction.php" target="submit_issue"  method="post" name="issue_form">
<input type="hidden" id="action" name="action" value="do_issue">
<input type="hidden" id="job" name="job" value="mod">
<input type='hidden' id='issue_id' name="issue_id" value='<?php echo $issue_id?>'>
<input type='hidden' id='issue_title' name="issue_title" value='<?php echo $issue->modules[0]->issue_title?>'>

<table border=0 cellspacing='1' cellpadding='0' width=100% bgcolor='#ffffff'>
	<tr bgcolor="#efefef" height=20>
		<td>
			<b><?php echo $title?>: <?php echo $issue->modules[0]->issue_title ?></b>
			<hr size=1>
		</td>
	</tr>
	<tr>
		<td height=130 valign=top>
					<table width=100% bgcolor=#ffffff border=0 cellspacing="1" cellpadding="0" align=center>
							<tr height=30>
								<td width=20% align="right">事务状态:</td>
								<td width=20%>
									<select id="issue_status" name="issue_status" class="box">
										<?php for($i=1;$i<sizeof($flow->module->status);$i++){?>
											<option value="<?php echo $flow->module->status[$i]->status_id?>" <?php if($flow->module->status[$i]->status_id==$issue->modules[0]->status_id){echo "selected";} ?>><?php echo $flow->module->status[$i]->state_name ?></option>
										<?php }?>
									</select>
								</td>
									
								<td width=20% align="right">严重性:</td>
								<td width=40%>
										<select class="box" id="serverity" name="serverity">
										<?php for($i=0;$i<sizeof($Config["serverity"]);$i++){?>
											<option value="<?php echo $i ?>" <?php if($issue->modules[0]->serverity_id==$i){echo "selected";}?>><?php echo $Config["serverity"][$i]?></option>
										<?php }?>
									</select>									
								</td>
								
							</tr>
							<tr height=30>
								
								<td width=20% align="right">处理者:</td>
								<td width=20%>
									<select id="action_user" name="action_user" class="box">
										<?php for($i=0;$i<sizeof($project->module->members);$i++){?>
												<?php 
													$select = "";
													for($n=0; $n<sizeof($issue->modules[0]->action_users); $n++)
													{
														if($project->module->members[$i]->user_id == $issue->modules[0]->action_users[$n]->action_user_id)
														{
															$select = "selected";
															break;
														}
													}
												?>
												<option value="<?php echo $project->module->members[$i]->user_id?>" <?php echo $select;?>><?php echo $project->module->members[$i]->real_name?></option>
										<?php }?>
									</select>	
								</td>
								
								<td width=20% align="right" >处理优先级:</td>
								<td width=40%>
									<select class="box" id="priority" name="priority">
										<?php for($i=0;$i<sizeof($Config["priority"]);$i++){?>
											<option value="<?php echo $i ?>" <?php if($issue->modules[0]->pripority_id==$i){echo "selected";}?>><?php echo $Config["priority"][$i]?></option>
										<?php }?>
									</select>			
								
							</tr>
							
							<tr height=30>	
								<td width=20% align="right">期望完成时间:</td>
								<td colspan=3>
									<script type="text/javascript" src="../script/calendar.js"></script>
									<input onfocus="setday(this)" size=10 id="exp_time" name="exp_time" class='box' value="">
								</td>
							</tr>
							<tr>
								<td colspan=4>
									<textarea id="issue_content" name="issue_content" cols="60" rows="8"><?php echo $issue->modules[0]->issue_content?></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>
				</table>
		</td>
	</tr>
	<tr height=30>
		<td align=center bgcolor="#efefef">
			<input type=button value=" 提交 " class=button onclick="SubmitIssueEdit()">
			&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>
