00001 <?php
00002 # This file is part of the Savane project
00003 # <http://gna.org/projects/savane/>
00004 #
00005 # $Id: detail.php 5499 2006-02-26 11:44:08Z toddy $
00006 #
00007 # Copyright 1999-2000 (c) The SourceForge Crew
00008 # Copyright 2001-2002 (c) Laurent Julliard, CodeX Team, Xerox
00009 #
00010 # Copyright 2002-2006 (c) Mathieu Roy <yeupou--gnu.org>
00011 # Yves Perrin <yves.perrin--cern.ch>
00012 #
00013 #
00014 # The Savane project is free software; you can redistribute it and/or
00015 # modify it under the terms of the GNU General Public License
00016 # as published by the Free Software Foundation; either version 2
00017 # of the License, or (at your option) any later version.
00018 #
00019 # The Savane project is distributed in the hope that it will be useful,
00020 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00021 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00022 # GNU General Public License for more details.
00023 #
00024 # You should have received a copy of the GNU General Public License
00025 # along with the Savane project; if not, write to the Free Software
00026 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00027
00028 $sql="SELECT * FROM ".ARTIFACT." WHERE bug_id='$item_id' AND group_id='$group_id'";
00029 $fields_per_line=2;
00030 $max_size=40;
00031
00032 $result=db_query($sql);
00033
00034 if (db_numrows($result) > 0)
00035 {
00036 # ################################ Start the form
00037
00038 # Defines the item name, converting bugs to bug.
00039 # (Ideally, the artifact bugs should be named bug)
00040 $item_name = utils_get_tracker_prefix(ARTIFACT)." #".$item_id;
00041 # Defines the item link
00042 $item_link = utils_link("?".$item_id, $item_name);
00043
00044 # Check whether this item is private or not. If it is private, show only to
00045 # the submitter
00046 unset($private_intro);
00047 if (db_result($result,0,'privacy') == "2")
00048 {
00049 if (member_check_private(0, $group_id))
00050 {
00051 # Nothing worth being mentioned
00052 }
00053 elseif (db_result($result,0,'submitted_by') == user_getid())
00054 {
00055 $private_intro = _("This item is private. However, you are allowed to read it as you submitted it.");
00056 }
00057 else
00058 {
00059 exit_error(_("This item is private."));
00060 }
00061 }
00062
00063 # Check if it is possible for the current user to post a comment. If not
00064 # add a message
00065 if (!group_restrictions_check($group_id, ARTIFACT, 2))
00066 {
00067 $private_intro .= ' '._("You are not allowed to post comments on this tracker with your current authentification level.");
00068 }
00069
00070
00071 trackers_header(array ('title'=>$item_name.", ".utils_cutstring(db_result($result,0,'summary'))));
00072
00073 print $private_intro;
00074
00075 print '<h2 class="'.utils_get_priority_color(db_result($result,0,'priority'), db_result($result,0,'status_id')).'">'.sprintf(_("<em>%s</em> overview:"), $item_link).' '.db_result($result,0,'summary').'</h2>';
00076
00077 print form_header($PHP_SELF, $form_id, "post", 'enctype="multipart/form-data" name="item_form"');
00078 print form_input("hidden", "func", "postaddcomment");
00079 print form_input("hidden", "group_id", $group_id);
00080 print form_input("hidden", "item_id", $item_id);
00081
00082 # Colspan explanation:
00083 #
00084 # We want the following, twice much space for the value than for the label
00085 #
00086 # | Label: Value________| Label: Value______ |
00087 # | Label: Value_____________________________ |
00088 #
00089 # So we have 4 column large via colspan.
00090
00091 print '
00092
00093 <table cellpadding="0" width="100%">
00094 <tr>
00095 <td class="preinput" width="15%">'._("Submitted by:").' </td>
00096 <td width="35%">'.utils_user_link(user_getname(db_result($result,0,'submitted_by')), user_getrealname(db_result($result,0,'submitted_by'))).'</td>
00097 <td colspan="'.($fields_per_line).'" align="center" width="50%" valign="top"><span class="noprint">'.form_submit(_("Submit Changes").'" class="bold', "submit").'</span></td>
00098 </tr>
00099 <tr>
00100 <td class="preinput" width="15%">'._("Submitted on:").' </td>
00101 <td width="35%">'.format_date($sys_datefmt,db_result($result,0,'date')).'</td>
00102 <td colspan="'.($fields_per_line).'" align="center" width="50%" valign="top"> </td>
00103 </tr>';
00104 $votes = db_result($result,0,'vote');
00105
00106 if ($votes)
00107 {
00108 # display vote here if any, anything else is handled below
00109 print '
00110 <tr>
00111 <td class="preinput" width="15%">'._("Votes:").' </td>
00112 <td width="35%"><a href="#votes">'.$votes.'</a></td>
00113 <td colspan="'.($fields_per_line).'" width="50%"> </td>
00114 </tr>
00115 ';
00116
00117 }
00118
00119 print '<tr><td colspan="'.($fields_per_line*2).'"> </td></tr>';
00120
00121 # Print special fields
00122 $i=0;
00123 $j=0;
00124 while ( $field_name = trackers_list_all_fields() )
00125 {
00126 # if the field is a special field (except summary and details)
00127 # or if not used by this project then skip it.
00128 if ( (!trackers_data_is_special($field_name) || $field_name=='summary' || $field_name=='details') &&
00129 trackers_data_is_used($field_name) )
00130 {
00131
00132 # print the originator email field only if it was posted by
00133 # an anonymous user
00134 if ($field_name != 'originator_email' ||
00135 ($field_name == 'originator_email' && db_result($result,0,'submitted_by') == '100'))
00136 {
00137
00138 # display the bug field
00139 # if field size is greatest than max_size chars then force it to
00140 # appear alone on a new line or it wont fit in the page
00141 $field_value = db_result($result,0,$field_name);
00142 list($sz,) = trackers_data_get_display_size($field_name);
00143
00144 if ($field_name == 'details')
00145 { $field_value = utils_rich_markup($field_value); }
00146
00147 $field_display = trackers_field_display($field_name,$group_id,$field_value,false,true,true);
00148
00149 $label = trackers_field_label_display($field_name,$group_id,false,false);
00150 $value = trackers_field_display($field_name,$group_id,$field_value,false,false,true);
00151
00152 # Save the assigned to value for later.
00153 # Also make the user link for this same field
00154 if ($field_name == 'assigned_to')
00155 {
00156 $item_assigned_to = trackers_field_display($field_name,$group_id,$field_value,false,false,true);
00157
00158 $value = utils_user_link(user_getname($field_value), user_getrealname($field_value));
00159 }
00160 # Details need a specific div
00161 if ($field_name == 'details')
00162 {
00163 $value = '<div class="trackersoriginalsubmission">'.$value.'</div>';
00164 }
00165
00166
00167 # Fields colors
00168 unset($field_class, $row_class);
00169 if ($previous_form_bad_fields && array_key_exists($field_name, $previous_form_bad_fields))
00170 {
00171 # We highlight fields that were not properly/completely
00172 # filled.
00173 $field_class = ' class="highlight"';
00174 }
00175 if ($j % 2 && $field_name != 'details')
00176 {
00177 # We keep the original submission with the default
00178 # background color, for lisibility sake
00179 #
00180 # We also use the boxitem background color only one time
00181 # out of two, to keep the page light
00182 $row_class = ' class="'.utils_altrow($j+1).'"';
00183 }
00184
00185 if ($sz > $max_size)
00186 {
00187 # Field getting one line for itself
00188
00189 # Each time change the background color
00190 $j++;
00191
00192 print "\n<tr".$row_class.">".
00193 '<td valign="middle" '.$field_class.' width="15%">'.$label.'</td>'.
00194 '<td valign="middle" '.$field_class.' colspan="'.(2*$fields_per_line-1).'" width="75%">'.
00195 $value.'</td>'.
00196 "\n</tr>";
00197 $i=0;
00198 }
00199 else
00200 {
00201 # Field getting half of a line for itself
00202
00203
00204 if (!($i % $fields_per_line))
00205 {
00206 # Every one out of two, prepare the background color change.
00207 # We do that at this moment because we cannot be sure
00208 # there will be another field on this line.
00209 $j++;
00210 }
00211
00212 print ($i % $fields_per_line ? '':"\n<tr".$row_class.">");
00213 print '<td valign="middle"'.$field_class.' width="15%">'.$label.'</td>'.
00214 '<td valign="middle"'.$field_class.' width="35%">'.$value.'</td>';
00215 $i++;
00216 print ($i % $fields_per_line ? '':"\n</tr>");
00217 }
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235 }
00236 }
00237 }
00238
00239 print '</table>';
00240 print '<p> </p>';
00241
00242 # ################################ Shortcuts
00243
00244 print '<div class="noprint"><h2 class="'.utils_get_priority_color(db_result($result,0,'priority'), db_result($result,0,'status_id')).'">'.sprintf(_("<em>%s</em> details:"), $item_link).'</h2>';
00245 print ' - <a href="#comments">'._("Follow-up Comments").'</a><br />';
00246 print ' - <a href="#attached">'._("Attached Files").'</a><br />';
00247 print ' - <a href="#dependencies">'._("Dependencies").'</a><br />';
00248 print ' - <a href="#cc">'._("Mail Notification Carbon-Copy List").'</a><br />';
00249 if (trackers_data_is_used("vote"))
00250 {
00251 print ' - <a href="#votes">'._("Votes").'</a><br />';
00252 }
00253 print ' - <a href="#history">'._("History").'</a><br />';
00254 print '<p> </p></div>';
00255
00256
00257 # ################################ Comments
00258
00259 print '<h3>'.html_anchor(_("Follow-up Comments"), 'comments').'</h3><div class="noprint">';
00260 if (group_restrictions_check($group_id, ARTIFACT, 2))
00261 {
00262 # I18N
00263 # The sentence will be shown as follows:
00264 # (Note: you can add pointers to other items by typing artifact #nnn
00265 # where artifact is one of support, bug, task, patch, recipe, file
00266 # and nnn is the item id number.)
00267 printf (_("(Note: you can add pointers to other items by typing %s where %s is one of %s and %s is the item id number.)"),
00268 "<em>artifact #nnn</em>",
00269 "<em>artifact</em>",
00270 "<em>support, bug, task, patch, recipe, file</em>",
00271 "<em>nnn</em>");
00272 print '<p> ';
00273 print trackers_field_textarea('comment','');
00274 print '<p>';
00275
00276 if (!user_isloggedin())
00277 {
00278 print '<h2 class="warn">'._("You are not logged in").'</h2><p>';
00279 printf (_("Please %slog in,%s so followups can be emailed to you."),'<a href="'.$GLOBALS['sys_home'].'account/login.php?uri='.urlencode($REQUEST_URI).'">','</a>');
00280 print '</p>';
00281 }
00282 print '<p> </p></div>';
00283 }
00284
00285 print show_item_details($item_id,$group_id,0,$item_assigned_to);
00286
00287 print '<p> </p>';
00288
00289 # ################################ Attached Files
00290
00291 print '<h3>'.html_anchor(_("Attached Files"), "attached").'</h3>';
00292
00293 if (group_restrictions_check($group_id, ARTIFACT, 2))
00294 {
00295 print '<p class="noprint"><span class="preinput"> '._("Attach File:").'</span><br />
00296 <input type="file" name="input_file" size="40" />
00297 <br />
00298 <span class="preinput">'._("File Description:").'</span><br />
00299 <input type="text" name="file_description" size="60" maxlength="255" />
00300 </p><p>';
00301 }
00302
00303 print show_item_attached_files($item_id,$group_id);
00304
00305 print '</p><p> </p>';
00306
00307 # ################################ Dependancies
00308
00309 print '<h3>'.html_anchor(_("Dependencies"), "dependencies").'</h3>';
00310
00311 print show_item_dependency($item_id);
00312
00313 print '<p></p>';
00314
00315 print show_dependent_item($item_id);
00316
00317 print '<p> </p>';
00318
00319 # ################################ Mail notification
00320
00321 print '<h3>'.html_anchor(_("Mail Notification Carbon-Copy List"), "cc").'</h3>';
00322 if (user_isloggedin())
00323 {
00324 print '<p class="noprint">';
00325 printf (_("(Note: for %s users, you can use their login name rather than their email addresses.)"), $GLOBALS['sys_name']);
00326 print '</p><p class="noprint">
00327 <span class="preinput">'._("Add an email address that should receive carbon copies of updates of this item:").'</span><br /> <input type="text" name="add_cc" size="30" /><br />
00328 <span class="preinput">'._("Comment:").'</span><br /> <input type="text" name="cc_comment" size="40" maxlength="255" /><p>';
00329 }
00330
00331 show_item_cc_list($item_id, $group_id);
00332
00333 print '<p> </p>';
00334
00335 # ################################ Votes
00336
00337 if (trackers_data_is_used("vote"))
00338 {
00339 print '<h3>'.html_anchor(_("Votes"), "votes").'</h3>';
00340 print '<p>'.sprintf(ngettext("There is %s vote so far.", "There are %s votes so far.", $votes), $votes).' '._("Votes easily highlight which items people would like to see resolved in priority, independantly of the priority of the item set by tracker managers.").'</p><p class="noprint">';
00341
00342 if (trackers_data_is_showed_on_add("vote") || member_check(user_getid(), $group_id))
00343 {
00344
00345 if (user_isloggedin())
00346 {
00347
00348 $votes_given = trackers_votes_user_giventoitem_count(user_getid(), ARTIFACT, $item_id);
00349 $votes_remaining = trackers_votes_user_remains_count(user_getid()) + $votes_given;
00350 if (!$new_vote)
00351 { $new_vote = $votes_given; }
00352
00353 # Show how many vote he already gave and allows to remove
00354 # or give more
00355 # votes.
00356 # The number of remaining points must be 100 - others votes
00357
00358 print '<span class="preinput">'._("Your vote:").'</span><br /> <input type="text" name="new_vote" size="3" maxlength="3" value="'.$new_vote.'" /> '.sprintf(ngettext("/ %s remaining vote", "/ %s remaining votes", $votes_remaining), $votes_remaining);
00359 print '</p>';
00360 }
00361 else
00362 {
00363 print '<span class="warn">'._("Only logged-in users can vote.").'</span></p>';
00364 }
00365 }
00366 else
00367 {
00368 print '<span class="warn">'._("Only project members can vote.").'</span></p>';
00369 }
00370
00371 print '<p> </p>';
00372 }
00373
00374
00375 # ################################ Submit
00376
00377 print '<div align="center" class="noprint">'.form_submit(_("Submit Changes").'" class="bold', "submit").'</form></div>
00378 ';
00379
00380
00381
00382 # History
00383
00384 print '<p> </p><p> </p>';
00385 show_item_history($item_id,$group_id);
00386
00387 trackers_footer(array());
00388 }
00389 else
00390 {
00391 exit_error(_("No item found with that id."));
00392 }
00393
00394
00395 ?>