2005-01-14 15:08:01 +01:00
|
|
|
<?php
|
2012-07-10 13:20:53 +02:00
|
|
|
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
|
|
|
|
* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
2012-12-30 15:13:49 +01:00
|
|
|
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
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
|
2013-01-16 15:36:08 +01:00
|
|
|
* 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 01:19:04 +02:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2005-01-14 15:08:01 +01:00
|
|
|
*/
|
|
|
|
|
|
2005-01-28 21:35:01 +01:00
|
|
|
/**
|
2009-01-09 22:22:58 +01:00
|
|
|
* \file htdocs/user/clicktodial.php
|
|
|
|
|
* \brief Page for Click to dial datas
|
|
|
|
|
*/
|
2005-01-14 15:08:01 +01: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/usergroups.lib.php';
|
2005-01-14 15:08:01 +01:00
|
|
|
|
|
|
|
|
$langs->load("users");
|
2008-04-28 00:50:11 +02:00
|
|
|
$langs->load("admin");
|
2005-01-14 15:08:01 +01:00
|
|
|
|
2012-01-04 23:17:12 +01:00
|
|
|
$action=GETPOST('action','alpha');
|
|
|
|
|
$id=GETPOST('id','int');
|
|
|
|
|
|
2009-08-17 19:32:38 +02:00
|
|
|
// Security check
|
|
|
|
|
$socid=0;
|
|
|
|
|
if ($user->societe_id > 0) $socid = $user->societe_id;
|
|
|
|
|
$feature2 = (($socid && $user->rights->user->self->creer)?'':'user');
|
2012-06-16 00:07:24 +02:00
|
|
|
if ($user->id == $id) // A user can always read its own card
|
2009-08-17 19:32:38 +02:00
|
|
|
{
|
|
|
|
|
$feature2='';
|
|
|
|
|
}
|
2012-07-08 23:22:22 +02:00
|
|
|
$result = restrictedArea($user, 'user', $id, '&user', $feature2);
|
2012-06-16 00:07:24 +02:00
|
|
|
|
2006-04-01 14:03:31 +02:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Actions
|
|
|
|
|
*/
|
2009-08-05 19:19:55 +02:00
|
|
|
|
2012-01-04 23:17:12 +01:00
|
|
|
if ($action == 'update' && ! $_POST['cancel'])
|
2005-01-14 15:08:01 +01:00
|
|
|
{
|
2010-05-02 20:02:43 +02:00
|
|
|
$edituser = new User($db);
|
2012-01-04 23:17:12 +01:00
|
|
|
$edituser->fetch($id);
|
2009-08-05 19:19:55 +02:00
|
|
|
|
2013-03-31 16:44:24 +02:00
|
|
|
$edituser->clicktodial_url = GETPOST("url");
|
|
|
|
|
$edituser->clicktodial_login = GETPOST("login");
|
|
|
|
|
$edituser->clicktodial_password = GETPOST("password");
|
2013-06-05 16:12:07 +02:00
|
|
|
$edituser->clicktodial_poste = GETPOST("poste");
|
2009-08-05 19:19:55 +02:00
|
|
|
|
2008-01-26 14:18:47 +01:00
|
|
|
$result=$edituser->update_clicktodial();
|
2013-03-31 16:44:24 +02:00
|
|
|
if ($result < 0) setEventMessage($edituser->error,'errors');
|
2005-01-14 15:08:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-08-05 19:19:55 +02:00
|
|
|
/*
|
|
|
|
|
* View
|
|
|
|
|
*/
|
2006-04-01 14:03:31 +02:00
|
|
|
|
2009-08-17 19:32:38 +02:00
|
|
|
$form = new Form($db);
|
|
|
|
|
|
2006-04-01 14:03:31 +02:00
|
|
|
llxHeader("","ClickToDial");
|
2005-01-14 15:08:01 +01:00
|
|
|
|
|
|
|
|
|
2012-10-09 09:34:12 +02:00
|
|
|
if ($id > 0)
|
2005-01-14 15:08:01 +01:00
|
|
|
{
|
2010-04-28 09:31:34 +02:00
|
|
|
$fuser = new User($db);
|
2012-01-04 23:17:12 +01:00
|
|
|
$fuser->fetch($id);
|
2005-08-11 20:48:08 +02:00
|
|
|
$fuser->fetch_clicktodial();
|
|
|
|
|
|
|
|
|
|
|
2006-11-19 17:02:53 +01:00
|
|
|
/*
|
|
|
|
|
* Affichage onglets
|
|
|
|
|
*/
|
|
|
|
|
$head = user_prepare_head($fuser);
|
2005-08-11 20:48:08 +02:00
|
|
|
|
2009-08-05 19:19:55 +02:00
|
|
|
$title = $langs->trans("User");
|
|
|
|
|
dol_fiche_head($head, 'clicktodial', $title, 0, 'user');
|
2005-08-11 20:48:08 +02:00
|
|
|
|
|
|
|
|
/*
|
2006-04-01 14:03:31 +02:00
|
|
|
* Fiche en mode visu
|
|
|
|
|
*/
|
2005-08-11 20:48:08 +02:00
|
|
|
|
|
|
|
|
print '<table class="border" width="100%">';
|
|
|
|
|
|
2008-01-26 14:18:47 +01:00
|
|
|
// Ref
|
|
|
|
|
print '<tr><td width="25%" valign="top">'.$langs->trans("Ref").'</td>';
|
|
|
|
|
print '<td colspan="2">';
|
|
|
|
|
print $form->showrefnav($fuser,'id','',$user->rights->user->user->lire || $user->admin);
|
|
|
|
|
print '</td>';
|
|
|
|
|
print '</tr>';
|
2005-08-11 20:48:08 +02:00
|
|
|
|
2012-01-04 23:17:12 +01:00
|
|
|
// Name
|
2008-01-26 14:18:47 +01:00
|
|
|
print '<tr><td width="25%" valign="top">'.$langs->trans("Lastname").'</td>';
|
2012-01-04 23:17:12 +01:00
|
|
|
print '<td colspan="2">'.$fuser->lastname.'</td>';
|
2005-08-11 20:48:08 +02:00
|
|
|
print "</tr>\n";
|
|
|
|
|
|
2013-02-23 15:26:39 +01:00
|
|
|
// Firstname
|
2008-01-26 14:18:47 +01:00
|
|
|
print '<tr><td width="25%" valign="top">'.$langs->trans("Firstname").'</td>';
|
2013-02-23 15:26:39 +01:00
|
|
|
print '<td colspan="2">'.$fuser->firstname.'</td>';
|
2008-01-26 14:18:47 +01:00
|
|
|
print "</tr>\n";
|
2009-08-05 19:19:55 +02:00
|
|
|
|
2005-08-11 20:48:08 +02:00
|
|
|
print "</table>\n";
|
|
|
|
|
print "<br>\n";
|
|
|
|
|
|
2013-03-31 16:44:24 +02:00
|
|
|
// Edit mode
|
2012-01-04 23:17:12 +01:00
|
|
|
if ($action == 'edit')
|
2005-01-14 15:08:01 +01:00
|
|
|
{
|
2012-10-09 09:34:12 +02:00
|
|
|
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$fuser->id.'" method="post">';
|
2009-05-17 10:01:54 +02:00
|
|
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
2006-04-01 14:03:31 +02:00
|
|
|
print '<input type="hidden" name="action" value="update">';
|
2005-08-11 20:48:08 +02:00
|
|
|
print '<table class="border" width="100%">';
|
2009-08-05 19:19:55 +02:00
|
|
|
|
2008-01-26 14:18:47 +01:00
|
|
|
if ($user->admin)
|
|
|
|
|
{
|
2012-01-04 23:17:12 +01:00
|
|
|
print '<tr><td width="25%" valign="top">ClickToDial URL</td>';
|
2009-01-09 22:22:58 +01:00
|
|
|
print '<td class="valeur">';
|
2013-03-31 16:44:24 +02:00
|
|
|
print '<input name="url" value="'.(! empty($fuser->clicktodial_url)?$fuser->clicktodial_url:'').'" size="92">';
|
|
|
|
|
if (empty($conf->global->CLICKTODIAL_URL) && empty($fuser->clicktodial_url))
|
2011-03-05 19:20:19 +01:00
|
|
|
{
|
|
|
|
|
$langs->load("errors");
|
|
|
|
|
print '<font class="error">'.$langs->trans("ErrorModuleSetupNotComplete").'</font>';
|
|
|
|
|
}
|
2013-03-31 16:44:24 +02:00
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
print ' '.$form->textwithpicto($langs->trans("KeepEmptyToUseDefault").': '.$conf->global->CLICKTODIAL_URL,$langs->trans("ClickToDialUrlDesc"));
|
|
|
|
|
}
|
|
|
|
|
print '</td>';
|
2008-01-26 14:18:47 +01:00
|
|
|
print '</tr>';
|
|
|
|
|
}
|
2009-08-05 19:19:55 +02:00
|
|
|
|
2012-01-04 23:17:12 +01:00
|
|
|
print '<tr><td width="25%" valign="top">ClickToDial '.$langs->trans("Login").'</td>';
|
2008-01-26 14:18:47 +01:00
|
|
|
print '<td class="valeur">';
|
2012-07-10 13:20:53 +02:00
|
|
|
print '<input name="login" value="'.(! empty($fuser->clicktodial_login)?$fuser->clicktodial_login:'').'"></td>';
|
2008-01-26 14:18:47 +01:00
|
|
|
print '</tr>';
|
2009-08-05 19:19:55 +02:00
|
|
|
|
2012-01-04 23:17:12 +01:00
|
|
|
print '<tr><td width="25%" valign="top">ClickToDial '.$langs->trans("Password").'</td>';
|
2008-01-26 14:18:47 +01:00
|
|
|
print '<td class="valeur">';
|
2012-07-10 13:20:53 +02:00
|
|
|
print '<input name="password" value="'.(! empty($fuser->clicktodial_password)?$fuser->clicktodial_password:'').'"></td>';
|
2005-08-11 20:48:08 +02:00
|
|
|
print "</tr>\n";
|
|
|
|
|
|
2012-01-04 23:17:12 +01:00
|
|
|
print '<tr><td width="25%" valign="top">ClickToDial '.$langs->trans("IdPhoneCaller").'</td>';
|
2008-01-26 14:18:47 +01:00
|
|
|
print '<td class="valeur">';
|
2012-07-10 13:20:53 +02:00
|
|
|
print '<input name="poste" value="'.(! empty($fuser->clicktodial_poste)?$fuser->clicktodial_poste:'').'"></td>';
|
2005-08-11 20:48:08 +02:00
|
|
|
print "</tr>\n";
|
|
|
|
|
|
2013-03-31 16:44:24 +02:00
|
|
|
print '</table>';
|
|
|
|
|
|
2013-06-05 16:12:07 +02:00
|
|
|
print '<br><center><input class="button" type="submit" value="'.$langs->trans("Save").'">';
|
|
|
|
|
print ' ';
|
|
|
|
|
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
|
|
|
|
|
print '</center>';
|
2009-08-05 19:19:55 +02:00
|
|
|
|
2013-03-31 16:44:24 +02:00
|
|
|
print '</form>';
|
2005-01-14 15:08:01 +01:00
|
|
|
}
|
2013-03-31 16:44:24 +02:00
|
|
|
else // View mode
|
2005-01-14 15:08:01 +01:00
|
|
|
{
|
|
|
|
|
|
2005-08-11 20:48:08 +02:00
|
|
|
print '<table class="border" width="100%">';
|
|
|
|
|
|
2012-07-10 13:20:53 +02:00
|
|
|
if (! empty($user->admin))
|
2008-01-26 14:18:47 +01:00
|
|
|
{
|
|
|
|
|
print "<tr>".'<td width="25%" valign="top">ClickToDial URL</td>';
|
2009-01-09 22:22:58 +01:00
|
|
|
print '<td class="valeur">';
|
2013-03-31 16:44:24 +02:00
|
|
|
$url=$conf->global->CLICKTODIAL_URL;
|
|
|
|
|
if (! empty($fuser->clicktodial_url)) $url=$fuser->clicktodial_url;
|
|
|
|
|
if (empty($url))
|
2011-03-05 19:20:19 +01:00
|
|
|
{
|
|
|
|
|
$langs->load("errors");
|
|
|
|
|
print '<font class="error">'.$langs->trans("ErrorModuleSetupNotComplete").'</font>';
|
|
|
|
|
}
|
2013-03-31 16:44:24 +02:00
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
print $form->textwithpicto((empty($fuser->clicktodial_url)?$langs->trans("DefaultLink").': ':'').$url,$langs->trans("ClickToDialUrlDesc"));
|
|
|
|
|
}
|
2009-01-09 22:22:58 +01:00
|
|
|
print '</td>';
|
2008-01-26 14:18:47 +01:00
|
|
|
print '</tr>';
|
|
|
|
|
}
|
2012-01-04 23:17:12 +01:00
|
|
|
print '<tr><td width="25%" valign="top">ClickToDial '.$langs->trans("Login").'</td>';
|
2012-07-10 13:20:53 +02:00
|
|
|
print '<td class="valeur">'.(! empty($fuser->clicktodial_login)?$fuser->clicktodial_login:'').'</td>';
|
2008-01-26 14:18:47 +01:00
|
|
|
print '</tr>';
|
2012-01-04 23:17:12 +01:00
|
|
|
print '<tr><td width="25%" valign="top">ClickToDial '.$langs->trans("Password").'</td>';
|
2012-07-10 13:20:53 +02:00
|
|
|
print '<td class="valeur">'.preg_replace('/./','*',(! empty($fuser->clicktodial_password)?$fuser->clicktodial_password:'')).'</a></td>';
|
2005-08-11 20:48:08 +02:00
|
|
|
print "</tr>\n";
|
2012-01-04 23:17:12 +01:00
|
|
|
print '<tr><td width="25%" valign="top">ClickToDial '.$langs->trans("IdPhoneCaller").'</td>';
|
2012-07-10 13:20:53 +02:00
|
|
|
print '<td class="valeur">'.(! empty($fuser->clicktodial_poste)?$fuser->clicktodial_poste:'').'</td>';
|
2005-08-11 20:48:08 +02:00
|
|
|
print "</tr></table>\n";
|
2005-01-14 15:08:01 +01:00
|
|
|
}
|
|
|
|
|
|
2005-08-11 20:48:08 +02:00
|
|
|
print "</div>\n";
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Barre d'actions
|
|
|
|
|
*/
|
|
|
|
|
print '<div class="tabsAction">';
|
|
|
|
|
|
2012-07-10 13:20:53 +02:00
|
|
|
if (! empty($user->admin) && $action <> 'edit')
|
2005-01-14 15:08:01 +01:00
|
|
|
{
|
2012-10-09 09:34:12 +02:00
|
|
|
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$fuser->id.'&action=edit">'.$langs->trans("Modify").'</a>';
|
2005-01-14 15:08:01 +01:00
|
|
|
}
|
2005-08-11 20:48:08 +02:00
|
|
|
|
|
|
|
|
print "</div>\n";
|
|
|
|
|
print "<br>\n";
|
|
|
|
|
|
2005-01-14 15:08:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2012-01-04 23:17:12 +01:00
|
|
|
llxFooter();
|
2005-01-14 15:08:01 +01:00
|
|
|
|
|
|
|
|
$db->close();
|
|
|
|
|
?>
|