New: Debut gestion possibilite de mettre plusieurs boites RSS.
This commit is contained in:
parent
ffc0f88f2a
commit
60eba2ed73
@ -168,13 +168,13 @@ print_titre($langs->trans("BoxesAvailable"));
|
|||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("Box").'</td>';
|
print '<td width="300">'.$langs->trans("Box").'</td>';
|
||||||
|
print '<td>'.$langs->trans("Note").'</td>';
|
||||||
print '<td>'.$langs->trans("SourceFile").'</td>';
|
print '<td>'.$langs->trans("SourceFile").'</td>';
|
||||||
print '<td align="center" width="180">'.$langs->trans("ActivateOn").'</td>';
|
print '<td align="center" width="160">'.$langs->trans("ActivateOn").'</td>';
|
||||||
print '<td align="center" width="80"> </td>';
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$sql = "SELECT rowid, name, file FROM ".MAIN_DB_PREFIX."boxes_def";
|
$sql = "SELECT rowid, name, file, note FROM ".MAIN_DB_PREFIX."boxes_def";
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
$var=True;
|
$var=True;
|
||||||
|
|
||||||
@ -207,7 +207,10 @@ if ($resql)
|
|||||||
|
|
||||||
print '<form action="boxes.php" method="POST">';
|
print '<form action="boxes.php" method="POST">';
|
||||||
$logo=eregi_replace("^object_","",$box->boximg);
|
$logo=eregi_replace("^object_","",$box->boximg);
|
||||||
print '<tr '.$bc[$var].'><td>'.img_object("",$logo).' '.$box->boxlabel.'</td><td>' . $obj->file . '</td>';
|
print '<tr '.$bc[$var].'>';
|
||||||
|
print '<td>'.img_object("",$logo).' '.$box->boxlabel.'</td>';
|
||||||
|
print '<td>' . ($obj->note?$obj->note:' ') . '</td>';
|
||||||
|
print '<td>' . $obj->file . '</td>';
|
||||||
|
|
||||||
// Pour chaque position possible, on affiche un lien
|
// Pour chaque position possible, on affiche un lien
|
||||||
// d'activation si boite non deja active pour cette position
|
// d'activation si boite non deja active pour cette position
|
||||||
@ -218,7 +221,6 @@ if ($resql)
|
|||||||
print ' <input type="submit" class="button" name="button" value="'.$langs->trans("Activate").'">';
|
print ' <input type="submit" class="button" name="button" value="'.$langs->trans("Activate").'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td> </td>';
|
|
||||||
print '</tr></form>';
|
print '</tr></form>';
|
||||||
}
|
}
|
||||||
$i++;
|
$i++;
|
||||||
@ -239,14 +241,14 @@ print_titre($langs->trans("BoxesActivated"));
|
|||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("Box").'</td>';
|
print '<td width="300">'.$langs->trans("Box").'</td>';
|
||||||
print '<td> </td>';
|
print '<td>'.$langs->trans("Note").'</td>';
|
||||||
print '<td align="center" width="180">'.$langs->trans("ActiveOn").'</td>';
|
print '<td align="center" width="160">'.$langs->trans("ActiveOn").'</td>';
|
||||||
print '<td align="center" width="60" colspan="2">'.$langs->trans("Position").'</td>';
|
print '<td align="center" width="60" colspan="2">'.$langs->trans("Position").'</td>';
|
||||||
print '<td align="center" width="80">'.$langs->trans("Disable").'</td>';
|
print '<td align="center" width="80">'.$langs->trans("Disable").'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$sql = "SELECT b.rowid, b.box_id, b.position, d.name, d.file";
|
$sql = "SELECT b.rowid, b.box_id, b.position, d.name, d.file, d.note";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."boxes as b, ".MAIN_DB_PREFIX."boxes_def as d";
|
$sql .= " FROM ".MAIN_DB_PREFIX."boxes as b, ".MAIN_DB_PREFIX."boxes_def as d";
|
||||||
$sql .= " where b.box_id = d.rowid";
|
$sql .= " where b.box_id = d.rowid";
|
||||||
$sql .= " ORDER by position, box_order";
|
$sql .= " ORDER by position, box_order";
|
||||||
@ -275,15 +277,16 @@ if ($resql)
|
|||||||
$box=new $module();
|
$box=new $module();
|
||||||
|
|
||||||
$logo=eregi_replace("^object_","",$box->boximg);
|
$logo=eregi_replace("^object_","",$box->boximg);
|
||||||
print '<tr '.$bc[$var].'><td>'.img_object("",$logo).' '.$box->boxlabel.'</td>';
|
print '<tr '.$bc[$var].'>';
|
||||||
print '<td> </td>';
|
print '<td>'.img_object("",$logo).' '.$box->boxlabel.'</td>';
|
||||||
|
print '<td>' . ($obj->note?$obj->note:' ') . '</td>';
|
||||||
print '<td align="center">' . $pos_name[$obj->position] . '</td>';
|
print '<td align="center">' . $pos_name[$obj->position] . '</td>';
|
||||||
$hasnext=true;
|
$hasnext=true;
|
||||||
$hasprevious=true;
|
$hasprevious=true;
|
||||||
if ($foundrupture) { $hasprevious=false; $foundrupture=0; }
|
if ($foundrupture) { $hasprevious=false; $foundrupture=0; }
|
||||||
if (! $objnext || $obj->position != $objnext->position) { $hasnext=false; $foundrupture=1; }
|
if (! $objnext || $obj->position != $objnext->position) { $hasnext=false; $foundrupture=1; }
|
||||||
print '<td align="center" width="10">'.$box_order.'</td>';
|
print '<td align="center">'.$box_order.'</td>';
|
||||||
print '<td align="center" width="50">';
|
print '<td align="center">';
|
||||||
print ($hasnext?'<a href="boxes.php?action=switch&switchfrom='.$obj->rowid.'&switchto='.$objnext->rowid.'">'.img_down().'</a> ':'');
|
print ($hasnext?'<a href="boxes.php?action=switch&switchfrom='.$obj->rowid.'&switchto='.$objnext->rowid.'">'.img_down().'</a> ':'');
|
||||||
print ($hasprevious?'<a href="boxes.php?action=switch&switchfrom='.$obj->rowid.'&switchto='.$objprevious->rowid.'">'.img_up().'</a>':'');
|
print ($hasprevious?'<a href="boxes.php?action=switch&switchfrom='.$obj->rowid.'&switchto='.$objprevious->rowid.'">'.img_up().'</a>':'');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|||||||
@ -54,11 +54,19 @@ if ($_POST["action"] == 'add' || $_POST["modify"])
|
|||||||
$external_rss_urlrss = "external_rss_urlrss_" . $_POST["norss"];
|
$external_rss_urlrss = "external_rss_urlrss_" . $_POST["norss"];
|
||||||
|
|
||||||
if(isset($_POST[$external_rss_urlrss])) {
|
if(isset($_POST[$external_rss_urlrss])) {
|
||||||
|
$boxlabel='(ExternalRSSInformations)';
|
||||||
$external_rss_title = "external_rss_title_" . $_POST["norss"];
|
$external_rss_title = "external_rss_title_" . $_POST["norss"];
|
||||||
//$external_rss_url = "external_rss_url_" . $_POST["norss"];
|
//$external_rss_url = "external_rss_url_" . $_POST["norss"];
|
||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
|
// Ajoute boite box_external_rss dans définition des boites
|
||||||
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes_def (name, file, note) VALUES ('".$boxlabel."','box_external_rss.php','".addslashes($_POST["norss"].' ('.$_POST[$external_rss_title]).")')";
|
||||||
|
if (! $db->query($sql))
|
||||||
|
{
|
||||||
|
$err++;
|
||||||
|
}
|
||||||
|
|
||||||
$result1=dolibarr_set_const($db, "EXTERNAL_RSS_TITLE_" . $_POST["norss"],$_POST[$external_rss_title]);
|
$result1=dolibarr_set_const($db, "EXTERNAL_RSS_TITLE_" . $_POST["norss"],$_POST[$external_rss_title]);
|
||||||
if ($result1) $result2=dolibarr_set_const($db, "EXTERNAL_RSS_URLRSS_" . $_POST["norss"],$_POST[$external_rss_urlrss]);
|
if ($result1) $result2=dolibarr_set_const($db, "EXTERNAL_RSS_URLRSS_" . $_POST["norss"],$_POST[$external_rss_urlrss]);
|
||||||
|
|
||||||
@ -81,6 +89,15 @@ if ($_POST["delete"])
|
|||||||
if(isset($_POST["norss"])) {
|
if(isset($_POST["norss"])) {
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
|
// Supprime boite box_external_rss de définition des boites
|
||||||
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes_def";
|
||||||
|
$sql.= " WHERE file ='box_external_rss.php' AND note like '".$_POST["norss"]." %'";
|
||||||
|
if (! $db->query($sql))
|
||||||
|
{
|
||||||
|
dolibarr_print_error($db,"sql=$sql");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
$result1=dolibarr_del_const($db,"EXTERNAL_RSS_TITLE_" . $_POST["norss"]);
|
$result1=dolibarr_del_const($db,"EXTERNAL_RSS_TITLE_" . $_POST["norss"]);
|
||||||
if ($result1) $result2=dolibarr_del_const($db,"EXTERNAL_RSS_URLRSS_" . $_POST["norss"]);
|
if ($result1) $result2=dolibarr_del_const($db,"EXTERNAL_RSS_URLRSS_" . $_POST["norss"]);
|
||||||
|
|
||||||
|
|||||||
@ -51,7 +51,7 @@ class InfoBox
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Retourne liste des boites elligibles pour la zone
|
* \brief Retourne tableau des boites elligibles pour la zone
|
||||||
* \param $zone ID de la zone (0 pour la Homepage, ...)
|
* \param $zone ID de la zone (0 pour la Homepage, ...)
|
||||||
* \return array Tableau des boites qualifiées
|
* \return array Tableau des boites qualifiées
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2003 Éric Seigne <erics@rycks.com>
|
* Copyright (C) 2003 Éric Seigne <erics@rycks.com>
|
||||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@ -371,8 +371,11 @@ class DolibarrModules
|
|||||||
{
|
{
|
||||||
$titre = $this->boxes[$key][0];
|
$titre = $this->boxes[$key][0];
|
||||||
$file = $this->boxes[$key][1];
|
$file = $this->boxes[$key][1];
|
||||||
|
$note = $this->boxes[$key][2];
|
||||||
|
|
||||||
$sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."boxes_def WHERE name ='".$titre."'";
|
$sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."boxes_def";
|
||||||
|
$sql.= " WHERE file ='".$file."'";
|
||||||
|
if ($note) $sql.=" AND note ='".addslashes($note)."'";
|
||||||
|
|
||||||
$result=$this->db->query($sql);
|
$result=$this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
@ -380,7 +383,8 @@ class DolibarrModules
|
|||||||
$row = $this->db->fetch_row($result);
|
$row = $this->db->fetch_row($result);
|
||||||
if ($row[0] == 0)
|
if ($row[0] == 0)
|
||||||
{
|
{
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes_def (name, file) VALUES ('".$titre."','".$file."')";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes_def (name, file, note)";
|
||||||
|
$sql.= " VALUES ('".$titre."','".$file."','".addslashes($note)."')";
|
||||||
if (! $this->db->query($sql))
|
if (! $this->db->query($sql))
|
||||||
{
|
{
|
||||||
$err++;
|
$err++;
|
||||||
@ -410,10 +414,12 @@ class DolibarrModules
|
|||||||
{
|
{
|
||||||
foreach ($this->boxes as $key => $value)
|
foreach ($this->boxes as $key => $value)
|
||||||
{
|
{
|
||||||
$titre = $this->boxes[$key][0];
|
//$titre = $this->boxes[$key][0];
|
||||||
$file = $this->boxes[$key][1];
|
$file = $this->boxes[$key][1];
|
||||||
|
//$note = $this->boxes[$key][2];
|
||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes_def WHERE file = '".$file."'";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes_def ";
|
||||||
|
$sql.= "WHERE file = '".$file."'";
|
||||||
if (! $this->db->query($sql) )
|
if (! $this->db->query($sql) )
|
||||||
{
|
{
|
||||||
$err++;
|
$err++;
|
||||||
|
|||||||
@ -74,8 +74,7 @@ class modExternalRss extends DolibarrModules
|
|||||||
|
|
||||||
// Boxes
|
// Boxes
|
||||||
$this->boxes = array();
|
$this->boxes = array();
|
||||||
$this->boxes[0][0] = "Informations externes RSS";
|
// Les boites sont ajoutées lors de la configuration des flux
|
||||||
$this->boxes[0][1] = "box_external_rss.php";
|
|
||||||
|
|
||||||
// Permissions
|
// Permissions
|
||||||
$this->rights = array();
|
$this->rights = array();
|
||||||
@ -90,6 +89,26 @@ class modExternalRss extends DolibarrModules
|
|||||||
{
|
{
|
||||||
$sql = array();
|
$sql = array();
|
||||||
|
|
||||||
|
// Recherche configuration de boites
|
||||||
|
$this->boxes=array();
|
||||||
|
$sql="select name, value from ".MAIN_DB_PREFIX."const";
|
||||||
|
$sql.= " WHERE name like 'EXTERNAL_RSS_TITLE_%'";
|
||||||
|
$result=$this->db->query($sql);
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
while ($obj = $this->db->fetch_object($result))
|
||||||
|
{
|
||||||
|
if (eregi('EXTERNAL_RSS_TITLE_([0-9]+)',$obj->name,$reg))
|
||||||
|
{
|
||||||
|
// Definie la boite si on a trouvée une ancienne configuration
|
||||||
|
$this->boxes[$reg[1]][0] = "Informations externes RSS";
|
||||||
|
$this->boxes[$reg[1]][1] = "box_external_rss.php";
|
||||||
|
$this->boxes[$reg[1]][2] = $reg[1]." (".$obj->value.")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->db->free($result);
|
||||||
|
}
|
||||||
|
|
||||||
return $this->_init($sql);
|
return $this->_init($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,6 +120,9 @@ class modExternalRss extends DolibarrModules
|
|||||||
{
|
{
|
||||||
$sql = array();
|
$sql = array();
|
||||||
|
|
||||||
|
// Supprime anciennes delcarations de la boite RSS
|
||||||
|
$this->boxes[0][1] = "box_external_rss.php";
|
||||||
|
|
||||||
return $this->_remove($sql);
|
return $this->_remove($sql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@ -463,7 +463,7 @@ function left_menu($menu_array, $help_url='', $form_search='')
|
|||||||
if ($helpbaseurl) print '<div class="help"><a class="help" target="_blank" href="'.sprintf($helpbaseurl,$help_url).'">'.$langs->trans("Help").'</a></div>';
|
if ($helpbaseurl) print '<div class="help"><a class="help" target="_blank" href="'.sprintf($helpbaseurl,$help_url).'">'.$langs->trans("Help").'</a></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MAIN_SHOW_BUGTRACK_LINK == 1)
|
if ($conf->global->MAIN_SHOW_BUGTRACK_LINK == 1)
|
||||||
{
|
{
|
||||||
// Lien vers le bugtrack
|
// Lien vers le bugtrack
|
||||||
$bugbaseurl='http://savannah.nongnu.org/bugs/?';
|
$bugbaseurl='http://savannah.nongnu.org/bugs/?';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user