Subversion Repositories Applications.projet

Rev

Rev 11 | Go to most recent revision | Details | 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
// +------------------------------------------------------------------------------------------------------+
22
// CVS : $Id: forums.php,v 1.1 2005-09-22 14:02:49 ddelon Exp $
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
34
*@version       $Revision: 1.1 $
35
// +------------------------------------------------------------------------------------------------------+
36
*/
37
 
38
// +------------------------------------------------------------------------------------------------------+
39
// |                                            ENTETE du PROGRAMME                                       |
40
// +------------------------------------------------------------------------------------------------------+
41
 
42
include_once (PROJET_CHEMIN_CLASSES.'HTML_formulaireMail.php') ;
43
 
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
 
70
        if ($info_liste->isPublic() || $droits <= PROJET_DROIT_CONTRIBUTEUR) {
71
            $liste = new ezmlm_php() ;
72
            // Paramétrage de la liste
73
 
74
            $liste->listdir = PROJET_CHEMIN_LISTES.$info_liste->getDomaine().'/'.$info_liste->getNom();
75
            $liste->listname = $info_liste->getNom() ;
76
            $liste->listdomain = $info_liste->getDomaine();
77
 
78
            if (isset ($GLOBALS['action']) && $GLOBALS['action'] != '') {
79
                $liste->set_action($GLOBALS['action']) ;
80
                $liste->set_actionargs($GLOBALS['actionargs']) ;
81
            } else {
82
                $liste->set_action('list_info') ;
83
            }
84
            $liste->sendheaders	= false;
85
            $liste->sendbody        = false;
86
            $liste->sendfooters    = false;
87
            $liste->forcehref = $this->_url->getURL() ;
88
 
89
 
90
            print '<a href="mailto:'.$info_liste->getAdresseEnvoi().'">' . $info_liste->getAdresseEnvoi() ;
91
            print "</a><br />\n";
92
 
93
            print '<h2>'.PROJET_TOUS_LES_MESSAGES.'</h2>'."\n";
94
            $info = new ezmlm_threads();
95
            if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
96
            $this->_url->addQueryString(PROJET_VARIABLE_ACTION, $this->_action) ;
97
            $info->forcehref = $this->_url->getURL();
98
            $info->listdir = $liste->listdir ;
99
            $info->listname = $info_liste->getNom();
100
            $info->listdomain = $info_liste->getDomaine() ;
101
            if (!$info->listmessages()) {
102
                if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
103
            }
104
 
105
            $this->_url->addQueryString(PROJET_VARIABLE_ACTION, $this->_action) ;
106
 
107
            // On teste si l'on vient d'une réponse à un email, si oui
108
            // on modifie $liste->action pour renvoyer le message auquelon vient de répondre
109
            if (isset($_POST['messageid'])) {
110
                $liste->action = 'show_msg' ;
111
            }
112
            switch ($liste->action) {
113
                case "show_msg":
114
                    if (count($liste->actionargs) < 2) {
115
                        $liste->error(EZMLM_INVALID_SYNTAX,TRUE);
116
                    }
117
                    $show_msg = new ezmlm_msgdisplay();
118
                    $show_msg->listdir = $liste->listdir ;
119
                    $show_msg->forcehref = $this->_url->getURL();
120
                    $show_msg->listname = $info_liste->getNom() ;
121
                    $show_msg->_auth = & $this->_auth ;
122
                    // actionargs[0] contient le nom du répertoire et actionargs[1] le nom du fichier
123
                    // On appelle la fonction qui affiche un fichier
124
                    print'<h2>'.PROJET_DERNIERS_MESSAGES.'</h2>'."\n" ;
125
                    $show_msg->display($liste->actionargs[0] . "/" . $liste->actionargs[1]);
126
                    break;
127
 
128
                case "list_info":
129
                    $info = new ezmlm_listinfo();
130
 
131
                    if (!$info) print 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
132
                    $info->forcehref = $this->_url->getURL();
133
                    $info->listdir = $liste->listdir ;
134
                    $info->listname = $info_liste->getNom();
135
                    $info->listdomain = $info_liste->getDomaine() ;
136
                    print'<h2>'.PROJET_DERNIERS_MESSAGES.'</h2>'."\n" ;
137
                    if (!$info->show_recentmsgs()) {
138
                        echo 'Pas de message dans cette liste' ;
139
                    }
140
                    break;
141
                case "show_threads":
142
                    $threads = new ezmlm_threads();
143
                    $this->_url->addQueryString(PROJET_VARIABLE_ACTION, $this->_action) ;
144
                    $threads->forcehref = $this->_url->getURL() ;
145
                    $threads->listdir = $liste->listdir ;
146
                    $threads->listname = $info_liste->getNom() ;
147
                    $threads->listdomain = $info_liste->getDomaine() ;
148
                    $threads->tempdir = PROJET_CHEMIN_APPLI.'/tmp' ;
149
                    $threads->load($liste->actionargs[0]);
150
                    break;
151
                case "show_author_msgs" :
152
                    $author = new ezmlm_author();
153
                    $author->listdir = $liste->listdir ;
154
                    $author->listname = $info_liste->getNom() ;
155
                    $author->listdomain = $info_liste->getDomaine() ;
156
                    $author->forcehref = $this->_url->getURL() ;
157
                    $author->display($liste->actionargs[0]);
158
                    break;
159
                break ;
160
                case 'show_month' :
161
                    $info = new ezmlm_listinfo();
162
                    if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
163
                    $info->forcehref = $this->_url->getURL();
164
                    $info->listdir = $liste->listdir ;
165
                    $info->listname = $info_liste->getNom();
166
                    $info->listdomain = $info_liste->getDomaine() ;
167
                    echo '[ '.$info->makelink('action=show_threads&amp;actionargs[]='.$liste->actionargs[0], 'par fil de discussion').' ]' ;
168
                    print'<h2>'.PROJET_MESSAGE_DU_MOIS.$GLOBALS['mois'][((int)substr($liste->actionargs[0],4,2) / 1)-1] .', ' .
169
                                                                substr($liste->actionargs[0],0,4). '</h2>'."\n" ;
170
                    if (!$info->show_month($liste->actionargs[0])) {
171
                        echo 'Pas de message dans cette liste' ;
172
                    }
173
                break;
174
                case 'repondre' :
175
                    if (count($liste->actionargs) < 2) {
176
                        $liste->error(EZMLM_INVALID_SYNTAX,TRUE);
177
                    }
178
                    $repondre = new ezmlm_repondre();
179
                    $repondre->listdir = $liste->listdir ;
180
                    $this->_url->removeQueryString (PROJET_VARIABLE_ACTION) ;
181
                    $repondre->forcehref = $this->_url->getURL();
182
                    $repondre->listname = $info_liste->getNom() ;
183
                    // actionargs[0] contient le nom du répertoire et actionargs[1] le nom du fichier
184
                    // On appelle la fonction qui affiche un fichier
185
                    print'<h2>'.PROJET_REDIGER_REPONSE.'</h2>'."\n" ;
186
                    $repondre->repondre($liste->actionargs[0] . "/" . $liste->actionargs[1]);
187
                    break;
188
            }
189
 
190
        } else {
191
            print PROJET_MESSAGE_LISTE_PRIVEE ;
192
        }
193
        $sortie_liste = ob_get_contents() ;
194
        ob_end_clean() ;
195
    }
196
}
197
 
198
include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php' ;
199
$listes_ext = new liste_externe ($this->_db) ;
200
$tableau_liste = $listes_ext->getListesAssociees($this->_id_projet) ;
201
 
202
if (count ($tableau_liste) != 0) {
203
    //$liste_ext_res .= '<h2>'.PROJET_LISTES_ASSOCIEES.'</h2>'."\n" ;
204
    for ($i = 0; $i < count ($tableau_liste); $i++) {
205
        $info_liste = $listes_ext->getInfoListe($tableau_liste[$i]) ;
206
        $liste_ext_res .= '<p><a href="'.$info_liste->AGO_A_URLGRP.'">'.$info_liste->AGO_A_URLGRP.'</a></p>'."\n" ;
207
        $liste_ext_res .= '<br />'."\n" ;
208
    }
209
}
210
 
211
$retour .= '<h1>'.PROJET_PROJET.' : '.$projet->getTitre()."</h1>" ;
212
$retour .= '<h2>'.PROJET_ADRESSE_ECRIRE.'</h2>'."\n" ;
213
$retour .= $sortie_liste ;
214
$retour .= $liste_ext_res ;
215
?>