Index: /contrib/Dms/themes/default/DocumentPageEnd.html
===================================================================
--- /contrib/Dms/themes/default/DocumentPageEnd.html	(revision 3526)
+++ /contrib/Dms/themes/default/DocumentPageEnd.html	(revision 4362)
@@ -20,5 +20,5 @@
   </tr>
   <tr>
-    <td width="45" background="<?php echo(printImgPath("line_vert.gif")) ?>">
+    <td width="45" background="<?php echo(printImgPath("line_vert.gif"));  ?>" >
       &nbsp;
     </td>
Index: /contrib/Dms/templates/default/viewDocument.tpl
===================================================================
--- /contrib/Dms/templates/default/viewDocument.tpl	(revision 3526)
+++ /contrib/Dms/templates/default/viewDocument.tpl	(revision 4362)
@@ -16,7 +16,7 @@
 		<th width="20%" id="tab1" class="activetab" onclick="javascript:tab.display(1);"><a href="#" tabindex="0" accesskey="1" onfocus="tab.display(1);" onclick="tab.display(1); return(false);" style="font-size:10px;">Informaci&oacute;n</a></th>
 		<th width="20%" id="tab2" class="activetab" onclick="javascript:tab.display(2);"><a href="#" tabindex="0" accesskey="2" onfocus="tab.display(2);" onclick="tab.display(2); return(false);" style="font-size:10px;">Todas las versiones</a></th>
-		<th width="20%" id="tab3" class="activetab" onclick="javascript:tab.display(3);"><a href="#" tabindex="0" accesskey="3" onfocus="tab.display(3);" onclick="tab.display(3); return(false);" style="font-size:10px;">Documentos relacionados</a></th>
-		<th width="20%" id="tab4" class="activetab" onclick="javascript:tab.display(4);"><a href="#" tabindex="0" accesskey="4" onfocus="tab.display(4);" onclick="tab.display(4); return(false);" style="font-size:10px;">Notificaciones</a></th>
-		<th width="20%" id="tab5" class="activetab" onclick="javascript:tab.display(5);"><a href="#" tabindex="0" accesskey="5" onfocus="tab.display(5);" onclick="tab.display(5); return(false);" style="font-size:10px;">{lang_acl}</a></th>
+		<!--<th width="20%" id="tab3" class="activetab" onclick="javascript:tab.display(3);"><a href="#" tabindex="0" accesskey="3" onfocus="tab.display(3);" onclick="tab.display(3); return(false);" style="font-size:10px;">Documentos relacionados</a></th>
+		<th width="20%" id="tab4" class="activetab" onclick="javascript:tab.display(4);"><a href="#" tabindex="0" accesskey="4" onfocus="tab.display(4);" onclick="tab.display(4); return(false);" style="font-size:10px;">Notificaciones</a></th> 
+		<th width="20%" id="tab5" class="activetab" onclick="javascript:tab.display(5);"><a href="#" tabindex="0" accesskey="5" onfocus="tab.display(5);" onclick="tab.display(5); return(false);" style="font-size:10px;">{lang_acl}</a></th>-->
 	</tr>
 </table>
@@ -187,5 +187,5 @@
 
 <!-- BEGIN lock_row -->
-	<tr class="row_on">
+<!--	<tr class="row_on">
 		<td class="description" valign="top">Status de Bloqueo:</td>
 		<td class="infos" colspan="3">
@@ -202,5 +202,5 @@
 			</div>
 		</td>
-	</tr>
+	</tr>-->
 <!-- END lock_row -->
 
@@ -298,5 +298,5 @@
 				<input type="hidden" id="targetid" name="targetid" value="unchanged">
 			</td>
-			<td align="center" width="150px"><a href="#" onclick="selectFolder({current_folder_id},'info_form'); return(false);" style="font-size:10px;">Mover Documento</a></td>
+			<td align="center" width="150px"></td>
 		</tr>
 		<tr class="row_on">
Index: /contrib/Dms/out/out.SetExpires.php
===================================================================
--- /contrib/Dms/out/out.SetExpires.php	(revision 3526)
+++ /contrib/Dms/out/out.SetExpires.php	(revision 4362)
@@ -34,6 +34,6 @@
 			<td valign="top" class="inputDescription"><?php printMLText("expires");?>:</td>
 			<td class="standardText">
-				<input type="Radio" name="expires" value="false"<?phpif (!$document->expires()) print " checked";?>><?php printMLText("does_not_expire");?><br>
-				<input type="radio" name="expires" value="true"<?phpif ($document->expires()) print " checked";?>><?php if ($document->expires()) printDateChooser($document->getExpires(), "exp"); else printDateChooser(-1, "exp"); ?>
+				<input type="Radio" name="expires" value="false"<?php if (!$document->expires()) print " checked";?>><?php printMLText("does_not_expire");?><br>
+				<input type="radio" name="expires" value="true"<?php if ($document->expires()) print " checked";?>><?php if ($document->expires()) printDateChooser($document->getExpires(), "exp"); else printDateChooser(-1, "exp"); ?>
 			</td>
 		</tr>
Index: /contrib/Dms/out/out.FolderAccess.php
===================================================================
--- /contrib/Dms/out/out.FolderAccess.php	(revision 3526)
+++ /contrib/Dms/out/out.FolderAccess.php	(revision 4362)
@@ -13,4 +13,5 @@
 
 include("../inc/inc.Authentication.php");
+//
 
 
@@ -26,10 +27,104 @@
 
 $folderid	= (isset($_GET['folderid'])) ? (int) $_GET['folderid'] : NULL;
-$folder		= getFolder($folderid);
-
-$allUsers = getAllUsers();
-
-if ($folder->getAccessMode($user) < M_ALL)
-	die ("Access denied");
+//$folder		= getFolder($folderid);
+
+if(!$folder = getFolder($folderid)) {
+$GLOBALS['phpgw']->redirect_link('out/out.ViewFolder.php?error=accesso denegado!');
+		
+}
+
+if ($folder->getAccessMode($user) < M_READWRITE)
+$GLOBALS['phpgw']->redirect_link('out/out.ViewFolder.php?error=accesso denegado!');
+
+
+//$allUsers = getAllUsers();
+//foreach($allUsers as $c=>$v)
+   //  echo "<p>El vector con indice $c tiene el valor $v </p>";
+     //while (list($clave, $valor) = each($allUsers)) {
+      //echo "<p>El vector con indice $clave tiene el valor $valor </p>";
+     //}
+//asort($allUsers);
+//uasort($allUsers,'ordenar');
+  
+
+
+
+
+$accounts = $GLOBALS['phpgw']->accounts->get_list('accounts'); 
+	$allUsers = array();
+	for ($i = 0; $i < count($accounts); $i++)
+	{
+		$id = $accounts[$i]["account_id"];
+		$login = $accounts[$i]["account_lid"];
+		$fullName = $accounts[$i]['account_firstname'].' '.$accounts[$i]['account_lastname'];
+		$email = $accounts[$i]["account_email"];
+		$isAdmin = phpgw_is_admin($id);
+		$pwd = '';
+		$comment = '';
+		//$myCollection->add($id,$login,$fullName,$email,$isAdmin,$pwd,$comment);
+		$allUsers[$i]=new User($id, $login, $pwd, $fullName, $email, $comment, $isAdmin);
+	}
+//$allUsers->sortDataSet("fullName");
+
+	
+	 function cmpNames($a,$b)
+    {
+        //Use sort() for simple alphabetical comparison
+        //Convert to lowercase to ensure consistent behaviour
+        $sortable = array(strtolower($a->_fullName),strtolower($b->_fullName));
+        $sorted = $sortable;
+        sort($sorted);   
+       
+        //If the names have switched position, return -1. Otherwise, return 1.
+        return ($sorted[0] == $sortable[0]) ? -1 : 1;
+    }
+uasort($allUsers, "cmpNames");
+
+
+//					$allGroups = getAllGroups();
+$phpgw_groups = $GLOBALS['phpgw']->accounts->get_list('groups');
+
+$allGroups= array();
+	
+	
+	for ($i = 0; $i < count($phpgw_groups); $i++)
+		$allGroups[$i] = new Group($phpgw_groups[$i]["account_id"], $phpgw_groups[$i]["account_lid"], '');
+	
+ function cmpNamesg($a,$b)
+    {
+        //Use sort() for simple alphabetical comparison
+        //Convert to lowercase to ensure consistent behaviour
+        $sortable = array(strtolower($a->_name),strtolower($b->_name));
+        $sorted = $sortable;
+        sort($sorted);   
+       
+        //If the names have switched position, return -1. Otherwise, return 1.
+        return ($sorted[0] == $sortable[0]) ? -1 : 1;
+    }
+    
+    uasort($allGroups, "cmpNamesg");
+    
+
+//Sort by name:
+//$myCollection->sortDataSet("fullName");
+//print_r($myCollection->dataSet);
+ //$allUsers[]->sortDataSet("fullName");
+
+//Sort by x
+//$myCollection->sortDataSet("login");
+//print_r($myCollection->dataSet);
+
+//Sort by y
+//$myCollection->sortDataSet("id");
+//print_r($myCollection->dataSet);
+
+//Sort by order added
+//$myCollection->sortDataSet("added");
+//print_r($myCollection->dataSet);
+	
+
+
+//if ($folder->getAccessMode($user) < M_ALL)
+	//die ("Access denied");
 
 
@@ -58,7 +153,8 @@
 printFolderPageStart($folder);
 printPageHeader(getMLText("edit_folder_access") . ": " . $folder->getName());
-
-
-//Nur admin darf Besitzer ändern
+$owner = $folder->getOwner();
+if($user->getID()==1120 ||$owner->getID()==$user->getID()){
+
+//Nur admin darf Besitzer ï¿œndern
 if ($user->isAdmin())
 {
@@ -112,5 +208,7 @@
 }
 
+if($user->getID()==1120 ){
 printMLText("does_not_inherit_access_msg", array("inheriturl" => "../op/op.FolderAccess.php?folderid=".$folderid."&action=inherit"));
+}
 print "</div>";
 
@@ -118,17 +216,8 @@
 $accessList = $folder->getAccessList();
 
-printNextBox(getMLText("default_access"));
-?>
-
-<div class="defaultAccess">
-<form action="../op/op.FolderAccess.php">
-	<input type="Hidden" name="folderid" value="<?php print $folderid;?>">
-	<input type="Hidden" name="action" value="setdefault">
-	
-	<?php printAccessModeSelection($folder->getDefaultAccess()); ?>
-	<p>
-	<input type="Submit">
-</form>
-</div>
+//printNextBox(getMLText("default_access"));
+?>
+
+
 
 <?php
@@ -227,5 +316,4 @@
 				<option value="none">-------------------------------
 				<?php
-					$allGroups = getAllGroups();
 					foreach ($allGroups as $groupObj)
 						print "<option value=\"".$groupObj->getID()."\">" . $groupObj->getName() . "\n";
@@ -251,5 +339,9 @@
 
 printEndBox();
+
+
 printFolderPageEnd($folder);
+
+}
 printHTMLFoot();
 ?>
Index: /contrib/Dms/out/out.AddSubFolder.php
===================================================================
--- /contrib/Dms/out/out.AddSubFolder.php	(revision 3526)
+++ /contrib/Dms/out/out.AddSubFolder.php	(revision 4362)
@@ -18,9 +18,14 @@
 
 $folderid = (isset($_GET['folderid'])) ? (int) $_GET['folderid'] : 1;
-$folder = getFolder($folderid);
 
+//echo "<br>folderid".$folderid;
+//$folder = getFolder($folderid);
+if(!$folder = getFolder($folderid)) {
+$GLOBALS['phpgw']->redirect_link('out/out.ViewFolder.php?error=accesso denegado!');
+		
+}
 
 if ($folder->getAccessMode($user) < M_READWRITE)
-	die("accesso denegado");
+$GLOBALS['phpgw']->redirect_link('out/out.ViewFolder.php?error=accesso denegado!');
 
 
Index: /contrib/Dms/out/out.FolderNotify.php
===================================================================
--- /contrib/Dms/out/out.FolderNotify.php	(revision 3526)
+++ /contrib/Dms/out/out.FolderNotify.php	(revision 4362)
@@ -15,10 +15,19 @@
 
 $folderid = (isset($_GET['folderid'])) ? (int) $_GET['folderid'] : 1;
-$folder = getFolder($folderid);
+//$folder = getFolder($folderid);
+
+if(!$folder = getFolder($folderid)) {
+$GLOBALS['phpgw']->redirect_link('out/out.ViewFolder.php?error=accesso denegado!');
+		
+}
+
+if ($folder->getAccessMode($user) < M_READWRITE)
+$GLOBALS['phpgw']->redirect_link('out/out.ViewFolder.php?error=accesso denegado!');
+
 
 $notifyList = $folder->getNotifyList();
 
-if ($folder->getAccessMode($user) < M_READWRITE)
-	die ("Access denied");
+//if ($folder->getAccessMode($user) < M_READWRITE)
+	//die ("Access denied");
 
 
Index: /contrib/Dms/out/out.ViewFolder.php
===================================================================
--- /contrib/Dms/out/out.ViewFolder.php	(revision 3526)
+++ /contrib/Dms/out/out.ViewFolder.php	(revision 4362)
@@ -1,3 +1,6 @@
 <?php
+
+
+
 include("../inc/inc.Settings.php");
 include("../inc/inc.AccessUtils.php");
@@ -14,16 +17,35 @@
 
 include("../inc/inc.Authentication.php");
+//include("../../phpgwapi/inc/class.accounts_ldap.inc.php");
+
+
+
+//echo"<br>".;
+//read_repository2($GLOBALS['phpgw_info']['user']['account_id']);
+
+
+$acceso=0;
 
 $folderid = (isset($_GET['folderid'])) ? (int) $_GET['folderid'] : 1;
+
+//echo "<br>a".$folderid."  b  ".$_GET['folderid']."<br>";
+
 if(!$folder = getFolder($folderid)) {
 	//die ("Accesso denegado!".$folderid."  ".getFolder($folderid));
-
+$acceso=0;
 $GLOBALS['phpgw']->redirect_link('out/out.ViewFolder.php?error=accesso denegado!');
 
+}else{
+	$acceso=1;
 }
+
+//echo $folder->getAccessMode();
 
 if ($folder->getAccessMode($user) < M_READ) {
 	//die ("accesso denegado!"."  ".$folder->getAccessMode($user));
+	$acceso=0;
 $GLOBALS['phpgw']->redirect_link('out/out.ViewFolder.php?error=accesso denegado!');
+}else{
+	$acceso=1;
 }
 
@@ -68,5 +90,8 @@
         </table>
 
-
+<?php
+//echo "acccceso".$acceso;
+	  if (isset($_GET['folderid'])||$_GET['folderid']>1){
+?>
 
 
@@ -93,16 +118,20 @@
 			<td colspan="2" height="8" class="textSidebox">&nbsp;</td>
 		</tr>
-		<tr class="divSideboxEntry">
+	<!--  	<tr class="divSideboxEntry">
 			<td width="20" align="center" valign="middle" class="textSidebox"><img class="sideboxstar" src="<?php echo  $GLOBALS['phpgw_info']['server']['webserver_url']?>/phpgwapi/templates/idots/images/orange-ball.png" width="9" height="9" alt="ball"/></td><td class="textSidebox"><a class="textSidebox" href="<?php echo  $GLOBALS['phpgw_info']['server']['webserver_url'];?>/mydms/out/out.FolderNotify.php?folderid=<?php echo $folderid;?>">notificaciones</a></td>
-		</tr>
+		</tr> -->
 		<tr class="divSideboxEntry">
 			<td width="20" align="center" valign="middle" class="textSidebox"><img class="sideboxstar" src="<?php echo  $GLOBALS['phpgw_info']['server']['webserver_url']?>/phpgwapi/templates/idots/images/orange-ball.png" width="9" height="9" alt="ball"/></td><td class="textSidebox"><a class="textSidebox" href="<?php echo  $GLOBALS['phpgw_info']['server']['webserver_url'];?>/mydms/out/out.FolderAccess.php?folderid=<?php echo $folderid;?>">derechos de acceso</a></td>
 
 		</tr>
+		
+		<?php }?>
 		</table>	
 	<table cellspacing="5" cellpadding="0" border="0">
 	<?php
+	  if($acceso>0){
 		$documents = $folder->getDocuments();
-		$documents = filterAccess($documents, $user, M_READ);
+		//echo "user".$user;
+		//$documents = filterAccess($documents, $user, M_READ);
 		if (count($documents) > 0)
 		{
@@ -149,4 +178,5 @@
 			print "<tr><td class=\"filelist\">".getMLText("no_documents")."</td></tr>";
 		}
+	  }
 	?>
 	</table>
Index: /contrib/Dms/out/out.ViewDocument.php
===================================================================
--- /contrib/Dms/out/out.ViewDocument.php	(revision 3526)
+++ /contrib/Dms/out/out.ViewDocument.php	(revision 4362)
@@ -19,4 +19,11 @@
 $document = getDocument($documentid);
 $folder = $document->getFolder();
+//echo $folder. "folder id<br>";
+//echo $document. "doc id<br>";
+//echo $documentid. "documentidid<br>";
+//echo $user. "user<br>";
+
+
+
 
 if ($document->getAccessMode($user) < M_READ)
Index: /contrib/Dms/out/out.EditFolder.php
===================================================================
--- /contrib/Dms/out/out.EditFolder.php	(revision 3526)
+++ /contrib/Dms/out/out.EditFolder.php	(revision 4362)
@@ -15,10 +15,19 @@
 
 $folderid = (isset($_GET['folderid'])) ? (int) $_GET['folderid'] : 1;
-$folder = getFolder($folderid);
+//$folder = getFolder($folderid);
+
+
+if(!$folder = getFolder($folderid)) {
+$GLOBALS['phpgw']->redirect_link('out/out.ViewFolder.php?error=accesso denegado!');
+		
+}
+
+if ($folder->getAccessMode($user) < M_READWRITE)
+$GLOBALS['phpgw']->redirect_link('out/out.ViewFolder.php?error=accesso denegado!');
 
 $parent = ($folder->getID() == $settings->_rootFolderID) ? false : $folder->getParent();
 
-if ($folder->getAccessMode($user) < M_READWRITE)
-	die ("Access denied");
+//if ($folder->getAccessMode($user) < M_READWRITE)
+	//die ("Access denied");
 
 
Index: /contrib/Dms/out/out.UpdateDocument.php
===================================================================
--- /contrib/Dms/out/out.UpdateDocument.php	(revision 3526)
+++ /contrib/Dms/out/out.UpdateDocument.php	(revision 4362)
@@ -87,6 +87,6 @@
 			<td valign="top" class="inputDescription"><?php printMLText("expires");?>:</td>
 			<td class="standardText">
