00001 <?php
00002 # This file is part of the Savane project
00003 # <http://gna.org/projects/savane/>
00004 #
00005 # $Id: mod.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 # The Savane project is free software; you can redistribute it and/or
00014 # modify it under the terms of the GNU General Public License
00015 # as published by the Free Software Foundation; either version 2
00016 # of the License, or (at your option) any later version.
00017 #
00018 # The Savane project is distributed in the hope that it will be useful,
00019 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00020 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00021 # GNU General Public License for more details.
00022 #
00023 # You should have received a copy of the GNU General Public License
00024 # along with the Savane project; if not, write to the Free Software
00025 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00026
00027
00028 # Need search functions.
00029 require_directory("search");
00030
00031 # Get parameters
00032 $depends_search_only_artifact = sane_post('depends_search_only_artifact');
00033 $depends_search_only_project = sane_post('depends_search_only_project');
00034
00035 $sql="SELECT * FROM ".ARTIFACT." WHERE bug_id='$item_id' AND group_id='$group_id'";
00036 $fields_per_line=2;
00037 $max_size=40;
00038
00039 $result=db_query($sql);
00040
00041 if (db_numrows($result) > 0)
00042 {
00043
00044 # Defines the item name, converting bugs to bug.
00045 # (Ideally, the artifact bugs should be named bug)
00046 $item_name = utils_get_tracker_prefix(ARTIFACT)." #".$item_id;
00047 # Defines the item link
00048 $item_link = utils_link("?".$item_id, $item_name);
00049
00050 # Check whether this item is private or not. If it is private, show only to
00051 # the submitter or to people that got the right to see private items
00052 unset($private_intro);
00053 if (db_result($result,0,'privacy') == "2")
00054 {
00055 if (member_check_private(0, $group_id))
00056 {
00057 # Nothing worth being mentioned
00058 }
00059 elseif (db_result($result,0,'submitted_by') == user_getid())
00060 {
00061 $private_intro = _("This item is private. However, you are allowed to read it as you submitted it.");
00062 }
00063 else
00064 {
00065 exit_error(_("This item is private. You are not listed as member allowed to read private items."));
00066 }
00067 }
00068
00069 # yeupou, 2005-09-11: I dont think this stuff still means something.
00070 # so it is commented out.
00071 #
00072 # # Prepare all the necessary fields in case the user wants to
00073 # # Create a new task based on this bug
00074 #
00075 # # assigned_to is passed along
00076 # $assigned_to = db_result($result,0,'assigned_to');
00077 #
00078 # # Check if hours is used. If so pass it along as well
00079 # if ( trackers_data_is_used('hours') )
00080 # {
00081 # $hours = db_result($result,0,'hours');
00082 # }
00083 # else
00084 # {
00085 # $hours = '';
00086 # }
00087 #
00088 # # Insert a reference to the originating bug in the task description
00089 # # yeupou, 2005-09-11: What task description?
00090 # $task_details = db_result($result,0,'details')."\n\nSee ".ARTIFACT." #$item_id\nhttp://".
00091 # $GLOBALS['sys_default_domain']."/bugs/?func=detailitem&item_id=$item_id&group_id=$group_id";
00092 #
00093
00094 trackers_header(array ('title'=>$item_name.", ".utils_cutstring(db_result($result,0,'summary')),
00095 # 'create_task'=>'Create task',
00096 # 'summary' => db_result($result,0,'summary'),
00097 # 'details' => $task_details,
00098 # 'assigned_to' => $assigned_to,
00099 # 'hours' => $hours,
00100 # 'item_id' => $item_id
00101 ));
00102
00103 # ################################ Check if the user have a specific role
00104
00105 if (member_check(0,$group_id,member_create_tracker_flag(ARTIFACT).'2', 1))
00106 {
00107 print help(_("You are both technician and manager for this tracker."),
00108 array(
00109 _("technician")=>_("can be assigned items, cannot change status or priority"),
00110 _("manager")=>_("fully manage the items")
00111 ));
00112
00113 }
00114 elseif (member_check(0,$group_id,member_create_tracker_flag(ARTIFACT).'1', 1))
00115 {
00116 print help(_("You are technician for this tracker."),
00117 array(
00118 _("technician")=>_("you can be assigned tracker's items, but you cannot reassign items, change priority nor open/close")
00119 ));
00120 }
00121 elseif (member_check(0,$group_id,member_create_tracker_flag(ARTIFACT).'3', 1))
00122 {
00123 print help(_("You are manager for this tracker."),
00124 array(
00125 _("manager")=>_("you can fully manage the trackers items, including assigning items to technicians, reassign items over trackers and projects, changing priority and open/close items")
00126 ));
00127 }
00128
00129 # ################################ Start the form
00130
00131 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>';
00132
00133 print form_header($PHP_SELF, $form_id, "post", 'enctype="multipart/form-data" name="item_form"');
00134 print form_input("hidden", "func", "postmoditem");
00135 print form_input("hidden", "group_id", $group_id);
00136 print form_input("hidden", "item_id", $item_id);
00137
00138 # Colspan explanation:
00139 #
00140 # We want the following, twice much space for the value than for the label
00141 #
00142 # | Label: Value________| Label: Value______ |
00143 # | Label: Value_____________________________ |
00144 #
00145 # So we have 4 column large via colspan.
00146
00147 print '
00148
00149 <table cellpadding="0" width="100%">
00150 <tr>
00151 <td class="preinput" width="15%">'._("Submitted by:").' </td>
00152 <td width="35%">'.utils_user_link(user_getname(db_result($result,0,'submitted_by')), user_getrealname(db_result($result,0,'submitted_by'))).'</td>
00153 <td colspan="'.($fields_per_line).'" width="50%" align="center" valign="top"><span class="noprint">'.form_submit(_("Submit Changes and Browse Items").'" class="bold', "submit").'</span></td>
00154 </tr>
00155 <tr>
00156 <td class="preinput" width="15%">'._("Submitted on:").' </td>
00157 <td width="35%">'.format_date($sys_datefmt,db_result($result,0,'date')).'</td>
00158 <td colspan="'.($fields_per_line).'" width="50%" align="center" valign="top"><span class="noprint">'.form_submit(_("Submit Changes and Return to this Item"), "submitreturn").'</span></td>
00159 </tr>';
00160
00161 $votes = db_result($result,0,'vote');
00162 if ($votes)
00163 {
00164 # display vote here if any, anything else is handled below
00165 print '
00166 <tr>
00167 <td class="preinput" width="15%">'._("Votes:").' </td>
00168 <td width="35%"><a href="#votes">'.$votes.'</a></td>
00169 <td colspan="'.($fields_per_line).'" width="50%"> </td>
00170 </tr>
00171 ';
00172
00173 }
00174
00175 print '<tr><td colspan="'.($fields_per_line*2).'"> </td></tr>';
00176
00177 # Now display the variable part of the field list (depend on the project)
00178
00179 # $i is used to count the number of field
00180 # $j is used to select the appropriate background color
00181 $i=0;
00182 $j=0;
00183
00184 while ($field_name = trackers_list_all_fields())
00185 {
00186 # if the field is a special field (except summary and details)
00187 # or if not used by this project then skip it.
00188 if ((!trackers_data_is_special($field_name) || $field_name=='summary' || $field_name=='details') &&
00189 trackers_data_is_used($field_name))
00190 {
00191
00192 # if the submitter was anonymous, print the originator email field
00193 if ($field_name != 'originator_email' ||
00194 ($field_name == 'originator_email' && db_result($result,0,'submitted_by') == '100'))
00195 {
00196
00197 # display the bug field
00198 # if field size is greatest than max_size chars then force it to
00199 # appear alone on a new line or it wont fit in the page
00200
00201 # Look for the field value in the database only if we missing
00202 # its values. If we already have a value, we are probably in
00203 # step 2 of a search on item/group (dependancy, reassignation).
00204
00205 # If nocache is set, we were explicetely asked to rely only
00206 # on database content
00207 # If we rely on submitted by form content, due to magic_quotes,
00208 # we need to run both stripslashes and htmlspecialchars
00209 if (!$$field_name || $nocache)
00210 { $field_value = db_result($result,0,$field_name); }
00211 else
00212 { $field_value = htmlspecialchars(stripslashes($$field_name)); }
00213 # On the cookbook, the recipe text must allow to see html
00214 # special chars as they were typed.
00215 if (ARTIFACT == "cookbook" && $field_name == 'details')
00216 {
00217 $field_value = htmlspecialchars($field_value);
00218 }
00219
00220 list($sz,) = trackers_data_get_display_size($field_name);
00221 $label = trackers_field_label_display($field_name,$group_id,false,false);
00222
00223 # Save the assigned to value for later
00224 if ($field_name == 'assigned_to')
00225 { $item_assigned_to = trackers_field_display($field_name,$group_id,$field_value,false,false,true);
00226 }
00227
00228 # original submission field must be displayed read-only,
00229 # (unless we are on the cookbook)
00230 # assigned_to, status_id and priority too, for technicians
00231 # (if super_user, do nothing)
00232 if (!user_is_super_user())
00233 { $mbcheck = member_check(0,$group_id,member_create_tracker_flag(ARTIFACT).'1', 1); }
00234
00235 if (($field_name =='details' && ARTIFACT != "cookbook") ||
00236 ($mbcheck && $field_name == 'status_id') ||
00237 ($mbcheck && $field_name == 'assigned_to') ||
00238 ($mbcheck && $field_name == 'priority') ||
00239 ($mbcheck && $field_name == 'originator_email'))
00240 {
00241 dbg("field_name:$field_name is read-only, mbcheck_is_not_manager:$mbcheck_is_not_manager");
00242 $value = utils_rich_markup(trackers_field_display($field_name,$group_id,$field_value,false,false,true));
00243
00244 # Details need a specific div
00245 if ($field_name == 'details')
00246 {
00247 $value = '<div class="trackersoriginalsubmission">'.$value.'</div>';
00248 }
00249
00250 }
00251 else
00252 {
00253 $value = trackers_field_display($field_name,$group_id,$field_value,false,false,$printer,false,false,_("None"),false,_("Any"),true);
00254 }
00255
00256 # check if the field is mandatory
00257 unset($star);
00258 $mandatory_flag = trackers_data_mandatory_flag($field_name);
00259 if ($mandatory_flag == 3 ||
00260 ($mandatory_flag == 0 &&
00261 trackers_check_is_shown_to_submitter($field_name, $group_id, db_result($result,0,'submitted_by'))))
00262
00263 {
00264 $star = '<span class="warn"> *</span>';
00265 }
00266
00267 # Fields colors
00268 unset($field_class, $row_class);
00269 if ($j % 2 && $field_name != 'details')
00270 {
00271 # We keep the original submission with the default
00272 # background color, for lisibility sake
00273 #
00274 # We also use the boxitem background color only one time
00275 # out of two, to keep the page light
00276 $row_class = ' class="'.utils_altrow($j+1).'"';
00277 }
00278
00279 # If we are working on the cookbook, present checkboxes to
00280 # defines context before the summary line;
00281 if (CONTEXT == 'cookbook' && $field_name == 'summary')
00282 {
00283 cookbook_print_form();
00284 }
00285
00286 # We highlight fields that were not properly/completely
00287 # filled.
00288 if ($previous_form_bad_fields && array_key_exists($field_name, $previous_form_bad_fields))
00289 {
00290 $field_class = ' class="highlight"';
00291 }
00292
00293 if ($sz > $max_size)
00294 {
00295 # Field getting one line for itself
00296
00297 # Each time prepare the change of the background color
00298 $j++;
00299
00300 print "\n<tr".$row_class.">".
00301 '<td valign="middle" '.$field_class.' width="15%">'.$label.$star.'</td>'.
00302 '<td valign="middle" '.$field_class.' colspan="'.(2*$fields_per_line-1).'" width="75%">'.
00303 $value.'</td>'.
00304 "\n</tr>";
00305 $i=0;
00306 }
00307 else
00308 {
00309 # Field getting half of a line for itself
00310
00311
00312 if (!($i % $fields_per_line))
00313 {
00314 # Every one out of two, prepare the background color change.
00315 # We do that at this moment because we cannot be sure
00316 # there will be another field on this line.
00317 $j++;
00318 }
00319
00320 print ($i % $fields_per_line ? '':"\n<tr".$row_class.">");
00321 print '<td valign="middle"'.$field_class.' width="15%">'.$label.$star.'</td><td valign="middle"'.$field_class.' width="35%">'.$value.'</td>';
00322 $i++;
00323 print ($i % $fields_per_line ? '':"\n</tr>");
00324 }
00325 }
00326 }
00327 }
00328
00329 print '</table>';
00330 print '<p class="warn"><span class="smaller">* '._("Mandatory Fields").'</span></p>';
00331 print '<p> </p>';
00332
00333 # ################################ Shortcuts
00334
00335 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>';
00336 print ' - <a href="#comments">'._("Follow-up Comments").'</a><br />';
00337 print ' - <a href="#attached">'._("Attached Files").'</a><br />';
00338 print ' - <a href="#dependencies">'._("Dependencies").'</a><br />';
00339 print ' - <a href="#cc">'._("Mail Notification Carbon-Copy List").'</a><br />';
00340 if (trackers_data_is_used("vote"))
00341 {
00342 print ' - <a href="#votes">'._("Votes").'</a><br />';
00343 }
00344 if (member_check(0,$group_id, member_create_tracker_flag(ARTIFACT).'3') && ARTIFACT != "cookbook")
00345 {
00346 print ' - <a href="#reassign">'._("Reassign this item").'</a><br />';
00347 }
00348
00349 print ' - <a href="#history">'._("History").'</a><br />';
00350 print '<p> </p></div>';
00351
00352 # ################################ Comments
00353
00354 print '<h3>'.html_anchor(_("Follow-up Comments"), 'comments').'</h3>';
00355 print '<p class="noprint">';
00356 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.)"),
00357 "<em>artifact #nnn</em>",
00358 "<em>artifact</em>",
00359 "<em>support, bug, task, recipe, patch, file</em>",
00360 "<em>nnn</em>");
00361
00362 print '<p class="noprint"><span class="preinput"> '._("Add a New Comment:").'</span><br />
00363 ';
00364 print trackers_field_textarea('comment', htmlspecialchars(stripslashes($comment)));
00365 print '</p>';
00366
00367 print '<p class="noprint"><span class="preinput">';
00368 print _("Comment Type:").'</span><br /> ';
00369 print trackers_field_box('comment_type_id',$comment_type_id,$group_id,'',true,'None');
00370
00371
00372 print '<br /><span class="preinput">'._("Use a Canned Response:").'</span><br /> ';
00373
00374 if ($canned_response == "!multiple!")
00375 {
00376
00377 $result_canned = trackers_data_get_canned_responses($group_id);
00378 if (db_numrows($result_canned) > 0)
00379 {
00380
00381 while ($canned = db_fetch_array($result_canned))
00382 {
00383
00384 print form_input("checkbox", "canned_response[]", $canned['bug_canned_id']).' '.$canned['title'];
00385 print '<br /> ';
00386
00387 }
00388 }
00389 else
00390 {
00391 print '<span class="warn">'._("Strangely enough, there is no canned response available.").'</span>';
00392 }
00393
00394 }
00395 else
00396 {
00397
00398 print trackers_canned_response_box ($group_id,'canned_response');
00399 print ' <a class="smaller" href="'.$GLOBALS['sys_home'].ARTIFACT.'/admin/field_values.php?group_id='.$group_id.'&create_canned=1">('._("Or define a new Canned Response").')</a>';
00400
00401 }
00402 print '<br /><span class="preinput">'._("Previous Comment Style:").'</span><br /> ';
00403 if ($quotation_style != "quoted")
00404 {
00405 print form_submit(_("Quoted, ready to be copied/pasted into your new comment"), "change_quotation_style");
00406 }
00407 else
00408 {
00409 print form_submit(_("Verbatim, unmodified"), "change_quotation_style");
00410
00411 }
00412
00413
00414
00415 print '</p> <p>';
00416
00417 print show_item_details($item_id,$group_id,0,$item_assigned_to,$quotation_style);
00418
00419 print '</p><p> </p>';
00420
00421 # ################################ Attached Files
00422
00423 print '<h3>'.html_anchor(_("Attached Files"), "attached").'</h3>';
00424
00425 print '<p class="noprint"><span class="preinput"> '._("Attach File:").'</span><br />
00426 <input type="file" name="input_file" size="40" />
00427 <br />
00428 <span class="preinput">'._("File Description:").'</span><br />
00429 <input type="text" name="file_description" size="60" maxlength="255" />
00430 </p><p>';
00431
00432 show_item_attached_files($item_id,$group_id);
00433
00434 print '</p><p> </p>';
00435
00436 # ################################ Dependencies
00437
00438 print '<h3>'.html_anchor(_("Dependencies"), "dependencies").'</h3>';
00439 print '<p class="noprint"><span class="preinput">';
00440 if (!$depends_search)
00441 { print _("Search an item (to fill a dependancy against):"); }
00442 else
00443 {
00444 # Print a specific message if we are already at step 2 of filling
00445 # a dependency.
00446 print _("New search, in case the previous one was not satisfactory (to fill a dependancy against):");
00447 }
00448
00449 print '</span><br />
00450 <input type="text" name="depends_search" size="40" maxlength="255" /><br />';
00451
00452
00453 print '<span class="preinput">'._("Of:").'</span><br />';
00454 print ' <select name="depends_search_only_artifact">';
00455
00456 # Generate the list of searchable trackers
00457 $tracker_list = array(
00458 'all' => _("Any Tracker"),
00459 'support' => _("The Support Tracker Only"),
00460 'bugs' => _("The Bug Tracker Only"),
00461 'task' => _("The Task Manager Only"),
00462 'patch' => _("The Patch Manager Only"),
00463 );
00464 foreach ($tracker_list as $option_value => $text)
00465 {
00466 $selected = '';
00467 if ($option_value == $depends_search_only_artifact)
00468 {
00469 $selected = ' selected="selected"';
00470 }
00471 print "<option value=\"$option_value\"$selected>$text</option>\n";
00472 }
00473 print "</select>\n";
00474
00475 print _("of");
00476
00477 print ' <select name="depends_search_only_project">';
00478 $selected = ('any' == $depends_search_only_project ? ' selected="selected"' : '');
00479 print '<option value="any"'.$selected.'>'._("Any Project").'</option>';
00480 $selected = ('notany' == $depends_search_only_project ? ' selected="selected"' : '');
00481 print '<option value="notany"'.$selected.'>'._("This Project Only").'</option>
00482 </select> ';
00483
00484 if (!$depends_search)
00485 {
00486 print form_submit(_("Search"), "submit");
00487 }
00488 else
00489 {
00490 # Print a specific message if we are already at step 2 of filling
00491 # a dependency.
00492 print form_submit(_("New search"), "submit");
00493 }
00494
00495 # Search results, if we are already at step 2 of filling
00496 if ($depends_search)
00497 {
00498 print '</p><p><span class="preinput">';
00499 printf (_("Please select a dependancy to add in the result of your search of '%s' in the database:"), $depends_search);
00500 print '</span>';
00501
00502 unset($success);
00503
00504 # If we have less than 4 characters, to avoid giving lot of feedback
00505 # and put an exit to the report, just consider the search as a failure.
00506 if (strlen($depends_search) > 3)
00507 {
00508
00509 # Build the list of trackers to take account of.
00510 if ($depends_search_only_artifact == "all")
00511 { $artifacts = array("support", "bugs", "task", "patch"); }
00512 else
00513 { $artifacts = array($depends_search_only_artifact); }
00514
00515 # Actually search on each asked trackers.
00516 while (list($num, $tracker) = each($artifacts))
00517 {
00518 if ($depends_search_only_project == "notany")
00519 { $GLOBALS['only_group_id'] = $group_id; }
00520
00521 # Do not ask for all words,
00522 $GLOBALS['exact'] = 0;
00523
00524 $result_search = search_run($depends_search, $tracker, 0);
00525 $success = db_numrows($result_search) + $success;
00526
00527 # Print the result, if existing.
00528 if (db_numrows($result_search) != 0)
00529 {
00530 while (list($res_id, $res_summary, $res_date, $res_privacy, $res_submitter_id, $res_submitter_name, $res_group) = db_fetch_array($result_search))
00531 {
00532 # Avoid item depending on itself.
00533 # Hide private items. For now, they are excluded for dependancies.
00534 # We ll implement that later if necessary.
00535 if ($res_privacy == 2)
00536 { continue; }
00537 if ($res_id != $item_id || $tracker != ARTIFACT)
00538 {
00539 # Right now only print id, summary and group.
00540 # We may change that depending on users feedback.
00541 print '<br />';
00542 print ' '.form_input("checkbox", "dependent_on_".$tracker."[]", $res_id).' '.$tracker.' #'.$res_id._(': ').$res_summary;
00543 print ', '._("group").' '.group_getname($res_group);
00544 }
00545 }
00546 }
00547 }
00548 }
00549 if (!$success)
00550 {
00551 print '<br /><span class="warn">';
00552 print _("None found. Please note that only search words of more than three characters are valid.");
00553 print '</span>';
00554 }
00555
00556 }
00557
00558
00559 print '</p><p>';
00560
00561
00562 print show_item_dependency($item_id);
00563
00564 print '</p><p>';
00565
00566 print show_dependent_item($item_id);
00567
00568 print '</p><p> </p>';
00569
00570 # ################################ Mail notification
00571
00572 print '<h3>'.html_anchor(_("Mail Notification Carbon-Copy List"), "cc").'</h3>';
00573 print '<p class="noprint">';
00574 printf (_("(Note: for %s users, you can use their login name rather than their email addresses.)"), $GLOBALS['sys_name']);
00575
00576 print '</p><p class="noprint"><span class="preinput">'
00577 ._("Add an email address that should receive carbon copies of updates of this item:").'</span><br /> <input type="text" name="add_cc" size="40" value="'.$add_cc.'" />
00578 <br />
00579 <span class="preinput">'
00580 ._("Comment:").'</span><br /> <input type="text" name="cc_comment" size="40" maxlength="255" value="'.$cc_comment.'" />';
00581 print '<p></p>';
00582 show_item_cc_list($item_id, $group_id);
00583
00584 print '<p> </p>';
00585
00586 # ################################ Votes
00587
00588 if (trackers_data_is_used("vote"))
00589 {
00590 $votes_given = trackers_votes_user_giventoitem_count(user_getid(), ARTIFACT, $item_id);
00591 $votes_remaining = trackers_votes_user_remains_count(user_getid()) + $votes_given;
00592 if (!$new_vote)
00593 { $new_vote = $votes_given; }
00594
00595 # ATM, the mod page is only for technicians/manager. They always have
00596 # the right to vote, as they are project member anyway.
00597 print '<h3>'.html_anchor(_("Votes"), "votes").'</h3>';
00598 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">';
00599
00600 # Show how many vote he already gave and allows to remove or give more
00601 # votes.
00602 # The number of remaining points must be 100 - others votes
00603 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);
00604 print '</p>';
00605 print '<p> </p>';
00606 }
00607
00608 # ################################ Reassign an item, if manager of the tracker
00609 # Not possible on the cookbook manager, cookbook entries are too specific
00610 if (member_check(0,$group_id, member_create_tracker_flag(ARTIFACT).'3') && ARTIFACT != "cookbook")
00611 {
00612 print '<h3 class="noprint">'.html_anchor(_("Reassign this item"), "reassign").'</h3>';
00613
00614 print '<p class="noprint"><span class="preinput">'
00615 ._("Move to the:").'</span><br /> ';
00616
00617 function specific_reassign_artifact ($art, $content)
00618 {
00619 # Function too trivial to generalized in usual includes.
00620 if (!$GLOBALS[reassign_change_artifact] && ARTIFACT == $art || $GLOBALS[reassign_change_artifact] == $art)
00621 { $checked = ' selected="selected"'; }
00622 print '<option value="'.$art.'"'.$checked.'>'.$content.'</option>';
00623 unset($checked);
00624 }
00625 print '<select name="reassign_change_artifact">';
00626 specific_reassign_artifact("support", _("Support Tracker"));
00627 specific_reassign_artifact("bugs", _("Bugs Tracker"));
00628 specific_reassign_artifact("task", _("Task Tracker"));
00629 specific_reassign_artifact("patch", _("Patch Tracker"));
00630 print '</select>';
00631
00632 print '<br /><br />
00633 <span class="preinput">';
00634
00635 if (!$reassign_change_project_search)
00636 { print _("Move to the project:"); }
00637 else
00638 {
00639 # Print a specific message if we are already at step 2 of
00640 # reassignation to another project.
00641 print _("New search, in case the previous one was not satisfactory (to reassign the item to another project):");
00642 }
00643
00644 print '</span><br /> <input type="text" name="reassign_change_project_search" size="40" maxlength="255" />';
00645 if (!$reassign_change_project_search)
00646 {
00647 print form_submit(_("Search"), "submit");
00648 }
00649 else
00650 {
00651 # Print a specific message if we are already at step 2 of filling
00652 # a ressign.
00653 print form_submit(_("New search"), "submit");
00654 }
00655
00656
00657 # Search results, if we are already at step 2 of filling
00658 if ($reassign_change_project_search)
00659 {
00660 print '</p><p><span class="preinput">';
00661 printf (_("To which project this bug should be reassigned to? This is the result of your search of '%s' in the database:"), $reassign_change_project_search);
00662 print '</span>';
00663
00664 # Print a null-option, someone may change his mine without having
00665 # to use the back button of his browser.
00666 print '<br /> <input type="radio" name="reassign_change_project" value="0" checked="checked" /> '._("Do not reassign to another project.");
00667
00668 unset($success);
00669 $result_search = search_run($reassign_change_project_search, "soft", 0);
00670 $success = db_numrows($result_search);
00671
00672 # Print the result, if existing.
00673 if (db_numrows($result_search) != 0)
00674 {
00675 while (list($res_group_name, $res_unix_group_name, $res_group_id) = db_fetch_array($result_search))
00676 {
00677 # Not reassigning to itself.
00678 if ($res_unix_group_name != $group_name)
00679 {
00680 print '<br />';
00681 print ' '.form_input("radio", "reassign_change_project", $res_unix_group_name).' ['.$res_unix_group_name.', #'.$res_group_id.'] '.$res_group_name;
00682 }
00683 }
00684 }
00685
00686 if (!$success)
00687 {
00688 print '<br /><span class="warn">';
00689 print _("None found. Please note that only search words of more than three characters are valid.");
00690 print '</span>';
00691 }
00692
00693 }
00694 }
00695
00696
00697
00698 # ################################ Submit
00699
00700 print '<p> </p>';
00701
00702 print '<div align="center" class="noprint">'.form_submit(_("Submit Changes and Browse Items").'" class="bold', "submit").' '.form_submit(_("Submit Changes and Return to this Item"), "submitreturn").'</form></div>';
00703
00704
00705 # ################################ History
00706 # May require in the future to think about only showing recent changes.
00707
00708 print '<p> </p><p> </p>';
00709 print show_item_history($item_id,$group_id);
00710
00711 }
00712
00713 trackers_footer(array());
00714
00715 ?>