/branches/v4.0/wikini/maj_wikini/tools/templates/actions/header.php |
---|
New file |
0,0 → 1,88 |
<?php |
//=======Restes de wikini===================================================================================================== |
$message = $this->GetMessage(); |
$user = $this->GetUser(); |
//On r�cupere le template et on execute les actions wikini |
$template = file_get_contents('tools/templates/themes/'.$this->config['favorite_theme'].'/squelettes/'.$this->config['favorite_squelette'].'.tpl.html'); |
$template_decoupe = explode("{WIKINI_PAGE}", $template); |
if ($act=preg_match_all ("/".'(\\{\\{)'.'(.*?)'.'(\\}\\})'."/is", $template_decoupe[0], $matches)) { |
$i = 0; $j = 0; |
foreach($matches as $valeur) { |
foreach($valeur as $val) { |
if ($matches[2][$j]!='') { |
$action= $matches[2][$j]; |
$template=str_replace('{{'.$action.'}}', $this->Format('{{'.$action.'}}'), $template_decoupe[0]); |
} |
$j++; |
} |
$i++; |
} |
} |
//on utilise la bibliotheque pear template it pour gerer les variables dans la template |
require_once 'tools/templates/api/IT.php'; |
$tpl = new HTML_Template_IT('tools/templates/themes/'.$this->config['favorite_theme'].'/squelettes'); |
$tpl->setTemplate($template, true, true); |
//on assigne les valeurs aux variables du template |
//titre de la page |
$wikini_titre=$this->GetWakkaName().":".$this->GetPageTag(); |
$tpl->setVariable('WIKINI_TITRE', $wikini_titre); |
// meta robots |
if ($this->GetMethod() != 'show') $wikini_meta_robots="<meta name=\"robots\" content=\"noindex, nofollow\"/>\n"; |
if (isset($wikini_meta_robots)) $tpl->setVariable('WIKINI_META_ROBOTS', $wikini_meta_robots); |
//mots cles |
$wikini_mots_cles = $this->config['meta_keywords']; |
$tpl->setVariable('WIKINI_MOTS_CLES', $wikini_mots_cles); |
//description |
$wikini_description = $this->config['meta_description']; |
$tpl->setVariable('WIKINI_DESCRIPTION', $wikini_description); |
//feuilles de styles |
$wikini_styles_css = ''; |
if ($this->config['favorite_style']!='none') $wikini_styles_css .= '<link rel="stylesheet" type="text/css" href="tools/templates/themes/'.$this->config['favorite_theme'].'/styles/'.$this->config['favorite_style'].'" media="screen" title="'.$this->config['favorite_style'].'" />'."\n"; |
foreach($this->config['styles'] as $key => $value) { |
if($key !== $this->config['favorite_style'] && $key !== 'none') { |
$wikini_styles_css .= '<link rel="alternate stylesheet" type="text/css" href="tools/templates/themes/'.$this->config['favorite_theme'].'/styles/'.$key.'" media="screen" title="'.$value.'" />'."\n"; |
} |
} |
$tpl->setVariable('WIKINI_STYLES_CSS', $wikini_styles_css); |
//javascripts |
$wikini_javascripts = ''; |
$repertoire = 'tools/templates/themes/'.$this->config['favorite_theme'].'/javascripts'; |
$dir = opendir($repertoire); |
while (false !== ($file = readdir($dir))) { |
if (substr($file, -3, 3)=='.js') $scripts[] = '<script type="text/javascript" src="'.$repertoire.'/'.$file.'"></script>'."\n"; |
} |
asort($scripts); |
foreach ($scripts as $key => $val) { |
$wikini_javascripts .= "$val\n"; |
} |
closedir($dir); |
if ($wikini_javascripts!='') $tpl->setVariable('WIKINI_JAVASCRIPTS', $wikini_javascripts); |
//attributs du body |
$wikini_body = $message ? "onLoad=\"alert('".$message."');\" " : ""; |
$tpl->setVariable('WIKINI_BODY', $wikini_body); |
//nom du site |
$wikini_titre_site = $this->config["wakka_name"] ; |
$tpl->setVariable('WIKINI_TITRE_SITE', $wikini_titre_site); |
//remise a zero des styles css |
$wikini_resetstyle .= $this->href().'/resetstyle'; |
$tpl->setVariable('WIKINI_RESETSTYLE', $wikini_resetstyle); |
//javascript du double clic |
$wikini_double_clic = "ondblclick=\"document.location='".$this->href("edit")."';\" "; |
$tpl->setVariable('WIKINI_DOUBLE_CLIC', $wikini_double_clic); |
$plugin_output_new = $tpl->show(); |
/branches/v4.0/wikini/maj_wikini/tools/templates/actions/selecteur.php |
---|
New file |
0,0 → 1,71 |
<?php |
/* |
selecteur.php |
Code original de ce fichier : Florian SCHMITT |
Copyright (c) 2007, Florian SCHMITT <florian.schmitt@laposte.net> |
All rights reserved. |
Redistribution and use in source and binary forms, with or without |
modification, are permitted provided that the following conditions |
are met: |
1. Redistributions of source code must retain the above copyright |
notice, this list of conditions and the following disclaimer. |
2. Redistributions in binary form must reproduce the above copyright |
notice, this list of conditions and the following disclaimer in the |
documentation and/or other materials provided with the distribution. |
3. The name of the author may not be used to endorse or promote products |
derived from this software without specific prior written permission. |
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
/* Paramètres : |
-- type : type de selecteur: theme, style, ou squelette |
*******************************************************************************/ |
if (!defined("WIKINI_VERSION")) |
{ |
die ("accès direct interdit"); |
} |
$type = $this->GetParameter("type"); |
// Affichage de la page ou d'un message d'erreur |
if (empty($type)) { |
echo $this->Format("//Le paramètre \"type\" est manquant.//"); |
} elseif ($type=='squelette' || $type=='style' || $type=='theme' ) { |
$wikini_selecteur= '<div class="selecteur_'.$type.'"> |
<form action="" method="post"> |
<select name="'.$type.'" onchange="javascript:this.form.submit();">'; |
foreach($this->config[$type.'s'] as $key => $value) { |
if($key !== $this->config['favorite_'.$type]) { |
$wikini_selecteur .= '<option value="'.$key.'">'.$value.'</option>'."\n"; |
} |
else { |
$squelettes=$this->config[$type.'s']; |
$wikini_selecteur .= '<option value="'.$this->config['favorite_'.$type].'" selected="selected">'. $squelettes[$this->config['favorite_'.$type]].'</option>'."\n"; |
} |
} |
$wikini_selecteur .= '</select> |
<input type="submit" value="Changer le '.$type.'" /> |
</form> |
</div> <!--fin div selecteur_'.$type.'-->'; |
echo $wikini_selecteur; |
} |
else { |
echo $this->Format("//Le paramètre \"type\" ne contient pas les valeurs 'squelette', 'style' ou 'theme'.//"); |
} |
?> |
/branches/v4.0/wikini/maj_wikini/tools/templates/actions/footer.php |
---|
New file |
0,0 → 1,73 |
<?php |
//On recupere le template et on execute les actions wikini |
$template = file_get_contents('tools/templates/themes/'.$this->config['favorite_theme'].'/squelettes/'.$this->config['favorite_squelette'].'.tpl.html'); |
$template_decoupe = explode("{WIKINI_PAGE}", $template); |
if ($act=preg_match_all ("/".'(\\{\\{)'.'(.*?)'.'(\\}\\})'."/is", $template_decoupe[1], $matches)) { |
$i = 0; $j = 0; |
foreach($matches as $valeur) { |
foreach($valeur as $val) { |
if ($matches[2][$j]!='') { |
$action= $matches[2][$j]; |
$template_decoupe[1]=str_replace('{{'.$action.'}}', $this->Format('{{'.$action.'}}'), $template_decoupe[1]); |
} |
$j++; |
} |
$i++; |
} |
} |
//on utilise la bibliotheque pear template it pour gerer les variables dans la template |
require_once 'tools/templates/api/IT.php'; |
$tpl = new HTML_Template_IT('tools/templates/themes/'.$this->config['favorite_theme'].'/squelettes'); |
$tpl->setTemplate($template_decoupe[1], true, true); |
//action pour le footer de wikini |
$wikini_barre_bas = |
'<div class="footer">'."\n"; |
//echo $this->FormOpen("", "RechercheTexte", "get"); |
$wikini_barre_bas .= |
$this->FormOpen("", "RechercheTexte", "get")."\n"; |
if ( $this->HasAccess("write") ) { |
$wikini_barre_bas .= "<a href=\"".$this->href("edit")."\" title=\"Cliquez pour éditer cette page.\">Éditer cette page</a> ::\n"; |
} |
if ( $this->GetPageTime() ) { |
$wikini_barre_bas .= "<a href=\"".$this->href("revisions")."\" title=\"Cliquez pour voir les dernières modifications sur cette page.\">".$this->GetPageTime()."</a> ::\n"; |
} |
// if this page exists |
if ($this->page) |
{ |
// if owner is current user |
if ($this->UserIsOwner()) |
{ |
$wikini_barre_bas .= |
"Propriétaire : vous :: \n". |
"<a href=\"".$this->href("acls")."\" title=\"Cliquez pour éditer les permissions de cette page.\">Éditer permissions</a> :: \n". |
"<a href=\"".$this->href("deletepage")."\">Supprimer</a> :: \n"; |
} |
else |
{ |
if ($owner = $this->GetPageOwner()) |
{ |
$wikini_barre_bas .= "Propriétaire : ".$this->Format($owner); |
} |
else |
{ |
$wikini_barre_bas .= "Pas de propriétaire "; |
$wikini_barre_bas .= ($this->GetUser() ? "(<a href=\"".$this->href("claim")."\">Appropriation</a>)" : ""); |
} |
$wikini_barre_bas .= " :: \n"; |
} |
} |
$wikini_barre_bas .= |
'<a href="'.$this->href("referrers").'" title="Cliquez pour voir les URLs faisant référence à cette page.">'."\n". |
'Références</a> ::'."\n". |
'Recherche : <input name="phrase" size="15" class="searchbox" />'."\n". |
$this->FormClose()."\n". |
'</div>'."\n"; |
$tpl->setVariable('WIKINI_BARRE_BAS', $wikini_barre_bas); |
$tpl->setVariable('WIKINI_VERSION', $this->GetWikiNiVersion()); |
$plugin_output_new = $tpl->show(); |
?> |