-				<input type="Radio" name="expires" value="false"<?phpif (!$document->expires()) print " checked";?>><?php printMLText("does_not_expire");?><br>
-				<input type="radio" name="expires" value="true"<?phpif ($document->expires()) print " checked";?>><?php printDateChooser(-1, "exp");?>
+				<input type="Radio" name="expires" value="false"<?php if (!$document->expires()) print " checked";?>><?php printMLText("does_not_expire");?><br>
+				<input type="radio" name="expires" value="true"<?php if ($document->expires()) print " checked";?>><?php printDateChooser(-1, "exp");?>
 			</td>
 		</tr>
Index: /contrib/Dms/out/out.AddDocument.php
===================================================================
--- /contrib/Dms/out/out.AddDocument.php	(revision 3526)
+++ /contrib/Dms/out/out.AddDocument.php	(revision 4362)
@@ -15,8 +15,17 @@
 
 $folderid = (isset($_GET['folderid'])) ? (int) $_GET['folderid'] : 1;
-$folder = getFolder($folderid);
+//$folder = getFolder($folderid);
+
+//if ($folder->getAccessMode($user) < M_READWRITE)
+	//die("access denied");
+	
+if(!$folder = getFolder($folderid)) {
+$GLOBALS['phpgw']->redirect_link('out/out.ViewFolder.php?error=accesso denegado!');
+		
+}
 
 if ($folder->getAccessMode($user) < M_READWRITE)
-	die("access denied");
+$GLOBALS['phpgw']->redirect_link('out/out.ViewFolder.php?error=accesso denegado!');
+
 
 printHTMLHead( getMLText("folder_title", array("foldername" => $folder->getName()) ) );
@@ -48,4 +57,8 @@
 printStartBox(getMLText("add_document"));
 ?>
+
+<font color="red"><b>NOTA:</b> El documento hereda el permiso correspondiente de la carpeta que lo contiene </font><br></br>
+
+
 
 <form action="../op/op.AddDocument.php" enctype="multipart/form-data" method="post" name="form1" onsubmit="return checkForm();">
Index: /contrib/Dms/inc/inc.ClassGroup.php
===================================================================
--- /contrib/Dms/inc/inc.ClassGroup.php	(revision 3526)
+++ /contrib/Dms/inc/inc.ClassGroup.php	(revision 4362)
@@ -10,5 +10,5 @@
 	
 	$name = $GLOBALS['phpgw']->accounts->id2name($id);
-	
+//	echo" el grupo es".$name."   ".$id."<br>";
 	return new Group($id, $name, '');
 }
@@ -144,4 +144,7 @@
 	{
 		//Wenn die User bereits abgefragt wurden, geht's so schneller:
+		
+		//echo "usuariooooo".$user->getID()."<br>";
+		
 		if (isset($this->_users))
 		{
@@ -154,15 +157,19 @@
 		
 		$members = $GLOBALS['phpgw']->accounts->member((int)$this->_id);
+	
                 $phpgw_group_member = array();
 
                 if (is_array($members))
                 {
-                        foreach($members as $member)
+                     /*   foreach($members as $member)
                         {
                                 if(!in_array($member['account_id'],$phpgw_group_member))
                                 {
                                         $phpgw_group_member[] = $member['account_id'];
-                                }
-                        }
+                                        //echo "grupomiembro".$member['account_id']."   ".$this->_id."<br>";
+                                }//else{
+                                	//echo "<br>arrreglo<br>".$member['account_id']."   ".$phpgw_group_member->id."<br>";
+                                //}
+                        }*/
                 }
 						
@@ -177,4 +184,7 @@
 
 	}
+	
+
+	
 
 	/**
Index: /contrib/Dms/inc/inc.ClassMultisort.php
===================================================================
--- /contrib/Dms/inc/inc.ClassMultisort.php	(revision 4362)
+++ /contrib/Dms/inc/inc.ClassMultisort.php	(revision 4362)
@@ -0,0 +1,119 @@
+<?php
+class dataItem
+{
+    var $name;
+    var $id;
+    var $login;
+    var $fullName;
+    var $email;
+    var $isAdmin;
+    var $pwd;
+    var $comment;
+    
+    
+    
+   
+    //Constructor
+    function dataItem($id,$login,$fullName,$email,$isAdmin,$pwd,$comment)
+    {
+        $this->id = $id;
+        $this->login = $login;
+        $this->fullName = $fullName;
+        $this->email = $email;
+        $this->isAdmin = $isAdmin;
+        $this->pwd = $pwd;
+        $this->comment = $comment;
+    }
+    
+    
+    function getID() { return $this->id; }
+
+	function getLogin() { return $this->login; }
+	
+	function getFullName() { return $this->fullName; }
+	function getPwd() { return $this->pwd; }
+		
+	function getEmail() { return $this->email; }
+		
+			
+	function getComment() { return $this->comment; }
+	function getIsAdmin() { return $this->isAdmin; }
+				
+    
+    
+}
+
+class collection
+{
+    var $dataSet = array();
+   
+    //Creates a new data item and adds it to our array
+    function add($id,$login,$fullName,$email,$isAdmin,$pwd,$comment)
+    {
+        $this->dataSet[] = new dataItem($id,$login,$fullName,$email,$isAdmin,$pwd,$comment);
+    }
+   
+    //The wrapper sort function
+    function sortDataSet($s)
+    {
+        //Sort by the given parameter
+        switch($s)
+        {
+            case "fullName":
+                //Note use of array to reference member method of this object in callback
+                uasort($this->dataSet,array($this,"cmpName"));
+                break;
+           
+            case "login":
+                uasort($this->dataSet,array($this,"cmpX"));
+                break;
+               
+            case "id":
+                uasort($this->dataSet,array($this,"cmpY"));
+                break;               
+           
+            case "added":
+            default:
+                //Re-sort array by original keys
+                ksort($this->dataSet);       
+        }
+    }
+
+    //Callback function for sorting by name
+    //$a and $b are dataItem objects
+    function cmpName($a,$b)
+    {
+        //Use sort() for simple alphabetical comparison
+        //Convert to lowercase to ensure consistent behaviour
+        $sortable = array(strtolower($a->fullName),strtolower($b->fullName));
+        $sorted = $sortable;
+        sort($sorted);   
+       
+        //If the names have switched position, return -1. Otherwise, return 1.
+        return ($sorted[0] == $sortable[0]) ? -1 : 1;
+    }
+   
+    //Callback function for sorting by x
+    //$a and $b are dataItem objects
+    function cmpX($a,$b)
+    {
+        //Use sort() for simple alphabetical comparison
+        //Convert to lowercase to ensure consistent behaviour
+        $sortable = array(strtolower($a->x),strtolower($b->x));
+        $sorted = $sortable;
+        sort($sorted);   
+       
+        //If the names have switched position, return -1. Otherwise, return 1.
+        return ($sorted[0] == $sortable[0]) ? -1 : 1;
+    }
+   
+    //Callback function for sorting by y
+    //$a and $b are dataItem objects
+    function cmpY($a,$b)
+    {       
+        //If $a's y attribute >= $b's y attribute, return 1. Otherwise, return -1.
+        return ($a->y >= $b->y) ? 1 : -1;
+    }   
+
+}
+?>
Index: /contrib/Dms/inc/class.uimydms.inc.php
===================================================================
--- /contrib/Dms/inc/class.uimydms.inc.php	(revision 3526)
+++ /contrib/Dms/inc/class.uimydms.inc.php	(revision 4362)
@@ -13,5 +13,5 @@
 	
 	/* $Id: class.uimydms.inc.php 22794 2006-11-06 05:53:11Z lkneschke $ */
-
+define('PHPGW_SERVER_ROOT','/var/www/expresso');
 	require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.Settings.php');
 	require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.DBAccess.php');
@@ -759,5 +759,5 @@
 			$this->t->set_var('lang_comment',lang('comment'));
 			$this->t->set_var('lang_keywords',lang('keywords'));
-			$this->t->set_var('lang_download',lang('download'));
+			$this->t->set_var('lang_download',lang('Descargar Archivo'));
 			$this->t->set_var('lang_last_update',lang('last update'));
 			$this->t->set_var('lang_current_version',lang('current version'));
@@ -776,5 +776,5 @@
 			$this->t->set_var('lang_delete',lang('delete'));
 			$this->t->set_var('lang_view_online',lang('view online'));
-			$this->t->set_var('lang_confirm_delete',lang('Do you really want to delete this document?'));
+			$this->t->set_var('lang_confirm_delete',lang('Relmente quiere borrar el documento?'));
 			$this->t->set_var('lang_update_document',lang('update document'));
 			$this->t->set_var('lang_update',lang('update'));
@@ -865,9 +865,12 @@
 		{
 			$documentID = ($_documentID === false ? (int)$_GET['documentid'] : $_documentID);
-
+			
+			//echo "documento".$documentID;
 			if(!$document	= getDocument($documentID))
 			{
 				print "Access denied!"; exit;
 			}
+		
+
 			$user 		= getUser($GLOBALS['phpgw_info']['user']['account_id']);
 			$accessMode	= $document->getAccessMode($user);
Index: /contrib/Dms/inc/inc.ClassFolder.php
===================================================================
--- /contrib/Dms/inc/inc.ClassFolder.php	(revision 3526)
+++ /contrib/Dms/inc/inc.ClassFolder.php	(revision 4362)
@@ -4,6 +4,7 @@
 	if (!is_numeric($id))
 		die ("invalid folderid");
-
-	$queryStr = "SELECT * FROM phpgw_mydms_Folders WHERE id = " . $id;
+	$queryStr = "SELECT id,name,parent,comment,owner,inheritaccess,defaultaccess,sequence FROM phpgw_mydms_folders WHERE id = " . $id;
+	
+	//echo "<br>folderrrrr".$queryStr."<br>";
 	$resArr = $GLOBALS['mydms']->db->getResultArray($queryStr);
 		
@@ -15,14 +16,19 @@
 	$resArr = $resArr[0];
 	if($id == 1) {
-		$resArr["defaultAccess"] = M_READ;
-	}
-	$newFolder =  new Folder($resArr["id"], $resArr["name"], $resArr["parent"], $resArr["comment"], $resArr["owner"], $resArr["inheritAccess"], $resArr["defaultAccess"], $resArr["sequence"]);
+		$resArr[6] = M_READ;
+	}
+	//	echo $resArr["id"]."  ".$resArr[6]." ".$resArr["parent"]."   ".$id."  ".$GLOBALS['phpgw_info']['user']['account_id']." dddd ".$resArr[5]."  dddd ".$resArr["defaultAccess"];
 	
+	$newFolder =  new Folder($resArr["id"], $resArr["name"], $resArr["parent"], $resArr["comment"], $resArr["owner"], $resArr["inheritaccess"], $resArr["defaultaccess"], $resArr["sequence"]);
+	//echo "llll".$GLOBALS['phpgw_info']['user']['account_id']."   ".$resArr["inheritaccess"];
 	#print $resArr["name"]."<br>";
 	#print $newFolder->getAccessMode(getUser($GLOBALS['phpgw_info']['user']['account_id']))."<br>";
-	if($newFolder->getAccessMode(getUser($GLOBALS['phpgw_info']['user']['account_id'])) > 1)
-        	return $newFolder;
-	else
+	if($newFolder->getAccessMode(getUser($GLOBALS['phpgw_info']['user']['account_id'])) > 1){
+	//echo "retornoooo";    
+		return $newFolder;
+	}
+	else{
 		return false;
+	}
 }
 
@@ -45,4 +51,8 @@
 	function Folder($id, $name, $parentID, $comment, $ownerID, $inheritAccess, $defaultAccess, $sequence)
 	{
+		//echo "aaaaaccccseexxx".$inheritAccess;
+			if($inheritAccess=='f'){
+				unset($inheritAccess);
+			}	
 		$this->_id = $id;
 		$this->_name = $name;
@@ -53,7 +63,7 @@
 		$this->_defaultAccess = $defaultAccess;
 		$this->_sequence = $sequence;
-		
 		$this->db = clone($GLOBALS['phpgw']->db);
 		$this->db->set_app('mydms');
+	//	echo"accc".$defaultAccess."lll{Ã±{{Ã±".$inheritAccess;
 	}
 
@@ -67,5 +77,5 @@
 		$where	= array('id' => $this->_id);
 		
-		if(!$this->db->update('phpgw_mydms_Folders', $data, $where, __LINE__, __FILE__))
+		if(!$this->db->update('phpgw_mydms_folders', $data, $where, __LINE__, __FILE__))
 			return false;
 		
@@ -82,5 +92,5 @@
 		$where	= array('id' => $this->_id);
 		
-		if(!$this->db->update('phpgw_mydms_Folders', $data, $where, __LINE__, __FILE__))
+		if(!$this->db->update('phpgw_mydms_folders', $data, $where, __LINE__, __FILE__))
 			return false;
 		
@@ -105,5 +115,5 @@
 		$where	= array('id' => $this->_id);
 		
-		if(!$this->db->update('phpgw_mydms_Folders', $data, $where, __LINE__, __FILE__))
+		if(!$this->db->update('phpgw_mydms_folders', $data, $where, __LINE__, __FILE__))
 			return false;
 		
@@ -126,5 +136,5 @@
 		$where	= array('id' => $this->_id);
 		
-		if(!$this->db->update('phpgw_mydms_Folders', $data, $where, __LINE__, __FILE__))
+		if(!$this->db->update('phpgw_mydms_folders', $data, $where, __LINE__, __FILE__))
 			return false;
 		
@@ -151,5 +161,5 @@
 		$where	= array('id' => $this->_id);
 		
-		if(!$this->db->update('phpgw_mydms_Folders', $data, $where, __LINE__, __FILE__))
+		if(!$this->db->update('phpgw_mydms_folders', $data, $where, __LINE__, __FILE__))
 			return false;
 		
@@ -167,5 +177,5 @@
 		$where	= array('id' => $this->_id);
 		
-		if(!$this->db->update('phpgw_mydms_Folders', $data, $where, __LINE__, __FILE__))
+		if(!$this->db->update('phpgw_mydms_folders', $data, $where, __LINE__, __FILE__))
 			return false;
 		
@@ -181,5 +191,5 @@
 		$where	= array('id' => $this->_id);
 		
-		if(!$this->db->update('phpgw_mydms_Folders', $data, $where, __LINE__, __FILE__))
+		if(!$this->db->update('phpgw_mydms_folders', $data, $where, __LINE__, __FILE__))
 			return false;
 
@@ -192,5 +202,5 @@
 		if (!isset($this->_subFolders))
 		{
-			$queryStr = "SELECT * FROM phpgw_mydms_Folders WHERE parent = " . $this->_id . " ORDER BY sequence";
+			$queryStr = "SELECT * FROM phpgw_mydms_folders WHERE parent = " . $this->_id . " ORDER BY sequence";
 
 
@@ -226,5 +236,5 @@
 			'sequence'	=> $sequence,
 		);
-		$res = $this->db->insert('phpgw_mydms_Folders', $insertData, '', __LINE__, __FILE__, 'mydms');
+		$res = $this->db->insert('phpgw_mydms_folders', $insertData, '', __LINE__, __FILE__, 'mydms');
 
 		if (!$res)
@@ -233,5 +243,5 @@
 		unset($this->_subFolders);
 		
-		return getFolder($this->db->get_last_insert_id('phpgw_mydms_Folders','id'));
+		return getFolder($this->db->get_last_insert_id('phpgw_mydms_folders','id'));
 	}
 
