4 * SourceForge Generic Tracker facility
6 * SourceForge: Breaking Down the Barriers to Open Source Development
7 * Copyright 1999-2001 (c) VA Linux Systems
8 * Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
9 * http://sourceforge.net
14 require_once $gfcommon.'tracker/Artifact.class.php';
15 require_once $gfcommon.'include/utils_crossref.php';
17 class ArtifactHtml extends Artifact {
20 * ArtifactHtml() - constructor
22 * Use this constructor if you are modifying an existing artifact
24 * @param $ArtifactType object
25 * @param $artifact_id integer (primary key from database)
28 function ArtifactHtml(&$ArtifactType,$artifact_id=false) {
29 return $this->Artifact($ArtifactType,$artifact_id);
33 * show details preformatted (like followups)
35 function showDetails($editable = false) {
36 $result = $this->getDetails();
37 $result = util_gen_cross_ref($result, $this->ArtifactType->Group->getID());
38 //$result = util_line_wrap( $result, 120,"\n");
39 $result = preg_replace('/\r|\n/', '<br />', $result);
42 if ($editable === true) {
43 $title_arr[] = '<div style="width:100%;">' .
44 '<div style="float:left">' . _('Detailed description') . '</div>' .
45 '<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')")) . '</div>' .
49 $title_arr[] = _('Detailed description');
51 echo $GLOBALS['HTML']->listTableTop ($title_arr);
53 echo '<tr ' . $GLOBALS['HTML']->boxGetAltRowStyle(0) .'><td>'. $result. '</td></tr>';
55 echo $GLOBALS['HTML']->listTableBottom();
59 function showMessages() {
60 $result= $this->getMessages();
61 $rows=db_numrows($result);
65 $title_arr[]=_('Message');
67 echo $GLOBALS['HTML']->listTableTop ($title_arr);
69 for ($i=0; $i < $rows; $i++) {
70 echo '<tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'><td>';
72 $params = array('user_id' => db_result($result,$i,'user_id'), 'size' => 's');
73 plugin_hook("user_logo", $params);
76 date(_('Y-m-d H:i'),db_result($result, $i, 'adddate')) .'<br />'.
78 if(db_result($result,$i,'user_id') == 100) {
79 echo db_result($result,$i,'realname');
81 echo util_make_link_u (db_result($result,$i,'user_name'),db_result($result,$i,'user_id'),db_result($result,$i,'realname'));
84 $text = db_result($result, $i, 'body');
85 $text = util_gen_cross_ref($text, $this->ArtifactType->Group->getID());
86 //$text = util_line_wrap( $text, 120,"\n");
87 $text = preg_replace('/\r|\n/', '<br />', $text);
88 echo "<br /><br />".$text.'</td></tr>';
91 echo $GLOBALS['HTML']->listTableBottom();
95 <p>'._('No Followups Have Been Posted').'</p>';
99 function showHistory() {
100 global $artifact_cat_arr,$artifact_grp_arr,$artifact_res_arr;
101 $result=$this->getHistory();
102 $rows= db_numrows($result);
107 $title_arr[]=_('Field');
108 $title_arr[]=_('Old Value');
109 $title_arr[]=_('Date');
110 $title_arr[]=_('By');
112 echo $GLOBALS['HTML']->listTableTop ($title_arr);
114 $artifactType =& $this->getArtifactType();
116 for ($i=0; $i < $rows; $i++) {
117 $field=db_result($result, $i, 'field_name');
119 <tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'><td>'.$field.'</td><td>';
121 if ($field == 'status_id') {
123 echo $artifactType->getStatusName(db_result($result, $i, 'old_value'));
125 } else if ($field == 'assigned_to') {
127 echo user_getname(db_result($result, $i, 'old_value'));
129 } else if ($field == 'close_date') {
130 if (db_result($result, $i, 'old_value'))
131 echo date(_('Y-m-d H:i'),db_result($result, $i, 'old_value'));
136 echo db_result($result, $i, 'old_value');
140 '<td>'. date(_('Y-m-d H:i'),db_result($result, $i, 'entrydate')) .'</td>'.
141 '<td>'. db_result($result, $i, 'user_name'). '</td></tr>';
144 echo $GLOBALS['HTML']->listTableBottom();
148 <p>'._('No Changes Have Been Made to This Item').'</p>';
153 function showRelations() {
154 $aid = $this->getID();
156 // Search for all relations pointing to this record.
158 $res = db_query_params ('SELECT *
159 FROM artifact_extra_field_list, artifact_extra_field_data, artifact_group_list, artifact, groups
161 AND artifact_extra_field_list.extra_field_id=artifact_extra_field_data.extra_field_id
162 AND artifact_group_list.group_artifact_id = artifact_extra_field_list.group_artifact_id
163 AND artifact.artifact_id = artifact_extra_field_data.artifact_id
164 AND groups.group_id = artifact_group_list.group_id
165 AND (field_data = $1 OR field_data LIKE $2 OR field_data LIKE $3 OR field_data LIKE $4)
166 ORDER BY artifact_group_list.group_id ASC, name ASC, artifact.artifact_id ASC',
171 if (db_numrows($res)>0) {
173 <div class="tabbertab" title="<?php echo _('Backward Relations'); ?>">
174 <table border="0" width="80%">
177 <h2><?php echo _('Changes') ?>:</h2>
181 while ($arr = db_fetch_array($res)) {
182 $title = $arr['group_name'].': '.$arr['name'];
183 if ($title != $current) {
184 echo $end.'<strong>'.$title.'</strong>';
186 $end = '<br /><br />';
188 $text = '[#'.$arr['artifact_id'].']';
189 $url = '/tracker/?func=detail&aid='.$arr['artifact_id'].'&group_id='.$arr['group_id'].'&atid='.$arr['group_artifact_id'];
190 $arg = 'title="'.util_html_secure($arr['summary']).'"' ;
191 if ($arr['status_id'] == 2) {
192 $arg .= 'class="artifact_closed"';
194 print '<br/> <a href="'.$url.'" '.$arg.'>'.$text.'</a>'.' <a href="'.$url.'">'.$arr['summary'].'</a> <i>(Relation: '.$arr['field_name'].')</i>';
209 // c-file-style: "bsd"