Index: /trunk/calendar_new/xsl/viewYear.xsl
===================================================================
--- /trunk/calendar_new/xsl/viewYear.xsl	(revision 574)
+++ /trunk/calendar_new/xsl/viewYear.xsl	(revision 574)
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:template match="/retorno">
+<xsl:variable name="today" select="today" />
+<div id="day">
+	<div id="{$today}"></div>
+</div>
+<div width="100%" class="title" align="left" ><label id="l_date"></label><br/><br/>
+	<table class="table_common" height="auto" width="100%" cellpadding="0" cellspacing="0">
+		<tbody>
+			<tr id="tr_week">
+				<xsl:for-each select="dayofweek">
+					<xsl:variable name="dayName" select="dayname" />
+					<td id="weekHeader_{$dayName}" class="td_header" height="1%">
+						<xsl:value-of select='$dayName' />
+					</td>
+				</xsl:for-each>
+			</tr>
+			<xsl:for-each select="/retorno/workWeek">
+				<tr>
+					<xsl:for-each select="workday">
+						<xsl:variable name="day" select="id" />
+						<td class="td_day" id="{$day}">
+							<xsl:value-of select='substring($day,5,2)' />
+						</td>
+					</xsl:for-each>
+				</tr>
+			</xsl:for-each>
+		</tbody>
+	</table>
+</div>
+<div id="returnEvents">
+	<xsl:for-each select="calEvent">
+		<xsl:variable name="event_id" select="id" />
+		<xsl:variable name="datetime" select="datetime" />
+		<xsl:if test="id > 0">
+			<div id="event_{$event_id}">
+				<div id="{$datetime}"></div>
+			</div>
+		</xsl:if>
+	</xsl:for-each>
+</div>
+</xsl:template>
+</xsl:stylesheet>
Index: /trunk/calendar_new/inc/hook_sidebox_menu.inc.php
===================================================================
--- /trunk/calendar_new/inc/hook_sidebox_menu.inc.php	(revision 574)
+++ /trunk/calendar_new/inc/hook_sidebox_menu.inc.php	(revision 574)
@@ -0,0 +1,60 @@
+<?php
+  /**************************************************************************\
+  * eGroupWare - Calendar's Sidebox-Menu for idots-template                  *
+  * http://www.egroupware.org                                                *
+  * Written by Pim Snel <pim@lingewoud.nl>                                   *
+  * --------------------------------------------                             *
+  *  This program is free software; you can redistribute it and/or modify it *
+  *  under the terms of the GNU General Public License as published by the   *
+  *  Free Software Foundation; either version 2 of the License, or (at your  *
+  *  option) any later version.                                              *
+  \**************************************************************************/
+
+{
+ /*
+	$menu_title speaks for itself
+	$file is the array with link to app functions
+
+	display_sidebox can be called as much as you like
+ */
+
+	$menu_title = $GLOBALS['phpgw_info']['apps'][$appname]['title'] . ' '. lang('Menu');
+	$file = Array(
+		'New Entry' => "javascript:addDetails();",
+		'_NewLine_', // give a newline
+		'Today'=>"javascript:calendar.getView('div_main','Day')",
+		'This week'=>"javascript:calendar.getView('div_main','Week')",
+		'This month'=>"javascript:calendar.getView('div_main','Month')",
+		'This year'=>"javascript:calendar.getView('div_main','Year')",
+		'_NewLine_', // give a newline
+		'Import'=>$GLOBALS['phpgw']->link('/index.php','menuaction=calendar.uiicalendar.import'),
+		'Report of hours'=>$GLOBALS['phpgw']->link('/calendar/inc/hourReport.php',''),
+		'Public Calendars'=> "javascript:openwindow('calendar/templates/celepar/publicView.php')"
+	);
+	display_sidebox($appname,$menu_title,$file);
+
+	if ($GLOBALS['phpgw_info']['user']['apps']['preferences'])
+	{
+		$menu_title = lang('Preferences');
+		$file = Array(
+			'Calendar preferences'=>$GLOBALS['phpgw']->link('/preferences/preferences.php','appname=calendar'),
+			'Grant Access'=>$GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app=calendar'),
+			'Edit Categories' =>$GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uicategories.index&cats_app=calendar&cats_level=True&global_cats=True'),
+		);
+		display_sidebox($appname,$menu_title,$file);
+	}
+
+	if ($GLOBALS['phpgw_info']['user']['apps']['admin'])
+	{
+		$menu_title = lang('Administration');
+		$file = Array(
+			'Configuration'=>$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiconfig.index&appname=calendar'),
+			'Custom Fields'=>$GLOBALS['phpgw']->link('/index.php','menuaction=calendar.uicustom_fields.index'),
+			'Holiday Management'=>$GLOBALS['phpgw']->link('/index.php','menuaction=calendar.uiholiday.admin'),
+			'Import CSV-File' => $GLOBALS['phpgw']->link('/calendar/csv_import.php'),
+			'Global Categories' =>$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicategories.index&appname=calendar'),
+		);
+		display_sidebox($appname,$menu_title,$file);
+	}
+}
+?>
Index: /trunk/calendar_new/inc/hourReport.php
===================================================================
--- /trunk/calendar_new/inc/hourReport.php	(revision 574)
+++ /trunk/calendar_new/inc/hourReport.php	(revision 574)
@@ -0,0 +1,156 @@
+<?php
+$phpgw_flags = Array(
+	'currentapp'    =>      'calendar',
+	'noappheader'   =>      True,
+	'noappfooter'   =>      True,
+	'nofooter'      =>      True
+);
+$GLOBALS['phpgw_info']['flags'] = $phpgw_flags;
+
+include('../../header.inc.php');
+$_SESSION['calendar']['user'] = $GLOBALS['phpgw_info']['user'];
+$_SESSION['calendar']['server'] = $GLOBALS['phpgw_info']['server'];
+define('PHPGW_API_INC','../../phpgwapi/inc');
+include_once(PHPGW_API_INC.'/class.db.inc.php');
+$page_content = <<<PAGE
+<HTML><HEAD></HEAD><BODY>
+<SCRIPT type="text/javascript">
+var Total = 0;
+	function show_table(){
+		var MainDiv = document.getElementById('MainDiv');
+		var showTable = document.createElement('TABLE');
+		var trLine = document.createElement('TR');
+		var tdVal = document.createElement('TD');
+		tdVal.innerHTML = "Titulo";
+		trLine.appendChild(tdVal);
+		tdVal = document.createElement('TD');
+		tdVal.innerHTML = "Descricao";
+		trLine.appendChild(tdVal);
+		tdVal = document.createElement('TD');
+		tdVal.innerHTML = "Horas";
+		trLine.appendChild(tdVal);
+		trLine.style.background = "#DDD";
+		showTable.appendChild(trLine);
+
+		var Eelement = MainDiv.firstChild;
+		while (Eelement){
+			trLine = document.createElement('TR');
+			tdVal = document.createElement('TD');
+			tdVal.innerHTML = Eelement.childNodes[0].innerHTML;
+			trLine.appendChild(tdVal);
+                        tdVal = document.createElement('TD');
+                        tdVal.innerHTML = Eelement.childNodes[1].innerHTML;
+                        trLine.appendChild(tdVal);
+			tdVal = document.createElement('TD');
+			Total += (Eelement.childNodes[3].innerHTML-Eelement.childNodes[2].innerHTML)/3600;
+                        tdVal.innerHTML = ((Eelement.childNodes[3].innerHTML-Eelement.childNodes[2].innerHTML)/3600).toFixed(1);
+                        trLine.appendChild(tdVal);
+			showTable.appendChild(trLine);
+	                Eelement = Eelement.nextSibling;
+
+		}
+		trLine = document.createElement('TR');
+		tdVal = document.createElement('TD');
+		tdDes =  document.createElement('TD');
+		tdDes.innerHTML = "Total";
+		tdDes.align = "left";
+		tdVal.innerHTML = Total.toFixed(1);
+		trLine.style.background = "#FFF";
+		trLine.appendChild(tdDes);
+		trLine.appendChild(document.createElement('TD'));
+                trLine.appendChild(tdVal);
+		showTable.appendChild(trLine);
+		showTable.className = "calendar_print_main";
+		MainDiv.parentNode.appendChild(showTable);
+	}
+</SCRIPT>
+PAGE;
+echo $page_content;
+$db = new db();
+$db->Halt_On_Error = 'no';
+$db->connect(
+	$_SESSION['calendar']['server']['db_name'],
+	$_SESSION['calendar']['server']['db_host'],
+	$_SESSION['calendar']['server']['db_port'],
+	$_SESSION['calendar']['server']['db_user'],
+	$_SESSION['calendar']['server']['db_pass'],
+	$_SESSION['calendar']['server']['db_type']
+);
+$user_id = $_SESSION['calendar']['user']['account_id'];
+
+function ldapName($uid){
+	$connection = $GLOBALS['phpgw']->common->ldapConnect();
+	$justthese = array("cn");
+	$search = ldap_search($connection, $GLOBALS['phpgw_info']['server']['ldap_context'], "uidNumber=" . $uid, $justthese);
+	$result = ldap_get_entries($connection, $search);
+	ldap_close($connection);
+	return $result[0]['cn'][0];
+}
+
+
+if (IsSet($_POST['CAT'])){
+	if (!preg_match("/[a-zA-Z0-9]+/i",$_POST['CAT'][0])){
+		echo "Invalid entry:".$_POST['CAT'][0];
+		return false;
+	}
+	if (strlen($_POST['DAT']) > 0 && !preg_match("/[0123][0-9].[01][0-9].[12][90][0-9][0-9]$/i",$_POST['DAT'])){
+		echo "Invalid entry:".$_POST['DAT'];
+		return false;
+	}
+
+	if (IsSet($_POST['DAT']))
+		$initDate = mktime(null,null,null,substr($_POST['DAT'],3,2),substr($_POST['DAT'],0,2),substr($_POST['DAT'],6,4));
+	if ($_POST['CAL'][0] != 'run')
+		$user_id = $_POST['CAL'][0];
+	foreach($_POST['CAT'] as $catid)
+		if(!$db->query("select cal_id,title,description,datetime,edatetime from phpgw_cal where ".(!$_POST['NORM']?"cal_type = 'H' and":" is_public = 1 and ")." owner = ".$user_id." and (category like '%,".$catid.",%' or category like '%,".$catid."' or category like '".$catid.",%' or category = '".$catid."')".(IsSet($initDate)?" and datetime > ".$initDate:""))){
+			print("Query failed");
+			return;
+		}
+		else
+			while($db->next_record())
+				$result_[] = $db->row();
+
+	echo "<div id='MainDiv' style='display: none;'>";
+	foreach($result_ as $ind => $entry){
+		echo "<div id=\"entry_".$ind."\"><div id=\"title_".$ind."\">".$entry['title']."</div><div id=\"description_".$ind."\">".$entry['description']."</div><div id=\"datetime_".$ind."\">".$entry['datetime']."</div><div id=\"edatetime_".$ind."\">".$entry['edatetime']."</div></div>";
+	}
+	echo "</div><script type=\"text/javascript\"> show_table();</script>";
+	return;
+}
+
+$cat_query="select cat_id,cat_name from phpgw_categories where cat_appname = 'calendar' and (cat_owner = ".$user_id;
+foreach($GLOBALS['phpgw']->accounts->membership() as $idx => $group){
+	$cat_query = $cat_query.' or cat_owner = '.$group['account_name'];
+}
+$cat_query = $cat_query.')';
+if (!$db->query($cat_query))
+	print("Query failed");
+else
+	while($db->next_record())
+		$categories[] = $db->row();
+
+if (!$db->query("select acl_account from phpgw_acl where acl_appname  = 'calendar' and acl_location = ".$user_id))
+	print("Query failed");
+else
+	while($db->next_record())
+		$userCals[] = $db->row();
+
+
+$self = $_SERVER['PHP_SELF'];
+print("<table><tbody><tr><td>");
+print("<form id=\"form1\" method=\"post\" action=\"$self\">");
+print("Categoria(s):<br></td><td>");
+print("<select name=\"CAT[]\" multiple>");
+foreach($categories as $entry)
+	print("<option value=\"".$entry['cat_id']."\">".$entry['cat_name']."</option>");
+print("</select></td></tr><tr><td>");
+print("Incluir ocorr&ecirc;ncias do tipo normal:</td><td><input name=\"NORM\" type=\"checkbox\"></input><br></td></tr>");
+print("<tr><td>Usuario:</td><td><select name=\"CAL[]\" multiple>");
+print("<option value=\"".$user_id."\">Minha agenda</option>");
+foreach($userCals as $ind => $entry)
+	print("<option value=\"".$entry['acl_account']."\">".ldapName($entry['acl_account'])."</option>");
+print("</td></tr><tr><td>Apartir da data: dd/mm/aaaa<br>(caso todas deixar em branco):</td><td><input name=\"DAT\" type=\"text\"></input></td></tr>");
+print("</td></tr></tbody></table><br><input value=\"Fazer consulta\" type=\"submit\"><br></form>");
+print("</BODY></HTML>");
+?>
