Add the initial gui for the voicemail front end.

This commit is contained in:
Mark Crane 2012-12-29 09:17:12 +00:00
parent 3227dbecd8
commit 307c21d21e
7 changed files with 1270 additions and 0 deletions

View File

@ -0,0 +1,100 @@
<?php
//Voicemails
$text['title-voicemails']['en-us'] = 'Voicemails';
$text['title-voicemails']['pt-pt'] = '';
$text['title-voicemail']['en-us'] = 'Voicemail';
$text['title-voicemail']['pt-pt'] = '';
$text['description-voicemail']['en-us'] = 'Voicemail settings.';
$text['description-voicemail']['pt-pt'] = '';
$text['label-voicemail_id']['en-us'] = 'Voicemail ID';
$text['label-voicemail_id']['pt-pt'] = '';
$text['description-voicemail_id']['en-us'] = 'Enter the Voicemail ID';
$text['description-voicemail_id']['pt-pt'] = '';
$text['label-voicemail_password']['en-us'] = 'Password';
$text['label-voicemail_password']['pt-pt'] = '';
$text['description-voicemail_password']['en-us'] = 'Enter the Password';
$text['description-voicemail_password']['pt-pt'] = '';
$text['label-greeting_id']['en-us'] = 'Greeting ID';
$text['label-greeting_id']['pt-pt'] = '';
$text['description-greeting_id']['en-us'] = 'Enter the Greeting ID';
$text['description-greeting_id']['pt-pt'] = '';
$text['label-voicemail_mail_to']['en-us'] = 'Mail To';
$text['label-voicemail_mail_to']['pt-pt'] = '';
$text['description-voicemail_mail_to']['en-us'] = 'Enter the email address to send voicemail to. ';
$text['description-voicemail_mail_to']['pt-pt'] = '';
$text['label-voicemail_attach_file']['en-us'] = 'Attach File';
$text['label-voicemail_attach_file']['pt-pt'] = '';
$text['description-voicemail_attach_file']['en-us'] = 'Choose whether to attach the file to the email.';
$text['description-voicemail_attach_file']['pt-pt'] = '';
$text['label-voicemail_local_after_email']['en-us'] = 'Local After Email';
$text['label-voicemail_local_after_email']['pt-pt'] = '';
$text['description-voicemail_local_after_email']['en-us'] = 'Choose to keep the voicemail file after sending the email.';
$text['description-voicemail_local_after_email']['pt-pt'] = '';
$text['label-voicemail_enabled']['en-us'] = 'Enabled';
$text['label-voicemail_enabled']['pt-pt'] = '';
$text['description-voicemail_enabled']['en-us'] = 'Select to enable or disable this voicemail.';
$text['description-voicemail_enabled']['pt-pt'] = '';
$text['label-voicemail_description']['en-us'] = 'Description';
$text['label-voicemail_description']['pt-pt'] = '';
$text['description-voicemail_description']['en-us'] = 'Enter the description.';
$text['description-voicemail_description']['pt-pt'] = '';
$text['label-true']['en-us'] = 'true';
$text['label-true']['pt-pt'] = '';
$text['label-false']['en-us'] = 'false';
$text['label-false']['pt-pt'] = 'falso';
$text['button-add']['en-us'] = 'Add';
$text['button-add']['pt-pt'] = '';
$text['button-edit']['en-us'] = 'Edit';
$text['button-edit']['pt-pt'] = '';
$text['button-delete']['en-us'] = 'Delete';
$text['button-delete']['pt-pt'] = '';
$text['button-save']['en-us'] = 'Save';
$text['button-save']['pt-pt'] = 'Guardar';
$text['button-view']['en-us'] = 'View';
$text['button-view']['pt-pt'] = '';
$text['button-back']['en-us'] = 'Back';
$text['button-back']['pt-pt'] = 'Voltar';
$text['confirm-delete']['en-us'] = 'Do you really want to delete this?';
$text['confirm-delete']['pt-pt'] = '';
$text['message-add']['en-us'] = 'Add Completed';
$text['message-add']['pt-pt'] = '';
$text['message-update']['en-us'] = 'Update Completed';
$text['message-update']['pt-pt'] = '';
$text['message-delete']['en-us'] = 'Delete Completed';
$text['message-delete']['pt-pt'] = '';
$text['message-required']['en-us'] = 'Please provide: ';
$text['message-required']['pt-pt'] = '';
?>

