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();
 ?>
