2008-04-08 20:24:56 +02:00
|
|
|
<?php
|
2015-06-30 21:50:24 +02:00
|
|
|
/* Copyright (C) 2008-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
2013-08-14 11:11:49 +02:00
|
|
|
* Copyright (C) 2012-2013 Juanjo Menent <jmenent@2byte.es>
|
2018-10-27 14:43:12 +02:00
|
|
|
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
|
2015-04-18 19:47:09 +02:00
|
|
|
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
2008-04-08 20:24:56 +02:00
|
|
|
*
|
|
|
|
|
* 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
|
2013-01-16 15:36:08 +01:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2008-04-08 20:24:56 +02:00
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2011-08-01 00:21:57 +02:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2008-04-08 20:24:56 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
2009-11-12 03:21:51 +01:00
|
|
|
* \file htdocs/admin/agenda_xcal.php
|
2009-05-04 22:57:26 +02:00
|
|
|
* \ingroup agenda
|
2009-11-12 03:21:51 +01:00
|
|
|
* \brief Page to setup miscellaneous options of agenda module
|
2009-05-04 22:57:26 +02:00
|
|
|
*/
|
2008-04-08 20:24:56 +02:00
|
|
|
|
2012-08-22 23:24:21 +02:00
|
|
|
require '../main.inc.php';
|
2012-08-22 23:11:24 +02:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
|
2008-04-08 20:24:56 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!$user->admin)
|
|
|
|
|
accessforbidden();
|
|
|
|
|
|
2018-05-26 18:41:16 +02:00
|
|
|
// Load translation files required by the page
|
2018-05-12 11:02:44 +02:00
|
|
|
$langs->loadLangs(array("admin","other","agenda"));
|
2008-04-08 20:24:56 +02:00
|
|
|
|
|
|
|
|
$def = array();
|
2012-03-29 12:41:11 +02:00
|
|
|
$actionsave=GETPOST('save','alpha');
|
2008-04-08 20:24:56 +02:00
|
|
|
|
|
|
|
|
// Sauvegardes parametres
|
|
|
|
|
if ($actionsave)
|
|
|
|
|
{
|
|
|
|
|
$i=0;
|
|
|
|
|
|
|
|
|
|
$db->begin();
|
2009-05-04 22:57:26 +02:00
|
|
|
|
2012-03-29 12:41:11 +02:00
|
|
|
$i+=dolibarr_set_const($db,'MAIN_AGENDA_XCAL_EXPORTKEY',trim(GETPOST('MAIN_AGENDA_XCAL_EXPORTKEY','alpha')),'chaine',0,'',$conf->entity);
|
|
|
|
|
$i+=dolibarr_set_const($db,'MAIN_AGENDA_EXPORT_PAST_DELAY',trim(GETPOST('MAIN_AGENDA_EXPORT_PAST_DELAY','alpha')),'chaine',0,'',$conf->entity);
|
|
|
|
|
$i+=dolibarr_set_const($db,'MAIN_AGENDA_EXPORT_CACHE',trim(GETPOST('MAIN_AGENDA_EXPORT_CACHE','alpha')),'chaine',0,'',$conf->entity);
|
2013-11-28 12:58:02 +01:00
|
|
|
$i+=dolibarr_set_const($db,'AGENDA_EXPORT_FIX_TZ',trim(GETPOST('AGENDA_EXPORT_FIX_TZ','alpha')),'chaine',0,'',$conf->entity);
|
2014-06-21 18:03:01 +02:00
|
|
|
|
2013-11-28 12:58:02 +01:00
|
|
|
if ($i >= 4)
|
2008-04-08 20:24:56 +02:00
|
|
|
{
|
|
|
|
|
$db->commit();
|
2015-10-23 12:58:30 +02:00
|
|
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
2008-04-08 20:24:56 +02:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$db->rollback();
|
2015-10-23 12:58:30 +02:00
|
|
|
setEventMessages($langs->trans("SaveFailed"), null, 'errors');
|
2008-04-08 20:24:56 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2010-01-12 11:41:51 +01:00
|
|
|
* View
|
2008-04-08 20:24:56 +02:00
|
|
|
*/
|
|
|
|
|
|
2010-05-22 11:50:32 +02:00
|
|
|
if (! isset($conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)) $conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY=100;
|
|
|
|
|
|
2017-08-22 08:12:30 +02:00
|
|
|
$wikihelp='EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
|
|
|
|
|
llxHeader('', $langs->trans("AgendaSetup"), $wikihelp);
|
2008-04-08 20:24:56 +02:00
|
|
|
|
2018-02-26 09:20:05 +01:00
|
|
|
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
2015-09-24 18:33:48 +02:00
|
|
|
print load_fiche_titre($langs->trans("AgendaSetup"),$linkback,'title_setup');
|
2008-04-08 20:24:56 +02:00
|
|
|
|
|
|
|
|
|
2015-06-30 21:50:24 +02:00
|
|
|
print '<form name="agendasetupform" action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
|
|
|
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
|
|
|
|
|
2008-04-08 20:24:56 +02:00
|
|
|
$head=agenda_prepare_head();
|
|
|
|
|
|
2017-04-30 04:32:03 +02:00
|
|
|
dol_fiche_head($head, 'xcal', $langs->trans("Agenda"), -1, 'action');
|
2008-04-08 20:24:56 +02:00
|
|
|
|
2013-03-30 14:27:13 +01:00
|
|
|
print $langs->trans("AgendaSetupOtherDesc")."<br>\n";
|
|
|
|
|
print "<br>\n";
|
2008-04-08 20:24:56 +02:00
|
|
|
|
2015-06-30 21:50:24 +02:00
|
|
|
print '<table class="noborder" width="100%">';
|
2008-04-08 20:24:56 +02:00
|
|
|
|
2015-06-30 21:50:24 +02:00
|
|
|
print '<tr class="liste_titre">';
|
2009-05-04 22:57:26 +02:00
|
|
|
print "<td>".$langs->trans("Parameter")."</td>";
|
2008-04-08 20:24:56 +02:00
|
|
|
print "<td>".$langs->trans("Value")."</td>";
|
|
|
|
|
//print "<td>".$langs->trans("Examples")."</td>";
|
|
|
|
|
print "<td> </td>";
|
|
|
|
|
print "</tr>";
|
|
|
|
|
|
2017-05-09 21:01:37 +02:00
|
|
|
print '<tr class="oddeven">';
|
2010-10-31 14:29:33 +01:00
|
|
|
print '<td class="fieldrequired">'.$langs->trans("PasswordTogetVCalExport")."</td>";
|
2012-10-24 12:18:40 +02:00
|
|
|
print '<td><input required="required" type="text" class="flat" id="MAIN_AGENDA_XCAL_EXPORTKEY" name="MAIN_AGENDA_XCAL_EXPORTKEY" value="' . (GETPOST('MAIN_AGENDA_XCAL_EXPORTKEY','alpha')?GETPOST('MAIN_AGENDA_XCAL_EXPORTKEY','alpha'):$conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) . '" size="40">';
|
|
|
|
|
if (! empty($conf->use_javascript_ajax))
|
|
|
|
|
print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"');
|
|
|
|
|
print '</td>';
|
2008-04-08 20:24:56 +02:00
|
|
|
print "<td> </td>";
|
|
|
|
|
print "</tr>";
|
|
|
|
|
|
2017-05-09 21:01:37 +02:00
|
|
|
print '<tr class="oddeven">';
|
2010-05-22 11:50:32 +02:00
|
|
|
print "<td>".$langs->trans("PastDelayVCalExport")."</td>";
|
2012-03-29 12:41:11 +02:00
|
|
|
print "<td><input type=\"text\" class=\"flat\" name=\"MAIN_AGENDA_EXPORT_PAST_DELAY\" value=\"". (GETPOST('MAIN_AGENDA_EXPORT_PAST_DELAY','alpha')?GETPOST('MAIN_AGENDA_EXPORT_PAST_DELAY','alpha'):$conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY) . "\" size=\"10\"> ".$langs->trans("days")."</td>";
|
2010-05-22 11:50:32 +02:00
|
|
|
print "<td> </td>";
|
|
|
|
|
print "</tr>";
|
|
|
|
|
|
2017-05-09 21:01:37 +02:00
|
|
|
print '<tr class="oddeven">';
|
2009-05-04 22:57:26 +02:00
|
|
|
print "<td>".$langs->trans("UseACacheDelay")."</td>";
|
2012-03-29 12:41:11 +02:00
|
|
|
print "<td><input type=\"text\" class=\"flat\" name=\"MAIN_AGENDA_EXPORT_CACHE\" value=\"". (GETPOST('MAIN_AGENDA_EXPORT_CACHE','alpha')?GETPOST('MAIN_AGENDA_EXPORT_CACHE','alpha'):$conf->global->MAIN_AGENDA_EXPORT_CACHE) . "\" size=\"10\"></td>";
|
2009-05-04 22:57:26 +02:00
|
|
|
print "<td> </td>";
|
|
|
|
|
print "</tr>";
|
|
|
|
|
|
2008-04-08 20:24:56 +02:00
|
|
|
print '</table>';
|
|
|
|
|
|
2013-11-28 12:58:02 +01:00
|
|
|
print '<br>';
|
|
|
|
|
|
2015-06-30 21:50:24 +02:00
|
|
|
print '<table class="noborder" width="100%">';
|
2013-11-28 12:58:02 +01:00
|
|
|
|
2015-06-30 21:50:24 +02:00
|
|
|
print '<tr class="liste_titre">';
|
2013-11-28 12:58:02 +01:00
|
|
|
print '<td width="25%">'.$langs->trans("Parameter")."</td>";
|
|
|
|
|
print "<td>".$langs->trans("Value")."</td>";
|
|
|
|
|
print "</tr>";
|
2017-05-09 21:01:37 +02:00
|
|
|
print '<tr class="oddeven">';
|
|
|
|
|
print '<td>'.$langs->trans("FixTZ")."</td>";
|
2013-11-28 12:58:02 +01:00
|
|
|
print "<td>";
|
|
|
|
|
print '<input class="flat" type="text" size="4" name="AGENDA_EXPORT_FIX_TZ" value="'.$conf->global->AGENDA_EXPORT_FIX_TZ.'">';
|
|
|
|
|
print ' '.$langs->trans("FillThisOnlyIfRequired");
|
|
|
|
|
print "</td>";
|
|
|
|
|
print "</tr>";
|
|
|
|
|
|
|
|
|
|
print '</table>';
|
|
|
|
|
|
2015-06-30 21:50:24 +02:00
|
|
|
dol_fiche_end();
|
|
|
|
|
|
|
|
|
|
print '<div class="center">';
|
2008-04-08 20:24:56 +02:00
|
|
|
print "<input type=\"submit\" name=\"save\" class=\"button\" value=\"".$langs->trans("Save")."\">";
|
2014-11-25 20:13:43 +01:00
|
|
|
print "</div>";
|
2008-04-08 20:24:56 +02:00
|
|
|
|
|
|
|
|
print "</form>\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
clearstatcache();
|
|
|
|
|
|
2011-09-02 17:41:35 +02:00
|
|
|
//if ($mesg) print "<br>$mesg<br>";
|
2008-04-08 20:24:56 +02:00
|
|
|
print "<br>";
|
|
|
|
|
|
2012-12-12 14:46:13 +01:00
|
|
|
|
2012-12-13 13:08:03 +01:00
|
|
|
// Define $urlwithroot
|
|
|
|
|
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
|
|
|
|
|
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
|
|
|
|
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
2012-12-12 14:46:13 +01:00
|
|
|
|
|
|
|
|
|
2008-04-08 20:24:56 +02:00
|
|
|
// Show message
|
|
|
|
|
$message='';
|
2012-12-12 14:46:13 +01:00
|
|
|
$urlvcal='<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=vcal&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'...').'" target="_blank">'.$urlwithroot.'/public/agenda/agendaexport.php?format=vcal&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'KEYNOTDEFINED').'</a>';
|
2010-10-31 14:29:33 +01:00
|
|
|
$message.=img_picto('','object_globe.png').' '.$langs->trans("WebCalUrlForVCalExport",'vcal',$urlvcal);
|
2008-04-08 20:24:56 +02:00
|
|
|
$message.='<br>';
|
2012-12-12 14:46:13 +01:00
|
|
|
$urlical='<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical&type=event&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'...').'" target="_blank">'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical&type=event&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'KEYNOTDEFINED').'</a>';
|
2010-11-20 00:50:27 +01:00
|
|
|
$message.=img_picto('','object_globe.png').' '.$langs->trans("WebCalUrlForVCalExport",'ical/ics',$urlical);
|
2008-04-27 22:31:15 +02:00
|
|
|
$message.='<br>';
|
2012-12-12 14:46:13 +01:00
|
|
|
$urlrss='<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=rss&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'...').'" target="_blank">'.$urlwithroot.'/public/agenda/agendaexport.php?format=rss&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'KEYNOTDEFINED').'</a>';
|
2010-10-31 14:29:33 +01:00
|
|
|
$message.=img_picto('','object_globe.png').' '.$langs->trans("WebCalUrlForVCalExport",'rss',$urlrss);
|
2008-09-06 23:36:26 +02:00
|
|
|
$message.='<br>';
|
|
|
|
|
$message.='<br>';
|
2010-10-31 14:29:33 +01:00
|
|
|
print $message;
|
|
|
|
|
|
2018-02-28 20:06:28 +01:00
|
|
|
$message =$langs->trans("AgendaUrlOptions1",$user->login,$user->login).'<br>';
|
2008-09-06 23:36:26 +02:00
|
|
|
$message.=$langs->trans("AgendaUrlOptions3",$user->login,$user->login).'<br>';
|
2017-07-04 10:29:38 +02:00
|
|
|
$message.=$langs->trans("AgendaUrlOptionsNotAdmin",$user->login,$user->login).'<br>';
|
2008-09-06 23:36:26 +02:00
|
|
|
$message.=$langs->trans("AgendaUrlOptions4",$user->login,$user->login).'<br>';
|
2018-02-28 20:06:28 +01:00
|
|
|
$message.=$langs->trans("AgendaUrlOptionsProject",$user->login,$user->login).'<br>';
|
|
|
|
|
$message.=$langs->trans("AgendaUrlOptionsNotAutoEvent",'systemauto','systemauto').'<br>';
|
2014-10-30 18:19:13 +01:00
|
|
|
|
2008-04-08 20:24:56 +02:00
|
|
|
print info_admin($message);
|
|
|
|
|
|
2012-10-24 12:18:40 +02:00
|
|
|
if (! empty($conf->use_javascript_ajax))
|
|
|
|
|
{
|
|
|
|
|
print "\n".'<script type="text/javascript">';
|
|
|
|
|
print '$(document).ready(function () {
|
|
|
|
|
$("#generate_token").click(function() {
|
|
|
|
|
$.get( "'.DOL_URL_ROOT.'/core/ajax/security.php", {
|
|
|
|
|
action: \'getrandompassword\',
|
|
|
|
|
generic: true
|
|
|
|
|
},
|
|
|
|
|
function(token) {
|
|
|
|
|
$("#MAIN_AGENDA_XCAL_EXPORTKEY").val(token);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});';
|
|
|
|
|
print '</script>';
|
|
|
|
|
}
|
2011-09-02 17:41:35 +02:00
|
|
|
|
2018-07-28 14:29:28 +02:00
|
|
|
// End of page
|
2011-08-27 16:24:16 +02:00
|
|
|
llxFooter();
|
2012-10-24 12:18:40 +02:00
|
|
|
$db->close();
|