Ignore:
Timestamp:
05/12/11 11:52:50 (13 years ago)
Author:
afernandes
Message:

Ticket #1416 - Disponibilizado módulo de recursos para a comunidade

File:
1 edited

Legend:

Unmodified
Added
Removed
  • contrib/Dms/out/out.FolderAccess.php

    r3526 r4362  
    1313 
    1414include("../inc/inc.Authentication.php"); 
     15// 
    1516 
    1617 
     
    2627 
    2728$folderid       = (isset($_GET['folderid'])) ? (int) $_GET['folderid'] : NULL; 
    28 $folder         = getFolder($folderid); 
    29  
    30 $allUsers = getAllUsers(); 
    31  
    32 if ($folder->getAccessMode($user) < M_ALL) 
    33         die ("Access denied"); 
     29//$folder               = getFolder($folderid); 
     30 
     31if(!$folder = getFolder($folderid)) { 
     32$GLOBALS['phpgw']->redirect_link('out/out.ViewFolder.php?error=accesso denegado!'); 
     33                 
     34} 
     35 
     36if ($folder->getAccessMode($user) < M_READWRITE) 
     37$GLOBALS['phpgw']->redirect_link('out/out.ViewFolder.php?error=accesso denegado!'); 
     38 
     39 
     40//$allUsers = getAllUsers(); 
     41//foreach($allUsers as $c=>$v) 
     42   //  echo "<p>El vector con indice $c tiene el valor $v </p>"; 
     43     //while (list($clave, $valor) = each($allUsers)) { 
     44      //echo "<p>El vector con indice $clave tiene el valor $valor </p>"; 
     45     //} 
     46//asort($allUsers); 
     47//uasort($allUsers,'ordenar'); 
     48   
     49 
     50 
     51 
     52 
     53$accounts = $GLOBALS['phpgw']->accounts->get_list('accounts');  
     54        $allUsers = array(); 
     55        for ($i = 0; $i < count($accounts); $i++) 
     56        { 
     57                $id = $accounts[$i]["account_id"]; 
     58                $login = $accounts[$i]["account_lid"]; 
     59                $fullName = $accounts[$i]['account_firstname'].' '.$accounts[$i]['account_lastname']; 
     60                $email = $accounts[$i]["account_email"]; 
     61                $isAdmin = phpgw_is_admin($id); 
     62                $pwd = ''; 
     63                $comment = ''; 
     64                //$myCollection->add($id,$login,$fullName,$email,$isAdmin,$pwd,$comment); 
     65                $allUsers[$i]=new User($id, $login, $pwd, $fullName, $email, $comment, $isAdmin); 
     66        } 
     67//$allUsers->sortDataSet("fullName"); 
     68 
     69         
     70         function cmpNames($a,$b) 
     71    { 
     72        //Use sort() for simple alphabetical comparison 
     73        //Convert to lowercase to ensure consistent behaviour 
     74        $sortable = array(strtolower($a->_fullName),strtolower($b->_fullName)); 
     75        $sorted = $sortable; 
     76        sort($sorted);    
     77        
     78        //If the names have switched position, return -1. Otherwise, return 1. 
     79        return ($sorted[0] == $sortable[0]) ? -1 : 1; 
     80    } 
     81uasort($allUsers, "cmpNames"); 
     82 
     83 
     84//                                      $allGroups = getAllGroups(); 
     85$phpgw_groups = $GLOBALS['phpgw']->accounts->get_list('groups'); 
     86 
     87$allGroups= array(); 
     88         
     89         
     90        for ($i = 0; $i < count($phpgw_groups); $i++) 
     91                $allGroups[$i] = new Group($phpgw_groups[$i]["account_id"], $phpgw_groups[$i]["account_lid"], ''); 
     92         
     93 function cmpNamesg($a,$b) 
     94    { 
     95        //Use sort() for simple alphabetical comparison 
     96        //Convert to lowercase to ensure consistent behaviour 
     97        $sortable = array(strtolower($a->_name),strtolower($b->_name)); 
     98        $sorted = $sortable; 
     99        sort($sorted);    
     100        
     101        //If the names have switched position, return -1. Otherwise, return 1. 
     102        return ($sorted[0] == $sortable[0]) ? -1 : 1; 
     103    } 
     104     
     105    uasort($allGroups, "cmpNamesg"); 
     106     
     107 
     108//Sort by name: 
     109//$myCollection->sortDataSet("fullName"); 
     110//print_r($myCollection->dataSet); 
     111 //$allUsers[]->sortDataSet("fullName"); 
     112 
     113//Sort by x 
     114//$myCollection->sortDataSet("login"); 
     115//print_r($myCollection->dataSet); 
     116 
     117//Sort by y 
     118//$myCollection->sortDataSet("id"); 
     119//print_r($myCollection->dataSet); 
     120 
     121//Sort by order added 
     122//$myCollection->sortDataSet("added"); 
     123//print_r($myCollection->dataSet); 
     124         
     125 
     126 
     127//if ($folder->getAccessMode($user) < M_ALL) 
     128        //die ("Access denied"); 
    34129 
    35130 
     
    58153printFolderPageStart($folder); 
    59154printPageHeader(getMLText("edit_folder_access") . ": " . $folder->getName()); 
    60  
    61  
    62 //Nur admin darf Besitzer ändern 
     155$owner = $folder->getOwner(); 
     156if($user->getID()==1120 ||$owner->getID()==$user->getID()){ 
     157 
     158//Nur admin darf Besitzer ï¿œndern 
    63159if ($user->isAdmin()) 
    64160{ 
     
    112208} 
    113209 
     210if($user->getID()==1120 ){ 
    114211printMLText("does_not_inherit_access_msg", array("inheriturl" => "../op/op.FolderAccess.php?folderid=".$folderid."&action=inherit")); 
     212} 
    115213print "</div>"; 
    116214 
     
    118216$accessList = $folder->getAccessList(); 
    119217 
    120 printNextBox(getMLText("default_access")); 
    121 ?> 
    122  
    123 <div class="defaultAccess"> 
    124 <form action="../op/op.FolderAccess.php"> 
    125         <input type="Hidden" name="folderid" value="<?php print $folderid;?>"> 
    126         <input type="Hidden" name="action" value="setdefault"> 
    127          
    128         <?php printAccessModeSelection($folder->getDefaultAccess()); ?> 
    129         <p> 
    130         <input type="Submit"> 
    131 </form> 
    132 </div> 
     218//printNextBox(getMLText("default_access")); 
     219?> 
     220 
     221 
    133222 
    134223<?php 
     
    227316                                <option value="none">------------------------------- 
    228317                                <?php 
    229                                         $allGroups = getAllGroups(); 
    230318                                        foreach ($allGroups as $groupObj) 
    231319                                                print "<option value=\"".$groupObj->getID()."\">" . $groupObj->getName() . "\n"; 
     
    251339 
    252340printEndBox(); 
     341 
     342 
    253343printFolderPageEnd($folder); 
     344 
     345} 
    254346printHTMLFoot(); 
    255347?> 
Note: See TracChangeset for help on using the changeset viewer.