<?php
require_once("module/module.project.php");
$projects = new CModuleProject();
$projects->InitByUserID($UserInfo["UID"]);
$parent_id=0;
$project_id=0;
$title = '创建新事物';

if(array_key_exists("parent_id", $_REQUEST))
{
		$parent_id = $_REQUEST['parent_id'];
		$project_id = $_REQUEST['project_id'];
		$title = "创建子事务事物 &nbsp;&nbsp;&nbsp;<a href='index.php?job=issue_info&issue_id=".$parent_id."'> 返回 </a>";
}
?>

<table width=80% border=0 cellspacing="1" cellpadding="0" align="center" bgcolor="#cccccc">
	<tr bgcolor="#cccccc" height=30>
		<td style="padding-left:20"><b><?php echo $title?></b></td>
	</tr>
	<tr bgcolor=#ffffff>
		<td>
			<span id='form_new_issue'>
			<?php if($projects->GetSize()==0){?>
				<br>
				<div align=center><b>你暂时还没有创建事物的权限</b></div>
			<?php } else {?>
			
				<form action="control/doaction.php" target="submit_issue"  method="post" enctype="multipart/form-data" name="issue_form">
					<input type="hidden" name="action" value="do_issue">
					<input type="hidden" name="job" value="add">
					<input type="hidden" name="parent_id" value="<?php echo $parent_id?>">
				<table width=100% border=0 cellspacing="0" cellpadding="0">
					<tr height=30>
						<td align=right width=200>项目名称:&nbsp;&nbsp;</td>
						<td>			
							<select id="project_id" name="project_id" onchange="CallIssueType();CallModule()" class="box">
								<?php for($i=0;$i<$projects->GetSize();$i++){?>
									<option value="<?php echo $projects->modules[$i]->project_id?>" <?php if($projects->modules[$i]->project_id==$project_id){echo 'selected';}?>><?php echo $projects->modules[$i]->project_name?></option>>
								<?php }?>
							</select>
						</td>
					</tr>
					<tr height=30>
						<td align=right width=200>事物类型:&nbsp;&nbsp;</td>
						<td>			
						 <select id="issue_type" name="issue_type" class="box" onchange="CallAction()"></select>
						</td>
					</tr>
					<tr height=30>
						<td align="right" width=10%>事物标题:&nbsp;&nbsp;</td>
						<td><input type=text id="issue_title" name="issue_title" class='box' size=60></td>
					</tr>
					
					<tr height=30>
						<td align="right" width=10%>严重性:&nbsp;&nbsp;</td>
						<td>	
							<select class="box" id="issue_serverity" name="issue_serverity">
							<?php for($i=0;$i<sizeof($Config["serverity"]);$i++){?>
								<option value=<?php echo $i?>><?php echo $Config["serverity"][$i]?></option>
							<?php }?>
							</select>						
						</td>
					</tr>
					
					<tr height=30>
						<td align="right" width=10%>处理优先级:&nbsp;&nbsp;</td>
						<td>
							<select class="box" id="issue_priority" name="issue_priority">
							<?php for($i=0;$i<sizeof($Config["priority"]);$i++){?>
								<option value=<?php echo $i?>><?php echo $Config["priority"][$i]?></option>
							<?php }?>
							</select>
						</td>
					</tr>
					
					<tr height=30>
						<td align="right" width=10%>处理动作:&nbsp;&nbsp;</td>
						<td id="work_action">
							<select id="issue_action" name="issue_action" class="box" onchange="CallActionUser();"></select>
						</td>
					</tr>
					<tr height=30>
						<td align="right" width=10%>项目模块:&nbsp;&nbsp;</td>
						<td>
							<select id="project_module" name="project_module" class="box" onchange="CallModuleChange()">
							<option value=0>---选择模块---</option>
							</select>
						</td>
					</tr>
					<tr height=40>
						<td align="right" width=10%>期望完成时间:&nbsp;&nbsp;</td>
						<td>
							<script type="text/javascript" src="script/calendar.js"></script>
							<input onfocus="setday(this)" size=10 id="exp_time" name="exp_time" class='box'>
						</td>
					</tr>
					<tr height=40>
						<td align="right" valign=top width=10%>处理人员:&nbsp;&nbsp;</td>
						<td valign=top>
							<input type=hidden value='0' id="action_users" name="action_users">
							<select id="action_user" name="action_user" class="box"></select>
						</td>
					</tr>
				
					<tr height=30>
						<td align="right" valign=top width=10%>事务内容:&nbsp;&nbsp;</td>
						<td>
							<textarea id="issue_content" name="issue_content" cols="100" rows="16"></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"]', {
												allowFileManager : true
											});
											/*
											K('input[name=getHtml]').click(function(e) {
												alert(editor.html());
											});
											K('input[name=isEmpty]').click(function(e) {
												alert(editor.isEmpty());
											});
											K('input[name=getText]').click(function(e) {
												alert(editor.text());
											});
											K('input[name=selectedHtml]').click(function(e) {
												alert(editor.selectedHtml());
											});
											K('input[name=setHtml]').click(function(e) {
												editor.html('<h3>Hello KindEditor</h3>');
											});
											K('input[name=setText]').click(function(e) {
												editor.text('<h3>Hello KindEditor</h3>');
											});
											K('input[name=insertHtml]').click(function(e) {
												editor.insertHtml('<strong>插入HTML</strong>');
											});
											K('input[name=appendHtml]').click(function(e) {
												editor.appendHtml('<strong>添加HTML</strong>');
											});
											K('input[name=clear]').click(function(e) {
												editor.html('');
											});*/
										});
							</script>
						</td>
					</tr>
					<tr>
						<td align=right valign="top">附件:</td>
						<td style="line-height:200%;padding-top:10; padding-left:20">
							<input type="file" name="attach_file" id="attach_file" class="box" size="60">
							<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><br>
						</td>
					</tr>
					<tr height=30 bgcolor=#efefef>
						<td colspan=2 style='padding-left:200'>
							<input type=button class="button" value=" 提 交 " onclick="SubmitIssue()">
						</td>
					</tr>
				</table>
				</form>
				<script>
					CallIssueType();
					CallModule();
				</script>
				<?php }?>
			</span>
			
			<iframe id="submit_issue" name="submit_issue" width=0 height=0>
			</iframe>
			</td>
		</tr>
</table>

