DAV module
This commit is contained in:
parent
f659b62316
commit
98b9f6bb47
163
htdocs/admin/dav.php
Normal file
163
htdocs/admin/dav.php
Normal file
@ -0,0 +1,163 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2008-2018 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
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (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
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/admin/dav.php
|
||||||
|
* \ingroup dav
|
||||||
|
* \brief Page to setup DAV server
|
||||||
|
*/
|
||||||
|
|
||||||
|
require '../main.inc.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/dav/dav.lib.php';
|
||||||
|
|
||||||
|
|
||||||
|
if (!$user->admin)
|
||||||
|
accessforbidden();
|
||||||
|
|
||||||
|
$langs->load("admin");
|
||||||
|
$langs->load("other");
|
||||||
|
$langs->load("agenda");
|
||||||
|
|
||||||
|
$def = array();
|
||||||
|
$actionsave=GETPOST('save','alpha');
|
||||||
|
|
||||||
|
// Sauvegardes parametres
|
||||||
|
if ($actionsave)
|
||||||
|
{
|
||||||
|
$i=0;
|
||||||
|
|
||||||
|
$db->begin();
|
||||||
|
|
||||||
|
$i+=dolibarr_set_const($db,'XXX',trim(GETPOST('XXX','alpha')),'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
|
if ($i >= 4)
|
||||||
|
{
|
||||||
|
$db->commit();
|
||||||
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$db->rollback();
|
||||||
|
setEventMessages($langs->trans("SaveFailed"), null, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
llxHeader('', $langs->trans("DAVSetup"), $wikihelp);
|
||||||
|
|
||||||
|
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||||
|
print load_fiche_titre($langs->trans("DAVSetup"),$linkback,'title_setup');
|
||||||
|
|
||||||
|
|
||||||
|
print '<form name="agendasetupform" action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
|
||||||
|
$head=dav_admin_prepare_head();
|
||||||
|
|
||||||
|
dol_fiche_head($head, 'webdav', '', -1, 'action');
|
||||||
|
|
||||||
|
print $langs->trans("WebDAVSetupDesc")."<br>\n";
|
||||||
|
print "<br>\n";
|
||||||
|
|
||||||
|
/*
|
||||||
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print "<td>".$langs->trans("Parameter")."</td>";
|
||||||
|
print "<td>".$langs->trans("Value")."</td>";
|
||||||
|
//print "<td>".$langs->trans("Examples")."</td>";
|
||||||
|
print "<td> </td>";
|
||||||
|
print "</tr>";
|
||||||
|
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
print '<td class="fieldrequired">'.$langs->trans("PasswordTogetVCalExport")."</td>";
|
||||||
|
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>';
|
||||||
|
print "<td> </td>";
|
||||||
|
print "</tr>";
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
*/
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
|
||||||
|
/*print '<div class="center">';
|
||||||
|
print "<input type=\"submit\" name=\"save\" class=\"button\" value=\"".$langs->trans("Save")."\">";
|
||||||
|
print "</div>";
|
||||||
|
*/
|
||||||
|
print "</form>\n";
|
||||||
|
|
||||||
|
|
||||||
|
clearstatcache();
|
||||||
|
|
||||||
|
//if ($mesg) print "<br>$mesg<br>";
|
||||||
|
print "<br>";
|
||||||
|
|
||||||
|
|
||||||
|
// 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
|
||||||
|
|
||||||
|
|
||||||
|
// Show message
|
||||||
|
$message='';
|
||||||
|
$url='<a href="'.$urlwithroot.'/dav/fileserver.php" target="_blank">'.$urlwithroot.'/dav/fileserver.php</a>';
|
||||||
|
$message.=img_picto('','object_globe.png').' '.$langs->trans("WebDavServer",'WebDAV',$url);
|
||||||
|
$message.='<br>';
|
||||||
|
print $message;
|
||||||
|
|
||||||
|
/*$message =$langs->trans("AgendaUrlOptions1",$user->login,$user->login).'<br>';
|
||||||
|
$message.=$langs->trans("AgendaUrlOptions3",$user->login,$user->login).'<br>';
|
||||||
|
$message.=$langs->trans("AgendaUrlOptionsNotAdmin",$user->login,$user->login).'<br>';
|
||||||
|
$message.=$langs->trans("AgendaUrlOptions4",$user->login,$user->login).'<br>';
|
||||||
|
$message.=$langs->trans("AgendaUrlOptionsProject",$user->login,$user->login).'<br>';
|
||||||
|
$message.=$langs->trans("AgendaUrlOptionsNotAutoEvent",'systemauto','systemauto').'<br>';
|
||||||
|
|
||||||
|
print info_admin($message);
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
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>';
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
@ -305,7 +305,7 @@ class modDav extends DolibarrModules
|
|||||||
*/
|
*/
|
||||||
public function init($options='')
|
public function init($options='')
|
||||||
{
|
{
|
||||||
$this->_load_tables();
|
//$this->_load_tables('/dav/sql/');
|
||||||
|
|
||||||
// Create extrafields
|
// Create extrafields
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||||
|
|||||||
@ -38,3 +38,35 @@ if(!defined('CDAV_URI_KEY'))
|
|||||||
else
|
else
|
||||||
define('CDAV_URI_KEY', substr(md5($_SERVER['HTTP_HOST']),0,8));
|
define('CDAV_URI_KEY', substr(md5($_SERVER['HTTP_HOST']),0,8));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepare array with list of tabs
|
||||||
|
*
|
||||||
|
* @return array Array of tabs to show
|
||||||
|
*/
|
||||||
|
function dav_admin_prepare_head()
|
||||||
|
{
|
||||||
|
global $db, $langs, $conf;
|
||||||
|
|
||||||
|
$h = 0;
|
||||||
|
$head = array();
|
||||||
|
|
||||||
|
$head[$h][0] = DOL_URL_ROOT.'/admin/dav.php?id='.$object->id;
|
||||||
|
$head[$h][1] = $langs->trans("WebDAV");
|
||||||
|
$head[$h][2] = 'webdav';
|
||||||
|
$h++;
|
||||||
|
|
||||||
|
// Show more tabs from modules
|
||||||
|
// Entries must be declared in modules descriptor with line
|
||||||
|
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||||
|
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||||
|
complete_head_from_modules($conf,$langs,$object,$head,$h,'admindav');
|
||||||
|
|
||||||
|
complete_head_from_modules($conf,$langs,$object,$head,$h,'admindav','remove');
|
||||||
|
|
||||||
|
return $head;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@ -470,6 +470,7 @@ WatermarkOnDraftExpenseReports=Watermark on draft expense reports
|
|||||||
AttachMainDocByDefault=Set this to 1 if you want to attach main document to email by default (if applicable)
|
AttachMainDocByDefault=Set this to 1 if you want to attach main document to email by default (if applicable)
|
||||||
FilesAttachedToEmail=Attach file
|
FilesAttachedToEmail=Attach file
|
||||||
SendEmailsReminders=Send agenda reminders by emails
|
SendEmailsReminders=Send agenda reminders by emails
|
||||||
|
davDescription=Add a component to be a DAV server
|
||||||
# Modules
|
# Modules
|
||||||
Module0Name=Users & groups
|
Module0Name=Users & groups
|
||||||
Module0Desc=Users / Employees and Groups management
|
Module0Desc=Users / Employees and Groups management
|
||||||
@ -1779,6 +1780,7 @@ MAIN_PDF_MARGIN_BOTTOM=Bottom margin on PDF
|
|||||||
SetToYesIfGroupIsComputationOfOtherGroups=Set this to yes if this group is a computation of other groups
|
SetToYesIfGroupIsComputationOfOtherGroups=Set this to yes if this group is a computation of other groups
|
||||||
EnterCalculationRuleIfPreviousFieldIsYes=Enter calculcation rule if previous field was set to Yes (For example 'CODEGRP1+CODEGRP2')
|
EnterCalculationRuleIfPreviousFieldIsYes=Enter calculcation rule if previous field was set to Yes (For example 'CODEGRP1+CODEGRP2')
|
||||||
SeveralLangugeVariatFound=Several language variants found
|
SeveralLangugeVariatFound=Several language variants found
|
||||||
|
WebDavServer=URL of %s server : %s
|
||||||
##### Resource ####
|
##### Resource ####
|
||||||
ResourceSetup=Configuration du module Resource
|
ResourceSetup=Configuration du module Resource
|
||||||
UseSearchToSelectResource=Use a search form to choose a resource (rather than a drop-down list).
|
UseSearchToSelectResource=Use a search form to choose a resource (rather than a drop-down list).
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user