View File

@ -0,0 +1,67 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('voicemail_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
require_once "app_languages.php";
foreach($text as $key => $value) {
$text[$key] = $value[$_SESSION['domain']['language']['code']];
}
//get the id
if (count($_GET)>0) {
$id = check_str($_GET["id"]);
}
if (strlen($id)>0) {
//delete voicemail
$sql = "delete from v_voicemails ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and voicemail_uuid = '$id' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($sql);
}
//redirect the user
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=voicemails.php\">\n";
echo "<div align='center'>\n";
echo $text['message-delete']."\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
?>

View File

@ -0,0 +1,356 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('voicemail_add') || permission_exists('voicemail_edit')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
require_once "app_languages.php";
foreach($text as $key => $value) {
$text[$key] = $value[$_SESSION['domain']['language']['code']];
}
//action add or update
if (isset($_REQUEST["id"])) {
$action = "update";
$voicemail_uuid = check_str($_REQUEST["id"]);
}
else {
$action = "add";
}
//get http post variables and set them to php variables
if (count($_POST)>0) {
$voicemail_id = check_str($_POST["voicemail_id"]);
$voicemail_password = check_str($_POST["voicemail_password"]);
$greeting_id = check_str($_POST["greeting_id"]);
$voicemail_mail_to = check_str($_POST["voicemail_mail_to"]);
$voicemail_attach_file = check_str($_POST["voicemail_attach_file"]);
$voicemail_local_after_email = check_str($_POST["voicemail_local_after_email"]);
$voicemail_enabled = check_str($_POST["voicemail_enabled"]);
$voicemail_description = check_str($_POST["voicemail_description"]);
}
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$msg = '';
if ($action == "update") {
$voicemail_uuid = check_str($_POST["voicemail_uuid"]);
}
//check for all required data
//if (strlen($domain_uuid) == 0) { $msg .= $text['message-required']." ".$text['label-domain_uuid']."<br>\n"; }
//if (strlen($voicemail_uuid) == 0) { $msg .= $text['message-required']." ".$text['label-voicemail_uuid']."<br>\n"; }
//if (strlen($voicemail_id) == 0) { $msg .= $text['message-required']." ".$text['label-voicemail_id']."<br>\n"; }
//if (strlen($voicemail_password) == 0) { $msg .= $text['message-required']." ".$text['label-voicemail_password']."<br>\n"; }
//if (strlen($greeting_id) == 0) { $msg .= $text['message-required']." ".$text['label-greeting_id']."<br>\n"; }
//if (strlen($voicemail_mail_to) == 0) { $msg .= $text['message-required']." ".$text['label-voicemail_mail_to']."<br>\n"; }
//if (strlen($voicemail_attach_file) == 0) { $msg .= $text['message-required']." ".$text['label-voicemail_attach_file']."<br>\n"; }
//if (strlen($voicemail_local_after_email) == 0) { $msg .= $text['message-required']." ".$text['label-voicemail_local_after_email']."<br>\n"; }
//if (strlen($voicemail_enabled) == 0) { $msg .= $text['message-required']." ".$text['label-voicemail_enabled']."<br>\n"; }
//if (strlen($voicemail_description) == 0) { $msg .= $text['message-required']." ".$text['label-voicemail_description']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "includes/header.php";
require_once "includes/persistformvar.php";
echo "<div align='center'>\n";
echo "<table><tr><td>\n";
echo $msg."<br />";
echo "</td></tr></table>\n";
persistformvar($_POST);
echo "</div>\n";
require_once "includes/footer.php";
return;
}
//add or update the database
if ($_POST["persistformvar"] != "true") {
if ($action == "add" && permission_exists('voicemail_add')) {
$sql = "insert into v_voicemails ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "voicemail_uuid, ";
$sql .= "voicemail_id, ";
$sql .= "voicemail_password, ";
if (strlen($greeting_id) > 0) {
$sql .= "greeting_id, ";
}
$sql .= "voicemail_mail_to, ";
$sql .= "voicemail_attach_file, ";
$sql .= "voicemail_local_after_email, ";
$sql .= "voicemail_enabled, ";
$sql .= "voicemail_description ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'$domain_uuid', ";
$sql .= "'".uuid()."', ";
$sql .= "'$voicemail_id', ";
$sql .= "'$voicemail_password', ";
if (strlen($greeting_id) > 0) {
$sql .= "'$greeting_id', ";
}
$sql .= "'$voicemail_mail_to', ";
$sql .= "'$voicemail_attach_file', ";
$sql .= "'$voicemail_local_after_email', ";
$sql .= "'$voicemail_enabled', ";
$sql .= "'$voicemail_description' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=voicemails.php\">\n";
echo "<div align='center'>\n";
echo " ".$text['message-add']."\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
} //if ($action == "add")
if ($action == "update" && permission_exists('voicemail_edit')) {
$sql = "update v_voicemails set ";
$sql .= "voicemail_id = '$voicemail_id', ";
$sql .= "voicemail_password = '$voicemail_password', ";
if (strlen($greeting_id) > 0) {
$sql .= "greeting_id = '$greeting_id', ";
}
$sql .= "voicemail_mail_to = '$voicemail_mail_to', ";
$sql .= "voicemail_attach_file = '$voicemail_attach_file', ";
$sql .= "voicemail_local_after_email = '$voicemail_local_after_email', ";
$sql .= "voicemail_enabled = '$voicemail_enabled', ";
$sql .= "voicemail_description = '$voicemail_description' ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and voicemail_uuid = '$voicemail_uuid'";
$db->exec(check_sql($sql));
unset($sql);
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=voicemails.php\">\n";
echo "<div align='center'>\n";
echo " ".$text['message-update']."\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
} //if ($action == "update")
} //if ($_POST["persistformvar"] != "true")
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//pre-populate the form
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
$voicemail_uuid = check_str($_GET["id"]);
$sql = "select * from v_voicemails ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and voicemail_uuid = '$voicemail_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$voicemail_id = $row["voicemail_id"];
$voicemail_password = $row["voicemail_password"];
$greeting_id = $row["greeting_id"];
$voicemail_mail_to = $row["voicemail_mail_to"];
$voicemail_attach_file = $row["voicemail_attach_file"];
$voicemail_local_after_email = $row["voicemail_local_after_email"];
$voicemail_enabled = $row["voicemail_enabled"];
$voicemail_description = $row["voicemail_description"];
break; //limit to 1 row
}
unset ($prep_statement);
}
//show the header
require_once "includes/header.php";
//show the content
echo "<div align='center'>";
echo "<table width='100%' border='0' cellpadding='0' cellspacing=''>\n";
echo "<tr class='border'>\n";
echo " <td align=\"left\">\n";
echo " <br>";
echo "<form method='post' name='frm' action=''>\n";
echo "<div align='center'>\n";
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td align='left' width='30%' nowrap='nowrap'><b>".$text['title-voicemail']."</b></td>\n";
echo "<td width='70%' align='right'><input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='voicemails.php'\" value='".$text['button-back']."'></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-voicemail_id'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='voicemail_id' maxlength='255' value='$voicemail_id'>\n";
echo "<br />\n";
echo $text['description-voicemail_id']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-voicemail_password'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='voicemail_password' maxlength='255' value=\"$voicemail_password\">\n";
echo "<br />\n";
echo $text['description-voicemail_password']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-greeting_id'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='greeting_id' maxlength='255' value='$greeting_id'>\n";
echo "<br />\n";
echo $text['description-greeting_id']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-voicemail_mail_to'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='voicemail_mail_to' maxlength='255' value=\"$voicemail_mail_to\">\n";
echo "<br />\n";
echo $text['description-voicemail_mail_to']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-voicemail_attach_file'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='voicemail_attach_file'>\n";
echo " <option value=''></option>\n";
if ($voicemail_attach_file == "true") {
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
}
else {
echo " <option value='true'>".$text['label-true']."</option>\n";
}
if ($voicemail_attach_file == "false") {
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
}
else {
echo " <option value='false'>".$text['label-false']."</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo $text['description-voicemail_attach_file']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-voicemail_local_after_email'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='voicemail_local_after_email'>\n";
echo " <option value=''></option>\n";
if ($voicemail_local_after_email == "true") {
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
}
else {
echo " <option value='true'>".$text['label-true']."</option>\n";
}
if ($voicemail_local_after_email == "false") {
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
}
else {
echo " <option value='false'>".$text['label-false']."</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo $text['description-voicemail_local_after_email']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-voicemail_enabled'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='voicemail_enabled'>\n";
echo " <option value=''></option>\n";
if ($voicemail_enabled == "true") {
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
}
else {
echo " <option value='true'>".$text['label-true']."</option>\n";
}
if ($voicemail_enabled == "false") {
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
}
else {
echo " <option value='false'>".$text['label-false']."</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo $text['description-voicemail_enabled']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-voicemail_description'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='voicemail_description' maxlength='255' value=\"$voicemail_description\">\n";
echo "<br />\n";
echo $text['description-voicemail_description']."\n";
echo "</td>\n";
echo "</tr>\n";
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
if ($action == "update") {
echo " <input type='hidden' name='voicemail_uuid' value='$voicemail_uuid'>\n";
}
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "</form>";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</div>";
//include the footer
require_once "includes/footer.php";
?>

View File

@ -0,0 +1,68 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('voicemail_message_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
require_once "app_languages.php";
foreach($text as $key => $value) {
$text[$key] = $value[$_SESSION['domain']['language']['code']];
}
//get the id
if (count($_GET)>0) {
$id = check_str($_GET["id"]);
$voicemail_uuid = check_str($_GET["voicemail_uuid"]);
}
if (strlen($id)>0) {
//delete voicemail_message
$sql = "delete from v_voicemail_messages ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and voicemail_message_uuid = '$id' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($sql);
}
//redirect the user
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=voicemail_edit.php?id=$voicemail_uuid\">\n";
echo "<div align='center'>\n";
echo "Delete Complete\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
?>

View File

@ -0,0 +1,304 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('voicemail_message_add') || permission_exists('voicemail_message_edit')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
require_once "app_languages.php";
foreach($text as $key => $value) {
$text[$key] = $value[$_SESSION['domain']['language']['code']];
}
//action add or update
if (isset($_REQUEST["id"])) {
$action = "update";
$voicemail_message_uuid = check_str($_REQUEST["id"]);
}
else {
$action = "add";
}
//set the parent uuid
if (strlen($_GET["voicemail_uuid"]) > 0) {
$voicemail_uuid = check_str($_GET["voicemail_uuid"]);
}
//get http post variables and set them to php variables
if (count($_POST)>0) {
$voicemail_uuid = check_str($_POST["voicemail_uuid"]);
$created_epoch = check_str($_POST["created_epoch"]);
$read_epoch = check_str($_POST["read_epoch"]);
$caller_id_name = check_str($_POST["caller_id_name"]);
$caller_id_number = check_str($_POST["caller_id_number"]);
$message_length = check_str($_POST["message_length"]);
$message_status = check_str($_POST["message_status"]);
$message_priority = check_str($_POST["message_priority"]);
}
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$msg = '';
if ($action == "update") {
$voicemail_message_uuid = check_str($_POST["voicemail_message_uuid"]);
}
//check for all required data
//if (strlen($voicemail_uuid) == 0) { $msg .= "Please provide: Voicemail UUID<br>\n"; }
//if (strlen($created_epoch) == 0) { $msg .= "Please provide: Created Epoch<br>\n"; }
//if (strlen($read_epoch) == 0) { $msg .= "Please provide: Read Epoch<br>\n"; }
//if (strlen($caller_id_name) == 0) { $msg .= "Please provide: Caller ID Name<br>\n"; }
//if (strlen($caller_id_number) == 0) { $msg .= "Please provide: Caller ID Number<br>\n"; }
//if (strlen($message_length) == 0) { $msg .= "Please provide: Length<br>\n"; }
//if (strlen($message_status) == 0) { $msg .= "Please provide: Status<br>\n"; }
//if (strlen($message_priority) == 0) { $msg .= "Please provide: Priority<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "includes/header.php";
require_once "includes/persistformvar.php";
echo "<div align='center'>\n";
echo "<table><tr><td>\n";
echo $msg."<br />";
echo "</td></tr></table>\n";
persistformvar($_POST);
echo "</div>\n";
require_once "includes/footer.php";
return;
}
//add or update the database
if ($_POST["persistformvar"] != "true") {
if ($action == "add" && permission_exists('voicemail_message_add')) {
$sql = "insert into v_voicemail_messages ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "voicemail_message_uuid, ";
$sql .= "voicemail_uuid, ";
$sql .= "voicemail_uuid, ";
$sql .= "created_epoch, ";
$sql .= "read_epoch, ";
$sql .= "caller_id_name, ";
$sql .= "caller_id_number, ";
$sql .= "message_length, ";
$sql .= "message_status, ";
$sql .= "message_priority ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'$domain_uuid', ";
$sql .= "'".uuid()."', ";
$sql .= "'$voicemail_uuid', ";
$sql .= "'$voicemail_uuid', ";
$sql .= "'$created_epoch', ";
$sql .= "'$read_epoch', ";
$sql .= "'$caller_id_name', ";
$sql .= "'$caller_id_number', ";
$sql .= "'$message_length', ";
$sql .= "'$message_status', ";
$sql .= "'$message_priority' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=voicemail_edit.php?id=$voicemail_uuid\">\n";
echo "<div align='center'>\n";
echo "Add Complete\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
} //if ($action == "add")
if ($action == "update" && permission_exists('voicemail_message_edit')) {
$sql = "update v_voicemail_messages set ";
$sql .= "voicemail_uuid = '$voicemail_uuid', ";
$sql .= "voicemail_uuid = '$voicemail_uuid', ";
$sql .= "created_epoch = '$created_epoch', ";
$sql .= "read_epoch = '$read_epoch', ";
$sql .= "caller_id_name = '$caller_id_name', ";
$sql .= "caller_id_number = '$caller_id_number', ";
$sql .= "message_length = '$message_length', ";
$sql .= "message_status = '$message_status', ";
$sql .= "message_priority = '$message_priority' ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and voicemail_message_uuid = '$voicemail_message_uuid'";
$db->exec(check_sql($sql));
unset($sql);
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=voicemail_edit.php?id=$voicemail_uuid\">\n";
echo "<div align='center'>\n";
echo "Update Complete\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
} //if ($action == "update")
} //if ($_POST["persistformvar"] != "true")
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//pre-populate the form
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
$voicemail_message_uuid = check_str($_GET["id"]);
$sql = "select * from v_voicemail_messages ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and voicemail_message_uuid = '$voicemail_message_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll();
foreach ($result as &$row) {
$voicemail_uuid = $row["voicemail_uuid"];
$created_epoch = $row["created_epoch"];
$read_epoch = $row["read_epoch"];
$caller_id_name = $row["caller_id_name"];
$caller_id_number = $row["caller_id_number"];
$message_length = $row["message_length"];
$message_status = $row["message_status"];
$message_priority = $row["message_priority"];
break; //limit to 1 row
}
unset ($prep_statement);
}
//show the header
require_once "includes/header.php";
//show the content
echo "<div align='center'>";
echo "<table width='100%' border='0' cellpadding='0' cellspacing=''>\n";
echo "<tr class='border'>\n";
echo " <td align=\"left\">\n";
echo " <br>";
echo "<form method='post' name='frm' action=''>\n";
echo "<div align='center'>\n";
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td align='left' width='30%' nowrap='nowrap'><b>Voicemail Messages</b></td>\n";
echo "<td width='70%' align='right'><input type='button' class='btn' name='' alt='back' onclick=\"window.location='voicemail_edit.php?id=$voicemail_uuid'\" value='Back'></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Created Epoch:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='created_epoch' maxlength='255' value='$created_epoch'>\n";
echo "<br />\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Read Epoch:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='read_epoch' maxlength='255' value='$read_epoch'>\n";
echo "<br />\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Caller ID Name:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='caller_id_name' maxlength='255' value=\"$caller_id_name\">\n";
echo "<br />\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Caller ID Number:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='caller_id_number' maxlength='255' value=\"$caller_id_number\">\n";
echo "<br />\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Length:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='message_length' maxlength='255' value='$message_length'>\n";
echo "<br />\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Status:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='message_status' maxlength='255' value=\"$message_status\">\n";
echo "<br />\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Priority:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='message_priority' maxlength='255' value=\"$message_priority\">\n";
echo "<br />\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
echo " <input type='hidden' name='voicemail_uuid' value='$voicemail_uuid'>\n";
if ($action == "update") {
echo " <input type='hidden' name='voicemail_message_uuid' value='$voicemail_message_uuid'>\n";
}
echo " <input type='submit' name='submit' class='btn' value='Save'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "</form>";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</div>";
//include the footer
require_once "includes/footer.php";
?>

View File

@ -0,0 +1,190 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('voicemail_message_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
require_once "app_languages.php";
foreach($text as $key => $value) {
$text[$key] = $value[$_SESSION['domain']['language']['code']];
}
//get the html values and set them as variables
$order_by = $_GET["order_by"];
$order = $_GET["order"];
if (strlen($_GET["id"]) > 0) {
$voicemail_uuid = $_GET["id"];
}
//additional includes
require_once "includes/header.php";
require_once "includes/paging.php";
//show the content
echo "<div align='center'>";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
echo "<tr class='border'>\n";
echo " <td align=\"center\">\n";
echo " <br />";
echo "<table width='100%' border='0'>\n";
echo " <tr>\n";
echo " <td width='50%' align='left' nowrap='nowrap'><b>".$text['title-voicemail_messages']."</b></td>\n";
echo " <td width='50%' align='right'>&nbsp;</td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align='left' colspan='2'>\n";
echo " ".$text['description-voicemail_message']."<br /><br />\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
//prepare to page the results
$sql = "select count(*) as num_rows from v_voicemail_messages ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and voicemail_uuid = '$voicemail_uuid' ";
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
if ($row['num_rows'] > 0) {
$num_rows = $row['num_rows'];
}
else {
$num_rows = '0';
}
}
//prepare to page the results
$rows_per_page = 10;
$param = "";
$page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page);
$offset = $rows_per_page * $page;
//get the list
$sql = "select * from v_voicemail_messages ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and voicemail_uuid = '$voicemail_uuid' ";
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
$sql .= "limit $rows_per_page offset $offset ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll();
$result_count = count($result);
unset ($prep_statement, $sql);
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
echo "<div align='center'>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo th_order_by('voicemail_uuid', $text['label-voicemail_uuid'], $order_by, $order);
echo th_order_by('created_epoch', $text['label-created_epoch'], $order_by, $order);
echo th_order_by('read_epoch', $text['label-read_epoch'], $order_by, $order);
echo th_order_by('caller_id_name', $text['label-caller_id_name'], $order_by, $order);
echo th_order_by('caller_id_number', $text['label-caller_id_number'], $order_by, $order);
echo th_order_by('message_length', $text['label-message_length'], $order_by, $order);
echo th_order_by('message_status', $text['label-message_status'], $order_by, $order);
echo th_order_by('message_priority', $text['label-message_priority'], $order_by, $order);
echo "<td align='right' width='42'>\n";
if (permission_exists('voicemail_message_add')) {
echo " <a href='voicemail_message_edit.php?voicemail_uuid=".$_GET['id']."' alt='".$text['button-add']."'>$v_link_label_add</a>\n";
}
else {
echo " &nbsp;\n";
}
echo "</td>\n";
echo "<tr>\n";
if ($result_count > 0) {
foreach($result as $row) {
echo "<tr >\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['voicemail_uuid']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['created_epoch']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['read_epoch']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['caller_id_name']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['caller_id_number']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['message_length']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['message_status']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['message_priority']."&nbsp;</td>\n";
echo " <td valign='top' align='right'>\n";
if (permission_exists('voicemail_message_edit')) {
echo " <a href='voicemail_message_edit.php?voicemail_uuid=".$row['voicemail_uuid']."&id=".$row['voicemail_message_uuid']."' alt='".$text['button-edit']."'>$v_link_label_edit</a>\n";
}
if (permission_exists('voicemail_message_delete')) {
echo " <a href='voicemail_message_delete.php?voicemail_uuid=".$row['voicemail_uuid']."&id=".$row['voicemail_message_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>\n";
}
echo " </td>\n";
echo "</tr>\n";
if ($c==0) { $c=1; } else { $c=0; }
} //end foreach
unset($sql, $result, $row_count);
} //end if results
echo "<tr>\n";
echo "<td colspan='9' align='left'>\n";
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td width='33.3%' nowrap='nowrap'>&nbsp;</td>\n";
echo " <td width='33.3%' align='center' nowrap='nowrap'>$paging_controls</td>\n";
echo " <td width='33.3%' align='right'>\n";
if (permission_exists('voicemail_message_add')) {
echo " <a href='voicemail_message_edit.php?voicemail_uuid=".$_GET['id']."' alt='".$text['button-add']."'>$v_link_label_add</a>\n";
}
else {
echo " &nbsp;\n";
}
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
echo "</div>";
echo "<br /><br />";
echo "</td>";
echo "</tr>";
echo "</table>";
echo "</div>";
echo "<br /><br />";
//include the footer
require_once "includes/footer.php";
?>

View File

@ -0,0 +1,185 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('voicemail_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
require_once "app_languages.php";
foreach($text as $key => $value) {
$text[$key] = $value[$_SESSION['domain']['language']['code']];
}
//get variables used to control the order
$order_by = $_GET["order_by"];
$order = $_GET["order"];
//additional includes
require_once "includes/header.php";
require_once "includes/paging.php";
//show the content
echo "<div align='center'>";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
echo "<tr class='border'>\n";
echo " <td align=\"center\">\n";
echo " <br />";
echo "<table width='100%' border='0'>\n";
echo " <tr>\n";
echo " <td width='50%' align='left' nowrap='nowrap'><b>".$text['title-voicemails']."</b></td>\n";
echo " <td width='50%' align='right'>&nbsp;</td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align='left' colspan='2'>\n";
echo " ".$text['description-voicemail']."<br /><br />\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
//prepare to page the results
$sql = "select count(*) as num_rows from v_voicemails ";
$sql .= "where domain_uuid = '$domain_uuid' ";
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
if ($row['num_rows'] > 0) {
$num_rows = $row['num_rows'];
}
else {
$num_rows = '0';
}
}
//prepare to page the results
$rows_per_page = 10;
$param = "";
$page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page);
$offset = $rows_per_page * $page;
//get the list
$sql = "select * from v_voicemails ";
$sql .= "where domain_uuid = '$domain_uuid' ";
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
$sql .= "limit $rows_per_page offset $offset ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
unset ($prep_statement, $sql);
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
echo "<div align='center'>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo th_order_by('voicemail_id', $text['label-voicemail_id'], $order_by, $order);
//echo th_order_by('voicemail_password', $text['label-voicemail_password'], $order_by, $order);
//echo th_order_by('greeting_id', $text['label-greeting_id'], $order_by, $order);
echo th_order_by('voicemail_mail_to', $text['label-voicemail_mail_to'], $order_by, $order);
echo th_order_by('voicemail_attach_file', $text['label-voicemail_attach_file'], $order_by, $order);
echo th_order_by('voicemail_local_after_email', $text['label-voicemail_local_after_email'], $order_by, $order);
echo th_order_by('voicemail_enabled', $text['label-voicemail_enabled'], $order_by, $order);
echo th_order_by('voicemail_description', $text['label-voicemail_description'], $order_by, $order);
echo "<td align='right' width='42'>\n";
if (permission_exists('voicemail_add')) {
echo " <a href='voicemail_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>\n";
}
else {
echo " &nbsp;\n";
}
echo "</td>\n";
echo "<tr>\n";
if ($result_count > 0) {
foreach($result as $row) {
echo "<tr >\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['voicemail_id']."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row['voicemail_password']."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row['greeting_id']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['voicemail_mail_to']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['voicemail_attach_file']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['voicemail_local_after_email']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['voicemail_enabled']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['voicemail_description']."&nbsp;</td>\n";
echo " <td valign='top' align='right'>\n";
if (permission_exists('voicemail_edit')) {
echo " <a href='voicemail_edit.php?id=".$row['voicemail_uuid']."' alt='".$text['button-edit']."'>$v_link_label_edit</a>\n";
}
if (permission_exists('voicemail_delete')) {
echo " <a href='voicemail_delete.php?id=".$row['voicemail_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>\n";
}
echo " </td>\n";
echo "</tr>\n";
if ($c==0) { $c=1; } else { $c=0; }
} //end foreach
unset($sql, $result, $row_count);
} //end if results
echo "<tr>\n";
echo "<td colspan='11' align='left'>\n";
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td width='33.3%' nowrap='nowrap'>&nbsp;</td>\n";
echo " <td width='33.3%' align='center' nowrap='nowrap'>$paging_controls</td>\n";
echo " <td width='33.3%' align='right'>\n";
if (permission_exists('voicemail_add')) {
echo " <a href='voicemail_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>\n";
}
else {
echo " &nbsp;\n";
}
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
echo "</div>";
echo "<br /><br />";
echo "</td>";
echo "</tr>";
echo "</table>";
echo "</div>";
echo "<br /><br />";
//include the footer
require_once "includes/footer.php";
?>