19,7 → 19,7 |
// | License along with this library; if not, write to the Free Software | |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
// +------------------------------------------------------------------------------------------------------+ |
// CVS : $Id: HTML_listeDocuments.class.php,v 1.8 2007-04-19 15:34:35 neiluj Exp $ |
// CVS : $Id: HTML_listeDocuments.class.php,v 1.8.2.1 2007-05-11 13:54:54 alexandre_tb Exp $ |
/** |
* Application projet |
* |
31,7 → 31,7 |
//Autres auteurs : |
*@author Aucun |
*@copyright Tela-Botanica 2000-2004 |
*@version $Revision: 1.8 $ |
*@version $Revision: 1.8.2.1 $ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
|
81,7 → 81,7 |
var $_chemin_icone = "icones/"; |
|
/** |
* L'identifiant du répertoire que l'on est en train d'observer. |
* L'identifiant du repertoire que l'on est en train d'observer. |
* @access private |
*/ |
var $_id_repertoire; |
98,7 → 98,13 |
* @access private |
*/ |
var $_auth ; |
|
/** |
* le style d affichage |
* @access private |
*/ |
var $_mode_affichage ; |
/** |
* |
* |
* @param bool utilise_pager Indique l'utilisation ou non du Pager. |
114,6 → 120,7 |
if (is_object($auth)) { |
$this->_auth = $auth ; |
} |
$this->_mode_affichage = 'standart'; |
} // end of member function HTML_listeDocuments |
|
/** |
123,7 → 130,7 |
* @return void |
* @access public |
*/ |
function __construct( &$url, $utilise_pager = false, $id_repertoire = 0, $auth = '' ) |
function __construct( &$url, $utilise_pager = false, $id_repertoire = 0, $auth = '', $id_projet = '' ) |
{ |
$this->HTML_listeDocuments($url, $utilise_pager, $id_repertoire, $auth); |
|
139,77 → 146,84 |
function construitEntete( $tableau_label ) |
{ |
$this->addRow ($tableau_label, NULL, 'TH') ; |
} // end of member function construitEntete |
} |
|
/** |
* |
* |
* @param Array tableau_label Un tableau à deux dimensions avec les labels à afficher dans le corps du |
* @param Array tableau_label Un tableau a deux dimensions avec les labels a afficher dans le corps du |
* tableau. |
* @return void |
* @access public |
*/ |
function construitListe( &$tableau_document, $droits, $mode = '', $objetDB = '') |
function construitListe( &$tableau_document, $droits, $mode = '', $objetDB = '', $id_projet = '') |
{ |
$compteur = 0 ;$class[0] = 'ligne_impaire'; $class[1] = 'ligne_paire' ; |
|
for ($i = 0; $i < count ($tableau_document) ; $i++) { |
// première condition : est-ce que le fichier a pour père le répertoire courant, si oui on l'affiche |
if ($tableau_document[$i]->_id_pere == $this->_id_repertoire || $mode == 'ignore_repertoire') { |
// d'abord l'image |
$icone = '<img src="'.$tableau_document[$i]->getCheminIcone().'" />' ; |
// Si le document est un répertoire, on ajoute id_repertoire au lien. |
if ($tableau_document[$i]->isRepertoire()) { |
$this->_url->addQueryString ('id_repertoire', $tableau_document[$i]->getChemin()) ; |
$lien = $this->_url->getURL() ; |
} else { // Si c'est un fichier, on fait un lien direct |
$lien = $tableau_document[$i]->getChemin() ; |
} |
// pour éviter des effets de bords, on enlève id_repertoire de l'url |
// dans le cas d'un répertoire, pour les fichiers on le laisse pour |
// qu'après une opération, on reste dans le répertoire où a eu lieu l'opération |
if ($tableau_document[$i]->isRepertoire()) $this->_url->removeQueryString('id_repertoire') ; |
|
// on insère le lien |
$lien_nom = '<a href="'.$lien.'">'.$icone.' '.$tableau_document[$i]->getNomLong()."</a>\n" ; |
|
// Pour la taille on divise par 1000 et on écrit Ko |
$taille = round($tableau_document[$i]->getTaille() / 1000).' Ko' ; |
|
// Récupération de l'auteur |
include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ; |
$annuaire = new annuaire($objetDB, array('table' => PROJET_ANNUAIRE, 'identifiant' => PROJET_CHAMPS_ID, |
'nom' => PROJET_CHAMPS_NOM, 'prenom' => PROJET_CHAMPS_PRENOM)) ; |
$annuaire->setId($tableau_document[$i]->_id_proprietaire) ; |
$nom_prenom = $annuaire->getInfo('nom').' '.$annuaire->getInfo('prenom') ; |
// On rempli le tableau à donner en paramètre à HTML_Table avec toutes ces infos, une par colonne |
$ligne_tableau = array($lien_nom, $taille, $nom_prenom, $tableau_document[$i]->getDateMiseAJour()) ; |
if ($droits <= PROJET_DROIT_CONTRIBUTEUR) array_push ($ligne_tableau, $tableau_document[$i]->getVisibilite()) ; |
|
// On ajoute au tableau, les action couper / modifier / supprimer |
if ($droits <= PROJET_DROIT_COORDINATEUR || $this->_auth->getAuthData(PROJET_CHAMPS_ID) == $tableau_document[$i]->_id_proprietaire) |
array_push ($ligne_tableau, $this->_actions ($tableau_document[$i])) ; |
if ($tableau_document[$i]->getVisibilite() != 'prive' || $droits < PROJET_DROIT_AUCUN) { |
$this->addRow ($ligne_tableau, array('class' => $class[$compteur]), 'TD', true) ; |
// enfin , s'il y a une description, on l'ajoute, mais sur une ligne entière (colspan) |
if ($tableau_document[$i]->getDescription() != "") { |
$this->addRow (array ($tableau_document[$i]->getDescription()), |
array ('colspan' => $this->getColCount(), 'class' => $class[$compteur])) ; |
$this->updateRowAttributes ($this->getRowCount()-1, array ('class' => $class[$compteur]), true) ; |
if ($this->_mode_affichage == 'standart') { |
$compteur = 0 ;$class[0] = 'ligne_impaire'; $class[1] = 'ligne_paire' ; |
|
for ($i = 0; $i < count ($tableau_document) ; $i++) { |
// Premiere condition : est-ce que le fichier a pour pere le repertoire courant, si oui on l'affiche |
if ($tableau_document[$i]->_id_pere == $this->_id_repertoire || $mode == 'ignore_repertoire') { |
// d'abord l'image |
$icone = '<img src="'.$tableau_document[$i]->getCheminIcone().'" />' ; |
// Si le document est un repertoire, on ajoute id_repertoire au lien. |
if ($tableau_document[$i]->isRepertoire()) { |
$this->_url->addQueryString ('id_repertoire', $tableau_document[$i]->getIdDocument()) ; |
$lien = $this->_url->getURL() ; |
} else { // Si c'est un fichier, on fait un lien direct |
$this->_url->addQueryString('id_document', $tableau_document[$i]->getIdDocument()); |
$this->_url->addQueryString('service', 'telechargement'); |
$lien = $this->_url->getURL() ; |
$this->_url->removeQueryString('service'); |
} |
} |
$compteur++; |
} |
|
if ($compteur == 2) $compteur = 0 ; |
// pour eviter des effets de bords, on enleve id_repertoire de l'url |
// dans le cas d'un repertoire, pour les fichiers on le laisse pour |
// qu'apres une operation, on reste dans le repertoire ou a eu lieu l'operation |
if ($tableau_document[$i]->isRepertoire()) $this->_url->removeQueryString('id_repertoire') ; |
|
// on insere le lien |
$lien_nom = '<a href="'.$lien.'">'.$icone.' '.$tableau_document[$i]->getNomLong()."</a>\n" ; |
|
$taille = $tableau_document[$i]->getTailleFormatee(); |
|
// Recuperation de l'auteur |
include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ; |
$annuaire = new annuaire($objetDB, array('table' => PROJET_ANNUAIRE, 'identifiant' => PROJET_CHAMPS_ID, |
'nom' => PROJET_CHAMPS_NOM, 'prenom' => PROJET_CHAMPS_PRENOM)) ; |
$annuaire->setId($tableau_document[$i]->_id_proprietaire) ; |
$nom_prenom = $annuaire->getInfo('nom').' '.$annuaire->getInfo('prenom') ; |
// On rempli le tableau a donner en parametre a HTML_Table avec toutes ces infos, une par colonne |
$ligne_tableau = array($lien_nom, $taille, $nom_prenom, $tableau_document[$i]->getDateMiseAJour()) ; |
if ($droits <= PROJET_DROIT_CONTRIBUTEUR) array_push ($ligne_tableau, $tableau_document[$i]->getVisibilite()) ; |
|
// On ajoute au tableau, les action couper / modifier / supprimer |
if ($droits <= PROJET_DROIT_COORDINATEUR || $this->_auth->getAuthData(PROJET_CHAMPS_ID) == $tableau_document[$i]->_id_proprietaire) |
array_push ($ligne_tableau, $this->_actions ($tableau_document[$i])) ; |
if ($tableau_document[$i]->getVisibilite() != 'prive' || $droits < PROJET_DROIT_AUCUN) { |
$this->addRow ($ligne_tableau, array('class' => $class[$compteur]), 'TD', true) ; |
// enfin , s'il y a une description, on l'ajoute, mais sur une ligne entière (colspan) |
if ($tableau_document[$i]->getDescription() != "") { |
$this->addRow (array ($tableau_document[$i]->getDescription()), |
array ('colspan' => $this->getColCount(), 'class' => $class[$compteur])) ; |
$this->updateRowAttributes ($this->getRowCount()-1, array ('class' => $class[$compteur]), true) ; |
} |
} |
$compteur++; |
} |
|
if ($compteur == 2) $compteur = 0 ; |
} |
$this->_url->removeQueryString('id_document'); |
$this->updateColAttributes(0, array ('class' => 'col1')) ; |
} else { |
|
} |
$this->updateColAttributes(0, array ('class' => 'col1')) ; |
} // end of member function construitListe |
|
/** |
* |
* |
* @param Array actions Un tableau avec les valeurs d'actions comme clé. "couper", modifier", |
* @param Array actions Un tableau avec les valeurs d'actions comme cle. "couper", modifier", |
* "supprimer". |
* @return void |
* @access public |
217,8 → 231,21 |
function setAction( $actions ) |
{ |
$this->_actions = $actions ; |
} // end of member function setAction |
} |
|
/** |
* |
* |
* @param string le mode, valeur possible standart ou ajax |
* @return void |
* @access public |
*/ |
function setModeAffichage( $mode ) |
{ |
$this->_mode_affichage = $mode ; |
} |
|
|
/** |
* |
* |
229,35 → 256,59 |
function setCheminIcones( $chemin ) |
{ |
$this->_chemin_icone = $chemin ; |
} // end of member function setCheminIcones |
} |
|
/** |
* Surcharge de l'opération de la classe mère. Ajoute la navigation dans les |
* répertoires. |
* Surcharge de l'operation de la classe mere. Ajoute la navigation dans les |
* repertoires. |
* |
* @return string |
* @access public |
*/ |
function toHTML( ) |
function toHTML($id_projet = '', $droits) |
{ |
$chemin_navig = "" ; |
if ($this->_id_repertoire != "") { |
$this->_url->removeQueryString(PROJET_VARIABLE_ID_REPERTOIRE) ; |
$chemin_navig = "<p>" ; |
$chemin_navig .= "<a href=\"".$this->_url->getURL()."\">".PROJET_RACINE."</a>\n" ; |
$this->_url->addQueryString(PROJET_VARIABLE_ID_REPERTOIRE, $this->_id_repertoire) ; |
for ($i = 0; $i < count ($this->_chemin_navigation); $i+=2) { |
$chemin_navig .= "> " ; |
$nom = $this->_chemin_navigation[$i+1] ; |
$this->_url->addQueryString ('id_repertoire', $this->_chemin_navigation[$i]) ; |
$chemin_navig .= "<a href=\"".$this->_url->getURL()."\">".$nom."</a>\n" ; |
} |
$chemin_navig .= "</p>\n" ; |
if ($this->_mode_affichage == 'standart') { |
$chemin_navig = "" ; |
if ($this->_id_repertoire != "") { |
$this->_url->removeQueryString(PROJET_VARIABLE_ID_REPERTOIRE) ; |
$chemin_navig = "<p>" ; |
$chemin_navig .= "<a href=\"".$this->_url->getURL()."\">".PROJET_RACINE."</a>\n" ; |
$this->_url->addQueryString(PROJET_VARIABLE_ID_REPERTOIRE, $this->_id_repertoire) ; |
for ($i = 0; $i < count ($this->_chemin_navigation); $i++) { |
$chemin_navig .= "> " ; |
$doc = new document ($this->_chemin_navigation[$i], $GLOBALS['projet_db']); |
$nom = $doc->getNomLong() ; |
$this->_url->addQueryString ('id_repertoire', $this->_chemin_navigation[$i]) ; |
$chemin_navig .= "<a href=\"".$this->_url->getURL()."\">".$nom."</a>\n" ; |
} |
$chemin_navig .= "</p>\n" ; |
} |
$res = $chemin_navig.HTML_Liste::toHTML() ; |
if ($this->getRowCount() == 1 && $this->_id_repertoire == '') { |
return '<div>'.PROJET_PAS_DE_DOCUMENTS.'</div>'."\n"; |
} |
} else { |
GEN_stockerFichierScript('dojo', 'api/js/dojo/dojo.js', 'text/javascript'); |
GEN_stockerFichierScript('dojoScriptProjet', 'client/projet/js/arbreDocument.js'); |
|
$res = '' ; |
|
$RCPUrl = PROJET_CHEMIN_APPLI.'services/ecouteArbreFichier.php?id_projet='.$id_projet; |
$this->_url->addQueryString(PROJET_VARIABLE_SERVICE, 'ecouteArbreFichier'); |
|
$RCPUrl = $this->_url->getURL(); |
// Le noeud racine |
|
if ($droits <= PROJET_DROIT_CONTRIBUTEUR) { |
$tree = '<div dojoType="Tree" DNDMode="between" selector="treeSelector" DNDAcceptTypes="bandTree" widgetId="bandTree" controller="treeController" eventNames="moveTo:nodeRemoved">'; |
} else { |
$tree = '<div dojoType="Tree" selector="treeSelector" DNDAcceptTypes="bandTree" widgetId="bandTree" controller="treeController">'; |
} |
$res .= '<div dojoType="TreeLoadingController" RPCUrl="'.$RCPUrl.'" widgetId="treeController" DNDController="create"></div> |
<div dojoType="TreeSelector" widgetId="treeSelector"></div>'.$tree. |
'<div dojoType="TreeNode" title="Racine" widgetId="rootNode" objectId="root" isFolder="true"></div></div>'; |
|
} |
$res = $chemin_navig.HTML_Liste::toHTML() ; |
if ($this->getRowCount() == 1 && $this->_id_repertoire == '') { |
return '<div>'.PROJET_PAS_DE_DOCUMENTS.'</div>'."\n"; |
} |
return $res ; |
} // end of member function toHTML |
|
264,7 → 315,7 |
/** |
* |
* |
* @param Array tableau_navigation Un tableau contenant les identifiants et les noms des répertoires. 0 => ["id"], |
* @param Array tableau_navigation Un tableau contenant les identifiants et les noms des repertoires. 0 => ["id"], |
* ["nom"] etc. |
* @return void |
* @access public |
275,7 → 326,7 |
} // end of member function setCheminNavigation |
|
/** |
* Affiche la légende des actions du module "documents" |
* Affiche la legende des actions du module "documents" |
* |
* @return string |
* @access public |
287,11 → 338,11 |
$res .= "<p><img src=\"".$this->_chemin_icone."/modif.png\" title=\"modifier\" alt=\"modifier\"> ".PROJET_LEGENDE_MODIFIE."</p>\n" ; |
$res .= "<p><img src=\"".$this->_chemin_icone."/trash.gif\" title=\"supprimer\" alt=\"supprimer\"> ".PROJET_LEGENDE_SUPPR."</p>\n" ; |
return $res ; |
} // end of member function affLegende |
} |
|
|
/** |
* Renvoie le chemin HTML, depuis le répertoire courant jusqu'à la racine. |
* Renvoie le chemin HTML, depuis le repertoire courant jusqu'a la racine. |
* |
* @return string |
* @access private |
301,13 → 352,11 |
$path = "" ; |
|
return $path ; |
} // end of member function _getCheminHTML |
} |
|
|
|
/** |
* Renvoie une chaine contenant le code html des icones des actions possibles sur un |
* fichier, c'est à dire couper, modifier, supprimer. |
* fichier, c'est a dire couper, modifier, supprimer. |
* |
* @return string |
* @access private |
318,7 → 367,7 |
|
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, $this->_actions["couper"]) ; |
$couper = ' '.PROJET_FICHIER_COUPER ; |
if (!$document->isRepertoire()) $couper = '<a href="'.$this->_url->getURL().'">'.$couper.'</a>' ; |
$couper = '<a href="'.$this->_url->getURL().'">'.$couper.'</a>' ; |
|
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, $this->_actions["modifier"]) ; |
$modifier = '<a href="'.$this->_url->getURL().'">'.PROJET_FICHIER_MODIFIER.'</a> ' ; |