Index: trunk/calendar/inc/hourReport.php
===================================================================
--- trunk/calendar/inc/hourReport.php	(revision 602)
+++ trunk/calendar/inc/hourReport.php	(revision 626)
@@ -20,4 +20,9 @@
 		var MainDiv = document.getElementById('MainDiv');
 		var showTable = document.createElement('TABLE');
+		showTable.style.color = "#000066"
+		showTable.style.background = "#F7F7F7";
+		showTable.style.border = "1px solid #CCCCCC";
+		showTable.width = "75%";
+		showTable.align = "center";
 		var trLine = document.createElement('TR');
 		var tdVal = document.createElement('TD');
@@ -27,4 +32,7 @@
 		tdVal.innerHTML = "Descricao";
 		trLine.appendChild(tdVal);
+                tdVal = document.createElement('TD');
+                tdVal.innerHTML = "Data";
+                trLine.appendChild(tdVal);
 		tdVal = document.createElement('TD');
 		tdVal.innerHTML = "Horas";
@@ -37,8 +45,14 @@
 			trLine = document.createElement('TR');
 			tdVal = document.createElement('TD');
-			tdVal.innerHTML = Eelement.childNodes[0].innerHTML;
+			var cal_id = Eelement.childNodes[4].innerHTML;
+			tdVal.innerHTML = "<a href='../../index.php?menuaction=calendar.uicalendar.view&cal_id="+cal_id+"'>"+Eelement.childNodes[0].innerHTML+"</a>";
 			trLine.appendChild(tdVal);
                         tdVal = document.createElement('TD');
                         tdVal.innerHTML = Eelement.childNodes[1].innerHTML;
+                        trLine.appendChild(tdVal);
+			tdVal = document.createElement('TD');
+			var today = new Date();
+			today.setTime(parseInt(Eelement.childNodes[2].innerHTML)*1000);
+                        tdVal.innerHTML = (today.getDate()+"/"+(today.getMonth()+1)+"/"+(today.getYear()+1900));
                         trLine.appendChild(tdVal);
 			tdVal = document.createElement('TD');
@@ -61,9 +75,9 @@
 		trLine.appendChild(tdDes);
 		trLine.appendChild(document.createElement('TD'));
+                trLine.appendChild(document.createElement('TD'));
 		trLine.appendChild(tdVal);
 		var tbody = document.createElement('tbody');
                 tbody.appendChild(trLine);
 		showTable.appendChild(tbody);
-		showTable.className = "calendar_print_main";
 		MainDiv.parentNode.appendChild(showTable);
 	}
@@ -81,5 +95,4 @@
 	$_SESSION['calendar']['server']['db_type']
 );
-
 if (IsSet($_POST['CAT'])){
 	if (!preg_match("/[a-zA-Z0-9]+/i",$_POST['CAT'][0])){
@@ -109,6 +122,7 @@
 
 
-	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:""))){
+	foreach($_POST['CAT'] as $catid){
+		$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:"");
+		if(!$db->query($query)){
 			print("<br>Query failed at host:<br>".$_SESSION['calendar']['server']['db_user']."@".$_SESSION['calendar']['server']['db_host'].":".$_SESSION['calendar']['server']['db_port']."<br>");
 			return;
@@ -118,4 +132,5 @@
 				$entry = $db->row();
 				$repeated = false;
+				if (!empty($result_))
 				foreach($result_ as $value){
 					if ($value['cal_id'] == $entry['cal_id'])
@@ -126,7 +141,9 @@
 			}
 		}
+}
 	echo "<div id='MainDiv' style='display: none;'>";
+	if (!empty($result_))
 	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 id=\"entry_".$ind."\"><div id=\"title_".$ind."\">".htmlspecialchars($entry['title'])."</div><div id=\"description_".$ind."\">".htmlspecialchars($entry['description'])."</div><div id=\"datetime_".$ind."\">".$entry['datetime']."</div><div id=\"edatetime_".$ind."\">".$entry['edatetime']."</div><div>".$entry['cal_id']."</div></div>";
 	}
 	echo "</div><script type=\"text/javascript\"> show_table();</script>";
