Subversion Repositories Applications.projet

Rev

Rev 39 | Rev 46 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 ddelon 1
<?php
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */
3
// +------------------------------------------------------------------------------------------------------+
4
// | PHP version 4.1                                                                                      |
5
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +------------------------------------------------------------------------------------------------------+
8
// | This library is free software; you can redistribute it and/or                                        |
9
// | modify it under the terms of the GNU General Public                                                  |
10
// | License as published by the Free Software Foundation; either                                         |
11
// | version 2.1 of the License, or (at your option) any later version.                                   |
12
// |                                                                                                      |
13
// | This library is distributed in the hope that it will be useful,                                      |
14
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
15
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
16
// | General Public License for more details.                                                             |
17
// |                                                                                                      |
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                                  |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
21
// +------------------------------------------------------------------------------------------------------+
41 alexandre_ 22
// CVS : $Id: forums.php,v 1.5 2005-10-17 16:19:51 alexandre_tb Exp $
2 ddelon 23
/**
24
* Application projet
25
*
26
* Action forums
27
*
28
*@package projet
29
//Auteur original :
30
*@author        Alexandre Granier <alexandre@tela-botanica.org>
31
//Autres auteurs :
32
*@author        Aucun
33
*@copyright     Tela-Botanica 2000-2005
41 alexandre_ 34
*@version       $Revision: 1.5 $
2 ddelon 35
// +------------------------------------------------------------------------------------------------------+
36
*/
37
 
38
// +------------------------------------------------------------------------------------------------------+
39
// |                                            ENTETE du PROGRAMME                                       |
40
// +------------------------------------------------------------------------------------------------------+
41
 
33 alexandre_ 42
include_once (PROJET_CHEMIN_CLASSES.'HTML_formulaireMail.class.php') ;
43
include_once (PROJET_CHEMIN_CLASSES.'inscription_liste.class.php') ;
2 ddelon 44
// RAPPEL IMPORTANT
45
// On se situe dans la méthode run() de la classe projetControleur
46
//
47
 
48
 
49
// création de l'objet projet courant
50
$projet = new projet ($this->_db, $this->_id_projet) ;
51
 
52
$liste_ext_res = '' ;
53
$sortie_liste = '' ;
54
if ($projet->avoirListe()) {
55
    foreach ($projet->_listes_associes as $info_liste) {
56
        ob_start() ;
57
        $id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;
58
        if ($this->_auth->getAuth()) {
59
            $participant = new participe($this->_db) ;
60
 
61
            $isCoord = $participant->isCoordinateur($id_u, $this->_id_projet, $this->_db) ;
62
            if ($isCoord) $droits = PROJET_DROIT_COORDINATEUR ;
63
            $isAdm = participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db) ;
64
            if ($isAdm) $droits = PROJET_DROIT_ADMINISTRATEUR ;
65
            if ($isAdm) $isCoord = true ;
66
        } else {
67
            $droits = PROJET_DROIT_AUCUN;
68
        }
69
 
33 alexandre_ 70
        // gestion de l'inscription désinscription à la liste
41 alexandre_ 71
        // TODO : la gestion de linscription au résumé
33 alexandre_ 72
        $inscription_liste = new inscription_liste($this->_db) ;
73
        $statut = $inscription_liste->getStatutInscrit( $info_liste->getId(),  $this->_auth ) ;
41 alexandre_ 74
        if ($this->_auth->getAuth()) {
75
	        if ($statut == 2) {
76
	        	$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_INSCRIPTION_LISTE);
77
	        	$inscription_laius ='<h2>'.PROJET_VOUS_ETES_INSCRIT.'</h2>'."\n" ;
78
	        	$inscription_laius .= '<a href="'.$this->_url->getURL().'">'.PROJET_SE_DESINSCRIRE_LISTE.'</a>'."\n" ;
79
	        } else {
80
	        	$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_DESINSCRIPTION_LISTE);
81
	        	$inscription_laius ='<h2>'.PROJET_VOUS_N_ETES_PAS_INSCRIT.'</h2>'."\n" ;
82
	        	$inscription_laius .= '<a href="'.$this->_url->getURL().'">'.PROJET_S_INSCRIRE.'</a>'."\n" ;
83
	        }
