WikiNi

ActionRssgp

PagePrincipale :: DerniersChangements :: DerniersCommentaires :: ParametresUtilisateur :: Vous êtes 38.107.191.105
ListeActions

Cette action permet de visualiser des items de fils RSS sous forme de carrés de couleurs associés à des mots-clé. Cette action est une expérimentation de YannLeGuennec et ne fait pas partie de la distribution officielle de wikini.




Le plugin se compose de plusieurs fichiers:

Codes sources:

actions/rssgp.php

<?php
/*
action rssgp pour wikini: affiche des carrés de couleurs correpondants à une analyse de fils RSS
Yann Le Guennec
v0.0.3
Licence Art Libre
dérivé de http://poietic-generator.net/ - Olivier Auber.

utilise wz_tooltip.js
http://www.walterzorn.com/tooltip/tooltip_e.htm

parametres:
- size: nombre de colonnes et lignes du carré global : il y a un fil RSS par ligne, le nombre de fils devrait donc être inférieur ou égal à size. Les fils supplémentaires ne sont pas traités.
- aff: affichage 100% ou taille fixe en pixel 
- limit : nombre d'item max par fil (vaut size par défaut)
- assoc: associations couleur|mot-clé séparés par des points virgules les couleurs prédéfinies sont: rouge, vert, bleu, jaune, fushia, cyan. On peut aussi utiliser des triplets rgb sous la forme r,g,b (valeurs numériques entre 0 et 255 séparées par des virgules). les associations sont traitées dans l'ordre, donc un item qui condiendra 2 mots-clés différents prendra la couleur du dernier mot trouvé dans la liste.
- rss: liste de fils RSS séparés par des points virgules
- refresh: temps de rafraichissement automatique en minutes
- field: permet de limiter la recherche sur un champ ("author","title","description")

*/

//mettre ici le chemin vers le fichier wz_tooltip.js sur votre serveur

define('WSTOOLTIP','http://exemple.tld/rssgp/wz_tooltip.js');

