| Line 19... |
Line 19... |
| 19 |
// | |
|
19 |
// | |
|
| 20 |
// | You should have received a copy of the GNU General Public License |
|
20 |
// | You should have received a copy of the GNU General Public License |
|
| 21 |
// | along with Foobar; if not, write to the Free Software |
|
21 |
// | along with Foobar; if not, write to the Free Software |
|
| 22 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
22 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
| 23 |
// +------------------------------------------------------------------------------------------------------+
|
23 |
// +------------------------------------------------------------------------------------------------------+
|
| 24 |
// CVS : $Id: integrateur_wikini.php,v 1.5 2005-09-09 09:37:17 ddelon Exp $
|
24 |
// CVS : $Id: integrateur_wikini.php,v 1.6 2005-09-14 09:12:15 ddelon Exp $
|
| 25 |
/**
|
25 |
/**
|
| 26 |
* Integrateur de page Wikini
|
26 |
* Integrateur de page Wikini
|
| 27 |
*
|
27 |
*
|
| 28 |
* Application permettant d'intégrer des pages wikini dans Papyrus.
|
28 |
* Application permettant d'intégrer des pages wikini dans Papyrus.
|
| 29 |
*
|
29 |
*
|
| Line 31... |
Line 31... |
| 31 |
//Auteur original :
|
31 |
//Auteur original :
|
| 32 |
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
|
32 |
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
|
| 33 |
//Autres auteurs :
|
33 |
//Autres auteurs :
|
| 34 |
*@author Aucun
|
34 |
*@author Aucun
|
| 35 |
*@copyright Tela-Botanica 2000-2004
|
35 |
*@copyright Tela-Botanica 2000-2004
|
| 36 |
*@version $Revision: 1.5 $ $Date: 2005-09-09 09:37:17 $
|
36 |
*@version $Revision: 1.6 $ $Date: 2005-09-14 09:12:15 $
|
| 37 |
*
|
37 |
*
|
| 38 |
// +------------------------------------------------------------------------------------------------------+
|
38 |
// +------------------------------------------------------------------------------------------------------+
|
| 39 |
// | ENTETE du PROGRAMME |
|
39 |
// | ENTETE du PROGRAMME |
|
| 40 |
// +------------------------------------------------------------------------------------------------------+
|
40 |
// +------------------------------------------------------------------------------------------------------+
|
| Line 81... |
Line 81... |
| 81 |
// TODO : creation des tables par defaut à l'installation d'un wikini
|
81 |
// TODO : creation des tables par defaut à l'installation d'un wikini
|
| 82 |
// TODO : Fusion des fichiers de configuration ?
|
82 |
// TODO : Fusion des fichiers de configuration ?
|
| 83 |
// TODO : creation automatique des Wikis ...
|
83 |
// TODO : creation automatique des Wikis ...
|
| Line 84... |
Line 84... |
| 84 |
|
84 |
|
| - |
|
85 |
ob_start();
|
| 85 |
ob_start();
|
86 |
|
| 86 |
include_once IW_CHEMIN_WIKINI_COURANT.'wakka.php';
|
87 |
include_once IW_CHEMIN_WIKINI_COURANT.'wakka.php';
|
| 87 |
ob_end_clean();
|
88 |
ob_end_clean();
|
| Line 88... |
Line 89... |
| 88 |
$_SERVER['PHP_SELF']=$server;
|
89 |
$_SERVER['PHP_SELF']=$server;
|
| 89 |
|
90 |
|
| 90 |
|
- |
|
| 91 |
// On surcharge la classe Wiki pour en faire ce qu'on en veut
|
- |
|
| 92 |
Class Wiki_Papyrus extends Wiki {
|
- |
|
| Line -... |
Line 91... |
| - |
|
91 |
|
| 93 |
function Format($text, $formatter = "wakka") {
|
92 |
// On surcharge la classe Wiki pour en faire ce qu'on en veut
|
| Line 94... |
Line 93... |
| 94 |
return $this->IncludeBuffered(IW_CHEMIN_WIKINI_COURANT_FORMATTER.$formatter.".php", "<i>Impossible de trouver le formateur \"$formatter\"</i>", compact("text"));
|
93 |
Class Wiki_Papyrus extends Wiki {
|
| 95 |
}
|
- |
|
| 96 |
|
- |
|
| 97 |
//TODO : a gauche !
|
94 |
|
| 98 |
|
- |
|
| 99 |
function Header() {
|
95 |
|
| 100 |
return;
|
96 |
//TODO : a gauche !
|
| 101 |
}
|
97 |
|
| 102 |
|
98 |
function Header() {
|
| - |
|
99 |
|
| - |
|
100 |
return;
|
| Line 103... |
Line 101... |
| 103 |
function Footer() {
|
101 |
}
|
| - |
|
102 |
|
| - |
|
103 |
function Footer() {
|
| Line 104... |
Line 104... |
| 104 |
return;
|
104 |
return;
|
| 105 |
}
|
105 |
}
|
| 106 |
|
106 |
|
| - |
|
107 |
function FormOpen($method = "", $tag = "", $formMethod = "post") {
|
| - |
|
108 |
|
| - |
|
109 |
// Le diff ne fonctionne pas avec la methode get dans papyrus. On surcharge avec du post.
|
| - |
|
110 |
|
| - |
|
111 |
if (($method=="diff") && $formMethod=="get") {
|
| - |
|
112 |
$formMethod="post";
|
| - |
|
113 |
}
|
| Line 107... |
Line -... |
| 107 |
// Le diff ne fonctionne pas avec la methode get dans papyrus. On surcharge avec du post.
|
- |
|
| 108 |
|
- |
|
| 109 |
function FormOpen($method = "", $tag = "", $formMethod = "post") {
|
114 |
|
| - |
|
115 |
if ($method=="edit") {
|
| - |
|
116 |
$result = "<form id=\"ACEditor\" name=\"ACEditor\" action=\"".$this->href($method, $tag)."\" method=\"".$formMethod."\">\n";
|
| - |
|
117 |
return $result;
|
| - |
|
118 |
}
|
| - |
|
119 |
|
| - |
|
120 |
return Parent::FormOpen($method,$tag, $formMethod);
|
| - |
|
121 |
|
| - |
|
122 |
}
|
| - |
|
123 |
// Detournement des handlers : comme ca on peut faire ce que l'on veut ....
|
| - |
|
124 |
function Method($method) {
|
| - |
|
125 |
|
| - |
|
126 |
if ($method=="edit") {
|
| - |
|
127 |
|
| - |
|
128 |
echo $this->Header();
|
| - |
|
129 |
|
| - |
|
130 |
$result='';
|
| - |
|
131 |
|
| - |
|
132 |
if ($_POST) {
|
| - |
|
133 |
if ($_POST["submit"] == "Sauver") {
|
| - |
|
134 |
// check for overwriting
|
| - |
|
135 |
if ($this->page) {
|
| - |
|
136 |
if ($this->page["id"] != $_POST["previous"]) {
|
| - |
|
137 |
$error = "ALERTE : ".
|
| - |
|
138 |
"Cette page a été modifiée par quelqu'un d'autre pendant que vous l'éditiez.<br />\n".
|
| - |
|
139 |
"Veuillez copier vos changements et rééditer cette page.\n";
|
| - |
|
140 |
}
|
| - |
|
141 |
}
|
| - |
|
142 |
// store
|
| - |
|
143 |
if (!$error) {
|
| - |
|
144 |
$body = str_replace("\r", "", $_POST["body"]);
|
| - |
|
145 |
// test si la nouvelle page est differente de la précédente
|
| - |
|
146 |
if(rtrim($body)==rtrim($this->page["body"])) {
|
| - |
|
147 |
$this->SetMessage("Cette page n\'a pas été enregistrée car elle n\'a subi aucune modification.");
|
| - |
|
148 |
$this->Redirect($this->href());
|
| - |
|
149 |
}
|
| - |
|
150 |
|
| - |
|
151 |
// add page (revisions)
|
| - |
|
152 |
$this->SavePage($this->tag, $body);
|
| - |
|
153 |
|
| - |
|
154 |
// now we render it internally so we can write the updated link table.
|
| - |
|
155 |
$this->ClearLinkTable();
|
| - |
|
156 |
$this->StartLinkTracking();
|
| - |
|
157 |
$dummy = $this->Header();
|
| - |
|
158 |
$dummy .= $this->Format($body);
|
| - |
|
159 |
$dummy .= $this->Footer();
|
| - |
|
160 |
$this->StopLinkTracking();
|
| - |
|
161 |
$this->WriteLinkTable();
|
| - |
|
162 |
$this->ClearLinkTable();
|
| - |
|
163 |
|
| - |
|
164 |
// forward
|
| - |
|
165 |
$this->Redirect($this->href());
|
| - |
|
166 |
}
|
| - |
|
167 |
}
|
| - |
|
168 |
}
|
| - |
|
169 |
|
| - |
|
170 |
// fetch fields
|
| - |
|
171 |
if (!$previous = $_POST["previous"]) $previous = $this->page["id"];
|
| - |
|
172 |
if (!$body = $_POST["body"]) $body = $this->page["body"];
|
| - |
|
173 |
|
| - |
|
174 |
// preview?
|
| - |
|
175 |
if ($_POST["submit"] == "Aperçu")
|
| - |
|
176 |
{
|
| - |
|
177 |
$result .=
|
| - |
|
178 |
"<div class=\"prev_alert\"><strong>Aperçu</strong></div>\n".
|
| - |
|
179 |
$this->Format($body)."\n\n".
|
| - |
|
180 |
$this->FormOpen("edit").
|
| - |
|
181 |
"<input type=\"hidden\" name=\"previous\" value=\"".$previous."\" />\n".
|
| - |
|
182 |
"<input type=\"hidden\" name=\"body\" value=\"".htmlentities($body)."\" />\n".
|
| - |
|
183 |
"<br />\n".
|
| - |
|
184 |
"<input name=\"submit\" type=\"submit\" value=\"Sauver\" accesskey=\"s\" />\n".
|
| - |
|
185 |
"<input name=\"submit\" type=\"submit\" value=\"Rééditer \" accesskey=\"p\" />\n".
|
| - |
|
186 |
"<input type=\"button\" value=\"Annulation\" onclick=\"document.location='".$this->href("")."';\" />\n".
|
| - |
|
187 |
$this->FormClose()."\n";
|
| - |
|
188 |
return $result;
|
| - |
|
189 |
}
|
| - |
|
190 |
else
|
| - |
|
191 |
{
|
| - |
|
192 |
|
| - |
|
193 |
require_once(IW_CHEMIN_BIBLIO_ACEDITOR."ACeditor.buttonsBar.php");
|
| - |
|
194 |
|
| - |
|
195 |
$result .=
|
| - |
|
196 |
$this->FormOpen("edit").
|
| - |
|
197 |
"<input type=\"hidden\" name=\"previous\" value=\"".$previous."\" />\n".$ACbuttonsBar.
|
| - |
|
198 |
"<textarea onkeydown=\"fKeyDown()\" name=\"body\" cols=\"60\" rows=\"40\" wrap=\"soft\" class=\"edit\">\n".
|
| - |
|
199 |
htmlspecialchars($body).
|
| - |
|
200 |
"\n</textarea><br />\n".
|
| - |
|
201 |
($this->config["preview_before_save"] ? "" : "<input name=\"submit\" type=\"submit\" value=\"Sauver\" accesskey=\"s\" />\n").
|
| - |
|
202 |
"<input name=\"submit\" type=\"submit\" value=\"Aperçu\" accesskey=\"p\" />\n".
|
| - |
|
203 |
"<input type=\"button\" value=\"Annulation\" onclick=\"document.location='".$this->href("")."';\" />\n".
|
| - |
|
204 |
$this->FormClose();
|
| - |
|
205 |
|
| - |
|
206 |
return $result;
|
| - |
|
207 |
}
|
| - |
|
208 |
|
| - |
|
209 |
}
|
| - |
|
210 |
else {
|
| - |
|
211 |
return Parent::Method($method);
|
| - |
|
212 |
}
|
| - |
|
213 |
}
|
| - |
|
214 |
|
| 110 |
|
215 |
|
| Line -... |
Line 216... |
| - |
|
216 |
// Surcharge Format a cause probleme de chemin.
|
| 111 |
if (($method=="diff") && $formMethod=="get") {
|
217 |
|
| 112 |
$formMethod="post";
|
218 |
function Format($text, $formatter = "wakka") {
|
| 113 |
}
|
219 |
return $this->IncludeBuffered(IW_CHEMIN_WIKINI_COURANT_FORMATTER.$formatter.".php", "<i>Impossible de trouver le formateur \"$formatter\"</i>", compact("text"));
|
| 114 |
|
220 |
}
|
| 115 |
// Appel methode parent
|
221 |
|
| 116 |
return parent::FormOpen($method, $tag, $formMethod);
|
222 |
|
| Line 197... |
Line 303... |
| 197 |
* @return string du code XHTML correspondant au contenu renvoyé par l'application.
|
303 |
* @return string du code XHTML correspondant au contenu renvoyé par l'application.
|
| 198 |
*/
|
304 |
*/
|
| 199 |
function afficherContenuCorps()
|
305 |
function afficherContenuCorps()
|
| 200 |
{
|
306 |
{
|
| Line 201... |
Line 307... |
| 201 |
|
307 |
|
| - |
|
308 |
// Ajout d'une feuille de style externe
|
| - |
|
309 |
GEN_stockerStyleExterne ('wikini', 'client/integrateur_wikini/presentations/styles/wikini.css') ;
|
| 202 |
print "la";
|
310 |
|
| 203 |
// TODO
|
311 |
// TODO
|
| 204 |
// Changement du niveau d'erreur pour éviter les Notices PHP dues à Wikini
|
312 |
// Changement du niveau d'erreur pour éviter les Notices PHP dues à Wikini
|
| Line 205... |
Line 313... |
| 205 |
// error_reporting(E_PARSE);
|
313 |
// error_reporting(E_PARSE);
|
| Line 247... |
Line 355... |
| 247 |
|
355 |
|
| 248 |
// TODO
|
356 |
// TODO
|
| 249 |
// Retour au niveau d'erreur définit dans le fichier de config de Papyrus
|
357 |
// Retour au niveau d'erreur définit dans le fichier de config de Papyrus
|
| Line 250... |
Line 358... |
| 250 |
// error_reporting(GEN_DEBOGAGE_NIVEAU);
|
358 |
// error_reporting(GEN_DEBOGAGE_NIVEAU);
|
| 251 |
|
- |
|
| - |
|
359 |
|
| Line 252... |
Line 360... |
| 252 |
return remplacerEntiteHTLM("<div id=\"wikini_page\" ondblclick=\"document.location='".$wiki->href("edit")."';"."\">"."\n".$sortie.'</div>'."\n");
|
360 |
//return remplacerEntiteHTLM("<div id=\"wikini_page\" onLoad=\"thisForm=document.ACEditor;\" ondblclick=\"document.location='".$wiki->href("edit")."';"."\">"."\n".$sortie.'</div>'."\n");
|
| Line 253... |
Line 361... |
| 253 |
|
361 |
return remplacerEntiteHTLM("<script type=\"text/javascript\" src=\"".IW_CHEMIN_BIBLIO_ACEDITOR."ACeditor.js\"></script><div id=\"wikini_page\" ondblclick=\"document.location='".$wiki->href("edit")."';"."\">"."\n".$sortie.'</div>'."\n");
|