33 alexandre_ 84
        }
85
 
2 ddelon 86
        if ($info_liste->isPublic() || $droits <= PROJET_DROIT_CONTRIBUTEUR) {
87
            $liste = new ezmlm_php() ;
88
            // Paramétrage de la liste
89
 
90
            $liste->listdir = PROJET_CHEMIN_LISTES.$info_liste->getDomaine().'/'.$info_liste->getNom();
91
            $liste->listname = $info_liste->getNom() ;
92
            $liste->listdomain = $info_liste->getDomaine();
93
 
94
            if (isset ($GLOBALS['action']) && $GLOBALS['action'] != '') {
95
                $liste->set_action($GLOBALS['action']) ;
96
                $liste->set_actionargs($GLOBALS['actionargs']) ;
97
            } else {
98
                $liste->set_action('list_info') ;
99
            }
100
            $liste->sendheaders	= false;
101
            $liste->sendbody        = false;
102
            $liste->sendfooters    = false;
103
            $liste->forcehref = $this->_url->getURL() ;
104
 
105
 
106
            print '<a href="mailto:'.$info_liste->getAdresseEnvoi().'">' . $info_liste->getAdresseEnvoi() ;
107
            print "</a><br />\n";
39 alexandre_ 108
            $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ENVOYER_UN_MAIL);
109
            print '<a href="'.$this->_url->getURL().'">'.PROJET_ECRIRE_LISTE.'</a><br />';
2 ddelon 110
 
111
            print '<h2>'.PROJET_TOUS_LES_MESSAGES.'</h2>'."\n";
112
            $info = new ezmlm_threads();
113
            if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
114
            $this->_url->addQueryString(PROJET_VARIABLE_ACTION, $this->_action) ;
115
            $info->forcehref = $this->_url->getURL();
116
            $info->listdir = $liste->listdir ;
117
            $info->listname = $info_liste->getNom();
118
            $info->listdomain = $info_liste->getDomaine() ;
119
            if (!$info->listmessages()) {
120
                if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
121
            }
122
 
123
            $this->_url->addQueryString(PROJET_VARIABLE_ACTION, $this->_action) ;
124
 
125
            // On teste si l'on vient d'une réponse à un email, si oui
126
            // on modifie $liste->action pour renvoyer le message auquelon vient de répondre
127
            if (isset($_POST['messageid'])) {
128
                $liste->action = 'show_msg' ;
129
            }
