2
0
mirror of https://github.com/ACSPRI/queXS synced 2024-04-02 12:12:16 +00:00

Added chat details to operator list and editing

Updated database schema
This commit is contained in:
Adam Zammit
2013-07-17 12:33:04 +10:00
parent 2404fe1046
commit 6625668195
3 changed files with 20 additions and 4 deletions

View File

@@ -50,8 +50,9 @@ $msg = "";
if (isset($_POST['submit']))
{
$operator_id = intval($_POST['operator_id']);
$voip = $enabled = 0;
$chat_enable = $voip = $enabled = 0;
if (isset($_POST['voip'])) $voip = 1;
if (isset($_POST['chat_enable'])) $chat_enable = 1;
if (isset($_POST['enabled'])) $enabled = 1;
if (HTPASSWD_PATH !== false && $_POST['existing_username'] != $_POST['username'] && empty($_POST['password']))
@@ -64,10 +65,12 @@ if (isset($_POST['submit']))
SET username = " . $db->qstr($_POST['username']) . ",
lastName = " . $db->qstr($_POST['lastName']) . ",
firstName = " . $db->qstr($_POST['firstName']) . ",
chat_user = " . $db->qstr($_POST['chat_user']) . ",
chat_password = " . $db->qstr($_POST['chat_password']) . ",
extension = " . $db->qstr($_POST['extension']) . ",
extension_password = " . $db->qstr($_POST['extension_password']) . ",
Time_zone_name = " . $db->qstr($_POST['timezone']) . ",
voip = $voip, enabled = $enabled
voip = $voip, enabled = $enabled, chat_enable = $chat_enable
WHERE operator_id = $operator_id";
$rs = $db->Execute($sql);
@@ -129,6 +132,9 @@ if (isset($_GET['edit']))
<div><label for="lastName"><?php echo T_("Last name") . ": "; ?></label><input type='text' name='lastName' value="<?php echo $rs['lastName'];?>"/></div>
<div><label for="extension"><?php echo T_("Extension") . ": "; ?></label><input type='text' name='extension' value="<?php echo $rs['extension'];?>"/></div>
<div><label for="extension_password"><?php echo T_("Extension Password") . ": "; ?></label><input type='text' name='extension_password' value="<?php echo $rs['extension_password'];?>"/></div>
<div><label for="chat_user"><?php echo T_("Jabber/XMPP chat user") . ": "; ?></label><input type='text' name='chat_user' value="<?php echo $rs['chat_user'];?>"/></div>
<div><label for="chat_password"><?php echo T_("Jabber/XMPP chat password") . ": "; ?></label><input type='text' name='chat_password' value="<?php echo $rs['chat_password'];?>"/></div>
<div><label for="chat_enable"><?php echo T_("Uses chat") . "? ";?></label><input type="checkbox" name="chat_enable" <?php if ($rs['chat_enable'] == 1) echo "checked=\"checked\"";?> value="1" /></div>
<div><label for="timezone"><?php echo T_("Timezone") . ": ";?></label><?php display_chooser($tz,"timezone","timezone",false,false,false,false,array("value",$rs['Time_zone_name'])); ?></div>
<div><label for="enabled"><?php echo T_("Enabled") . "? ";?></label><input type="checkbox" name="enabled" <?php if ($rs['enabled'] == 1) echo "checked=\"checked\"";?> value="1" /></div>
<div><label for="voip"><?php echo T_("Uses VoIP") . "? ";?></label><input type="checkbox" name="voip" <?php if ($rs['voip'] == 1) echo "checked=\"checked\"";?> value="1" /></div>

View File

@@ -54,6 +54,8 @@ if (isset($_POST['operator']))
$operator = $db->qstr($_POST['operator'],get_magic_quotes_gpc());
$firstname = $db->qstr($_POST['firstname'],get_magic_quotes_gpc());
$lastname = $db->qstr($_POST['lastname'],get_magic_quotes_gpc());
$chat_user = $db->qstr($_POST['chat_user'],get_magic_quotes_gpc());
$chat_password = $db->qstr($_POST['chat_password'],get_magic_quotes_gpc());
$time_zone_name = $db->qstr($_POST['Time_zone_name'],get_magic_quotes_gpc());
$extension = 1000;
$extensionp = "";
@@ -98,16 +100,18 @@ if (isset($_POST['operator']))
$temporary = 0;
$refusal = 0;
$voip = 0;
$chat = 0;
if (isset($_POST['supervisor']) && $_POST['supervisor'] == "on") $supervisor = 1;
if (isset($_POST['refusal']) && $_POST['refusal'] == "on") $refusal = 1;
if (isset($_POST['temporary']) && $_POST['temporary'] == "on") $temporary = 1;
if (isset($_POST['voip']) && $_POST['voip'] == "on") $voip = 1;
if (isset($_POST['chat_enable']) && $_POST['chat_enable'] == "on") $chat = 1;
if (!empty($_POST['operator']))
{
$sql = "INSERT INTO operator
(`operator_id` ,`username` ,`firstName` ,`lastName`, `extension`,`extension_password`, `Time_zone_name`,`voip`)
VALUES (NULL , $operator, $firstname , $lastname, $extension, $extensionp, $time_zone_name, $voip);";
(`operator_id` ,`username` ,`firstName` ,`lastName`, `extension`,`extension_password`, `Time_zone_name`,`voip`,`chat_enable`,`chat_user`,`chat_password`)
VALUES (NULL , $operator, $firstname , $lastname, $extension, $extensionp, $time_zone_name, $voip, $chat, $chat_user, $chat_password);";
if ($db->Execute($sql))
{
@@ -200,6 +204,9 @@ $rs = $db->GetAll($sql);
<p><?php echo T_("Enter the telephone extension password:"); ?> <input name="extensionp" type="text"/></p>
<?php } ?>
<p><?php echo T_("Will this operator be using VoIP?"); ?> <input name="voip" type="checkbox" checked="checked"/></p>
<p><?php echo T_("Jabber/XMPP username for chat:"); ?> <input name="chat_user" type="text"/></p>
<p><?php echo T_("Jabber/XMPP password for chat:"); ?> <input name="chat_password" type="text"/></p>
<p><?php echo T_("Will this operator be using chat?"); ?> <input name="chat_enable" type="checkbox"/></p>
<p><?php echo T_("Is the operator a normal interviewer?"); ?> <input name="temporary" type="checkbox" checked="checked"/></p>
<p><?php echo T_("Is the operator a supervisor?"); ?> <input name="supervisor" type="checkbox"/></p>
<p><?php echo T_("Is the operator a refusal converter?"); ?> <input name="refusal" type="checkbox"/></p>

View File

@@ -1177,6 +1177,9 @@ CREATE TABLE `operator` (
`voip` tinyint(1) NOT NULL default '1',
`voip_status` tinyint(1) NOT NULL default '0',
`next_case_id` bigint(20) default NULL,
`chat_enable` tinyint(1) default '0',
`chat_user` varchar(255) collate utf8_unicode_ci default NULL,
`chat_password` varchar(255) collate utf8_unicode_ci default NULL,
PRIMARY KEY (`operator_id`),
UNIQUE KEY `username` (`username`),
UNIQUE KEY `extension` (`extension`)