From 7ffcf41978da7718ae52a74126852f65933a0051 Mon Sep 17 00:00:00 2001 From: konradSC Date: Fri, 23 Apr 2021 19:39:25 -0400 Subject: [PATCH] Windows 10 softphone app (#153) * SessionTalk Windows 10 app provisioning * Update app_languages.php * CSV Corporate Directory for SessionTalk Windows * Change menu name to "SessionCloud" --- sessiontalk/app_languages.php | 191 ++++++++++++++++++++++++-- sessiontalk/app_menu.php | 8 +- sessiontalk/index.php | 45 ++++-- sessiontalk/sessiontalk_directory.php | 142 +++++++++++++++++++ 4 files changed, 364 insertions(+), 22 deletions(-) create mode 100644 sessiontalk/sessiontalk_directory.php diff --git a/sessiontalk/app_languages.php b/sessiontalk/app_languages.php index c06e9cfc..e9376194 100644 --- a/sessiontalk/app_languages.php +++ b/sessiontalk/app_languages.php @@ -1,18 +1,18 @@ diff --git a/sessiontalk/app_menu.php b/sessiontalk/app_menu.php index 1f9ff32c..186fbb14 100644 --- a/sessiontalk/app_menu.php +++ b/sessiontalk/app_menu.php @@ -1,8 +1,8 @@ \ No newline at end of file +?> diff --git a/sessiontalk/index.php b/sessiontalk/index.php index e149ab95..74720af3 100644 --- a/sessiontalk/index.php +++ b/sessiontalk/index.php @@ -68,11 +68,6 @@ $sql .= "AND e.extension_uuid = eu.extension_uuid "; $sql .= "AND eu.user_uuid = u.user_uuid "; $sql .= "order by e.extension asc "; - -// $sql .= "where e.extension_uuid = eu.extension_uuid "; -// $sql .= "and e.domain_uuid = :domain_uuid "; -// $sql .= "and e.enabled = 'true' "; -// $sql .= "order by e.extension asc "; $parameters['user_uuid'] = $_SESSION['user']['user_uuid']; } $parameters['domain_uuid'] = $_SESSION['domain_uuid']; @@ -125,7 +120,7 @@ echo $text['title_description-sessiontalk']."\n"; echo "

\n"; - //echo $qr_content; //enable for debugging + //echo $qr_content; //debug echo "
"; echo $text['label-extension']."
\n"; echo "\n"; - +echo "
\n"; echo "\n"; echo "
\n"; + //stream the file if (is_uuid($extension_uuid)) { - $qr_content = html_entity_decode( $qr_content, ENT_QUOTES, 'UTF-8' ); + $html_link = "scsc:?username=". $username . "@" . $_SESSION['domain_name'] . ":". $_SESSION['provision']['sessiontalk_provider_id']['text']."%26password=".$field['api_key']; + $html_link = html_entity_decode( $html_link, ENT_QUOTES, 'UTF-8' ); + + //Windows 10 + echo "
\n"; + echo "
".$text['header-windows_10']."
\n"; + echo "
\n"; + echo "
\n"; + + echo "
\n"; + echo " ".$text['description-step_1']."\n"; + echo " ".$text['description-windows_10']."\n"; + echo "
\n"; + echo "
\n"; + echo " ".$text['description-step_2']."".$text['description-windows_10_directory']."\n"; + echo "
\n"; + echo "
\n"; + echo "
\n"; + + //Mobile + echo "
\n"; + echo "
".$text['header-mobile']."
\n"; + echo "
\n"; + echo "
\n"; + + echo "
\n"; + echo " ".$text['description-step_1_mobile']."\n"; + echo "
\n"; + echo "
\n"; + echo " ".$text['description-step_2_mobile']."\n"; + echo "
\n"; + require_once 'resources/qr_code/QRErrorCorrectLevel.php'; require_once 'resources/qr_code/QRCode.php'; require_once 'resources/qr_code/QRCodeImage.php'; + $qr_content = html_entity_decode( $qr_content, ENT_QUOTES, 'UTF-8' ); try { + $code = new QRCode (- 1, QRErrorCorrectLevel::H); $code->addData($qr_content); $code->make(); diff --git a/sessiontalk/sessiontalk_directory.php b/sessiontalk/sessiontalk_directory.php new file mode 100644 index 00000000..697d825c --- /dev/null +++ b/sessiontalk/sessiontalk_directory.php @@ -0,0 +1,142 @@ + + Portions created by the Initial Developer are Copyright (C) 2008-2016 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane +*/ + +//includes + require_once "root.php"; + require_once "resources/require.php"; + require_once "resources/check_auth.php"; + require_once "resources/paging.php"; + +//check permissions + require_once "resources/check_auth.php"; + if (permission_exists('company_directory_view')) { + //access granted + } + else { + echo "access denied"; + exit; + } + +//add multi-lingual support + $language = new text; + $text = $language->get(); + +//get the http values and set them as variables + $order_by = check_str($_REQUEST["order_by"]); + $order = check_str($_REQUEST["order"]); + +//handle search term + $search = check_str($_REQUEST["search"]); + if (strlen($search) > 0) { + $sql_mod = "and ( "; + $sql_mod .= "e.extension ILIKE '%".$search."%' "; + $sql_mod .= "or e.call_group ILIKE '%".$search."%' "; + $sql_mod .= "or e.directory_last_name ILIKE '%".$search."%' "; + $sql_mod .= "or e.directory_first_name ILIKE '%".$search."%' "; + $sql_mod .= ") "; + } + if (strlen($order_by) < 1) { + $order_by = "extension"; + $order = "ASC"; + } + + $domain_uuid = $_SESSION['domain_uuid']; + + +//lookup the domain count + $sql = "select count(*) as num_rows from v_extensions as e\n"; + $sql .= "WHERE domain_uuid = '$domain_uuid' and directory_visible = 'true' \n"; + $sql .= $sql_mod; //add search mod from above" + $prep_statement = $db->prepare($sql); + if ($prep_statement) { + $prep_statement->execute(); + $row = $prep_statement->fetch(PDO::FETCH_ASSOC); + $numeric_extension_count = $row['num_rows']; + if (($db_type == "pgsql") or ($db_type == "mysql")) { + $numeric_extension_count = $row['num_rows']; + } + } + unset($prep_statement, $row); + + +//prepare to page the results + $rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50; + $param = "&search=".$search; + if (!isset($_GET['page'])) { $_GET['page'] = 0; } + $_GET['page'] = check_str($_GET['page']); + list($paging_controls_mini, $rows_per_page, $var_3) = paging($numeric_extension_count, $param, $rows_per_page, true); //top + list($paging_controls, $rows_per_page, $var_3) = paging($numeric_extension_count, $param, $rows_per_page); //bottom + $offset = $rows_per_page * $_GET['page']; + + +//get all the counts from the database + $sql = "SELECT \n"; + $sql .= "e.directory_first_name AS first_name, \n"; + $sql .= "e.directory_last_name AS last_name, \n"; + $sql .= "e.extension AS phone, \n"; + $sql .= "e.call_group AS group\n"; + $sql .= "FROM v_extensions as e \n"; + $sql .= "WHERE e.domain_uuid = '$domain_uuid' and e.directory_visible = 'true' \n"; + $sql .= $sql_mod; //add search mod from above + $sql .= "ORDER BY ".$order_by." ".$order." \n"; + if ($export != "true") {$sql .= "limit $rows_per_page offset $offset ";} + $database = new database; + $directory = $database->select($sql, null, 'all'); + unset($database,$result); + + + //set the headers + header('Content-type: application/octet-binary'); + header("Content-Disposition: attachment; filename=company-directory_" . date("Y-m-d") . ".csv"); + + //show the column names on the first line + $z = 0; + foreach($directory[1] as $key => $val) { + if ($z == 0) { + echo '"'.$key.'"'; + } + else { + echo ',"'.$key.'"'; + } + $z++; + } + echo "\n"; + + //add the values to the csv + $x = 0; + + foreach($directory as $key => $row){ + echo '"'.$row['first_name'].'"'; + echo ',"'.$row['last_name'].'"'; + echo ',"'.$row['phone'].'"'; + echo ',"'.$row['group'].'"'; + echo "\n"; + $x++; + } + + exit; + +?>