130
            switch ($liste->action) {
131
                case "show_msg":
132
                    if (count($liste->actionargs) < 2) {
133
                        $liste->error(EZMLM_INVALID_SYNTAX,TRUE);
134
                    }
135
                    $show_msg = new ezmlm_msgdisplay();
136
                    $show_msg->listdir = $liste->listdir ;
137
                    $show_msg->forcehref = $this->_url->getURL();
138
                    $show_msg->listname = $info_liste->getNom() ;
139
                    $show_msg->_auth = & $this->_auth ;
140
                    // actionargs[0] contient le nom du répertoire et actionargs[1] le nom du fichier
141
                    // On appelle la fonction qui affiche un fichier
142
                    print'<h2>'.PROJET_DERNIERS_MESSAGES.'</h2>'."\n" ;
143
                    $show_msg->display($liste->actionargs[0] . "/" . $liste->actionargs[1]);
144
                    break;
145
 
146
                case "list_info":
147
                    $info = new ezmlm_listinfo();
148
 
149
                    if (!$info) print 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
150
                    $info->forcehref = $this->_url->getURL();
151
                    $info->listdir = $liste->listdir ;
152
                    $info->listname = $info_liste->getNom();
153
                    $info->listdomain = $info_liste->getDomaine() ;
154
                    print'<h2>'.PROJET_DERNIERS_MESSAGES.'</h2>'."\n" ;
155
                    if (!$info->show_recentmsgs()) {
156
                        echo 'Pas de message dans cette liste' ;
157
                    }
158
                    break;
159
                case "show_threads":
160
                    $threads = new ezmlm_threads();
161
                    $this->_url->addQueryString(PROJET_VARIABLE_ACTION, $this->_action) ;
162
                    $threads->forcehref = $this->_url->getURL() ;
163
                    $threads->listdir = $liste->listdir ;
164
                    $threads->listname = $info_liste->getNom() ;
165
                    $threads->listdomain = $info_liste->getDomaine() ;
166
                    $threads->tempdir = PROJET_CHEMIN_APPLI.'/tmp' ;
167
                    $threads->load($liste->actionargs[0]);
168
                    break;
169
                case "show_author_msgs" :
170
                    $author = new ezmlm_author();
171
                    $author->listdir = $liste->listdir ;
172
                    $author->listname = $info_liste->getNom() ;
173
                    $author->listdomain = $info_liste->getDomaine() ;
174
                    $author->forcehref = $this->_url->getURL() ;
175
                    $author->display($liste->actionargs[0]);
176
                    break;
177
                break ;
178
                case 'show_month' :
179
                    $info = new ezmlm_listinfo();
180
                    if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
181
                    $info->forcehref = $this->_url->getURL();
182
                    $info->listdir = $liste->listdir ;
183
                    $info->listname = $info_liste->getNom();
184
                    $info->listdomain = $info_liste->getDomaine() ;
185
                    echo '[ '.$info->makelink('action=show_threads&amp;actionargs[]='.$liste->actionargs[0], 'par fil de discussion').' ]' ;
186
                    print'<h2>'.PROJET_MESSAGE_DU_MOIS.$GLOBALS['mois'][((int)substr($liste->actionargs[0],4,2) / 1)-1] .', ' .
187
                                                                substr($liste->actionargs[0],0,4). '</h2>'."\n" ;
188
                    if (!$info->show_month($liste->actionargs[0])) {
189
                        echo 'Pas de message dans cette liste' ;
190
                    }
191
                break;
192
                case 'repondre' :
193
                    if (count($liste->actionargs) < 2) {
194
                        $liste->error(EZMLM_INVALID_SYNTAX,TRUE);
195
                    }
196
                    $repondre = new ezmlm_repondre();
197
                    $repondre->listdir = $liste->listdir ;
198
                    $this->_url->removeQueryString (PROJET_VARIABLE_ACTION) ;
199
                    $repondre->forcehref = $this->_url->getURL();
200
                    $repondre->listname = $info_liste->getNom() ;
201
                    // actionargs[0] contient le nom du répertoire et actionargs[1] le nom du fichier
202
                    // On appelle la fonction qui affiche un fichier
203
                    print'<h2>'.PROJET_REDIGER_REPONSE.'</h2>'."\n" ;
204
                    $repondre->repondre($liste->actionargs[0] . "/" . $liste->actionargs[1]);
205
                    break;
206
            }
207
 
208
        } else {
209
            print PROJET_MESSAGE_LISTE_PRIVEE ;
210
        }
211
        $sortie_liste = ob_get_contents() ;
212
        ob_end_clean() ;
213
    }
214
}
215
 
216
include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php' ;
217
$listes_ext = new liste_externe ($this->_db) ;
218
$tableau_liste = $listes_ext->getListesAssociees($this->_id_projet) ;
219
 
220
if (count ($tableau_liste) != 0) {
221
    //$liste_ext_res .= '<h2>'.PROJET_LISTES_ASSOCIEES.'</h2>'."\n" ;
222
    for ($i = 0; $i < count ($tableau_liste); $i++) {
223
        $info_liste = $listes_ext->getInfoListe($tableau_liste[$i]) ;
224
        $liste_ext_res .= '<p><a href="'.$info_liste->AGO_A_URLGRP.'">'.$info_liste->AGO_A_URLGRP.'</a></p>'."\n" ;
225
        $liste_ext_res .= '<br />'."\n" ;
226
    }
227
}
228
 
229
$retour .= '<h1>'.PROJET_PROJET.' : '.$projet->getTitre()."</h1>" ;
33 alexandre_ 230
$retour .= $inscription_laius ;
2 ddelon 231
$retour .= '<h2>'.PROJET_ADRESSE_ECRIRE.'</h2>'."\n" ;
33 alexandre_ 232
 
2 ddelon 233
$retour .= $sortie_liste ;
234
$retour .= $liste_ext_res ;
235
?>