Subversion Repositories Applications.papyrus

Rev

Rev 1404 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1404 Rev 1446
Line 17... Line 17...
17
// |                                                                                                      |
17
// |                                                                                                      |
18
// | You should have received a copy of the GNU General Public                                            |
18
// | You should have received a copy of the GNU General Public                                            |
19
// | License along with this library; if not, write to the Free Software                                  |
19
// | License along with this library; if not, write to the Free Software                                  |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
21
// +------------------------------------------------------------------------------------------------------+
21
// +------------------------------------------------------------------------------------------------------+
22
// CVS : $Id: ecouteArbreFichier.php,v 1.1.2.2 2007-05-24 07:56:15 alexandre_tb Exp $
22
// CVS : $Id: ecouteArbreFichier.php,v 1.1.2.3 2007-06-04 15:42:17 alexandre_tb Exp $
23
/**
23
/**
24
* Application projet
24
* Application projet
25
*
25
*
26
* Service d ecoute de l arbre du porte document, renvoie les donnees du repertoire demande
26
* Service d ecoute de l arbre du porte document, renvoie les donnees du repertoire demande
27
*
27
*
Line 29... Line 29...
29
//Auteur original :
29
//Auteur original :
30
*@author        Alexandre Granier <alexandre@tela-botanica.org>
30
*@author        Alexandre Granier <alexandre@tela-botanica.org>
31
//Autres auteurs :
31
//Autres auteurs :
32
*@author        Aucun
32
*@author        Aucun
33
*@copyright     Tela-Botanica 2000-2005
33
*@copyright     Tela-Botanica 2000-2005
34
*@version       $Revision: 1.1.2.2 $
34
*@version       $Revision: 1.1.2.3 $
35
// +------------------------------------------------------------------------------------------------------+
35
// +------------------------------------------------------------------------------------------------------+
36
*/
36
*/
Line 37... Line 37...
37
 
37
 
38
// +------------------------------------------------------------------------------------------------------+
38
// +------------------------------------------------------------------------------------------------------+
Line 75... Line 75...
75
   } else {
75
   } else {
76
   		$id_parent = $node->objectId;
76
   		$id_parent = $node->objectId;
77
   }
77
   }
78
	$sql = 'select * from projet_documents where pd_pere='.$id_parent ;
78
	$sql = 'select * from projet_documents where pd_pere='.$id_parent ;
79
	if (isset($id_projet)) $sql .= ' and pd_ce_projet='.$id_projet;
79
	if (isset($id_projet)) $sql .= ' and pd_ce_projet='.$id_projet;
80
 
-
 
-
 
80
	$sql .= ' order by pd_nom';
81
   $resultat = $GLOBALS['projet_db']->query($sql);
81
   $resultat = $GLOBALS['projet_db']->query($sql);
Line 82... Line 82...
82
 
82
 
83
   if (DB::isError($resultat)) {
83
   if (DB::isError($resultat)) {
84
        die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
84
        die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
85
   }
85
   }
86
   $nodeArray = array();
86
   $nodeArray = array();
Line 87... Line 87...
87
   $i = 0;
87
   $i = 0;
Line 88... Line 88...
88
   
88
   
89
   include_once PROJET_CHEMIN_CLASSES.'document.class.php';
89
   include_once PROJET_CHEMIN_CLASSES.'document.class.php';
90
   
90
   
