4 * SourceForge Generic Tracker facility
6 * SourceForge: Breaking Down the Barriers to Open Source Development
7 * Copyright 1999-2001 (c) VA Linux Systems
8 * http://sourceforge.net
13 require_once $gfcommon.'tracker/Artifact.class.php';
14 require_once $gfcommon.'include/utils_crossref.php';
16 class ArtifactHtml extends Artifact {
19 * ArtifactHtml() - constructor
21 * Use this constructor if you are modifying an existing artifact
23 * @param $ArtifactType object
24 * @param $artifact_id integer (primary key from database)
27 function ArtifactHtml(&$ArtifactType,$artifact_id=false) {
28 return $this->Artifact($ArtifactType,$artifact_id);
32 * show details preformatted (like followups)
34 function showDetails($editable = false) {
35 $result = $this->getDetails();
36 $result = util_gen_cross_ref($result, $this->ArtifactType->Group->getID());
37 //$result = util_line_wrap( $result, 120,"\n");
38 $result = preg_replace('/\r?\n/', '<br />', $result);
41 if ($editable === true) {
42 $title_arr[] = '<div style="width:100%;">' .
43 '<div style="float:left">' . _('Detailed description') . '</div>' .
44 '<div style="float:right">' . html_image('ic/forum_edit.gif','37','15',array('title'=>"Click to edit", 'alt'=>"Click to edit", 'onclick'=>"switch2edit(this, 'show', 'edit')", 'border'=>"0")) . '</div>' .
46 html_image('ic/forum_edit.gif','37','15',array(title=>"Click to edit" alt=>"Click to edit" onclick=>"switch2edit(this, 'show', 'edit')", border=>"0"))
52 $title_arr[] = _('Detailed description');
54 echo $GLOBALS['HTML']->listTableTop ($title_arr);
56 echo '<tr ' . $GLOBALS['HTML']->boxGetAltRowStyle(0) .'><td>'. $result. '</td></tr>';
58 echo $GLOBALS['HTML']->listTableBottom();
62 function showMessages() {
63 $result= $this->getMessages();
64 $rows=db_numrows($result);
68 $title_arr[]=_('Message');
70 echo $GLOBALS['HTML']->listTableTop ($title_arr);
72 for ($i=0; $i < $rows; $i++) {
73 echo '<tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'><td>'.
75 date(_('Y-m-d H:i'),db_result($result, $i, 'adddate')) .'<br />'.
77 if(db_result($result,$i,'user_id') == 100) {
78 echo db_result($result,$i,'realname');
80 echo util_make_link_u (db_result($result,$i,'user_name'),db_result($result,$i,'user_id'),db_result($result,$i,'realname'));
83 $text = db_result($result, $i, 'body');
84 $text = util_gen_cross_ref($text, $this->ArtifactType->Group->getID());
85 //$text = util_line_wrap( $text, 120,"\n");
86 $text = preg_replace('/\r?\n/', '<br />', $text);
87 echo "<br /><br />".$text.'</td></tr>';
90 echo $GLOBALS['HTML']->listTableBottom();
94 <p>'._('No Followups Have Been Posted').'</p>';
98 function showHistory() {
99 global $artifact_cat_arr,$artifact_grp_arr,$artifact_res_arr;
100 $result=$this->getHistory();
101 $rows= db_numrows($result);
106 $title_arr[]=_('Field');
107 $title_arr[]=_('Old Value');
108 $title_arr[]=_('Date');
109 $title_arr[]=_('By');
111 echo $GLOBALS['HTML']->listTableTop ($title_arr);
113 $artifactType =& $this->getArtifactType();
115 for ($i=0; $i < $rows; $i++) {
116 $field=db_result($result, $i, 'field_name');
118 <tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'><td>'.$field.'</td><td>';
120 if ($field == 'status_id') {
122 echo $artifactType->getStatusName(db_result($result, $i, 'old_value'));
124 } else if ($field == 'assigned_to') {
126 echo user_getname(db_result($result, $i, 'old_value'));
128 } else if ($field == 'close_date') {
129 if (db_result($result, $i, 'old_value'))
130 echo date(_('Y-m-d H:i'),db_result($result, $i, 'old_value'));
135 echo db_result($result, $i, 'old_value');
139 '<td>'. date(_('Y-m-d H:i'),db_result($result, $i, 'entrydate')) .'</td>'.
140 '<td>'. db_result($result, $i, 'user_name'). '</td></tr>';
143 echo $GLOBALS['HTML']->listTableBottom();
147 <p>'._('No Changes Have Been Made to This Item').'</p>';
152 function showRelations() {
153 $aid = $this->getID();
155 // Search for all relations pointing to this record.
157 $res = db_query_params ('SELECT *
158 FROM artifact_extra_field_list, artifact_extra_field_data, artifact_group_list, artifact, groups
160 AND artifact_extra_field_list.extra_field_id=artifact_extra_field_data.extra_field_id
161 AND artifact_group_list.group_artifact_id = artifact_extra_field_list.group_artifact_id
162 AND artifact.artifact_id = artifact_extra_field_data.artifact_id
163 AND groups.group_id = artifact_group_list.group_id
164 AND (field_data = $1 OR field_data LIKE $2 OR field_data LIKE $3 OR field_data LIKE $4)
165 ORDER BY artifact_group_list.group_id ASC, name ASC, artifact.artifact_id ASC',
170 if (db_numrows($res)>0) {
172 <div class="tabbertab" title="<?php echo _('Backward Relations'); ?>">
173 <table border="0" width="80%">
176 <h2><?php echo _('Changes') ?>:</h2>
180 while ($arr = db_fetch_array($res)) {
181 $title = $arr['group_name'].': '.$arr['name'];
182 if ($title != $current) {
183 echo $end.'<strong>'.$title.'</strong>';
185 $end = '<br /><br />';
187 $text = '[#'.$arr['artifact_id'].']';
188 $url = '/tracker/?func=detail&aid='.$arr['artifact_id'].'&group_id='.$arr['group_id'].'&atid='.$arr['group_artifact_id'];
189 $arg = 'title="'.$arr['summary'].'"' ;
190 if ($arr['status_id'] == 2) {
191 $arg .= 'class="artifact_closed"';
193 print '<br/> <a href="'.$url.'" '.$arg.'>'.$text.'</a>'.' <a href="'.$url.'">'.$arr['summary'].'</a> <i>(Relation: '.$arr['field_name'].')</i>';
208 // c-file-style: "bsd"