@@ -307,7 +317,10 @@
 	function getDocuments()
 	{
+		
+	//	echo "aaaaaaaquoooooo";
 		if (!isset($this->_documents))
 		{
-			$queryStr = "SELECT * FROM phpgw_mydms_Documents WHERE folder = " . $this->_id . " ORDER BY sequence";
+			$queryStr = "SELECT * FROM phpgw_mydms_documents WHERE folder = " . $this->_id . " ORDER BY id desc,sequence";
+		//	echo "eeeeee".$queryStr;
 			$resArr = $GLOBALS['mydms']->db->getResultArray($queryStr);
 			if (is_bool($resArr) && !$resArr)
@@ -341,5 +354,5 @@
 			'sequence'	=> $sequence,
 		);
-		$res = $this->db->insert('phpgw_mydms_Documents', $insertData, '', __LINE__, __FILE__, 'mydms');
+		$res = $this->db->insert('phpgw_mydms_documents', $insertData, '', __LINE__, __FILE__, 'mydms');
 
 		if (!$res)
@@ -355,10 +368,10 @@
 		#	return false;
 		
-		$document = getDocument($this->db->get_last_insert_id('phpgw_mydms_Documents','id'));
+		$document = getDocument($this->db->get_last_insert_id('phpgw_mydms_documents','id'));
 		
 		$res = $document->addContent($comment, $owner, $tmpFile, $orgFileName, $fileType, $mimeType);
 		if (is_bool($res) && !$res)
 		{
-			$queryStr = "DELETE FROM phpgw_mydms_Documents WHERE id = " . $document->getID();
+			$queryStr = "DELETE FROM phpgw_mydms_documents WHERE id = " . $document->getID();
 			$GLOBALS['mydms']->db->getResult($queryStr);
 			return false;
@@ -389,11 +402,11 @@
 		
 		//Entfernen der Datenbankeintrï¿œge
-		$queryStr = "DELETE FROM phpgw_mydms_Folders WHERE id =  " . $this->_id;
-		if (!$GLOBALS['mydms']->db->getResult($queryStr))
-			return false;
-		$queryStr = "DELETE FROM phpgw_mydms_ACLs WHERE target = ". $this->_id. " AND targetType = " . T_FOLDER;
-		if (!$GLOBALS['mydms']->db->getResult($queryStr))
-			return false;
-		$queryStr = "DELETE FROM phpgw_mydms_Notify WHERE target = ". $this->_id. " AND targetType = " . T_FOLDER;
+		$queryStr = "DELETE FROM phpgw_mydms_folders WHERE id =  " . $this->_id;
+		if (!$GLOBALS['mydms']->db->getResult($queryStr))
+			return false;
+		$queryStr = "DELETE FROM phpgw_mydms_acls WHERE target = ". $this->_id. " AND targettype = " . T_FOLDER;
+		if (!$GLOBALS['mydms']->db->getResult($queryStr))
+			return false;
+		$queryStr = "DELETE FROM phpgw_mydms_notify WHERE target = ". $this->_id. " AND targettype = " . T_FOLDER;
 		if (!$GLOBALS['mydms']->db->getResult($queryStr))
 			return false;
@@ -415,6 +428,6 @@
 		if (!isset($this->_accessList))
 		{
-			$queryStr = "SELECT * FROM phpgw_mydms_ACLs WHERE targetType = ".T_FOLDER." AND target = " . $this->_id . " ORDER BY targetType";
-
+			$queryStr = "SELECT * FROM phpgw_mydms_acls WHERE targettype = ".T_FOLDER." AND target = " . $this->_id . " ORDER BY targettype";
+//echo "aqui".$queryStr ;
 			$resArr = $GLOBALS['mydms']->db->getResultArray($queryStr);
 
@@ -426,4 +439,6 @@
 			foreach ($resArr as $row)
 			{
+								//echo "el grupo de acceso es".$row[4]."   ".$row["groupid"]."<br>";
+				
 				if ($row["userid"] != -1)
 					array_push($this->_accessList["users"], new UserAccess($row["userid"], $row["mode"]));
@@ -435,8 +450,44 @@
 		return $this->_accessList;
 	}
+	
+	
+	
+function getAccessList2()
+	{
+		
+		$grupos=read_repository2($GLOBALS['phpgw_info']['user']['account_id']);
+	//	echo "".$GLOBALS['phpgw_info']['user']['account_id'];
+
+	if($grupos!=''){
+			$queryStr = "SELECT * FROM phpgw_mydms_acls WHERE targettype = ".T_FOLDER." AND target = " . $this->_id . " and (userid=".$GLOBALS['phpgw_info']['user']['account_id']." or groupid in (".$grupos."))  ORDER BY targettype";
+	}else{
+					$queryStr = "SELECT * FROM phpgw_mydms_acls WHERE targettype = ".T_FOLDER." AND target = " . $this->_id . " and (userid=".$GLOBALS['phpgw_info']['user']['account_id']." )  ORDER BY targettype";
+		
+	}
+//echo "<br>aqui".$queryStr ;
+			$resArr = $GLOBALS['mydms']->db->getResultArray($queryStr);
+
+
+			if (is_bool($resArr) && !$resArr)
+				return false;
+			
+			//$this->_accessList = array("groups" => array(), "users" => array());
+			foreach ($resArr as $row)
+			{
+				//echo "acceso".$row["mode"];
+								//echo "el grupo de acceso es".$row[4]."   ".$row["groupid"]."<br>";
+				return $row["mode"];
+				/*if ($row["userid"] != -1)
+					array_push($this->_accessList["users"], new UserAccess($row["userid"], $row["mode"]));
+				else //if ($row["groupID"] != -1)
+					array_push($this->_accessList["groups"], new GroupAccess($row["groupid"], $row["mode"]));*/
+			}
+		
+		return false;
+	}
 
 	function clearAccessList()
 	{
-		$queryStr = "DELETE FROM phpgw_mydms_ACLs WHERE targetType = " . T_FOLDER . " AND target = " . $this->_id;
+		$queryStr = "DELETE FROM phpgw_mydms_acls WHERE targettype = " . T_FOLDER . " AND target = " . $this->_id;
 		if (!$GLOBALS['mydms']->db->getResult($queryStr))
 			return false;
@@ -450,5 +501,5 @@
 		$userOrGroup = ($isUser) ? "userid" : "groupid";
 		
-		$queryStr = "INSERT INTO phpgw_mydms_ACLs (target, targetType, ".$userOrGroup.", mode) VALUES 
+		$queryStr = "INSERT INTO phpgw_mydms_acls (target, targettype, ".$userOrGroup.", mode) VALUES 
 					(".$this->_id.", ".T_FOLDER.", " . $userOrGroupID . ", " .$mode. ")";
 		if (!$GLOBALS['mydms']->db->getResult($queryStr))
@@ -463,5 +514,5 @@
 		$userOrGroup = ($isUser) ? "userID" : "groupID";
 		
-		$queryStr = "UPDATE phpgw_mydms_ACLs SET mode = " . $newMode . " WHERE targetType = ".T_FOLDER." AND target = " . $this->_id . " AND " . $userOrGroup . " = " . $userOrGroupID;
+		$queryStr = "UPDATE phpgw_mydms_acls SET mode = " . $newMode . " WHERE targettype = ".T_FOLDER." AND target = " . $this->_id . " AND " . $userOrGroup . " = " . $userOrGroupID;
 		if (!$GLOBALS['mydms']->db->getResult($queryStr))
 			return false;
@@ -475,5 +526,5 @@
 		$userOrGroup = ($isUser) ? "userID" : "groupID";
 		
-		$queryStr = "DELETE FROM phpgw_mydms_ACLs WHERE targetType = ".T_FOLDER." AND target = ".$this->_id." AND ".$userOrGroup." = " . $userOrGroupID;
+		$queryStr = "DELETE FROM phpgw_mydms_acls WHERE targettype = ".T_FOLDER." AND target = ".$this->_id." AND ".$userOrGroup." = " . $userOrGroupID;
 		if (!$GLOBALS['mydms']->db->getResult($queryStr))
 			return false;
@@ -492,4 +543,5 @@
 	function getAccessMode($user)
 	{
+		
 		GLOBAL $settings;
 
@@ -532,5 +584,7 @@
 		//ACLs durchforsten
 		$foundInACL = false;
-		$accessList = $this->getAccessList();
+		
+		return $this->getAccessList2();
+		/*$accessList = $this->getAccessList();
 		if (!$accessList) {
 			return false;
@@ -552,6 +606,10 @@
 		foreach ($accessList["groups"] as $groupAccess)
 		{
+			
 			if ($user->isMemberOfGroup($groupAccess->getGroup()))
 			{
+				
+						//	echo "entro grupoooo<br>";//.$groupAccess->getGroup()."  <br>";
+				
 				$foundInACL = true;
 				if ($groupAccess->getMode() > $highestPrivileged)
@@ -562,8 +620,8 @@
 		}
 		if ($foundInACL)
-			return $highestPrivileged;
+			return $highestPrivileged;*/
 		
 		//Standard-Berechtigung verwenden
-		return $this->getDefaultAccess();
+		//return $this->getDefaultAccess();
 	}
 
@@ -572,5 +630,5 @@
 		if (!isset($this->_notifyList))
 		{
-			$queryStr ="SELECT * FROM phpgw_mydms_Notify WHERE targetType = " . T_FOLDER . " AND target = " . $this->_id;
+			$queryStr ="SELECT * FROM phpgw_mydms_notify WHERE targettype = " . T_FOLDER . " AND target = " . $this->_id;
 			$resArr = $GLOBALS['mydms']->db->getResultArray($queryStr);
 			if (is_bool($resArr) && $resArr == false)
@@ -593,5 +651,5 @@
 		$userOrGroup = ($isUser) ? "userID" : "groupID";
 		
-		$queryStr = "INSERT INTO phpgw_mydms_Notify (target, targetType, " . $userOrGroup . ") VALUES (" . $this->_id . ", " . T_FOLDER . ", " . $userOrGroupID . ")";
+		$queryStr = "INSERT INTO phpgw_mydms_notify (target, targettype, " . $userOrGroup . ") VALUES (" . $this->_id . ", " . T_FOLDER . ", " . $userOrGroupID . ")";
 		if (!$GLOBALS['mydms']->db->getResult($queryStr))
 			return false;
@@ -605,5 +663,5 @@
 		$userOrGroup = ($isUser) ? "userID" : "groupID";
 		
-		$queryStr = "DELETE FROM phpgw_mydms_Notify WHERE target = " . $this->_id . " AND targetType = " . T_FOLDER . " AND " . $userOrGroup . " = " . $userOrGroupID;
+		$queryStr = "DELETE FROM phpgw_mydms_notify WHERE target = " . $this->_id . " AND targettype = " . T_FOLDER . " AND " . $userOrGroup . " = " . $userOrGroupID;
 		if (!$GLOBALS['mydms']->db->getResult($queryStr))
 			return false;
Index: /contrib/Dms/inc/inc.ClassDocument.php
===================================================================
--- /contrib/Dms/inc/inc.ClassDocument.php	(revision 3526)
+++ /contrib/Dms/inc/inc.ClassDocument.php	(revision 4362)
@@ -3,8 +3,12 @@
 function getDocument($id)
 {
+	
+//	echo "aggggi".$id;
 	if (!is_numeric($id))
 		die ("invalid documentid");
 	
 	$queryStr = "SELECT * FROM phpgw_mydms_Documents WHERE id = " . $id;
+	
+	//echo "<br>documentos".$queryStr."<br>";
 	$resArr = $GLOBALS['mydms']->db->getResultArray($queryStr);
 	if (is_bool($resArr) && $resArr == false)
@@ -15,6 +19,7 @@
 
 	$resArr = $resArr[0];
-	$newDocument = new Document($resArr["id"], $resArr["name"], $resArr["comment"], $resArr["date"], $resArr["expires"], $resArr["owner"], $resArr["folder"], $resArr["inheritAccess"], $resArr["defaultAccess"], $resArr["locked"], $resArr["keywords"], $resArr["sequence"]);
-
+	$newDocument = new Document($resArr["id"], $resArr["name"], $resArr["comment"], $resArr["date"], $resArr["expires"], $resArr["owner"], $resArr["folder"], $resArr[7], $resArr[8], $resArr[9], $resArr["keywords"], $resArr["sequence"]);
+
+	
 	if($newDocument->getAccessMode(getUser($GLOBALS['phpgw_info']['user']['account_id'])) > M_NONE)
 		return $newDocument;
@@ -419,5 +424,5 @@
 				return M_NONE;
 		}
-		
+		return $this->getAccessList2();
 		//Berechtigung erben??
 		// wird ï¿œber GetAccessList() bereits realisiert.
@@ -431,5 +436,5 @@
 		}
 		*/
-		$highestPrivileged = M_NONE;
+	/*	$highestPrivileged = M_NONE;
 		
 		//ACLs durchforsten
@@ -465,7 +470,40 @@
 		
 		//Standard-Berechtigung verwenden
-		return $this->getDefaultAccess();
-	}
-
+		return $this->getDefaultAccess();*/
+	}
+function getAccessList2()
+	{
+		
+		$grupos=read_repository2($GLOBALS['phpgw_info']['user']['account_id']);
+	//	echo "".$GLOBALS['phpgw_info']['user']['account_id'];
+
+	if($grupos!=''){
+			$queryStr = "SELECT * FROM phpgw_mydms_acls WHERE targettype = ".T_FOLDER." AND target in ( select folder from phpgw_mydms_Documents WHERE id=" . $this->_id . ") and (userid=".$GLOBALS['phpgw_info']['user']['account_id']." or groupid in (".$grupos."))  ORDER BY targettype";
+	}else{
+					$queryStr = "SELECT * FROM phpgw_mydms_acls WHERE targettype = ".T_FOLDER." AND target in  ( select folder from phpgw_mydms_Documents WHERE id=" . $this->_id . ") and (userid=".$GLOBALS['phpgw_info']['user']['account_id']." )  ORDER BY targettype";
+		
+	}
+//echo "aqui".$queryStr ;
+			$resArr = $GLOBALS['mydms']->db->getResultArray($queryStr);
+
+
+			if (is_bool($resArr) && !$resArr)
+				return false;
+			
+			//$this->_accessList = array("groups" => array(), "users" => array());
+			foreach ($resArr as $row)
+			{
+				
+								//echo "el grupo de acceso es".$row[4]."   ".$row["groupid"]."<br>";
+				return $row["mode"];
+				/*if ($row["userid"] != -1)
+					array_push($this->_accessList["users"], new UserAccess($row["userid"], $row["mode"]));
+				else //if ($row["groupID"] != -1)
+					array_push($this->_accessList["groups"], new GroupAccess($row["groupid"], $row["mode"]));*/
+			}
+		
+
+		return $this->_accessList;
+	}
 	function getNotifyList()
 	{
@@ -683,5 +721,5 @@
 		);
 			
-		if(!$this->db->select('phpgw_mydms_DocumentContent', $cols, $where, __LINE__, __FILE__)) {
+		if(!$this->db->select('phpgw_mydms_DocumentContent', $cols, $where, __LINE__, __FILE__, false, 'ORDER BY version,id desc')) {
 			return false;
 		}
Index: /contrib/Dms/inc/inc.ClassUser.php
===================================================================
--- /contrib/Dms/inc/inc.ClassUser.php	(revision 3526)
+++ /contrib/Dms/inc/inc.ClassUser.php	(revision 4362)
@@ -49,8 +49,120 @@
 }
 
+
+
+
+		
+	function read_repository2($id)
+		{
+			
+			$login=$GLOBALS['phpgw']->accounts->id2name($id);
+				$ds = $GLOBALS['phpgw']->common->ldapConnect();
+				$user_context  = $GLOBALS['phpgw_info']['server']['ldap_context'];
+				$group_context  = $GLOBALS['phpgw_info']['server']['ldap_context'];
+				$justthese = array("gidnumber");
+				$sri = @ldap_search($ds, $group_context, ("(&(memberUid=" . $login.")(phpgwaccounttype=g))"), $justthese);
+			
+				if(!$sri)
+				return null;
+				$allValues = ldap_get_entries($ds, $sri);
+
+				
+				while (list($null,$allVals) = @each($allValues))
+				{
+					settype($allVals,'array');
+					
+					if($data!=""){
+						$data=$data.",";
+					}
+					$data=$data. $allVals['gidnumber'][0];
+				
+					
+					
+				}
+				
+				//echo "<br>".$data;
+		  		return $data;
+		}
+		
+
+function get_account_name($account_id,$valor)
+		{
+		//	$acct_type = $this->get_type($account_id);
+$acct_type ='u';
+			/* jakjr: using justthese with ldap_search */
+			//$justthese = array("cn","uid","givenname","sn","gecos");
+
+			/* search the dn for the given uid */
+$ds = $GLOBALS['phpgw']->common->ldapConnect();
+$user_context  = $GLOBALS['phpgw_info']['server']['ldap_context'];
+			
+$justthese = array("uidnumber",  "cn",  "mail","gecos","dn");
+			//	$sri = @ldap_search($this->ds, "ou=usuarios,ou=cnti,dc=gob,dc=ve", ("(&(sn=*)(mail=*@*)(structuralObjectClass=inetOrgPerson)(deliveryMode=virtual))"), $justthese);
+
+			//if(($acct_type == 'g') && $this->group_context)
+		//	{
+		//		$sri = @ldap_search($this->ds, $this->group_context, '(gidnumber=' . (int)$account_id . ')', $justthese);
+		//	}
+		//	else
+		//	{
+				$sri = @ldap_search($ds, $user_context, '(uidnumber=' . (int)$account_id . ')', $justthese);
+			//}
+
+//echo $this->ds.",". $this->user_context.",". '(uidnumber=' . (int)$account_id . ')'.",". $justthese;
+			if(!$sri)
+				return False;
+			$allValues = ldap_get_entries($ds, $sri);
+$retorna="";
+			if($acct_type =='g')
+			{
+				if($valor=='gecos') {
+					$retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['gecos'][0],'utf-8');
+				}
+				if($valor=='uidnumber') {
+					$retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['uidnumber'][0],'utf-8');
+				}
+				if($valor=='cn') {
+					$retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['cn'][0],'utf-8');
+				}
+
+				if($valor=='mail') {
+					$retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['mail'][0],'utf-8');
+				}
+				if($valor=='dn') {
+					$retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['dn'][0],'utf-8');
+				}
+				
+			}
+			else
+			{
+				if($valor=='gecos') {
+					$retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['gecos'][0],'utf-8');
+				}
+				if($valor=='uidnumber') {
+					$retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['uidnumber'][0],'utf-8');
+				}
+				if($valor=='cn') {
+					$retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['cn'][0],'utf-8');
+				}
+
+				if($valor=='mail') {
+					$retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['mail'][0],'utf-8');
+				}
+				if($valor=='dn') {
+					$retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['dn'][0],'utf-8');
+				}
+				
+
+
+
+			}
+			return $retorna;
+		}
+
 function getUser($id)
 {
+//echo "llego";
 	$resArr["id"] = $id;
-	$resArr["login"] = phpgw_id2name($id);
+	$resArr["login"] =  phpgw_id2name($id);//get_account_name($id,'dn');
 	$resArr["fullName"] = phpgw_get_accname($id);
 	$resArr["email"] = phpgw_get_accemail($id);
@@ -59,4 +171,5 @@
 	$resArr["pwd"] = '';
 	$resArr["comment"] = '';
+//	echo "hhh".$resArr["login"]."  ".$resArr["fullName"]."  ".$resArr["isAdmin"];
 	return new User($resArr["id"], $resArr["login"], $resArr["pwd"], $resArr["fullName"], $resArr["email"], $resArr["comment"], $resArr["isAdmin"]);
 }
@@ -137,4 +250,71 @@
 		$this->_isAdmin = $isAdmin;
 	}
+	
+	
+	function add($id,$login,$fullName,$email,$isAdmin,$pwd,$comment)
+    {
+        $this->User = new User($id, $login, $pwd, $fullName, $email, $comment, $isAdmin);
+    }
+	
+	 function sortDataSet($s)
+    {
+        //Sort by the given parameter
+        switch($s)
+        {
+            case "fullName":
+                //Note use of array to reference member method of this object in callback
+                uasort($this->User,array($this,"cmpName"));
+                break;
+           
+            case "login":
+                uasort($this->User,array($this,"cmpX"));
+                break;
+               
+            case "id":
+                uasort($this->User,array($this,"cmpY"));
+                break;               
+           
+            case "added":
+            default:
+                //Re-sort array by original keys
+                ksort($this->User);       
+        }
+    }
+
+    //Callback function for sorting by name
+    //$a and $b are dataItem objects
+    function cmpName($a,$b)
+    {
+        //Use sort() for simple alphabetical comparison
+        //Convert to lowercase to ensure consistent behaviour
+        $sortable = array(strtolower($a->_fullName),strtolower($b->_fullName));
+        $sorted = $sortable;
+        sort($sorted);   
+       
+        //If the names have switched position, return -1. Otherwise, return 1.
+        return ($sorted[0] == $sortable[0]) ? -1 : 1;
+    }
+   
+    //Callback function for sorting by x
+    //$a and $b are dataItem objects
+    function cmpX($a,$b)
+    {
+        //Use sort() for simple alphabetical comparison
+        //Convert to lowercase to ensure consistent behaviour
+        $sortable = array(strtolower($a->x),strtolower($b->x));
+        $sorted = $sortable;
+        sort($sorted);   
+       
+        //If the names have switched position, return -1. Otherwise, return 1.
+        return ($sorted[0] == $sortable[0]) ? -1 : 1;
+    }
+   
+    //Callback function for sorting by y
+    //$a and $b are dataItem objects
+    function cmpY($a,$b)
+    {       
+        //If $a's y attribute >= $b's y attribute, return 1. Otherwise, return -1.
+        return ($a->y >= $b->y) ? 1 : -1;
+    }   
 
 	function getID() { return $this->_id; }
@@ -339,4 +519,5 @@
 	function isMemberOfGroup($group)
 	{
+		//echo "es miembro de".$this."<br>";
 		return $group->isMember($this);
 	}
