added an edit dialog to the issue_show view
This commit is contained in:
		| @ -379,7 +379,7 @@ class File extends Controller | ||||
| 				{ | ||||
| 					$status = 'error - no name'; | ||||
| 				} | ||||
| 				else if ($post_new_description === FALSE || ($post_new_description = $post_new_description) == '') | ||||
| 				else if ($post_new_description === FALSE || ($post_new_description = trim($post_new_description)) == '') | ||||
| 				{ | ||||
| 					$status = 'error - no description'; | ||||
| 				} | ||||
|  | ||||
| @ -575,9 +575,9 @@ class Issue extends Controller | ||||
| 				} | ||||
| 				else if ($issue->summary === FALSE || ($issue->summary = trim($issue->summary)) == '') | ||||
| 				{ | ||||
| 					$status = 'error - no name'; | ||||
| 					$status = 'error - no summary'; | ||||
| 				} | ||||
| 				else if ($issue->description === FALSE || ($issue->description = $issue->description) == '') | ||||
| 				else if ($issue->description === FALSE || ($issue->description = trim($issue->description)) == '') | ||||
| 				{ | ||||
| 					$status = 'error - no description'; | ||||
| 				} | ||||
| @ -624,4 +624,216 @@ class Issue extends Controller | ||||
|  | ||||
| 		print $status; | ||||
| 	} | ||||
|  | ||||
| 	function xhr_update ($projectid = '') | ||||
| 	{ | ||||
| 		$this->load->model ('ProjectModel', 'projects'); | ||||
| 		$this->load->model ('IssueModel', 'issues'); | ||||
| 		$this->load->library ('upload'); | ||||
|  | ||||
| 		$login = $this->login->getUser (); | ||||
| 		$revision_saved = -1; | ||||
|  | ||||
| 		if ($login['id'] == '') | ||||
| 		{ | ||||
| 			$status = 'error - anonymous user'; | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			$project = $this->projects->get ($projectid); | ||||
| 			if ($project === FALSE) | ||||
| 			{ | ||||
| 				$status = "error - failed to get the project {$projectid}"; | ||||
| 			} | ||||
| 			else if ($project === NULL) | ||||
| 			{ | ||||
| 				$status = "error - no such project {$projectid}"; | ||||
| 			} | ||||
| 			else if (!$login['sysadmin?'] &&  | ||||
| 			         $this->projects->projectHasMember($projectid, $login['id']) === FALSE) | ||||
| 			{ | ||||
| 				$status = "error - not a member {$login['id']}"; | ||||
| 			} | ||||
| 			else | ||||
| 			{ | ||||
| 				$issue = new stdClass(); | ||||
| 				$issue->projectid = $projectid; | ||||
| 				$issue->id = $this->input->post('issue_edit_id'); | ||||
| 				$issue->summary = $this->input->post('issue_edit_summary'); | ||||
| 				$issue->description = $this->input->post('issue_edit_description'); | ||||
| 				//$issue->type = $this->input->post('issue_edit_type'); | ||||
|  | ||||
| 				if ($issue->id === FALSE || ($issue->id = trim($issue->id)) == '') | ||||
| 				{ | ||||
| 					$status = 'error - no ID'; | ||||
| 				} | ||||
| 				else if ($issue->summary === FALSE || ($issue->summary = trim($issue->summary)) == '') | ||||
| 				{ | ||||
| 					$status = 'error - no summary'; | ||||
| 				} | ||||
| 				else if ($issue->description === FALSE || ($issue->description = trim($issue->description)) == '') | ||||
| 				{ | ||||
| 					$status = 'error - no description'; | ||||
| 				} | ||||
| 				else | ||||
| 				{ | ||||
| 					$status = ''; | ||||
|  | ||||
| 					if ($status == '') | ||||
| 					{ | ||||
| 						if ($this->issues->update_summary_and_description ($login['id'], $issue) === FALSE) | ||||
| 						{ | ||||
| 							$status = 'error - ' . $this->issues->getErrorMessage(); | ||||
| 						} | ||||
| 						else | ||||
| 						{ | ||||
| 							$status = 'ok'; | ||||
| 						} | ||||
| 					} | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		print $status; | ||||
| 	} | ||||
|  | ||||
| 	private function _handle_file ($login, $projectid, $issueid, $filename) | ||||
| 	{ | ||||
| 		$this->load->model ('ProjectModel', 'projects'); | ||||
| 		$this->load->model ('IssueModel', 'issues'); | ||||
|  | ||||
| 		$data['login'] = $login; | ||||
|  | ||||
| 		$project = $this->projects->get ($projectid); | ||||
| 		if ($project === FALSE) | ||||
| 		{ | ||||
| 			$data['message'] = 'DATABASE ERROR'; | ||||
| 			$this->load->view ($this->VIEW_ERROR, $data); | ||||
| 		} | ||||
| 		else if ($project === NULL) | ||||
| 		{ | ||||
| 			$data['message'] =  | ||||
| 				$this->lang->line('MSG_NO_SUCH_PROJECT') .  | ||||
| 				" - {$projectid}"; | ||||
| 			$this->load->view ($this->VIEW_ERROR, $data); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			if ($project->public !== 'Y' && $login['id'] == '') | ||||
| 			{ | ||||
| 				// non-public projects require sign-in. | ||||
| 				redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); | ||||
| 			} | ||||
|  | ||||
| 			$att = $this->issues->getFile ($login['id'], $project, $issueid, $filename); | ||||
| 			if ($att === FALSE) | ||||
| 			{ | ||||
| 				$data['project'] = $project; | ||||
| 				$data['message'] = 'DATABASE ERROR'; | ||||
| 				$this->load->view ($this->VIEW_ERROR, $data); | ||||
| 			} | ||||
| 			else if ($att === NULL) | ||||
| 			{ | ||||
| 				$data['project'] = $project; | ||||
| 				$data['message'] = sprintf ( | ||||
| 					$this->lang->line('ISSUE_MSG_NO_SUCH_FILE'), $filename); | ||||
| 				$this->load->view ($this->VIEW_ERROR, $data); | ||||
| 			} | ||||
| 			else | ||||
| 			{ | ||||
| 				$path = CODEPOT_ISSUE_FILE_DIR . "/{$att->encname}"; | ||||
|  | ||||
| 				$stat = @stat($path); | ||||
| 				if ($stat === FALSE) | ||||
| 				{ | ||||
| 					$data['project'] = $project; | ||||
| 					$data['message'] = sprintf ( | ||||
| 						$this->lang->line('issue_MSG_FAILED_TO_READ_FILE'), $filename); | ||||
| 					$this->load->view ($this->VIEW_ERROR, $data); | ||||
| 					return; | ||||
| 				} | ||||
|  | ||||
| 				$etag = sprintf ('%x-%x-%x-%x', $stat['dev'], $stat['ino'], $stat['size'], $stat['mtime']); | ||||
| 				$lastmod = gmdate ('D, d M Y H:i:s', $stat['mtime']); | ||||
|  | ||||
| 				header ('Last-Modified: ' . $lastmod . ' GMT'); | ||||
| 				header ('Etag: ' . $etag); | ||||
|  | ||||
| 				if ((isset($_SERVER['HTTP_IF_NONE_MATCH']) && $_SERVER['HTTP_IF_NONE_MATCH'] == $etag) || | ||||
| 				    (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) >= $stat['mtime'])) | ||||
| 				{ | ||||
| 					header('Not Modified', true, 304); | ||||
| 					flush (); | ||||
| 					return; | ||||
| 				} | ||||
|  | ||||
| 				header ('Content-Type: ' . mime_content_type($path)); | ||||
| 				header ('Content-Length: ' . $stat['size']); | ||||
| 				header ('Content-Disposition: inline; filename=' . $filename); | ||||
| 				flush (); | ||||
|  | ||||
| 				$x = @readfile($path); | ||||
| 				if ($x === FALSE) | ||||
| 				{ | ||||
| 					$data['project'] = $project; | ||||
| 					$data['message'] = sprintf ( | ||||
| 						$this->lang->line('ISSUE_MSG_FAILED_TO_READ_FILE'), $filename); | ||||
| 					$this->load->view ($this->VIEW_ERROR, $data); | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	function file ($projectid = '', $issueid = '', $filename = '') | ||||
| 	{ | ||||
| 		$login = $this->login->getUser (); | ||||
| 		if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '') | ||||
| 			redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); | ||||
|  | ||||
| 		if ($issueid == '' || $filename == '') | ||||
| 		{ | ||||
| 			$data['login'] = $login; | ||||
| 			$data['message'] = 'INVALID PARAMETERS'; | ||||
| 			$this->load->view ($this->VIEW_ERROR, $data); | ||||
| 			return; | ||||
| 		} | ||||
|  | ||||
| 		$filename = $this->converter->HexToAscii ($filename); | ||||
|  | ||||
| 		$part = explode (':', $filename); | ||||
| 		if (count($part) == 3) | ||||
| 		{ | ||||
| 			if ($part[0] != '') $projectid = $part[0]; | ||||
| 			if ($part[1] != '') $issueid = $part[1]; | ||||
| 			if ($part[2] != '') $filename = $part[2]; | ||||
| 		} | ||||
|  | ||||
| 		$this->_handle_file ($login, $projectid, $issueid, $filename); | ||||
| 	} | ||||
|  | ||||
|  | ||||
| 	function file0 ($projectid = '', $target = '') | ||||
| 	{ | ||||
| 		//$target => projectid:issueid:filename | ||||
|  | ||||
| 		$login = $this->login->getUser (); | ||||
| 		if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '') | ||||
| 			redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); | ||||
|  | ||||
| 		if ($target == '') | ||||
| 		{ | ||||
| 			$data['login'] = $login; | ||||
| 			$data['message'] = 'INVALID PARAMETERS'; | ||||
| 			$this->load->view ($this->VIEW_ERROR, $data); | ||||
| 			return; | ||||
| 		} | ||||
|  | ||||
| 		$target = $this->converter->HexToAscii ($target); | ||||
| 		$part = explode (':', $target); | ||||
| 		if (count($part) == 3) | ||||
| 		{ | ||||
| 			if ($part[0] == '') $part[0] = $projectid; | ||||
| 			$this->_handle_attachment ($login, $part[0], $part[1], $part[2]); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  | ||||
| @ -229,7 +229,7 @@ class Wiki extends Controller | ||||
| 		$this->_handle_attachment ($login, $projectid, $wikiname, $name); | ||||
| 	} | ||||
|  | ||||
| 	function _handle_attachment ($login, $projectid, $wikiname, $name) | ||||
| 	private function _handle_attachment ($login, $projectid, $wikiname, $name) | ||||
| 	{ | ||||
| 		$this->load->model ('ProjectModel', 'projects'); | ||||
| 		$this->load->model ('WikiModel', 'wikis'); | ||||
|  | ||||
| @ -22,34 +22,49 @@ class IssueModel extends Model | ||||
|  | ||||
| 	function get ($userid, $project, $id) | ||||
| 	{ | ||||
| 		$this->db->trans_start (); | ||||
| 		$this->db->trans_begin (); // manual transaction. not using trans_start(). | ||||
|  | ||||
| 		$this->db->where ('projectid', $project->id); | ||||
| 		$this->db->where ('id', $id); | ||||
| 		$query = $this->db->get ('issue'); | ||||
| 		if ($this->db->trans_status() === FALSE)  | ||||
| 		{ | ||||
| 			$this->db->trans_complete (); | ||||
| 			$this->db->trans_rollback (); | ||||
| 			return FALSE; | ||||
| 		} | ||||
|  | ||||
| 		$result = $query->result (); | ||||
| 		if (empty($result)) | ||||
| 		{ | ||||
| 			$this->db->trans_complete (); | ||||
| 			$this->db->trans_commit (); | ||||
| 			return NULL; | ||||
| 		} | ||||
|  | ||||
| 		$this->db->where ('projectid', $project->id); | ||||
| 		$this->db->where ('issueid', $id); | ||||
| 		$query = $this->db->get ('issue_file_list'); | ||||
| 		if ($this->db->trans_status() === FALSE) | ||||
| 		{ | ||||
| 			$this->db->trans_rollback (); | ||||
| 			return FALSE; | ||||
| 		} | ||||
| 		$files = $query->result(); | ||||
|  | ||||
| 		$this->db->where ('projectid', $project->id); | ||||
| 		$this->db->where ('id', $id); | ||||
| 		$this->db->order_by ('sno', 'asc'); | ||||
| 		$query = $this->db->get ('issue_change'); | ||||
|  | ||||
| 		$this->db->trans_complete (); | ||||
| 		if ($this->db->trans_status() === FALSE) return FALSE; | ||||
|  | ||||
| 		if ($this->db->trans_status() === FALSE) | ||||
| 		{ | ||||
| 			$this->db->trans_rollback (); | ||||
| 			return FALSE; | ||||
| 		} | ||||
| 		$changes = $query->result(); | ||||
|  | ||||
| 		$this->db->trans_commit (); | ||||
|  | ||||
| 		$result[0]->changes = $changes; | ||||
| 		$result[0]->files = $files; | ||||
| 		return $result[0]; | ||||
| 	} | ||||
|  | ||||
| @ -145,6 +160,25 @@ class IssueModel extends Model | ||||
| 		return $query->result (); | ||||
| 	} | ||||
|  | ||||
| 	function getFile ($userid, $project, $issueid, $filename) | ||||
| 	{ | ||||
| 		$this->db->trans_start (); | ||||
|  | ||||
| 		$this->db->select ('filename,encname,md5sum,description,createdon,createdby'); | ||||
| 		$this->db->where ('projectid', $project->id); | ||||
| 		$this->db->where ('issueid', $issueid); | ||||
| 		$this->db->where ('filename', $filename); | ||||
|  | ||||
| 		$query = $this->db->get ('issue_file_list'); | ||||
| 		$this->db->trans_complete (); | ||||
|  | ||||
| 		if ($this->db->trans_status() === FALSE) return FALSE; | ||||
| 		$result = $query->result (); | ||||
| 		if (empty($result)) return NULL; | ||||
|  | ||||
| 		return $result[0]; | ||||
| 	} | ||||
|  | ||||
| 	function create ($userid, $issue) | ||||
| 	{ | ||||
| 		// TODO: check if userid can do this.. | ||||
| @ -554,6 +588,32 @@ class IssueModel extends Model | ||||
| 		restore_error_handler (); | ||||
| 		return $x; | ||||
| 	} | ||||
|  | ||||
| 	function update_summary_and_description ($userid, $issue) | ||||
| 	{ | ||||
| 		// TODO: check if userid can do this.. | ||||
| 		$this->db->trans_start (); | ||||
| 		$this->db->where ('projectid', $issue->projectid); | ||||
| 		$this->db->where ('id', $issue->id); | ||||
| 		$this->db->set ('summary', $issue->summary); | ||||
| 		$this->db->set ('description', $issue->description); | ||||
| 		$this->db->set ('updatedon', date('Y-m-d H:i:s')); | ||||
| 		$this->db->set ('updatedby', $userid); | ||||
| 		$this->db->update ('issue'); | ||||
|  | ||||
| 		$this->db->set ('createdon', date('Y-m-d H:i:s')); | ||||
| 		$this->db->set ('type',      'issue'); | ||||
| 		$this->db->set ('action',    'update'); | ||||
| 		$this->db->set ('projectid', $issue->projectid); | ||||
| 		$this->db->set ('userid',    $userid); | ||||
| 		$this->db->set ('message',   $issue->id); | ||||
| 		$this->db->insert ('log'); | ||||
|  | ||||
| 		$this->db->trans_complete (); | ||||
| 		if ($this->db->trans_status() === FALSE) return FALSE; | ||||
|  | ||||
| 		return $issue->id; | ||||
| 	} | ||||
| } | ||||
|  | ||||
| ?> | ||||
|  | ||||
| @ -58,14 +58,14 @@ function render_wiki(input_text) | ||||
| 	creole_render_wiki_with_input_text ( | ||||
| 		input_text, | ||||
| 		"issue_home_mainarea_new_description_preview",  | ||||
| 		"<?php print site_url()?>/wiki/show/<?php print $project->id?>/", | ||||
| 		"<?php print site_url()?>/wiki/attachment0/<?php print $project->id?>/" | ||||
| 		"<?php print site_url()?>/issue/show/<?php print $project->id?>/", | ||||
| 		"<?php print site_url()?>/issue/file0/<?php print $project->id?>/" | ||||
| 	); | ||||
|  | ||||
| 	prettyPrint (); | ||||
| } | ||||
|  | ||||
| var import_in_progress = false; | ||||
| var work_in_progress = false; | ||||
| var populated_file_obj = []; | ||||
| var populated_file_max = 0; | ||||
|  | ||||
| @ -137,12 +137,12 @@ $(function () { | ||||
| 			buttons: { | ||||
|  | ||||
| 				'<?php print $this->lang->line('OK')?>': function () { | ||||
| 					if (import_in_progress) return; | ||||
| 					if (work_in_progress) return; | ||||
|  | ||||
| 					if (!!window.FormData) | ||||
| 					{ | ||||
| 						// FormData is supported | ||||
| 						import_in_progress = true; | ||||
| 						work_in_progress = true; | ||||
|  | ||||
| 						var form_data = new FormData(); | ||||
|  | ||||
| @ -178,7 +178,7 @@ $(function () { | ||||
| 							cache: false, | ||||
|  | ||||
| 							success: function (data, textStatus, jqXHR) {  | ||||
| 								import_in_progress = false; | ||||
| 								work_in_progress = false; | ||||
| 								$('#issue_home_mainarea_new_form').dialog('enable'); | ||||
| 								$('#issue_home_mainarea_new_form').dialog('close'); | ||||
| 								if (data == 'ok')  | ||||
| @ -193,7 +193,7 @@ $(function () { | ||||
| 							}, | ||||
|  | ||||
| 							error: function (jqXHR, textStatus, errorThrown) {  | ||||
| 								import_in_progress = false; | ||||
| 								work_in_progress = false; | ||||
| 								$('#issue_home_mainarea_new_form').dialog('enable'); | ||||
| 								$('#issue_home_mainarea_new_form').dialog('close'); | ||||
| 								var errmsg = ''; | ||||
| @ -210,14 +210,14 @@ $(function () { | ||||
| 					} | ||||
| 				}, | ||||
| 				'<?php print $this->lang->line('Cancel')?>': function () { | ||||
| 					if (import_in_progress) return; | ||||
| 					if (work_in_progress) return; | ||||
| 					$('#issue_home_mainarea_new_form').dialog('close'); | ||||
| 				} | ||||
| 			}, | ||||
|  | ||||
| 			beforeClose: function() {  | ||||
| 				// if importing is in progress, prevent dialog closing | ||||
| 				return !import_in_progress; | ||||
| 				return !work_in_progress; | ||||
| 			} | ||||
| 		} | ||||
| 	); | ||||
|  | ||||
| @ -21,8 +21,28 @@ | ||||
| <script type="text/javascript" src="<?php print base_url_make('/js/jquery-ui.min.js')?>"></script> | ||||
| <link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/jquery-ui.css')?>" /> | ||||
|  | ||||
| <?php | ||||
| $hex_issue_id = $this->converter->AsciiToHex ($issue->id); | ||||
| ?> | ||||
|  | ||||
| <script type="text/javascript"> | ||||
|  | ||||
| function show_alert (outputMsg, titleMsg)  | ||||
| { | ||||
| 	$('#issue_show_mainarea_alert').html(outputMsg).dialog({ | ||||
| 		title: titleMsg, | ||||
| 		resizable: true, | ||||
| 		modal: true, | ||||
| 		width: 'auto', | ||||
| 		height: 'auto', | ||||
| 		buttons: { | ||||
| 			"OK": function () { | ||||
| 				$(this).dialog("close"); | ||||
| 			} | ||||
| 		} | ||||
| 	}); | ||||
| } | ||||
|  | ||||
| $.widget("ui.combobox", { | ||||
| 	_create: function() { | ||||
| 		var self = this; | ||||
| @ -78,7 +98,95 @@ $.widget("ui.combobox", { | ||||
| }); | ||||
|  | ||||
|  | ||||
| var work_in_progress = false; | ||||
|  | ||||
| $(function () {  | ||||
| <?php if (isset($login['id']) && $login['id'] != ''): ?> | ||||
| 	$("#issue_show_mainarea_edit_description_tabs").tabs (); | ||||
| 	$("#issue_show_mainarea_edit_description_tabs").bind ('tabsshow', function (event, ui) { | ||||
| 		if (ui.index == 1) render_wiki ($("#issue_show_mainarea_edit_description").val()); | ||||
| 	}); | ||||
|  | ||||
| 	$('#issue_show_mainarea_edit_form').dialog ( | ||||
| 		{ | ||||
| 			title: '<?php print $this->lang->line('Edit');?>', | ||||
| 			resizable: true, | ||||
| 			autoOpen: false, | ||||
| 			width: 'auto', | ||||
| 			height: 'auto', | ||||
| 			modal: true, | ||||
| 			buttons: { | ||||
|  | ||||
| 				'<?php print $this->lang->line('OK')?>': function () { | ||||
| 					if (work_in_progress) return; | ||||
|  | ||||
| 					if (!!window.FormData) | ||||
| 					{ | ||||
| 						// FormData is supported | ||||
| 						work_in_progress = true; | ||||
|  | ||||
| 						var form_data = new FormData(); | ||||
|  | ||||
| 						form_data.append ('issue_edit_id', '<?php print $issue->id; ?>'); | ||||
| 						form_data.append ('issue_edit_summary', $('#issue_show_mainarea_edit_summary').val()); | ||||
| 						form_data.append ('issue_edit_description', $('#issue_show_mainarea_edit_description').val()); | ||||
|  | ||||
| 						$('#issue_show_mainarea_edit_form').dialog('disable'); | ||||
| 						$.ajax({ | ||||
| 							url: codepot_merge_path('<?php print site_url() ?>', '<?php print "/issue/xhr_update/{$project->id}"; ?>'), | ||||
| 							type: 'POST', | ||||
| 							data: form_data, | ||||
| 							mimeType: 'multipart/form-data', | ||||
| 							contentType: false, | ||||
| 							processData: false, | ||||
| 							cache: false, | ||||
|  | ||||
| 							success: function (data, textStatus, jqXHR) {  | ||||
| 								work_in_progress = false; | ||||
| 								$('#issue_show_mainarea_edit_form').dialog('enable'); | ||||
| 								$('#issue_show_mainarea_edit_form').dialog('close'); | ||||
| 								if (data == 'ok')  | ||||
| 								{ | ||||
| 									// refresh the page to the head revision | ||||
| 									$(location).attr ('href', codepot_merge_path('<?php print site_url(); ?>', '<?php print "/issue/show/{$project->id}/{$hex_issue_id}"; ?>')); | ||||
| 								} | ||||
| 								else | ||||
| 								{ | ||||
| 									show_alert ('<pre>' + codepot_htmlspecialchars(data) + '</pre>', "<?php print $this->lang->line('Error')?>"); | ||||
| 								} | ||||
| 							}, | ||||
|  | ||||
| 							error: function (jqXHR, textStatus, errorThrown) {  | ||||
| 								work_in_progress = false; | ||||
| 								$('#issue_show_mainarea_edit_form').dialog('enable'); | ||||
| 								$('#issue_show_mainarea_edit_form').dialog('close'); | ||||
| 								var errmsg = ''; | ||||
| 								if (errmsg == '' && errorThrown != null) errmsg = errorThrown; | ||||
| 								if (errmsg == '' && textStatus != null) errmsg = textStatus; | ||||
| 								if (errmsg == '') errmsg = 'Unknown error'; | ||||
| 								show_alert ('Failed - ' + errmsg, "<?php print $this->lang->line('Error')?>"); | ||||
| 							} | ||||
| 						}); | ||||
| 					} | ||||
| 					else | ||||
| 					{ | ||||
| 						show_alert ('<pre>NOT SUPPORTED</pre>', "<?php print $this->lang->line('Error')?>"); | ||||
| 					} | ||||
| 				}, | ||||
| 				'<?php print $this->lang->line('Cancel')?>': function () { | ||||
| 					if (work_in_progress) return; | ||||
| 					$('#issue_show_mainarea_edit_form').dialog('close'); | ||||
| 				} | ||||
| 			}, | ||||
|  | ||||
| 			beforeClose: function() {  | ||||
| 				// if importing is in progress, prevent dialog closing | ||||
| 				return !work_in_progress; | ||||
| 			} | ||||
| 		} | ||||
| 	); | ||||
| <?php endif; ?> | ||||
|  | ||||
| 	/* | ||||
| 	$("#issue_change_type").combobox(); | ||||
| 	$("#issue_change_status").combobox(); | ||||
| @ -117,6 +225,15 @@ $(function () { | ||||
| 		}  | ||||
| 	);  | ||||
|  | ||||
| <?php if (isset($login['id']) && $login['id'] != ''): ?> | ||||
| 	$("#issue_show_mainarea_edit_button").button().click ( | ||||
| 		function () {  | ||||
| 			$('#issue_show_mainarea_edit_form').dialog('open');  | ||||
| 			return false; // prevent the default behavior | ||||
| 		} | ||||
| 	); | ||||
| <?php endif; ?> | ||||
|  | ||||
| 	$("#issue_show_mainarea_change_form_open").button().click ( | ||||
| 		function () {  | ||||
| 			$('#issue_show_mainarea_change_form').dialog('open');  | ||||
| @ -176,7 +293,6 @@ $(function () { | ||||
| <!----------------------------------------------------------------------------> | ||||
|  | ||||
| <?php | ||||
| $hexid = $this->converter->AsciiToHex ($issue->id); | ||||
| $this->load->view ( | ||||
| 	'projectbar', | ||||
| 	array ( | ||||
| @ -190,8 +306,8 @@ $this->load->view ( | ||||
|  | ||||
| 		'ctxmenuitems' => array ( | ||||
| 			array ("issue/create/{$project->id}", '<i class="fa fa-plus"></i> ' . $this->lang->line('New')), | ||||
| 			array ("issue/update/{$project->id}/{$hexid}", '<i class="fa fa-edit"></i> ' . $this->lang->line('Edit')), | ||||
| 			array ("issue/delete/{$project->id}/{$hexid}", '<i class="fa fa-trash"></i> ' . $this->lang->line('Delete')) | ||||
| 			array ("issue/update/{$project->id}/{$hex_issue_id}", '<i class="fa fa-edit"></i> ' . $this->lang->line('Edit')), | ||||
| 			array ("issue/delete/{$project->id}/{$hex_issue_id}", '<i class="fa fa-trash"></i> ' . $this->lang->line('Delete')) | ||||
| 		) | ||||
| 	) | ||||
| ); | ||||
| @ -237,6 +353,14 @@ $this->load->view ( | ||||
| 			print ': ';  | ||||
| 			print htmlspecialchars($issue->owner); | ||||
| 		} | ||||
|  | ||||
| 		if (isset($login['id']) && $login['id'] != '') | ||||
| 		{ | ||||
| 			print ' | '; | ||||
| 			print '<a id="issue_show_mainarea_edit_button" href="#">'; | ||||
| 			print $this->lang->line('Edit'); | ||||
| 			print '</a>'; | ||||
| 		} | ||||
| 	?> | ||||
| </div> | ||||
|  | ||||
| @ -246,6 +370,28 @@ $this->load->view ( | ||||
| </pre> | ||||
| </div> <!-- issue_show_mainarea_description --> | ||||
|  | ||||
| <div id="issue_show_mainarea_file_list"> | ||||
| <?php if (!empty($issue->files)): ?> | ||||
| <ul> | ||||
| <?php | ||||
| 	 | ||||
| 	foreach ($issue->files as $f) | ||||
| 	{ | ||||
| 		$hexname = $this->converter->AsciiToHex ($f->filename); | ||||
| 		print '<li>'; | ||||
| 		print anchor ( | ||||
| 			"issue/file/{$project->id}/{$issue->id}/{$hexname}",  | ||||
| 			htmlspecialchars($f->filename) | ||||
| 		); | ||||
|  | ||||
| 		if (!empty($f->description)) printf ('- %s', htmlspecialchars($f->description)); | ||||
| 		print '</li>'; | ||||
| 	} | ||||
| ?> | ||||
| </ul> | ||||
| <?php endif; ?> | ||||
| </div> | ||||
|  | ||||
| <div id="issue_show_mainarea_changes"> | ||||
| <?php | ||||
| 	$commentno = 0; | ||||
| @ -376,11 +522,41 @@ $this->load->view ( | ||||
| 	print '</table>'; | ||||
| ?> | ||||
|  | ||||
|  | ||||
| </div> | ||||
|  | ||||
| <?php if (isset($login['id']) && $login['id'] != ''): ?> | ||||
| <div id='issue_show_mainarea_edit_form'> | ||||
| 	<div style='line-height: 2em;'> | ||||
| 		<?php | ||||
| 		print form_dropdown ( | ||||
| 			'issue_show_edit_type',  | ||||
| 			$issue_type_array, | ||||
| 			set_value('issue_show_edit_type', $issue->type), | ||||
| 			'id="issue_show_mainarea_edit_type" disabled="disabled"' | ||||
| 		); | ||||
| 		?> | ||||
| 		<input type='text' id='issue_show_mainarea_edit_summary' name='issue_home_new_summary' size='50' placeholder='<?php print $this->lang->line('Summary'); ?>' value='<?php print addslashes($issue->summary); ?>'/> | ||||
| 	</div> | ||||
|  | ||||
| 	<div id='issue_show_mainarea_edit_description_tabs' style='width:100%;'> | ||||
| 		<ul> | ||||
| 			<li><a href='#issue_show_mainarea_edit_description_input'><?php print $this->lang->line('Description'); ?></a></li> | ||||
| 			<li><a href='#issue_show_mainarea_edit_description_preview'><?php print $this->lang->line('Preview'); ?></a></li> | ||||
| 		</ul> | ||||
|  | ||||
| 		<div id='issue_show_mainarea_edit_description_input'> | ||||
| 			<textarea type='textarea' id='issue_show_mainarea_edit_description' name='issue_home_new_description' rows=24 cols=100 style='width:100%;'><?php print htmlspecialchars($issue->description); ?></textarea> | ||||
| 		</div> | ||||
| 		<div id='issue_show_mainarea_edit_description_preview' class='form_input_preview'> | ||||
| 		</div> | ||||
| 	</div> | ||||
| </div> | ||||
| <?php endif; ?> | ||||
|  | ||||
| <div id="issue_show_mainarea_change_form"> | ||||
|  | ||||
| 	<?php print form_open("issue/show/{$project->id}/{$hexid}/", 'id="issue_change_form"')?> | ||||
| 	<?php print form_open("issue/show/{$project->id}/{$hex_issue_id}/", 'id="issue_change_form"')?> | ||||
|  | ||||
| 		<input type='hidden' name='issue_change' id='issue_change' value='change' /> | ||||
|  | ||||
| @ -462,6 +638,8 @@ $this->load->view ( | ||||
| 	<?php print $this->lang->line ('ISSUE_MSG_CONFIRM_UNDO')?> | ||||
| </div> | ||||
|  | ||||
| <div id='issue_show_mainarea_alert'></div> | ||||
|  | ||||
| </div> <!-- issue_show_mainarea --> | ||||
|  | ||||
| <div class='footer-pusher'></div> <!-- for sticky footer --> | ||||
| @ -476,8 +654,8 @@ $this->load->view ( | ||||
|  | ||||
|  | ||||
| <?php  | ||||
| 	$creole_base = site_url() . "/wiki/show/{$project->id}/";  | ||||
| 	$creole_attachment_base = site_url() . "/wiki/attachment0/{$project->id}/";  | ||||
| 	$creole_base = site_url() . "/issue/show/{$project->id}/{$issue->id}/";  | ||||
| 	$creole_attachment_base = site_url() . "/issue/file/{$project->id}/{$issue->id}/";  | ||||
| ?> | ||||
|  | ||||
| <script type="text/javascript"> | ||||
|  | ||||
| @ -235,3 +235,33 @@ | ||||
| .ui-tabs .ui-tabs-nav li.ui-state-active { | ||||
| 	border-bottom: 1px solid #fbd850 !important; | ||||
| } | ||||
|  | ||||
| /*----------------------------------------------- | ||||
|  * issue home show - edit issue dialog | ||||
|  *-----------------------------------------------*/ | ||||
| #issue_show_mainarea_edit_description_tabs { | ||||
| 	border: none !important; | ||||
| } | ||||
|  | ||||
| #issue_show_mainarea_edit_description_tabs .ui-tabs-panel { | ||||
| 	padding: 0.2em 0em 0em 0em !important; | ||||
| } | ||||
|  | ||||
| #issue_show_mainarea_edit_description_tabs .ui-widget-header { | ||||
| 	border: none !important; | ||||
| 	background: none !important; | ||||
| 	padding: 0em !important; | ||||
| } | ||||
|  | ||||
| #issue_show_mainarea_edit_description_tabs .ui-tabs-nav { | ||||
| 	padding: 0em !important; | ||||
| } | ||||
|  | ||||
| /* #issue_show_mainarea_edit_description_tabs .ui-tabs-nav li { */ | ||||
| .ui-tabs .ui-tabs-nav li.ui-state-default { | ||||
| 	border-bottom: 1px solid #cccccc !important; | ||||
| } | ||||
|  | ||||
| .ui-tabs .ui-tabs-nav li.ui-state-active { | ||||
| 	border-bottom: 1px solid #fbd850 !important; | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user