From 307c21d21e7437ab35261ba9efa0043ebe632c32 Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Sat, 29 Dec 2012 09:17:12 +0000 Subject: [PATCH] Add the initial gui for the voicemail front end. --- app/voicemails/app_languages.php | 100 ++++++ app/voicemails/voicemail_delete.php | 67 ++++ app/voicemails/voicemail_edit.php | 356 ++++++++++++++++++++ app/voicemails/voicemail_message_delete.php | 68 ++++ app/voicemails/voicemail_message_edit.php | 304 +++++++++++++++++ app/voicemails/voicemail_messages.php | 190 +++++++++++ app/voicemails/voicemails.php | 185 ++++++++++ 7 files changed, 1270 insertions(+) create mode 100644 app/voicemails/app_languages.php create mode 100644 app/voicemails/voicemail_delete.php create mode 100644 app/voicemails/voicemail_edit.php create mode 100644 app/voicemails/voicemail_message_delete.php create mode 100644 app/voicemails/voicemail_message_edit.php create mode 100644 app/voicemails/voicemail_messages.php create mode 100644 app/voicemails/voicemails.php diff --git a/app/voicemails/app_languages.php b/app/voicemails/app_languages.php new file mode 100644 index 0000000000..7d47e4cc4a --- /dev/null +++ b/app/voicemails/app_languages.php @@ -0,0 +1,100 @@ + \ No newline at end of file diff --git a/app/voicemails/voicemail_delete.php b/app/voicemails/voicemail_delete.php new file mode 100644 index 0000000000..12dbef30c7 --- /dev/null +++ b/app/voicemails/voicemail_delete.php @@ -0,0 +1,67 @@ + + Portions created by the Initial Developer are Copyright (C) 2008-2012 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane +*/ +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 "\n"; + echo "
\n"; + echo $text['message-delete']."\n"; + echo "
\n"; + require_once "includes/footer.php"; + return; + +?> \ No newline at end of file diff --git a/app/voicemails/voicemail_edit.php b/app/voicemails/voicemail_edit.php new file mode 100644 index 0000000000..c89e5ab7d8 --- /dev/null +++ b/app/voicemails/voicemail_edit.php @@ -0,0 +1,356 @@ + + Portions created by the Initial Developer are Copyright (C) 2008-2012 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane +*/ +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']."
\n"; } + //if (strlen($voicemail_uuid) == 0) { $msg .= $text['message-required']." ".$text['label-voicemail_uuid']."
\n"; } + //if (strlen($voicemail_id) == 0) { $msg .= $text['message-required']." ".$text['label-voicemail_id']."
\n"; } + //if (strlen($voicemail_password) == 0) { $msg .= $text['message-required']." ".$text['label-voicemail_password']."
\n"; } + //if (strlen($greeting_id) == 0) { $msg .= $text['message-required']." ".$text['label-greeting_id']."
\n"; } + //if (strlen($voicemail_mail_to) == 0) { $msg .= $text['message-required']." ".$text['label-voicemail_mail_to']."
\n"; } + //if (strlen($voicemail_attach_file) == 0) { $msg .= $text['message-required']." ".$text['label-voicemail_attach_file']."
\n"; } + //if (strlen($voicemail_local_after_email) == 0) { $msg .= $text['message-required']." ".$text['label-voicemail_local_after_email']."
\n"; } + //if (strlen($voicemail_enabled) == 0) { $msg .= $text['message-required']." ".$text['label-voicemail_enabled']."
\n"; } + //if (strlen($voicemail_description) == 0) { $msg .= $text['message-required']." ".$text['label-voicemail_description']."
\n"; } + if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { + require_once "includes/header.php"; + require_once "includes/persistformvar.php"; + echo "
\n"; + echo "
\n"; + echo $msg."
"; + echo "
\n"; + persistformvar($_POST); + echo "
\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 "\n"; + echo "
\n"; + echo " ".$text['message-add']."\n"; + echo "
\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 "\n"; + echo "
\n"; + echo " ".$text['message-update']."\n"; + echo "
\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 "
"; + echo "\n"; + echo "\n"; + echo " "; + echo " "; + echo "
\n"; + echo "
"; + + echo "
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo " \n"; + echo " \n"; + echo " "; + echo "
".$text['title-voicemail']."
\n"; + echo " ".$text['label-voicemail_id'].":\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-voicemail_id']."\n"; + echo "
\n"; + echo " ".$text['label-voicemail_password'].":\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-voicemail_password']."\n"; + echo "
\n"; + echo " ".$text['label-greeting_id'].":\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-greeting_id']."\n"; + echo "
\n"; + echo " ".$text['label-voicemail_mail_to'].":\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-voicemail_mail_to']."\n"; + echo "
\n"; + echo " ".$text['label-voicemail_attach_file'].":\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-voicemail_attach_file']."\n"; + echo "
\n"; + echo " ".$text['label-voicemail_local_after_email'].":\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-voicemail_local_after_email']."\n"; + echo "
\n"; + echo " ".$text['label-voicemail_enabled'].":\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-voicemail_enabled']."\n"; + echo "
\n"; + echo " ".$text['label-voicemail_description'].":\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-voicemail_description']."\n"; + echo "
\n"; + if ($action == "update") { + echo " \n"; + } + echo " \n"; + echo "
"; + echo ""; + + echo "
"; + echo "
"; + +//include the footer + require_once "includes/footer.php"; +?> \ No newline at end of file diff --git a/app/voicemails/voicemail_message_delete.php b/app/voicemails/voicemail_message_delete.php new file mode 100644 index 0000000000..df2bcc793f --- /dev/null +++ b/app/voicemails/voicemail_message_delete.php @@ -0,0 +1,68 @@ + + Portions created by the Initial Developer are Copyright (C) 2008-2012 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane +*/ +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 "\n"; + echo "
\n"; + echo "Delete Complete\n"; + echo "
\n"; + require_once "includes/footer.php"; + return; + +?> \ No newline at end of file diff --git a/app/voicemails/voicemail_message_edit.php b/app/voicemails/voicemail_message_edit.php new file mode 100644 index 0000000000..2cc08105d8 --- /dev/null +++ b/app/voicemails/voicemail_message_edit.php @@ -0,0 +1,304 @@ + + Portions created by the Initial Developer are Copyright (C) 2008-2012 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane +*/ +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
\n"; } + //if (strlen($created_epoch) == 0) { $msg .= "Please provide: Created Epoch
\n"; } + //if (strlen($read_epoch) == 0) { $msg .= "Please provide: Read Epoch
\n"; } + //if (strlen($caller_id_name) == 0) { $msg .= "Please provide: Caller ID Name
\n"; } + //if (strlen($caller_id_number) == 0) { $msg .= "Please provide: Caller ID Number
\n"; } + //if (strlen($message_length) == 0) { $msg .= "Please provide: Length
\n"; } + //if (strlen($message_status) == 0) { $msg .= "Please provide: Status
\n"; } + //if (strlen($message_priority) == 0) { $msg .= "Please provide: Priority
\n"; } + if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { + require_once "includes/header.php"; + require_once "includes/persistformvar.php"; + echo "
\n"; + echo "
\n"; + echo $msg."
"; + echo "
\n"; + persistformvar($_POST); + echo "
\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 "\n"; + echo "
\n"; + echo "Add Complete\n"; + echo "
\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 "\n"; + echo "
\n"; + echo "Update Complete\n"; + echo "
\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 "
"; + echo "\n"; + echo "\n"; + echo " "; + echo " "; + echo "
\n"; + echo "
"; + + echo "
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo " \n"; + echo " \n"; + echo " "; + echo "
Voicemail Messages
\n"; + echo " Created Epoch:\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo "\n"; + echo "
\n"; + echo " Read Epoch:\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo "\n"; + echo "
\n"; + echo " Caller ID Name:\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo "\n"; + echo "
\n"; + echo " Caller ID Number:\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo "\n"; + echo "
\n"; + echo " Length:\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo "\n"; + echo "
\n"; + echo " Status:\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo "\n"; + echo "
\n"; + echo " Priority:\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo "\n"; + echo "
\n"; + echo " \n"; + if ($action == "update") { + echo " \n"; + } + echo " \n"; + echo "
"; + echo ""; + + echo "
"; + echo "
"; + +//include the footer + require_once "includes/footer.php"; +?> \ No newline at end of file diff --git a/app/voicemails/voicemail_messages.php b/app/voicemails/voicemail_messages.php new file mode 100644 index 0000000000..3d98adf663 --- /dev/null +++ b/app/voicemails/voicemail_messages.php @@ -0,0 +1,190 @@ + + Portions created by the Initial Developer are Copyright (C) 2008-2012 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane +*/ +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 "
"; + echo "\n"; + echo "\n"; + echo " "; + echo ""; + echo "
\n"; + echo "
"; + + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
".$text['title-voicemail_messages']." 
\n"; + echo " ".$text['description-voicemail_message']."