91
   if ($GLOBALS['projet_auth']->getAuth()) {
91
   if ($GLOBALS['projet_auth']->getAuth() && is_object($this)) {
92
	    include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
92
	    include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
93
	    $participant = new participe($GLOBALS['projet_db']) ;
93
	    $participant = new participe($GLOBALS['projet_db']) ;
94
	    $id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;
94
	    $id_u = $GLOBALS['projet_auth']->getAuthData(PROJET_CHAMPS_ID) ;
95
	    $isCoord = $participant->isCoordinateur($id_u, $this->_id_projet, $this->_db) ;
95
	    $isCoord = $participant->isCoordinateur($id_u, $this->_id_projet, $GLOBALS['projet_db']) ;
96
	    if ($isCoord) $droits = PROJET_DROIT_COORDINATEUR ;
96
	    if ($isCoord) $droits = PROJET_DROIT_COORDINATEUR ;
97
	    $isAdm = participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db) ;
97
	    $isAdm = participe::isAdministrateur($GLOBALS['projet_auth']->getAuthData(PROJET_CHAMPS_ID), $GLOBALS['projet_db']) ;
98
	    if ($isAdm) $droits = PROJET_DROIT_ADMINISTRATEUR ;
98
	    if ($isAdm) $droits = PROJET_DROIT_ADMINISTRATEUR ;
Line 99... Line 99...
99
	    if ($isAdm) $isCoord = true ;
99
	    if ($isAdm) $isCoord = true ;
100
	    $isParticipant = $participant->isContributeur($id_u, $this->_id_projet, $this->_db);
100
	    $isParticipant = $participant->isContributeur($id_u, $this->_id_projet, $GLOBALS['projet_db']);
101
	    if ($isParticipant) $droits = PROJET_DROIT_CONTRIBUTEUR;
101
	    if ($isParticipant) $droits = PROJET_DROIT_CONTRIBUTEUR;
102
	    
102
	    
103
	    $statut = participe::getStatutSurProjetCourant ($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
103
	    $statut = participe::getStatutSurProjetCourant ($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
-
 
104
	    // si participant, on ajoute le champs visibilite
-
 
105
   } else {
104
	    // si participant, on ajoute le champs visibilite
106
   	$droits = PROJET_DROIT_AUCUN;
105
   } else {
107
   }
106
   	$droits = PROJET_DROIT_AUCUN;
108
	// Recuperation de l'auteur
-
 
109
        include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
107
   }
110
        
108
 
111
   while ( $ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
109
   while ( $ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
112
       $document = new document($ligne['pd_id'], $GLOBALS['projet_db'], PROJET_CHEMIN_FICHIER, PROJET_CHEMIN_ICONES);
110
       $document = new document($ligne['pd_id'], $GLOBALS['projet_db'], PROJET_CHEMIN_FICHIER, PROJET_CHEMIN_ICONES);
113
		$GLOBALS['url']->addQueryString('id_projet', $id_projet);
Line -... Line 114...
-
 
114
		$GLOBALS['url']->addQueryString('id_document', $document->getIdDocument());
-
 
115
		$GLOBALS['url']->addQueryString(PROJET_VARIABLE_SERVICE, 'telechargement');
-
 
116
		// json attend de l utf8, en lui fournissant des donnees au format htmlentities,
-
 
117
		// ca passe
-
 
118
		
-
 
119
		$annuaire = new annuaire($objetDB, array('table' => PROJET_ANNUAIRE, 'identifiant' => PROJET_CHAMPS_ID, 
111
		$GLOBALS['url']->addQueryString('id_document', $document->getIdDocument());
120
                                    'nom' => PROJET_CHAMPS_NOM, 'prenom' => PROJET_CHAMPS_PRENOM)) ;
112
		$GLOBALS['url']->addQueryString(PROJET_VARIABLE_SERVICE, 'telechargement');
121
        $annuaire->setId($document->_id_proprietaire) ;
113
		// json attend de l utf8, en lui fournissant des donnees au format htmlentities,
122
        $nom_prenom = $annuaire->getInfo('nom').' '.$annuaire->getInfo('prenom') ;
114
		// ca passe
123
        
115
		
124
        
116
		// On regarde si l utilisateur a les droits pour deplacer
125
		// On regarde si l utilisateur a les droits pour deplacer
117
		if ($droits <= PROJET_DROIT_COORDINATEUR || 
126
		if ($droits <= PROJET_DROIT_COORDINATEUR || 
Line 118... Line 127...
118
			$GLOBALS['projet_auth']->getAuthData(PROJET_CHAMPS_ID) == $document->_id_proprietaire) {
127
			$GLOBALS['projet_auth']->getAuthData(PROJET_CHAMPS_ID) == $document->_id_proprietaire) {
119
				$actions = 'MOVE,REMOVE,EDIT' ;
128
				$actions = 'MOVE,REMOVE,EDIT' ;
120
				if ($document->isRepertoire()) $actions .= ',ADDCHILD';	
129
				if ($document->isRepertoire()) $actions .= ',ADDCHILD';	
121
			} 
130
			} 
122
				else $actions = '';
131
				else $actions = '';
123
		
132
		
124
       $node = array(
133
       $node = array(
125
          'title'=> htmlentities($document->getNomLong()),
134
          'title'=> iconv('ISO-8859-1', 'UTF-8', $document->getNomLong()),
126
          'widgetId' => 'document_'.$document->getIdDocument(),
135
          'widgetId' => 'document_'.$document->getIdDocument(),
127
          'objectId'=> $document->getIdDocument(),
136
          'objectId'=> $document->getIdDocument(),
128
          'isFolder'=> $document->isRepertoire(),
137
          'isFolder'=> $document->isRepertoire(),
129
          'link' => str_replace ('&amp;', '&', $GLOBALS['url']->getURL()),
138
          'link' => str_replace ('&amp;', '&', $GLOBALS['url']->getURL()),
130
          'childIconSrc' => $document->getCheminIcone(),
139
          'childIconSrc' => $document->getCheminIcone(),
131
          'expandIcon' => PROJET_CHEMIN_ICONES.'folder-expanded.gif',
140
          'expandIcon' => PROJET_CHEMIN_ICONES.'folder-expanded.gif',