[evolvis-commits] r17651: revert r17650 as it’s been integrated into bzr theme-evolvis now

mirabilos at evolvis.org mirabilos at evolvis.org
Fri Oct 28 18:06:55 CEST 2011


Author: mirabilos
Date: 2011-10-28 18:06:55 +0200 (Fri, 28 Oct 2011)
New Revision: 17651

Modified:
   trunk/gforge_base/evolvisforge-5.1/src/www/themes/evolvis/Theme.class.php
Log:
revert r17650 as it’s been integrated into bzr theme-evolvis now

Modified: trunk/gforge_base/evolvisforge-5.1/src/www/themes/evolvis/Theme.class.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/src/www/themes/evolvis/Theme.class.php	2011-10-28 15:47:35 UTC (rev 17650)
+++ trunk/gforge_base/evolvisforge-5.1/src/www/themes/evolvis/Theme.class.php	2011-10-28 16:06:55 UTC (rev 17651)
@@ -1,10 +1,12 @@
 <?php
-/* Evolvis theme for Tarent GmbH
+/*-
+ * Evolvis theme for tarent solutions GmbH
  * heavily modified version of the Mac OS X like theme.
+ *
  * Copyright (c) 2009, 2010, 2011
  *	Thorsten Glaser <t.glaser at tarent.de>
  * Copyright (c) 2007 Thorsten Glaser <t.glaser at aurisp.de>
- *	on behalf of Tarent GmbH
+ *	on behalf of tarent GmbH
  * Copyright (c) 2007 Waldemar Brodkorb <w.brodkorb at tarent.de>
  *
  * Copyright (c) 2002-2003 Richard Offer. All rights reserved.
@@ -28,26 +30,11 @@
  * Except as contained in this notice, the name of the author shall not be
  * used in advertising or otherwise to promote the sale, use or other dealings
  * in this Software without prior written authorization from the author.
-
  *
- * Based on the "debian" theme, which is apparantly :-
- *		Copyright 1999-2001 (c) VA Linux Systems
- *
+ * Based on the "debian" theme, which is apparantly
+ * Copyright 1999-2001 (c) VA Linux Systems
  */
 
