Skip to content
This repository was archived by the owner on Mar 4, 2021. It is now read-only.

Commit 15ea9e0

Browse files
committed
Merge branch 'release/1.2.17'
2 parents 44288e6 + 42d13c8 commit 15ea9e0

File tree

15 files changed

+165
-40
lines changed

15 files changed

+165
-40
lines changed

CHANGELOG.markdown

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# OpenVBX Change Log
22

3+
## OpenVBX 1.2.17
4+
5+
- Fix implementation of `OpenVBX::connectAuthTenant()` by making it static.
6+
- Fix Text to Speech voice and language picker to properly present and use extended language codes when using the Alice voice.
7+
- Clean up settings forms to redirect back to the same form after submission.
8+
- Fix bug that prevented the population of the Twilio Client Application SID during installation.
9+
- Adding (long overdue) pagination to Numbers screen.
10+
11+
312
## OpenVBX 1.2.16
413

514
- Update SMS Applet to properly use `<Sms>` TwiML when sending messages during voice flows. (Thanks @gegere)

OpenVBX/config/langcodes.php

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
2+
3+
/**
4+
* Language codes for the Text to Speech language picker in system settings.
5+
*/
6+
$config['lang_codes'] = array(
7+
'default' => array(
8+
'en-gb' => 'British English',
9+
'en' => 'English',
10+
'fr' => 'French',
11+
'de' => 'German',
12+
'it' => 'Italian',
13+
'es' => 'Spanish',
14+
),
15+
'extended' => array(
16+
'da-DK' => 'Danish, Denmark',
17+
'de-DE' => 'German, Germany',
18+
'en-AU' => 'English, Australia',
19+
'en-CA' => 'English, Canada',
20+
'en-GB' => 'English, UK',
21+
'en-IN' => 'English, India',
22+
'en-US' => 'English, United States',
23+
'ca-ES' => 'Catalan, Spain',
24+
'es-ES' => 'Spanish, Spain',
25+
'es-MX' => 'Spanish, Mexico',
26+
'fi-FI' => 'Finnish, Finland',
27+
'fr-CA' => 'French, Canada',
28+
'fr-FR' => 'French, France',
29+
'it-IT' => 'Italian, Italy',
30+
'ja-JP' => 'Japanese, Japan',
31+
'ko-KR' => 'Korean, Korea',
32+
'nb-NO' => 'Norwegian, Norway',
33+
'nl-NL' => 'Dutch, Netherlands',
34+
'pl-PL' => 'Polish, Poland',
35+
'pt-BR' => 'Portuguese, Brazil',
36+
'pt-PT' => 'Portuguese, Portugal',
37+
'ru-RU' => 'Russian, Russia',
38+
'sv-SE' => 'Swedish, Sweden',
39+
'zh-CN' => 'Chinese, Mandarin',
40+
'zh-HK' => 'Chinese, Cantonese',
41+
'zh-TW' => 'Chinese, Taiwanese Mandarin',
42+
),
43+
);

OpenVBX/config/version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
22

3-
$config['version'] = '1.2.16';
3+
$config['version'] = '1.2.17';

OpenVBX/controllers/install.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ public function setup()
236236

