Minor esthetical change and fix
This commit is contained in:
parent
2e2b3b4be4
commit
ab2b56be13
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2008-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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
|
||||
@ -17,11 +17,11 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/admin/agenda.php
|
||||
\ingroup agenda
|
||||
\brief Page de configuration du module agenda
|
||||
\version $Id$
|
||||
*/
|
||||
* \file htdocs/admin/agenda.php
|
||||
* \ingroup agenda
|
||||
* \brief Page de configuration du module agenda
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
|
||||
@ -44,10 +44,11 @@ if ($actionsave)
|
||||
$i=0;
|
||||
|
||||
$db->begin();
|
||||
|
||||
$i+=dolibarr_set_const($db,'MAIN_AGENDA_XCAL_EXPORTKEY',trim($_POST["MAIN_AGENDA_XCAL_EXPORTKEY"]),'chaine',0,'',$conf->entity);
|
||||
|
||||
if ($i > 0)
|
||||
$i+=dolibarr_set_const($db,'MAIN_AGENDA_XCAL_EXPORTKEY',trim($_POST["MAIN_AGENDA_XCAL_EXPORTKEY"]),'chaine',0,'',$conf->entity);
|
||||
$i+=dolibarr_set_const($db,'MAIN_AGENDA_EXPORT_CACHE',trim($_POST["MAIN_AGENDA_EXPORT_CACHE"]),'chaine',0,'',$conf->entity);
|
||||
|
||||
if ($i >= 2)
|
||||
{
|
||||
$db->commit();
|
||||
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
|
||||
@ -83,7 +84,7 @@ print '<form name="agendasetupform" action="'.$_SERVER["PHP_SELF"].'" method="po
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print "<td width=\"30%\">".$langs->trans("Parameter")."</td>";
|
||||
print "<td>".$langs->trans("Parameter")."</td>";
|
||||
print "<td>".$langs->trans("Value")."</td>";
|
||||
//print "<td>".$langs->trans("Examples")."</td>";
|
||||
print "<td> </td>";
|
||||
@ -95,6 +96,12 @@ print "<td><input type=\"text\" class=\"flat\" name=\"MAIN_AGENDA_XCAL_EXPORTKEY
|
||||
print "<td> </td>";
|
||||
print "</tr>";
|
||||
|
||||
print "<tr class=\"pair\">";
|
||||
print "<td>".$langs->trans("UseACacheDelay")."</td>";
|
||||
print "<td><input type=\"text\" class=\"flat\" name=\"MAIN_AGENDA_EXPORT_CACHE\" value=\"". ($_POST["MAIN_AGENDA_EXPORT_CACHE"]?$_POST["MAIN_AGENDA_EXPORT_CACHE"]:$conf->global->MAIN_AGENDA_EXPORT_CACHE) . "\" size=\"10\"></td>";
|
||||
print "<td> </td>";
|
||||
print "</tr>";
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<br><center>';
|
||||
|
||||
@ -60,7 +60,7 @@ if (! $conf->agenda->enabled)
|
||||
if (empty($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY))
|
||||
{
|
||||
$user->getrights();
|
||||
|
||||
|
||||
llxHeader();
|
||||
print '<div class="error">Module Agenda was not configured properly.</div>';
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
@ -71,7 +71,7 @@ if (empty($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY))
|
||||
if (empty($_GET["exportkey"]) || $conf->global->MAIN_AGENDA_XCAL_EXPORTKEY != $_GET["exportkey"])
|
||||
{
|
||||
$user->getrights();
|
||||
|
||||
|
||||
llxHeader();
|
||||
print '<div class="error">Bad value for key.</div>';
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
@ -97,10 +97,13 @@ if (! $filename)
|
||||
|
||||
$agenda=new ActionComm($db);
|
||||
|
||||
$cachedelay=0;
|
||||
if (! empty($conf->global->MAIN_AGENDA_EXPORT_CACHE)) $cachedelay=$conf->global->MAIN_AGENDA_EXPORT_CACHE;
|
||||
|
||||
// Build file
|
||||
if ($format == 'ical' || $format == 'vcal')
|
||||
{
|
||||
$result=$agenda->build_exportfile($format,$type,0,$filename,$filters);
|
||||
{
|
||||
$result=$agenda->build_exportfile($format,$type,$cachedelay,$filename,$filters);
|
||||
if ($result >= 0)
|
||||
{
|
||||
$attachment = true;
|
||||
@ -111,19 +114,19 @@ if ($format == 'ical' || $format == 'vcal')
|
||||
//$contenttype='text/plain';
|
||||
$outputencoding='UTF-8';
|
||||
//$contenttype='ISO-8859-1';
|
||||
|
||||
|
||||
if ($contenttype) header('Content-Type: '.$contenttype.($outputencoding?'; charset='.$outputencoding:''));
|
||||
if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"');
|
||||
|
||||
|
||||
// Ajout directives pour resoudre bug IE
|
||||
//header('Cache-Control: Public, must-revalidate');
|
||||
//header('Pragma: public');
|
||||
|
||||
|
||||
// Clean parameters
|
||||
$outputfile=$conf->agenda->dir_temp.'/'.$filename;
|
||||
$result=readfile($outputfile);
|
||||
if (! $result) print 'File '.$outputfile.' was empty.';
|
||||
|
||||
|
||||
// header("Location: ".DOL_URL_ROOT.'/document.php?modulepart=agenda&file='.urlencode($filename));
|
||||
exit;
|
||||
}
|
||||
@ -131,7 +134,7 @@ if ($format == 'ical' || $format == 'vcal')
|
||||
|
||||
if ($format == 'rss')
|
||||
{
|
||||
$result=$agenda->build_exportfile($format,$type,0,$filename,$filters);
|
||||
$result=$agenda->build_exportfile($format,$type,$cachedelay,$filename,$filters);
|
||||
if ($result >= 0)
|
||||
{
|
||||
$attachment = false;
|
||||
@ -142,22 +145,22 @@ if ($format == 'rss')
|
||||
//$contenttype='text/plain';
|
||||
$outputencoding='UTF-8';
|
||||
//$contenttype='ISO-8859-1';
|
||||
|
||||
|
||||
if ($contenttype) header('Content-Type: '.$contenttype.($outputencoding?'; charset='.$outputencoding:''));
|
||||
if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"');
|
||||
|
||||
|
||||
// Ajout directives pour resoudre bug IE
|
||||
//header('Cache-Control: Public, must-revalidate');
|
||||
//header('Pragma: public');
|
||||
|
||||
|
||||
// Clean parameters
|
||||
$outputfile=$conf->agenda->dir_temp.'/'.$filename;
|
||||
$result=readfile($outputfile);
|
||||
if (! $result) print 'File '.$outputfile.' was empty.';
|
||||
|
||||
|
||||
// header("Location: ".DOL_URL_ROOT.'/document.php?modulepart=agenda&file='.urlencode($filename));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -233,6 +233,7 @@ ErrorCantUseRazInStartedYearIfNoYearMonthInMask=Error, can't user option @ if se
|
||||
UMask=UMask parameter for new files on Unix/Linux/BSD file system.
|
||||
UMaskExplanation=This parameter allow you to define permissions set by default on files created by Dolibarr on server (during upload for example).<br>It must be the octal value (for example, 0666 means read and write for everyone).<br>Ce paramètre ne sert pas sous un serveur Windows.
|
||||
SeeWikiForAllTeam=Take a look at the wiki page for full list of all actors and their organisation
|
||||
UseACacheDelay = Delay for caching export response in seconds (0 or empty for no cache)
|
||||
|
||||
# Modules
|
||||
Module0Name=Users & groups
|
||||
|
||||
@ -233,6 +233,7 @@ ErrorCantUseRazInStartedYearIfNoYearMonthInMask = Erreur, ne peut utiliser l'opt
|
||||
UMask = Paramètre UMask des nouveaux fichiers sous Unix/Linux/BSD.
|
||||
UMaskExplanation = Ce paramètre permet de définir les droits des fichiers créés sur le serveur par Dolibarr (lors d'upload par exemple).<br>Ce doit être la valeur octal (par exemple 0666 signifie lecture/ecriture pour tous).<br>Ce paramètre n'a aucun effet sur un serveur Windows.
|
||||
SeeWikiForAllTeam = Voir le wiki pour le détail de tous les acteurs et leur organisation
|
||||
UseACacheDelay = Delay de mise en cache de l'export en secondes (0 ou vide pour aucun cache)
|
||||
# Modules = undefined
|
||||
Module0Name = Utilisateurs & groupes
|
||||
Module0Desc = Gestion des utilisateurs et groupes
|
||||
|
||||
@ -32,59 +32,59 @@
|
||||
*/
|
||||
function versiontostring($versionarray)
|
||||
{
|
||||
$string='?';
|
||||
if (isset($versionarray[0])) $string=$versionarray[0];
|
||||
if (isset($versionarray[1])) $string.='.'.$versionarray[1];
|
||||
if (isset($versionarray[2])) $string.='.'.$versionarray[2];
|
||||
return $string;
|
||||
$string='?';
|
||||
if (isset($versionarray[0])) $string=$versionarray[0];
|
||||
if (isset($versionarray[1])) $string.='.'.$versionarray[1];
|
||||
if (isset($versionarray[2])) $string.='.'.$versionarray[2];
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Compare 2 versions
|
||||
\param versionarray1 Tableau de version (vermajeur,vermineur,autre)
|
||||
\param versionarray2 Tableau de version (vermajeur,vermineur,autre)
|
||||
\return int <0 si versionarray1<versionarray2, 0 si =, >0 si versionarray1>versionarray2
|
||||
*/
|
||||
\brief Compare 2 versions
|
||||
\param versionarray1 Tableau de version (vermajeur,vermineur,autre)
|
||||
\param versionarray2 Tableau de version (vermajeur,vermineur,autre)
|
||||
\return int <0 si versionarray1<versionarray2, 0 si =, >0 si versionarray1>versionarray2
|
||||
*/
|
||||
function versioncompare($versionarray1,$versionarray2)
|
||||
{
|
||||
$ret=0;
|
||||
$i=0;
|
||||
while ($i < max(sizeof($versionarray1),sizeof($versionarray1)))
|
||||
{
|
||||
$operande1=isset($versionarray1[$i])?$versionarray1[$i]:0;
|
||||
$operande2=isset($versionarray2[$i])?$versionarray2[$i]:0;
|
||||
if ($operande1 < $operande2) { $ret = -1; break; }
|
||||
if ($operande1 > $operande2) { $ret = 1; break; }
|
||||
$i++;
|
||||
}
|
||||
return $ret;
|
||||
$ret=0;
|
||||
$i=0;
|
||||
while ($i < max(sizeof($versionarray1),sizeof($versionarray1)))
|
||||
{
|
||||
$operande1=isset($versionarray1[$i])?$versionarray1[$i]:0;
|
||||
$operande2=isset($versionarray2[$i])?$versionarray2[$i]:0;
|
||||
if ($operande1 < $operande2) { $ret = -1; break; }
|
||||
if ($operande1 > $operande2) { $ret = 1; break; }
|
||||
$i++;
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
\brief Return version PHP
|
||||
\return array Tableau de version (vermajeur,vermineur,autre)
|
||||
*/
|
||||
\brief Return version PHP
|
||||
\return array Tableau de version (vermajeur,vermineur,autre)
|
||||
*/
|
||||
function versionphparray()
|
||||
{
|
||||
return split('\.',PHP_VERSION);
|
||||
return split('\.',PHP_VERSION);
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Return version Dolibarr
|
||||
\return array Tableau de version (vermajeur,vermineur,autre)
|
||||
*/
|
||||
\brief Return version Dolibarr
|
||||
\return array Tableau de version (vermajeur,vermineur,autre)
|
||||
*/
|
||||
function versiondolibarrarray()
|
||||
{
|
||||
return split('\.',DOL_VERSION);
|
||||
return split('\.',DOL_VERSION);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Launch a sql file
|
||||
* \param sqlfile Full path to sql file
|
||||
* \return int <=0 if KO, >0 if OK
|
||||
*/
|
||||
* \brief Launch a sql file
|
||||
* \param sqlfile Full path to sql file
|
||||
* \return int <=0 if KO, >0 if OK
|
||||
*/
|
||||
function run_sql($sqlfile,$silent=1)
|
||||
{
|
||||
global $db, $conf, $langs, $user;
|
||||
@ -114,7 +114,7 @@ function run_sql($sqlfile,$silent=1)
|
||||
//print var_dump($versioncommande);
|
||||
//print var_dump($versionarray);
|
||||
if (sizeof($versioncommande) && sizeof($versionarray)
|
||||
&& versioncompare($versioncommande,$versionarray) <= 0)
|
||||
&& versioncompare($versioncommande,$versionarray) <= 0)
|
||||
{
|
||||
// Version qualified, delete SQL comments
|
||||
$buf=eregi_replace('^-- V([0-9\.]+)','',$buf);
|
||||
@ -282,13 +282,13 @@ function run_sql($sqlfile,$silent=1)
|
||||
|
||||
|
||||
/**
|
||||
\brief Effacement d'une constante dans la base de donnees
|
||||
\sa dolibarr_get_const, dolibarr_sel_const
|
||||
\param db Handler d'acces base
|
||||
\param name Nom ou rowid de la constante
|
||||
\param entity Multi company id
|
||||
\return int <0 si ko, >0 si ok
|
||||
*/
|
||||
\brief Effacement d'une constante dans la base de donnees
|
||||
\sa dolibarr_get_const, dolibarr_sel_const
|
||||
\param db Handler d'acces base
|
||||
\param name Nom ou rowid de la constante
|
||||
\param entity Multi company id
|
||||
\return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function dolibarr_del_const($db, $name, $entity=1)
|
||||
{
|
||||
global $conf;
|
||||
@ -297,7 +297,7 @@ function dolibarr_del_const($db, $name, $entity=1)
|
||||
$sql.=" WHERE (name='".addslashes($name)."' OR rowid='".addslashes($name)."')";
|
||||
$sql.= " AND entity = ".$entity;
|
||||
|
||||
dol_syslog("admin.lib::dolibarr_del_const sql=".$sql);
|
||||
dol_syslog("admin.lib::dolibarr_del_const sql=".$sql);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -311,86 +311,86 @@ function dolibarr_del_const($db, $name, $entity=1)
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Recupere une constante depuis la base de donnees.
|
||||
\sa dolibarr_del_const, dolibarr_set_const
|
||||
\param db Handler d'acces base
|
||||
\param name Nom de la constante
|
||||
\param entity Multi company id
|
||||
\return string Valeur de la constante
|
||||
*/
|
||||
\brief Recupere une constante depuis la base de donnees.
|
||||
\sa dolibarr_del_const, dolibarr_set_const
|
||||
\param db Handler d'acces base
|
||||
\param name Nom de la constante
|
||||
\param entity Multi company id
|
||||
\return string Valeur de la constante
|
||||
*/
|
||||
function dolibarr_get_const($db, $name, $entity=1)
|
||||
{
|
||||
global $conf;
|
||||
$value='';
|
||||
$value='';
|
||||
|
||||
$sql = "SELECT value";
|
||||
$sql.= " FROM llx_const";
|
||||
$sql.= " WHERE name = '".addslashes($name)."'";
|
||||
$sql.= " AND entity = ".$entity;
|
||||
$sql = "SELECT value";
|
||||
$sql.= " FROM llx_const";
|
||||
$sql.= " WHERE name = '".addslashes($name)."'";
|
||||
$sql.= " AND entity = ".$entity;
|
||||
|
||||
dol_syslog("admin.lib::dolibarr_get_const sql=".$sql);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj=$db->fetch_object($resql);
|
||||
if ($obj) $value=$obj->value;
|
||||
}
|
||||
return $value;
|
||||
dol_syslog("admin.lib::dolibarr_get_const sql=".$sql);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj=$db->fetch_object($resql);
|
||||
if ($obj) $value=$obj->value;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
\brief Insertion d'une constante dans la base de donnees.
|
||||
\sa dolibarr_del_const, dolibarr_get_const
|
||||
\param db Handler d'acces base
|
||||
\param name Nom de la constante
|
||||
\param value Valeur de la constante
|
||||
\param type Type de constante (chaine par defaut)
|
||||
\param visible La constante est elle visible (0 par defaut)
|
||||
\param note Explication de la constante
|
||||
\param entity Multi company id
|
||||
\return int -1 if KO, 1 if OK
|
||||
*/
|
||||
* \brief Insertion d'une constante dans la base de donnees.
|
||||
* \sa dolibarr_del_const, dolibarr_get_const
|
||||
* \param db Handler d'acces base
|
||||
* \param name Nom de la constante
|
||||
* \param value Valeur de la constante
|
||||
* \param type Type de constante (chaine par defaut)
|
||||
* \param visible La constante est elle visible (0 par defaut)
|
||||
* \param note Note on parameter
|
||||
* \param entity Multi company id
|
||||
* \return int -1 if KO, 1 if OK
|
||||
*/
|
||||
function dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if (empty($name))
|
||||
{
|
||||
dol_print_error("Error: Call to function dolibarr_set_const with wrong parameters", LOG_ERR);
|
||||
exit;
|
||||
}
|
||||
{
|
||||
dol_print_error("Error: Call to function dolibarr_set_const with wrong parameters", LOG_ERR);
|
||||
exit;
|
||||
}
|
||||
|
||||
$db->begin();
|
||||
$db->begin();
|
||||
|
||||
//dol_syslog("dolibarr_set_const name=$name, value=$value");
|
||||
$sql = "DELETE FROM llx_const WHERE name = '".addslashes($name)."'";
|
||||
$sql.= " AND entity = ".$entity;
|
||||
dol_syslog("admin.lib::dolibarr_set_const sql=".$sql, LOG_DEBUG);
|
||||
//dol_syslog("dolibarr_set_const name=$name, value=$value");
|
||||
$sql = "DELETE FROM llx_const WHERE name = '".addslashes($name)."'";
|
||||
$sql.= " AND entity = ".$entity;
|
||||
dol_syslog("admin.lib::dolibarr_set_const sql=".$sql, LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
|
||||
if (strcmp($value,'')) // true if different. Must work for $value='0' or $value=0
|
||||
{
|
||||
$sql = "INSERT INTO llx_const(name,value,type,visible,note,entity)";
|
||||
$sql.= " VALUES ('".$name."','".addslashes($value)."','".$type."',".$visible.",'".addslashes($note)."',".$entity.")";
|
||||
if (strcmp($value,'')) // true if different. Must work for $value='0' or $value=0
|
||||
{
|
||||
$sql = "INSERT INTO llx_const(name,value,type,visible,note,entity)";
|
||||
$sql.= " VALUES ('".$name."','".addslashes($value)."','".$type."',".$visible.",'".addslashes($note)."',".$entity.")";
|
||||
|
||||
dol_syslog("admin.lib::dolibarr_set_const sql=".$sql, LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
}
|
||||
|
||||
if ($resql)
|
||||
{
|
||||
$db->commit();
|
||||
$conf->global->$name=$value;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$error=$db->lasterror();
|
||||
dol_syslog("admin.lib::dolibarr_set_const ".$error, LOG_ERR);
|
||||
$db->rollback();
|
||||
return -1;
|
||||
}
|
||||
$resql=$db->query($sql);
|
||||
}
|
||||
|
||||
if ($resql)
|
||||
{
|
||||
$db->commit();
|
||||
$conf->global->$name=$value;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$error=$db->lasterror();
|
||||
dol_syslog("admin.lib::dolibarr_set_const ".$error, LOG_ERR);
|
||||
$db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -890,7 +890,7 @@ else
|
||||
// Administrateur
|
||||
print '<tr><td width="25%" valign="top">'.$langs->trans("Administrator").'</td>';
|
||||
print '<td>'.yn($fuser->admin);
|
||||
if ($conf->global->MAIN_MODULE_MULTICOMPANY && $fuser->admin && ! $fuser->entity)
|
||||
if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY) && $fuser->admin && ! $fuser->entity)
|
||||
{
|
||||
print ' '.img_redstar($langs->trans("SuperAdministrator"));
|
||||
}
|
||||
@ -912,7 +912,7 @@ else
|
||||
{
|
||||
print $langs->trans("DomainUser",$ldap->domainFQDN);
|
||||
}
|
||||
else if ($fuser->entity!=0)
|
||||
else if (empty($conf->global->MAIN_MODULE_MULTICOMPANY) || ! empty($fuser->entity))
|
||||
{
|
||||
print $html->textwithpicto($langs->trans("Internal"),$langs->trans("InternalExternalDesc"));
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user