📄 layout.class
字号:
* @param array The array of title links */ function listTableTop ($title_arr,$links_arr=false) { $return = ' <table cellspacing="0" cellpadding="1" width="100%" border="0" style="background-color:' .$this->COLOR_HTMLBOX_TITLE.'"> <tr><td> <table width="100%" border="0" cellspacing="1" cellpadding="2"> <tr style="background-color:'. $this->COLOR_HTMLBOX_TITLE .'">'; $count=count($title_arr); if ($links_arr) { for ($i=0; $i<$count; $i++) { $return .= ' <td align="center"><a class="sortbutton "href="'.$links_arr[$i].'"><span style="color:'. $this->FONTCOLOR_HTMLBOX_TITLE.'"><strong>'.$title_arr[$i].'</strong></span></a></td>'; } } else { for ($i=0; $i<$count; $i++) { $return .= ' <td align="center"><span style="color:'. $this->FONTCOLOR_HTMLBOX_TITLE.'"><strong>'.$title_arr[$i].'</strong></span></td>'; } } return $return.'</tr>'; } function listTableBottom() { return '</table></td></tr></table>'; } function outerTabs($params) { global $Language; $TABS_DIRS[]='/'; $TABS_DIRS[]='/my/'; $TABS_DIRS[]='/softwaremap/'; $TABS_DIRS[]='/snippet/'; $TABS_DIRS[]='/people/'; $TABS_TITLES[]=$Language->getText('menu','home'); $TABS_TITLES[]=$Language->getText('menu','mypage'); $TABS_TITLES[]=$Language->getText('menu','projectree'); $TABS_TITLES[]=$Language->getText('menu','code_snippet'); $TABS_TITLES[]=$Language->getText('menu','project_help_wanted'); if (user_ismember(1,'A')) { $TABS_DIRS[]='/admin/'; $TABS_TITLES[]=$Language->getText('menu','admin'); } if ($params['group']) { // get group info using the common result set $project =& group_get_object($params['group']); if ($project && is_object($project)) { if ($project->isError()) { } elseif (!$project->isProject()) { } else { $TABS_DIRS[]='/projects/'.$project->getUnixName().'/'; $TABS_TITLES[]=$project->getPublicName(); $selected=count($TABS_DIRS)-1; } } } elseif (strstr($GLOBALS['REQUEST_URI'],'/my/') || strstr($GLOBALS['REQUEST_URI'],'/account/')) { $selected=array_search("/my/", $TABS_DIRS); } elseif (strstr($GLOBALS['REQUEST_URI'],'softwaremap')) { $selected=array_search("/softwaremap/", $TABS_DIRS); } elseif (strstr($GLOBALS['REQUEST_URI'],'/snippet/')) { $selected=array_search("/snippet/", $TABS_DIRS); } elseif (strstr($GLOBALS['REQUEST_URI'],'/people/')) { $selected=array_search("/people/", $TABS_DIRS); } elseif (strstr($GLOBALS['REQUEST_URI'],'/admin/') && user_ismember(1,'A')) { $selected=(count($TABS_DIRS)-1); } else { $selected=0; } echo $this->tabGenerator($TABS_DIRS,$TABS_TITLES,false,$selected,'#E0E0E0','100%'); } /** * projectTabs() - Prints out the project tabs, contained here in case * we want to allow it to be overriden * * @param string Is the tab currently selected * @param string Is the group we should look up get title info */ function projectTabs($toptab,$group) { global $Language; // get group info using the common result set $project =& group_get_object($group); if (!$project || !is_object($project)) { return; } if ($project->isError()) { //wasn't found or some other problem return; } if (!$project->isProject()) { return; } // Summary $TABS_DIRS[]='/projects/'. $project->getUnixName() .'/'; $TABS_TITLES[]=$Language->getText('group','short_summary'); (($toptab == 'home') ? $selected=(count($TABS_TITLES)-1) : '' ); if (user_ismember($group,'A')) { // Project Admin $TABS_DIRS[]='/project/admin/?group_id='. $group; $TABS_TITLES[]=$Language->getText('group','short_admin'); (($toptab == 'admin') ? $selected=(count($TABS_TITLES)-1) : '' ); } /* Homepage $TABS_DIRS[]='http://'. $project->getHomePage(); $TABS_TITLES[]=$Language->getText('group','short_homepage'); */ // Forums if ($project->usesForum()) { $TABS_DIRS[]='/forum/?group_id='.$group; $TABS_TITLES[]=$Language->getText('group','short_forum'); (($toptab == 'forums') ? $selected=(count($TABS_TITLES)-1) : '' ); } // Artifact Tracking $TABS_DIRS[]='/tracker/?group_id='.$group; $TABS_TITLES[]=$Language->getText('group','short_tracker'); (($toptab == 'tracker' || $toptab == 'bugs' || $toptab == 'support' || $toptab == 'patch') ? $selected=(count($TABS_TITLES)-1) : '' ); // Mailing Lists if ($project->usesMail()) { $TABS_DIRS[]='/mail/?group_id='.$group; $TABS_TITLES[]=$Language->getText('group','short_mail'); (($toptab == 'mail') ? $selected=(count($TABS_TITLES)-1) : '' ); } // Project Manager if ($project->usesPm()) { $TABS_DIRS[]='/pm/?group_id='.$group; $TABS_TITLES[]=$Language->getText('group','short_pm'); (($toptab == 'pm') ? $selected=(count($TABS_TITLES)-1) : '' ); } // Doc Manager if ($project->usesDocman()) { $TABS_DIRS[]='/docman/?group_id='.$group; $TABS_TITLES[]=$Language->getText('group','short_docman'); (($toptab == 'docman') ? $selected=(count($TABS_TITLES)-1) : '' ); } // Surveys if ($project->usesSurvey()) { $TABS_DIRS[]='/survey/?group_id='.$group; $TABS_TITLES[]=$Language->getText('group','short_survey'); (($toptab == 'surveys') ? $selected=(count($TABS_TITLES)-1) : '' ); } //newsbytes if ($project->usesNews()) { $TABS_DIRS[]='/news/?group_id='.$group; $TABS_TITLES[]=$Language->getText('group','short_news'); (($toptab == 'news') ? $selected=(count($TABS_TITLES)-1) : '' ); } // CVS if ($project->usesCVS()) { $TABS_DIRS[]='/scm/?group_id='.$group; $TABS_TITLES[]=$Language->getText('group','short_cvs'); (($toptab == 'scm_index') ? $selected=(count($TABS_TITLES)-1) : '' ); } // Downloads $TABS_DIRS[]='/project/showfiles.php?group_id='.$group; $TABS_TITLES[]=$Language->getText('group','short_files'); (($toptab == 'downloads') ? $selected=(count($TABS_TITLES)-1) : '' ); echo $this->tabGenerator($TABS_DIRS,$TABS_TITLES,true,$selected,'white','100%'); } function tabGenerator($TABS_DIRS,$TABS_TITLES,$nested=false,$selected=false,$sel_tab_bgcolor='WHITE',$total_width='100%') { $dark='style="background-color:#BBBBBB"'; $light='style="background-color:'. $sel_tab_bgcolor .'"'; $count=count($TABS_DIRS); $width=intval((100/$count)); $return .= ' <!-- start tabs --> <table border="0" cellpadding="0" cellspacing="0" width="'.$total_width.'"> <tr>'; if ($nested) { $inner='-inner'; } else { $inner=''; } for ($i=0; $i<$count; $i++) { $bgcolor=(($selected==$i)?$light:$dark); $imgcolor=(($selected==$i)?'':'-dark'); $return .= ' <td '.$bgcolor.' width="9" valign="top">'. '<div align="left">'. html_image('tabs/topleft'.$inner.$imgcolor.'.png',9,9,array()).'</div></td> <td '.$bgcolor.' width="'.$width.'%" rowspan="2" align="center">'. '<a class="'. (($selected==$i)?'tabsellink':'tablink') .'" href="'. $TABS_DIRS[$i] . '">'. $TABS_TITLES[$i] .'</a></td> <td '.$bgcolor.' width="9" valign="top">'. '<div align="right">'. html_image('tabs/topright'.$inner.$imgcolor.'.png',9,9,array()).'</div></td>'; if ($i < $count-1) { $return .= '<td width="1" rowspan="2"><img src="'.$this->imgroot . 'clear.png" height="2" width="1" alt="" /></td>'; } } $return .= ' </tr> <tr>'; for ($i=0; $i<$count; $i++) { $bgcolor=(($selected==$i)?$light:$dark); $return .= '<td '.$bgcolor.'> </td>'; $return .= '<td '.$bgcolor.'> </td>'; } $return .= ' </tr> <tr>'; for ($i=0; $i<$count; $i++) { $bgcolor=(($selected==$i)?$light:'style="background-color:#999999"'); $return .= '<td '.$bgcolor.' colspan="4"><img src="'.$this->imgroot . 'clear.png" height="2" width="1" alt="" /></td>'; } return $return.' </tr> </table>'; } function searchBox() { global $Language,$words,$forum_id,$group_id,$group_project_id,$atid,$exact,$type_of_search; // if there is no search currently, set the default if ( ! isset($type_of_search) ) { $exact = 1; } print ' <form action="/search/" method="post"'.$new_window.'> <table border="0" cellpadding="0" cellspacing="0"> <tr><td> <div align="center" style="font-size:smaller"> <select name="type_of_search">'; if ($atid && $group_id) { $group =& group_get_object($group_id); if ($group && is_object($group)) { $ath = new ArtifactTypeHtml($group,$atid); if ($ath && is_object($ath)) { print ' <option value="artifact"'.( $type_of_search == 'artifact' ? ' selected="selected"' : '' ).'>'. $ath->getName() .'</option>'; } } } else if ($group_id && $forum_id) { print ' <option value="forums"'.( $type_of_search == 'forums' ? ' selected="selected"' : '' ).'>'.$Language->getText('searchbox','forum').'</OPTION>'; } else if ($group_id && $group_project_id) { print ' <option value="task"'. ( $type_of_search == 'tasks' ? ' selected="selected"' : '').'>'.$Language->getText('searchbox','task').'</option>'; } print ' <option value="soft"'.( $type_of_search == 'soft' ? ' selected="selected"' : '' ).'>'.$Language->getText('searchbox','softwaregroup').'</option>'; print ' <option value="skill"'.( $type_of_search == 'skill' ? ' selected="selected"' : '' ).'>'.$Language->getText('searchbox','skill').'</option>'; print ' <option value="people"'.( $type_of_search == 'people' ? ' selected="selected"' : '' ).'>'.$Language->getText('searchbox','people').'</option>'; print ' </select></div>';// print '<br />';// print '// <input type="CHECKBOX" name="exact" value="1"'.( $exact ? ' CHECKED' : ' UNCHECKED' ).'> Require All Words'; print '</td><td> '; if ( isset($forum_id) ) { print ' <input type="hidden" value="'.$forum_id.'" name="forum_id" />'; } if ( isset($group_id) ) { print ' <input type="hidden" value="'.$group_id.'" name="group_id" />'; } if ( isset($atid) ) { print ' <input type="hidden" value="'.$atid.'" name="atid" />'; } if ( isset($group_project_id) ){ print ' <input type="hidden" value="'.$group_project_id.'" name="group_project_id" />'; } print '</td><td>'; print ' <input type="text" size="12" name="words" value="'.$words.'" />'; print '</td><td> </td><td>'; print '<input type="submit" name="Search" value="'.$Language->getText('searchbox','search').'" />'; print ' </td></tr></table>'; print '</form>'; } /** * beginSubMenu() - Opening a submenu. * * @return string Html to start a submenu. */ function beginSubMenu () { $return = ' <p><strong>'; return $return; } /** * endSubMenu() - Closing a submenu. * * @return string Html to end a submenu. */ function endSubMenu () { $return = '</strong></p>'; return $return; } /** * printSubMenu() - Takes two array of titles and links and builds the contents of a menu. * * @param array The array of titles. * @param array The array of title links. * @return string Html to build a submenu. */ function printSubMenu ($title_arr,$links_arr) { $count=count($title_arr); $count--; for ($i=0; $i<$count; $i++) { $return .= ' <a href='.$links_arr[$i].'>'.$title_arr[$i].'</a> | '; } $return .= ' <a href='.$links_arr[$i].'>'.$title_arr[$i].'</a>'; return $return; } /** * subMenu() - Takes two array of titles and links and build a menu. * * @param array The array of titles. * @param array The array of title links. * @return string Html to build a submenu. */ function subMenu ($title_arr,$links_arr) { $return = $this->beginSubMenu () ; $return .= $this->printSubMenu ($title_arr,$links_arr) ; $return .= $this->endSubMenu () ; return $return; } /** * multiTableRow() - create a mutlilevel row in a table * * @param string the row attributes * @param array the array of cell data, each element is an array, * the first item being the text, * the subsequent items are attributes (dont include * the bgcolor for the title here, that will be * handled by $istitle * @param boolean is this row part of the title ? * */ function multiTableRow($row_attr, $cell_data, $istitle) { $return= ' <tr '.$row_attr; if ( $istitle ) { $return .=' align="center" bgcolor="'. $this->COLOR_HTMLBOX_TITLE .'"'; } $return .= '>'; for ( $c = 0; $c < count($cell_data); $c++ ) { $return .='<td '; for ( $a=1; $a < count($cell_data[$c]); $a++) { $return .= $cell_data[$c][$a].' '; } $return .= '>'; if ( $istitle ) { $return .='<font color="'.$this->FONTCOLOR_HTMLBOX_TITLE.'"><strong>'; } $return .= $cell_data[$c][0]; if ( $istitle ) { $return .='</strong></font>'; } $return .= '</td>'; } $return .= '</tr> '; return $return; }}?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -