agenda_xcal.php 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <?php
  2. /* Copyright (C) 2008-2010 Laurent Destailleur <eldy@users.sourceforge.net>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. /**
  18. * \file htdocs/admin/agenda_xcal.php
  19. * \ingroup agenda
  20. * \brief Page to setup miscellaneous options of agenda module
  21. */
  22. require("../main.inc.php");
  23. require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
  24. require_once(DOL_DOCUMENT_ROOT.'/lib/agenda.lib.php');
  25. if (!$user->admin)
  26. accessforbidden();
  27. $langs->load("admin");
  28. $langs->load("other");
  29. $langs->load("agenda");
  30. $def = array();
  31. $actionsave=$_POST["save"];
  32. // Sauvegardes parametres
  33. if ($actionsave)
  34. {
  35. $i=0;
  36. $db->begin();
  37. $i+=dolibarr_set_const($db,'MAIN_AGENDA_XCAL_EXPORTKEY',trim($_POST["MAIN_AGENDA_XCAL_EXPORTKEY"]),'chaine',0,'',$conf->entity);
  38. $i+=dolibarr_set_const($db,'MAIN_AGENDA_EXPORT_PAST_DELAY',trim($_POST["MAIN_AGENDA_EXPORT_PAST_DELAY"]),'chaine',0,'',$conf->entity);
  39. $i+=dolibarr_set_const($db,'MAIN_AGENDA_EXPORT_CACHE',trim($_POST["MAIN_AGENDA_EXPORT_CACHE"]),'chaine',0,'',$conf->entity);
  40. if ($i >= 3)
  41. {
  42. $db->commit();
  43. $mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
  44. }
  45. else
  46. {
  47. $db->rollback();
  48. $mesg = "<font class=\"error\">".$langs->trans("SaveFailed")."</font>";
  49. }
  50. }
  51. /**
  52. * View
  53. */
  54. if (! isset($conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)) $conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY=100;
  55. llxHeader();
  56. $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
  57. print_fiche_titre($langs->trans("AgendaSetup"),$linkback,'setup');
  58. print '<br>';
  59. print $langs->trans("AgendaSetupOtherDesc")."<br>\n";
  60. print "<br>\n";
  61. $head=agenda_prepare_head();
  62. dol_fiche_head($head, 'xcal', $langs->trans("Agenda"));
  63. print '<form name="agendasetupform" action="'.$_SERVER["PHP_SELF"].'" method="post">';
  64. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  65. print "<table class=\"noborder\" width=\"100%\">";
  66. print "<tr class=\"liste_titre\">";
  67. print "<td>".$langs->trans("Parameter")."</td>";
  68. print "<td>".$langs->trans("Value")."</td>";
  69. //print "<td>".$langs->trans("Examples")."</td>";
  70. print "<td>&nbsp;</td>";
  71. print "</tr>";
  72. print "<tr class=\"impair\">";
  73. print '<td class="fieldrequired">'.$langs->trans("PasswordTogetVCalExport")."</td>";
  74. print "<td><input type=\"text\" class=\"flat\" name=\"MAIN_AGENDA_XCAL_EXPORTKEY\" value=\"". ($_POST["MAIN_AGENDA_XCAL_EXPORTKEY"]?$_POST["MAIN_AGENDA_XCAL_EXPORTKEY"]:$conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) . "\" size=\"40\"></td>";
  75. print "<td>&nbsp;</td>";
  76. print "</tr>";
  77. print "<tr class=\"pair\">";
  78. print "<td>".$langs->trans("PastDelayVCalExport")."</td>";
  79. print "<td><input type=\"text\" class=\"flat\" name=\"MAIN_AGENDA_EXPORT_PAST_DELAY\" value=\"". ($_POST["MAIN_AGENDA_EXPORT_PAST_DELAY"]?$_POST["MAIN_AGENDA_EXPORT_PAST_DELAY"]:$conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY) . "\" size=\"10\"> ".$langs->trans("days")."</td>";
  80. print "<td>&nbsp;</td>";
  81. print "</tr>";
  82. print "<tr class=\"impair\">";
  83. print "<td>".$langs->trans("UseACacheDelay")."</td>";
  84. 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>";
  85. print "<td>&nbsp;</td>";
  86. print "</tr>";
  87. print '</table>';
  88. print '<br><center>';
  89. print "<input type=\"submit\" name=\"save\" class=\"button\" value=\"".$langs->trans("Save")."\">";
  90. print "</center>";
  91. print "</form>\n";
  92. print '</div>';
  93. clearstatcache();
  94. if ($mesg) print "<br>$mesg<br>";
  95. print "<br>";
  96. // Show message
  97. $message='';
  98. $urlvcal='<a href="'.DOL_MAIN_URL_ROOT.'/public/agenda/agendaexport.php?format=vcal&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'...').'" target="_blank">'.DOL_MAIN_URL_ROOT.'/public/agenda/agendaexport.php?format=vcal&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'KEYNOTDEFINED').'</a>';
  99. $message.=img_picto('','object_globe.png').' '.$langs->trans("WebCalUrlForVCalExport",'vcal',$urlvcal);
  100. $message.='<br>';
  101. $urlical='<a href="'.DOL_MAIN_URL_ROOT.'/public/agenda/agendaexport.php?format=ical&type=event&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'...').'" target="_blank">'.DOL_MAIN_URL_ROOT.'/public/agenda/agendaexport.php?format=ical&type=event&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'KEYNOTDEFINED').'</a>';
  102. $message.=img_picto('','object_globe.png').' '.$langs->trans("WebCalUrlForVCalExport",'ical/ics',$urlical);
  103. $message.='<br>';
  104. $urlrss='<a href="'.DOL_MAIN_URL_ROOT.'/public/agenda/agendaexport.php?format=rss&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'...').'" target="_blank">'.DOL_MAIN_URL_ROOT.'/public/agenda/agendaexport.php?format=rss&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'KEYNOTDEFINED').'</a>';
  105. $message.=img_picto('','object_globe.png').' '.$langs->trans("WebCalUrlForVCalExport",'rss',$urlrss);
  106. $message.='<br>';
  107. $message.='<br>';
  108. print $message;
  109. $message=$langs->trans("AgendaUrlOptions1",$user->login,$user->login).'<br>';
  110. $message.=$langs->trans("AgendaUrlOptions2",$user->login,$user->login).'<br>';
  111. $message.=$langs->trans("AgendaUrlOptions3",$user->login,$user->login).'<br>';
  112. $message.=$langs->trans("AgendaUrlOptions4",$user->login,$user->login).'<br>';
  113. $message.=$langs->trans("AgendaUrlOptions5",$user->login,$user->login);
  114. print info_admin($message);
  115. $db->close();
  116. llxFooter();
  117. ?>