-//for all subpages available:
-//array for directories that need right navi:
-$right_navarr[]='/forum';
-$right_navarr[]='/tracker';
-$right_navarr[]='/mail';
-$right_navarr[]='/pm';
-$right_navarr[]='/docman';
-$right_navarr[]='/news';
-$right_navarr[]='/scm';
-$right_navarr[]='/frs';
-$right_navarr[]='/project/admin';
-$right_navarr[]='/projects';
-
 class Theme extends Layout {
 
 	/**
@@ -59,82 +46,19 @@
 
 		// The root location for images
 		$this->imgroot = '/themes/evolvis/images/';
-		$this->imgproj = '/themes/evolvis/images/proj/';
 
-		// The HTML box background color
+		//XXX same as in evolvis.css
 		$this->COLOR_HTMLBOX_BACK = '#FFFFFF';
 
-		// The color to separate HTML boxes
-		$this->COLOR_HTMLBOX_SEP = '#000000';
-
-		// Font Face Constants
-		// The content font
-		$this->FONT_CONTENT = 'sans-serif';
-		// The HTML box title font
-		$this->FONT_HTMLBOX_TITLE = 'sans-serif';
-		// The HTML box title font color
-		$this->FONTCOLOR_HTMLBOX_TITLE = '#72A5D8';
-		// The content font color
-		$this->FONTCOLOR_CONTENT = '#202020';
-		//The smaller font size
-		$this->FONTSIZE_SMALLER='small';
-		//The smallest font size
-		$this->FONTSIZE_SMALLEST='x-small';
-		//The HTML box title font size
-		$this->FONTSIZE_HTMLBOX_TITLE = 'x-small';
-
-		// new variables introduced by this theme...
-
-		// background image
-		//$this->BACKGROUND= 'background.png';
-
-		// height of a tab (ie the size of the background image), 23 is specified in the
-		// style guide and so the background images were drawn for that size, changing
-		// this will lead to the images being cropped or tiled, either will look bad.
-		$this->TAB_HEIGHT=23;
-
-		// the following are not used in this theme, but have been set to obnoxious
-		// colors to help debug any new pages that make assumptions about a theme...
-		// The content background color
-		$this->COLOR_CONTENT_BACK= '#0000FF';
-		// The background color
-		$this->COLOR_BACK= '#00FF00';
-		// The HTML box title color
-		$this->COLOR_HTMLBOX_TITLE = '#FF0000';
-
-		//by cepe
-		//standard evolvis color
-		$this->EVOLVIS_COLOR='#CC0E08';
-		$this->EVOLVIS_BG_COLOR='#bebebe';
-		$this->allvar=array(	'imgroot' => '/themes/evolvis/images/',
-					'imgproj' => '/themes/evolvis/images/proj/',
-					'COLOR_HTMLBOX_BACK' => '#FFFFFF',
-					'COLOR_HTMLBOX_SEP' => '#000000',
-					'FONT_CONTENT' => 'sans-serif',
-					'FONT_HTMLBOX_TITLE' => 'sans-serif',
-					'FONTCOLOR_HTMLBOX_TITLE' => '#72A5D8',
-					'FONTCOLOR_CONTENT' => '#202020',
-					'FONTSIZE_SMALLER' => 'small',
-					'FONTSIZE_SMALLEST' => 'x-small',
-					'FONTSIZE_HTMLBOX_TITLE' => 'x-small',
-					'TAB_HEIGHT' => 23,
-					'COLOR_CONTENT_BACK' => '#0000FF',
-					'COLOR_BACK' => '#00FF00',
-					'COLOR_HTMLBOX_TITLE' => '#FF0000'
-				);
-		require_once('template.class');
-		$this->template = new template('/usr/share/gforge/www/themes/evolvis/templates/');
-		//rklein for right nav
+		$this->addStylesheet('/themes/css/evolvis.css', 'all');
+		// $this->addStylesheet('/themes/css/screen.css', 'screen');
+		$this->addStylesheet('/themes/css/print.css', 'print');
+		$this->addJavascript('/js/common.js');
+		$this->addJavascript('/js/css.js');
 		$this->project = false;
-		$this->rightnav = false;
-
-		$this->addStylesheet('/themes/css/evolvis.css','all');
-		// $this->addStylesheet('/themes/css/screen.css','screen');
-		$this->addStylesheet('/themes/css/print.css','print');
-		$this->addStylesheet('/themes/css/smoothness/jquery-ui-1.8.15.custom.css');
-		$this->addJavascript('common.js');
-		$this->addJavascript('css.js');
-		$this->addJavascript('standardista-table-sorting.js');
+		$this->emit_forgebar = true;
+		$this->collapsible_counter = 0;
+		$this->collapsible_ids = array();
 	}
 
 	function header($params) {
@@ -147,313 +71,291 @@
 		return $this->internal_header($params);
 	}
 
-	function internal_header($params) {
-		//rightnavar for right navigation by rklein
-		global $right_navarr,$group_id,$sysDTDs,$sysXMLNSs;
-		$site_fonts=' sans-serif';
-		$this->SITE_FONTS=$site_fonts;
-		$params['title'] = isset($params['title']) && $params['title'] ?
-		    forge_get_config('forge_name') . ': ' . $params['title'] : forge_get_config('forge_name');
+	function disableForgebar() {
+		$this->emit_forgebar = false;
+	}
 
-		$tpl_input['param_title']	= $params['title'];
-		$tpl_input['lang_encoding']	= 'utf-8';
-		$tpl_input['lang_doctype']	= $sysDTDs['transitional']['doctype'];
-		$tpl_input['lang_xmlns']	= $sysXMLNSs;
-		$tpl_input['lang_languagecode']	= _('en');
-		$tpl_input['issecure']		= session_issecure()?'s':'';
-		$tpl_input['default_domain']	= forge_get_config('web_host');
-		$tpl_input['SESSION_LOGGEDIN']	= session_loggedin();
-		$tpl_input['lang_getText_common_login'] = _('Log In');
-		$tpl_input['lang_getText_common_logout'] = _('Log Out');
-		$tpl_input['lang_getText_common_newaccount'] = _('New Account');
-		$tpl_input['lang_getText_common_myaccount'] = _('My Account');
-		$tpl_input['lang_getText_menu_mypage'] = _('My Page');
-
-		// ####Head-Variablen####
-
-		$tpl_input['outerTabs']=$this->outerTabs($params,0);
-		if (isset($params['group'])) {
-			$tpl_input['projectTabs'] = $this->projectTabs($params['toptab'],$params['group']);
+	function emit_headlink($inblock,$tooltip,$redtext,$target,$text) {
+		$tooltip = util_html_secure(util_ifsetor($tooltip,""));
+		if ($tooltip && $tooltip[0] == '-') {
+			$tooltip = "";
 		}
 
-		$tpl_input['publicName'] = '';
-		if (array_key_exists ('group', $params)){
-				$this->project = group_get_object($params['group']);
-				if (isset($this->project) && is_object($this->project) && !$this->project->isError() && $this->project->isProject()){
-					$tpl_input['publicName'] = "<div id=\"project_name\">Project: ".$this->project->getPublicName()."<hr class=\"hidePartForPrinting\" /></div>";
-				}
+		if ($inblock || $tooltip) {
+			$rv = '<span';
+			if ($inblock) {
+				$rv .= ' class="headblock"';
+			}
+			if ($tooltip) {
+				$rv .= ' title="' . $tooltip . '"';
+			}
+			$rv .= ">";
+			$rq = "</span>";
+		} else {
+			$rv = "";
+			$rq = "";
 		}
+		$rv .= '<span class="headlinks">//</span>' .
+		    '<a class="headlink" href="' . $target . '">' .
+		    '<span class="headlink' .
+		    ($redtext ? "s" : "") . '">' .
+		    util_html_secure($text) . "</span></a>" . $rq;
+		return $rv;
+	}
 
-		if (eregi("(msie) ([0-9]{1,2}.[0-9]{1,3})",$_SERVER['HTTP_USER_AGENT'],$regs)) {
-			$tpl_input['ie']='_ie';
+	function internal_header($params) {
+		global $_SERVER, $group_id, $sysDTDs, $sysXMLNSs;
+
+		$has_group = false;
+		if (array_key_exists('group', $params)) {
+			$this->project = group_get_object($params['group']);
+			if (isset($this->project) && is_object($this->project) &&
+			    !$this->project->isError() && $this->project->isProject()) {
+				$group_id = $this->project->getID();
+				$has_group = true;
+			}
 		}
-		$this->template->assign_vars($tpl_input);
-		$this->template->assign_vars($this->allvar);
-		$this->template->set_filenames(array(
-		    'head' => 'header_htmlhead.tpl',
-		    'body' => 'header_body.tpl'
-		));
+
+		$params['title'] = isset($params['title']) && $params['title'] ?
+		    forge_get_config('forge_name') . ': ' . $params['title'] :
+		    forge_get_config('forge_name');
+
 		if ($this->emit_html_head) {
-			$this->template->pparse('head');
+			echo '<' .
+			    '?xml version="1.0" encoding="utf-8" ?' . ">\n";
+			echo $sysDTDs['transitional']['doctype'];
+?>
+<html <?php echo $sysXMLNSs; ?> xml:lang="en" lang="<?php echo _('en'); ?>">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title><?php echo util_html_secure($params['title']); ?></title>
+<?php
 			$this->headerCSS();
-                        $this->headerJS();
+			$this->headerJS();
 			$this->headerForgepluckerMeta();
-			if (strpos($_SERVER['HTTP_USER_AGENT'], "Gecko")) {
+			if (strpos(util_ifsetor($_SERVER['HTTP_USER_AGENT'],
+			    ""), "Gecko")) {
 				/*
 				 * Work around a bug in Mozilla™ related
 				 * browsers which display a selected option
 				 * as black-on-white always, no matter the
 				 * style, when leaving the select’s focus.
 				 */
-				echo "\t\t\t<style type=\"text/css\">\n\t\t\t" .
-				    "	option { background-color:black; color:white; }" .
-				    "\n\t\t\t</style>\n";
+?>
+<style type="text/css">
+	option { background-color:black; color:white; }
+</style><!-- https://bugzilla.mozilla.org/show_bug.cgi?id=554620 --><?php
 			}
