mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-06 11:43:50 +00:00
SIP Profiles: Modal integration.
This commit is contained in:
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
The Initial Developer of the Original Code is
|
The Initial Developer of the Original Code is
|
||||||
Mark J Crane <markjcrane@fusionpbx.com>
|
Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
Portions created by the Initial Developer are Copyright (C) 2008-2016
|
Portions created by the Initial Developer are Copyright (C) 2008-2020
|
||||||
the Initial Developer. All Rights Reserved.
|
the Initial Developer. All Rights Reserved.
|
||||||
|
|
||||||
Contributor(s):
|
Contributor(s):
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
//includes
|
//includes
|
||||||
include "root.php";
|
require_once "root.php";
|
||||||
require_once "resources/require.php";
|
require_once "resources/require.php";
|
||||||
require_once "resources/check_auth.php";
|
require_once "resources/check_auth.php";
|
||||||
require_once "resources/paging.php";
|
require_once "resources/paging.php";
|
||||||
@@ -54,11 +54,14 @@ if (is_uuid($sip_profile_uuid) && $sip_profile_name != '') {
|
|||||||
|
|
||||||
//get the sip profile data
|
//get the sip profile data
|
||||||
if (count($_GET) > 0 && $_POST["persistformvar"] != "true") {
|
if (count($_GET) > 0 && $_POST["persistformvar"] != "true") {
|
||||||
$sql = "select sip_profile_description from v_sip_profiles ";
|
$sql = "select sip_profile_hostname, sip_profile_enabled, sip_profile_description from v_sip_profiles ";
|
||||||
$sql .= "where sip_profile_uuid = :sip_profile_uuid ";
|
$sql .= "where sip_profile_uuid = :sip_profile_uuid ";
|
||||||
$parameters['sip_profile_uuid'] = $sip_profile_uuid;
|
$parameters['sip_profile_uuid'] = $sip_profile_uuid;
|
||||||
$database = new database;
|
$database = new database;
|
||||||
$sip_profile_description = $database->select($sql, $parameters, 'column');
|
$row = $database->select($sql, $parameters, 'row');
|
||||||
|
$sip_profile_hostname = $row['sip_profile_hostname'];
|
||||||
|
$sip_profile_enabled = $row['sip_profile_enabled'];
|
||||||
|
$sip_profile_description = $row['sip_profile_description'];
|
||||||
unset($sql, $parameters);
|
unset($sql, $parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,8 +69,9 @@ if (is_uuid($sip_profile_uuid) && $sip_profile_name != '') {
|
|||||||
$sip_profile_uuid_new = uuid();
|
$sip_profile_uuid_new = uuid();
|
||||||
$array['sip_profiles'][0]['sip_profile_uuid'] = $sip_profile_uuid_new;
|
$array['sip_profiles'][0]['sip_profile_uuid'] = $sip_profile_uuid_new;
|
||||||
$array['sip_profiles'][0]['sip_profile_name'] = $sip_profile_name;
|
$array['sip_profiles'][0]['sip_profile_name'] = $sip_profile_name;
|
||||||
$array['sip_profiles'][0]['sip_profile_enabled'] = 'true';
|
$array['sip_profiles'][0]['sip_profile_hostname'] = $sip_profile_hostname;
|
||||||
$array['sip_profiles'][0]['sip_profile_description'] = $sip_profile_description;
|
$array['sip_profiles'][0]['sip_profile_enabled'] = $sip_profile_enabled;
|
||||||
|
$array['sip_profiles'][0]['sip_profile_description'] = $sip_profile_description.' ('.$text['label-copy'].')';
|
||||||
|
|
||||||
//get the the sip profile settings
|
//get the the sip profile settings
|
||||||
$sql = "select * from v_sip_profile_domains ";
|
$sql = "select * from v_sip_profile_domains ";
|
||||||
|
|||||||
@@ -328,7 +328,7 @@
|
|||||||
|| permission_exists('outbound_route_add')
|
|| permission_exists('outbound_route_add')
|
||||||
|| permission_exists('time_condition_add')
|
|| permission_exists('time_condition_add')
|
||||||
) {
|
) {
|
||||||
echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$_SESSION['theme']['button_icon_copy'],'id'=>'btn_copy','style'=>$button_margin,'onclick'=>"var name = prompt('".$text['label-new_sip_profile_name']."'); if (name != null) { window.location='sip_profile_copy.php?id=".urlencode($sip_profile_uuid)."&name=' + name; }"]);
|
echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$_SESSION['theme']['button_icon_copy'],'name'=>'btn_copy','style'=>$button_margin,'onclick'=>"modal_open('modal-copy','new_profile_name');"]);
|
||||||
unset($button_margin);
|
unset($button_margin);
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
@@ -336,7 +336,7 @@
|
|||||||
|| permission_exists('sip_profile_domain_delete')
|
|| permission_exists('sip_profile_domain_delete')
|
||||||
|| permission_exists('sip_profile_setting_delete')
|
|| permission_exists('sip_profile_setting_delete')
|
||||||
) {
|
) {
|
||||||
echo button::create(['type'=>'submit','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'id'=>'btn_delete','name'=>'action','value'=>'delete','style'=>$button_margin,'onclick'=>"if (!confirm('".$text['confirm-delete']."')) { this.blur(); return false; }"]);
|
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'name'=>'btn_delete','style'=>$button_margin,'onclick'=>"modal_open('modal-delete','btn_delete');"]);
|
||||||
unset($button_margin);
|
unset($button_margin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -345,6 +345,38 @@
|
|||||||
echo " <div style='clear: both;'></div>\n";
|
echo " <div style='clear: both;'></div>\n";
|
||||||
echo "</div>\n";
|
echo "</div>\n";
|
||||||
|
|
||||||
|
if ($action == 'update') {
|
||||||
|
if (
|
||||||
|
permission_exists('dialplan_add')
|
||||||
|
|| permission_exists('inbound_route_add')
|
||||||
|
|| permission_exists('outbound_route_add')
|
||||||
|
|| permission_exists('time_condition_add')
|
||||||
|
) {
|
||||||
|
echo modal::create([
|
||||||
|
'id'=>'modal-copy',
|
||||||
|
'type'=>'general',
|
||||||
|
'message'=>$text['label-new_sip_profile_name']."...<br /><br /><input class='formfld modal-input' data-continue='btn_copy' type='text' id='new_profile_name' maxlength='255'>",
|
||||||
|
'actions'=>button::create([
|
||||||
|
'type'=>'button',
|
||||||
|
'label'=>$text['button-continue'],
|
||||||
|
'icon'=>'check',
|
||||||
|
'id'=>'btn_copy',
|
||||||
|
'style'=>'float: right; margin-left: 15px;',
|
||||||
|
'collapse'=>'never',
|
||||||
|
'onclick'=>"modal_close(); if (document.getElementById('new_profile_name').value != '') { window.location='sip_profile_copy.php?id=".urlencode($sip_profile_uuid)."&name=' + document.getElementById('new_profile_name').value; }"
|
||||||
|
]),
|
||||||
|
'onclose'=>"document.getElementById('new_profile_name').value = '';",
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
permission_exists('sip_profile_delete')
|
||||||
|
|| permission_exists('sip_profile_domain_delete')
|
||||||
|
|| permission_exists('sip_profile_setting_delete')
|
||||||
|
) {
|
||||||
|
echo modal::create(['id'=>'modal-delete','type'=>'delete','actions'=>button::create(['type'=>'submit','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_delete','style'=>'float: right; margin-left: 15px;','collapse'=>'never','name'=>'action','value'=>'delete','onclick'=>"modal_close();"])]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||||
|
|
||||||
echo "<tr>\n";
|
echo "<tr>\n";
|
||||||
|
|||||||
@@ -123,10 +123,10 @@
|
|||||||
echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'id'=>'btn_add','link'=>'sip_profile_edit.php']);
|
echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'id'=>'btn_add','link'=>'sip_profile_edit.php']);
|
||||||
}
|
}
|
||||||
if (permission_exists('sip_profile_edit') && $sip_profiles) {
|
if (permission_exists('sip_profile_edit') && $sip_profiles) {
|
||||||
echo button::create(['type'=>'button','label'=>$text['button-toggle'],'icon'=>$_SESSION['theme']['button_icon_toggle'],'id'=>'btn_toggle','onclick'=>"if (confirm('".$text['confirm-toggle']."')) { list_action_set('toggle'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
|
echo button::create(['type'=>'button','label'=>$text['button-toggle'],'icon'=>$_SESSION['theme']['button_icon_toggle'],'name'=>'btn_toggle','onclick'=>"modal_open('modal-toggle','btn_toggle');"]);
|
||||||
}
|
}
|
||||||
if (permission_exists('sip_profile_delete') && $sip_profiles) {
|
if (permission_exists('sip_profile_delete') && $sip_profiles) {
|
||||||
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'id'=>'btn_delete','onclick'=>"if (confirm('".$text['confirm-delete']."')) { list_action_set('delete'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
|
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'name'=>'btn_delete','onclick'=>"modal_open('modal-delete','btn_delete');"]);
|
||||||
}
|
}
|
||||||
echo "<form id='form_search' class='inline' method='get'>\n";
|
echo "<form id='form_search' class='inline' method='get'>\n";
|
||||||
echo "<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown='list_search_reset();'>";
|
echo "<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown='list_search_reset();'>";
|
||||||
@@ -140,6 +140,13 @@
|
|||||||
echo " <div style='clear: both;'></div>\n";
|
echo " <div style='clear: both;'></div>\n";
|
||||||
echo "</div>\n";
|
echo "</div>\n";
|
||||||
|
|
||||||
|
if (permission_exists('sip_profile_edit') && $sip_profiles) {
|
||||||
|
echo modal::create(['id'=>'modal-toggle','type'=>'toggle','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_toggle','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('toggle'); list_form_submit('form_list');"])]);
|
||||||
|
}
|
||||||
|
if (permission_exists('sip_profile_delete') && $sip_profiles) {
|
||||||
|
echo modal::create(['id'=>'modal-delete','type'=>'delete','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_delete','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('delete'); list_form_submit('form_list');"])]);
|
||||||
|
}
|
||||||
|
|
||||||
echo $text['description-sip_profiles']."\n";
|
echo $text['description-sip_profiles']."\n";
|
||||||
echo "<br /><br />\n";
|
echo "<br /><br />\n";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user