237237
try
238238
{
239-
$this->openvbx_settings['application_sid'] = $this->get_application($this->openvbx_settings);
239+
$openvbx_settings['application_sid'] = $this->get_application($this->openvbx_settings);
240240

241241
if(!($dbh = @mysql_connect($database['default']['hostname'],
242242
$database['default']['username'],

OpenVBX/controllers/numbers.php

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,38 @@ class Numbers extends User_Controller
2626
private $error_message = FALSE;
2727
private $new_number = null;
2828

29+
private $numbers_per_page = 50;
30+
2931
function __construct()
3032
{
3133
parent::__construct();
3234
$this->section = 'numbers';
3335
$this->template->write('title', 'Numbers');
3436
$this->load->model('vbx_incoming_numbers');
37+
$this->load->library('pagination');
3538
}
3639

3740
function index()
3841
{
3942
$this->admin_only($this->section);
4043
$this->template->add_js('assets/j/numbers.js');
41-
44+
45+
$max = $this->input->get_post('max');
46+
$offset = $this->input->get_post('offset');
47+
48+
if (empty($offset)) {
49+
$offset = 0;
50+
}
51+
52+
if (empty($max)) {
53+
$max = $this->numbers_per_page;
54+
}
55+
4256
$data = $this->init_view_data();
4357
$data['selected_country'] = $this->vbx_settings->get('numbers_country', $this->tenant->id);
4458

4559
$numbers = array();
60+
$total_numbers = 0;
4661
$data['countries'] = array();
4762
$data['openvbx_js']['countries'] = array();
4863
try
@@ -85,10 +100,6 @@ function index()
85100
}
86101

87102
$item->phone_formatted = format_phone($item->phone);
88-
if (!empty($item->pin))
89-
{
90-
$item->pin = implode('-', str_split($item->pin, 4));
91-
}
92103

93104
$capabilities = array();
94105
if (!empty($item->capabilities))
@@ -103,7 +114,7 @@ function index()
103114
}
104115
$item->capabilities = $capabilities;
105116

106-
$item->status = null;
117+
$item->status = null;
107118

108119
if ($item->installed)
109120
{
@@ -113,12 +124,12 @@ function index()
113124

114125
array_push($data['incoming_numbers'], $item);
115126
}
116-
elseif (!empty($item->url) || !empty($item->smsUrl))
127+
elseif ((!empty($item->url) || !empty($item->smsUrl)) && $offset == 0)
117128
{
118129
// Number is in use elsewhere
119130
array_push($data['other_numbers'], $item);
120131
}
121-
else
132+
elseif ($offset == 0)
122133
{
123134
// Number is open for use
124135
array_push($data['available_numbers'], $item);
@@ -149,6 +160,22 @@ function index()
149160

150161
$data['counts'] = $this->message_counts();
151162

163+
/**
164+
* $numbers is a list of phone numbers straight from the Twilio API,
165+
* there's no fancy query logic here, just slicing up the array.
166+
*/
167+
$total_numbers = count($data['incoming_numbers']);
168+
$data['incoming_numbers'] = array_slice($data['incoming_numbers'], $offset, $max, true);
169+
170+
// pagination
171+
$page_config = array(
172+
'base_url' => site_url('numbers'),
173+
'total_rows' => $total_numbers,
174+
'per_page' => $max
175+
);
176+
$this->pagination->initialize($page_config);
177+
$data['pagination'] = CI_Template::literal($this->pagination->create_links());
178+
152179
$this->respond('', 'numbers/numbers', $data);
153180
}
154181

OpenVBX/controllers/settings/site.php

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ class Site extends User_Controller
2828
const MODE_MULTI = 1;
2929
const MODE_SINGLE = 2;
3030

31+
protected $form_action;
32+
3133
function __construct()
3234
{
3335
parent::__construct();
@@ -44,6 +46,7 @@ public function index($action = '', $id = false)
4446
private function site($action, $id)
4547
{
4648
$this->section = 'settings/site';
49+
$this->form_action = $action;
4750

4851
switch($action)
4952
{
@@ -81,7 +84,7 @@ private function tenant_handler($id)
8184
return $this->get_tenant($id);
8285
}
8386
default:
84-
return redirect('settings/site');
87+
return redirect('settings/site#multi-tenant');
8588
}
8689
}
8790

@@ -216,7 +219,11 @@ private function get_site()
216219
$data['error'] .= $e->getMessage();
217220
}
218221
}
219-
222+
223+
// load language codes for text-to-speech
224+
$this->config->load('langcodes');
225+
$data['lang_codes'] = $this->config->item('lang_codes');
226+
220227
// verify Client Application data
221228
$data['client_application_error'] = false;
222229
$account = OpenVBX::getAccount();
@@ -350,12 +357,24 @@ private function update_site()
350357

351358
flush_minify_caches();
352359

360+
$returnSection = '';
361+
switch($this->form_action) {
362+
case 'account':
363+
$returnSection = '#twilio-account';
364+
break;
365+
case 'theme':
366+
$returnSection = '#theme';
367+
break;
368+
default;
369+
$returnSection = '#system-config';
370+
}
371+
353372
if($this->response_type == 'html')
354373
{
355-
redirect('settings/site');
374+
redirect('settings/site' . $returnSection);
356375
}
357376

358-
$this->respond('', 'settings/site', $data);
377+
$this->respond('', 'settings/site' . $returnSection, $data);
359378
}
360379

361380
private function update_application($app_sid)

OpenVBX/libraries/OpenVBX.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ public static function getRequestSignature()
505505
* @param int $tenant_id
506506
* @return bool
507507
*/
508-
public function connectAuthTenant($tenant_id) {
508+
public static function connectAuthTenant($tenant_id) {
509509
$auth = true;
510510

511511
$ci =& get_instance();

OpenVBX/views/numbers/available.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
<?php endif; /* Sandbox */ ?>
3131
<?php
3232
echo $item->phone;
33-
echo !empty($item->pin)? ' Pin: '.$item->pin : '';
3433
?>
3534
</td>
3635
<td class="incoming-number-flow">
@@ -52,9 +51,7 @@
5251
?>
5352
</td>
5453
<td class="incoming-number-delete">
55-
<?php if(empty($item->pin)): ?>
5654
<a href="numbers/delete/<?php echo $item->id; ?>" class="action trash delete"><span class="replace">Delete</span></a>
57-
<?php endif; ?>
5855
</td>
5956
</tr>
6057
<?php endforeach; ?>

OpenVBX/views/numbers/incoming.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
<?php endif; /* Sandbox */ ?>
3232
<?php
3333
echo $item->phone;
34-
echo !empty($item->pin)? ' Pin: '.$item->pin : '';
3534
?>
3635
</td>
3736
<td class="incoming-number-flow">
@@ -53,9 +52,7 @@
5352
?>
5453
</td>
5554
<td class="incoming-number-delete">
56-
<?php if(empty($item->pin)): ?>
5755
<a href="numbers/delete/<?php echo $item->id; ?>" class="action trash delete"><span class="replace">Delete</span></a>
58-
<?php endif; ?>
5956
</td>
6057
</tr>
6158
<?php

OpenVBX/views/numbers/menu-top.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55
<li class="menu-item"><button class="add-button add number"><span>Get a Number</span></button></li>
66
</ul>
77
<?php endif; ?>
8+
<?php echo $pagination; ?>
89
</div><!-- .vbx-content-menu -->

0 commit comments

Comments
 (0)