Main Page | Directories | File List | File Members

Layout.class

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: Layout.class 5372 2006-02-14 13:25:16Z yeupou $
00006 #
00007 #  Copyright 1999-2000 (c) The SourceForge Crew
00008 #  Copyright 2000-2003 (c) Free Software Foundation
00009 #                          Mathieu Roy <yeupou--gnu.org>
00010 #                          Stéphane Urbanoski <s.urbanovski--ac-nancy-metz.fr>
00011 #                          Derek Feichtinger <derek.feichtinger--cern.ch>
00012 #
00013 #  Copyright 2004-2006 (c) Mathieu Roy <yeupou--gnu.org>
00014 #
00015 # The Savane project is free software; you can redistribute it and/or
00016 # modify it under the terms of the GNU General Public License
00017 # as published by the Free Software Foundation; either version 2
00018 # of the License, or (at your option) any later version.
00019 #
00020 # The Savane project is distributed in the hope that it will be useful,
00021 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 # GNU General Public License for more details.
00024 #
00025 # You should have received a copy of the GNU General Public License
00026 # along with the Savane project; if not, write to the Free Software
00027 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00028 
00029 class Layout extends Error
00030 {
00031 
00032 ########################################## BASIC HTML
00033 
00034 
00035   var $bgpri = array();
00036 
00037 # Constuctor
00038   function Layout ()
00039   {
00040     GLOBAL $bgpri;
00041 # Constructor for parent class...
00042     $this->Error();
00043 
00044 #  Set up the priority color array one time only
00045     $bgpri[1] = 'priora';
00046     $bgpri[2] = 'priorb';
00047     $bgpri[3] = 'priorc';
00048     $bgpri[4] = 'priord';
00049     $bgpri[5] = 'priore';
00050     $bgpri[6] = 'priorf';
00051     $bgpri[7] = 'priorg';
00052     $bgpri[8] = 'priorh';
00053     $bgpri[9] = 'priori';
00054 
00055     $bgpri[11] = 'prioraclosed';
00056     $bgpri[12] = 'priorbclosed';
00057     $bgpri[13] = 'priorcclosed';
00058     $bgpri[14] = 'priordclosed';
00059     $bgpri[15] = 'prioreclosed';
00060     $bgpri[16] = 'priorfclosed';
00061     $bgpri[17] = 'priorgclosed';
00062     $bgpri[18] = 'priorhclosed';
00063     $bgpri[19] = 'prioriclosed';
00064 
00065   }
00066 
00067 
00068   function box_top ($title, $subclass="", $noboxitem=0)
00069   {
00070     $return = '     <div class="box'.$subclass.'">
00071        <div class="boxtitle">'.$title.'</div><!-- end boxtitle -->';
00072     if (!$noboxitem)
00073       {
00074         $return .= '
00075        <div class="boxitem">';
00076       }
00077     return $return;
00078   }
00079 
00080 # Box Middle, equivalent to html_box1_middle()
00081   function box_middle ($title, $noboxitem=0)
00082   {
00083     $return = '</div><!-- end boxitem -->
00084        <div class="boxtitle">'.$title.'</div><!-- end boxtitle -->';
00085     if (!$noboxitem)
00086       {
00087         $return .= '
00088        <div class="boxitem">';
00089       }
00090     return $return;
00091   }
00092 
00093 # Box Middle, equivalent to html_box1_middle()
00094   function box_nextitem ($class)
00095   {
00096     return '</div><!-- end boxitem -->
00097        <div class="'.$class.'">';
00098   }
00099 
00100 # Box Bottom, equivalent to html_box1_bottom()
00101   function box_bottom ($noboxitem=0)
00102   {
00103     if (!$noboxitem)
00104       {
00105         $return = '</div><!-- end boxitem -->';
00106       }
00107 
00108     $return .= '
00109      </div><!-- end box -->
00110 ';
00111     return $return;
00112   }
00113 
00114 
00115 
00116 # Box Top, equivalent to html_box1_top()
00117   function box1_top ($title,$echoout=1,$subclass="")
00118   {
00119     $return = '<table class="box'.$subclass.'">
00120                 <tr>
00121                         <td colspan="2" class="boxtitle">'.$title.'</td>
00122                 </tr>
00123                 <tr>
00124                         <td colspan="2" class="boxitem">';
00125     if ($echoout)
00126       { print $return; }
00127     else
00128       { return $return;}
00129   }
00130 
00131 # Box Middle, equivalent to html_box1_middle()
00132   function box1_middle ($title,$bgcolor='')
00133   {
00134     return '
00135                         </td>
00136                 </tr>
00137                 <tr>
00138                         <td colspan="2" class="boxtitle">'.$title.'</td>
00139                 </tr>
00140                 <tr>
00141                         <td colspan=2 class="boxitem">';
00142   }
00143 
00144 # Box Bottom, equivalent to html_box1_bottom()
00145   function box1_bottom ($echoout=1)
00146   {
00147     $return = '
00148                         </td>
00149                 </tr>
00150         </table>';
00151     if ($echoout)
00152       {  print $return; }
00153     else
00154       { return $return; }
00155   }
00156 
00157   function generic_header_start ($params)
00158   {
00159     global $G_USER, $G_SESSION;
00160 
00161 # Avoid any cache by setting an expire time in the past, without
00162 # distinction.
00163 # On Savane there are many forms, the content changes frequently,
00164 # it is probably better to avoid any cache problem that way.
00165 # We could use the Lastest-Modification header, but it would require
00166 # an extra call to time().
00167     $context = $params['context'];
00168     if ($context)
00169       {
00170 # Only make the test if context is set.
00171 # Then look for usual trackers (bugs, patch...), project admin part
00172 # and personal area (/my)
00173         if ("news" == $context ||
00174             "support" == $context ||
00175             "bugs" == $context ||
00176             "task" == $context ||
00177             "my" == $context ||
00178             "myitems" == $context ||
00179             "mygroups" == $context ||
00180             ereg("^a", $context))
00181           {
00182             header("Expires: Thu, 22 Dec 1977 15:00:00 GMT");
00183             dbg("Expires is set.");
00184           }
00185       }
00186 
00187     $title = context_title($context, $params['group']);
00188 
00189 
00190     if ($params['title'] && $title)
00191       {
00192         $params['title'] = sprintf("%s: %s", $title, $params['title']);
00193       }
00194     elseif ($title)
00195       {
00196         $params['title'] = $title;
00197       }
00198 
00199     $params['title'] = sprintf("%s  [%s]", $params['title'], $GLOBALS['sys_name']);
00200 
00201     print '<?xml version="1.0" encoding="utf-8"?>
00202 <!DOCTYPE html
00203         PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
00204          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
00205 <html xmlns="http://www.w3.org/1999/xhtml" lang="'.SV_LANG.'" xml:lang="'.SV_LANG.'">
00206 <head>
00207   <title>'.$params['title'].'</title>
00208   <meta name="Generator" content="Savane '.$GLOBALS['savane_version'].', see '.$GLOBALS['savane_url'].'" />
00209   <meta http-equiv="Content-Script-Type" content="text/javascript" />
00210   <link rel="stylesheet" type="text/css" href="'.$GLOBALS['sys_home'].'css/'.SV_THEME.'.css" />
00211   <link rel="icon" type="image/png" href="'.$GLOBALS['sys_home'].'images/'.SV_THEME.'.theme/icon.png" />
00212 ';
00213     utils_get_content("page_header");
00214   }
00215   function generic_header_end ($params)
00216   {
00217     print '
00218 </head>';
00219   }
00220 
00221   function generic_footer ($params)
00222   {
00223     print '<p class="footer">';
00224     utils_get_content("page_footer");
00225 
00226     # Powered by is no longer translated: it allows us to search on google
00227     # for a simple string to find public site running Savane, which would be
00228     # more complicated if it was i18n-ized
00229     print ' </p>
00230  <div align="right">'.utils_link($GLOBALS['savane_url'], sprintf("Powered by Savane %s", $GLOBALS['savane_version'])).'</div>';
00231 
00232 # yeupou--gnu.org 2005-09-16:
00233 # Dirty hack to get rid of serious issue in MSIE handling of
00234 # CSS.
00235 # If we are using MSIE, we havent closed main and realbody yet,
00236 # because the footer wouldnt be visible otherwise.
00237     if (strpos($_SERVER['HTTP_USER_AGENT'], "MSIE") && !$_GET["printer"])
00238       {
00239         print '</div></div>';
00240       }
00241     print '
00242 </body>
00243 </html>';
00244   }
00245 
00246   function header ($params)
00247   {
00248     $this->generic_header_start($params);
00249     $this->generic_header_end($params);
00250     
00251     
00252     # Hide the box option if any
00253     unset($script_hide);
00254     if (!sane_all("printer"))
00255       {
00256         $script_hide = ' onload="document.getElementById(\'boxoptionscontent\').style.display=\'none\'; document.getElementById(\'boxoptionslinkhide\').style.display=\'none\'; document.getElementById(\'boxoptionslinkshow\').style.display=\'inline\';"';
00257       }
00258 
00259     print '
00260 <body'.$script_hide.'>
00261 <div class="realbody">
00262 ';
00263     menu_print_sidebar($params);
00264 
00265 # yeupou--gnu.org 2005-09-16:
00266 # Dirty hack to get rid of serious issue in MSIE handling of
00267 # CSS.
00268 # Please, do never add such an hack in savane somewhere else without
00269 # talking about it on savane-dev.
00270 # DONT CHANGE width, margin and padding size, or you ll be very sorry
00271 # for MSIE users
00272 # (do nothing in printer mode)
00273     unset($dirtyhack);
00274     if (strpos($_SERVER['HTTP_USER_AGENT'], "MSIE") && !$_GET["printer"])
00275       { $dirtyhack = ' style="position: absolute; width: 83%; margin-left: 0.5%;  overflow: visible;"'; }
00276     print '
00277  <div class="main"'.$dirtyhack.'><a name="top"></a>
00278 ';
00279 
00280   }
00281 
00282   function footer ($params)
00283   {
00284     print '
00285   <p class="backtotop">
00286   '.utils_link("#top", '<img src="'.$GLOBALS['sys_home'].'images/'.SV_THEME.'.theme/top.orig.png" border="0" alt="'._("Back to the top").'" />').'
00287   </p>';
00288 # yeupou--gnu.org 2005-09-16:
00289 # Dirty hack to get rid of serious issue in MSIE handling of
00290 # CSS.
00291 # If we are using MSIE, we cannot close main, because the footer
00292 # will never be visible otherwise.
00293     if (!strpos($_SERVER['HTTP_USER_AGENT'], "MSIE") || $_GET["printer"])
00294       {
00295         print '
00296  </div><!-- end main -->
00297 <br class="clear" />
00298 </div><!-- end realbody -->
00299 ';
00300       }
00301 
00302     $this->generic_footer ($params);
00303 
00304   }
00305 
00306 # ######################################### LEFT MENU
00307 
00308 # title of left menu part
00309   function menuhtml_top ($title)
00310   {
00311     print '
00312         <li class="menutitle">
00313            '.$title.'
00314         </li><!-- end menutitle -->';
00315   }
00316 
00317 # left menu entry
00318   function menu_entry ($link, $title, $available=1, $help=0)
00319   {
00320     print '
00321         <li class="menuitem">
00322            '.utils_link($link, $title, "menulink", $available, $help).'
00323         </li><!-- end menuitem -->';
00324   }
00325 
00326 # end of left menu part
00327   function menuhtml_bottom ()
00328   {
00329 
00330   }
00331 
00332 # ######################################### TOP MENU
00333 
00334 # Generic function
00335 
00336   function maintab_start ($title,$typeadmin=0)
00337   {
00338 # FIXME: it is still used?
00339 #<div class="topmenu"><div class="'.($typeadmin ? 'topmenurestricted' : 'topmenupublic').'">
00340 
00341     return  '
00342     <div class="topmenu">
00343       <span class="topmenutitle">'.$title.'</span>
00344       <div class="topmenuitem">';
00345   }
00346 
00347   function maintab_stop ()
00348   {
00349     return  '
00350       </div><!-- end topmenuitem -->
00351     </div><!-- end topmenu -->
00352 
00353 ';
00354 #</div></div><!-- end topmenu + public/restricted -->
00355   }
00356 
00357   function subtab_start ()
00358   {
00359     return  '
00360        </div><!-- end topmenuitem -->
00361       <div class="topmenuitem"><span class="smaller">
00362          &gt;&gt;&nbsp;&nbsp;';
00363   }
00364 
00365   function subtab_stop ()
00366   {
00367 # no need to close the topmenuitem div, it is handled by maintab_stop()
00368     return  '</span>';
00369   }
00370 
00371 
00372   function maintab_entry ($url, $title, $selected=0, $available=1, $help=0)
00373   {
00374     if ($selected)
00375       { return "\n        ".utils_link($url, $title, "tabselect", $available, $help); }
00376     else
00377       { return "\n        ".utils_link($url, $title, "tabs", $available, $help); }
00378   }
00379 
00380   function subtab_entry ($url, $title, $selected=0, $available=1, $help=0)
00381   {
00382     return $this->maintab_entry($url,$title,$selected,$available,$help);
00383   }
00384 
00385   function maintab_separator ()
00386   {
00387     return ' |&nbsp;';
00388   }
00389 
00390   function subtab_separator ()
00391   {
00392     return ' |&nbsp;';
00393   }
00394 
00395 ##############################################################
00396 # Depending on the context, this function will ask proper tabs to be brought
00397 
00398   function tabs ($params)
00399   {
00400     global $group_id;
00401 
00402 # Print topmenu title
00403     print '<h2 class="toptitle"><img src="'.$GLOBALS['sys_home'].'images/'.SV_THEME.'.theme/'.context_icon().'.orig.png" width="48" height="48" alt="'.context_icon().'" class="pageicon" />';
00404     print context_title();
00405 
00406     if ($params['title'] != "")
00407       { print _(": ").$params['title']; }
00408 
00409     print '</h2>';
00410 
00411 # Now call the specific tab function
00412     switch (CONTEXT)
00413       {
00414       case 'my': $this->user_tabs(); break;
00415       case 'siteadmin': $this->admin_tabs(); break;
00416       case 'userguide': $this->project_tabs(); break;
00417       case isset($group_id): $this->project_tabs(); break;
00418       default: $this->site_tabs();
00419       }
00420   }
00421 
00422 #  TOP MENU FUNCTIONS SPECIFIC TO: users personal pages
00423 
00424 
00425   function user_tabs ()
00426   {
00427     $tabDatas = array();
00428 
00429     $tabDatas[] = $this->maintab_entry($GLOBALS['sys_home'].'my/', _("Incoming Items"), SUBCONTEXT == 'browse', 1, _("What's new for me?"));
00430     $tabDatas[] = $this->maintab_entry($GLOBALS['sys_home'].'my/items.php', _("Items"), SUBCONTEXT == 'items', 1, _("Browse my items (bugs, tasks, bookmarks...)"));
00431     if (user_use_votes())
00432       {
00433         $tabDatas[] = $this->maintab_entry($GLOBALS['sys_home'].'my/votes.php', _("Votes"), SUBCONTEXT == 'votes', 1, _("Browse items I voted for"));
00434       }
00435     $tabDatas[] = $this->maintab_entry($GLOBALS['sys_home'].'my/groups.php', _("Group Membership"), SUBCONTEXT == 'groups', 1, _("List the groups I belong to"));
00436     if (user_get_preference("use_bookmarks"))
00437       {
00438         $tabDatas[] = $this->maintab_entry($GLOBALS['sys_home'].'my/bookmarks.php', _("Bookmarks"), SUBCONTEXT == 'bookmarks', 1, _("List my bookmarks"));
00439       }
00440 
00441     $tabDatas[] = $this->maintab_entry($GLOBALS['sys_home'].'my/admin/',  _("Account Configuration"), SUBCONTEXT == 'configure', 1, _("Account configuration: authentication, cosmetics preferences..."));
00442 
00443     print $this->maintab_start(_("My"));
00444     print join ($this->maintab_separator(),$tabDatas);
00445     print $this->maintab_stop();
00446 
00447   }
00448 
00449 #  TOP MENU FUNCTIONS SPECIFIC TO: server admin pages
00450 
00451   function admin_tabs ()
00452   {
00453 
00454     /*
00455         FIRST STEP: pointer to each feature activated
00456     */
00457 
00458     $tabDatas[] = $this->maintab_entry($GLOBALS['sys_home'].'admin/' ,
00459                                        _("Home"),
00460                                        SUBCONTEXT == 'browse');
00461 
00462     $tabDatas[] = $this->maintab_entry($GLOBALS['sys_home'].'admin/group_type.php' ,
00463                                        _("Group Type Management"),
00464                                        SUBCONTEXT == 'grouptype');
00465 
00466     $tabDatas[] = $this->maintab_entry($GLOBALS['sys_home'].'admin/grouplist.php' ,
00467                                        _("Group Management"),
00468                                        SUBCONTEXT == 'groupedit');
00469 
00470     $tabDatas[] = $this->maintab_entry($GLOBALS['sys_home'].'admin/userlist.php' ,
00471                                        _("User Management"),
00472                                        SUBCONTEXT == 'useredit');
00473 
00474     $tabDatas[] = $this->maintab_entry($GLOBALS['sys_home'].'people/admin/' ,
00475                                        _("Contributor Wanted Management"));
00476 
00477 
00478     /*
00479         SECOND STEP: pointer to the submenus
00480     */
00481 
00482     $subTabDatas = array();
00483     if (SUBCONTEXT == "browsing")
00484       {
00485         $subTabDatas[] = $this->subtab_entry($GLOBALS['sys_home'].'task/?group='.$GLOBALS['sys_unix_group_name'].'&amp;category_id=1&amp;status_id=1&amp;go_report=Apply' ,
00486                                              _("Pending Project Registrations"));
00487 
00488         $subTabDatas[] = $this->subtab_entry($GLOBALS['sys_home'].'news/approve.php?group='.$GLOBALS['sys_unix_group_name'] ,
00489                                              _("Site news approval"));
00490 
00491         $subTabDatas[] = $this->subtab_entry($GLOBALS['sys_home'].'admin/lastlogins.php' ,
00492                                              _("Most Recent Logins"));
00493 
00494       }
00495 
00496     if (SUBCONTEXT == "groupedit")
00497       {
00498         if ($GLOBALS['group_name'])
00499           {
00500             $subTabDatas[] = $this->subtab_entry($GLOBALS['sys_home'].'project/admin/?group='.$GLOBALS['group_name'] ,
00501                                                  _("This Project Admin"));
00502 
00503             $subTabDatas[] = $this->subtab_entry($GLOBALS['sys_home'].'project/admin/editgroupfeatures.php?group='.$GLOBALS['group_name'],
00504                                                  _("This Project Active Features"),
00505                                                  0);
00506 
00507             $subTabDatas[] = $this->subtab_entry($GLOBALS['sys_home'].'project/admin/useradmin.php?group='.$GLOBALS['group_name'] ,
00508                                                  _("Manage This Project Members"));
00509 
00510             $subTabDatas[] = $this->subtab_entry($GLOBALS['sys_home'].'project/admin/history.php?group='.$GLOBALS['group_name'],
00511                                                  _("Show This Project History"),
00512                                                  0);
00513 
00514           }
00515       }
00516 
00517     print $this->maintab_start(_("Server Admin"),1);
00518     print join ($this->maintab_separator(),$tabDatas);
00519 
00520     if ($subTabDatas)
00521       {
00522         print $this->subtab_start();
00523         print join ($this->subtab_separator(),$subTabDatas);
00524         print $this->subtab_stop();
00525       }
00526 
00527     print $this->maintab_stop();
00528   }
00529 
00530 #  TOP MENU FUNCTIONS SPECIFIC TO: project pages
00531 
00532   function project_tabs ()
00533   {
00534     global $group_id, $sys_group_id;
00535 
00536     if (CONTEXT == 'userguide')
00537       {
00538         $GLOBALS['group_id'] = $sys_group_id;
00539         $GLOBALS['group_name'] = $GLOBALS['sys_unix_group_name'];
00540       }
00541 
00542 # get group info using the common result set
00543     $project=project_get_object($group_id);
00544 
00545     if ($project->isError())
00546       {
00547 #wasnt found or some other problem
00548         return;
00549       }
00550 
00551 # FIXME: in which cases do we have this "special" thing? I dont remember.
00552 # The if was supposed to prevent the context title to show up
00553 #if ($context != "special")
00554 
00555 
00556     /*
00557 
00558     FIRST STEP: pointer to each feature activated
00559 
00560     */
00561 
00562     $tabDatas = array();
00563 
00564 # Summary
00565     $tabDatas[] = $this->maintab_entry($GLOBALS['sys_home'].'projects/'. $project->getUnixName() .'/', _("Main"), (CONTEXT == 'project' && SUBCONTEXT != 'configure'), 1, _("Project Main Page"));
00566 
00567 # Homepage
00568     if ($project->Uses("homepage"))
00569       {
00570         $tabDatas[] = $this->maintab_entry($project->getUrl("homepage"), _("Homepage"),0, 1, _("Browse Project Homepage (outside of Savane)"));
00571       }
00572 
00573 # Documentation (internal): Cookbook
00574 # Projects dont have the choice to use it, as there maybe site doc that
00575 # applies to features they use
00576     $tabDatas[] = $this->maintab_entry($project->getArtifactUrl("cookbook"), _("Cookbook"), (CONTEXT == 'cookbook' && SUBCONTEXT != 'configure'), 1, _("User Docs: Cookbook containing useful howtos"));
00577 
00578 # Documentation (internal 2): User Guide
00579 # This is only on the system group
00580     if ($group_id == $sys_group_id)
00581       {
00582         $tabDatas[] = $this->maintab_entry($GLOBALS['sys_home'].'userguide/', _("In Depth Guide"), (CONTEXT == 'userguide'), 1, _("User Docs: In Depth Guide"));
00583       }
00584 
00585 # Documentation (extra link)
00586     if ($project->Uses("extralink_documentation"))
00587       {
00588         $tabDatas[] = $this->maintab_entry($project->getUrl("extralink_documentation"), _("Other Docs"),0,1, _("Browse Other Documentation"));
00589       }
00590 
00591 # Downloads
00592     if ($project->Uses("download"))
00593       {
00594         $tabDatas[] = $this->maintab_entry($project->getArtifactUrl("files"), _("Files"), (CONTEXT == 'download' && SUBCONTEXT != 'configure'),1, _("Browse the Filelist (Download Area)"));
00595       }
00596 
00597 # Support Tracking
00598     if ($project->Uses("support"))
00599       {
00600         $tabDatas[] = $this->maintab_entry($project->getArtifactUrl("support"), _("Support"), (CONTEXT == 'support' && SUBCONTEXT != 'configure'),  1, _("Tech Support Tracker: post, search and manage support requests"));
00601 
00602       }
00603 
00604 # Forums
00605     if ($project->Uses("forum"))
00606       {
00607         $tabDatas[] = $this->maintab_entry($project->getArtifactUrl("forum"), _("Forum"), (CONTEXT == 'forum' && SUBCONTEXT != 'configure'), 1, _("Forum"));
00608       }
00609 
00610 # Mailing Lists
00611     if ($project->usesMail())
00612       {
00613         $tabDatas[] = $this->maintab_entry($project->getArtifactUrl("mail"), _("Mailing Lists"), (CONTEXT == 'mail' && SUBCONTEXT != 'configure'), 1, _("List existing Mailing Lists"));
00614       }
00615 
00616 # SCMs
00617     if ($project->Uses("cvs") || $project->UsesForHomepage("cvs"))
00618       {
00619         $tabDatas[] = $this->maintab_entry($project->getArtifactUrl("cvs"), _("CVS"), CONTEXT == 'cvs', 1, _("Source Code Manager: CVS Repository"));
00620       }
00621 
00622     if ($project->Uses("arch") || $project->UsesForHomepage("arch"))
00623       {
00624         $tabDatas[] = $this->maintab_entry($project->getArtifactUrl("arch"), _("Arch"), CONTEXT == 'arch', 1, _("Source Code Manager: Arch Repository"));
00625       }
00626 
00627     if ($project->Uses("svn") || $project->UsesForHomepage("svn"))
00628       {
00629         $tabDatas[] = $this->maintab_entry($project->getArtifactUrl("svn"), _("SVN"), CONTEXT == 'svn', 1, _("Source Code Manager: Subversion Repository"));
00630       }
00631 
00632 
00633 # Bug Tracking
00634     if ($project->Uses("bugs"))
00635       {
00636         $tabDatas[] = $this->maintab_entry($project->getArtifactUrl("bugs"), _("Bugs"), (CONTEXT == 'bugs' && SUBCONTEXT != 'configure'), 1, _("Bug Tracker: report, search and track bugs"));
00637       }
00638 
00639 # Task Tracker
00640     if ($project->Uses("task"))
00641       {
00642         $tabDatas[] = $this->maintab_entry($project->getArtifactUrl("task"), _("Tasks"), (CONTEXT == 'task' && SUBCONTEXT != 'configure'), 1, _("Task Manager: post, search and manage tasks"));
00643       }
00644 
00645 # Patch Manager
00646     if ($project->Uses("patch"))
00647       {
00648         $tabDatas[] = $this->maintab_entry($project->getArtifactUrl("patch"), _("Patches"), (CONTEXT == 'patch' && SUBCONTEXT != 'configure'), 1, _("Patch Manager: post, search and manage patches"));
00649       }
00650 
00651 # News: the last because it is on the frontpage
00652     if ($project->Uses("news"))
00653       {
00654         $tabDatas[] = $this->maintab_entry($GLOBALS['sys_home'].'news/?group='.$project->getUnixName(), _("News"), (CONTEXT == 'news' && SUBCONTEXT != 'configure'), 1, _("Read latest News, post News"));
00655       }
00656 
00657 # Search: as all projects now use the cookbook, search is always accurate
00658     $tabDatas[] = $this->maintab_entry($GLOBALS['sys_home'].'project/search.php?group='.$project->getUnixName(), _("Search"), (SUBCONTEXT == 'search' && CONTEXT == 'project') , 1, _("Search items of this project trackers"));
00659 
00660 
00661 
00662     /*
00663 
00664     SECOND STEP: pointer to the submenus
00665 
00666     */
00667     unset($subTabDatas);
00668     if (SUBCONTEXT != "configure")
00669       {
00670         $subTabDatas = array();
00671         if (CONTEXT == "bugs" ||
00672             CONTEXT == "support" ||
00673             CONTEXT == "patch" ||
00674             CONTEXT == "task")
00675           {
00676 # The following code was not properly i18ned. Therefore we need
00677 # these arrays to better suit translation.
00678             switch (CONTEXT)
00679               {
00680               case "bugs":
00681                 $linktitle["submit"] = _("Submit a bug");
00682                 $linktitle["browse_open"] = _("Browse open bugs");
00683 #               $linktitle["browse_my"] = _("Browse my bugs");
00684                 $linktitle["digest"] = _("Digest bugs");
00685                 $linktitle["export"] = _("Export bugs");
00686                 $linktitle["search"] = _("Search a bug");
00687                 break;
00688               case "support":
00689                 $linktitle["submit"] = _("Submit a request");
00690                 $linktitle["browse_open"] = _("Browse open requests");
00691 #               $linktitle["browse_my"] = _("Browse my requests");
00692                 $linktitle["digest"] = _("Digest requests");
00693                 $linktitle["export"] = _("Export requests");
00694                 $linktitle["search"] = _("Search a request");
00695                 break;
00696               case "patch":
00697                 $linktitle["submit"] = _("Submit a patch");
00698                 $linktitle["browse_open"] = _("Browse open patches");
00699 #               $linktitle["browse_my"] = _("Browse my patches");
00700                 $linktitle["digest"] = _("Digest patches");
00701                 $linktitle["export"] = _("Export patches");
00702                 $linktitle["search"] = _("Search a patch");
00703                 break;
00704               case "task":
00705                 $linktitle["submit"] = _("Submit a task");
00706                 $linktitle["browse_open"] = _("Browse open tasks");
00707 #               $linktitle["browse_my"] = _("Browse my tasks");
00708                 $linktitle["digest"] = _("Digest tasks");
00709                 $linktitle["export"] = _("Export tasks");
00710                 $linktitle["search"] = _("Search a task");
00711                 break;
00712               }
00713 
00714             $subTabDatas[] = $this->subtab_entry('./?func=additem&amp;group='.$project->getUnixName(),
00715                                                  $linktitle["submit"],
00716                                                  0,
00717                                                  group_restrictions_check($group_id, CONTEXT));
00718 
00719 
00720             $subTabDatas[] = $this->subtab_entry('./?func=browse&amp;set=open&amp;group='.$project->getUnixName(),
00721                                                  $linktitle["browse_open"]);
00722 
00723 # Deprecated:
00724 #   kind of babysitting for the user to give a shortcut to what he can do
00725 #   in 2 clicks, while getting the menu line longer and longer
00726 #
00727 #           $subTabDatas[] = $this->subtab_entry('./?func=browse&amp;set=my&amp;group='.$project->getUnixName(),
00728 #                                                $linktitle["browse_my"],
00729 #                                                0,
00730 #                                                user_isloggedin());
00731 
00732             $subTabDatas[] = $this->subtab_entry('./?func=digest&amp;group='.$project->getUnixName(),
00733                                                  $linktitle["digest"]);
00734 
00735             $subTabDatas[] = $this->subtab_entry('export.php?group='.$project->getUnixName(),
00736                                                  $linktitle["export"],
00737                                                  0,
00738                                                  member_check(0, $group_id));
00739 
00740             $subTabDatas[] = $this->maintab_entry('reporting.php?group='.$project->getUnixName(),
00741                                                   _("Statistics"), 0);
00742 
00743             # At the end of the submenu, for cohesion with the "search" in the
00744             # menu that is also at the end
00745             $subTabDatas[] = $this->subtab_entry('./?func=search&amp;group='.$project->getUnixName(),
00746                                                  $linktitle["search"]);
00747 
00748           }
00749         else if (CONTEXT == "cookbook")
00750           {
00751 # Quite similar to other trackers, the cookbook have some specific
00752 # links
00753             $subTabDatas[] = $this->subtab_entry('./?group='.$project->getUnixName(),
00754                                                  _("Browse recipes"));
00755 
00756             $subTabDatas[] = $this->subtab_entry('edit.php?func=additem&amp;group='.$project->getUnixName(),
00757                                                  _("Submit a recipe"),
00758                                                  0,
00759                                                  group_restrictions_check($group_id, CONTEXT));
00760 
00761 
00762             $subTabDatas[] = $this->subtab_entry('edit.php?func=browse&amp;group='.$project->getUnixName(),
00763                                                  _("Edit recipes"),
00764                                                  0,
00765                                                  group_restrictions_check($group_id, CONTEXT));
00766 
00767             $subTabDatas[] = $this->subtab_entry('edit.php?func=digest&amp;group='.$project->getUnixName(),
00768                                                  _("Digest recipes"));
00769 
00770             $subTabDatas[] = $this->subtab_entry('export.php?group='.$project->getUnixName(),
00771                                                  _("Export recipes"),
00772                                                  0,
00773                                                  member_check(0, $group_id));
00774 
00775 #  Does it make sense on a documentation tool?
00776 #           $subTabDatas[] = $this->maintab_entry('reporting.php?group='.$project->getUnixName(),
00777 #                                                 _("Statistics"), 0);
00778 
00779             # At the end of the submenu, for cohesion with the "search" in the
00780             # menu that is also at the end
00781             $subTabDatas[] = $this->subtab_entry('./?func=search&amp;group='.$project->getUnixName(),
00782                                                  _("Search a recipe"));
00783 
00784           }
00785         else if (CONTEXT == "news")
00786           {
00787 
00788             $subTabDatas[] = $this->subtab_entry($GLOBALS['sys_home'].'news/submit.php?group='.$project->getUnixName(),
00789                                                  _("Submit News"),
00790                                                  0,
00791                                                  group_restrictions_check($group_id, CONTEXT));
00792 
00793             $subTabDatas[] = $this->subtab_entry($GLOBALS['sys_home'].'news/approve.php?group='.$project->getUnixName(),
00794                                                  _("Manage Submitted News"),
00795                                                  0,
00796                                                  member_check(0, $group_id, "N3"));
00797 
00798           }
00799         else if (CONTEXT == "download")
00800           {
00801             if (member_check(0, $group_id))
00802               {
00803                 $subTabDatas[] = $this->subtab_entry('add.php?group='.$project->getUnixName(),
00804                                                      _("Add Files"), 0);
00805               }
00806           }
00807         else if (CONTEXT == "cvs" || CONTEXT == "arch" || CONTEXT == "svn")
00808           {
00809             if ($project->Uses(CONTEXT) && $project->getUrl(CONTEXT."_viewcvs") != 'http://' && $project->getUrl(CONTEXT."_viewcvs") != '')
00810               {
00811                 $subTabDatas[] = $this->subtab_entry($project->getUrl(CONTEXT."_viewcvs"),
00812                                                      _("Browse Sources Repository"), 0);
00813               }
00814             if($project->UsesForHomepage(CONTEXT) && $project->getUrl("cvs_viewcvs_homepage") != 'http://' && $project->getUrl("cvs_viewcvs_homepage") != '' && $project->Uses("homepage"))
00815               {
00816                 $subTabDatas[] = $this->subtab_entry($project->getUrl("cvs_viewcvs_homepage"),
00817                                                      _("Browse Web Pages Repository"), 0);
00818               }
00819           }
00820       }
00821 
00822 # print the public menu :
00823 
00824     print $this->maintab_start(_("Public Areas"));
00825     print join ($this->maintab_separator(),$tabDatas);
00826     if ($subTabDatas)
00827       {
00828         print $this->subtab_start();
00829         print join ($this->subtab_separator(),$subTabDatas);
00830         print $this->subtab_stop();
00831       }
00832     print $this->maintab_stop();
00833 
00834     /*
00835 
00836     THIRD STEP: pointer for admins to features activated
00837 
00838          While admin will have any links availables, project members will
00839          only get links if they got appropriate administrative rights.
00840 
00841          Update: in fact, only _project_ admins will get links for most
00842          of the trackers since _trackers_ admins are not allowed to
00843          configure trackers. _trackers_adminsa are only managers.
00844 
00845     */
00846 
00847     if (member_check(0, $group_id, 'A'))
00848       {
00849         $tabDatas = array();
00850 
00851         $tabDatas[] = $this->maintab_entry($GLOBALS['sys_home'].'project/admin/?group='.$project->getUnixName(),
00852                                            _("Main"), (CONTEXT == 'project' && SUBCONTEXT == 'configure'), 1, _("Project Administration Main Page"));
00853 
00854 
00855         $tabDatas[] = $this->maintab_entry($GLOBALS['sys_home'].'cookbook/admin/?group='.$project->getUnixName(),
00856                                            _("Cookbook"), (CONTEXT == 'cookbook' && SUBCONTEXT == 'configure'), 1, _("Cookbook: edit notifications, field usage, field values..."));
00857 
00858         if ($project->Uses("support"))
00859           {
00860             $tabDatas[] = $this->maintab_entry($GLOBALS['sys_home'].'support/admin/?group='.$project->getUnixName(),
00861                                                _("Support"), (CONTEXT == 'support' && SUBCONTEXT == 'configure'), 1, _("Tech Support Tracker: edit notifications, field usage, field values..."));
00862           }
00863 
00864         if ($project->Uses("forum"))
00865           {
00866             $tabDatas[] = $this->maintab_entry($GLOBALS['sys_home'].'forum/admin/?group='.$project->getUnixName(),
00867                                                _("Forum"), (CONTEXT == 'forum' && SUBCONTEXT == 'configure'));
00868           }
00869 
00870         if ($project->usesMail())
00871           {
00872             $tabDatas[] = $this->maintab_entry($GLOBALS['sys_home'].'mail/admin/?group='.$project->getUnixName(),
00873                                                _("Mailing Lists"), (CONTEXT == 'mail' && SUBCONTEXT == 'configure'), 1, _("Add Mailing Lists, Update Lists Description..."));
00874           }
00875 
00876         if ($project->Uses("bugs"))
00877           {
00878             $tabDatas[] = $this->maintab_entry($GLOBALS['sys_home'].'bugs/admin/?group='.$project->getUnixName(),
00879                                                _("Bugs"), (CONTEXT == 'bugs' && SUBCONTEXT == 'configure'), 1, _("Bug Tracker: edit notifications, field usage, field values..."));
00880           }
00881 
00882         if ($project->Uses("task"))
00883           {
00884             $tabDatas[] = $this->maintab_entry($GLOBALS['sys_home'].'task/admin/?group='.$project->getUnixName(),
00885                                                _("Tasks"), (CONTEXT == 'task' && SUBCONTEXT == 'configure'), 1, _("Task Manager: edit notifications, field usage, field values..."));
00886           }
00887 
00888         if ($project->Uses("patch"))
00889           {
00890             $tabDatas[] = $this->maintab_entry($GLOBALS['sys_home'].'patch/admin/?group='.$project->getUnixName(),
00891                                                _("Patches"), (CONTEXT == 'patch' && SUBCONTEXT == 'configure'),1, _("Patch Tracker: edit notifications, field usage, field values..."));
00892           }
00893 
00894         if ($project->Uses("news"))
00895           {
00896             $tabDatas[] = $this->maintab_entry($GLOBALS['sys_home'].'news/admin/?group='.$project->getUnixName(),
00897                                                _("News"), (CONTEXT == 'news' && SUBCONTEXT == 'configure'), 1, _("News Manager: edit notifications"));
00898           }
00899 
00900         /*
00901 
00902         FINAL STEP: always for admins, pointers to subsections
00903 
00904         */
00905 
00906         unset($subTabDatas);
00907 
00908         if (SUBCONTEXT == 'configure')
00909           {
00910             $subTabDatas = array();
00911 
00912 # Main  related administration links
00913             if (CONTEXT == 'project')
00914               {
00915                 $subTabDatas[] = $this->subtab_entry($GLOBALS['sys_home'].'project/admin/editgroupinfo.php?group='.$project->getUnixName(),
00916                                                      _("Edit Public Info"), 0, 1, _("Edit project description and name"));
00917 
00918 # link to feature management
00919 
00920                 $subTabDatas[] = $this->subtab_entry($GLOBALS['sys_home'].'project/admin/editgroupfeatures.php?group='.$project->getUnixName(),
00921                                                      _("Set Active Features"), 0, 1, _("Select the tools your project use"));
00922 
00923 # link to user management
00924 
00925                 $subTabDatas[] = $this->subtab_entry($GLOBALS['sys_home'].'project/admin/useradmin.php?group='.$project->getUnixName(),
00926                                                      _("Manage Members"), 0, 1, _("Add, remove members, approve or reject requests for inclusion"));
00927 
00928 # link to user permission management
00929 
00930                 $subTabDatas[] = $this->subtab_entry($GLOBALS['sys_home'].'project/admin/userperms.php?group='.$project->getUnixName(),
00931                                                      _("Set Permissions"), 0, 1, _("Set members and group default permissions, set posting restrictions"));
00932 
00933 # link to notification settings management
00934 
00935                 $subTabDatas[] = $this->subtab_entry($GLOBALS['sys_home'].'project/admin/editgroupnotifications.php?group='.$project->getUnixName(),
00936                                                      _("Configure Notifications"), 0, 1, _("Configure mail notifications for all tools"));
00937 
00938 
00939                 $subTabDatas[] = $this->subtab_entry($GLOBALS['sys_home'].'project/admin/conf-copy.php?group='.$project->getUnixName(),
00940                                                      _("Copy Configuration"),
00941                                                      0,
00942                                                      1,
00943                                                      _("Copy the configuration of trackers of another projects"));
00944 
00945 # link to project history
00946                 $subTabDatas[] = $this->subtab_entry($GLOBALS['sys_home'].'project/admin/history.php?group='.$project->getUnixName(),
00947                                                      _("Show History"), 0, 1, _("Show Project History: members added, removed, configuration changes..."));
00948 
00949 # links to people related stuff
00950                 $subTabDatas[] = $this->subtab_entry($GLOBALS['sys_home'].'people/createjob.php?group='.$project->getUnixName(),
00951                                                      _("Post Jobs"), 0, 1, _("Post a request for contribution"));
00952 
00953                 $subTabDatas[] = $this->subtab_entry($GLOBALS['sys_home'].'people/editjob.php?group='.$project->getUnixName(),
00954                                                      _("Edit Jobs"), 0, 1, _("Edit previously posted request for contribution"));
00955 
00956               }
00957             else if (CONTEXT == "bugs" ||
00958                      CONTEXT == "support" ||
00959                      CONTEXT == "patch" ||
00960                      CONTEXT == "cookbook" ||
00961                      CONTEXT == "task")
00962               {
00963                 $subTabDatas[] = $this->subtab_entry('field_usage.php?group='.$project->getUnixName(),
00964                                                      _("Select Fields"),
00965                                                      0,
00966                                                      1,
00967                                                      _("Define what fields you want to use in this tracker"));
00968 
00969                 $subTabDatas[] = $this->subtab_entry('field_values.php?group='.$project->getUnixName(),
00970                                                      _("Edit Fields Values"),
00971                                                      0,
00972                                                      1,
00973                                                      _("Define the set of possible values for the fields you have decided to use in this tracker"));
00974 
00975                 $subTabDatas[] = $this->subtab_entry('editqueryforms.php?group='.$project->getUnixName(),
00976                                                      _("Manage Query Forms"),
00977                                                      0,
00978                                                      1,
00979                                                      _("Define project-wide query form: what search criteria to use and what item fields to show in the query form table"));
00980 
00981                 $subTabDatas[] = $this->subtab_entry('userperms.php?group='.$project->getUnixName(),
00982                                                      _("Set Permissions"),
00983                                                      0,
00984                                                      1,
00985                                                      _("Defines posting restrictions"));
00986 
00987                 $subTabDatas[] = $this->subtab_entry('notification_settings.php?group='.$project->getUnixName(),
00988                                                      _("Manage Notifications"),
00989                                                      0);
00990 
00991 
00992                 $subTabDatas[] = $this->subtab_entry('conf-copy.php?group='.$project->getUnixName(),
00993                                                      _("Copy Configuration"),
00994                                                      0,
00995                                                      1,
00996                                                      _("Copy the configuration of another tracker"));
00997 
00998 
00999                 $subTabDatas[] = $this->subtab_entry('other_settings.php?group='.$project->getUnixName(),
01000                                                      _("Other Settings"),
01001                                                      0,
01002                                                      1,
01003                                                      _("Modify the preamble shown on the item submission form"));
01004               }
01005             else if (CONTEXT == "mail")
01006               {
01007                 $subTabDatas[] = $this->subtab_entry('./?add_list=1&amp;group='.$project->getUnixName(),
01008                                                      _("Add Mailing List"), 0);
01009                 $subTabDatas[] = $this->subtab_entry('./?change_status=1&amp;group='.$project->getUnixName(),
01010                                                      _("Edit Mailing List"), 0);
01011               }
01012             else if (CONTEXT =="forum")
01013               {
01014                 $subTabDatas[] = $this->subtab_entry('./?group='.$project->getUnixName().'&amp;add_forum=1',
01015                                                      _("Add Forum"),
01016                                                      0);
01017                 $subTabDatas[] = $this->subtab_entry('./?group='.$project->getUnixName().'&amp;delete=1',
01018                                                      _("Delete Message"),
01019                                                      0);
01020                 $subTabDatas[] = $this->subtab_entry('./?group='.$project->getUnixName().'&amp;change_status=1',
01021                                                      _("Update Forum Info/Status"),
01022                                                      0);
01023                 $subTabDatas[] = $this->subtab_entry('./?group='.$project->getUnixName().'&amp;manage_members=1',
01024                                                      _("Manage Members"),
01025                                                      0);
01026               }
01027           }
01028 
01029         print $this->maintab_start(_("Administration"), 1);
01030         print join ($this->maintab_separator(),$tabDatas);
01031         if ($subTabDatas)
01032           {
01033             print $this->subtab_start();
01034             print join ($this->subtab_separator(),$subTabDatas);
01035             print $this->subtab_stop();
01036           }
01037         print $this->maintab_stop();
01038       }
01039   }
01040 
01041 #  TOP MENU FUNCTIONS SPECIFIC TO: site (like people) pages
01042 
01043   function site_tabs ()
01044   {
01045 # there is nothing for now
01046 
01047   }
01048 
01049 
01050 }
01051 
01052 ?>

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