if (!
class_exists('RssReader')) {

Class 
RssReader {
    
    var 
$xml_file// url du fil RSS
    
var $host// nom de domaine du fil
    
var $xml_parser;
    var 
$data;
    var 
$fp;
    var 
$store;
    var 
$cur_tag
    var 
$cur_data
    var 
$cur_item
    var 
$color//couleur de l'item
    
var $lgd// mot clé associé à l'item
    
var $keywords//tableau d'associations couleurs/motsclés
    
    
var $html//resultat HTML
    
    
var $size;
    var 
$img_size;
    
    var 
$limit_item_feed//nombre de colonnes = nombre d'items par feed
    
var $limit_item_total//nombre total de cases, items

    
var $count_item_feed// compteur d'items affichés par feed
    
var $count_item_total// compteur total
    
var $tableau_couleur//associations noms de couleurs / couleurs rgb
    
    
var $aff// affichage 100% ou taille fixe
    
var $limit//nombre d'item max par feed
    
var $field//champ de recherche exclusif
    
    
function rssreader() {
        
$this->store FALSE;
        
$this->cur_item = array("title"=>"""link"=>"""description"=>"""date"=>"""author"=>"");
        
$this->html "";
        
$this->count_item_feed 0;
        
$this->count_item_total 0;
        
$this->tableau_couleur = array("bleu"=>"0,0,255""rouge"=>"255,0,0""vert"=>"0,225,0""jaune"=>"255,255,0""fushia"=>"255,0,255""cyan"=>"0,255,255");
        
$this->field "";
        return 
$this;
    }
    
    
//nombre de colonnes / lignes du carré global
    
function setSize($size) {
        
$this->size $size;
        
// le nombre total d'items est limité au nombre de cases du carré global donné par size
        
$this->limit_item_total $this->size $this->size
    }
    
    function 
getSize() {
        return 
$this->size;
    }
    
    
//taille du carré global pour affichage
    
function setAff($aff) {
        if(
$aff == "100%") {
            
$this->aff $aff;
            
$this->img_size floor(100/$this->size)."%"//setSize() doit être appelé avant
        
} else if (preg_match("'^[0-9]{1,3}$'"$aff)) {
            
$this->aff ceil($aff)."px";
            
$this->img_size floor($this->aff/$this->size)."px";
        } 
    }
    
    
//nombre limite d'item par feed
    
function setLimit($l) {
        if(
preg_match("'^[0-9]{1,3}$'"$l)) {
            
$this->limit_item_feed $l;
        } else {
            
$this->limit_item_feed $this->size;
        }
    }
    
    function 
setField($f) {
        
$this->field htmlentities($f);
    }
    
    function 
setKeywords($kw) {
        
// kw sous la forme 
        // bleu|ducamp;rouge|auber;jaune|guennec;fushia|bourguet;cyan|vodjdani;vert|constitution"
        // assoc de couleurs
        // on créé le tableau d'associations
        
$tab explode(";"$kw);
        foreach(
$tab as $t) {
            
$a explode("|"$t);
            
$col trim($a[0]); 
            
$k trim($a[1]); 
            
//couleur prédéfinie
            
if(isset($this->tableau_couleur[$col])) {
                
$this->keywords[$k] = "background-color:rgb(".$this->tableau_couleur[$col].")";
            
//couleur rgb sous la forme r,g,b    
            
} else if(preg_match("'^[0-9]{1,3},[0-9]{1,3},[0-9]{1,3}$'"$col)) {
                
$this->keywords[$k] = "background-color:rgb($col)";
            } else if(
preg_match("'^#[a-zA-Z0-9]{6}$'"$col)) {
                
$this->keywords[$k] = "background-color:$col";
            
//couleur par défaut    
            
} else {
                
$this->keywords[$k] = "background-color:rgb(0,0,0)";
            }
        }
        
//return $this;
    
}
    
    function 
getKeywords() {
        
$this->legende "";
        while(list(
$k,$v) = each($this->keywords)) {
            
$this->legende .= "<span style=\"color:rgb($v)\">$k</span> ";
        }
        
reset($this->keywords);
        return 
$this->legende;
    }
    
    function 
getColor() {
        
    }
    
    function 
startElement($parser$name$attribs) {
        if(
$name == "ITEM") {
            
$this->store TRUE;
        }
        
$this->cur_tag $name;
        
$this->cur_data "";
    }

    function 
endElement($parser$name) {
        if(
$name == "ITEM") {
            
$this->count_item_feed++;
            
//couleur par défaut de l'item
            
$this->color "background-color:rgb(210,210,210)";
            if(
is_array($this->keywords)) {
                
$this->lgd "";
                while( list(
$k$v) = each($this->keywords) ) {
                    
                    if( 
$this->field == "author" && eregi($k$this->cur_item['author']) || 
                     
$this->field == "title" && eregi($k$this->cur_item['title']) || 
                     
$this->field == "description" && eregi($k$this->cur_item['description']) 
                     ) {
                            
$this->color $v;
                            
$this->lgd $k;
                        
                    } else if (
$this->field == ""){
                    
                    
                        if(
eregi($k$this->cur_item['title']) || eregi($k$this->cur_item['author']) || eregi($k$this->cur_item['description']) ) {
                        
                            
$this->color $v;
                            
$this->lgd $k;
                        
                        } 
/*else {
                            
                        }*/
                    
}
                    
                    
// essai valeur de gris en fonction de la chaine auteur
                    // si couleur par défaut
                    
if($this->color == "background-color:rgb(210,210,210)")    {
                        
$str $this->cur_item['author'];
                        
$tot 0;
                        for (
$i=0$i strlen($str); $i++) {
                            
$nb ord(substr($str,$i));
                            
$tot += $nb;
                        }
                        
$nb2 $tot%255;
                        
$this->color "background-color:rgb($nb2, $nb2, $nb2)"
                     }  
                     
                     
                }
                
reset($this->keywords);
            } else {
                echo 
"<!-- debug:: not an array -->\n";
            }
            
            
/*
            
            */
            
            
if( $this->count_item_total<$this->limit_item_total && $this->count_item_feed<=$this->limit_item_feed ) {
                    
                    
$ptitle $this->host;
                    if(
$this->lgd != "") { 
                        
$ptitle .= "  (mot-cl&eacute;: $this->lgd) "//<span style=\"background-color:".$this->color."\">&nbsp;</span> 
                    
}
                    
$txt "<b>" addslashes(htmlentities($this->cur_item['title'])) . " </b>---  " addslashes(htmlentities($this->cur_item['author'])) . " (" htmlentities($this->cur_item['date']) . ")   " addslashes(htmlentities($this->cur_item['description']));
                    
$txt ereg_replace("\("""$txt);
                    
$txt ereg_replace("\)"""$txt);
                    
$txt preg_replace("'([\r\n])+'"""$txt);  
                    
$this->html .= "<a href=\"".$this->cur_item['link']."\" title=\"$txt\" onmouseover=\"this.T_TITLE='$ptitle';this.T_BGCOLOR='#E6FFFB';this.T_OFFSETX=20;this.T_OFFSETY=20;this.T_STICKY=1;return escape('$txt')\"><img style=\"width:".$this->img_size.";height:".$this->img_size.";border:none;".$this->color."\" src=\"/rssgp/transparentpixel.gif\" alt=\"\"></a>"//
                    
                    
$this->count_item_total++;
                    
                } else {
                    
//echo "debug::$this->count_item_total<=$this->limit_item_total && $this->count_item_feed<=$this->limit_item_feed<br>";
                
}

                
$this->cur_item['title'] = ''
                
$this->cur_item['link'] = ''
                
$this->cur_item['description'] = ''
                
$this->cur_item['date'] = ''
                
$this->cur_item['author'] = ''
                
$this->storeFALSE
            }
        }

        function 
characterData ($parser$data) {
            if(
$this->store == TRUE) {
                if(
$this->cur_tag == "TITLE") {
                    
$this->cur_item['title'] .= rtrim($data);
                }
                else if(
$this->cur_tag == "LINK") {
                    
$this->cur_item['link'] .= rtrim($data);
                }
                else if(
$this->cur_tag == "DESCRIPTION" || $this->cur_tag == "RDF:VALUE") { // sans doute pas la bonne place pour RDF:VALUE mais...
                    
$this->cur_item['description'] .=  $data//rtrim()
                
}
                else if(
$this->cur_tag == "DC:DATE") {
                    
$this->cur_item['date'] .=  $data;
                }
                else if(
$this->cur_tag == "DC:CONTRIBUTOR") {
                    
$this->cur_item['author'] .=  $data;
                }
            }
        }



        function 
parseRss($xml_file) {
            
$this->xml_file trim($xml_file);
            
$u parse_url($this->xml_file);
            
$this->host $u['host'];
            
$this->html "";
            
            if (
$this->count_item_total $this->limit_item_total) {
            
                if(
$this->fp = @fopen($this->xml_file"r")) {
                
//$this->html .= "<a href=\"".$this->xml_file."\">RSS</a><br />";
                
$this->xml_parser xml_parser_create();
                
xml_set_object($this->xml_parser$this);
                
xml_set_element_handler($this->xml_parser,"startElement""endElement");
                
xml_set_character_data_handler($this->xml_parser"characterData");
                while (
$this->data fread($this->fp4096)) {
                    
//if($encoding == "utf-8") {
                     //   $data = utf8_decode($data);
                    //}
                    
xml_parse($this->xml_parser$this->data);
                    
//echo "debug:<b>$this->count_item_feed </b><br>";
                
}
                
fclose($this->fp);
                
//echo "<h3>".xml_error_string(xml_get_error_code($this->xml_parser))."</h3>";
                
xml_parser_free ($this->xml_parser);
                
$this->count_item_feed 0;
                
                
                } else {
                    
$this->html "<!-- feed $this->xml_file not available -->";
                }
            } else {
                
$this->html "<!-- feed $this->xml_file outside limit  $this->limit_item_total -->";
            }
            return 
$this->html;
        }


}
    
}    
    
//if(!$encoding =  $this->GetParameter("encoding")) {
//    $encoding = "iso-8859-1";
//}
?>

<?php
if(!$rss =  $this->GetParameter("rss")) {
    echo 
"veuillez spécifier des adresses de fil RSS avec le paramètre rss";
} else {
    
$gp = new RssReader();
    
    
$gp->setKeywords($this->GetParameter("assoc"));
    
    if(!
$s =  $this->GetParameter("size")) {     // nombre de carré/item par ligne
        
$s 10;
    }
    
$gp->setSize($s);  
    
    if(!
$a =  $this->GetParameter("aff")) {      // taille d'affichage du carré global
        
$a 200;
    }
    
$gp->setAff($a);  
    
    if(!
$l =  $this->GetParameter("limit")) {    // nombre d'item max par feed
        
$l $gp->getSize();
    }
    
$gp->setLimit($l);
    
    if(
$field =  $this->GetParameter("field")) { // champ de recherche exclusif
        
$gp->setField($field);
    }
    
    echo 
"<div style=\"width:".$gp->aff.";height:".$gp->aff.";background-color:#000000\">\n";
    
    
$x explode(";"$rss);
    foreach(
$x as $xf) {
        echo 
$gp->parseRss($xf);
    }
    
    echo 
"\r\n</div>";
}
echo 
"<br />".$this->ComposeLinkToPage($this->GetPageTag(), "rssgp""Éditer ce bloc");

//delai de rafraichissement en minutes
if( !is_numeric($this->GetParameter("refresh")) || $this->GetParameter("refresh")<) {
    
$refresh 60000*10;//10 minutes
} else {
    
$refresh 60000 $this->GetParameter("refresh");
}
echo 
"<script language=\"javascript\" type=\"text/javascript\">setTimeout('this.location.reload()', $refresh);</script>";
echo 
"<script language=\"JavaScript\" type=\"text/javascript\" src=\"".WSTOOLTIP."\"></script>";
?>


handler/page/rssgp.php

<?php
if (!eregi("wakka.php"$_SERVER['PHP_SELF'])) {
    die (
"acc&egrave;s direct interdit");
}

if (
$HasAccessRead=$this->HasAccess("write"))  {
        
//si enregistrement de modifications
        
if($_POST['enregistrer'] == 'enregistrer') {
            
reset($_POST['mot']);
            
reset($_POST['color']);
            
reset($_POST['rss']);
            
            
$action_bloc_assoc " assoc=\"";
            
$n=0;
            while ( list(
$index$value) = each($_POST['mot']) ) {
                if(
$value != "" && $_POST['color'][$index] != "") {
                    
//echo $index."::".$value."::".$_POST['color'][$index]."<br />\n";
                    
if($n>0) {
                        
$action_bloc_assoc .=   ";"//Delimiteur
                    
}
                    
//paires associations
                    
$action_bloc_assoc .= $_POST['color'][$index]."|".$value;
                    
$n++;
                }
            }
            
$action_bloc_assoc .=   "\""
            
            
            
$action_bloc_rss " rss=\"";
            
$n=0;
            while ( list(
$index$value) = each($_POST['rss']) ) {
                if(
$value != "") {
                    if(
$n>0) {
                        
$action_bloc_rss .=   ";"//Delimiteur
                    
}
                    
$action_bloc_rss .= $value;
                    
$n++;
                }
            }
            
$action_bloc_rss .=   "\"";
            
            
//size="10" aff="100%" field=""
            
if($_POST['size'] != '') {
                
$action_bloc_size " size=\"".$_POST['size']."\"";
            } else {
                
$action_bloc_size " size=\"10\"";
            }
            if(
$_POST['aff'] != '') {
                
$action_bloc_aff " aff=\"".$_POST['aff']."\"";
            } else {
                
$action_bloc_aff " aff=\"100%\"";
            }
            if(
$_POST['field'] != '') {
                
$action_bloc_field " field=\"".$_POST['field']."\"";
            } else {
                
$action_bloc_field " field=\"\"";
            }
            if(
$_POST['limit'] != '') {
                
$action_bloc_limit " limit=\"".$_POST['limit']."\"";
            } else {
                
$action_bloc_limit " limit=\"\"";
            }
            if(
$_POST['refresh'] != '') {
                
$action_bloc_refresh " refresh=\"".$_POST['refresh']."\"";
            } else {
                
$action_bloc_refresh " refresh=\"10\"";
            }
            
            
$action "{{rssgp  " $action_bloc_size $action_bloc_aff $action_bloc_field $action_bloc_limit $action_bloc_assoc $action_bloc_rss "}}";
            
            
//enregistrement de la page
            
$this->SavePage($this->tag$action);
            
            
header("Location:".$this->config["base_url"].$this->tag);
            exit;
        }
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
    <title><?php echo "Édition de ".$this->tag?></title>
    <style type="text/css">
    body {
        font-family: verdana;
        font-size:0.8em;
    }
    /*
    .nom {
       width:10%;
    }
    */
    .im {
        width:50px;
    }
    input, select {
        background-color:#ffffff;
        border:1px #000000 solid;
        margin:3px;
        padding:2px;
    }
    .blocassoc {
        width:100%;
        height:40px;
        border-bottom:1px #ccc solid;
        margin:2px;
        padding:2px;
    }
    .curs {
        cursor: crossair;
    }
    </style>
</head>

<body>
<script type="text/javascript" src="/rssgp/wz_dragdrop.js"></script>
<?php
//complète un chiffre hexa avec des 0;
function zeropad($num$lim=2) {
   return (
strlen($num) >= $lim) ? $num zeropad("0" $num);
}

function 
makeJsBloc1($i$rsl$rsr$gsl$gsr$bsl$bsr) {            
return 
'"ccanvas_'.$i.'"+NO_DRAG,"track_r_'.$i.'"+NO_DRAG, "track_g_'.$i.'"+NO_DRAG, "track_b_'.$i.'"+NO_DRAG, "thumb_r_'.$i.'"+MAXOFFLEFT+'.$rsl.'+MAXOFFRIGHT+'.$rsr.'+HORIZONTAL, "thumb_g_'.$i.'"+MAXOFFLEFT+'.$gsl.'+MAXOFFRIGHT+'.$gsr.'+HORIZONTAL, "thumb_b_'.$i.'"+MAXOFFLEFT+'.$bsl.'+MAXOFFRIGHT+'.$bsr.'+HORIZONTAL';
}

function 
makeJsBloc2($i$rs$gs$bs) { 
return 
"
thumb_r_$i = dd.elements.thumb_r_$i,
thumb_g_$i = dd.elements.thumb_g_$i,
thumb_b_$i = dd.elements.thumb_b_$i,
track_r_$i = dd.elements.track_r_$i,
track_g_$i = dd.elements.track_g_$i,
track_b_$i = dd.elements.track_b_$i,
ccanvas_$i = dd.elements.ccanvas_$i,
thumb_r_$i.nb = $i,
thumb_g_$i.nb = $i,
thumb_b_$i.nb = $i,
thumb_r_$i.moveTo(dd.elements.track_r_$i.x+$rs, dd.elements.track_r_$i.y);//+36
thumb_g_$i.moveTo(dd.elements.track_g_$i.x+$gs, dd.elements.track_g_$i.y);//+36
thumb_b_$i.moveTo(dd.elements.track_b_$i.x+$bs, dd.elements.track_b_$i.y);//+36
thumb_r_$i.setZ(dd.elements.track_r_$i.z+1);
thumb_g_$i.setZ(dd.elements.track_g_$i.z+1);
thumb_b_$i.setZ(dd.elements.track_b_$i.z+1);
dd.elements.track_r_$i.addChild('thumb_r_$i');
dd.elements.track_g_$i.addChild('thumb_g_$i');
dd.elements.track_b_$i.addChild('thumb_b_$i');
thumb_r_$i.defx = dd.elements.track_r_$i.x+$rs;
thumb_g_$i.defx = dd.elements.track_g_$i.x+$gs;
thumb_b_$i.defx = dd.elements.track_b_$i.x+$bs;
"
;
}

function 
makeDivAssocBloc($i$v$bg$hexcolor) {
    
$div "\n<div class=\"blocassoc\">";
    
$div .= '<input type="text" name="mot['.$i.']" value="'.$v.'" size="12" /> 
<img class="im" style="'
.$bg.'" name="im_'.$i.'" src="/rssgp/transparentpixel.gif" width="50" height="35" alt="'.$v.'" title="'.$v.'"/> 
<img class="im" style="'
.$bg.'"name="ccanvas_'.$i.'" src="/rssgp/transparentpixel.gif" width="50" height="35" alt="color" title="color" /> 
<img name="track_r_'
.$i.'" src="/rssgp/track.gif" width="94" height="35" alt="red" title="red" />
<img  class="curs" name="thumb_r_'
.$i.'" src="/rssgp/sliderthumbr.gif" width="22" height="35" alt="red" title="red" />
<img name="track_g_'
.$i.'" src="/rssgp/track.gif" width="94" height="35" alt="green" title="green" />
<img  class="curs" name="thumb_g_'
.$i.'" src="/rssgp/sliderthumbg.gif" width="22" height="35" alt="green" title="green" />
<img name="track_b_'
.$i.'" src="/rssgp/track.gif" width="94" height="35" alt="blue" title="blue" />
<img  class="curs" name="thumb_b_'
.$i.'" src="/rssgp/sliderthumbb.gif" width="22" height="35" alt="blue" title="blue" />
<input id="color_'
.$i.'" name="color['.$i.']" type="hidden" size="9" value="'.$hexcolor.'"/></div>';
    return 
$div;
}

$JS " <script type=\"text/javascript\">
<!--
SET_DHTML("
;


$JS2 " function my_DragFunc() {
    if (dd.obj.name.indexOf('thumb_') >= 0)  {
        
        i = dd.obj.nb;
        
        thumb_r = eval('thumb_r_'+i);
        thumb_g = eval('thumb_g_'+i);
        thumb_b = eval('thumb_b_'+i);
        track_r = eval('track_r_'+i);
        track_g = eval('track_g_'+i);
        track_b = eval('track_b_'+i);
        ccanvas = eval('ccanvas_'+i);

        var red = (parseInt((thumb_r.x-track_r.x)*255/90)).toString(16); 
        var green = (parseInt((thumb_g.x-track_g.x)*255/90)).toString(16);
        var blue = (parseInt((thumb_b.x-track_b.x)*255/90)).toString(16); //+45
        while (red.length < 2) red = '0'+red;
        while (blue.length < 2) blue = '0'+blue;
        while (green.length < 2) green = '0'+green;
        
        var color = \"#\"+red+green+blue;
        
        ccanvas.setBgColor(color);
        
        id = 'color_'+i;
        colf = document.getElementById(id);
        colf.setAttribute('value',color);
    }
}"
;
        
        



if (
$HasAccessRead=$this->HasAccess("write")) {

    if( !
$this->page ) {
    
        echo 
"La page demandée n'existe pas";
        
    } else if (
$this->page) {
        
        if ( 
ereg('\{\{rssgp',$this->page['body']) )  {
        
            echo 
"<h1>Édition du bloc de veille  <a href=\"".$this->config["base_url"].$this->tag."\">".$this->tag."</a></h1>";
        
            
//passe les valeurs de paramètres de l'action dans un tableau $param
            
$body $this->page["body"];
            
preg_match_all("/([A-Za-z0-9]*)=\"(.*)\"/U"$body$matches);
            if (
is_array($matches)) {
                for (
$a 0$a count($matches[1]); $a++) {
                    
$param[$matches[1][$a]] = $matches[2][$a];
                }
            }
        
        
            
//affichage dans formulaire des données courantes
            
echo "<form name=\"\" action=\"".$this->config["base_url"].$this->tag."/rssgp\" method=\"post\">\n";
        
            
//options générales
            //size
            
            
if(!$param['size'] || $param['size'] == "") { $param['size'] = 10; }
            echo 
"Nombre de colonnes et lignes du carré global: ";
            echo 
"<input type=\"text\" name=\"size\" value=\"".$param['size']."\" size=\"4\" /><br />\n";
        
            
//aff
            
if(!$param['aff'] || $param['aff'] == "") { $param['aff'] = "100%"; }
            echo 
"Taille d'affichage du carré global, en pixels ou pourcentage: ";
            echo 
"<input type=\"text\" name=\"aff\" value=\"".$param['aff']."\" size=\"4\" /><br />\n";
        
        
            
//limit
            
if(!$param['limit'] || $param['limit'] == "") { $param['limit'] = 10; }
            echo 
"Nombre maximum d'items par fils: ";
            echo 
"<input type=\"text\" name=\"limit\" value=\"".$param['limit']."\" size=\"4\" /><br />\n";
            
            
            
            
//aff
            
echo "Sélectionner un champ pour limiter la recherche des mots-clé (optionnel): ";
            echo 
"<select name=\"field\">\n";
            echo 
"<option value=\"\""
            if (
$param['field'] == '') { echo " selected=\"selected\""; }
            echo 
"></option>\n";
            echo 
"<option value=\"title\"";
            if (
$param['field'] == 'title') { echo " selected=\"selected\""; }
            echo 
">titre</option>\n";
            echo 
"<option value=\"description\"";
            if (
$param['field'] == 'description') { echo " selected=\"selected\""; }
            echo 
">description</option>\n";
            echo 
"<option value=\"author\"";
            if (
$param['field'] == 'author') { echo " selected=\"selected\""; }
            echo 
">auteur</option>\n";
            echo 
"</select><br />\n";
        
            
//refresh
            
if(!$param['refresh'] || $param['refresh'] == "") { $param['refresh'] = 10; }
            echo 
"Durée en minutes entre chaque rafraîchissement de la page: ";
            echo 
"<input type=\"text\" name=\"refresh\" value=\"".$param['refresh']."\" size=\"4\" /><br />\n";
            echo 
"<h2>Fils RSS</h2>\n";
        
        
            
//fils RSS
            
if($param['rss'] && $param['rss'] != "") {
                
$rss explode(";"$param["rss"]);
                
$n=0;
                if(
is_array($rss)) {
                    foreach(
$rss as $r) {
                        echo 
"<input type=\"text\" size=\"90%\" name=\"rss[$n]\" value=\"$r\" /> <a href=\"$r\">voir le fichier</a> <br />\n";
                        
$n++;
                    }
                }
            }
            
//champs suplémentaires pour ajouter des fils 
            
echo "<input type=\"text\" size=\"90%\" name=\"rss[$n]\" value=\"\" /><br />\n";
            
$n++;
            echo 
"<input type=\"text\" size=\"90%\" name=\"rss[$n]\" value=\"\" /><br />\n";
        
        
            
//associations couleurs mots-clés
            //preg_match_all("/([a-z0-9,#]*)\|(.*);/U", $param["assoc"], $matches);
            //if (is_array($matches))        {
            //    for ($a = 0; $a < count($matches[1]); $a++)            {
            //        $assoc[$matches[1][$a]] = $matches[2][$a];
            //    }
            //}

            
$assoc_liste explode(";"$param["assoc"]);
            if (
is_array($assoc_liste))  {
                foreach (
$assoc_liste as $a)    {
                    
$aa explode("|",$a);
                    
$assoc[$aa[0]] = $aa[1]; 
                }
            }

            
$i 0;
        

            echo 
"<h2>Associations couleurs / mots-clés</h2>\n";
            echo 
"Pour supprimer une association, effacer le mot-clé du champ correspondant.<br />";
        
            while (list(
$k,$v) = each($assoc)) {
                
//$k couleur
                //$v mot-clé
                //si couleur hexadecimal
                
if(ereg("#",$k)) {
                    
$k trim($k);
                    
$r hexdec(substr($k,1,2));
                    
$g hexdec(substr($k,3,2));
                    
$b hexdec(substr($k,5,2));
                
                    
$hexcolor $k;
                
//si couleur rgb    
                
} else if(ereg(",",$k)){
            
                    
$col explode(",",$k);
                    if(
is_array($col) && is_numeric($col[0]) && is_numeric($col[1]) && is_numeric($col[2])) {
                        
$r $col[0];
                        
$g $col[1];
                        
$b $col[2];
                    
                    } else {
                        
$r 0
                        
$g 0
                        
$b 0
                    }
                    
$hexcolor "#".zeropad(dechex($r),2).zeropad(dechex($g),2).zeropad(dechex($b),2);
                } else {
                    
$r 0
                    
$g 0
                    
$b 0
                    
$hexcolor "#000000";
                }
            
            
            
                
$rs round($r*90/255); 
                
$gs round($g*90/255); 
                
$bs round($b*90/255); 
                
$rsr90-$rs$rsl $rs;
                
$gsr90-$gs$gsl $gs;
                
$bsr90-$bs$bsl $bs;
            
                
//couleur RGB
                
$rgbcolor "$r,$g,$b";
                
$bg "background-color:rgb($r,$g,$b)";
            
                
//div bloc attend $i, $v, $bg, $hexcolor
                
echo makeDivAssocBloc($i$v$bg$hexcolor);
            
                if(
$i != 0) { $JS .= ",";}
            
                
//$JS attend $i, $rsl, $rsr, $gsl, $gsr, $bsl, $bsr
                
$JS .= makeJsBloc1($i$rsl$rsr$gsl$gsr$bsl$bsr);
           
                
//$JS2 attend pour chaque association : $i , $rs, $gs, $bs
                
$JS2 .= makeJsBloc2($i$rs$gs$bs);
            
                
$i++;
            }
        
            
//rajoute des champs vides (5) pour ajout associations
            
$bg "background-color:rgb(0,0,0)";
            for (
$j=$i$j<$i+5$j++) {
                echo 
makeDivAssocBloc($j''$bg'#000000');
                if(
$j != 0) { $JS .= ",";}
                
$JS .= makeJsBloc1($j090090090);
                
$JS2 .= makeJsBloc2($j000);
            }
        
        
        
            
$JS .= ");\n";
        
            echo 
"<br />";
            echo 
"<input type=\"submit\" name=\"enregistrer\" value=\"enregistrer\" />";
            echo 
" <input type=\"button\" name=\"annuler\" value=\"annuler\" onclick=\"history.back(-1)\" />";
            echo 
"</form>";

            echo 
$JS.$JS2."//-->
</script>"
;
        } else {
            echo 
"Cette page ne contient pas de bloc de veille.";
        }
    }
}
?>
</body>
</html>

Il n'y a pas de commentaire sur cette page. [Afficher commentaires/formulaire]