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-2012 Alain Peyrat - Alcatel-Lucent
9 * Copyright 2011, Franck Villaume - Capgemini
10 * http://fusionforge.org
12 * This file is part of FusionForge. FusionForge is free software;
13 * you can redistribute it and/or modify it under the terms of the
14 * GNU General Public License as published by the Free Software
15 * Foundation; either version 2 of the Licence, or (at your option)
18 * FusionForge is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License along
24 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
25 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
28 require_once $gfcommon.'tracker/Artifact.class.php';
29 require_once $gfcommon.'include/utils_crossref.php';
31 class ArtifactHtml extends Artifact {
34 * show details preformatted (like followups)
36 function showDetails($editable = false) {
37 $result = $this->getDetails();
38 $result = util_gen_cross_ref($result, $this->ArtifactType->Group->getID());
39 //$result = util_line_wrap( $result, 120,"\n");
40 $result = preg_replace('/\r|\n/', '<br />', $result);
43 if ($editable === true) {
44 $title_arr[] = '<div style="width:100%;">' .
45 '<div style="float:left">' . _('Detailed description') . '</div>' .
46 '<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>' .
50 $title_arr[] = _('Detailed description');
52 echo $GLOBALS['HTML']->listTableTop ($title_arr);
54 echo '<tr ' . $GLOBALS['HTML']->boxGetAltRowStyle(0) .'><td>'. $result. '</td></tr>';
56 echo $GLOBALS['HTML']->listTableBottom();
60 function showMessages($asc=true) {
61 $result= $this->getMessages($asc);
62 $rows=db_numrows($result);
66 $title_arr[]=_('Message');
68 echo $GLOBALS['HTML']->listTableTop ($title_arr);
70 for ($i=0; $i < $rows; $i++) {
71 echo '<tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'><td>';
73 $params = array('user_id' => db_result($result,$i,'user_id'), 'size' => 's');
74 plugin_hook("user_logo", $params);
77 date(_('Y-m-d H:i'),db_result($result, $i, 'adddate')) .'<br />'.
79 if(db_result($result,$i,'user_id') == 100) {
80 echo db_result($result,$i,'realname');
82 echo util_make_link_u (db_result($result,$i,'user_name'),db_result($result,$i,'user_id'),db_result($result,$i,'realname'));
85 $text = db_result($result, $i, 'body');
86 $text = util_gen_cross_ref($text, $this->ArtifactType->Group->getID());
87 //$text = util_line_wrap( $text, 120,"\n");
88 $text = preg_replace('/\r|\n/', '<br />', $text);
89 echo "<br /><br />".$text.'</td></tr>';
92 echo $GLOBALS['HTML']->listTableBottom();
96 <p>'._('No Followups Have Been Posted').'</p>';
100 function showHistory() {
101 global $artifact_cat_arr,$artifact_grp_arr,$artifact_res_arr;
102 $result=$this->getHistory();
103 $rows= db_numrows($result);
108 $title_arr[]=_('Field');
109 $title_arr[]=_('Old Value');
110 $title_arr[]=_('Date');
111 $title_arr[]=_('By');
113 echo $GLOBALS['HTML']->listTableTop ($title_arr);
115 $artifactType =& $this->getArtifactType();
117 for ($i=0; $i < $rows; $i++) {
118 $field=db_result($result, $i, 'field_name');
120 <tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'><td>'.$field.'</td><td>';
122 if ($field == 'status_id') {
124 echo $artifactType->getStatusName(db_result($result, $i, 'old_value'));
126 } else if ($field == 'assigned_to') {
128 echo user_getname(db_result($result, $i, 'old_value'));
130 } else if ($field == 'close_date') {
131 if (db_result($result, $i, 'old_value'))
132 echo date(_('Y-m-d H:i'),db_result($result, $i, 'old_value'));
137 echo db_result($result, $i, 'old_value');
141 '<td>'. date(_('Y-m-d H:i'),db_result($result, $i, 'entrydate')) .'</td>'.
142 '<td>'. db_result($result, $i, 'user_name'). '</td></tr>';
145 echo $GLOBALS['HTML']->listTableBottom();
149 <p>'._('No Changes Have Been Made to This Item').'</p>';
154 function showRelations() {
155 $aid = $this->getID();
157 // Search for all relations pointing to this record.
159 $res = db_query_params ('SELECT *
160 FROM artifact_extra_field_list, artifact_extra_field_data, artifact_group_list, artifact, groups
162 AND artifact_extra_field_list.extra_field_id=artifact_extra_field_data.extra_field_id
163 AND artifact_group_list.group_artifact_id = artifact_extra_field_list.group_artifact_id
164 AND artifact.artifact_id = artifact_extra_field_data.artifact_id
165 AND groups.group_id = artifact_group_list.group_id
166 AND (field_data = $1 OR field_data LIKE $2 OR field_data LIKE $3 OR field_data LIKE $4)
167 ORDER BY artifact_group_list.group_id ASC, name ASC, artifact.artifact_id ASC',
172 if (db_numrows($res)>0) {
174 <div class="tabbertab" title="<?php echo _('Backward Relations'); ?>">
175 <table class="fullwidth">
178 <h2><?php echo _('Changes') ?>:</h2>
182 while ($arr = db_fetch_array($res)) {
183 $title = $arr['group_name'].': '.$arr['name'];
184 if ($title != $current) {
185 echo $end.'<strong>'.$title.'</strong>';
187 $end = '<br /><br />';
189 $text = '[#'.$arr['artifact_id'].']';
190 $url = '/tracker/?func=detail&aid='.$arr['artifact_id'].'&group_id='.$arr['group_id'].'&atid='.$arr['group_artifact_id'];
191 $arg = 'title="'.util_html_secure($arr['summary']).'"' ;
192 if ($arr['status_id'] == 2) {
193 $arg .= 'class="artifact_closed"';
195 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"