Main Page | Directories | File List | File Members

show.php File Reference

Go to the source code of this file.

Functions

 show_item_list ($result_arr, $offset, $total_rows, $field_arr,#4 $title_arr, $width_arr, $url, $nolink=false)
 show_item_list_sober ($result_arr, $total_rows, $url)
 show_item_history ($item_id, $group_id, $no_limit=false)

Variables

print $GLOBALS['sys_home'] SV_THEME
 print


Function Documentation

show_item_history item_id,
group_id,
no_limit = false
 

Definition at line 503 of file show.php.

References $field, $j, $result, $rows, $title, $title_arr, db_numrows(), db_result, format_date(), group_id, nbsp, print, trackers_data_get_history(), trackers_data_get_label(), trackers_data_is_date_field(), and trackers_data_is_select_box().

00504 {
00505   global $sys_datefmt;
00506   $result=trackers_data_get_history($item_id);
00507   $rows=db_numrows($result);
00508 
00509   # If no limit is not set, print only 10 latest news items
00510   # yeupou--gnu.org 2004-09-17: currently we provide no way to get the
00511   # full history. We'll see if users request it.
00512   if ($no_limit)
00513     {
00514       $title = _("History");
00515     }
00516   else
00517     {
00518       if ($rows > 15)
00519         { $rows = 15; }
00520       $title = sprintf(ngettext("%s latest change", "%s latest changes", $rows), $rows);
00521     }
00522 
00523 
00524   print "\n".'<h3>'.html_anchor($title, "history").'</h3>';
00525 
00526   if ($rows > 0)
00527     {
00528 
00529       $title_arr=array();
00530       $title_arr[]=_("Date");
00531       $title_arr[]=_("Changed By");
00532       $title_arr[]=_("Updated Field");
00533       $title_arr[]=_("Previous Value");
00534       $title_arr[]="=>";
00535       $title_arr[]=_("Replaced By");
00536 
00537       print html_build_list_table_top ($title_arr);
00538 
00539       $j=0;
00540       for ($i=0; $i < $rows; $i++)
00541         {
00542           $field = db_result($result, $i, 'field_name');
00543 
00544           # If the stored label is "realdetails", it means it is the details
00545           # field (realdetails is used because someone had the nasty idea to
00546           # use "details" to mean "comment")
00547           if ($field == "realdetails")
00548             { $field = "details"; }
00549 
00550           $field_label = trackers_data_get_label($field);
00551 
00552           # if field_label is empty, no label was found, return as it is stored
00553           if (!$field_label)
00554             { $field_label = $field; }
00555 
00556           $value_id =  db_result($result, $i, 'old_value');
00557           $new_value_id =  db_result($result, $i, 'new_value');
00558 
00559           $date = db_result($result, $i, 'date');
00560           $user = db_result($result, $i, 'user_name');
00561 
00562           # If the previous date and user are equal, do not print user
00563           # and date
00564           if ($date == $previous_date && $user == $previous_user)
00565             {
00566           print "\n".'<tr class="'. utils_get_alt_row_color($j).'"><td>&nbsp;</td><td>&nbsp;</td>';
00567 
00568             }
00569           else
00570             {
00571 
00572           $j++;
00573           print "\n".'<tr class="'. utils_get_alt_row_color($j).'">';
00574 
00575           # Date
00576           print '<td align="center" class="smaller">'.format_date($sys_datefmt,$date).'</td>';
00577 
00578           # Person
00579           print '<td align="center" class="smaller">'.utils_user_link($user).'</td>';
00580             }
00581 
00582           $previous_date = $date;
00583           $previous_user = $user;
00584 
00585           # Updated Field
00586           print '<td class="smaller" align="center">'.$field_label.'</td>';
00587 
00588           # Previous value
00589           print '<td class="smaller" align="right">';
00590           if (trackers_data_is_select_box($field))
00591             {
00592               # Its a select box look for value in clear
00593               # (If we hit case of transition automatique update, show it in
00594               # specific way)
00595               if ($value_id == "transition-other-field-update")
00596                 {
00597                   print "-"._("Automatic update due to transitions settings")."-";
00598                 }
00599               else
00600                 {
00601                   print trackers_data_get_value($field, $group_id, $value_id);
00602                 }
00603             }
00604           else if (trackers_data_is_date_field($field))
00605             {
00606               # For date fields do some special processing
00607               print format_date($sys_datefmt,$value_id);
00608             }
00609           else
00610             {
00611               # It's a text zone then display directly
00612               print $value_id;
00613             }

show_item_list result_arr,
offset,
total_rows,
field_arr,
#4 $  title_arr,
width_arr,
url,
nolink = false
 

Definition at line 27 of file show.php.

References $chunksz, $group_id, $j, $morder, $PHP_SELF, $value, and, format_date(), group_id, nbsp, order, print, trackers_data_get_cached_field_value(), trackers_data_is_date_field(), trackers_data_is_select_box(), and trackers_data_is_username_field().

00035 {
00036   global $group_id,$PHP_SELF,$chunksz,$morder;
00037 
00038   # Build the list of links to use for column headings
00039   # Used to trigger sort on that column
00040   if ($url)
00041     {
00042       $links_arr = array();
00043       while (list(,$field) = each($field_arr))
00044         {
00045           $links_arr[] = $url.'&amp;order='.$field.'#results';
00046         }
00047     }
00048 
00049   /*
00050       Show extra rows for <-- Prev / Next -->
00051   */
00052 
00053   $nav_bar ='<h3 class="nextprev">';
00054 
00055   # If all bugs on screen so no prev/begin pointer at all
00056   if ($total_rows > $chunksz)
00057     {
00058       if ($offset > 0)
00059         {
00060           $nav_bar .=
00061              '<span class="xsmall"><a href="'.$url.'&amp;offset=0#results"><img src="'.$GLOBALS['sys_home'].'images/'.SV_THEME.'.theme/first.png" border="0" alt="'._("Begin").'" />'._("Begin").'</a>'.
00062              '&nbsp;&nbsp;&nbsp;&nbsp;'.
00063              '<a href="'.$url.'&amp;offset='.($offset-$chunksz).
00064              '#results"><img src="'.$GLOBALS['sys_home'].'images/'.SV_THEME.'.theme/previous.png" border="0" alt="'._("Previous Results").'" />'._("Previous Results").'</a></span>';
00065         }
00066       else
00067         {
00068           $nav_bar .=
00069              '<span class="xsmall"><img src="'.$GLOBALS['sys_home'].'images/'.SV_THEME.'.theme/firstgrey.png" border="0" alt="'._("Begin").'" /><em>'._("Begin").'</em>'.
00070              '&nbsp;&nbsp;&nbsp;&nbsp;'.
00071              '<img src="'.$GLOBALS['sys_home'].'images/'.SV_THEME.'.theme/previousgrey.png" border="0" alt="'._("Previous Results").'" /><em>'._("Previous Results").'</em></span>';
00072         }
00073     }
00074 
00075 
00076   $offset_last = min($offset+$chunksz-1, $total_rows-1);
00077 
00078   #fb("$offset_last offset_last");
00079 
00080   $nav_bar .= " &nbsp;  &nbsp; &nbsp; &nbsp; ".sprintf(ngettext("%d matching item", "%d matching items", $total_rows), $total_rows);
00081   $nav_bar .= " - ".sprintf(_("Items %s to %s"), ($offset+1), ($offset_last+1))."  &nbsp; &nbsp; &nbsp; &nbsp; ";
00082 
00083 
00084   # If all items are on screen, no next/end pointer at all
00085   # FIXME: it should not count private items
00086   if ($total_rows > $chunksz)
00087     {
00088       if ( ($offset+$chunksz) < $total_rows )
00089         {
00090 
00091           $offset_end = ($total_rows - ($total_rows % $chunksz));
00092           if ($offset_end == $total_rows)
00093             { $offset_end -= $chunksz; }
00094 
00095           #fb("$offset_end offset_end");
00096 
00097           $nav_bar .=
00098              '<span class="xsmall"><a href="'.$url.'&amp;offset='.($offset+$chunksz).
00099              '#results">'._("Next Results").'<img src="'.$GLOBALS['sys_home'].'images/'.SV_THEME.'.theme/next.png" border="0" alt="'._("Next Results").'" /></a>'.
00100              '&nbsp;&nbsp;&nbsp;&nbsp;'.
00101              '<a href="'.$url.'&amp;offset='.($offset_end).
00102              '#results">'._("End").'<img src="'.$GLOBALS['sys_home'].'images/'.SV_THEME.'.theme/last.png" border="0" alt="'._("End").'" /></a></span>';
00103         }
00104       else
00105         {
00106           $nav_bar .= '<span class="xsmall"><em>'._("Next Results").'</em><img src="'.$GLOBALS['sys_home'].'images/'.SV_THEME.'.theme/nextgrey.png" border="0" alt="'._("Next Results").'" />'.
00107              '&nbsp;&nbsp;&nbsp;&nbsp;'.
00108              '<em>'._("End").'</em><img src="'.$GLOBALS['sys_home'].'images/'.SV_THEME.'.theme/lastgrey.png" border="0" alt="'._("End").'" /></span>';
00109         }
00110     }
00111   $nav_bar .= '</h3>';
00112 
00113   # Print prev/next links
00114   print $nav_bar.'<a name="results"></a><br />';
00115 
00116   print html_build_list_table_top ($title_arr,$links_arr);
00117 
00118   #see if the bugs are too old - so we can highlight them
00119   $nb_of_fields = count($field_arr);
00120 
00121   while (list(,$thisitem) = each($result_arr))
00122     {
00123       $thisitem_id = $thisitem['bug_id'];
00124 
00125       print '<tr class="'.utils_get_priority_color($result_arr[$thisitem_id]["priority"], $result_arr[$thisitem_id]["status_id"]).'">'."\n";
00126 
00127       for ($j=0; $j<$nb_of_fields; $j++)
00128         {
00129            # If we are in digest mode, add the digest checkbox
00130           if ($field_arr[$j] == "digest")
00131             {
00132               # Dirty workaround to have boxes selected by default in the
00133               # form_input
00134               print '<td class="center">'.form_input("checkbox", "items_for_digest[]", "$thisitem_id\" checked=\"checked").'</td>';
00135               continue;
00136             }
00137 
00138           $value = $result_arr[$thisitem_id][$field_arr[$j]];
00139           if ($width_arr[$j])
00140             {
00141               $width = 'width="'.$width_arr[$j].'%"';
00142             }
00143           else
00144             {
00145               $width = '';
00146             }
00147 
00148           if (trackers_data_is_date_field($field_arr[$j]) )
00149             {
00150               if ($value)
00151                 {
00152                   if ($field_arr[$j] == 'planned_close_date' and $value < time())
00153                     { $highlight_date = ' class="highlight"'; }
00154                   else
00155                     { $highlight_date = ''; }
00156                   print "<td $width$highlight_date>";
00157                   print format_date('short',$value);
00158                   print "</td>\n";
00159                 }
00160               else
00161                 { print "<td align=\"middle\" $width>-</td>\n"; }
00162 
00163             }
00164           else if ($field_arr[$j] == 'bug_id')
00165             {
00166 
00167               if ($nolink)
00168                 { print "<td $width>#$value</td>\n"; }
00169               else
00170                     {
00171                       print "<td $width>";
00172 
00173                       print '<a href="?func=detailitem&amp;item_id='.$value.'">';
00174 
00175                       print '&nbsp;#'.$value .'</a></td>'."\n";
00176 
00177                     }
00178 
00179             }
00180           else if (trackers_data_is_username_field($field_arr[$j]))
00181             {
00182 
00183               if ($nolink)
00184                 { print "<td $width>$value</td>\n"; }
00185               else
00186                 { print "<td $width>".utils_user_link($value)."</td>\n"; }
00187 
00188             }
00189           else if (trackers_data_is_select_box($field_arr[$j]))
00190             {
00191               print "<td $width>". trackers_data_get_cached_field_value($field_arr[$j], $group_id, $value) .'</td>'."\n";
00192 
00193             }
00194           else
00195                 {
00196                   if ($nolink)
00197                     { print "<td $width>". $value .'&nbsp;</td>'."\n"; }
00198                   else
00199                     {
00200                       print "<td $width>".'<a href="?func=detailitem&amp;item_id='.
00201                         $thisitem_id.'">'.
00202                         $value .'</a></td>'."\n";
00203                     }
00204                 }
00205 
00206         }
00207       print "</tr>\n";
00208     }
00209 
00210   print '</table>';
00211 
00212   # Print prev/next links
00213   print "<br />".$nav_bar;
00214 
00215 }

show_item_list_sober result_arr,
total_rows,
url
 

Do the same a item list but in sober output

Definition at line 220 of file show.php.

References $group_id, $j, $sys_group_id, $value, and, cookbook_audience_possiblevalues(), cookbook_context_possiblevalues(), cookbook_context_project_impossiblevalues(), db_numrows(), db_query(), db_result, format_date(), group_id, nbsp, print, summary, trackers_data_get_cached_field_value(), trackers_data_is_date_field(), trackers_data_is_select_box(), trackers_data_is_username_field(), and utils_link().

00223 {
00224   global $group_id, $sys_group_id, $sys_name;
00225 
00226   $possible_contexts = cookbook_context_possiblevalues();
00227   $possible_audiences = cookbook_audience_possiblevalues();
00228 
00229   # If we are on a project cookbook, take into account impossible values:
00230   # recipes of features unused by the project
00231   $impossible_contexts = array();
00232   if ($group_id != $sys_group_id)
00233     {
00234       $impossible_contexts = cookbook_context_project_impossiblevalues();
00235     }
00236 
00237 
00238   # Add the unset case, when the item is actually not bound to any context
00239   # or action
00240   # Build sql specific part for these
00241   unset($sql_unboundcontext, $sql_unboundaudience);
00242   $thisarray = array_merge($possible_contexts, $impossible_contexts);
00243   while (list($context,) = each($thisarray))
00244     {
00245       $sql_unboundcontext .= "AND context_$context='0' ";
00246     }
00247   while (list($audience,) = each($possible_audiences))
00248     { $sql_unboundaudience .= "AND audience_$audience='0' "; }
00249 
00250   # Built for scratch two groups of audiences possible for this page:
00251   # group members and non-group members
00252   $possible_audiences = array();
00253   $possible_audiences['nonmembers'] = _("Non Project Members");
00254   $possible_audiences['members'] = _("Project Members");
00255 
00256   # Add unset cases to the arrays
00257   $possible_contexts['unbound'] = _("Other");
00258   $possible_audiences['unbound'] = _("Undefined");
00259 
00260   # Build sql specific part to group audiences between:
00261   #   project members / non project members
00262   $sql_nonmembers = "AND (audience_anonymous='1' OR audience_loggedin='1')";
00263   $sql_members = "AND (audience_members='1' OR audience_technicians='1' OR audience_managers='1')";
00264 
00265   unset($sql_privateitem);
00266 
00267   # Go through the list of possible context and then possible actions
00268   # print relevant items
00269   print '<ul>';
00270   reset($possible_contexts);
00271   while (list($context,$context_label) = each($possible_contexts))
00272     {
00273       unset($context_content);
00274       reset($possible_audiences);
00275       while (list($audience,$audience_label) = each($possible_audiences))
00276         {
00277           # Get recipes contextual data
00278           # (no limit argument, expecting people not to use terrible scales)
00279 
00280           if ($audience == 'nonmembers')
00281             {
00282               $sql_audience = $sql_nonmembers;
00283             }
00284           else
00285             {
00286               $sql_audience = $sql_members;
00287             }
00288 
00289           # Special deal for the item unbound
00290           if ($audience != 'unbound' && $context != 'unbound')
00291             {
00292               # Normal case, binds for both context and audience
00293               $sql_context = "SELECT * FROM cookbook_context2recipe WHERE (group_id='$group_id' OR group_id='$sys_group_id') AND context_$context='1' $sql_audience";
00294             }
00295           else if ($audience == 'unbound' && $context != 'unbound')
00296             {
00297               # Bind only for the context
00298               $sql_context = "SELECT * FROM cookbook_context2recipe WHERE (group_id='$group_id' OR group_id='$sys_group_id') AND context_$context='1' $sql_unboundaudience";
00299             }
00300           else if ($context == 'unbound' && $audience != 'unbound')
00301             {
00302               # Bind only for the audience
00303               $sql_context = "SELECT * FROM cookbook_context2recipe WHERE (group_id='$group_id' OR group_id='$sys_group_id') $sql_audience $sql_unboundcontext";
00304             }
00305           else if ($context == 'unbound' && $audience == 'unbound')
00306             {
00307               # Not binded at all
00308               $sql_context = "SELECT * FROM cookbook_context2recipe WHERE (group_id='$group_id' OR group_id='$sys_group_id') $sql_unboundcontext $sql_unboundaudience";
00309             }
00310 
00311           $result_context = db_query($sql_context);
00312           $result_rows = db_numrows($result_context);
00313 
00314           if ($result_rows)
00315             {
00316               # We want to show items sorted by alphabetical order.
00317               # We will first put the result in a an array
00318               # we will sort the array and use it to print out results.
00319               # We store the summary in lower case, to avoid having a case
00320               # sensitive sort.
00321               $thisaudience_results = array();
00322               for ($i = 0; $i < $result_rows; $i++)
00323                 {
00324                   $thisitem_id = db_result($result_context, $i, 'recipe_id');
00325                   $thisaudience_results[$thisitem_id] =
00326                     strtolower($result_arr[$thisitem_id]["summary"]);
00327                 }
00328               asort($thisaudience_results);
00329               unset($audience_content);
00330               while (list($thisitem_id,$summary) = each($thisaudience_results))
00331                 {
00332                   # Ignore if not approved
00333                   if ($result_arr[$thisitem_id]["resolution_id"] != '1')
00334                     { continue; }
00335 
00336                   # Detect if it is a site wide doc item. Ignore that if we
00337                   # are on the site admin group
00338                   unset($is_site_doc, $url_extra_arg);
00339                   if ($group_id != $sys_group_id)
00340                     {
00341                       if ($result_arr[$thisitem_id]["group_id"] == $sys_group_id)
00342                         {
00343                           $is_site_doc = true;
00344                           $url_extra_arg = '&amp;comingfrom='.$group_id;
00345                         }
00346                     }
00347 
00348 
00349                   $audience_content .= '<li>';
00350                   # Show specific background color only for maximum priority
00351                   $priority = $result_arr[$thisitem_id]["priority"];
00352                   if ($priority > 4)
00353                     {
00354                       $audience_content .= '<span class="'.utils_get_priority_color($result_arr[$thisitem_id]["priority"]).'">';
00355                     }
00356 
00357                   # In this link, we need to mention from where we come from
00358                   # so it is possible to know if we are actually inside a
00359                   # group cookbook if ever we look at a site wide documentation
00360                   $audience_content .= utils_link($GLOBALS['sys_home'].'cookbook/?func=detailitem'.$url_extra_arg.'&amp;item_id='.$thisitem_id, $result_arr[$thisitem_id]["summary"]);
00361                   if ($priority > 4)
00362                     {
00363                       $audience_content .= '</span>';
00364                     }
00365 
00366                   # If it comes from the site docs, mention it
00367                   if ($is_site_doc)
00368                     {
00369                       $audience_content .= '&nbsp;&nbsp;<span class="smaller">('.sprintf(_("From %s User Docs"), $sys_name).')</span>';
00370                     }
00371 
00372                   $audience_content .= '</li>';
00373                 }
00374 
00375               # If there was valid results, save the subcontext
00376               if (!$audience_content)
00377                 { continue; }
00378 
00379               $context_content .= '<li><span class="smaller">'.sprintf(_("%s:"), $audience_label).'</span>';
00380               $context_content .= '<ul>';
00381               $context_content .= $audience_content;
00382               $context_content .= '</ul>';
00383               $context_content .= '</li>';
00384             }
00385         }
00386       # If there was valid results, print the context
00387       if (!$context_content)
00388         { continue; }
00389 
00390       print '<li>'.html_anchor(sprintf(_("%s:"), $context_label), $context);
00391       print '<ul>';
00392       print $context_content;
00393       print '</ul><br />';
00394       print '</li>';
00395 
00396     }
00397   print '</ul>';
00398 
00399 
00400 
00401 
00402 
00403   return true;
00404   while (list(,$thisitem) = each($result_arr))
00405     {
00406       $thisitem_id = $thisitem['bug_id'];
00407 
00408       print '<tr class="'.utils_get_priority_color($result_arr[$thisitem_id]["priority"], $result_arr[$thisitem_id]["status_id"]).'">'."\n";
00409 
00410       for ($j=0; $j<$nb_of_fields; $j++)
00411 
00412 
00413         {
00414            # If we are in digest mode, add the digest checkbox
00415           if ($field_arr[$j] == "digest")
00416             {
00417               print '<td class="center">'.form_input("checkbox", "items_for_digest[]", $thisitem_id).'</td>';
00418               continue;
00419             }
00420 
00421           $value = $result_arr[$thisitem_id][$field_arr[$j]];
00422           if ($width_arr[$j])
00423             {
00424               $width = 'width="'.$width_arr[$j].'%"';
00425             }
00426           else
00427             {
00428               $width = '';
00429             }
00430 
00431           if (trackers_data_is_date_field($field_arr[$j]) )
00432             {
00433               if ($value)
00434                 {
00435                   if ($field_arr[$j] == 'planned_close_date' and $value < time())
00436                     { $highlight_date = ' class="highlight"'; }
00437                   else
00438                     { $highlight_date = ''; }
00439                   print "<td $width$highlight_date>";
00440                   print format_date('short',$value);
00441                   print "</td>\n";
00442                 }
00443               else
00444                 { print "<td align=\"middle\" $width>-</td>\n"; }
00445 
00446             }
00447           else if ($field_arr[$j] == 'bug_id')
00448             {
00449 
00450               if ($nolink)
00451                 { print "<td $width>#$value</td>\n"; }
00452               else
00453                     {
00454                       print "<td $width>";
00455 
00456                       print '<a href="?func=detailitem&amp;item_id='.$value.'">';
00457 
00458                       print '&nbsp;#'.$value .'</a></td>'."\n";
00459 
00460                     }
00461 
00462             }
00463           else if (trackers_data_is_username_field($field_arr[$j]))
00464             {
00465 
00466               if ($nolink)
00467                 { print "<td $width>$value</td>\n"; }
00468               else
00469                 { print "<td $width>".utils_user_link($value)."</td>\n"; }
00470 
00471             }
00472           else if (trackers_data_is_select_box($field_arr[$j]))
00473             {
00474               print "<td $width>". trackers_data_get_cached_field_value($field_arr[$j], $group_id, $value) .'</td>'."\n";
00475 
00476             }
00477           else
00478                 {
00479                   if ($nolink)
00480                     { print "<td $width>". $value .'&nbsp;</td>'."\n"; }
00481                   else
00482                     {
00483                       print "<td $width>".'<a href="?func=detailitem&amp;item_id='.
00484                         $thisitem_id.'">'.
00485                         $value .'</a></td>'."\n";
00486                     }
00487                 }
00488 
00489         }
00490       print "</tr>\n";
00491     }
00492 
00493   print '</table>';
00494 
00495   # Print prev/next links
00496   print "<br />".$nav_bar;
00497 
00498 }


Variable Documentation

print
 

Definition at line 632 of file show.php.

print $GLOBALS ['sys_home'] SV_THEME
 

Definition at line 615 of file show.php.

Referenced by html_image().


Generated on Sun Feb 26 13:23:05 2006 for Savane PHP Frontend Developer Reference by  doxygen 1.4.4