Index: /contrib/Resources/index22.php
===================================================================
--- /contrib/Resources/index22.php	(revision 4362)
+++ /contrib/Resources/index22.php	(revision 4362)
@@ -0,0 +1,425 @@
+<?php
+/**
+ * TimeSheet - index
+ *
+ * @link http://www.egroupware.org
+ * @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
+ * @package timesheet
+ * @copyright (c) 2005 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
+ * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
+ * @version $Id: index.php 22356 2006-08-26 16:32:29Z ralfbecker $ 
+ */
+
+
+
+
+	$phpgw_flags = Array(
+		'currentapp'	=>	'resources',
+		'noheader'	=>	True,
+		'nonavbar'	=>	True,
+		'noappheader'	=>	True,
+		'noappfooter'	=>	True,
+		'nofooter'	=>	True
+	);
+
+	$GLOBALS['phpgw_info']['flags'] = $phpgw_flags;
+	include('../header.inc.php');
+	
+
+
+
+	//ExecMethod('resources.uiresources.index',$parms);
+	
+	
+
+////echo "tamannn".count($search)."  ".$search[0];
+
+
+$diaa=86400;
+$semana=604800;
+$mesdia=2419200;//(24*3600*7*4)
+$mesfecha=2592000;//(24*3600*7
+$anual=31536000;
+$from ="";
+if (isset($idd)){
+
+			$from = ' and t1.location=\''.$idd.'\' ';
+			}
+
+if (isset($starttime)){
+if (isset($starttime2)){
+
+			$from =$from .' and (t2.recur_enddate<\''.$starttime2.'\' or t2.recur_enddate=0) ';
+}
+			}
+
+//$sql2=" delete from phpgw_cal_id_repeat2  where login_id='".$this->bo->owner."'";	
+//$GLOBALS['phpgw']->db->query($sql2,__LINE__,__FILE__);
+
+			
+			
+			
+			
+		
+			$org_start = $this->maketime($event['start']);
+			$org_end   = $this->maketime($event['end']);
+			$start = mktime($event['start']['hour'],$event['start']['min'],0,substr($date,4,2),substr($date,6,2),substr($date,0,4));
+			$end   = $org_end + $start - $org_start;
+			$event['start'] = $this->time2array($start);
+			$event['end']   = $this->time2array($end);
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+
+
+$sql = ' select t1.cal_id, t2.recur_type, t2.recur_use_end, t2.recur_enddate, t2.recur_interval, t2.recur_data,t2.recur_exception ,case when t1.datetime is null then 0 else t1.datetime end, case when  t1.edatetime is null then 0 else t1.edatetime end, t1.title from phpgw_cal t1 left outer join phpgw_cal_repeats t2 on (t1.cal_id=t2.cal_id ) and t1.cal_id not in (select t1.reference from phpgw_cal t1  left outer join phpgw_cal_repeats t2 on (t1.cal_id=t2.cal_id )) order by t1.mdatetime desc';
+
+
+
+echo $sql."<br>";
+
+$sqla="";
+
+$GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__);
+while( $GLOBALS['phpgw']->db->next_record() )
+{
+$vuelta=0;	
+$fechaini=$GLOBALS['phpgw']->db->f('datetime');
+$fechafin=$GLOBALS['phpgw']->db->f('edatetime');
+$datetimeini = $GLOBALS['phpgw']->datetime->localdates($fechaini);
+$datetimefin = $GLOBALS['phpgw']->datetime->localdates($fechafin);
+$titulo=$GLOBALS['phpgw']->db->f('title');
+$typo=$GLOBALS['phpgw']->db->f('recur_type');
+
+$reference=$GLOBALS['phpgw']->db->f('reference');
+
+if($reference>0){
+
+}
+if($typo==''){
+$typo=0;
+}
+$interval=$GLOBALS['phpgw']->db->f('recur_interval');
+$id=$GLOBALS['phpgw']->db->f('cal_id');
+
+
+
+//echo $id."cal_id<br>";
+//echo $typo."tupo<br>";
+
+$dueno=1120;
+
+if($typo==0){
+
+
+
+
+$sqla=$sqla." insert into phpgw_cal_id_repeat2 values($id,$dueno,$fechaini,$fechafin);";
+
+}
+$vuelta=0;
+
+
+
+if($typo==1){
+while (($fechaini)<=$starttime2||$vuelta<50){
+
+
+
+
+$sqla=$sqla." insert into phpgw_cal_id_repeat2 values($id,$dueno,$fechaini,$fechafin);";
+
+
+$n=1;
+if ($interval>1){
+$n=$n*$interval;
+}
+
+
+$fechaini=$fechaini+($diaa*$interval);
+$fechafin=$fechafin+($diaa*$interval);
+
+$vuelta=$vuelta+1;
+}
+}
+$vuelta=0;	
+
+
+
+
+
+
+
+
+
+
+
+if($typo==2){
+while (($fechaini)<=$starttime2||$vuelta<54){
+
+
+
+
+//echo  "2 ".$GLOBALS['phpgw']->common->show_date($fechaini)."-".$GLOBALS['phpgw']->common->show_date($fechafin)."  ".$titulo."<br>";
+$sqla=$sqla." insert into phpgw_cal_id_repeat2 values($id,$dueno,$fechaini,$fechafin);";
+
+//echo "Repetir segun dia de semana.....";
+// en base de datos se guarda  la sumatoria de los dias, segun lunes 2,martes,4 miercoles 8, jueves 16, viernes 32, sabado 64, domingo 1
+//
+
+$fechaini=$fechaini+$semana;
+$fechafin=$fechafin+$semana;
+$vuelta=$vuelta+1;
+}
+}
+
+
+$vuelta=0;	
+if($typo==4){
+$mesanterior1=$datetimeini['month'];
+$mesanterior2=$datetimefin['month'];
+while (($fechaini)<=$starttime2||$vuelta<15){
+
+//echo  "3 ".$GLOBALS['phpgw']->common->show_date($fechaini)."-".$GLOBALS['phpgw']->common->show_date($fechafin)."  ".$titulo."<br>";
+
+
+$sqla=$sqla." insert into phpgw_cal_id_repeat2 values($id,$dueno,$fechaini,$fechafin);";
+
+
+$n=1;
+if ($interval>1){
+$n=$n*$interval;
+}
+
+
+//echo "mes1  ".$mes1."anterior  ".$mesanterior1."<br>";
+
+
+for($i=0;$i<$n;$i++){
+
+
+$fechaini=$fechaini+$mesdia;
+
+$datetime = $GLOBALS['phpgw']->datetime->localdates($fechaini);
+$mes1=$datetime['month'];
+
+
+if($mes1==$mesanterior1){
+$fechaini=$fechaini+$semana;
+$mesanterior1=$mes1;
+}else{
+$mesanterior1=$mes1;
+}
+}
+
+
+$fechafin=$fechafin+$mesdia;
+$datetime2 = $GLOBALS['phpgw']->datetime->localdates($fechafin);
+
+$mes2=$datetime2['month'];
+if($mes2==$mesanterior2){
+	$fechafin=$fechafin+$semana;
+$mesanterior2=$mes2+1;
+}else{
+$mesanterior2=$mes2;
+}
+
+$vuelta=$vuelta+1;
+}
+}
+$vuelta=0;	
+if($typo==3){
+while (($fechaini)<=$starttime2||$vuelta<10){
+
+
+
+
+
+//echo  "4 ".$GLOBALS['phpgw']->common->show_date($fechaini)."-".$GLOBALS['phpgw']->common->show_date($fechafin)."  ".$titulo."<br>";
+$sqla=$sqla." insert into phpgw_cal_id_repeat2 values($id,$dueno,$fechaini,$fechafin);";
+//$fechaini=$fechaini+$mesfecha;
+$datetime = $GLOBALS['phpgw']->datetime->localdates($fechaini);
+//echo "<br>".$datetime['year']." ".$datetime['month']."  ".$datetime['day']."  ".$datetime['hour']." ".$datetime['minute']."<BR>";
+$n=1;
+if ($interval>1){
+$n=$n*$interval;
+}
+$mes1=$datetime['month']+$n;
+if($datetime['day']>28 && $mes1==2 ){
+$mes1=$datetime['month']+$n+1;
+}
+if($datetime['day']>30 && ($mes1==2||$mes1==4||$mes1==6||$mes1==9||$mes1==11)){
+$mes1=$datetime['month']+$n+1;
+}
+$dia1=$datetime['day'];
+
+//validar lo de dia de semana ?
+//activar acorde al dia
+if($datetime['dow']!=0){
+//echo "jjjjj";
+}
+
+
+
+$fechaini = mktime($datetime['hour'],$datetime['minute'],0,$mes1,$dia1,$datetime['year']) - $tz_offset;
+
+//$fechafin=$fechafin+$mesfecha;
+$datetime = $GLOBALS['phpgw']->datetime->localdates($fechafin);
+$mes2=$datetime['month']+$n;
+if($datetime['day']>28 && $mes2==2 ){
+$mes2=$datetime['month']+$n+1;
+}
+if($datetime['day']>30 && ($mes2==2||$mes2==4||$mes2==6||$mes2==9||$mes2==11)){
+$mes2=$datetime['month']+$n+1;
+}
+$dia2=$datetime['day'];
+
+//echo "<br>".$datetime['year']." ".$datetime['month']."  ".$datetime['day']."  ".$datetime['hour']." ".$datetime['minute']."<BR>";
+
+//echo "<br>".$fechaini."<br>";
+
+$fechafin = mktime($datetime['hour'],$datetime['minute'],0,$mes2,$dia2,$datetime['year']) - $tz_offset;
+
+
+
+$vuelta=$vuelta+1;
+}
+}
+
+$vuelta=0;	
+if($typo==5){
+while (($fechaini)<=$starttime2||$vuelta<5){
+
+//echo  "5 ".$GLOBALS['phpgw']->common->show_date($fechaini)."-".$GLOBALS['phpgw']->common->show_date($fechafin)."  ".$titulo." ".$id." "."<br>";
+$sqla=$sqla." insert into phpgw_cal_id_repeat2 values($id,$dueno,$fechaini,$fechafin);";
+//$fechaini=$fechaini+$anual;
+//$fechafin=$fechafin+$anual;
+
+$datetime = $GLOBALS['phpgw']->datetime->localdates($fechaini);
+//echo "<br>".$datetime['year']." ".$datetime['month']."  ".$datetime['day']."  ".$datetime['hour']." ".$datetime['minute']."<BR>";
+
+//echo "<br>".$fechaini;
+$n=1;
+
+if ($interval>1){
+$n=$n*$interval;
+}
+
+$an1=$datetime['year']+$n;
+$fechaini = mktime($datetime['hour'],$datetime['minute'],0,$datetime['month'],$datetime['day'],$an1) - $tz_offset;
+
+//$fechafin=$fechafin+$mesfecha;
+$datetime = $GLOBALS['phpgw']->datetime->localdates($fechafin);
+$an2=$datetime['year']+$n;
+
+
+
+
+
+$fechafin = mktime($datetime['hour'],$datetime['minute'],0,$datetime['month'],$datetime['day'],$an2) - $tz_offset;
+
+
+
+
+
+$vuelta=$vuelta+1;
+}
+}
+
+
+}
+
+$GLOBALS['phpgw']->db->query($sqla,__LINE__,__FILE__);
+
+
+
+$from ="";
+/*if (isset($idd)){
+
+			$from = ' and t1.location=\''.$idd.'\' ';
+			}
+
+if (isset($starttime)){
+if (isset($starttime2)){
+
+			$from =$from .' and ((t5.datetime>\''.$starttime.'\' and t5.datetime<\''.$starttime2.'\' )';
+$from =$from .' or( t5.edatetime>\''.$starttime.'\' and t5.edatetime<\''.$starttime2.'\' ) or (t5.datetime <\''.$starttime.'\' and t5.edatetime>\''.$starttime.'\'))';
+}*/
+		//	}
+
+			$sql = ' select t1.cal_id ,t1.owner,t1.groups,t5.datetime,t5.edatetime,
+t1.priority ,t1.cal_type, t1.is_public ,
+t1.title,t1.description,t1.location ,
+t2.list_descripcion as publico,t3.list_descripcion as priority ,t4.name as namelocation,t1.reference from   phpgw_cal  t1, phpgw_listas t2, phpgw_listas t3 ,phpgw_resources t4,phpgw_cal_id_repeat2 t5
+where t1.is_public =t2.list_id and t1.cal_id=t5.cal_id and t2.list_name=\'visibility\' 
+and t1.priority=t3.list_id and t3.list_name=\'priority\' 
+and t1.location=t4.name '
+					. $from. " order by 4 desc ";
+					//.$search;
+					//. 'WHERE (phpgw_cal_user.res_id = phpgw_cal.res_id) '
+					//. $where . $extra;
+
+
+//echo $sql;
+
+
+
+			//if($this->debug)
+			////{
+				echo "FULL SQL : ".$sql."<br>\n";
+			//}
+
+ //$resultado=pg_query($this->bo->connect(),$sql) or die("Error al mostrar");
+
+
+$GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__);
+while( $GLOBALS['phpgw']->db->next_record() )
+			{
+			//	
+
+//$valorfechaini=$this->bo->time2array($GLOBALS['phpgw']->db->f('datetime'),$alarm = 0);
+//$ini=$valorfechaini['mday']."/".$valorfechaini['month']."/".$valorfechaini['year'];
+$ini=$GLOBALS['phpgw']->common->show_date($GLOBALS['phpgw']->db->f('datetime'))."-".$GLOBALS['phpgw']->common->show_date($GLOBALS['phpgw']->db->f('edatetime'));
+
+
+
+
+
+			}
+		
+function time2array($time,$alarm = 0)
+		{
+			return array(
+				'year'  => (int)(date('Y',$time)),
+				'month' => (int)(date('m',$time)),
+				'mday'  => (int)(date('d',$time)),
+				'hour'  => (int)(date('H',$time)),
+				'min'   => (int)(date('i',$time)),
+				'sec'   => (int)(date('s',$time)),
+				'alarm' => (int)($alarm)
+			);
+		}
+			
+		
+			
+			function maketime($time)
+		{
+			return mktime(intval($time['hour']),intval($time['min']),intval($time['sec']),intval($time['month']),intval($time['mday']),intval($time['year']));
+		}
+			
+
+			
+		//	return $retval;
+	
+	
+	$GLOBALS['phpgw']->common->phpgw_exit();
+
+?>
+
Index: /contrib/Resources/index23.php
===================================================================
--- /contrib/Resources/index23.php	(revision 4362)
+++ /contrib/Resources/index23.php	(revision 4362)
@@ -0,0 +1,363 @@
+<?php
+/**
+ * TimeSheet - index
+ *
+ * @link http://www.egroupware.org
+ * @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
+ * @package timesheet
+ * @copyright (c) 2005 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
+ * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
+ * @version $Id: index.php 22356 2006-08-26 16:32:29Z ralfbecker $ 
+ */
+
+
+
+
+	$phpgw_flags = Array(
+		'currentapp'	=>	'resources',
+		'noheader'	=>	True,
+		'nonavbar'	=>	True,
+		'noappheader'	=>	True,
+		'noappfooter'	=>	True,
+		'nofooter'	=>	True
+	);
+
+	$GLOBALS['phpgw_info']['flags'] = $phpgw_flags;
+	include('../header.inc.php');
+	
+
+
+
+	//ExecMethod('resources.uiresources.index',$parms);
+	
+	
+
+////echo "tamannn".count($search)."  ".$search[0];
+
+
+$diaa=86400;
+$semana=604800;
+$mesdia=2419200;//(24*3600*7*4)
+$mesfecha=2592000;//(24*3600*7
+$anual=31536000;
+$from ="";
+if (isset($idd)){
+
+			$from = ' and t1.location=\''.$idd.'\' ';
+			}
+
+if (isset($starttime)){
+if (isset($starttime2)){
+
+			$from =$from .' and (t2.recur_enddate<\''.$starttime2.'\' or t2.recur_enddate=0) ';
+}
+			}
+
+//$sql2=" delete from phpgw_cal_id_repeat2  where login_id='".$this->bo->owner."'";	
+//$GLOBALS['phpgw']->db->query($sql2,__LINE__,__FILE__);
+
+			
+			//			$this->bo = CreateObject('calendar.bocalendar',1);
+			echo "ggg".check_repeating_events(1246905507);
+			//$event['start']=1246905507;
+			//$event['end']=1247160600;
+		
+			//$org_start = maketime($event['start']);
+			//$org_end   = maketime($event['end']);
+		//	$start = mktime($event['start']['hour'],$event['start']['min'],0,substr($date,4,2),substr($date,6,2),substr($date,0,4));
+			//$end   = $org_end + $start - $org_start;
+			//$event['start'] = time2array($start);
+			//$event['end']   = time2array($end);
+			
+			
+			echo "<br>1246905507";		
+			echo "<br>1247160600";		
+	echo "<br>".$event['start']['year']." ".$event['start']['month']." ".$event['start']['day'].$event['start']['hour']."  ".$event['start']['min'];		
+	echo "<br>".$event['end'];		
+		echo "<br>.";		
+		echo "<br>";		
+			
+			
+			
+			
+			
+			
+			
+
+
+$sql = ' select t1.cal_id, t2.recur_type, t2.recur_use_end, t2.recur_enddate, t2.recur_interval, t2.recur_data,t2.recur_exception ,case when t1.datetime is null then 0 else t1.datetime end, case when  t1.edatetime is null then 0 else t1.edatetime end, t1.title from phpgw_cal t1 left outer join phpgw_cal_repeats t2 on (t1.cal_id=t2.cal_id ) and t1.cal_id not in (select t1.reference from phpgw_cal t1  left outer join phpgw_cal_repeats t2 on (t1.cal_id=t2.cal_id )) order by t1.mdatetime desc';
+
+
+
+echo $sql."<br>";
+
+$sqla="";
+
+$GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__);
+while( $GLOBALS['phpgw']->db->next_record() )
+{
+$vuelta=0;	
+$fechaini=$GLOBALS['phpgw']->db->f('datetime');
+$fechafin=$GLOBALS['phpgw']->db->f('edatetime');
+$datetimeini = $GLOBALS['phpgw']->datetime->localdates($fechaini);
+$datetimefin = $GLOBALS['phpgw']->datetime->localdates($fechafin);
+$titulo=$GLOBALS['phpgw']->db->f('title');
+$typo=$GLOBALS['phpgw']->db->f('recur_type');
+
+$reference=$GLOBALS['phpgw']->db->f('reference');
+
+if($reference>0){
+
+}
+if($typo==''){
+$typo=0;
+}
+$interval=$GLOBALS['phpgw']->db->f('recur_interval');
+$id=$GLOBALS['phpgw']->db->f('cal_id');
+
+
+
+//echo $id."cal_id<br>";
+//echo $typo."tupo<br>";
+
+$dueno=1120;
+
+
+}
+
+$GLOBALS['phpgw']->db->query($sqla,__LINE__,__FILE__);
+
+
+
+$from ="";
+/*if (isset($idd)){
+
+			$from = ' and t1.location=\''.$idd.'\' ';
+			}
+
+if (isset($starttime)){
+if (isset($starttime2)){
+
+			$from =$from .' and ((t5.datetime>\''.$starttime.'\' and t5.datetime<\''.$starttime2.'\' )';
+$from =$from .' or( t5.edatetime>\''.$starttime.'\' and t5.edatetime<\''.$starttime2.'\' ) or (t5.datetime <\''.$starttime.'\' and t5.edatetime>\''.$starttime.'\'))';
+}*/
+		//	}
+
+			$sql = ' select t1.cal_id ,t1.owner,t1.groups,t5.datetime,t5.edatetime,
+t1.priority ,t1.cal_type, t1.is_public ,
+t1.title,t1.description,t1.location ,
+t2.list_descripcion as publico,t3.list_descripcion as priority ,t4.name as namelocation,t1.reference from   phpgw_cal  t1, phpgw_listas t2, phpgw_listas t3 ,phpgw_resources t4,phpgw_cal_id_repeat2 t5
+where t1.is_public =t2.list_id and t1.cal_id=t5.cal_id and t2.list_name=\'visibility\' 
+and t1.priority=t3.list_id and t3.list_name=\'priority\' 
+and t1.location=t4.name '
+					. $from. " order by 4 desc ";
+					//.$search;
+					//. 'WHERE (phpgw_cal_user.res_id = phpgw_cal.res_id) '
+					//. $where . $extra;
+
+
+//echo $sql;
+
+
+
+			//if($this->debug)
+			////{
+				echo "FULL SQL : ".$sql."<br>\n";
+			//}
+
+ //$resultado=pg_query($this->bo->connect(),$sql) or die("Error al mostrar");
+
+
+$GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__);
+while( $GLOBALS['phpgw']->db->next_record() )
+			{
+			//	
+
+//$valorfechaini=$this->bo->time2array($GLOBALS['phpgw']->db->f('datetime'),$alarm = 0);
+//$ini=$valorfechaini['mday']."/".$valorfechaini['month']."/".$valorfechaini['year'];
+$ini=$GLOBALS['phpgw']->common->show_date($GLOBALS['phpgw']->db->f('datetime'))."-".$GLOBALS['phpgw']->common->show_date($GLOBALS['phpgw']->db->f('edatetime'));
+
+
+
+
+
+			}
+		
+function time2array($time,$alarm = 0)
+		{
+			return array(
+				'year'  => (int)(date('Y',$time)),
+				'month' => (int)(date('m',$time)),
+				'mday'  => (int)(date('d',$time)),
+				'hour'  => (int)(date('H',$time)),
+				'min'   => (int)(date('i',$time)),
+				'sec'   => (int)(date('s',$time)),
+				'alarm' => (int)($alarm)
+			);
+		}
+			
+		
+			
+			function maketime($time)
+		{
+			return mktime(intval($time['hour']),intval($time['min']),intval($time['sec']),intval($time['month']),intval($time['mday']),intval($time['year']));
+		}
+			
+function check_repeating_events($datetime)
+		{
+			echo "aaaa<br>";
+			$repeating_events = Array();
+			$cached_events = Array();
+			//$event = read_entry($cal_id);
+			//$repeating_events[0] = $event;
+			@reset($repeating_events);
+						echo "aaaa<br>";
+			
+			$search_date_full = date('Ymd',$datetime);
+			$search_date_year = date('Y',$datetime);
+			$search_date_month = date('m',$datetime);
+			$search_date_day = date('d',$datetime);
+			$search_date_dow = date('w',$datetime);
+			$search_beg_day = mktime(0,0,0,$search_date_month,$search_date_day,$search_date_year);
+			//$rpt_wdays
+			$repeated = $repeating_events;
+			$r_events = count($repeated);
+			for ($i=0;$i<$r_events;$i++)
+			{
+				echo "aaaa<br>";
+				$rep_events = $this->repeating_events[$i];
+				$id = $rep_events['id'];
+				$event_beg_day = mktime(0,0,0,$rep_events['start']['month'],$rep_events['start']['mday'],$rep_events['start']['year']);
+				if($rep_events['recur_enddate']['month'] != 0 && $rep_events['recur_enddate']['mday'] != 0 && $rep_events['recur_enddate']['year'] != 0)
+				{
+					$event_recur_time = $this->maketime($rep_events['recur_enddate']);
+				}
+				else
+				{
+					$event_recur_time = mktime(0,0,0,1,1,2030);
+				}
+				$end_recur_date = date('Ymd',$event_recur_time);
+				$full_event_date = date('Ymd',$event_beg_day);
+
+				if($this->debug)
+				{
+					echo '<!-- check_repeating_events - Processing ID - '.$id.' -->'."\n";
+					echo '<!-- check_repeating_events - Recurring End Date - '.$end_recur_date.' -->'."\n";
+				}
+
+				// only repeat after the beginning, and if there is an rpt_end before the end date
+				if (($search_date_full > $end_recur_date) || ($search_date_full < $full_event_date))
+				{
+					continue;
+				}
+
+				if ($search_date_full == $full_event_date)
+				{
+					$this->sort_event($rep_events,$search_date_full);
+					continue;
+				}
+				else
+				{
+					$freq = $rep_events['recur_interval'];
+					$freq = $freq ? $freq : 1;
+					$type = $rep_events['recur_type'];
+					switch($type)
+					{
+						case MCAL_RECUR_DAILY:
+							if($this->debug)
+							{
+								echo '<!-- check_repeating_events - MCAL_RECUR_DAILY - '.$id.' -->'."\n";
+							}
+							
+							if ($freq == 1 && $rep_events['recur_enddate']['month'] != 0 && $rep_events['recur_enddate']['mday'] != 0 && $rep_events['recur_enddate']['year'] != 0 && $search_date_full <= $end_recur_date)
+							{
+								$this->sort_event($rep_events,$search_date_full);
+							}
+							elseif (floor(($search_beg_day - $event_beg_day)/86400) % ($freq ? $freq : 1))
+							{
+								continue;
+							}
+							else
+							{
+								$this->sort_event($rep_events,$search_date_full);
+							}
+							break;
+						case MCAL_RECUR_WEEKLY:
+							if (floor(($search_beg_day - $event_beg_day)/604800)  % ($freq ? $freq : 1))
+							{
+								continue;
+							}
+							$check = 0;
+							switch($search_date_dow)
+							{
+								case 0:
+									$check = MCAL_M_SUNDAY;
+									break;
+								case 1:
+									$check = MCAL_M_MONDAY;
+									break;
+								case 2:
+									$check = MCAL_M_TUESDAY;
+									break;
+								case 3:
+									$check = MCAL_M_WEDNESDAY;
+									break;
+								case 4:
+									$check = MCAL_M_THURSDAY;
+									break;
+								case 5:
+									$check = MCAL_M_FRIDAY;
+									break;
+								case 6:
+									$check = MCAL_M_SATURDAY;
+									break;
+							}
+							if ($rep_events['recur_data'] & $check)
+							{
+								$this->sort_event($rep_events,$search_date_full);
+							}
+							break;
+						case MCAL_RECUR_MONTHLY_WDAY:
+							if ((($search_date_year - $rep_events['start']['year']) * 12 + $search_date_month - $rep_events['start']['month']) % $freq)
+							{
+								continue;
+							}
+
+							if (($GLOBALS['phpgw']->datetime->day_of_week($rep_events['start']['year'],$rep_events['start']['month'],$rep_events['start']['mday']) == $GLOBALS['phpgw']->datetime->day_of_week($search_date_year,$search_date_month,$search_date_day)) &&
+								(ceil($rep_events['start']['mday']/7) == ceil($search_date_day/7)))
+							{
+								$this->sort_event($rep_events,$search_date_full);
+							}
+							break;
+						case MCAL_RECUR_MONTHLY_MDAY:
+							if ((($search_date_year - $rep_events['start']['year']) * 12 + $search_date_month - $rep_events['start']['month'])  % ($freq ? $freq : 1))
+							{
+								continue;
+							}
+							if ($search_date_day == $rep_events['start']['mday'])
+							{
+								$this->sort_event($rep_events,$search_date_full);
+							}
+							break;
+						case MCAL_RECUR_YEARLY:
+							if (($search_date_year - $rep_events['start']['year']) % ($freq ? $freq : 1))
+							{
+								continue;
+							}
+							if (date('dm',$datetime) == date('dm',$event_beg_day))
+							{
+								$this->sort_event($rep_events,$search_date_full);
+							}
+							break;
+					}
+				}
+			}	// end for loop
+		}	
+			
+		//	return $retval;
+	
+	
+	$GLOBALS['phpgw']->common->phpgw_exit();
+
+?>
+
Index: /contrib/Resources/todo
===================================================================
--- /contrib/Resources/todo	(revision 3526)
+++ /contrib/Resources/todo	(revision 4362)
@@ -11,26 +11,2 @@
 add buy and prize functionality
 add location functionality
