Subversion Repositories Applications.papyrus

Rev

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

Rev Author Line No. Line
433 ddelon 1
<?php
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */
3
// +------------------------------------------------------------------------------------------------------+
4
// | PHP version 4.1                                                                                      |
5
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (C) 2005 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +------------------------------------------------------------------------------------------------------+
8
// | This file is part of Integrateur Wikini.                                                             |
9
// |                                                                                                      |
10
// | Foobar is free software; you can redistribute it and/or modify                                       |
11
// | it under the terms of the GNU General Public License as published by                                 |
12
// | the Free Software Foundation; either version 2 of the License, or                                    |
13
// | (at your option) any later version.                                                                  |
14
// |                                                                                                      |
15
// | Foobar is distributed in the hope that it will be useful,                                            |
16
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
17
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                        |
18
// | GNU General Public License for more details.                                                         |
19
// |                                                                                                      |
20
// | You should have received a copy of the GNU General Public License                                    |
21
// | along with Foobar; if not, write to the Free Software                                                |
22
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
23
// +------------------------------------------------------------------------------------------------------+
434 ddelon 24
// CVS : $Id: integrateur_wikini.php,v 1.2 2005-08-25 08:59:12 ddelon Exp $
433 ddelon 25
/**
26
* Integrateur de page Wikini
27
*
28
* Application permettant d'intégrer des pages wikini dans Papyrus.
29
*
30
*@package IntegrateurWikini
31
//Auteur original :
32
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
33
//Autres auteurs :
34
*@author        Aucun
35
*@copyright     Tela-Botanica 2000-2004
434 ddelon 36
*@version       $Revision: 1.2 $ $Date: 2005-08-25 08:59:12 $
37
*
433 ddelon 38
// +------------------------------------------------------------------------------------------------------+
39
// |                                            ENTETE du PROGRAMME                                       |
40
// +------------------------------------------------------------------------------------------------------+
41
/** Inclusion de la classe PEAR de gestion des URL. */
42
require_once 'Net/URL.php';
43
/** Inclusion du fichier de configuration général de IntegrateurWikini.*/
44
require_once 'client'.GEN_SEP.'integrateur_wikini'.GEN_SEP.'configuration'.GEN_SEP.'iw_config.inc.php';
45
 
46
/** Inclusion du fichier permettant d'encoder du texte mais pas les balises XHTML.*/
47
require_once IW_CHEMIN_BIBLIO.'iw_encodage.fonct.php';
48
/** Inclusion du fichier permettant d'inclure les données dans du XHTML.*/
49
require_once IW_CHEMIN_BIBLIO.'iw_affichage_xhtml.fonct.php';
50
 
434 ddelon 51
global $wiki;
52
global $wiki_p;
433 ddelon 53
 
434 ddelon 54
if ( ! isset( $_REQUEST['wiki'] ) ) {
55
    $_REQUEST['wiki'] = $GLOBALS['_GEN_commun']['info_application']->page;
56
}
57
 
58
$server=$_SERVER['PHP_SELF'];
59
$_SERVER['PHP_SELF']="wakka.php";
60
 
61
// Utilise le wakkaconfig de la racine ...
62
// TODO : generer un wakkaconfig en fonction des parametres, dans un temp et l'ecrire
63
// juste avant ... : bof (car conflits possibles).
64
// Ou alors : on utilise un wakkaconfig generique à minima ...
65
// Dans tous les cas, il faut gerer le WakaConfig Generique !
66
// Prevoir de revoir la contrib menu ... qui doit être switchable, ou plutot,
67
// Customiser son menu avec papyrus ...
68
 
69
ob_start();
70
include_once '/home/david/workspace/papyrus/wikini/wikini_01/wakka.php';
71
ob_end_clean();
72
 
73
$_SERVER['PHP_SELF']=$server;
74
 
75
 
