dolibarr/htdocs/admin/clicktodial.php

134 lines
4.2 KiB
PHP
Raw Normal View History

2005-01-14 15:08:01 +01:00
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
2011-03-05 19:29:02 +01:00
* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.org>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
2005-01-14 15:08:01 +01: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
* the Free Software Foundation; either version 3 of the License, or
2005-01-14 15:08:01 +01: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/>.
2005-01-14 15:08:01 +01:00
*/
2010-03-24 14:12:34 +01:00
/**
* \file htdocs/admin/clicktodial.php
* \ingroup clicktodial
2011-03-05 19:29:02 +01:00
* \brief Page to setup module clicktodial
*/
2005-01-14 15:08:01 +01:00
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
2005-01-14 15:08:01 +01:00
$langs->load("admin");
2011-09-21 15:24:27 +02:00
if (!$user->admin) accessforbidden();
$action = GETPOST("action");
2005-01-14 15:08:01 +01:00
2011-09-06 12:52:42 +02:00
/*
* Actions
*/
if ($action == 'setvalue' && $user->admin)
2005-01-14 15:08:01 +01:00
{
$result=dolibarr_set_const($db, "CLICKTODIAL_URL", GETPOST("url"), 'chaine', 0, '', $conf->entity);
2011-09-21 15:24:27 +02:00
if ($result >= 0)
{
setEventMessage($langs->trans("SetupSaved"));
2011-09-21 15:24:27 +02:00
}
else
{
setEventMessage($langs->trans("Error"),'errors');
2005-01-14 15:08:01 +01:00
}
}
/*
2011-09-06 12:52:42 +02:00
* View
2005-01-14 15:08:01 +01:00
*/
$user->fetch_clicktodial();
2010-03-24 14:12:34 +01:00
$wikihelp='EN:Module_ClickToDial_En|FR:Module_ClickToDial|ES:Módulo_ClickTodial_Es';
2010-05-26 13:42:29 +02:00
llxHeader('',$langs->trans("ClickToDialSetup"),$wikihelp);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("ClickToDialSetup"),$linkback,'setup');
2005-01-14 15:08:01 +01:00
print $langs->trans("ClickToDialDesc")."<br>\n";
2005-01-14 22:09:22 +01:00
print '<br>';
2005-01-14 15:08:01 +01:00
print '<form method="post" action="clicktodial.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
2005-01-14 15:08:01 +01:00
print '<input type="hidden" name="action" value="setvalue">';
$var=true;
2013-03-31 04:03:08 +02:00
print '<table class="noborder" width="100%">';
2005-01-14 22:09:22 +01:00
print '<tr class="liste_titre">';
2011-03-05 19:29:02 +01:00
print '<td width="120">'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Value").'</td>';
2005-01-14 15:08:01 +01:00
print "</tr>\n";
$var=!$var;
2011-03-05 19:29:02 +01:00
print '<tr '.$bc[$var].'><td valign="top">';
print $langs->trans("DefaultLink").'</td><td>';
2011-03-05 19:29:02 +01:00
print '<input size="92" type="text" name="url" value="'.$conf->global->CLICKTODIAL_URL.'"><br>';
print '<br>';
print $langs->trans("ClickToDialUrlDesc").'<br>';
print $langs->trans("Example").':<br>http://myphoneserver/mypage?login=__LOGIN__&password=__PASS__&caller=__PHONEFROM__&called=__PHONETO__';
2013-06-05 16:24:32 +02:00
//if (! empty($user->clicktodial_url))
//{
print '<br>';
print info_admin($langs->trans("ValueOverwrittenByUserSetup"));
//}
2005-01-14 15:08:01 +01:00
print '</td></tr>';
2013-03-31 04:03:08 +02:00
print '</table>';
2005-01-14 15:08:01 +01:00
2013-03-31 04:03:08 +02:00
print '<center><br><input type="submit" class="button" value="'.$langs->trans("Modify").'"></center>';
2013-03-31 16:51:49 +02:00
print '</form><br><br>';
2013-03-31 04:03:08 +02:00
if (! empty($conf->global->CLICKTODIAL_URL))
{
$user->fetch_clicktodial();
$phonefortest=$mysoc->phone;
if (GETPOST('phonefortest')) $phonefortest=GETPOST('phonefortest');
print '<form action="'.$_SERVER["PHP_SELF"].'">';
print $langs->trans("LinkToTestClickToDial",$user->login).' : ';
print '<input class="flat" type="text" name="phonefortest" value="'.dol_escape_htmltag($phonefortest).'">';
print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("RefreshPhoneLink")).'">';
print '</form>';
2013-03-31 04:03:08 +02:00
$setupcomplete=1;
2013-06-05 16:24:32 +02:00
if (preg_match('/__LOGIN__/',$conf->global->CLICKTODIAL_URL) && empty($user->clicktodial_login)) $setupcomplete=0;
if (preg_match('/__PASSWORD__/',$conf->global->CLICKTODIAL_URL) && empty($user->clicktodial_password)) $setupcomplete=0;
if (preg_match('/__PHONEFROM__/',$conf->global->CLICKTODIAL_URL) && empty($user->clicktodial_poste)) $setupcomplete=0;
2013-03-31 04:03:08 +02:00
if ($setupcomplete)
{
print $langs->trans("LinkToTest",$user->login).': '.dol_print_phone($phonefortest, '', 0, 0, 'AC_TEL');
2013-03-31 04:03:08 +02:00
}
else
{
$langs->load("errors");
print '<div class="warning">'.$langs->trans("WarningClickToDialUserSetupNotComplete").'</div>';
}
}
2010-07-28 23:12:30 +02:00
llxFooter();
$db->close();
2013-03-31 04:03:08 +02:00
?>