-
-
-CREATE TABLE phpgw_resources
-(
-  res_id integer NOT NULL DEFAULT nextval('seq_phpgw_resources'::regclass),
-  "name" character varying(100),
-  short_description character varying(100),
-  cat_id integer NOT NULL,
-  quantity integer,
-  useable integer,
-  "location" character varying(100),
-  bookable character(1),
-  prize character varying(200),
-  picture_src character varying(20),
-  accessory_of integer,
-  storage_info character varying(200),
-  inventory_number character varying(20),
-  administrador character varying(255),
-  email character varying(255),
-  "owner" character varying(255),
-  CONSTRAINT phpgw_resources_pkey PRIMARY KEY (res_id)
-)
-WITH (OIDS=TRUE);
-ALTER TABLE phpgw_resources OWNER TO postgres;
Index: /contrib/Resources/inc/class.uiresourcescal.inc.php
===================================================================
--- /contrib/Resources/inc/class.uiresourcescal.inc.php	(revision 4362)
+++ /contrib/Resources/inc/class.uiresourcescal.inc.php	(revision 4362)
@@ -0,0 +1,682 @@
+<?php
+  /**************************************************************************\
+  * eGroupWare - resources                                                    *
+  * http://www.eGroupWare.org                                                *
+  * Maintained and further developed by RalfBecker@outdoor-training.de       *
+  * Based on Webresources by Craig Knudsen <cknudsen@radix.net>               *
+  *          http://www.radix.net/~cknudsen                                  *
+  * Originaly modified by Mark Peters <skeeter@phpgroupware.org>             *
+  * --------------------------------------------                             *
+  *  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.                                              *
+  \**************************************************************************/
+
+
+	class uiresourcescal
+	{
+		var $dbb;
+		var $template;
+		var $cat;
+		var $debug = False;
+		var $cat_id;
+		var $theme;
+		var $link_tpl;
+		var $public_functions = array(
+		
+		'search4' => True,'search5' => True		
+		);
+
+
+
+
+	var $prefs;
+	
+	var $bo;
+
+	var $link;
+	
+	var $tmpl;
+
+	var $html;
+
+	var $duration_format = ',';	// comma is necessary!
+	
+	
+
+
+var $optionldap;
+
+
+		
+
+
+	function search4()
+		{
+			$this->bo = CreateObject('resources.boresources',1);
+			
+$this->today = date('Ymd',$GLOBALS['phpgw']->datetime->users_localtime);
+
+
+
+		
+			$error = '';
+
+
+
+			$matches = 0;
+
+
+if (isset($_REQUEST['fecha'])){
+list($dia,$mes,$ano)=split("/",$_REQUEST['fecha']);
+if (isset($_REQUEST['fecha2'])){
+list($dia2,$mes2,$ano2)=split("/",$_REQUEST['fecha2']);
+}else{
+	list($dia2,$mes2,$ano2)=split("/",$_REQUEST['fecha']);
+	
+}
+if(isset($_REQUEST['hora'])){
+list($horai,$minutoi,$horaf,$minutof)=split(":",$_REQUEST['hora']);
+}else{
+	$horai=0;
+	$minutoi=0;
+	$horaf=23;
+	$minutof=59;
+}
+	$starttimea = $this->bo->maketime2(0,0,0,$dia,$mes,$ano,'am') - $GLOBALS['phpgw']->datetime->tz_offset;
+
+
+}else{
+	$localtime = $GLOBALS['phpgw']->datetime->users_localtime;
+	$ano = date('Y',$localtime);
+	$mes = date('m',$localtime);
+	$dia = date('d',$localtime);					
+	$ano2 = date('Y',$localtime);
+	$mes2 = date('m',$localtime);
+	$dia2 = date('d',$localtime);
+	$horai=0;
+	$minutoi=0;
+	$horaf=23;
+	$minutof=59;
+
+
+
+}
+
+$pm='pm';
+if($horaf<12){
+	$pm='am';
+}else{
+	$horaf=$horaf-12;
+}
+$am='am';
+if($horai>11){
+	$am='pm';
+	$horai=$horai-12;
+	
+}
+
+
+	$starttime = $this->bo->maketime2($horai,$minutoi,0,$dia,$mes,$ano,$am) - $GLOBALS['phpgw']->datetime->tz_offset;
+$starttime2 = $this->bo->maketime2($horaf,$minutof,59,$dia2,$mes2,$ano2,$pm) - $GLOBALS['phpgw']->datetime->tz_offset;
+
+$location='';
+if($_GET['id']!=''){
+$location=$_GET['id'];}else{
+$location='n/a';}
+
+		$date_to_eval = sprintf("%04d%02d%02d",$ano,$mes,$dia);
+		
+		
+		
+if($_GET['calid']!='0'){
+$l_ids=array($_GET['calid']);
+}else{
+	$l_ids=0;
+}
+$events=$this->bo->overlap($starttime,$starttime2,Array(),0,$l_ids,'False',$location);
+
+				print_debug('Date',$date_to_eval);
+				print_debug('Count',count($events));
+
+if(count($events)>0){
+				foreach($events as $event)
+				{
+					if ($this->bo->rejected_no_show($event))
+					{
+						continue;	// user does not want to see rejected events
+					}
+					if ($event['recur_type'])	// calculate start- + end-datetime for recuring events
+					{
+						$this->bo->set_recur_date($event,$date_to_eval);
+					}
+				
+
+				}
+}
+			$date_to_eval = sprintf("%04d%02d%02d",$ano,$mes,$dia);
+
+			$matches = count($event);
+
+$hay="Para el ".$dia."/".$mes."/".$ano."  en la sala: ".$location ." y a la hora indicada esta ocupada por:";
+				
+			if ($matches == 1)
+			{
+				$quantity = lang('1 match found').'.';
+			}
+			elseif ($matches > 0)
+			{
+				$quantity = lang('%1 matches found',$matches).'.';
+			}
+			else
+			{
+				$nohay="Para el ".$dia."/".$mes."/".$ano."  en la sala: ".$location ." y a la hora indicada por ud esta disponible.";
+				
+			}
+
+	
+
+$script='';
+
+		
+
+	
+
+	?>
+	<html>
+	<head>
+	<title>Expresso CNTI [Recursos]</title>
+		<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+		<meta name="language" content="es-es" />
+		<link rel="icon" href="calendar/templates/default/images/navbar.png" type="image/x-ico" />
+		<link rel="shortcut icon" href="calendar/templates/default/images/navbar.png" />
+		<META http-equiv="Default-Style" content="eGroupWareStyle">
+		
+		<script src="phpgwapi/templates/default/js/simple_show_hide.js" type="text/javascript">
+		</script>
+		<!-- This solves the Internet Explorer PNG-transparency bug, but only for IE 5.5 and higher --> 
+		<!--[if lt IE 7]>
+		<script src="/expresso/phpgwapi/templates/default/js/pngfix.js" type="text/javascript">
+		</script>
+		<![endif]-->
+
+		<style type="text/css">
+<!--
+	.row_on { color: #000000; background-color: #f4f8fb; }
+	.row_off { color: #000000; background-color: #ffffff; }
+	.th { color: #000000; background-color: #D3DCE3; }
+	
+-->
+</style>
+<LINK href="phpgwapi/templates/default/css/base.css" type="text/css" rel="StyleSheet"><LINK href="phpgwapi/templates/default/css/azul.css" type="text/css" rel="StyleSheet"><LINK href="/expresso/calendar/templates/default/app.css" type="text/css" rel="StyleSheet">
+
+		<link rel="stylesheet" type="text/css" media="all" href="phpgwapi/js/jscalendar/calendar-win2k-cold-1.css" title="" />
+<script type="text/javascript" src="phpgwapi/js/jscalendar/calendar.js"></script>
+<script type="text/javascript" src="phpgwapi/inc/jscalendar-setup.php"></script>
+
+
+		<script src="phpgwapi/templates/default/js/cookieManager.js" type="text/javascript"></script>
+	</head>
+
+	<!-- we don't need body tags anymore, do we?) we do!!! onload!! LK -->
+	<body  bgcolor="#FFFFFF" alink="red" link="blue" vlink="blue" >
+
+	<?php
+
+	if(count($events)>0){
+		
+		
+	echo $hay;?><br><br>
+		<table><tr class="th">
+	
+<td width="150">Nombre</td>
+		
+<td width="300">Descripci&oacute;n</td>
+			
+	
+<td width="100">Responsable</td>
+
+<td width="100">Hora</td>
+
+			
+			</tr>
+	
+	<?php 
+	
+	
+			foreach($events  as $id => $data)
+			{
+
+				$datetime = $this->bo->maketime($event['start']) - $GLOBALS['phpgw']->datetime->tz_offset;
+
+
+if($data['public']==1){
+	$descripcion=$data['description'];
+	$name=$data['title'];
+}else{
+	$descripcion='-';
+	$name='Privado';
+}
+
+$dueno=$this->get_account_name($data['owner'],'gecos');
+echo "<tr><td>".$name."</td><td>".$descripcion."</td><td>".$dueno."</td><td> ".$GLOBALS['phpgw']->common->show_hour($this->bo->maketime($data['start']))."-".$GLOBALS['phpgw']->common->show_hour($this->bo->maketime($data['end']))."</td></tr>";
+
+
+
+
+			}
+			}else{		
+				echo $nohay;
+			}
+			?>
+
+		
+		</table>
+	</td>
+	</tr>
+	</table>
+	</body>
+	</html>
+
+	<?php 
+	
+
+		/*	if($matches > 0)
+			{
+		//		$p->parse('rows','search_list_footer',True);
+			}*/
+
+		//	$p->pparse('out','search');
+		}
+		
+
+
+
+
+	function search5()
+		{
+			$this->bo = CreateObject('resources.boresources',1);
+			
+$this->today = date('Ymd',$GLOBALS['phpgw']->datetime->users_localtime);
+
+
+
+		
+			$error = '';
+
+
+
+			$matches = 0;
+
+
+if (isset($_REQUEST['fecha'])){
+list($dia,$mes,$ano)=split("/",$_REQUEST['fecha']);
+if (isset($_REQUEST['fecha2'])){
+list($dia2,$mes2,$ano2)=split("/",$_REQUEST['fecha2']);
+}else{
+	list($dia2,$mes2,$ano2)=split("/",$_REQUEST['fecha']);
+	
+}
+if(isset($_REQUEST['hora'])){
+list($horai,$minutoi,$horaf,$minutof)=split(":",$_REQUEST['hora']);
+}else{
+	$horai=0;
+	$minutoi=0;
+	$horaf=23;
+	$minutof=59;
+}
+	$starttimea = $this->bo->maketime2(0,0,0,$dia,$mes,$ano,'am') - $GLOBALS['phpgw']->datetime->tz_offset;
+
+
+}else{
+	$localtime = $GLOBALS['phpgw']->datetime->users_localtime;
+	$ano = date('Y',$localtime);
+	$mes = date('m',$localtime);
+	$dia = date('d',$localtime);					
+	$ano2 = date('Y',$localtime);
+	$mes2 = date('m',$localtime);
+	$dia2 = date('d',$localtime);
+	$horai=0;
+	$minutoi=0;
+	$horaf=23;
+	$minutof=59;
+
+
+
+}
+
+$pm='pm';
+if($horaf<12){
+	$pm='am';
+}else{
+	$horaf=$horaf-12;
+}
+$am='am';
+if($horai>11){
+	$am='pm';
+	$horai=$horai-12;
+	
+}
+
+
+	$starttime = $this->bo->maketime2($horai,$minutoi,0,$dia,$mes,$ano,$am) - $GLOBALS['phpgw']->datetime->tz_offset;
+$starttime2 = $this->bo->maketime2($horaf,$minutof,59,$dia2,$mes2,$ano2,$pm) - $GLOBALS['phpgw']->datetime->tz_offset;
+
+$location='';
+if($_GET['id']!=''){
+$location=$_GET['id'];}else{
+$location='n/a';}
+
+		$date_to_eval = sprintf("%04d%02d%02d",$ano,$mes,$dia);
+		//echo $_GET['participants'].size;
+
+
+		
+		
+		  
+//$participantes=Array($_GET['participants']);
+		$partes=split(",",$_GET['participants']);
+
+					$l_participants = array();
+
+		for ($i = 0; $i < count($partes); $i++) {
+    $l_participants[$partes[$i]]='U';
+}	
+
+if($_GET['calid']!='0'){
+$l_ids=array($_GET['calid']);
+}else{
+	$l_ids=0;
+}
+
+					
+$events=$this->bo->overlap($starttime,$starttime2,$l_participants,0,$l_ids,'False');
+
+
+//$events=$this->bo->overlap($starttime,$starttime2,Array(),0,0,'False',$location);
+
+				print_debug('Date',$date_to_eval);
+				print_debug('Count',count($events));
+
+if(count($events)>0){
+				foreach($events as $event)
+				{
+					if ($this->bo->rejected_no_show($event))
+					{
+						continue;	// user does not want to see rejected events
+					}
+					if ($event['recur_type'])	// calculate start- + end-datetime for recuring events
+					{
+						$this->bo->set_recur_date($event,$date_to_eval);
+					}
+				
+
+				}
+}
+			$date_to_eval = sprintf("%04d%02d%02d",$ano,$mes,$dia);
+
+			$matches = count($event);
+
+$hay="Para el ".$dia."/".$mes."/".$ano."  y a la hora indicada por ud esta(n) ocupados los participantes:";
+				
+			if ($matches == 1)
+			{
+				$quantity = lang('1 match found').'.';
+			}
+			elseif ($matches > 0)
+			{
+				$quantity = lang('%1 matches found',$matches).'.';
+			}
+			else
+			{
+				$nohay="Para el ".$dia."/".$mes."/".$ano." y a la hora indicada por ud estan disponible los participantes.";
+				
+			}
+
+	
+
+$script='';
+
+	
+
+	?>
+	<html>
+	<head>
+	<title>Expresso CNTI [Recursos]</title>
+		<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+		<meta name="language" content="es-es" />
+		<link rel="icon" href="calendar/templates/default/images/navbar.png" type="image/x-ico" />
+		<link rel="shortcut icon" href="calendar/templates/default/images/navbar.png" />
+		<META http-equiv="Default-Style" content="eGroupWareStyle">
+		
+		<script src="phpgwapi/templates/default/js/simple_show_hide.js" type="text/javascript">
+		</script>
+		<!-- This solves the Internet Explorer PNG-transparency bug, but only for IE 5.5 and higher --> 
+		<!--[if lt IE 7]>
+		<script src="/expresso/phpgwapi/templates/default/js/pngfix.js" type="text/javascript">
+		</script>
+		<![endif]-->
+
+		<style type="text/css">
+<!--
+	.row_on { color: #000000; background-color: #f4f8fb; }
+	.row_off { color: #000000; background-color: #ffffff; }
+	.th { color: #000000; background-color: #D3DCE3; }
+	
+-->
+</style>
+<LINK href="phpgwapi/templates/default/css/base.css" type="text/css" rel="StyleSheet"><LINK href="phpgwapi/templates/default/css/azul.css" type="text/css" rel="StyleSheet"><LINK href="/expresso/calendar/templates/default/app.css" type="text/css" rel="StyleSheet">
+
+		<link rel="stylesheet" type="text/css" media="all" href="phpgwapi/js/jscalendar/calendar-win2k-cold-1.css" title="" />
+<script type="text/javascript" src="phpgwapi/js/jscalendar/calendar.js"></script>
+<script type="text/javascript" src="phpgwapi/inc/jscalendar-setup.php"></script>
+
+
+		<script src="phpgwapi/templates/default/js/cookieManager.js" type="text/javascript"></script>
+	</head>
+
+	<!-- we don't need body tags anymore, do we?) we do!!! onload!! LK -->
+	<body  bgcolor="#FFFFFF" alink="red" link="blue" vlink="blue" >
+
+	<?php  		
+if(count($events)>0){
+	
+	
+	echo $hay;?><br><br>
+		<table><tr class="th">
+	
+<td width="150">Nombre</td>
+		
+<td width="300">Descripci&oacute;n</td>
+			
+	
+<td width="100">Responsable</td>
+
+<td width="100">Participantes</td>
+
+
+<td width="100">Hora</td>
+
+			
+			</tr>
+	
+	<?php 
+	
+	
+			foreach($events  as $id => $data)
+			{
+
+				$datetime = $this->bo->maketime($event['start']) - $GLOBALS['phpgw']->datetime->tz_offset;
+
+
+if($data['public']==1){
+	$descripcion=$data['description'];
+	$name=$data['title'];
+}else{
+	$descripcion='-';
+	$name='Privado';
+}
+
+$dueno=$this->get_account_name($data['owner'],'gecos');
+
+
+$participantesreunion="";
+			$overlapped_event = $this->bo->read_entry2($data['id'],True);
+			
+		//	echo "rrrr".$overlapped_event."lllll".count($overlapped_event);
+			
+			 $participantesreunion="";
+				foreach($overlapped_event['participants'] as $id => $status)
+				{
+					//$conflict = isset($event['participants'][$id]);
+					for ($i = 0; $i < count($partes); $i++) {
+						//echo $partes[$i];
+						if($partes[$i]==$id)
+						$participantesreunion .= '<li>'.$GLOBALS['phpgw']->common->grab_owner_name($id)."</li>";
+						
+					}
+					
+						
+				}
+
+echo "<tr><td>".$name."</td><td>".$descripcion."</td><td>".$dueno."<td>".$participantesreunion."</td><td> ".$GLOBALS['phpgw']->common->show_hour($this->bo->maketime($data['start']))."-".$GLOBALS['phpgw']->common->show_hour($this->bo->maketime($data['end']))."</td></tr>";
+
+
+
+
+			}
+			}else{		
+				echo $nohay;
+			}	
+			?>
+
+		
+		</table>
+	</td>
+	</tr>
+	</table>
+	</body>
+	</html>
+<?php 
+	
+		/*	if($matches > 0)
+			{
+		//		$p->parse('rows','search_list_footer',True);
+			}*/
+
+		//	$p->pparse('out','search');
+		}
+
+
+function get_type($account_id)
+		{
+			$allValues = array();
+			/* jakjr: using justthese with ldap_search */
+			$sri = @ldap_search($this->ds, $this->user_context, '(&(uidnumber=' . (int)$account_id . ')(phpgwaccounttype=u))', array("phpgwaccounttype"));
+			if(!$sri)
+				return False;
+			$allValues = ldap_get_entries($this->ds, $sri);
+
+			if ($allValues[0]['phpgwaccounttype'][0])
+			{
+				return $allValues[0]['phpgwaccounttype'][0];
+			}
+
+			$allValues = array();
+			/* jakjr: using justthese with ldap_search */
+			$sri = @ldap_search($this->ds, $this->group_context, '(&(gidnumber=' . (int)$account_id . ')(phpgwaccounttype=g))', array("phpgwaccounttype"));
+			if(!$sri)
+				return False;
+			$allValues = ldap_get_entries($this->ds, $sri);
+
+			if ($allValues[0]['phpgwaccounttype'][0])
+			{
+				return $allValues[0]['phpgwaccounttype'][0];
+			}
+			return False;
+		}
+
+		
+		
+
+function get_account_name($account_id,$valor)
+		{
+			$this->user_context  = $GLOBALS['phpgw_info']['server']['ldap_context'];
+			$this->group_context = $GLOBALS['phpgw_info']['server']['ldap_group_context'];
+			$acct_type = $this->get_type($account_id);
+			$this->ds = $GLOBALS['phpgw']->common->ldapConnect();
+			if(!$this->ds)
+				$this->ds = $GLOBALS['phpgw']->common->ldapConnect();
+			/* jakjr: using justthese with ldap_search */
+			//$justthese = array("cn","uid","givenname","sn","gecos");
+
+			/* search the dn for the given uid */
+
+$justthese = array("uidnumber",  "cn",  "mail","gecos","dn");
+			//	$sri = @ldap_search($this->ds, "ou=usuarios,ou=cnti,dc=gob,dc=ve", ("(&(sn=*)(mail=*@*)(structuralObjectClass=inetOrgPerson)(deliveryMode=virtual))"), $justthese);
+
+			if(($acct_type == 'g') && $this->group_context)
+			{
+				$sri = @ldap_search($this->ds, $this->group_context, '(gidnumber=' . (int)$account_id . ')', $justthese);
+			}
+			else
+			{
+				$sri = @ldap_search($this->ds, $this->user_context, '(uidnumber=' . (int)$account_id . ')', $justthese);
+			}
+
+//echo $this->ds.",". $this->user_context.",". '(uidnumber=' . (int)$account_id . ')'.",". $justthese;
+			if(!$sri)
+				return False;
+			$allValues = ldap_get_entries($this->ds, $sri);
+$retorna="";
+			if($acct_type =='g')
+			{
+				if($valor=='gecos') {
+					$retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['gecos'][0],'utf-8');
+				}
+				if($valor=='uidnumber') {
+					$retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['uidnumber'][0],'utf-8');
+				}
+				if($valor=='cn') {
+					$retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['cn'][0],'utf-8');
+				}
+
+				if($valor=='mail') {
+					$retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['mail'][0],'utf-8');
+				}
+				if($valor=='dn') {
+					$retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['dn'][0],'utf-8');
+				}
+				
+			}
+			else
+			{
+				if($valor=='gecos') {
+					$retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['gecos'][0],'utf-8');
+				}
+				if($valor=='uidnumber') {
+					$retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['uidnumber'][0],'utf-8');
+				}
+				if($valor=='cn') {
+					$retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['cn'][0],'utf-8');
+				}
+
+				if($valor=='mail') {
+					$retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['mail'][0],'utf-8');
+				}
+				if($valor=='dn') {
+					$retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['dn'][0],'utf-8');
+				}
+				
+
+
+
+			}
+			return $retorna;
+		}
+		
+		
+}
+
+?>
Index: /contrib/Resources/inc/class.boresources.inc.php
===================================================================
--- /contrib/Resources/inc/class.boresources.inc.php	(revision 3524)
+++ /contrib/Resources/inc/class.boresources.inc.php	(revision 4362)
@@ -267,5 +267,5 @@
 			}
 