\n"; + echo "
\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 "
\n"; + echo "\n"; + echo "\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 "\n"; + echo "\n"; + + if ($result_count > 0) { + foreach($result as $row) { + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "\n"; + if ($c==0) { $c=1; } else { $c=0; } + } //end foreach + unset($sql, $result, $row_count); + } //end if results + + echo "\n"; + echo "\n"; + echo "\n"; + + echo "
\n"; + if (permission_exists('voicemail_message_add')) { + echo " $v_link_label_add\n"; + } + else { + echo "  \n"; + } + echo "
".$row['voicemail_uuid']." ".$row['created_epoch']." ".$row['read_epoch']." ".$row['caller_id_name']." ".$row['caller_id_number']." ".$row['message_length']." ".$row['message_status']." ".$row['message_priority']." \n"; + if (permission_exists('voicemail_message_edit')) { + echo " $v_link_label_edit\n"; + } + if (permission_exists('voicemail_message_delete')) { + echo " $v_link_label_delete\n"; + } + echo "
\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
 $paging_controls\n"; + if (permission_exists('voicemail_message_add')) { + echo " $v_link_label_add\n"; + } + else { + echo "  \n"; + } + echo "
\n"; + echo "
"; + echo "
"; + echo "

"; + + echo "
"; + echo "
"; + echo "

"; + +//include the footer + require_once "includes/footer.php"; +?> \ No newline at end of file diff --git a/app/voicemails/voicemails.php b/app/voicemails/voicemails.php new file mode 100644 index 0000000000..3d0006a7e7 --- /dev/null +++ b/app/voicemails/voicemails.php @@ -0,0 +1,185 @@ + + Portions created by the Initial Developer are Copyright (C) 2008-2012 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane +*/ +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 "
"; + echo "\n"; + echo "\n"; + echo " "; + echo ""; + echo "
\n"; + echo "
"; + + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
".$text['title-voicemails']." 
\n"; + echo " ".$text['description-voicemail']."

\n"; + echo "
\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 "
\n"; + echo "\n"; + echo "\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 "\n"; + echo "\n"; + + if ($result_count > 0) { + foreach($result as $row) { + echo "\n"; + echo " \n"; + //echo " \n"; + //echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "\n"; + if ($c==0) { $c=1; } else { $c=0; } + } //end foreach + unset($sql, $result, $row_count); + } //end if results + + echo "\n"; + echo "\n"; + echo "\n"; + + echo "
\n"; + if (permission_exists('voicemail_add')) { + echo " $v_link_label_add\n"; + } + else { + echo "  \n"; + } + echo "
".$row['voicemail_id']." ".$row['voicemail_password']." ".$row['greeting_id']." ".$row['voicemail_mail_to']." ".$row['voicemail_attach_file']." ".$row['voicemail_local_after_email']." ".$row['voicemail_enabled']." ".$row['voicemail_description']." \n"; + if (permission_exists('voicemail_edit')) { + echo " $v_link_label_edit\n"; + } + if (permission_exists('voicemail_delete')) { + echo " $v_link_label_delete\n"; + } + echo "
\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
 $paging_controls\n"; + if (permission_exists('voicemail_add')) { + echo " $v_link_label_add\n"; + } + else { + echo "  \n"; + } + echo "
\n"; + echo "
"; + echo "
"; + echo "

"; + + echo "
"; + echo "
"; + echo "

"; + +//include the footer + require_once "includes/footer.php"; +?> \ No newline at end of file