Main Page | Directories | File List | File Members

html.php

Go to the documentation of this file.
00001 <?php
00002 # This file is part of the Savane project
00003 # <http://gna.org/projects/savane/>
00004 #
00005 # $Id: html.php 5441 2006-02-19 13:53:40Z toddy $
00006 #
00007 #  Copyright 1999-2000 (c) The SourceForge Crew
00008 #  Copyright 2000-2003 (c) Free Software Foundation
00009 #                          Mathieu Roy <yeupou--gnu.org>
00010 #
00011 #  Copyright 2004-2006 (c) Mathieu Roy <yeupou--gnu.org>
00012 #                          Paul Pogonyshev <pogonyshev--gmx.net>
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 # display browsing/display options: should be on top of pages, after the
00029 # specific content/page description.
00030 # The form should end by #options so it the user does not have to scroll down
00031 # too much
00032 function html_show_displayoptions ($content, $form_opening=0, $submit=0)
00033 {
00034   return html_show_boxoptions(_("Display Criteria"), $content, $form_opening, $submit);
00035 }
00036 
00037 function html_show_boxoptions ($legend, $content, $form_opening=0, $submit=0)
00038 {
00039 
00040   $script_hide = 'onclick="document.getElementById(\'boxoptionscontent\').style.display=\'none\'; document.getElementById(\'boxoptionslinkhide\').style.display=\'none\'; document.getElementById(\'boxoptionslinkshow\').style.display=\'inline\';"';
00041   $script_show = 'onclick="document.getElementById(\'boxoptionscontent\').style.display=\'inline\'; document.getElementById(\'boxoptionslinkhide\').style.display=\'inline\'; document.getElementById(\'boxoptionslinkshow\').style.display=\'none\';"';
00042 
00043   $ret = '
00044 <fieldset class="boxoptions">
00045 <a name="options"></a>
00046 <legend>';
00047 
00048   # yeupou, 2006-02: it is not ubercool to use monospace font to show
00049   # plus or minus button, but all the tests I made with icons so far ended up
00050   # in quite an ugly thing when the font scale change.
00051   $ret .= '
00052   <span '.$script_hide.' id="boxoptionslinkhide"><span class="minusorplus">(-)</span>'.$legend.'</span>
00053   <span '.$script_show.' id="boxoptionslinkshow"><span class="minusorplus">(+)</span>'.$legend.'</span>
00054 </legend>
00055 <span id="boxoptionscontent">';
00056 
00057   if ($form_opening && $submit)
00058     {
00059       $ret .= '
00060 '.$form_opening.'
00061 <span class="boxoptionssubmit">'.$submit.'</span>';
00062     }
00063 
00064 $ret .= '
00065 <span class="smaller">'.$content.'</span>';
00066 
00067   if ($form_opening && $submit)
00068     {
00069       $ret .= '
00070 </form>';
00071     }
00072 
00073   $ret .= '
00074 </span>
00075 </fieldset>
00076 ';
00077 
00078   return $ret;
00079 }
00080 
00081 
00082 function html_splitpage ($how)
00083 {
00084   if ($how == 'start' || $how == '1')
00085     {
00086       return "\n".'<div class="splitright">'."\n";
00087 
00088     }
00089   elseif ($how == 'middle' || $how == '2')
00090     {
00091       return  "\n".'</div><!-- end  splitright -->'."\n".
00092         '<div class="splitleft">'."\n";
00093 
00094     }
00095   else
00096     {
00097       return "\n".'</div><!-- end  splitleft -->'."\n";
00098     }
00099 }
00100 
00101 
00102 function html_nextprev ($search_url, $rows, $rows_returned)
00103 {
00104   global $offset, $max_rows;
00105 
00106   if (($rows_returned > $rows) || ($offset != 0))
00107     {
00108       print "\n<br /><h5 class=\"nextprev\">\n";
00109 
00110       if ($offset != 0)
00111         {
00112           print '<a href="'.$search_url.'&amp;offset='.($offset-$rows).'&amp;max_rows='.$max_rows.'#results">';
00113           print '<img src="'.$GLOBALS['sys_home'].'images/'.SV_THEME.'.theme/previous.png" border="0" alt="'._("Previous Results").'" />'._("Previous Results").'</a>';
00114 
00115         }
00116       else
00117         {
00118           print '<img src="'.$GLOBALS['sys_home'].'images/'.SV_THEME.'.theme/previousgrey.png" border="0" alt="'._("Previous Results").'" /><em>'._("Previous Results").'</em>';
00119         }
00120 
00121       print "&nbsp; &nbsp; &nbsp;";
00122 
00123       if ($rows_returned > $rows)
00124         {
00125           print '<a href="'.$search_url.'&amp;offset='.($offset+$rows).'&amp;max_rows='.$max_rows.'#results">';
00126           print _("Next Results").' <img src="'.$GLOBALS['sys_home'].'images/'.SV_THEME.'.theme/next.png" border="0" alt="'._("Next Results").'" /></a>';
00127         }
00128       else
00129         {
00130           print '<em>'._("Next Results").'</em> <img src="'.$GLOBALS['sys_home'].'images/'.SV_THEME.'.theme/nextgrey.png" border="0" alt="'._("Next Results").'" />';
00131         }
00132 
00133       print "</h5>\n";
00134     }
00135 }
00136 
00137 function html_anchor ($content, $name)
00138 {
00139   if (!$name) { $name = $content; };
00140   return '<a name="'.$name.'" href="#'.$name.'">'.$content.'</a>';
00141 }
00142 
00146 function html_feedback_top()
00147 {
00148   # By default, escape the html special chars, unless feedback_html was
00149   # set in the code to allow an htmlized feedback (that should happen on rare
00150   # occasions)
00151   if (!$GLOBALS[feedback_html])
00152     {
00153       $GLOBALS[feedback] = htmlspecialchars($GLOBALS[feedback]);
00154       $GLOBALS[ffeedback] = htmlspecialchars($GLOBALS[ffeedback]);
00155     }
00156 
00157   $script_hide = 'onclick="document.getElementById(\'feedback\').style.visibility=\'hidden\'; document.getElementById(\'feedbackback\').style.visibility=\'visible\';"';
00158   $script_show = 'onclick="document.getElementById(\'feedback\').style.visibility=\'visible\'; document.getElementById(\'feedbackback\').style.visibility=\'hidden\';"';
00159 
00160 
00161   # Button to get back hidden feedback, hidden by default
00162   print '<div '.$script_show.' id="feedbackback" class="feedbackback">'._("Show feedback again").'</div>';
00163 
00164   # Only success
00165   if ($GLOBALS[feedback] && !$GLOBALS[ffeedback])
00166     {
00167         print '<div id="feedback" class="feedback" '.$script_hide.'><span class="feedbacktitle"><img src="'.$GLOBALS['sys_home'].'images/'.SV_THEME.'.theme/ok.png" class="feedbackimage" alt="'._("Success").'" /> '._("Success:").'</span> '.$GLOBALS[feedback].'</div>';
00168     }
00169 
00170   # Only errors
00171   if ($GLOBALS[ffeedback] && !$GLOBALS[feedback])
00172     {
00173       print '<div id="feedback" class="feedbackerror" '.$script_hide.'><span class="feedbackerrortitle"><img src="'.$GLOBALS['sys_home'].'images/'.SV_THEME.'.theme/wrong.png" class="feedbackimage" alt="'._("Error").'" /> '._("Error:").'</span>'.$GLOBALS[ffeedback].'</div>';
00174     }
00175 
00176   # Errors and success
00177   if ($GLOBALS[ffeedback] && $GLOBALS[feedback])
00178     {  print '<div id="feedback" class="feedbackerrorandsuccess" '.$script_hide.'><span class="feedbackerrorandsuccesstitle"><img src="'.$GLOBALS['sys_home'].'images/'.SV_THEME.'.theme/wrong.png" class="feedbackimage" alt="'._("Some Errors").'" /> '._("Some Errors:").'</span>'.$GLOBALS[feedback].' '.$GLOBALS[ffeedback].'</div>'; }
00179 
00180   if ($GLOBALS[sys_debug_on] && $GLOBALS[debug])
00181     {  print '<div class="debug">DEBUG information: '.$GLOBALS[debug].'</div>'; }
00182 
00183 
00184   # We unset feedback so there will be a bottom feedback only if something
00185   # changed. It may confuse users, however I would find more confusing to
00186   # have two lookalike feedback information providing most of the time the
00187   # same information AND (that is the problem) sometimes more information
00188   # in the second one.
00189   unset($GLOBALS[feedback],$GLOBALS[ffeedback],$GLOBALS[debug]);
00190 }
00191 
00195 function html_feedback_bottom()
00196 {
00197   html_feedback_top();
00198 }
00199 
00200 
00201 
00202 function html_image ($src,$args,$display=1)
00203 {
00204   GLOBAL $img_attr;
00205   $return = ('<img src="'.$GLOBALS['sys_home'].'images/'.SV_THEME.'.theme/'.$src.'"');
00206   reset($args);
00207   while(list($k,$v) = each($args))
00208     {
00209       $return .= ' '.$k.'="'.$v.'"';
00210     }
00211 
00212   # ## insert a border tag if there isn't one
00213   if (!$args['border']) $return .= (' border="0"');
00214 
00215 
00216   # ## if no height AND no width tag, insert em both
00217   if (!$args['height'] && !$args['width'])
00218     {
00219 
00220      #Check to see if we've already fetched the image data
00221  if(!$img_attr[$src] && is_file($GLOBALS['sys_www_topdir'].'/images/'.SV_THEME.'.theme/'.$src))
00222    {
00223      list($width, $height, $type, $img_attr[$src]) = @getimagesize($GLOBALS['sys_www_topdir'].'/images/'.SV_THEME.'.theme/'.$src);
00224 
00225    }
00226  else
00227    {
00228      if (is_file($GLOBALS['sys_www_topdir'].'/images/'.SV_THEME.'.theme/'.$src))
00229        {
00230          list($width, $height, $type, $img_attr[$src])  = @getimagesize($GLOBALS['sys_www_topdir'].'/images/'.SV_THEME.'.theme/'.$src);
00231        }
00232    }
00233  $return .= ' ' . $img_attr[$src];
00234 }
00235 
00236 # ## insert alt tag if there isn't one
00237   if (!$args['alt']) $return .= " alt=\"$src\"";
00238 
00239   $return .= (' />');
00240   if ($display)
00241     {
00242       print $return;
00243     }
00244   else
00245     {
00246       return $return;
00247     }
00248 }
00249 
00250 function html_build_list_table_top ($title_arr,$links_arr=false,$table=true)
00251 {
00252   /*
00253                 Takes an array of titles and builds
00254                 The first row of a new table
00255 
00256                 Optionally takes a second array of links for the titles
00257   */
00258   GLOBAL $HTML;
00259 
00260   if ($table)
00261     {
00262      $return = '
00263   <table class="box">';
00264     }
00265 
00266      $return .= '
00267                 <tr>';
00268 
00269   $count=count($title_arr);
00270   if ($links_arr)
00271     {
00272       for ($i=0; $i<$count; $i++)
00273         {
00274           $return .= '
00275                         <td class="boxtitle"><a class="sortbutton" href="'.$links_arr[$i].'">'.$title_arr[$i].'</a></td>';
00276         }
00277     }
00278   else
00279     {
00280       for ($i=0; $i<$count; $i++)
00281         {
00282           $return .= '
00283                         <td class="boxtitle">'.$title_arr[$i].'</td>';
00284         }
00285     }
00286   return $return.'</tr>';
00287 }
00288 
00289 function html_get_alt_row_color ($i)
00290 {
00291   GLOBAL $HTML;
00292   if ($i % 2 == 0)
00293     {
00294       return 'boxitemalt';
00295     }
00296   else
00297     {
00298       return 'boxitem';
00299     }
00300 }
00301 
00302 #deprecated
00303 function utils_get_alt_row_color ($i)
00304 {
00305   return html_get_alt_row_color ($i);
00306 }
00307 
00308 
00309 
00310 function html_build_select_box_from_array ($vals,$select_name,$checked_val='xzxz',$samevals = 0)
00311 {
00312   /*
00313                 Takes one array, with the first array being the "id" or value
00314                 and the array being the text you want displayed
00315 
00316                 The second parameter is the name you want assigned to this form element
00317 
00318                 The third parameter is optional. Pass the value of the item that should be checked
00319   */
00320 
00321   $return .= '
00322                 <select name="'.$select_name.'">';
00323 
00324   $rows=count($vals);
00325 
00326   for ($i=0; $i<$rows; $i++)
00327     {
00328       if ($samevals)
00329         {
00330           $return .= "\n\t\t<option value=\"" . $vals[$i] . "\"";
00331           if ($vals[$i] == $checked_val)
00332             {
00333               $return .= ' selected="selected"';
00334             }
00335         }
00336       else
00337         {
00338           $return .= "\n\t\t<option value=\"" . $i .'"';
00339           if ($i == $checked_val)
00340             {
00341               $return .= ' selected="selected"';
00342             }
00343         }
00344       $return .= '>'.$vals[$i].'</option>';
00345     }
00346   $return .= '
00347                 </select>';
00348 
00349   return $return;
00350 }
00351 
00352 function html_build_select_box_from_arrays ($vals,
00353                                             $texts,
00354                                             $select_name,
00355                                             $checked_val='xzxz', #4
00356                                             $show_100=true,
00357                                             $text_100='None', #6
00358                                             $show_any=false,
00359                                             $text_any='Any', #8
00360                                             $show_unknown=false)
00361 {
00362   /*
00363 
00364   The infamous '100 row' has to do with the
00365                         SQL Table joins done throughout all this code.
00366                 There must be a related row in users, categories, etc, and by default that
00367                         row is 100, so almost every pop-up box has 100 as the default
00368                 Most tables in the database should therefore have a row with an id of 100 in it
00369                         so that joins are successful
00370 
00371                 There is now another infamous row called the Any row. It is not
00372                 in any table as opposed to 100. it's just here as a convenience mostly
00373                 when using select boxes in queries (bug, task,...). The 0 value is reserved
00374                 for Any and must not be used in any table.
00375 
00376                 Params:
00377 
00378                 Takes two arrays, with the first array being the "id" or value
00379                 and the other array being the text you want displayed
00380 
00381                 The third parameter is the name you want assigned to this form element
00382 
00383                 The fourth parameter is optional. Pass the value of the item that should be checked
00384 
00385                 The fifth parameter is an optional boolean - whether or not to show the '100 row'
00386 
00387                 The sixth parameter is optional - what to call the '100 row' defaults to none
00388                 The 7th parameter is an optional boolean - whether or not to show the 'Any row'
00389 
00390                 The 8th parameter is optional - what to call the 'Any row' defaults to nAny     */
00391 
00392 
00393 
00394   $return .= '
00395                 <select name="'.$select_name.'">';
00396 
00397 
00398   # We want the "Default" on item initial post, only at this momement
00399   if ($show_unknown)
00400     {
00401       $return .= "\n<option value=\"!unknown!\">"._("Unknown")."</option>";
00402     }
00403 
00404   #we don't always want the default any  row shown
00405   if ($show_any)
00406     {
00407       $selected = ( $checked_val == 0 ? 'selected="selected"':'');
00408       $return .= "\n<option value=\"0\" $selected>$text_any </option>";
00409     }
00410 
00411   #we don't always want the default 100 row shown
00412   if ($show_100)
00413     {
00414       $selected = ( $checked_val == 100 ? 'selected="selected"':'');
00415       $return .= "\n<option value=\"100\" $selected>$text_100 </option>";
00416     }
00417 
00418 
00419   $rows=count($vals);
00420   if (count($texts) != $rows)
00421     {
00422       $return .= 'ERROR - uneven row counts';
00423     }
00424 
00425 
00426 
00427   for ($i=0; $i<$rows; $i++)
00428     {
00429       #  uggh - sorry - don't show the 100 row and Any row
00430       #  if it was shown above, otherwise do show it
00431       if ((($vals[$i] != '100') && ($vals[$i] != '0')) ||
00432            ($vals[$i] == '100' && !$show_100) ||
00433            ($vals[$i] == '0' && !$show_any))
00434         {
00435           $return .= '
00436                                 <option value="'.$vals[$i].'"';
00437           if ($vals[$i] == $checked_val)
00438             {
00439               $return .= ' selected="selected"';
00440             }
00441           $return .= '>'.$texts[$i].'</option>';
00442 
00443        }
00444 
00445     }
00446   $return .= '
00447                 </select>';
00448   return $return;
00449 }
00450 
00451 function html_build_select_box ($result, $name, $checked_val="xzxz",$show_100=true,$text_100='None',$show_any=false,$text_any='Any',$show_unknown=false)
00452 {
00453   /*
00454                 Takes a result set, with the first column being the "id" or value
00455                 and the second column being the text you want displayed
00456 
00457                 The second parameter is the name you want assigned to this form element
00458 
00459                 The third parameter is optional. Pass the value of the item that should be checked
00460 
00461                 The fourth parameter is an optional boolean - whether or not to show the '100 row'
00462 
00463                 The fifth parameter is optional - what to call the '100 row' defaults to none
00464   */
00465 
00466   return html_build_select_box_from_arrays (utils_result_column_to_array($result,0),utils_result_column_to_array($result,1),$name,$checked_val,$show_100,$text_100,$show_any,$text_any,$show_unknown);
00467 }
00468 
00469 function html_build_multiple_select_box ($result,$name,$checked_array,$size='8',$show_100=true,$text_100='None', $show_any=false,$text_any='Any',$show_value=true)
00470 {
00471   /*
00472                 Takes a result set, with the first column being the "id" or value
00473                 and the second column being the text you want displayed
00474 
00475                 The second parameter is the name you want assigned to this form element
00476 
00477                 The third parameter is an array of checked values;
00478 
00479                 The fourth parameter is optional. Pass the size of this box
00480 
00481                 Fifth to eigth params determine whether to show None and Any
00482 
00483                 Ninth param determine whether to show numeric values next to
00484                 the menu label (default true for backward compatibility
00485   */
00486 
00487   $checked_count=count($checked_array);
00488   #      print '-- '.$checked_count.' --';
00489   $return .= '
00490                 <SELECT NAME="'.$name.'" MULTIPLE SIZE="'.$size.'">';
00491   /*
00492                 Put in the Any box
00493   */
00494   if ($show_any)
00495     {
00496       $return .= '
00497                 <option value="0"';
00498       for ($j=0; $j<$checked_count; $j++)
00499         {
00500           if ($checked_array[$j] == '0')
00501             {
00502               $return .= ' selected="selected"';
00503             }
00504         }
00505       $return .= '>'.$text_any.'</option>';
00506     }
00507 
00508   /*
00509                 Put in the default NONE box
00510   */
00511   if ($show_100)
00512     {
00513       $return .= '
00514                 <option value="100"';
00515       for ($j=0; $j<$checked_count; $j++)
00516         {
00517           if ($checked_array[$j] == '100')
00518             {
00519               $return .= ' selected="selected"';
00520             }
00521         }
00522       $return .= '>'.$text_100.'</option>';
00523     }
00524 
00525   $rows=db_numrows($result);
00526 
00527   for ($i=0; $i<$rows; $i++)
00528     {
00529       if (db_result($result,$i,0) != '100')
00530         {
00531           $return .= '
00532                                 <option value="'.db_result($result,$i,0).'"';
00533           /*
00534                                 Determine if it's checked
00535           */
00536           $val=db_result($result,$i,0);
00537           for ($j=0; $j<$checked_count; $j++)
00538             {
00539               if ($val == $checked_array[$j])
00540                 {
00541                   $return .= ' selected="selected"';
00542                 }
00543             }
00544           $return .= '>'. ($show_value?$val.'-':'').
00545              substr(db_result($result,$i,1),0,35). '</option>';
00546         }
00547     }
00548   $return .= '
00549                 </SELECT>';
00550   return $return;
00551 }
00552 
00553 function html_select_permission_box ($artifact, $row, $level="member")
00554 {
00555   # If $row['user_id'] does not exists, we havent got a row but simple value
00556   # and it means that we are about to modify per group default
00557   if ($level == "type")
00558     {
00559       $value = $row;
00560       $default = 0;
00561     }
00562   elseif ($level == "group")
00563     {
00564       $value = $row;
00565       $default = _("Group Type Default");
00566     }
00567   else
00568     {
00569       $num = $row['user_id'];
00570       $value = $row[$artifact.'_flags'];
00571       $default = _("Group Default");
00572     }
00573 
00574   print '
00575     <td align="center">
00576       <select name="'.$artifact.'_user_'.$num.'">';
00577   if ($default)
00578     {
00579       print '
00580         <option value="NULL"'.((!$value)?" selected=\"selected\"":"").'>'.$default.'</option>';
00581     }
00582   print '
00583         <option value="9"'.(($value == 9)?" selected=\"selected\"":"").'>'._("None").'</option>';
00584   if ($artifact != "news")
00585     {
00586       print '
00587         <option value="1"'.(($value == 1)?" selected=\"selected\"":"").'>'._("Technician").'</option>';
00588     }
00589 
00590   print '
00591         <option value="3"'.(($value == 3)?" selected=\"selected\"":"").'>'._("Manager").'</option>';
00592 
00593 
00594   if ($artifact != "news")
00595     {
00596       print '
00597         <option value="2"'.(($value == 2)?" selected=\"selected\"":"").'>'._("Techn. & Manager").'</option>';
00598     }
00599 
00600   print '
00601       </select>';
00602 
00603   if (!$value && $level == "group")
00604     {
00605       $value = group_gettypepermissions($GLOBALS[group_id], $artifact);
00606       print '<br />('.
00607         (($value == 9)?_("None"):"").
00608         (($value == 1)?_("Technician"):"").
00609         (($value == 3)?_("Manager"):"").
00610         (($value == 2)?_("Techn. & Manager"):"").
00611         ')';
00612     }
00613 
00614   print '
00615     </td>';
00616 }
00617 
00618 
00619 function html_select_restriction_box ($artifact, $row, $level="group", $notd=0, $event=1)
00620 {
00621   # event = 1 : posting items
00622   # event = 2 : posting comments
00623 
00624   # If $row['user_id'] does not exists, we havent got a row but simple value
00625   # and it means that we are about to modify per group default
00626   if ($level == "type")
00627     {
00628       $value = $row;
00629       $default = 0;
00630     }
00631   else
00632     {
00633       $value = $row;
00634       if ($event == 2)
00635         {
00636           $default = _("Same as for new items");
00637         }
00638       else
00639         {
00640           $default = _("Group Type Default");
00641         }
00642     }
00643 
00644   if (!$notd)
00645     {
00646       print '
00647     <td align="center">';
00648     }
00649 
00650   print '
00651       <select name="'.$artifact.'_restrict_event'.$event.'">';
00652 
00653   if ($default)
00654     {
00655       print '
00656         <option value="NULL"'.((!$value)?" selected=\"selected\"":"").'>'.$default.'</option>';
00657     }
00658   print '
00659         <option value="5"'.(($value == 5)?" selected=\"selected\"":"").'>'._("Project Member").'</option>';
00660   print '
00661         <option value="3"'.(($value == 3)?" selected=\"selected\"":"").'>'._("Logged-in User").'</option>';
00662   print '
00663         <option value="2"'.(($value == 2)?" selected=\"selected\"":"").'>'._("Anonymous").'</option>';
00664 
00665   print '
00666       </select>';
00667 
00668   if (!$value && $level == "group" && $event == 1)
00669     {
00670       $value = group_gettyperestrictions($GLOBALS[group_id], $artifact);
00671       print '<br />('.
00672         (($value == 5)?_("Project Member"):"").
00673         (($value == 3)?_("Logged-in User"):"").
00674         (($value == 2)?_("Anonymous"):"").
00675         ')';
00676     }
00677 
00678 
00679   if (!$notd)
00680     {
00681       print '
00682     </td>';
00683     }
00684 }
00685 
00686 
00687 # This function must now every type of directory that can be built by the
00688 # backend.
00689 # FIXME: in a future, we may create a table of method associating
00690 # method -> perl module -> sub name
00691 function html_select_typedir_box ($input_name, $current_value)
00692 {
00693   print '<br />&nbsp;&nbsp;
00694       <select name="'.$input_name.'">
00695         <option value="basicdirectory"'.(($current_value == "basicdirectory")?" selected":"").'>'._("Basic Directory").'</option>
00696         <option value="basiccvs"'.(($current_value == "basiccvs")?" selected=\"selected\"":"").'>'._("Basic Cvs Directory").'</option>
00697         <option value="basicsvn"'.(($current_value == "basicsvn")?" selected=\"selected\"":"").'>'._("Basic Subversion Directory").'</option>
00698         <option value="cvsattic"'.(($current_value == "cvsattic")?" selected=\"selected\"":"").'>'._("Cvs Attic/Gna").'</option>
00699         <option value="svnattic"'.(($current_value == "svnattic")?" selected=\"selected\"":"").'>'._("Subversion Attic/Gna").'</option>
00700         <option value="savannah-gnu"'.(($current_value == "savannah-gnu")?" selected=\"selected\"":"").'>'._("Savannah GNU").'</option>
00701         <option value="savannah-nongnu"'.(($current_value == "savannah-nongnu")?" selected=\"selected\"":"").'>'._("Savannah non-GNU").'</option>
00702       </select> [BACKEND SPECIFIC]
00703 ';
00704 
00705   # put some information
00706   print '<br /><span class="smaller">Basic directory will make the backend using DownloadMakeArea(), defined in Savannah::Download; <br /> CVS directory will make the backend using CvsMakeArea(), defined in Savannah::Cvs;<br />
00707 (If you need to build directories with another method, the solution is to write a new sub in the appropriate perl module, please send a mail to savane-dev@gna.org to get information about that)</span><br /><br />';
00708 
00709 }
00710 
00711 # Print an theme select box. This function will add the special rotate
00712 # and random meta-themes. This function will hide disallowed theme.
00713 # That is said that theme are not strictly forbidden, someone can
00714 # forge a form and choose a forbidden theme.
00715 # But it is really not a big deal and it is better to have making to
00716 # many checks in theme_list(), which is frequently ran, unlike this
00717 # one.
00718 function html_select_theme_box ($input_name="user_theme", $current=0)
00719 {
00720 
00721   print '
00722                 <select name="'.$input_name.'">';
00723 
00724   # usual themes
00725   $data = theme_list(1);
00726   while (list(,$theme) = each($data))
00727     {
00728       print "\n\t\t".'<option value="'.$theme.'"';
00729       if ($theme == $current)
00730         { print ' selected="selected"'; }
00731       print '>'.$theme;
00732       if ($theme == $GLOBALS['sys_themedefault'])
00733         { print ' ('._("default").')'; }
00734       print '</option>'."\n";
00735     }
00736 
00737   # special rotate case
00738   $theme = "rotate";
00739   print "\n\t\t".'<option value="'.$theme.'"';
00740   if ($theme == $current)
00741     { print ' selected="selected"'; }
00742   print '> &gt; '.("alphabetically picked everyday").'</option>';
00743   # special random case
00744   $theme = "random";
00745   print "\n\t\t".'<option value="'.$theme.'"';
00746   if ($theme == $current)
00747     { print ' selected="selected"'; }
00748   print '> &gt; '.("randomly picked everyday").'</option>';
00749   print "               </select>\n";
00750 
00751 }
00752 
00753 function html_build_priority_select_box ($name='priority', $checked_val='5')
00754 {
00755   /*
00756                 Return a select box of standard priorities.
00757                 The name of this select box is optional and so is the default checked value
00758   */
00759     ?>
00760      <SELECT NAME="<?php print $name; ?>">
00761         <option value="1"<?php if ($checked_val=="1")
00762           {print " selected=\"selected\"";} ?>>1 - Lowest</option>
00763                                     <option value="2"<?php if ($checked_val=="2")
00764                                       {print " selected=\"selected\"";} ?>>2</option>
00765                                                                 <option value="3"<?php if ($checked_val=="3")
00766                                                                   {print " selected=\"selected\"";} ?>>3</option>
00767                                                                                             <option value="4"<?php if ($checked_val=="4")
00768                                                                                               {print " selected=\"selected\"";} ?>>4</option>
00769                                                                                                                         <option value="5"<?php if ($checked_val=="5")
00770                                                                                                                           {print " selected=\"selected\"";} ?>>5 - Medium</option>
00771                                                                                                                                                     <option value="6"<?php if ($checked_val=="6")
00772                                                                                                                                                       {print " selected=\"selected\"";} ?>>6</option>
00773                                                                                                                                                                                 <option value="7"<?php if ($checked_val=="7")
00774                                                                                                                                                                                   {print " selected=\"selected\"";} ?>>7</option>
00775                                                                                                                                                                                                             <option value="8"<?php if ($checked_val=="8")
00776                                                                                                                                                                                                               {print " selected=\"selected\"";} ?>>8</option>
00777                                                                                                                                                                                                                                         <option value="9"<?php if ($checked_val=="9")
00778                                                                                                                                                                                                                                           {print " selected=\"selected\"";} ?>>9 - Highest</option>
00779                                                                                                                                                                                                                                                                     </SELECT>
00780                                                                                                                                                                                                                                                                     <?php
00781 
00782                                                                                                                                                                                                                                                                     }
00783 function html_buildpriority_select_box ($name='priority', $checked_val='5')
00784 {
00785   return html_build_priority_select_box($name, $checked_val);
00786 }
00787 
00788 
00789 function html_build_checkboxarray($options,$name,$checked_array)
00790 {
00791   $option_count=count($options);
00792   $checked_count=count($checked_array);
00793 
00794   for ($i=1; $i<=$option_count; $i++)
00795     {
00796       print '
00797                         <br><input type="checkbox" name="'.$name.'" value="'.$i.'"';
00798       for ($j=0; $j<$checked_count; $j++)
00799         {
00800           if ($i == $checked_array[$j])
00801             {
00802               print ' checked="checked"';
00803             }
00804         }
00805       print ' /> '.$options[$i];
00806     }
00807 }
00808 
00809 function html_buildcheckboxarray($options,$name,$checked_array)
00810 {
00811   #deprecated
00812   return html_build_checkboxarray($options,$name,$checked_array);
00813 }
00814 
00815 function html_build_checkbox ($name, $is_checked=0)
00816 {
00817   print  '<input type="checkbox" name="'.$name.'" value="1"';
00818   if ($is_checked)
00819     { print ' checked="checked"'; }
00820   print ' />';
00821 }
00822 
00826 function html_header($params)
00827 {
00828   global $HTML;
00829   print $HTML->header($params);
00830   print html_feedback_top($GLOBALS['feedback']);
00831   print $HTML->tabs($params);
00832 }
00833 
00834 function html_footer($params)
00835 {
00836   global $HTML;
00837   print html_feedback_bottom($GLOBALS['feedback']);
00838   $HTML->footer($params);
00839 }
00840 
00844 function site_header($params)
00845 {
00846   html_header($params);
00847 }
00848 
00849 function site_footer($params)
00850 {
00851   html_footer($params);
00852 }
00853 
00854 /*
00855         Project pages functions
00856         ----------------------------------------------------------------
00857 */
00858 
00859 
00865 function site_project_header($params)
00866 {
00867   global $group_id;
00868 
00869   #get the project object
00870   $project=project_get_object($group_id);
00871 
00872   #group doesn't exist
00873   if ($project->isError())
00874     {
00875       exit_error("Invalid Group $group_id","That group does not exist.");
00876     }
00877 
00878   #group is private
00879   if (!$project->isPublic())
00880     {
00881       #if its a private group, you must be a member of that group
00882       session_require(array('group'=>$group_id));
00883     }
00884 
00885   #for dead projects must be member of admin project
00886   if (!$project->isActive())
00887     {
00888       # only sys_group people can view non-active, non-holding groups
00889       session_require(array('group'=>$GLOBALS['sys_group_id']));
00890     }
00891 
00892   html_header($params);
00893 }
00894 
00901 function site_project_footer($params)
00902 {
00903   html_footer($params);
00904 }
00905 
00906 /*
00907         User pages functions
00908         ----------------------------------------------------------------
00909 */
00910 
00917 function site_user_header($params)
00918 {
00919   session_require(array('isloggedin'=>'1'));
00920   html_header($params);
00921 }
00922 
00929 function site_user_footer($params)
00930 {
00931   html_footer($params);
00932 }
00933 
00934 /*
00935         Administrative pages functions
00936         ----------------------------------------------------------------
00937 */
00938 
00939 function site_admin_header($params)
00940 {
00941   session_require(array('group'=>'1','admin_flags'=>'A'));
00942   html_header($params);
00943 }
00944 
00945 function site_admin_footer($params)
00946 {
00947   html_footer($params);
00948 }
00949 
00950 function show_group_type_box($name='group_type',$checked_val='xzxz', $show_select_one=false)
00951 {
00952   $result=db_query("SELECT * FROM group_type");
00953   return html_build_select_box($result,'group_type',$checked_val,$show_select_one, "> "._("Choose one below"));
00954 }
00955 
00956 
00957 function html_member_explain_roles ()
00958 {
00959 
00960   print _("Technicians, and only technicians, can be assigned tracker's items. They cannot reassign items, change the status or priority of items.");
00961   print '<p>';
00962   print _("Trackers Managers can fully manage the trackers items, including assigning items to technicians, reassign items over trackers and projects, changing priority and status of items - but they cannot configure the trackers.");
00963   print '<p>';
00964   print _("Project Admins can manage members, configure the trackers, post jobs, and add mailing-list. They actually also have manager rights on every tracker and are allowed to read private items.");
00965   print '<p>';
00966 }
00967 
00968 ?>

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