-			/*$this->so = CreateObject('resources.soresources',
+			$this->so = CreateObject('calendar.socalendar',
 				Array(
 					'owner'		=> $this->owner,
@@ -274,5 +274,5 @@
 					'g_owner'	=> $this->g_owner
 				)
-			);*/
+			);
 			$this->rpt_day = array(	// need to be after creation of soresources
 				MCAL_M_SUNDAY    => 'Sunday',
@@ -589,8 +589,24 @@
 
 			$event = $this->so->read_entry($id);
-				echo $event;
+				//echo $event;
 			
 			
 			return False;
+		}
+		
+		
+	function read_entry2($id,$ignore_acl=False)
+		{
+			
+			
+				$event = $this->so->read_entry($id);
+				if(!isset($event['participants'][$this->owner]) && $this->user_is_a_member($event,$this->owner))
+				{
+					$this->so->add_attribute('participants','U',(int)$this->owner);
+					$this->so->add_entry($event);
+					$event = $this->get_cached_event();
+				}
+				return $this->xmlrpc ? $this->xmlrpc_prepare($event) : $event;
+			
 		}
 
@@ -774,4 +790,5 @@
 
 			
+			
 			$send_to_ui = True;
 			//if ((!is_array($l_start) || !is_array($l_end)) && !isset($_GET['readsess']))	// xmlrpc call
@@ -799,4 +816,5 @@
 					foreach($params['participants'] as $user => $data)
 					{
+						
 						$l_participants[] = $user.$data['status'];
 					}
@@ -1204,4 +1222,5 @@
 				}
 
+				
 				$overlapping_events = $this->overlap(
 					$this->maketime($event['start']),
@@ -1471,5 +1490,5 @@
 		}
 
-		function overlap($starttime,$endtime,$participants,$owner=0,$id=0,$restore_cache=False)
+	function overlap($starttime,$endtime,$participants,$owner=0,$id=0,$restore_cache=False,$location='n/a')
 		{
 //			$retval = Array();
@@ -1478,4 +1497,9 @@
 /* This needs some attention.. by commenting this chunk of code it will fix bug #444265 */
 
+			//	  foreach($id as $c=>$v)
+     		  //   echo "<p>El 565vector con indice $c tiene el valor $v </p>";
+		
+			
+			
 			if($restore_cache)
 			{
@@ -1488,7 +1512,11 @@
 //			$temp_end_time = (int)$GLOBALS['phpgw']->common->show_date($endtime,'Hi');
 			$temp_start = (int)(date('Ymd',$starttime));
+
 			$temp_start_time = (int)(date('Hi',$starttime));
 			$temp_end = (int)(date('Ymd',$endtime));
 			$temp_end_time = (int)(date('Hi',$endtime));
+		//	echo "<br>inicio".$temp_start_time." <br> fin ".$temp_end_time."<br>   ".(int)(date('Hi a',$endtime))."<br>";
+		//	echo "<br>inicio".$temp_start." <br> fin ".$temp_end."<br>   ".(int)(date('Hi a',$endtime))."<br>";
+			
 			if($this->debug)
 			{
@@ -1509,4 +1537,5 @@
 				$users[] = $this->owner;
 			}
+
 
 			$possible_conflicts = $this->store_to_cache(
@@ -1518,5 +1547,6 @@
 					'eday'	=> substr(strval($temp_end),6,2),
 					'eyear'	=> substr(strval($temp_end),0,4),
-					'owner'	=> $users
+					'owner'	=> $users,
+					'location'	=> $location
 				)
 			);
@@ -1527,5 +1557,6 @@
 				echo '<!-- Possible Conflicts ('.$temp_start.'): '.count($possible_conflicts[$temp_start]).' '.count($id).' -->'."\n";
 			}
-
+//echo "aaa".$possible_conflicts[$temp_start];
+//echo "bbbb".$possible_conflicts[$temp_end];
 			if($possible_conflicts[$temp_start] || $possible_conflicts[$temp_end])
 			{
@@ -1569,15 +1600,25 @@
 							$temp_event_end = sprintf("%d%02d",$event['end']['hour'],$event['end']['min']);
 //							if((($temp_start_time <= $temp_event_start) && ($temp_end_time >= $temp_event_start) && ($temp_end_time <= $temp_event_end)) ||
+
+
+			/*}*/
+
+
+
 							if(($temp_start_time <= $temp_event_start &&
-								$temp_end_time > $temp_event_start &&
-								$temp_end_time <= $temp_event_end ||
-								$temp_start_time >= $temp_event_start &&
-								$temp_start_time < $temp_event_end &&
-								$temp_end_time >= $temp_event_end ||
-								$temp_start_time <= $temp_event_start &&
-								$temp_end_time >= $temp_event_end ||
-								$temp_start_time >= $temp_event_start &&
-								$temp_end_time <= $temp_event_end) &&
-								$this->participants_not_rejected($participants,$event))
+								$temp_end_time >= $temp_event_start &&
+								$temp_end_time <= $temp_event_end) ||
+								($temp_start_time <= $temp_event_start &&
+								$temp_end_time >= $temp_event_start &&
+								$temp_end_time >= $temp_event_end)||
+								($temp_start_time <= $temp_event_start &&
+								$temp_end_time >= $temp_event_end) ||		
+
+								($temp_start_time >= $temp_event_start &&
+								$temp_start_time <= $temp_event_end &&
+								$temp_end_time >= $temp_event_end) ||
+								
+								($temp_start_time >= $temp_event_start &&
+								$temp_end_time <= $temp_event_end)) 
 							{
 								if($this->debug)
@@ -1585,5 +1626,5 @@
 									echo ' Conflicts';
 								}
-								$retval[] = $event['id'];
+								$retval[] = $event;
 							}
 							if($this->debug)
@@ -1597,5 +1638,6 @@
 			else
 			{
-				$retval = False;
+				$retval1 = False;
+				$retval = Array();
 			}
 
@@ -2022,9 +2064,14 @@
 			}
 			$repeated = $this->repeating_events;
+
+//echo $repeated."repeat<br>" ;
 			$r_events = count($repeated);
+//echo $r_events."  ".$this->repeating_event[1]. "repeat23<br>" ;
 			for ($i=0;$i<$r_events;$i++)
 			{
 				$rep_events = $this->repeating_events[$i];
+
 				$id = $rep_events['id'];
+//echo $id;
 				$event_beg_day = mktime(0,0,0,$rep_events['start']['month'],$rep_events['start']['mday'],$rep_events['start']['year']);
 				if($rep_events['recur_enddate']['month'] != 0 && $rep_events['recur_enddate']['mday'] != 0 && $rep_events['recur_enddate']['year'] != 0)
@@ -2160,5 +2207,8 @@
 				return False;
 			}
-			if (isset($params['start']) && ($datearr = $GLOBALS['server']->iso86012date($params['start'])))
+$location=$params['location'];
+
+	//echo "location".$location;		
+	if (isset($params['start']) && ($datearr = $GLOBALS['server']->iso86012date($params['start'])))
 			{
 				$syear = $datearr['year'];
@@ -2219,5 +2269,5 @@
 				//Se $emonth nao tem valor, recebe o valor de $smonth (que recebe $params['smonth']) e soma 1.
 				//O valor $params['emonth'] indica o mes final para a pesquisa de eventos, e passou a ser
-				//informado na a impressao de eventos mensais. Mudancas feitas em class.uiresources.inc.php, 
+				//informado na a impressao de eventos mensais. Mudancas feitas em class.uicalendar.inc.php, 
 				//function display_month_print();
 				if(!$emonth)
@@ -2236,5 +2286,5 @@
 				$edate = mktime(23,59,59,$emonth,$eday,$eyear);
 			}