76
// On surcharge la classe Wiki pour en faire ce qu'on en veut
77
Class Wiki_Papyrus extends Wiki {
78
    function Format($text, $formatter = "wakka") {
79
		return $this->IncludeBuffered("/home/david/workspace/papyrus/wikini/wikini_01/formatters/".$formatter.".php", "<i>Impossible de trouver le formateur \"$formatter\"</i>", compact("text"));
80
	}
81
	function Header() {
82
 
83
		$sortie='';
84
		$sortie.='<h1 class="wiki_name">';
85
		// Todo : Initialiser : wakka_nom
86
		$sortie.= $this->config["wakka_name"];
87
		$sortie.='</h1>';
88
		$sortie.='<h1 class="page_name">';
89
		$sortie.='<a href="';
90
		$sortie.=$this->config["base_url"];
91
		$sortie.='RechercheTexte&amp;phrase=';
92
		$sortie.=htmlentities($this->GetPageTag());
93
		$sortie.='">';
94
		$sortie.=htmlentities($this->GetPageTag());
95
		$sortie.='</a>';
96
		$sortie.='</h1>';
97
 
98
		$sortie.='<div class="header">';
99
		$sortie.= $this->ComposeLinkToPage($this->config["root_page"]).'::';
100
		$sortie.= $this->config["navigation_links"] ? $this->Format($this->config["navigation_links"])." :: \n" : "";
101
		$sortie.='Vous &ecirc;tes ';
102
		$sortie.= $this->Format($this->GetUserName());
103
		if ($user = $this->GetUser()) {
104
			$sortie.="(<a href=\"".$this->config["base_url"]."ParametresUtilisateur&amp;action=logout\">D&eacute;connexion</a>)\n";
105
		}
106
		$sortie.='</div>';
107
		return $sortie;
108
	}
109
 
110
	function Footer() {
111
		return;
112
	}
113
}
114
 
115
 
433 ddelon 116
// Appel du fichier de traduction des textes de l'application Integrateur Wikini
117
if (file_exists(IW_CHEMIN_LANGUES.'iw_langue_'.IW_I18N.'.inc.php')) {
118
    /** Inclusion du fichier de traduction de l'application Integrateur Wikini. */
119
    include_once IW_CHEMIN_LANGUES.'iw_langue_'.IW_I18N.'.inc.php';
120
} else {
121
    /** Inclusion du fichier de traduction fr par défaut. */
122
    include_once IW_CHEMIN_LANGUES.'iw_langue_fr.inc.php';
123
}
434 ddelon 124
 
125
 
433 ddelon 126
// +------------------------------------------------------------------------------------------------------+
127
// |                                            CORPS du PROGRAMME                                        |
128
// +------------------------------------------------------------------------------------------------------+
129
/** Fonction afficherContenuCorps() - Fonction appelé par le gestionnaire Papyrus.
130
*
131
* Elle retourne le contenu de l'application.
132
*
133
* @return  string  du code XHTML correspondant au contenu renvoyé par l'application.
134
*/
135
function afficherContenuCorps()
136
{
434 ddelon 137
	global $wiki;
138
 
139
	$sortie='';
140
 
433 ddelon 141
    $wakkaConfig = $GLOBALS['wikini_config_defaut'];
434 ddelon 142
    $wiki  = new Wiki_Papyrus($wakkaConfig);
143
 
144
	// Gestion de la variable de session "linktracking"
433 ddelon 145
    if ( ! isset( $_SESSION['linktracking'] ) ) {
146
        $_SESSION['linktracking'] = 1;
147
    }
434 ddelon 148
 
433 ddelon 149
    // Suppression des slash.
434 ddelon 150
    $_REQUEST['wiki'] = preg_replace("/^\//", '',  $_REQUEST['wiki']);
151
 
433 ddelon 152
    // split into page/method
434 ddelon 153
    if ( preg_match( "#^(.+?)/(.*)$#",  $_REQUEST['wiki'], $matches ) ) {
433 ddelon 154
        list(, $page, $method) = $matches;
434 ddelon 155
    } else if ( preg_match( "#^(.*)$#",  $_REQUEST['wiki'], $matches ) ) {
433 ddelon 156
        list(, $page) = $matches;
157
    }
158
 
159
    // Vérification de la méthode d'affichage employée!
160
    if ( ! isset( $method ) ) {
161
        $method = '';
162
    }
434 ddelon 163
 
433 ddelon 164
    //Récupération du contenu de la page Wikini
165
 
434 ddelon 166
    ob_start();
167
 
168
    $server=$_SERVER['PHP_SELF'];
169
	$_SERVER['PHP_SELF']="wakka.php";
170
 
171
	$wiki->Run($page, $method);
172
 
173
    $_SERVER['PHP_SELF']=$server;
174
 
175
    $sortie.= ob_get_contents();
176
    ob_end_clean();
177
 
178
 
179
 
180
	return remplacerEntiteHTLM("<div id=\"wikini_page\" ondblclick=\"document.location='".$wiki->href("edit")."';"."\">"."\n".$sortie.'</div>'."\n");
181
 
182
 
433 ddelon 183
}
184
 
434 ddelon 185
 
186
// TODO : qu'affiche-t-on en pied ?
433 ddelon 187
/** Fonction afficherContenuPied() - Fonction appelé par le gestionnaire Papyrus.
188
*
189
* Elle retourne le pied de l'application.
190
*
191
* @return  string  du code XHTML correspondant au pied renvoyé par l'application.
192
*/
193
function afficherContenuPied()
194
{
195
    return inclusion_html('pied_page');
196
}
197
?>