Subversion Repositories Applications.papyrus

Compare Revisions

Ignore whitespace Rev 1150 → Rev 1144

/trunk/api/text/wiki_papyrus/Papyrus.class.php
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: Papyrus.class.php,v 1.12 2006-12-12 17:16:52 jp_milcent Exp $
// CVS : $Id: Papyrus.class.php,v 1.11 2006-12-12 13:33:57 jp_milcent Exp $
/**
* Classe configurant le formatage pour Papyrus.
*
36,7 → 36,7
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.12 $ $Date: 2006-12-12 17:16:52 $
*@version $Revision: 1.11 $ $Date: 2006-12-12 13:33:57 $
// +------------------------------------------------------------------------------------------------------+
*/
 
72,6 → 72,7
*
*/
var $rules = array(
'Nouveaute', // Action Nouveaute
'Plan', // Action Plan
'Syndication', // Action Syndication
'Redirection' // Action Redirection
281,9 → 282,6
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.11 2006/12/12 13:33:57 jp_milcent
* Suppression de l'action MotCles transformée en Applette.
*
* Revision 1.10 2006/12/08 20:16:27 jp_milcent
* Suppression de l'action Lien remplacée par une applette.
*
/trunk/api/text/wiki_papyrus/Render/Xhtml/Nouveaute.php
New file
0,0 → 1,164
<?php
 
class Text_Wiki_Render_Xhtml_Nouveaute extends Text_Wiki_Render {
/**
*
* Renders a token into text matching the requested format.
*
* @access public
*
* @param array $options The "options" portion of the token (second
* element).
*
* @return string The text rendered from the token options.
*
*/
function token($options)
{
// Initialisation des variables
$sortie = '';
$type = '';
$site = '';
$nombre = $options['nombre'];
// Récupération du type
if (isset($options['type'])) {
$type = $options['type'];
}
// Récupération du site
if (isset($options['site'])) {
$site = $options['site'];
}
// Récupération de la catégorie
if (isset($options['categorie'])) {
$categorie = $options['categorie'];
}
$aso_info_menu = GEN_lireInfoMenuContenuDate($GLOBALS['_GEN_commun']['pear_db'], $type, $site, $categorie);
// Formatage des infos en XHTML
$sortie .= '<ul class="page_liste">'."\n";
$i = 0;
foreach ($aso_info_menu as $menu_id => $un_menu) {
if ($i == $nombre) {
break;
}
// Création de l'url
$une_url =& new Pap_URL();
$une_url->setId($menu_id);
// Début affichage d'une entrée de la liste des pages modifiées
if ($un_menu->gmc_ce_type_modification = 1) {
$type_modif = 'mineure';
} elseif ($un_menu->gmc_ce_type_modification = 2) {
$type_modif = 'majeure';
}
$sortie .= '<li class="page_modification_'.$type_modif.'">'."\n";
// Affichage du titre
$sortie .= '<h2 class="page_titre"><a href="'.$une_url->getURL().'">';
if (!empty($un_menu->gm_titre)) {
$sortie .= $un_menu->gm_titre;
} elseif (!empty($un_menu->gm_titre_alternatif)) {
$sortie .= $un_menu->gm_titre_alternatif;
} else {
$sortie .= $un_menu->gm_nom;
}
$sortie .= '</a></h2>'."\n".'<dl>'."\n";
// Affichage de l'auteur(s)
if (!empty($un_menu->gm_auteur)) {
$sortie .= '<dt class="page_auteur"> Auteur(s)&nbsp;: '.'</dt>'."\n";
$sortie .= '<dd>'.$un_menu->gm_auteur.'</dd>'."\n";
}
// Affichage des contributeur(s)
if (!empty($un_menu->gm_contributeur)) {
$sortie .= '<dt class="page_contributeur"> Contributeur(s)&nbsp;: '.'</dt>'."\n";
$sortie .= '<dd>'.$un_menu->gm_contributeur.'</dd>'."\n";
}
// Affichage de la date de la modification de la page
$sortie .= '<dt class="page_modification_date"> '.'Modifié le&nbsp;: '.'</dt>'."\n";
$sortie .= '<dd>'."\n";
if (($jour = date('d', strtotime($un_menu->gmc_date_modification)) ) != 0 ) {
$sortie .= '<span class="page_modification_jour"> '.$jour.'</span>'."\n";
}
if (($mois = $this->_traduireMois(date('m', strtotime($un_menu->gmc_date_modification))) ) != '' ) {
$sortie .= '<span class="page_modification_mois"> '.$mois.'</span>'."\n";
}
if (($annee = date('Y', strtotime($un_menu->gmc_date_modification)) ) != 0 ) {
$sortie .= '<span class="page_modification_annee"> '.$annee.'</span>'."\n";
}
$sortie .= '<span class="page_separateur_date_heure"> - </span>'."\n";
// Affichage de l'horaire de la modification de la page
if (($heure = date('G', strtotime($un_menu->gmc_date_modification)) ) != 0 ) {
$sortie .= '<span class="page_modification_heure">'.$heure.'</span>';
$sortie .= '<span class="page_separateur_heure">:</span>';
$minute = date('i', strtotime($un_menu->gmc_date_modification));
$sortie .= '<span class="page_modification_minute">'.$minute.'</span>'."\n";
/*
if (($seconde = date('s', strtotime($un_menu->gm_date_creation)) ) != 0 ) {
$sortie .= '<span class="page_separateur_heure">:</span>';
$sortie .= '<span class="page_creation_seconde">'.$seconde.'</span>';
}
*/
}
$sortie .= '</dd>'."\n";
// Affichage de la description
if (!empty($un_menu->gm_description_libre)) {
$sortie .= '<dt class="page_description"> Description&nbsp;: '.'</dt>'."\n";
$sortie .= '<dd>'.$un_menu->gm_description_libre.'</dd>'."\n";
}
// Affichage du résumé de la modification
if (!empty($un_menu->gmc_resume_modification)) {
$sortie .= '<dt class="page_resumer_modification_'.$type_modif.'"> Résumer modification&nbsp;: '.'</dt>'."\n";
$sortie .= '<dd>'.$un_menu->gmc_resume_modification.'</dd>'."\n";
}
$sortie .= '</dl>'."\n";
$sortie .= '</li>'."\n";
$i++;
}
$sortie .= '</ul>'."\n";
return $sortie;
}
function _traduireMois($mois_numerique)
{
switch ($mois_numerique) {
case '01' :
return 'janvier';
case '02' :
return 'février';
case '03' :
return 'mars';
case '04' :
return 'avril';
case '05' :
return 'mai';
case '06' :
return 'juin';
case '07' :
return 'juillet';
case '08' :
return 'août';
case '09' :
return 'septembre';
case '10' :
return 'octobre';
case '11' :
return 'novembre';
case '12' :
return 'décembre';
default:
return '';
}
}
}
?>
/trunk/api/text/wiki_papyrus/Parse/Nouveaute.php
New file
0,0 → 1,48
<?php
// $Id: Nouveaute.php,v 1.2 2005-07-08 15:16:54 alexandre_tb Exp $
 
 
/**
*
* This class implements a Text_Wiki_Parse to find source text marked as
* an Interwiki link. See the regex for a detailed explanation of the
* text matching procedure; e.g., "InterWikiName:PageName".
*
* @author Paul M. Jones <pmjones@ciaweb.net>
*
* @package Text_Wiki
*
*/
class Text_Wiki_Parse_Nouveaute extends Text_Wiki_Parse {
var $regex = '/\{\{Nouveaute nombre="([1-9][0-9]*)"(?: categorie="(.+?)"|)(?: type="(mineure|majeure)"|)(?: site="((?i:[,-]|\w|\s)+)"|)\}\}/';
/**
*
* Remplace l'action par une liste des dernières pages modifiées
* Les options sont:
*
* 'nombre' => le nombre de dernière page modifiée que l'on veut afficher
*
* @access public
*
* @param array &$matches The array of matches from parse().
*
* @return A delimited token to be used as a placeholder in
* the source text, plus any text priot to the match.
*
*/
function process(&$matches)
{
$options = array(
'nombre' => $matches[1],
'categorie' => $matches[2],
'type' => $matches[3],
'site' => $matches[4]
);
return $this->wiki->addToken($this->rule, $options);
}
}
?>