-			//echo "<p>boresources::store_to_cache(".print_r($params,True).") syear=$syear, smonth=$smonth, sday=$sday, eyear=$eyear, emonth=$emonth, eday=$eday, xmlrpc='$param[xmlrpc]'</p>\n";
+			//echo "<p>bocalendar::store_to_cache(".print_r($params,True).") syear=$syear, smonth=$smonth, sday=$sday, eyear=$eyear, emonth=$emonth, eday=$eday, xmlrpc='$param[xmlrpc]'</p>\n";
 			if($this->debug)
 			{
@@ -2248,16 +2298,18 @@
 			if($owner_id)
 			{
-				$cached_event_ids = "";//$this->so->list_events($syear,$smonth,$sday,$eyear,$emonth,$eday,$owner_id);
-				$cached_event_ids_repeating = "";//$this->so->list_repeated_events($syear,$smonth,$sday,$eyear,$emonth,$eday,$owner_id);
+
+				$cached_event_ids = $this->so->list_events($syear,$smonth,$sday,$eyear,$emonth,$eday,$owner_id,$location);
+				$cached_event_ids_repeating = $this->so->list_repeated_events($syear,$smonth,$sday,$eyear,$emonth,$eday,$owner_id,$location);
 			}
 			else
 			{
-				$cached_event_ids = "";//$this->so->list_events($syear,$smonth,$sday,$eyear,$emonth,$eday);
-				$cached_event_ids_repeating = "";//$this->so->list_repeated_events($syear,$smonth,$sday,$eyear,$emonth,$eday);
+
+				$cached_event_ids = $this->so->list_events($syear,$smonth,$sday,$eyear,$emonth,$eday,0,$location);
+				$cached_event_ids_repeating = $this->so->list_repeated_events($syear,$smonth,$sday,$eyear,$emonth,$eday,0,$location);
 			}
 
 			$c_cached_ids = count($cached_event_ids);
 			$c_cached_ids_repeating = count($cached_event_ids_repeating);
-
+//echo "totaless".$c_cached_ids." -  ".$c_cached_ids_repeating;
 			if($this->debug)
 			{
@@ -2274,10 +2326,15 @@
 
 			$cache_start = (int)(sprintf("%04d%02d%02d",$syear,$smonth,$sday));
+
 			$cached_event=$this->get_cached_event();
+
 			if($c_cached_ids)
 			{
+
 				for($i=0;$i<$c_cached_ids;$i++)
 				{
-					$event = "";//$this->so->read_entry($cached_event_ids[$i]);
+					$event = $this->so->read_entry($cached_event_ids[$i]);
+
+//echo "<br>antrrrrroooo".$event['start']."  a ".$event['end']." b ".$event['id'];
 					if ($event['recur_type'])
 					{
@@ -2287,4 +2344,5 @@
 					$enddate = (int)(date('Ymd',$this->maketime($event['end'])));
 					$this->cached_events[$startdate][] = $event;
+//echo "ver".$event['recur_type'].$startdate." ---".$enddate."<br>antrrrrroooo";;
 					if($startdate != $enddate)
 					{
@@ -2294,5 +2352,8 @@
 						for($j=$startdate,$k=0;$j<=$enddate;$k++,$j=(int)(date('Ymd',mktime(0,0,0,$start['month'],$start['mday'] + $k,$start['year']))))
 						{
+
+
 							$c_evt_day = count($this->cached_events[$j]) - 1;
+//echo "<br>aaaa".$c_evt_day."<br>antrrrrroooo"; ;
 							if($c_evt_day < 0)
 							{
@@ -2310,4 +2371,5 @@
 								}
 								$this->cached_events[$j][] = $event;
+//echo "<br>llll:".$event."<br>antrrrrroooo";;
 							}
 							if ($j >= $cache_start && (@$params['no_doubles'] || @$this->xmlrpc))
@@ -2323,7 +2385,10 @@
 			if($c_cached_ids_repeating)
 			{
+//echo "repeaiting".$c_cached_ids_repeating;
+
 				for($i=0;$i<$c_cached_ids_repeating;$i++)
 				{
-					$this->repeating_events[$i] = "";//$this->so->read_entry($cached_event_ids_repeating[$i]);
+					$this->repeating_events[$i] = $this->so->read_entry($cached_event_ids_repeating[$i]);
+//echo "abc".$this->repeating_events[$i]."<br>";
 					if($this->debug)
 					{
@@ -2339,4 +2404,6 @@
 					}
 					$this->check_repeating_events($date);
+
+
 					if($this->debug)
 					{
@@ -2349,7 +2416,10 @@
 				}
 			}
+
+//echo "countt".count($this->cached_events);
 			$retval = Array();
 			for($j=date('Ymd',mktime(0,0,0,$smonth,$sday,$syear)),$k=0;$j<=date('Ymd',mktime(0,0,0,$emonth,$eday,$eyear));$k++,$j=date('Ymd',mktime(0,0,0,$smonth,$sday + $k,$syear)))
 			{
+//echo "vueltaaaa".$j."<br>";
 				if(is_array($this->cached_events[$j]))
 				{
@@ -2359,4 +2429,5 @@
 						{
 							$retval[] = $this->xmlrpc_prepare($event);
+//echo "cachhhhhheeeeeqqq2222".$this->xmlrpc_prepare($event)."<br>";
 						}
 					}
@@ -2364,9 +2435,14 @@
 					{
 						$retval[$j] = $this->cached_events[$j];
-					}
-				}
+						//foreach($this->cached_events[$j][0] as $c=>$v)
+     						//echo "<p>El vector con indice $c tiene el valor $v </p>";
+//echo "cachhhhhheeeeeqqq".$this->cached_events[$j][0]['public']."<br>";
+					}
+				}
+
+
 			}
 			//echo "store_to_cache(".print_r($params,True).")=<pre>".print_r($retval,True)."</pre>\n";
-			//$this->so->cal->event = $cached_event;
+			$this->so->cal->event = $cached_event;
 			return $retval;
 		}
Index: /contrib/Resources/inc/class.uiresources.inc.php
===================================================================
--- /contrib/Resources/inc/class.uiresources.inc.php	(revision 3524)
+++ /contrib/Resources/inc/class.uiresources.inc.php	(revision 4362)
@@ -37,4 +37,6 @@
 		'footer' => True			
 		);
+
+
 
 
@@ -135,6 +137,10 @@
 		function uiresources()
 		{
-
-
+			$localtime = $GLOBALS['phpgw']->datetime->users_localtime;
+
+					$this->year = date('Y',$localtime);
+					$this->month = date('m',$localtime);
+					$this->day = date('d',$localtime);
+			$this->today = date('Ymd',$GLOBALS['phpgw']->datetime->users_localtime);
 
 
@@ -954,4 +960,5 @@
 'accionmodificar'	=>'index.php?menuaction=resources.uiresources.edit&id='. $data['id'],
 'accionlistar'	=>'index.php?menuaction=resources.uiresources.search2&id='.  $data['name'],
+				
 'accionborrar'	=>'index.php?menuaction=resources.uiresources.delete&id='. $data['id'],
 'accionreservar'	=>'index.php?menuaction=calendar.uicalendar.add&location='. $data['name']
@@ -985,5 +992,5 @@
 	//		}
 
-			$sql = 'select t1.*,t2.cat_name from   phpgw_resources t1 ,phpgw_categories t2 where t1.cat_id=t2.cat_id '
+			$sql = "select t1.*,t2.cat_name from   phpgw_resources t1 ,phpgw_categories t2 where t1.cat_id=t2.cat_id and t1.name !='n/a'"
 					. $from;
 					//.$search;
@@ -1452,4 +1459,263 @@
 
 //print_r($_REQUEST); 
+$this->today = date('Ymd',$GLOBALS['phpgw']->datetime->users_localtime);
+
+
+
+			$jscal = CreateObject('phpgwapi.jscalendar');	// before phpgw_header() !!!
+
+			unset($GLOBALS['phpgw_info']['flags']['noheader']);
+			unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
+			$GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['resources']['title'].' - '.lang('Search Results');
+			$GLOBALS['phpgw']->common->phpgw_header();
+
+			$error = '';
+
+
+
+			$matches = 0;
+
+//echo "aaaaa".$GLOBALS['phpgw']->common->show_date(1288884600);
+
+//echo "aaaaa".$GLOBALS['phpgw']->common->show_date(1288886400);
+
+if (isset($_REQUEST['fecha'])){
+list($dia,$mes,$ano)=split("/",$_REQUEST['fecha']);
+if (isset($_REQUEST['fecha2'])){
+list($dia2,$mes2,$ano2)=split("/",$_REQUEST['fecha2']);
+}else{
+	list($dia2,$mes2,$ano2)=split("/",$_REQUEST['fecha']);
+	
+}
+if(isset($_REQUEST['hora'])){
+list($horai,$minutoi,$horaf,$minutof)=split(":",$_REQUEST['hora']);
+}else{
+	$horai=0;
+	$minutoi=0;
+	$horaf=23;
+	$minutof=59;
+}
+	$starttimea = $this->bo->maketime2(0,0,0,$dia,$mes,$ano,'am') - $GLOBALS['phpgw']->datetime->tz_offset;
+
+
+}else{
+	$localtime = $GLOBALS['phpgw']->datetime->users_localtime;
+	$ano = date('Y',$localtime);
+	$mes = date('m',$localtime);
+	$dia = date('d',$localtime);					
+	$ano2 = date('Y',$localtime);
+	$mes2 = date('m',$localtime);
+	$dia2 = date('d',$localtime);
+	$horai=0;
+	$minutoi=0;
+	$horaf=23;
+	$minutof=59;
+
+//$starttime = $this->bo->maketime2(0,0,0,$dia,$mes,$ano,'am') - $GLOBALS['phpgw']->datetime->tz_offset;
+///echo $starttime;
+//$starttime2 = $this->bo->maketime2(23,59,59,$dia,$mes,$ano,'pm') - $GLOBALS['phpgw']->datetime->tz_offset;
+///echo $starttime2;
+
+}
+
+
+
+$pm='pm';
+if($horaf<12){
+	$pm='am';
+}else{
+	$horaf=$horaf-12;
+}
+$am='am';
+if($horai>11){
+	$am='pm';
+	$horai=$horai-12;
+	
+}
+
+
+//echo $horai."  <br>  ".$starttimea."<br>".$horaf;
+	$starttime = $this->bo->maketime2($horai,$minutoi,0,$dia,$mes,$ano,$am) - $GLOBALS['phpgw']->datetime->tz_offset;
+//echo "fff".$starttime;
+$starttime2 = $this->bo->maketime2($horaf,$minutof,59,$dia2,$mes2,$ano2,$pm) - $GLOBALS['phpgw']->datetime->tz_offset;
+///echo $starttime2;
+		//$event = $this->bo->read_entry($res_id);	
+$location='';
+if($_GET['id']!=''){
+$location=$_GET['id'];}else{
+$location='n/a';}
+
+/*$eventtt=$this->bo->store_to_cache(
+				Array(
+					'syear'  => $ano,
+					'smonth' => $mes,
+					'sday'   => $dia,
+				'shour'   => $horai,
+				'smin'   => $minutoi,
+					'eyear'  => $ano,
+					'emonth' => $mes,
+					'eday'   => $dia,
+				'fhour'   => $horaf,
+				'fmin'   => $minutof,
+'location'	=>	$location
+				)
+			);	*/
+		$date_to_eval = sprintf("%04d%02d%02d",$ano,$mes,$dia);
+		
+	//	echo "date _to _eval".$date_to_eval."<br>";
+//$events = $this->bo->cached_events[$date_to_eval];//(5,23,0,22,10,2010) 
+$events=$this->bo->overlap($starttime,$starttime2,Array(),0,0,'False',$location);
+				print_debug('Date',$date_to_eval);
+				print_debug('Count',count($events));
+//echo "llll<br>".'Date'.$date_to_eval;
+//echo "llll<br>".'Count'.count($events);
+if(count($events)>0){
+				foreach($events as $event)
+				{
+					if ($this->bo->rejected_no_show($event))
+					{
+						continue;	// user does not want to see rejected events
+					}
+					if ($event['recur_type'])	// calculate start- + end-datetime for recuring events
+					{
+						$this->bo->set_recur_date($event,$date_to_eval);
+					}
+					//$events_to_show[] = array(
+					//	'starttime' => $this->bo->maketime($event['start']),
+					//	'endtime'   => $this->bo->maketime($event['end']),
+					//	'content'   => $this->link_to_entry($event,$mes,$dia,$ano)
+					//);
+
+				}
+}
+//echo "eeeevento".count($event)."<br>";
+			$date_to_eval = sprintf("%04d%02d%02d",$ano,$mes,$dia);
+
+//$event = $this->get_event_ids2($_REQUEST['id'],$starttime,$starttime2);
+
+
+			//$event_ids = $this->bo->search_keywords($_POST['keywords']);
+
+			
+			$matches = count($event);
+
+//echo "matches" . $matches."<br>";
+
+			if ($matches == 1)
+			{
+				$quantity = lang('1 match found').'.';
+			}
+			elseif ($matches > 0)
+			{
+				$quantity = lang('%1 matches found',$matches).'.';
+			}
+			else
+			{
+				echo lang('no matches found')." para el ".$dia."/".$mes."/".$ano."  en la sala:".$location;
+				
+				//return;
+			}
+
+			if ($matches > 0){
+			$p = $GLOBALS['phpgw']->template;
+			$p->set_file(
+				Array(
+					'search_form'	=> 'search2.tpl'
+				)
+			);
+			
+		}else{
+			$p = $GLOBALS['phpgw']->template;
+			$p->set_file(
+				Array(
+					'search_form'	=> 'search3.tpl'
+				)
+			);
+		}
+		$p->set_block('search_form','search','search');
+			$p->set_block('search_form','search_list_header','search_list_header');
+			$p->set_block('search_form','search_list','search_list');
+			$p->set_block('search_form','search_list_footer','search_list_footer');
+
+$script='';
+
+		
+
+			if($matches > 0)
+			{
+				$p->parse('rows','search_list_header',True);
+			}
+
+//if($info){
+//echo $matches;
+//for($i=0;$i<$matches;$i++)
+		//	{
+//echo "i".$i;
+if(count($events)>0){
+			foreach($events  as $id => $data)
+			{
+
+//echo "<br>dataaaa".$data['title'];
+//echo "<br>".$this->get_account_name($data['owner'],'gecos')."  ".$data['owner'];
+				$datetime = $this->bo->maketime($event['start']) - $GLOBALS['phpgw']->datetime->tz_offset;
+
+
+
+//echo "ffffffeeecha".$GLOBALS['phpgw']->common->show_date($data[$i]['datetime'])."     ".$data[$i]['start']."  ".$this->bo->maketime($data[$i]['start']);
+//echo $data['location']."  .. ".$data['last_status']."  .. ".$data['is_public'];
+if($data['public']==1){
+	$descripcion=$data['description'];
+	$name=$data['title'];
+}else{
+	$descripcion='-';
+	$name='Privado';
+}
+$dueno=$this->get_account_name($data['owner'],'gecos');
+				$info = array(
+					'tr_color'	=> $GLOBALS['phpgw']->nextmatchs->alternate_row_color(),
+					'date'		=> $GLOBALS['phpgw']->common->show_date($datetime),
+'id'    => $data['id'],
+					'name'         => $name,
+					'description'         => $descripcion,
+					'location'         =>$data['location'],
+				
+					'owner'=>$this->get_account_name($data['owner'],'gecos'),
+					'fecha'=> $dia."/".$mes."/".$ano." <br>   ".$GLOBALS['phpgw']->common->show_hour($this->bo->maketime($data['start']))."-".$GLOBALS['phpgw']->common->show_hour($this->bo->maketime($data['end'])),
+					'priority'=>'',
+					'ispublic'=>$data['is_public'],
+
+'accionmodificar'	=>'index.php?menuaction=resources.uiresources.edit&id='. $data['id'],
+'accionlistar'	=>'index.php?menuaction=resources.uiresources.search2&id='. $data['id'],
+'accionborrar'	=>$data['id'],
+'accionreservar'	=>'index.php?menuaction=calendar.uicalendar.add&location='. $data['id']
+				);
+
+
+
+//'accionagregar'	=>'index.php?menuaction=resources.uiresources.edit&parent='. $data['id']
+$p->set_var($info);
+				$p->set_var($info);
+				$p->parse('rows','search_list',True);
+			}
+//}
+//	}
+}
+			if($matches > 0)
+			{
+				$p->parse('rows','search_list_footer',True);
+			}
+
+			$p->pparse('out','search');
+		}
+
+		
+	
+		
+		
+		
+	function search22()
+		{
+
+//print_r($_REQUEST); 
 
 			$jscal = CreateObject('phpgwapi.jscalendar');	// before phpgw_header() !!!
@@ -1568,11 +1834,11 @@
 		}
 
-
-
-
+	
 function get_event_ids2($idd,$starttime,$starttime2)
 		{
-////echo "tamannn".count($search)."  ".$search[0];
-
+
+
+
+$from ="";
 $from ="";
 if (isset($idd)){
@@ -1582,7 +1848,9 @@
 
 if (isset($starttime)){
+
+			$from =$from .' and t1.datetime>=\''.$starttime.'\'';
 if (isset($starttime2)){
 
-			$from =$from .' and t1.datetime>=\''.$starttime.'\' and t1.datetime<=\''.$starttime2.'\' ';
+			$from =$from .'  and t1.datetime<=\''.$starttime2.'\' ';
 }
 			}
@@ -1601,4 +1869,5 @@
 
 
+//echo $sql;
 
 
@@ -1638,5 +1907,4 @@
 				);
 
-
 			}
 		
@@ -1646,4 +1914,173 @@
 			return $retval;
 		}
+function link_to_entry($event,$month,$day,$year)
+		{
+			$str = '';
+			$is_private = !$event['public'] && !$this->bo->check_perms(PHPGW_ACL_READ,$event);
+			$viewable = !$this->bo->printer_friendly && $this->bo->check_perms(PHPGW_ACL_READ,$event);
+
+			$starttime = $this->bo->maketime($event['start']) - $GLOBALS['phpgw']->datetime->tz_offset;
+			$endtime = $this->bo->maketime($event['end']) - $GLOBALS['phpgw']->datetime->tz_offset;
+			$rawdate = mktime(0,0,0,$month,$day,$year);
+			$rawdate_offset = $rawdate - $GLOBALS['phpgw']->datetime->tz_offset;
+			$nextday = mktime(0,0,0,$month,$day + 1,$year) - $GLOBALS['phpgw']->datetime->tz_offset;
+			if ((int)$GLOBALS['phpgw']->common->show_date($starttime,'Hi') && $starttime == $endtime)
+			{
+				$time = $GLOBALS['phpgw']->common->show_date($starttime,$this->bo->users_timeformat);
+			}
+			elseif ($starttime <= $rawdate_offset && $endtime >= $nextday - 60)
+			{
+				$time = '[ '.lang('All Day').' ]';
+			}
+			elseif ((int)$GLOBALS['phpgw']->common->show_date($starttime,'Hi') || $starttime != $endtime)
+			{
+				if($starttime < $rawdate_offset && $event['recur_type'] == MCAL_RECUR_NONE)
+				{
+					$start_time = $GLOBALS['phpgw']->common->show_date($rawdate_offset,$this->bo->users_timeformat);
+				}
+				else
+				{
+					$start_time = $GLOBALS['phpgw']->common->show_date($starttime,$this->bo->users_timeformat);
+				}
+
+				if($endtime >= ($rawdate_offset + 86400))
+				{
+					$end_time = $GLOBALS['phpgw']->common->show_date(mktime(23,59,59,$month,$day,$year) - $GLOBALS['phpgw']->datetime->tz_offset,$this->bo->users_timeformat);
+				}
+				else
+				{
+					$end_time = $GLOBALS['phpgw']->common->show_date($endtime,$this->bo->users_timeformat);
+				}
+				$time = $start_time.'-'.$end_time;
+			}
+			else
+			{
+				$time = '';
+			}
+			
+			$texttitle = $texttime = $textdesc = $textlocation = $textstatus = '';
+
+			
+			
+			if(!$is_private)
+			{
+				//$text .= $this->bo->display_status($event['users_status']);
+				
+				// split text for better display by templates, also see $texttime $texttitle $textdesc $textlocation	
+				$textstatus=$this->bo->display_status($event['users_status']); 
+				
+			}
+
+			/*
+			$text = '<nobr>&nbsp;'.$time.'&nbsp;</nobr> '.$this->bo->get_short_field($event,$is_private,'title').$text.
+				(!$is_private && $event['description'] ? ': <i>'.$this->bo->get_short_field($event,$is_private,'description').'</i>':'').
+				$GLOBALS['phpgw']->browser->br;
+			*/
+			
+			$texttime=$time;
+			$texttitle=$this->bo->get_short_field($event,$is_private,'title');
+			$textdesc=(!$is_private && $event['description'] ? $this->bo->get_short_field($event,$is_private,'description'):'');
+			// added $textlocation but this must be activated in the actual pict_link.tpl file of the used template set
+			$textlocation=$this->bo->get_short_field($event,$is_private,'location');
+
+			if ($viewable)
+			{
+				$date = sprintf('%04d%02d%02d',$year,$month,$day);
+				$this->link_tpl->set_var('link_link',$this->page('view','&cal_id='.$event['id'].'&date='.$date));
+				$this->link_tpl->set_var('lang_view',lang('View this entry'));
+				$this->link_tpl->set_var('desc', $textdesc);
+				$this->link_tpl->set_var('location', $textlocation);
+				$this->link_tpl->parse('picture','link_open',True);
+			}
+			if (!$is_private)
+			{
+				if($event['priority'] == 3)
+				{
+					$picture[] = Array(
+						'pict'	=> $GLOBALS['phpgw']->common->image('calendar','high'),
+						'width'	=> 16,
+						'height'=> 16,
+						'title' => lang('high priority')
+					);
+				}
+				if($event['recur_type'] == MCAL_RECUR_NONE)
+				{
+					$picture[] = Array(
+						'pict'	=> $GLOBALS['phpgw']->common->image('calendar','circle'),
+						'width'	=> 9,
+						'height'=> 9,
+						'title' => lang('single event')
+					);
+				}
+				else
+				{
+					$picture[] = Array(
+						'pict'	=> $GLOBALS['phpgw']->common->image('calendar','recur'),
+						'width'	=> 12,
+						'height'=> 12,
+						'title' => lang('recurring event')
+					);
+				}
+			}
+			
+			if($event['public'] == 0)
+			{
+				$picture[] = Array(
+					'pict'	=> $GLOBALS['phpgw']->common->image('calendar','private'),
+					'width'	=> 13,
+					'height'=> 13,
+					'title' => lang('private')
+				);
+			}
+		/**	if(@isset($event['alarm']) && count($event['alarm']) >= 1 && !$is_private)
+			{
+				// if the alarm is to go off the day before the event
+				// the icon does not show up because of 'alarm_today'
+				// - TOM
+				if($this->bo->alarm_today($event,$rawdate_offset,$starttime))
+				{
+					$picture[] = Array(
+						'pict'  => $GLOBALS['phpgw']->common->image('calendar','alarm'),
+						'width' => 13,
+						'height'=> 13,
+						'title' => lang('alarm')
+					);
+				}
+			}*/
+
+			$description = $this->bo->get_short_field($event,$is_private,'description');
+			for($i=0;$i<count($picture);$i++)
+			{
+				$var = Array(
+					'pic_image' => $picture[$i]['pict'],
+					'width'     => $picture[$i]['width'],
+					'height'    => $picture[$i]['height'],
+					'title'     => $picture[$i]['title']
+				);
+				$this->output_template_array($this->link_tpl,'picture','pict',$var);
+			}
+			if ($texttitle)
+			{
+				$var = Array(
+			//		'text' => $text,
+					'time'=> $texttime,
+					'title'=> $texttitle,
+					'users_status'=>$textstatus,
+					'desc'=> $textdesc,
+					'location'=> "<br><b>Local:</b> ".$textlocation
+				);
+				$this->output_template_array($this->link_tpl,'picture','link_text',$var);
+			}
+
+			if ($viewable)
+			{
+				$this->link_tpl->parse('picture','link_close',True);
+			}
+			$str = $this->link_tpl->fp('out','link_pict');
+			$this->link_tpl->set_var('picture','');
+			$this->link_tpl->set_var('out','');
+//			unset($p);
+			return $str;
+		}
 
 
Index: /contrib/Resources/inc/class.soresources.inc.php
===================================================================
--- /contrib/Resources/inc/class.soresources.inc.php	(revision 3524)
+++ /contrib/Resources/inc/class.soresources.inc.php	(revision 4362)
@@ -49,5 +49,6 @@
 				echo '<!-- SO cat_id : '.$this->cat_id.' -->'."\n";
 			}