-			echo "</head><body>\n";
+			echo "\n</head><body>\n";
 		}
-		$this->template->pparse('body');
-
-		if (isset($params['submenu']))
-			echo $params['submenu'];
-
-		/* rightnav start by rklein */
-		if (isset($this->project) && is_object($this->project) && !$this->project->isError() && $this->project->isProject()) {
-			foreach ($right_navarr AS $dir) {
-				if (strpos($_SERVER['REQUEST_URI'], $dir) === 0) {
-					$this->rightnav=true;
-					echo '<table class="project_papa"><tr class="ff"><td class="project_content">';
-				}
+		if ($this->emit_forgebar) {
+			$pagetop = 'page_top';
+			if (eregi("(msie) ([0-9]{1,2}.[0-9]{1,3})",
+			    util_ifsetor($_SERVER['HTTP_USER_AGENT'], ""), $regs)) {
+				$pagetop .= '_ie';
 			}
-		}
-		/* rightnav end */
-		echo "<!-- ]internal_header -->\n";
+?><div id="ev_forgebar">
+<div id="red_headbar"></div>
+<div id="<?php echo $pagetop; ?>" class="hidePartForPrinting">
+	<div id="logo">
+		<div style="height:48px; padding-top:3px;">
+			<span style="overflow:hidden;"><a href="/"><img
+			 src="/themes/evolvis/images/logo_internal_repo.png"
+			 name="logo" border="0" style="height:44px;"
+			 alt="evolvis" /></a></span>
+			<div class="forgeglobalmenu">
+			<table style="white-space:nowrap;"><tr>
+<?php	if (session_loggedin()) {
+		echo "\t\t\t<td style=\"padding-left:1em;\">" .
+		    $this->emit_headlink(false,
+		    _('Log out of the session with the Forge system'),
+		    false, "/account/logout.php?return_to=" .
+		    urlencode(getStringFromServer('REQUEST_URI')),
+		    _('Log Out')) . "</td>\n";
+		echo "\t\t\t<td style=\"padding-left:1em;\">" .
+		    $this->emit_headlink(false,
+		    _('Configure Account settings, Password & SSH keys'),
+		    false, "/account/",
+		    _('My Account')) . "</td>\n";
+		echo "\t\t\t<td style=\"padding-left:1em;\">" .
+		    $this->emit_headlink(false,
+		    _('Manage projects, assigned tasks, bugs, etc.'),
+		    false, "/my/",
+		    _('My Page')) . "</td>\n";
+		echo "\t\t\t</tr><tr>\n\t\t\t" .
+		    "<td colspan=\"3\" style=\"padding-left:1em;\">\n";
+	} else {
+		echo "\t\t\t<td style=\"padding-left:1em;\">" .
+		    $this->emit_headlink(false,
+		    _('Log into a new session with the Forge system'),
+		    false, "/account/login.php?return_to=" .
+		    urlencode(getStringFromServer('REQUEST_URI')),
+		    _('Log In')) . "</td>\n";
+		echo "\t\t\t<td style=\"padding-left:1em;\">" .
+		    $this->emit_headlink(false,
+		    _('Register a user account with the Forge system'),
+		    false, "/account/register.php",
+		    _('New Account')) . "</td>\n";
+		echo "\t\t\t</tr><tr>\n\t\t\t" .
+		    "<td colspan=\"2\" style=\"padding-left:1em;\">\n";
 	}
-
-	function footer($params) {
-		global $group_id;
-
-		echo "\n<!-- footer[ -->\n";
-		/* rightnav start */
-		if ($this->rightnav == true) {
-			echo '</td><td class="project_info"><div class="hidePartForPrinting">';
-			$this->write_rightnav($group_id);
-			echo '</div></td></tr></table>';
+	echo "\t\t\t\t" . '<form action="' . util_make_url('/pm/t_follow.php') . '"
+				 method="get">' . _('Jump to Task:') . '
+					<input type="text" size="8" name="tid" />
+					<input type="submit" name="j" value="' . _('OK') . '" />
+				</form>
+			</td></tr></table></div>
+		</div><div class="forgeoutertabs">' .
+		    $this->outerTabs($params, 0) . "</div>\n";
+		if ($has_group) {
+			echo '<div class="forgeprojecttabs">' .
+			    $this->projectTabs(util_ifsetor($params['toptab']),
+			    $group_id) . '</div>';
 		}
-		/* rightnav end */
-		$tpl_input['SCRIPT_NAME']='';
-		if (forge_get_config ('show_source')) {
-			$tpl_input['SCRIPT_NAME']='<a class="showsource" href="/source.php?file=' . getStringFromServer('SCRIPT_NAME') . '">Show Source</a>';
+?>
+	</div>
+	<div id="backimg"></div>
+	<br clear="all" />
+</div><!-- page top -->
+</div><!-- ev_forgebar -->
+<div id="ev_content" class="content"><?php
+		} else {
+			echo '<div id="ev_content" class="contentnoforgebar">';
 		}
-		$this->template->assign_vars($tpl_input);
-		$this->template->set_filenames(array('footer'=>'overall_footer.tpl'));
-		$this->template->pparse('footer');
-	}
 
-	//function write_rightnav by rklein
-	function write_rightnav($group_id)
-	{
-		global $gfcommon;
-
-		echo "\n<!-- write_rightnav[ -->\n";
-		require_once('www/news/news_utils.php');
-		require_once('www/include/trove.php');
-		require_once('www/include/project_summary.php');
-		require_once($gfcommon.'/pm/ProjectTaskSqlQueries.php');
-		$project =$this->project;
-		echo $this->searchBox(0);
-		echo '<br />';
-
-		// ############################## PUBLIC AREAS
-
-		echo $this->boxTop(_('Public Areas'));
-
-		// ################# Homepage Link
-
-		print "\n".'<a href="http://' . $project->getHomePage() . '">';
-		print html_image('ic/home16b.png','20','20',array('alt'=>_('Home Page')));
-		print ' '._('Project Home Page')."</a>\n";
-
-		// ################## ArtifactTypes
-
-		// CB hide tracker if desired
-		if ($project->usesTracker()) {
-			print '<hr size="1" />' . "\n" .
-			    '<a href="'.util_make_url ('/tracker/?group_id='.$group_id).'">';
-			print html_image('ic/tracker20g.png','20','20',array('alt'=>_('Tracker')));
-			print ' '._('Tracker')."</a>\n";
-
-			$result=db_query_params("SELECT agl.*,aca.count,aca.open_count
-			FROM artifact_group_list agl
-			LEFT JOIN artifact_counts_agg aca USING (group_artifact_id)
-			WHERE agl.group_id=$1
-			AND agl.is_public=1
-			ORDER BY group_artifact_id ASC",array($group_id));
-
-			$rows = db_numrows($result);
-
-			if (!$result || $rows < 1) {
-				echo "<br />\n<em>"._('No trackers found').'</em>';
-			} else {
-				for ($j = 0; $j < $rows; $j++) {
-					echo "\n<p>- ";
-					print util_make_link ('/tracker/?atid='. db_result($result, $j, 'group_artifact_id') . '&group_id='.$group_id.'&func=browse',db_result($result, $j, 'name')) . ' ' ;
-					printf(ngettext('(<strong>%1$s</strong> open / <strong>%2$s</strong> total)', '(<strong>%1$s</strong> open / <strong>%2$s</strong> total)', (int) db_result($result, $j, 'open_count')), (int) db_result($result, $j, 'open_count'), (int) db_result($result, $j, 'count'));
-					echo '<br />'.db_result($result, $j, 'description').'</p>';
-				}
-				echo "\n";
-			}
+		echo "\n".'<div class="forgegrouptitle"><div id="project_name">';
+		if ($has_group) {
+			echo "Project: " . $this->project->getPublicName();
+		} else {
+			echo "Forge: " . forge_get_config('forge_name');
 		}
+		echo '</div><div class="forgesearchbox">' .
+		    $this->navigation->getSearchBox();
+		echo "</div></div>\n\n";
 
-		// ################## forums
+		$this->handleSubmenu($params);
 
-		if ($project->usesForum()) {
-			print '<hr size="1" />' . "\n" .
-			    '<a href="'.util_make_url ('/forum/?group_id='.$group_id).'">';
-			print html_image('ic/forum20g.png','20','20',array('alt'=>_('Forums')));
-			print ' '._('Public Forums')."</a>\n<br />(";
-			$messages_count = project_get_public_forum_message_count($group_id);
-			$forums_count = project_get_public_forum_count($group_id);
-			printf(ngettext("<strong>%d</strong> message","<strong>%d</strong> messages",$messages_count),$messages_count);
-			print ' in ';
-			printf(ngettext("<strong>%d</strong> forum","<strong>%d</strong> forums",$forums_count),$forums_count);
-			print ")\n";
-		}
+		echo "<!-- ]internal_header -->\n";
+	}
 
-		// ##################### Doc Manager
+	function footer($params) {
+		global $group_id;
 
-		if ($project->usesDocman()) {
-			print '
-			<hr size="1" />
-			<a href="'.util_make_url ('/docman/?group_id='.$group_id).'">';
-			print html_image('ic/docman16b.png','20','20',array('alt'=>_('Docs')));
-			print ' '._('Document Manager')."</a>\n";
-		}
+		echo "\n<!-- footer[ -->\n";
+?><div id="fffooter" class="hidePartForPrinting">
+<span id="imprint"><a href="/impress/">Impressum / imprint</a></span>
+<span id="powerd_by">powered by <a
+ href="https://evolvis.org/">Evolvis</a> by <a
+ href="https://www.tarent.de/">tarent solutions GmbH</a>, based on <a
+ href="https://fusionforge.org/">FusionForge</a></span>
+</div>
 
-		// ##################### Mailing lists
-
-		if ($project->usesMail()) {
-			print '<hr size="1" />' . "\n" .
-			    '<a href="'.util_make_url ('/mail/?group_id='.$group_id).'">';
-			print html_image('ic/mail16b.png','20','20',array('alt'=>_('Lists')));
-			print ' '._('Mailing Lists')."</a><br />\n";
-			$n = project_get_mail_list_count($group_id);
-			printf(ngettext('(<strong>%1$s</strong> public mailing list)', '(<strong>%1$s</strong> public mailing lists)', $n), $n)."\n";
+<script language="javascript" type="text/javascript" src="/js/awstats_misc_tracker.js"></script>
+<noscript><img src="/js/awstats_misc_tracker.js?nojs=y" height="0" width="0" border="0" style="display:none" alt="stats" /></noscript>
+<div id="red_bottombar"></div>
+</div><!-- content -->
+<?php
+		foreach ($this->footer_hooks as $h) {
+			call_user_func($h, $params);
 		}
-
-		// ##################### Task Manager
-
-		if ($project->usesPm()) {
-			print '<hr size="1" />' . "\n" .
-			    '<a href="'.util_make_url ('/pm/?group_id='.$group_id).'">';
-			print html_image('ic/taskman20g.png','20','20',array('alt'=>_('Tasks')));
-			print ' '._('Task Manager')."</a>\n";
-			$result = db_query_params ("SELECT * FROM project_group_list WHERE group_id=$1 AND is_public=1",array($group_id));
-			$rows = db_numrows($result);
-			if (!$result || $rows < 1) {
-				echo "<br />\n<em>"._('No tasks found').'</em>';
-			} else {
-				for ($j = 0; $j < $rows; $j++) {
-					echo "\n<br />- ";
-					print util_make_link ('/pm/task.php?group_project_id='.db_result($result, $j, 'group_project_id').'&group_id='.$group_id.'&func=browse',db_result($result, $j, 'project_name'));
-				}
-				echo "\n";
-			}
+		if ($this->collapsible_counter > 0) {
+?>
+<div id="evcollapsibleicon0min" style="display:none;"><?php
+			echo $this->getPicto($this->_getToggleMinusForWidgets(),
+			    _('Toggle'), 'Toggle', '16', '16');
+ ?></div>
+<div id="evcollapsibleicon0max" style="display:none;"><?php
+			echo $this->getPicto($this->_getTogglePlusForWidgets(),
+			    _('Toggle'), 'Toggle', '16', '16');
+ ?></div>
+<script language="JavaScript" type="text/javascript">//<![CDATA[
+	/* get real (generated) URIs of the pictographs */
+	var i = document.getElementById("evcollapsibleicon0max").getElementsByTagName("img")[0];
+	var icon_maximise = i.getAttributeNode("src").nodeValue;
+	var i = document.getElementById("evcollapsibleicon0min").getElementsByTagName("img")[0];
+	var icon_minimise = i.getAttributeNode("src").nodeValue;
+	/* initialise all collapsibles with them */
+	var evcollapsibleids = [];
+<?php
+	foreach ($this->collapsible_ids as $nr => $cid) {
+		echo "\tevcollapsibleids[" . $nr . "] = '" . $cid . "';\n";
+	}
+?>
+	for (var i = 1; i <= <?php echo $this->collapsible_counter; ?>; ++i) {
+		evcollapse('evcollapsibleicon' + i,
+		    'evcollapsibleelem' + i, 1, evcollapsibleids[i]);
+	}
+//]]></script>
+<?php
 		}
+?>
+</body>
+</html>
+<?php
+	}
 
-		// ######################### SCM
-
-		if ($project->usesSCM()) {
-			print '<hr size="1" />' . "\n" .
-			    '<a href="'.util_make_url ('/scm/?group_id='.$group_id).'">';
-			print html_image('ic/cvs16b.png','20','20',array('alt'=>_('SCM')));
-			print ' '._('SCM Repository')."</a><br />";
-
-			/*
-			$result = db_query_params("
-				SELECT sum(commits) AS commits,sum(adds) AS adds
-				FROM stats_cvs_group
-				WHERE group_id=$1
-			", array($group_id));
-			$cvs_commit_num = db_result($result,0,0);
-			$cvs_add_num	= db_result($result,0,1);
-			if (!$cvs_commit_num) {
-				$cvs_commit_num=0;
-			}
-			if (!$cvs_add_num) {
-				$cvs_add_num=0;
-			}
-			*/
-			$hook_params = array () ;
-			$hook_params['group_id'] = $group_id ;
-			plugin_hook ("scm_stats", $hook_params) ;
-			echo "\n";
+	/* internal */
+	function boxTopCollapsible($title, $id, $hidep, $cookie_id) {
+		$nr = ++$this->collapsible_counter;
+		$iid = "evcollapsibleicon" . $nr;
+		$eid = "evcollapsibleelem" . $nr;
+		if ($cookie_id) {
+			$this->collapsible_ids[$nr] = $cookie_id;
 		}
+		$h = $hidep ? ' hidePartForPrinting' : '';
 
-		// ######################## AnonFTP
-
-		// CB hide FTP if desired
-		if ($project->usesFTP()) {
-			if ($project->isActive()) {
-				print '<hr size="1" />'."\n";
-				print '<a href="ftp://' . $project->getUnixName() . '.' . forge_get_config('web_host') . '/pub/'. $project->getUnixName() .'/">';
-				print html_image('ic/ftp16b.png','20','20',array('alt'=>_('Anonymous FTP Space')));
-				print ' '._('Anonymous FTP Space')."</a>\n";
-			}
-		}
-
-		// ######################## minimum unique ID
-
-		print "\n<hr size=\"1\" />\n";
-		printf(_('Minimum Unique Task/Tracker Item ID: %d') . "\n",
-		    tasktracker_getminid());
-
-		// ######################## (end)
-
-		echo $this->boxBottom();
-		echo "<!-- ]write_rightnav -->\n";
+		return '<tr class="boxtitlebar' . $h . '"' .
+		    ($id ? ' id="' . $this->toSlug($id) . '-title"' : "") . '>
+			<td class="ff" align="left"' .
+		    ($id ? ' id="' . $this->toSlug($id) . '-title-content"' : "") . '>
+				' . $title . '
+				<div class="widget_titlebar_minimize hidePartForPrinting"
+				 style="display:none;"
+				 onclick="evcollapse(' . "'" . $iid .
+				    "', '" . $eid . "', 0, '" . $cookie_id .
+				    "'" . ');"
+				 id="' . $iid . '">' .
+				    $this->getPicto($this->_getToggleMinusForWidgets(),
+				    _('Toggle'), 'Toggle', '16', '16') . '
+				</div>
+			</td>
+		</tr><tr class="boxcontent' . $h . '" id="' . $eid . '" align="left">
+			<td' .
+		    ($id ? ' id="' . $this->toSlug($id) . '-content"' : "") .
+		    '>';
 	}
 
 	/**
 	 * boxTop() - Top HTML box
 	 *
 	 * @param	string	Box title
-	 * @param	bool	Whether to echo or return the results
-	 * @param	string	The box background color
+	 * @param	string	ID attribute (optional)
+	 * @param	bool	hide from printing? (optional)
+	 * @param	string	Collapsible Cookie ID (optional)
 	 */
-	function boxTop($title) {
-		return '
-		<!-- boxTop[ -->
-		<table cellspacing="2" cellpadding="0" width="100%" border="0" class="hidePartForPrinting">
-		<tr class="ff">
-		<td class="ff">
-			<table cellspacing="2" cellpadding="0" width="100%" border="0">
-				<tr class="titlebar">
-					<td class="ff" colspan="2">'.$title.'</td>
-				</tr>
-				<tr class="ff" align="left" bgcolor="'. $this->COLOR_HTMLBOX_BACK .'">
-					<td class="ff" colspan="2" height="1"></td>
-				</tr>
-				<tr class="ff" align="left"><td class="ff" colspan="2"><!-- ]boxTop -->';
+	function boxTop($title, $id="", $hidep=false, $ccid="") {
+		return '<!-- boxTop[ -->
+		<table' . ($id ? ' id="' . $this->toSlug($id) . '"' : "") .
+		    ' width="100%" border="0" class="ff" cellspacing="0">
+		' . $this->boxTopCollapsible($title, $id, $hidep, $ccid) .
+		    '<!-- ]boxTop -->';
 	}
 
 	/**
 	 * boxMiddle() - Middle HTML box
 	 *
 	 * @param	string	Box title
-	 * @param	string	The box background color
+	 * @param	string	ID attribute (optional)
+	 * @param	bool	hide from printing? (optional)
+	 * @param	string	Collapsible Cookie ID (optional)
 	 */
-	function boxMiddle($title) {
-		return '
-				<!-- boxMiddle[ -->
-				</td>
-				</tr>
-				<tr class="titlebar">
-					<td class="ff" colspan="2"><span>'.$title.'</span></td>
-				</tr>
-				<tr class="ff" align="left" bgcolor="'. $this->COLOR_HTMLBOX_BACK .'">
-					<td class="ff" colspan="2" height="1"></td>
-				</tr>
-				<tr class="ff"><td class="ff" colspan="2"><!-- ]boxMiddle -->';
+	function boxMiddle($title, $id="", $hidep=false, $ccid="") {
+		return '<!-- boxMiddle[ -->
+			</td>
+		</tr><tr bgcolor="'. $this->COLOR_HTMLBOX_BACK .'"
+		 class="hidePartForPrinting"><td height="1"></td>
+		</tr>' . $this->boxTopCollapsible($title, $id, $hidep, $ccid) .
+		    '<!-- ]boxMiddle -->';
 	}
 
 	/**
@@ -474,17 +376,13 @@
 
 	/**
 	 * boxBottom() - Bottom HTML box
-	 *
-	 * @param	bool	Whether to echo or return the results
 	 */
 	function boxBottom() {
 		return '<!-- boxBottom[ -->
-					</td>
-				</tr>
-			</table>
-		</td>
-		</tr>
-		</table><!-- ]boxBottom -->'."\n";
+			</td>
+		</tr><tr bgcolor="'. $this->COLOR_HTMLBOX_BACK .'"
+		 class="hidePartForPrinting"><td height="1"></td>
+		</tr></table><!-- ]boxBottom -->'."\n";
 	}
 
 	/**
@@ -492,40 +390,43 @@
 	 *
 	 * @param	array	The array of titles
 	 * @param	array	The array of title links
+	 * @param	int	(ignored?!)
+	 * @param	bool	Show a table border (default: false)
 	 */
-	function listTableTop ($title_arr,$links_arr=false) {
-		$return = '
+	function listTableTop($title_arr,$links_arr=false,$cnt=0,$useborder=false) {
+		$rv = '
 		<!-- listTableTop[ -->
-		<table cellspacing="0" cellpadding="1" width="100%" border="0">
+		<table cellspacing="0" cellpadding="1" width="100%" ' .
+		($useborder ? $useborder : 'border="0"') . '>
 		<tr class="ff"><td class="ff">
 		<table width="100%" border="0" cellspacing="2" cellpadding="0">
 		<thead>
 		<tr class="ff">';
 
-		$count=count($title_arr);
+		$count = count($title_arr);
 		if (!$count) {
-			$return .= '<td style="color:red;">No $title_arr:' .
+			$rv .= '<td style="color:red;">No $title_arr:' .
 			    "<pre>\n" . htmlentities(debug_string_backtrace()) .
 			    "</pre></td>\n";
 		} else if ($links_arr) {
 			for ($i=0; $i<$count; $i++) {
-				$return .= '
+				$rv .= '
 		<td class="ff" align="left"><a class="titlebar" href="'.$links_arr[$i].'">'.$title_arr[$i].'</a></td>';
 			}
 		} else {
 			for ($i=0; $i<$count; $i++) {
-				$return .= '
+				$rv .= '
 		<td align="left" class="list_table_top">'.$title_arr[$i].'</td>';
 			}
 		}
-		$return .= '
+		$rv .= '
 		</tr>
 		</thead><tfoot>
 		<tr class="ff" align="left" bgcolor="'. $this->COLOR_HTMLBOX_BACK .'">
 		<td class="ff" colspan="'.$count.'" height="1"><img src="'.$this->imgroot.'clear.png" height="1" width="1" alt="" /></td>
 		</tr>
 		</tfoot><tbody><!-- ]listTableTop -->'."\n";
-		return $return;
+		return $rv;
 	}
 
 	/**
@@ -534,8 +435,8 @@
 	 * @param	array	The array of titles
 	 * @param	array	The array of title links
 	 */
-	function listTableTopSortable ($title_arr,$links_arr=false) {
-		$return = '
+	function listTableTopSortable($title_arr,$links_arr=false) {
+		$rv= '
 		<!-- listTableTopSortable[ -->
 		<table cellspacing="0" cellpadding="1" width="100%" border="0">
 		<tr class="ff"><td class="ff">
@@ -543,26 +444,26 @@
 		<thead>
 		<tr class="ff">';
 
-		$count=count($title_arr);
+		$count = count($title_arr);
 		if ($links_arr) {
 			for ($i=0; $i<$count; $i++) {
-				$return .= '
+				$rv.= '
 				<th class="ff" align="left"><a class="titlebar" href="'.$links_arr[$i].'">'.$title_arr[$i].'</a></th>';
 			}
 		} else {
 			for ($i=0; $i<$count; $i++) {
-				$return .= '
+				$rv.= '
 				<th align="left" class="list_table_top">'.$title_arr[$i].'</th>';
 			}
 		}
-		$return .= '
+		$rv.= '
 		</tr>
 		</thead>
 		<tfoot><tr class="ff" align="left" bgcolor="'. $this->COLOR_HTMLBOX_BACK .'">
 		<td class="ff" colspan="'.$count.'" height="1"><img src="'.$this->imgroot.'clear.png" height="1" width="1" alt="" /></td>
 		</tr></tfoot>
 		<tbody><!-- ]listTableTopSortable -->'."\n";
-		return $return;
+		return $rv;
 	}
 
 	function listTableBottom() {
@@ -570,17 +471,12 @@
 	}
 
 
-	function tabGenerator($TABS_DIRS,$TABS_TITLES,$nested=false,$selected=false,$sel_tab_bgcolor='BLACK',$total_width='100%',$TAB_TYPE) {
-
+	function tabGenerator($TABS_DIRS,$TABS_TITLES,$nested=false,$selected=false,$sel_tab_bgcolor='BLACK',$total_width='100%',$TAB_TYPE,$TABS_TOOLTIPS=array()) {
 		$rv = "";
 		for ($i = 0; $i < count($TABS_DIRS); $i++) {
-			$rv .= '<span class="headblock">' . "\n\t" .
-			    '<span class="headlink' .
-			    (($TAB_TYPE=='outerTab' || $selected==$i)?'s':'') .
-			    '">//</span><a class="headlink" href="' .
-			    $TABS_DIRS[$i] . '"><span class="headlink' .
-			    (($selected==$i)?'s':'') . '">' . $TABS_TITLES[$i] .
-			    "</span></a>\n</span> ";
+			$rv .= "\n" . $this->emit_headlink(true,
+			    util_ifsetor($TABS_TOOLTIPS[$i], ""),
+			    ($selected == $i), $TABS_DIRS[$i], $TABS_TITLES[$i]);
 		}
 		return $rv;
 	}
@@ -591,10 +487,15 @@
 		if (!isset($this->COLOR_SELECTED_TAB)) {
 			$this->COLOR_SELECTED_TAB= '#e0e0e0';
 		}
+
+		$rv = $this->tabGenerator($menu['urls'], $menu['titles'], false,
+		    $menu['selected'], $this->COLOR_SELECTED_TAB, '100%',
+		    "outerTab", util_ifsetor($menu['tooltips'], array()));
 		if (!$write) {
-			return $this->tabGenerator($menu['urls'],$menu['titles'],false,$menu['selected'],$this->COLOR_SELECTED_TAB,'100%',"outerTab");
+			return $rv;
 		} else {
-			echo $this->tabGenerator($menu['urls'],$menu['titles'],false,$menu['selected'],$this->COLOR_SELECTED_TAB,'100%',"outerTab");
+			echo $rv;
+			return "<div>bogus call <pre>{".debug_string_backtrace()."}</pre> & ERROR</div>\n";
 		}
 	}
 
@@ -608,8 +509,9 @@
 	function projectTabs($toptab,$group) {
 		$menu = $this->navigation->getProjectMenu($group, $toptab);
 
-		return $this->tabGenerator($menu['urls'], $menu['titles'], true, $menu['selected'],'white','100%','projectTab');
-
+		return $this->tabGenerator($menu['urls'], $menu['titles'], true,
+		    $menu['selected'], 'white', '100%', 'projectTab',
+		    util_ifsetor($menu['tooltips'], array()));
 	}
 
 	/**
@@ -617,164 +519,102 @@
 	 *
 	 * @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
+	 *			the first item being the text,
+	 *			the subsequent items are attributes
 	 * @param	boolean is this row part of the title ?
 	 *
 	 */
-
-
 	function multiTableRow($row_attr, $cell_data, $istitle) {
-		$return= '
+		$rv = '
 		<!-- multiTableRow -->
 		<tr class="multi_table_row" '.$row_attr;
 		if ( $istitle ) {
-			$return .=' align="center" ';
+			$rv .=' align="center" ';
 		}
-		$return .= '>';
-		for ( $c = 0; $c < count($cell_data); $c++ ) {
-			$return .='<td class="ff" ';
-			for ( $a=1; $a < count($cell_data[$c]); $a++) {
-				$return .= $cell_data[$c][$a].' ';
+		$rv .= '>';
+		for ($c = 0; $c < count($cell_data); $c++) {
+			$rv .='<td class="ff" ';
+			for ($a=1; $a < count($cell_data[$c]); $a++) {
+				$rv .= $cell_data[$c][$a].' ';
 			}
-			$return .= '>';
-			if ( $istitle ) {
-				$return .='<span class="titlebar">';
+			$rv .= '>';
+			if ($istitle) {
+				$rv .='<span class="titlebar">';
 			}
-			$return .= $cell_data[$c][0];
-			if ( $istitle ) {
-				$return .='</span>';
+			$rv .= $cell_data[$c][0];
+			if ($istitle) {
+				$rv .='</span>';
 			}
-			$return .= '</td>';
+			$rv .= '</td>';
 
 		}
-		$return .= '</tr>
+		$rv .= '</tr>
 		<!-- end multiTableRow -->
 		';
 
-		return $return;
+		return $rv;
 	}
 
-	function searchBox($print=1) {
-		global $words,$forum_id,$group_id,$group_project_id,$atid,$exact,$type_of_search;
-
-		if (get_magic_quotes_gpc()) {
-			$defaultWords = stripslashes($words);
-		} else {
-			$defaultWords = $words;
-		}
-
-		// if there is no search currently, set the default
-		if (!isset($type_of_search)) {
-			$exact = 1;
-		}
-		if ($print) {
-			print '<div class="hidePartForPrinting">
-			<form action="/search/" method="get">';
-			$parameters = array(
-				SEARCH__PARAMETER_GROUP_ID => $group_id,
-				SEARCH__PARAMETER_ARTIFACT_ID => $atid,
-				SEARCH__PARAMETER_FORUM_ID => $forum_id,
-				SEARCH__PARAMETER_GROUP_PROJECT_ID => $group_project_id
-			);
-
-			$searchManager =& getSearchManager();
-			$searchManager->setParametersValues($parameters);
-			$searchEngines =& $searchManager->getAvailableSearchEngines();
-
-			echo '<select name="type_of_search">';
-			for($i = 0, $max = count($searchEngines); $i < $max; $i++) {
-				$searchEngine =& $searchEngines[$i];
-				echo '<option value="'.$searchEngine->getType().'"'.( $type_of_search == $searchEngine->getType() ? ' selected="selected"' : '' ).'>'.$searchEngine->getLabel($parameters).'</option>'."\n";
-			}
-			echo '</select>';
-
-			$parameters = $searchManager->getParameters();
-			foreach($parameters AS $name => $value) {
-				print '<input type="hidden" value="'.$value.'" name="'.$name.'" />';
-			}
-			print '<input type="text" size="12" name="words" value="'.$defaultWords.'" />';
-
-			print '<input type="submit" name="Search" value="'._('Search').'" />';
-
-			if (isset($group_id)) {
-				print '
-					<br/>
-					<span id="advanced_search">
-					› <a href="/search/advanced_search.php?group_id='.$group_id.'">'
-					._('Advanced search').'</a>
-					</span>';
-			}
-			print '</form></div>';
-			print '
-<hr />
-<form action="' . util_make_url('/pm/t_follow.php') . '" method="get">
-	' . _('Jump to Task:') . '<br /><input type="text" size="8"
-	name="tid" /><input type="submit" name="j" value="' . _('OK') . '" />
-</form>';
-		} else {
-			$re= '<div class="hidePartForPrinting">
-				<form action="/search/" method="get">';
-			$parameters = array(
-				SEARCH__PARAMETER_GROUP_ID => $group_id,
-				SEARCH__PARAMETER_ARTIFACT_ID => $atid,
-				SEARCH__PARAMETER_FORUM_ID => $forum_id,
-				SEARCH__PARAMETER_GROUP_PROJECT_ID => $group_project_id
-			);
-
-			$searchManager =& getSearchManager();
-			$searchManager->setParametersValues($parameters);
-			$searchEngines =& $searchManager->getAvailableSearchEngines();
-
-			$re.= '<select name="type_of_search">';
-			for($i = 0, $max = count($searchEngines); $i < $max; $i++) {
-				$searchEngine =& $searchEngines[$i];
-				$re.= '<option value="'.$searchEngine->getType().'"'.( $type_of_search == $searchEngine->getType() ? ' selected="selected"' : '' ).'>'.$searchEngine->getLabel($parameters).'</option>'."\n";
-			}
-			$re.= '</select>';
-
-			$parameters = $searchManager->getParameters();
-			foreach($parameters AS $name => $value) {
-				$re.= '<input type="hidden" value="'.$value.'" name="'.$name.'" />';
-			}
-			$re.= '<input type="text" size="12" name="words" value="'.$defaultWords.'" />';
-
-			$re.='<input type="submit" name="Search" value="'._('Search').'" />';
-
-			if (isset($group_id)) {
-				$re.= '
-					<br/>
-					<span id="advanced_search">
-					› <a href="/search/advanced_search.php?group_id='.$group_id.'">'
-					._('Advanced search').'</a>
-					</span>';
-			}
-			$re.='</form></div>';
-			$re .= '
-<hr />
-<form action="' . util_make_url('/pm/t_follow.php') . '" method="get">
-	' . _('Jump to Task:') . '<br /><input type="text" size="8"
-	name="tid" /><input type="submit" name="j" value="' . _('OK') . '" />
-</form>';
-			return $re;
-		}
-	}
-
 	/**
 	 * feedback() - returns the htmlized feedback string when an action is performed.
 	 *
-	 * @param	string	feedback string
-	 * @return	string	htmlized feedback
+	 * @param string feedback string
+	 * @return string htmlized feedback
 	 */
 	function feedback($feedback) {
 		if (!$feedback) {
 			return '';
 		} else {
 			return '
-		<h3 style="color:red">'.strip_tags($feedback, '<br>').'</h3>';
+			<h3 style="color:red">'.strip_tags($feedback, '<br>').'</h3>';
 		}
 	}
 
+	/**
+	 * beginSubMenu() - Opening a submenu.
+	 *
+	 * @return	string	HTML to start a submenu
+	 */
+	function beginSubMenu() {
+		return '
+<div class="forgesubmenu">';
+	}
+
+	/**
+	 * endSubMenu() - Closing a submenu.
+	 *
+	 * @return	string	HTML to start a submenu
+	 */
+	function endSubMenu() {
+		return "\n<!-- ]forgesubmenu --></div>\n";
+	}
+
+	/**
+	 * 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
+	 * @param	array	The array of tooltips (optional)
+	 * @return	string	HTML to build a submenu
+	 */
+	function printSubMenu($title_arr,$links_arr,$tooltip_arr=array()) {
+		$rv = "";
+
+		for ($i = 0; $i < count($links_arr); ++$i) {
+			if ($i) {
+				/*
+				 * insert spaces between the items
+				 * so that they can wrap around
+				 */
+				$rv .= "\n";
+			}
+			$rv .= $this->emit_headlink(true,
+			    util_ifsetor($tooltip_arr[$i], ""),
+			    false, $links_arr[$i],
+			    util_ifsetor($title_arr[$i], "Link ".$i));
+		}
+		return $rv;
+	}
 }
 
 // Local Variables:



More information about the evolvis-commits mailing list