diff --git a/app/destinations/resources/classes/destinations.php b/app/destinations/resources/classes/destinations.php index 6f81f54f33..efcc87f364 100644 --- a/app/destinations/resources/classes/destinations.php +++ b/app/destinations/resources/classes/destinations.php @@ -476,10 +476,11 @@ if (!class_exists('destinations')) { $language2 = new text; //build the destination select list in html - $response .= " \n"; $response .= " \n"; foreach($_SESSION['destinations']['array'][$destination_type] as $key => $value) { - if (permission_exists($destination->singular($key)."_destinations")) { + $singular = $this->singular($key); + if (permission_exists("{$singular}_destinations")) { //determine if selected $selected = ($key == $destination_key) ? "selected='selected'" : ''; @@ -493,7 +494,7 @@ if (!class_exists('destinations')) { $text2 = $language2->get($_SESSION['domain']['language']['code'], 'app/dialplans'); } //add the application to the select list - $response .= " \n"; + $response .= " \n"; } } $response .= " \n"; @@ -501,23 +502,20 @@ if (!class_exists('destinations')) { foreach($_SESSION['destinations']['array'][$destination_type] as $key => $value) { if ($key == $destination_key) { foreach($value as $k => $row) { - $selected = ($row['destination'] == $destination_value) ? "selected='selected'" : ''; - $response .= " \n"; - if ($row['destination'] == $destination_value) { - $response_button = button::create([ - 'type'=>'button', - 'icon'=>'external-link-alt', - 'id'=>'btn_dest_go', - 'title'=>$row['label'], - //'style'=>'margin-left: 15px;', - 'link'=>'/app/'.$key.'/'.$this->singular($key).'_edit.php?id='.$row[$this->singular($key).'_uuid'] - ])."\n"; - } + $selected = ($row['destination'] == $destination_value) ? "selected='selected'" : ''; + $uuid = isset($row[$this->singular($key).'_uuid']) ? $row[$this->singular($key).'_uuid'] : $row['uuid']; + $response .= " \n"; } } } - $response .= " ".$response_button."\n"; - + $response .= " "; + $response .= button::create([ + 'type'=>'button', + 'icon'=>'external-link-alt', + 'id'=>'btn_dest_go', + 'title'=>$text['label-edit'], + 'onclick'=>"let types = document.getElementById('{destination_id}_type').options; let opts = document.getElementById('{$destination_id}').options; if(opts[opts.selectedIndex].id && opts[opts.selectedIndex].id.length > 0) {window.open('/app/'+types[types.selectedIndex].className+'/'+types[types.selectedIndex].id+'_edit.php?id='+opts[opts.selectedIndex].id, '_blank');}" + ])."\n"; //debug information //echo $response; diff --git a/app/destinations/resources/destinations.php b/app/destinations/resources/destinations.php index e8095231bf..ae026b5e6e 100644 --- a/app/destinations/resources/destinations.php +++ b/app/destinations/resources/destinations.php @@ -30,7 +30,8 @@ echo "