Improve the destination select list other category.

This commit is contained in:
FusionPBX 2020-11-23 09:32:02 -07:00 committed by GitHub
parent 7370d5cd45
commit 6be0a340f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 32 additions and 24 deletions

View File

@ -206,6 +206,7 @@ if (!class_exists('destinations')) {
} }
array_multisort($option_groups, SORT_ASC, $this->destinations); array_multisort($option_groups, SORT_ASC, $this->destinations);
} }
//add the sql and data to the array //add the sql and data to the array
if ($this->destinations !== null && is_array($this->destinations)) { if ($this->destinations !== null && is_array($this->destinations)) {
$x = 0; $x = 0;
@ -485,11 +486,15 @@ if (!class_exists('destinations')) {
//add multi-lingual support //add multi-lingual support
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/".$key."/app_languages.php")) { if (file_exists($_SERVER["PROJECT_ROOT"]."/app/".$key."/app_languages.php")) {
$language2 = new text;
$text2 = $language2->get($_SESSION['domain']['language']['code'], 'app/'.$key); $text2 = $language2->get($_SESSION['domain']['language']['code'], 'app/'.$key);
$found = 'true';
}
if ($key == 'other') {
$text2 = $language2->get($_SESSION['domain']['language']['code'], 'app/dialplans');
} }
//add the application to the select list //add the application to the select list
$response .= " <option value='".$key."' $selected>".$text2['title-'.$key]." </option>\n"; $response .= " <option value='".$key."' $selected>".$text2['title-'.$key]."</option>\n";
} }
} }
$response .= " </select>\n"; $response .= " </select>\n";
@ -618,21 +623,17 @@ if (!class_exists('destinations')) {
$this->destinations[$x]['select_value']['ivr'] = "menu-exec-app:transfer \${destination}"; $this->destinations[$x]['select_value']['ivr'] = "menu-exec-app:transfer \${destination}";
$this->destinations[$x]['select_label'] = "\${name}"; $this->destinations[$x]['select_label'] = "\${name}";
$y=0; $y=0;
$this->destinations[$x]['result']['data'][$y]['label'] = 'check_voicemail'; $this->destinations[$x]['result']['data'][$y]['name'] = 'check_voicemail';
$this->destinations[$x]['result']['data'][$y]['name'] = '*98';
$this->destinations[$x]['result']['data'][$y]['destination'] = '*98 XML ${context}'; $this->destinations[$x]['result']['data'][$y]['destination'] = '*98 XML ${context}';
$y++; $y++;
$this->destinations[$x]['result']['data'][$y]['label'] = 'company_directory'; $this->destinations[$x]['result']['data'][$y]['name'] = 'company_directory';
$this->destinations[$x]['result']['data'][$y]['name'] = '*411';
$this->destinations[$x]['result']['data'][$y]['destination'] = '*411 XML ${context}'; $this->destinations[$x]['result']['data'][$y]['destination'] = '*411 XML ${context}';
$y++; $y++;
$this->destinations[$x]['result']['data'][$y]['label'] = 'hangup';
$this->destinations[$x]['result']['data'][$y]['name'] = 'hangup'; $this->destinations[$x]['result']['data'][$y]['name'] = 'hangup';
$this->destinations[$x]['result']['data'][$y]['application'] = 'hangup'; $this->destinations[$x]['result']['data'][$y]['application'] = 'hangup';
$this->destinations[$x]['result']['data'][$y]['destination'] = ''; $this->destinations[$x]['result']['data'][$y]['destination'] = '';
$y++; $y++;
$this->destinations[$x]['result']['data'][$y]['label'] = 'record'; $this->destinations[$x]['result']['data'][$y]['name'] = 'record';
$this->destinations[$x]['result']['data'][$y]['name'] = '*732';
$this->destinations[$x]['result']['data'][$y]['destination'] = '*732 XML ${context}'; $this->destinations[$x]['result']['data'][$y]['destination'] = '*732 XML ${context}';
$y++; $y++;
} }
@ -814,40 +815,39 @@ if (!class_exists('destinations')) {
$this->destinations[$x]['result']['data'] = $result; $this->destinations[$x]['result']['data'] = $result;
} }
if ($row['type'] === 'array') { if ($row['type'] === 'array') {
$this->destinations[$x] = $row['result']['data']; $this->destinations[$x] = $row;
} }
$x++; $x++;
} }
$this->destinations[$x]['type'] = 'array'; $this->destinations[$x]['type'] = 'array';
$this->destinations[$x]['label'] = 'other'; $this->destinations[$x]['label'] = 'other';
$this->destinations[$x]['name'] = 'dialplans'; $this->destinations[$x]['name'] = 'other';
$this->destinations[$x]['field']['label'] = "label";
$this->destinations[$x]['field']['name'] = "name"; $this->destinations[$x]['field']['name'] = "name";
$this->destinations[$x]['field']['extension'] = "extension";
$this->destinations[$x]['field']['destination'] = "destination"; $this->destinations[$x]['field']['destination'] = "destination";
$this->destinations[$x]['select_value']['dialplan'] = "transfer:\${destination}"; $this->destinations[$x]['select_value']['dialplan'] = "transfer:\${destination}";
$this->destinations[$x]['select_value']['ivr'] = "menu-exec-app:transfer \${destination}"; $this->destinations[$x]['select_value']['ivr'] = "menu-exec-app:transfer \${destination}";
$this->destinations[$x]['select_label'] = "\${name}"; $this->destinations[$x]['select_label'] = "\${name}";
$y = 0; $y = 0;
$this->destinations[$x]['result']['data'][$y]['label'] = 'check_voicemail'; $this->destinations[$x]['result']['data'][$y]['name'] = 'check_voicemail';
$this->destinations[$x]['result']['data'][$y]['name'] = '*98';
$this->destinations[$x]['result']['data'][$y]['extension'] = '*98'; $this->destinations[$x]['result']['data'][$y]['extension'] = '*98';
$this->destinations[$x]['result']['data'][$y]['destination'] = '*98 XML ${context}'; $this->destinations[$x]['result']['data'][$y]['destination'] = '*98 XML ${context}';
$y++; $y++;
$this->destinations[$x]['result']['data'][$y]['label'] = 'company_directory'; $this->destinations[$x]['result']['data'][$y]['name'] = 'company_directory';
$this->destinations[$x]['result']['data'][$y]['name'] = '*411';
$this->destinations[$x]['result']['data'][$y]['extension'] = '*411'; $this->destinations[$x]['result']['data'][$y]['extension'] = '*411';
$this->destinations[$x]['result']['data'][$y]['destination'] = '*411 XML ${context}'; $this->destinations[$x]['result']['data'][$y]['destination'] = '*411 XML ${context}';
$y++; $y++;
$this->destinations[$x]['result']['data'][$y]['label'] = 'hangup';
$this->destinations[$x]['result']['data'][$y]['name'] = 'hangup'; $this->destinations[$x]['result']['data'][$y]['name'] = 'hangup';
$this->destinations[$x]['result']['data'][$y]['application'] = 'hangup'; $this->destinations[$x]['result']['data'][$y]['application'] = 'hangup';
$this->destinations[$x]['result']['data'][$y]['destination'] = ''; $this->destinations[$x]['result']['data'][$y]['destination'] = '';
$y++; $y++;
$this->destinations[$x]['result']['data'][$y]['label'] = 'record'; $this->destinations[$x]['result']['data'][$y]['name'] = 'record';
$this->destinations[$x]['result']['data'][$y]['name'] = '*732';
$this->destinations[$x]['result']['data'][$y]['extension'] = '*732'; $this->destinations[$x]['result']['data'][$y]['extension'] = '*732';
$this->destinations[$x]['result']['data'][$y]['destination'] = '*732 XML ${context}'; $this->destinations[$x]['result']['data'][$y]['destination'] = '*732 XML ${context}';
$y++; $y++;
} }
//remove special characters from the name //remove special characters from the name
@ -875,6 +875,7 @@ if (!class_exists('destinations')) {
foreach ($row['result']['data'] as $data) { foreach ($row['result']['data'] as $data) {
$select_value = $row['select_value'][$destination_type]; $select_value = $row['select_value'][$destination_type];
$select_label = $row['select_label']; $select_label = $row['select_label'];
//echo $select_label." ".__line__." ".$name."<br />\n";
foreach ($row['field'] as $key => $value) { foreach ($row['field'] as $key => $value) {
if ($key == 'destination' and is_array($value)) { if ($key == 'destination' and is_array($value)) {
if ($value['type'] == 'csv') { if ($value['type'] == 'csv') {
@ -916,6 +917,12 @@ if (!class_exists('destinations')) {
} }
} }
//view_array($data, false);
//echo "name ".$name."\n";
//echo "select_value ".$select_value."\n";
//echo "select_label ".$select_label."\n";
//echo "\n";
$select_value = str_replace("\${domain_name}", $this->domain_name, $select_value); $select_value = str_replace("\${domain_name}", $this->domain_name, $select_value);
$select_value = str_replace("\${context}", $this->domain_name, $select_value); $select_value = str_replace("\${context}", $this->domain_name, $select_value);
$select_label = str_replace("\${domain_name}", $this->domain_name, $select_label); $select_label = str_replace("\${domain_name}", $this->domain_name, $select_label);
@ -942,6 +949,7 @@ if (!class_exists('destinations')) {
unset($text); unset($text);
} }
} }
if (!$selected) { if (!$selected) {
$destination_label = str_replace(":", " ", $destination_value); $destination_label = str_replace(":", " ", $destination_value);
$destination_label = str_replace("menu-exec-app", "", $destination_label); $destination_label = str_replace("menu-exec-app", "", $destination_label);