21,7 → 21,7 |
// | along with Foobar; if not, write to the Free Software | |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
// +------------------------------------------------------------------------------------------------------+ |
// CVS : $Id: integrateur_wikini.php,v 1.5 2005-09-09 09:37:17 ddelon Exp $ |
// CVS : $Id: integrateur_wikini.php,v 1.6 2005-09-14 09:12:15 ddelon Exp $ |
/** |
* Integrateur de page Wikini |
* |
33,7 → 33,7 |
//Autres auteurs : |
*@author Aucun |
*@copyright Tela-Botanica 2000-2004 |
*@version $Revision: 1.5 $ $Date: 2005-09-09 09:37:17 $ |
*@version $Revision: 1.6 $ $Date: 2005-09-14 09:12:15 $ |
* |
// +------------------------------------------------------------------------------------------------------+ |
// | ENTETE du PROGRAMME | |
83,6 → 83,7 |
// TODO : creation automatique des Wikis ... |
|
ob_start(); |
|
include_once IW_CHEMIN_WIKINI_COURANT.'wakka.php'; |
ob_end_clean(); |
$_SERVER['PHP_SELF']=$server; |
90,34 → 91,139 |
|
// On surcharge la classe Wiki pour en faire ce qu'on en veut |
Class Wiki_Papyrus extends Wiki { |
function Format($text, $formatter = "wakka") { |
return $this->IncludeBuffered(IW_CHEMIN_WIKINI_COURANT_FORMATTER.$formatter.".php", "<i>Impossible de trouver le formateur \"$formatter\"</i>", compact("text")); |
} |
|
|
//TODO : a gauche ! |
|
function Header() { |
|
return; |
} |
|
function Footer() { |
} |
|
function Footer() { |
return; |
} |
} |
|
function FormOpen($method = "", $tag = "", $formMethod = "post") { |
|
// Le diff ne fonctionne pas avec la methode get dans papyrus. On surcharge avec du post. |
|
function FormOpen($method = "", $tag = "", $formMethod = "post") { |
|
if (($method=="diff") && $formMethod=="get") { |
$formMethod="post"; |
} |
|
if ($method=="edit") { |
$result = "<form id=\"ACEditor\" name=\"ACEditor\" action=\"".$this->href($method, $tag)."\" method=\"".$formMethod."\">\n"; |
return $result; |
} |
|
// Appel methode parent |
return parent::FormOpen($method, $tag, $formMethod); |
return Parent::FormOpen($method,$tag, $formMethod); |
|
} |
// Detournement des handlers : comme ca on peut faire ce que l'on veut .... |
function Method($method) { |
|
if ($method=="edit") { |
|
echo $this->Header(); |
|
$result=''; |
|
if ($_POST) { |
if ($_POST["submit"] == "Sauver") { |
// check for overwriting |
if ($this->page) { |
if ($this->page["id"] != $_POST["previous"]) { |
$error = "ALERTE : ". |
"Cette page a été modifiée par quelqu'un d'autre pendant que vous l'éditiez.<br />\n". |
"Veuillez copier vos changements et rééditer cette page.\n"; |
} |
} |
// store |
if (!$error) { |
$body = str_replace("\r", "", $_POST["body"]); |
// test si la nouvelle page est differente de la précédente |
if(rtrim($body)==rtrim($this->page["body"])) { |
$this->SetMessage("Cette page n\'a pas été enregistrée car elle n\'a subi aucune modification."); |
$this->Redirect($this->href()); |
} |
|
// add page (revisions) |
$this->SavePage($this->tag, $body); |
|
// now we render it internally so we can write the updated link table. |
$this->ClearLinkTable(); |
$this->StartLinkTracking(); |
$dummy = $this->Header(); |
$dummy .= $this->Format($body); |
$dummy .= $this->Footer(); |
$this->StopLinkTracking(); |
$this->WriteLinkTable(); |
$this->ClearLinkTable(); |
|
// forward |
$this->Redirect($this->href()); |
} |
} |
} |
|
// fetch fields |
if (!$previous = $_POST["previous"]) $previous = $this->page["id"]; |
if (!$body = $_POST["body"]) $body = $this->page["body"]; |
|
// preview? |
if ($_POST["submit"] == "Aperçu") |
{ |
$result .= |
"<div class=\"prev_alert\"><strong>Aperçu</strong></div>\n". |
$this->Format($body)."\n\n". |
$this->FormOpen("edit"). |
"<input type=\"hidden\" name=\"previous\" value=\"".$previous."\" />\n". |
"<input type=\"hidden\" name=\"body\" value=\"".htmlentities($body)."\" />\n". |
"<br />\n". |
"<input name=\"submit\" type=\"submit\" value=\"Sauver\" accesskey=\"s\" />\n". |
"<input name=\"submit\" type=\"submit\" value=\"Rééditer \" accesskey=\"p\" />\n". |
"<input type=\"button\" value=\"Annulation\" onclick=\"document.location='".$this->href("")."';\" />\n". |
$this->FormClose()."\n"; |
return $result; |
} |
else |
{ |
|
require_once(IW_CHEMIN_BIBLIO_ACEDITOR."ACeditor.buttonsBar.php"); |
|
$result .= |
$this->FormOpen("edit"). |
"<input type=\"hidden\" name=\"previous\" value=\"".$previous."\" />\n".$ACbuttonsBar. |
"<textarea onkeydown=\"fKeyDown()\" name=\"body\" cols=\"60\" rows=\"40\" wrap=\"soft\" class=\"edit\">\n". |
htmlspecialchars($body). |
"\n</textarea><br />\n". |
($this->config["preview_before_save"] ? "" : "<input name=\"submit\" type=\"submit\" value=\"Sauver\" accesskey=\"s\" />\n"). |
"<input name=\"submit\" type=\"submit\" value=\"Aperçu\" accesskey=\"p\" />\n". |
"<input type=\"button\" value=\"Annulation\" onclick=\"document.location='".$this->href("")."';\" />\n". |
$this->FormClose(); |
|
return $result; |
} |
|
} |
else { |
return Parent::Method($method); |
} |
} |
|
|
// Surcharge Format a cause probleme de chemin. |
|
function Format($text, $formatter = "wakka") { |
return $this->IncludeBuffered(IW_CHEMIN_WIKINI_COURANT_FORMATTER.$formatter.".php", "<i>Impossible de trouver le formateur \"$formatter\"</i>", compact("text")); |
} |
|
|
} |
|
|
|
|
// Appel du fichier de traduction des textes de l'application Integrateur Wikini |
if (file_exists(IW_CHEMIN_LANGUES.'iw_langue_'.IW_I18N.'.inc.php')) { |
/** Inclusion du fichier de traduction de l'application Integrateur Wikini. */ |
199,7 → 305,9 |
function afficherContenuCorps() |
{ |
|
print "la"; |
// Ajout d'une feuille de style externe |
GEN_stockerStyleExterne ('wikini', 'client/integrateur_wikini/presentations/styles/wikini.css') ; |
|
// TODO |
// Changement du niveau d'erreur pour éviter les Notices PHP dues à Wikini |
// error_reporting(E_PARSE); |
249,8 → 357,8 |
// Retour au niveau d'erreur définit dans le fichier de config de Papyrus |
// error_reporting(GEN_DEBOGAGE_NIVEAU); |
|
return remplacerEntiteHTLM("<div id=\"wikini_page\" ondblclick=\"document.location='".$wiki->href("edit")."';"."\">"."\n".$sortie.'</div>'."\n"); |
|
//return remplacerEntiteHTLM("<div id=\"wikini_page\" onLoad=\"thisForm=document.ACEditor;\" ondblclick=\"document.location='".$wiki->href("edit")."';"."\">"."\n".$sortie.'</div>'."\n"); |
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"); |
|
} |
|