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 = nl2br($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() {
62 if (session_loggedin()) {
63 $u = session_get_user();
64 $order = $u->getPreference('tracker_messages_order');
66 if (!isset($order) || !$order) $order = 'up';
68 $result= $this->getMessages($order);
69 $rows=db_numrows($result);
73 $title_arr[]=_('Message');
83 <script type="text/javascript">/* <![CDATA[ */
84 function show_edit_button(id) {
85 var element = document.getElementById(id);
86 if (element) element.style.display = 'block';
88 function hide_edit_button(id) {
89 var element = document.getElementById(id);
90 if (element) element.style.display = 'none';
94 echo '<img style="display: none;" id="img_order" src="" alt="" />';
95 echo '<table class="listing full" id="messages_list">
99 <a name="sort" href="#sort" class="sortheader" onclick="thead = true;ts_resortTable(this, 0);submitOrder();return false;">Message<span id="order_span" sortdir="'.$order.'" class="sortarrow"> <img src="/images/sort_'.$img_order.'.gif" alt="'.$char_order.'" /></span></a></th>
104 for ($i=0; $i < $rows; $i++) {
105 echo '<tr onmouseover="show_edit_button(\'edit_bt_'.$i.'\')" onmouseout="hide_edit_button(\'edit_bt_'.$i.'\')" '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'><td>';
107 $params = array('user_id' => db_result($result,$i,'user_id'), 'size' => 's');
108 plugin_hook("user_logo", $params);
110 echo '<span style="float:left">';
112 date(_('Y-m-d H:i'),db_result($result, $i, 'adddate')) .'<br />'.
114 if(db_result($result,$i,'user_id') == 100) {
115 echo db_result($result,$i,'realname');
117 echo util_make_link_u (db_result($result,$i,'user_name'),db_result($result,$i,'user_id'),db_result($result,$i,'realname'));
121 echo '<p style="clear: both;padding-top: 1em;">';
122 $text = db_result($result, $i, 'body');
123 $text = util_gen_cross_ref($text, $this->ArtifactType->Group->getID());
124 //$text = util_line_wrap( $text, 120,"\n");
125 $text = nl2br($text);
131 echo $GLOBALS['HTML']->listTableBottom();
135 <p>'._('No Followups Have Been Posted').'</p>';
139 function showHistory() {
140 $result=$this->getHistory();
141 $rows= db_numrows($result);
146 $title_arr[]=_('Field');
147 $title_arr[]=_('Old Value');
148 $title_arr[]=_('Date');
149 $title_arr[]=_('By');
151 echo $GLOBALS['HTML']->listTableTop ($title_arr);
153 $artifactType =& $this->getArtifactType();
155 for ($i=0; $i < $rows; $i++) {
156 $field=db_result($result, $i, 'field_name');
158 <tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'><td>'.$field.'</td><td>';
160 if ($field == 'status_id') {
162 echo $artifactType->getStatusName(db_result($result, $i, 'old_value'));
164 } elseif ($field == 'assigned_to') {
166 echo user_getname(db_result($result, $i, 'old_value'));
168 } elseif ($field == 'close_date') {
169 if (db_result($result, $i, 'old_value'))
170 echo date(_('Y-m-d H:i'),db_result($result, $i, 'old_value'));
175 echo db_result($result, $i, 'old_value');
179 '<td>'. date(_('Y-m-d H:i'),db_result($result, $i, 'entrydate')) .'</td>'.
180 '<td>'. db_result($result, $i, 'user_name'). '</td></tr>';
183 echo $GLOBALS['HTML']->listTableBottom();
187 <p>'._('No Changes Have Been Made to This Item').'</p>';
192 function showRelations() {
193 $aid = $this->getID();
195 // Search for all relations pointing to this record.
197 $res = db_query_params ('SELECT *
198 FROM artifact_extra_field_list, artifact_extra_field_data, artifact_group_list, artifact, groups
200 AND artifact_extra_field_list.extra_field_id=artifact_extra_field_data.extra_field_id
201 AND artifact_group_list.group_artifact_id = artifact_extra_field_list.group_artifact_id
202 AND artifact.artifact_id = artifact_extra_field_data.artifact_id
203 AND groups.group_id = artifact_group_list.group_id
204 AND (field_data = $1 OR field_data LIKE $2 OR field_data LIKE $3 OR field_data LIKE $4)
205 ORDER BY artifact_group_list.group_id ASC, name ASC, artifact.artifact_id ASC',
210 if (db_numrows($res)>0) {
212 <div class="tabbertab" title="<?php echo _('Backward Relations'); ?>">
213 <table class="fullwidth">
216 <h2><?php echo _('Changes') ?>:</h2>
220 while ($arr = db_fetch_array($res)) {
221 $title = $arr['group_name'].': '.$arr['name'];
222 if ($title != $current) {
223 echo $end.'<strong>'.$title.'</strong>';
225 $end = '<br /><br />';
227 $text = '[#'.$arr['artifact_id'].']';
228 $url = '/tracker/?func=detail&aid='.$arr['artifact_id'].'&group_id='.$arr['group_id'].'&atid='.$arr['group_artifact_id'];
229 $arg = 'title="'.util_html_secure($arr['summary']).'"' ;
230 if ($arr['status_id'] == 2) {
231 $arg .= 'class="artifact_closed"';
233 print '<br/> <a href="'.$url.'" '.$arg.'>'.$text.'</a>'.' <a href="'.$url.'">'.$arr['summary'].'</a> <i>(Relation: '.$arr['field_name'].')</i>';
246 // c-file-style: "bsd"