-			$this->cal = CreateObject('infolog.soinfolog_');
+		//	$this->cal = CreateObject('infolog.soinfolog_');
+			$this->cal = CreateObject('calendar.socalendar_');
 			//$this->open_box($this->owner);
 		}
@@ -76,4 +77,9 @@
 		}
 
+	function read_entry2($id)
+		{
+			return $this->cal->fetch_event($id);
+		}
+		
 		function list_events($startYear,$startMonth,$startDay,$endYear=0,$endMonth=0,$endDay=0,$owner_id=0)
 		{
@@ -427,4 +433,33 @@
 			$this->cal->set_recur_yearly($year,$month,$day,$interval);
 		}
+function list_eventsa($startYear,$startMonth,$startDay,$endYear=0,$endMonth=0,$endDay=0,$owner_id=0,$location='n/a')
+		{
+
+			$extra = '';
+			$extra .= (strpos($this->filter,'private')?'AND phpgw_cal.is_public=0 ':'');
+			//$extra .= ($this->cat_id?"AND phpgw_cal.category like '%".$this->cat_id."%' ":'');
+			if ($this->cat_id)
+			{
+				if (!is_object($GLOBALS['phpgw']->categories))
+				{
+					$GLOBALS['phpgw']->categories = CreateObject('phpgwapi.categories');
+				}
+				$cats = $GLOBALS['phpgw']->categories->return_all_children($this->cat_id);
+				$extra .= "AND (phpgw_cal.category".(count($cats) > 1 ? " IN ('".implode("','",$cats)."')" : '=\''.(int)$this->cat_id."'");
+				foreach($cats as $cat)
+				{
+					$extra .= " OR phpgw_cal.category LIKE '$cat,%' OR phpgw_cal.category LIKE '%,$cat,%' OR phpgw_cal.category LIKE '%,$cat'";
+				}
+				$extra .= ') ';
+			}
+			if($owner_id)
+			{
+				return $this->cal->list_events($startYear,$startMonth,$startDay,$endYear,$endMonth,$endDay,$extra,$GLOBALS['phpgw']->datetime->tz_offset,$owner_id,$location);
+			}
+			else
+			{
+				return $this->cal->list_events($startYear,$startMonth,$startDay,$endYear,$endMonth,$endDay,$extra,$GLOBALS['phpgw']->datetime->tz_offset);
+			}
+		}
 		
 		/* End mcal equiv functions */
Index: /contrib/Resources/templates/default/search2.tpl
===================================================================
--- /contrib/Resources/templates/default/search2.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/search2.tpl	(revision 4362)
@@ -31,6 +31,5 @@
 </script>
 <center>
-
-<table id="calendar_search_table" width="90%">
+<table id="calendar_search_table" width="800">
 
 <tr><td align=left>
@@ -40,5 +39,5 @@
 	
 <td>
-		<table>
+		<table width="150">
 	
 			<tr>
@@ -50,5 +49,5 @@
 	</td>
 <td>
-		<table>
+		<table width="300">
 	
 			<tr>
@@ -62,5 +61,5 @@
 	
 <td>
-		<table>
+		<table width="100">
 	
 			<tr>
@@ -71,36 +70,7 @@
 		</table>
 	</td>
+
 <td>
-		<table>
-	
-			<tr>
-			<td class="inactiv_sortcolumn" align="left">Grupos</td>
-			
-			</tr>
-			
-		</table>
-	</td>
-	<td>
-		<table>
-	
-			<tr>
-			<td class="inactiv_sortcolumn" align="left">Prioridad</td>
-			
-			</tr>
-			
-		</table>
-	</td>
-<td>
-		<table>
-	
-			<tr>
-			<td class="inactiv_sortcolumn" align="left">Public</td>
-			
-			</tr>
-			
-		</table>
-	</td>
-<td>
-		<table>
+		<table width="150">
 	
 			<tr>
@@ -125,5 +95,5 @@
 	</td>
 <td>
-		<table>
+		<table width="100">
 	
 			<tr>
@@ -158,9 +128,7 @@
 <td>{description}</td>
 <td>	{location}</td>
-<td>	{groups}</td>
-<td>	{priority}</td>
-<td>	{ispublic}</td>
+
 <td>	{fecha}</td>
-<td>{owner}</td>
+<td>{owner}<input type=hidden value={id}></td>
 
 
Index: /contrib/Resources/templates/default/search3.tpl
===================================================================
--- /contrib/Resources/templates/default/search3.tpl	(revision 4362)
+++ /contrib/Resources/templates/default/search3.tpl	(revision 4362)
@@ -0,0 +1,84 @@
+<!-- BEGIN search -->
+
+<script language="Javascript">
+  
+    function submitit(form,campo)
+{
+
+ var texto;
+ 
+texto=document.form.start.value;
+
+
+      var url = document.location.href;
+
+      partes = url.split('/');
+
+      page=partes[partes.length-1];
+
+      partes2=page.split('&');
+
+     
+form.action=page+'&fecha='+texto;
+form.action='index.php?menuaction=resources.uiresources.search2&fecha='+texto+'&'+partes2[partes2.length-1];
+//self.location.href=page+'&fecha='+texto;
+form.submit();
+	//form.submit_button.value = '';
+	return false;
+	
+}
+ 
+</script>
+<center>
+<table id="calendar_search_table"  width="800">
+
+<tr><td align=left>
+<form  METHOD=POST name="form">
+<input type=hidden name=ordena value="">
+	<table><tr class="th">
+	
+
+
+<td>
+		<table>
+	
+			<tr>
+			<td class="inactiv_sortcolumn" align="left">Fecha para realizar la busqueda
+
+<input id="start[str]" name="start" size="10"  onchange="return submitit(this.form)" type="text">
+<script type="text/javascript">
+	document.writeln('<img id="start[str]-trigger" src="phpgwapi/templates/default/images/datepopup.gif" title="Seleccionar fecha" style="cursor:pointer; cursor:hand;"/>');
+	Calendar.setup(
+	{
+		inputField  : "start[str]",
+		button      : "start[str]-trigger"
+	}
+	);
+</script>
+
+</td>
+			
+			</tr>
+			
+		</table>
+	</td>
+
+	
+	</tr>
+
+	
+</form>
+</table>
+<!-- END search -->
+
+<!-- BEGIN search_list_header -->
+
+<!-- END search_list_header -->
+
+<!-- BEGIN search_list -->
+	
+<!-- END search_list -->
+
+<!-- BEGIN search_list_footer -->
+
+<!-- END search_list_footer -->
Index: /contrib/Resources/templates/default/search.tpl
===================================================================
--- /contrib/Resources/templates/default/search.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/search.tpl	(revision 4362)
@@ -56,14 +56,5 @@
 	</td>
 	
-	<td>
-		<table>
 	
-			<tr>
-			<td class="inactiv_sortcolumn" align="left">Categor&iacute;a <br>Administrador</td>
-			
-			</tr>
-			
-		</table>
-	</td>
 <td>
 		<table>
@@ -103,5 +94,5 @@
 
 
-<td>{category}<br>{administrador}</td>
+
 <td>	{location}</td>
 
@@ -109,7 +100,5 @@
 
 
-<td>
-<a href="{accionmodificar}"><img src=/resources/templates/default/images/edit.png alt="modificar"></a>&nbsp;&nbsp;&nbsp;
-</td>
+
 <td>
 <a href="{accionlistar}"><img src=/resources/templates/default/images/calendar.png alt="ver recursos asignados"></a>&nbsp;&nbsp;&nbsp;
@@ -121,12 +110,5 @@
 <a href="{accionreservar}"><img src=/resources/templates/default/images/bookable.png alt="reservar"></a>&nbsp;&nbsp;&nbsp;
 </td>
-<td>
 
-<a href="" onClick="if ( 0 || confirm('eliminar esta entrada?')) return submitit2('{accionborrar}');; "><img src=/infolog/templates/default/images/delete.png alt="borrar"></a><br>
-
-
-<br>
-
-</td>
 
 
Index: /contrib/Resources/templates/default/head.tpl
===================================================================
--- /contrib/Resources/templates/default/head.tpl	(revision 3524)
+++ /contrib/Resources/templates/default/head.tpl	(revision 4362)
@@ -17,30 +17,7 @@
 <table id="calendar_head_table" class="calendar_head_table" border="0" width="100%" cols="{cols}" cellpadding="6" cellspacing="0">
 	<tr>
-		<td rowspan=10>
+		<td>
 	
-	<div id="divSubContainer">
-		<table cellpadding="0" cellspacing="0" width="100%">
-		<tbody><tr>
-		<!-- Sidebox Column -->
-<td id="tdSidebox" valign="top"><div id="thesideboxcolumn" style="width: 203px;"><div id="sideresize"></div>
-<div class="divSidebox">
-	<div class="divSideboxHeader"><span>Recursos Men&uacute;</span></div>
-
-	<div>
-		<table cellpadding="0" cellspacing="0" width="100%">
-		<tbody><tr class="divSideboxEntry">
-			<td class="textSidebox" align="center" valign="middle" width="20"><img class="sideboxstar" src="/resources/templates/default/images/orange-ball.png" alt="ball" height="9" width="9"></td><td class="textSidebox"><a class="textSidebox" href="index.php?menuaction=resources.uiresources.search">Lista del registro</a></td>
-		</tr>
-		<tr class="divSideboxEntry">
-			<td class="textSidebox" align="center" valign="middle" width="20"><img class="sideboxstar" src="/resources/templates/default/images/orange-ball.png" alt="ball" height="9" width="9"></td><td class="textSidebox"><a class="textSidebox" href=""></a><a class="textSidebox" href="index.php?menuaction=resources.uiresources.edit"  >A&ntilde;adir</a></td>
-		</tr>
-
-		</tbody></table>	
-	</div>
-</div>
-
-<div class="sideboxSpace"></div>
-
-</td> <td> 
+	
 
 
Index: /contrib/Resources/templates/default/searcha.tpl
===================================================================
--- /contrib/Resources/templates/default/searcha.tpl	(revision 4362)
+++ /contrib/Resources/templates/default/searcha.tpl	(revision 4362)
@@ -0,0 +1,149 @@
+<html>
+<head>
+
+<!-- BEGIN search -->
+
+<script language="Javascript">
+  
+    function submitit(form,campo)
+{
+
+ var texto;
+ 
+texto=document.form.start.value;
+
+
+      var url = document.location.href;
+
+      partes = url.split('/');
+
+      page=partes[partes.length-1];
+
+      partes2=page.split('&');
+
+     
+form.action=page+'&fecha='+texto;
+form.action='index.php?menuaction=resources.uiresources.search2&fecha='+texto+'&'+partes2[partes2.length-1];
+//self.location.href=page+'&fecha='+texto;
+form.submit();
+	//form.submit_button.value = '';
+	return false;
+	
+}
+ 
+</script>
+</head>
+<body>
+<center>
+<table id="calendar_search_table" width="800">
+
+<tr><td align=left>
+<form  METHOD=POST name="form">
+<input type=hidden name=ordena value="">
+	<table><tr class="th">
+	
+<td>
+		<table width="150">
+	
+			<tr>
+			<td class="inactiv_sortcolumn" align="left">Nombre</td>
+			
+			</tr>
+			
+		</table>
+	</td>
+<td>
+		<table width="300">
+	
+			<tr>
+			<td class="inactiv_sortcolumn" align="left">Descripci&oacute;n</td>
+			
+			</tr>
+			
+		</table>
+	</td>
+	
+	
+<td>
+		<table width="100">
+	
+			<tr>
+			<td class="inactiv_sortcolumn" align="left">Ubicaci&oacute;n</td>
+			
+			</tr>
+			
+		</table>
+	</td>
+
+<td>
+		<table width="150">
+	
+			<tr>
+			<td class="inactiv_sortcolumn" align="left">Fecha
+
+<input id="start[str]" name="start" size="10"  onchange="return submitit(this.form)" type="text">
+<script type="text/javascript">
+	document.writeln('<img id="start[str]-trigger" src="phpgwapi/templates/default/images/datepopup.gif" title="Seleccionar fecha" style="cursor:pointer; cursor:hand;"/>');
+	Calendar.setup(
+	{
+		inputField  : "start[str]",
+		button      : "start[str]-trigger"
+	}
+	);
+</script>
+
+</td>
+			
+			</tr>
+			
+		</table>
+	</td>
+<td>
+		<table width="100">
+	
+			<tr>
+			<td class="inactiv_sortcolumn" align="left">Due&ntilde;o</td>
+			
+			</tr>
+			
+		</table>
+	</td>
+					
+	
+	</tr>
+
+	<tr>
+		<td colspan="2" align="center" bgcolor="{th_bg}">
+			<b></b>
+		</td>
+	</tr>
+	{rows}
+</form>
+</table>
+<!-- END search -->
+
+<!-- BEGIN search_list_header -->
+
+<!-- END search_list_header -->
+
+<!-- BEGIN search_list -->
+	<tr bgcolor="{tr_color}">
+		
+<td>	{name}</td>
+<td>{description}</td>
+<td>	{location}</td>
+
+<td>	{fecha}</td>
+<td>{owner}<input type=hidden value={id}></td>
+
+
+
+
+	</tr>
+<!-- END search_list -->
+
+<!-- BEGIN search_list_footer -->
+
+<!-- END search_list_footer -->
+</body>
+</html>
