|
|
|
|
@@ -53,6 +53,25 @@
|
|
|
|
|
|
|
|
|
|
//get http post variables and set them to php variables
|
|
|
|
|
if (is_array($_POST)) {
|
|
|
|
|
|
|
|
|
|
//process the http post data by submitted action
|
|
|
|
|
if ($_POST['action'] != '' && is_uuid($_POST['sip_profile_uuid'])) {
|
|
|
|
|
$array[0]['checked'] = 'true';
|
|
|
|
|
$array[0]['uuid'] = $_POST['sip_profile_uuid'];
|
|
|
|
|
|
|
|
|
|
switch ($_POST['action']) {
|
|
|
|
|
case 'delete':
|
|
|
|
|
if (permission_exists('sip_profile_delete')) {
|
|
|
|
|
$obj = new sip_profiles;
|
|
|
|
|
$obj->delete($array);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
header('Location: sip_profiles.php');
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$sip_profile_uuid = $_POST["sip_profile_uuid"];
|
|
|
|
|
$sip_profile_name = $_POST["sip_profile_name"];
|
|
|
|
|
$sip_profile_hostname = $_POST["sip_profile_hostname"];
|
|
|
|
|
@@ -60,6 +79,8 @@
|
|
|
|
|
$sip_profile_description = $_POST["sip_profile_description"];
|
|
|
|
|
$sip_profile_domains = $_POST["sip_profile_domains"];
|
|
|
|
|
$sip_profile_settings = $_POST["sip_profile_settings"];
|
|
|
|
|
$sip_profile_domains_delete = $_POST["sip_profile_domains_delete"];
|
|
|
|
|
$sip_profile_settings_delete = $_POST["sip_profile_settings_delete"];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//process the user data and save it to the database
|
|
|
|
|
@@ -161,6 +182,34 @@
|
|
|
|
|
$database->save($array);
|
|
|
|
|
$message = $database->message;
|
|
|
|
|
|
|
|
|
|
//revoke temporary permissions
|
|
|
|
|
$p->delete('sip_profile_domain_add', 'temp');
|
|
|
|
|
$p->delete('sip_profile_setting_add', 'temp');
|
|
|
|
|
|
|
|
|
|
//remove checked domains
|
|
|
|
|
if (
|
|
|
|
|
$action == 'update'
|
|
|
|
|
&& permission_exists('sip_profile_domain_delete')
|
|
|
|
|
&& is_array($sip_profile_domains_delete)
|
|
|
|
|
&& @sizeof($sip_profile_domains_delete) != 0
|
|
|
|
|
) {
|
|
|
|
|
$obj = new sip_profiles;
|
|
|
|
|
$obj->sip_profile_uuid = $sip_profile_uuid;
|
|
|
|
|
$obj->delete_domains($sip_profile_domains_delete);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//remove checked settings
|
|
|
|
|
if (
|
|
|
|
|
$action == 'update'
|
|
|
|
|
&& permission_exists('sip_profile_setting_delete')
|
|
|
|
|
&& is_array($sip_profile_settings_delete)
|
|
|
|
|
&& @sizeof($sip_profile_settings_delete) != 0
|
|
|
|
|
) {
|
|
|
|
|
$obj = new sip_profiles;
|
|
|
|
|
$obj->sip_profile_uuid = $sip_profile_uuid;
|
|
|
|
|
$obj->delete_settings($sip_profile_settings_delete);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//get the hostname
|
|
|
|
|
if ($sip_profile_hostname == '') {
|
|
|
|
|
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
|
|
|
|
|
@@ -169,10 +218,6 @@
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//revoke temporary permissions
|
|
|
|
|
$p->delete('sip_profile_domain_add', 'temp');
|
|
|
|
|
$p->delete('sip_profile_setting_add', 'temp');
|
|
|
|
|
|
|
|
|
|
//clear the cache
|
|
|
|
|
$cache = new cache;
|
|
|
|
|
$cache->delete("configuration:sofia.conf:".$sip_profile_hostname);
|
|
|
|
|
@@ -221,13 +266,15 @@
|
|
|
|
|
unset($sql, $parameters);
|
|
|
|
|
|
|
|
|
|
//add an empty row
|
|
|
|
|
$x = count($sip_profile_settings);
|
|
|
|
|
$sip_profile_settings[$x]['sip_profile_setting_uuid'] = uuid();
|
|
|
|
|
$sip_profile_settings[$x]['sip_profile_uuid'] = $sip_profile_uuid;
|
|
|
|
|
$sip_profile_settings[$x]['sip_profile_setting_name'] = '';
|
|
|
|
|
$sip_profile_settings[$x]['sip_profile_setting_value'] = '';
|
|
|
|
|
$sip_profile_settings[$x]['sip_profile_setting_enabled'] = '';
|
|
|
|
|
$sip_profile_settings[$x]['sip_profile_setting_description'] = '';
|
|
|
|
|
if (permission_exists('sip_profile_setting_add')) {
|
|
|
|
|
$x = count($sip_profile_settings);
|
|
|
|
|
$sip_profile_settings[$x]['sip_profile_setting_uuid'] = '';
|
|
|
|
|
$sip_profile_settings[$x]['sip_profile_uuid'] = $sip_profile_uuid;
|
|
|
|
|
$sip_profile_settings[$x]['sip_profile_setting_name'] = '';
|
|
|
|
|
$sip_profile_settings[$x]['sip_profile_setting_value'] = '';
|
|
|
|
|
$sip_profile_settings[$x]['sip_profile_setting_enabled'] = '';
|
|
|
|
|
$sip_profile_settings[$x]['sip_profile_setting_description'] = '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//get the child data
|
|
|
|
|
$sql = "select * from v_sip_profile_domains ";
|
|
|
|
|
@@ -238,12 +285,14 @@
|
|
|
|
|
unset($sql, $parameters);
|
|
|
|
|
|
|
|
|
|
//add an empty row
|
|
|
|
|
$x = count($sip_profile_domains);
|
|
|
|
|
$sip_profile_domains[$x]['sip_profile_domain_uuid'] = uuid();
|
|
|
|
|
$sip_profile_domains[$x]['sip_profile_uuid'] = $sip_profile_uuid;
|
|
|
|
|
$sip_profile_domains[$x]['sip_profile_domain_name'] = '';
|
|
|
|
|
$sip_profile_domains[$x]['sip_profile_domain_alias'] = '';
|
|
|
|
|
$sip_profile_domains[$x]['sip_profile_domain_parse'] = '';
|
|
|
|
|
if (permission_exists('sip_profile_domain_add')) {
|
|
|
|
|
$x = count($sip_profile_domains);
|
|
|
|
|
$sip_profile_domains[$x]['sip_profile_domain_uuid'] = '';
|
|
|
|
|
$sip_profile_domains[$x]['sip_profile_uuid'] = $sip_profile_uuid;
|
|
|
|
|
$sip_profile_domains[$x]['sip_profile_domain_name'] = '';
|
|
|
|
|
$sip_profile_domains[$x]['sip_profile_domain_alias'] = '';
|
|
|
|
|
$sip_profile_domains[$x]['sip_profile_domain_parse'] = '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//create token
|
|
|
|
|
$object = new token;
|
|
|
|
|
@@ -270,16 +319,28 @@
|
|
|
|
|
echo "<div class='action_bar' id='action_bar'>\n";
|
|
|
|
|
echo " <div class='heading'><b>".$text['title-sip_profile']."</b></div>\n";
|
|
|
|
|
echo " <div class='actions'>\n";
|
|
|
|
|
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'style'=>'margin-right: 15px;','link'=>'sip_profiles.php']);
|
|
|
|
|
if ($action == 'update' && (
|
|
|
|
|
permission_exists('dialplan_add')
|
|
|
|
|
|| permission_exists('inbound_route_add')
|
|
|
|
|
|| permission_exists('outbound_route_add')
|
|
|
|
|
|| permission_exists('time_condition_add')
|
|
|
|
|
)) {
|
|
|
|
|
echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$_SESSION['theme']['button_icon_copy'],'style'=>'margin-right: 15px;','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-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'link'=>'sip_profiles.php']);
|
|
|
|
|
$button_margin = 'margin-left: 15px;';
|
|
|
|
|
if ($action == 'update') {
|
|
|
|
|
if (
|
|
|
|
|
permission_exists('dialplan_add')
|
|
|
|
|
|| permission_exists('inbound_route_add')
|
|
|
|
|
|| permission_exists('outbound_route_add')
|
|
|
|
|
|| permission_exists('time_condition_add')
|
|
|
|
|
) {
|
|
|
|
|
echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$_SESSION['theme']['button_icon_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; }"]);
|
|
|
|
|
unset($button_margin);
|
|
|
|
|
}
|
|
|
|
|
if (
|
|
|
|
|
permission_exists('sip_profile_delete')
|
|
|
|
|
|| permission_exists('sip_profile_domain_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; }"]);
|
|
|
|
|
unset($button_margin);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save']]);
|
|
|
|
|
echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'style'=>'margin-left: 15px;']);
|
|
|
|
|
echo " </div>\n";
|
|
|
|
|
echo " <div style='clear: both;'></div>\n";
|
|
|
|
|
echo "</div>\n";
|
|
|
|
|
@@ -302,72 +363,65 @@
|
|
|
|
|
echo " ".$text['title-sip_profile_domains']."\n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td class='vtable' align='left'>\n";
|
|
|
|
|
echo " <table>\n";
|
|
|
|
|
echo " <table border='0' cellpadding='0' cellspacing='0'>\n";
|
|
|
|
|
echo " <tr>\n";
|
|
|
|
|
echo " <th class='vtable' style='width:80px; text-align: left;'> ".$text['label-sip_profile_domain_name']."</th>\n";
|
|
|
|
|
echo " <th class='vtable' style='width:70px; text-align: left;'>".$text['label-sip_profile_domain_alias']."</th>\n";
|
|
|
|
|
echo " <th class='vtable' style='width:70px; text-align: left;'>".$text['label-sip_profile_domain_parse']."</th>\n";
|
|
|
|
|
echo " <th class='vtable'>".$text['label-sip_profile_domain_name']."</th>\n";
|
|
|
|
|
echo " <th class='vtable' style='text-align: center;'>".$text['label-sip_profile_domain_alias']."</th>\n";
|
|
|
|
|
echo " <th class='vtable' style='text-align: center;'>".$text['label-sip_profile_domain_parse']."</th>\n";
|
|
|
|
|
if (
|
|
|
|
|
permission_exists('sip_profile_domain_delete') && (
|
|
|
|
|
(permission_exists('sip_profile_domain_add') && is_array($sip_profile_domains) && @sizeof($sip_profile_domains) > 1) ||
|
|
|
|
|
(!permission_exists('sip_profile_domain_add') && is_array($sip_profile_domains) && @sizeof($sip_profile_domains) != 0)
|
|
|
|
|
)) {
|
|
|
|
|
echo " <td class='vtable edit_delete_checkbox_all' onmouseover=\"swap_display('delete_label_domains', 'delete_toggle_domains');\" onmouseout=\"swap_display('delete_label_domains', 'delete_toggle_domains');\">\n";
|
|
|
|
|
echo " <span id='delete_label_domains'>".$text['label-delete']."</span>\n";
|
|
|
|
|
echo " <span id='delete_toggle_domains'><input type='checkbox' id='checkbox_all_domains' name='checkbox_all' onclick=\"edit_all_toggle('domains');\"></span>\n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
}
|
|
|
|
|
echo " </tr>\n";
|
|
|
|
|
$x = 0;
|
|
|
|
|
foreach ($sip_profile_domains as $row) {
|
|
|
|
|
$bottom_border = !is_uuid($row['sip_profile_domain_uuid']) ? "border-bottom: none;" : null;
|
|
|
|
|
echo " <tr>\n";
|
|
|
|
|
if (is_uuid($row["sip_profile_domain_uuid"])) {
|
|
|
|
|
$sip_profile_domain_uuid = $row["sip_profile_domain_uuid"];
|
|
|
|
|
}
|
|
|
|
|
if (is_uuid($row["sip_profile_uuid"])) {
|
|
|
|
|
$sip_profile_uuid = $row["sip_profile_uuid"];
|
|
|
|
|
}
|
|
|
|
|
echo " <input type='hidden' name='sip_profile_domains[$x][sip_profile_domain_uuid]' value='".escape($sip_profile_domain_uuid)."'>\n";
|
|
|
|
|
echo " <input type='hidden' name='sip_profile_domains[$x][sip_profile_domain_uuid]' value='".(is_uuid($row["sip_profile_domain_uuid"]) ? $sip_profile_domain_uuid : uuid())."'>\n";
|
|
|
|
|
echo " <input type='hidden' name='sip_profile_domains[$x][sip_profile_uuid]' value='".escape($sip_profile_uuid)."'>\n";
|
|
|
|
|
echo " <td class='vtablerow' style='' onclick=\"label_to_form('label_sip_profile_domain_name_$x','sip_profile_domain_name_$x');\" nowrap='nowrap'>\n";
|
|
|
|
|
echo " <td class='vtablerow' style='".$bottom_border."' ".(permission_exists('sip_profile_domain_edit') ? "onclick=\"label_to_form('label_sip_profile_domain_name_$x','sip_profile_domain_name_$x');\"" : null)." nowrap='nowrap'>\n";
|
|
|
|
|
echo " <label id='label_sip_profile_domain_name_$x'>".escape($row["sip_profile_domain_name"])."</label>\n";
|
|
|
|
|
echo " <input id='sip_profile_domain_name_$x' class='formfld' style='display: none;' type='text' name='sip_profile_domains[$x][sip_profile_domain_name]' maxlength='255' value=\"".escape($row["sip_profile_domain_name"])."\">\n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td class='vtablerow' style='' onclick=\"label_to_form('label_sip_profile_domain_alias_$x','sip_profile_domain_alias_$x');\" nowrap='nowrap'>\n";
|
|
|
|
|
echo " <td class='vtablerow' style='".$bottom_border." text-align: center;' ".(permission_exists('sip_profile_domain_edit') ? "onclick=\"label_to_form('label_sip_profile_domain_alias_$x','sip_profile_domain_alias_$x');\"" : null)." nowrap='nowrap'>\n";
|
|
|
|
|
echo " <label id='label_sip_profile_domain_alias_$x'>".$text['label-'.$row["sip_profile_domain_alias"]]."</label>\n";
|
|
|
|
|
echo " <select id='sip_profile_domain_alias_$x' class='formfld' style='display: none;' name='sip_profile_domains[$x][sip_profile_domain_alias]'>\n";
|
|
|
|
|
echo " <option value=''></option>\n";
|
|
|
|
|
if ($row["sip_profile_domain_alias"] == "true") {
|
|
|
|
|
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo " <option value='true'>".$text['label-true']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
if ($row["sip_profile_domain_alias"] == "false") {
|
|
|
|
|
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo " <option value='false'>".$text['label-false']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
echo " <option value='true' ".($row["sip_profile_domain_alias"] == "true" ? "selected='selected'" : null).">".$text['label-true']."</option>\n";
|
|
|
|
|
echo " <option value='false' ".($row["sip_profile_domain_alias"] == "false" ? "selected='selected'" : null).">".$text['label-false']."</option>\n";
|
|
|
|
|
echo " </select>\n";
|
|
|
|
|
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td class='vtablerow' style='' onclick=\"label_to_form('label_sip_profile_domain_parse_$x','sip_profile_domain_parse_$x');\" nowrap='nowrap'>\n";
|
|
|
|
|
echo " <td class='vtablerow' style='".$bottom_border." text-align: center;' ".(permission_exists('sip_profile_domain_edit') ? "onclick=\"label_to_form('label_sip_profile_domain_parse_$x','sip_profile_domain_parse_$x');\"" : null)." nowrap='nowrap'>\n";
|
|
|
|
|
echo " <label id='label_sip_profile_domain_parse_$x'>".$text['label-'.$row["sip_profile_domain_parse"]]."</label>\n";
|
|
|
|
|
echo " <select id='sip_profile_domain_parse_$x' class='formfld' style='display: none;' name='sip_profile_domains[$x][sip_profile_domain_parse]'>\n";
|
|
|
|
|
echo " <option value=''></option>\n";
|
|
|
|
|
if ($row["sip_profile_domain_parse"] == "true") {
|
|
|
|
|
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo " <option value='true'>".$text['label-true']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
if ($row["sip_profile_domain_parse"] == "false") {
|
|
|
|
|
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo " <option value='false'>".$text['label-false']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
echo " <option value='true' ".($row["sip_profile_domain_parse"] == "true" ? "selected='selected'" : null).">".$text['label-true']."</option>\n";
|
|
|
|
|
echo " <option value='false' ".($row["sip_profile_domain_parse"] == "false" ? "selected='selected'" : null).">".$text['label-false']."</option>\n";
|
|
|
|
|
echo " </select>\n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td class='list_control_icons' style='width: 25px;'>\n";
|
|
|
|
|
if (strlen($row["sip_profile_domain_name"]) > 0) {
|
|
|
|
|
echo " <a href='sip_profile_domain_delete.php?id=".urlencode($row["sip_profile_domain_uuid"])."&sip_profile_domain_uuid=".urlencode($row["sip_profile_domain_uuid"])."&a=delete' alt='delete' onclick=\"return confirm('".$text['confirm-delete']."')\">".$v_link_label_delete."</a>\n";
|
|
|
|
|
if (permission_exists('sip_profile_domain_delete')) {
|
|
|
|
|
if (is_uuid($row['sip_profile_domain_uuid'])) {
|
|
|
|
|
echo " <td class='vtable' style='text-align: center; padding-bottom: 3px;'>";
|
|
|
|
|
echo " <input type='checkbox' name='sip_profile_domains_delete[".$x."][checked]' value='true' class='chk_delete checkbox_domains' onclick=\"edit_delete_action('domains');\">\n";
|
|
|
|
|
echo " <input type='hidden' name='sip_profile_domains_delete[".$x."][uuid]' value='".escape($row['sip_profile_domain_uuid'])."' />\n";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo " <td>\n";
|
|
|
|
|
}
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
}
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " </tr>\n";
|
|
|
|
|
//convert last empty labels to form elements
|
|
|
|
|
if ($row["sip_profile_domain_name"] == '' && $row["sip_profile_domain_alias"] == '' && $row["sip_profile_domain_parse"] == '') {
|
|
|
|
|
if (permission_exists('sip_profile_domain_add') && !is_uuid($row["sip_profile_domain_uuid"])) {
|
|
|
|
|
echo "<script>\n";
|
|
|
|
|
echo " label_to_form('label_sip_profile_domain_name_$x','sip_profile_domain_name_$x');\n";
|
|
|
|
|
echo " label_to_form('label_sip_profile_domain_alias_$x','sip_profile_domain_alias_$x');\n";
|
|
|
|
|
@@ -385,56 +439,62 @@
|
|
|
|
|
echo " ".$text['label-sip_profile_settings']."\n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td class='vtable' align='left'>\n";
|
|
|
|
|
echo " <table>\n";
|
|
|
|
|
echo " <table border='0' cellpadding='0' cellspacing='0'>\n";
|
|
|
|
|
echo " <tr>\n";
|
|
|
|
|
echo " <th class='vtable' style='text-align: left;'> ".$text['label-sip_profile_setting_name']."</th>\n";
|
|
|
|
|
echo " <th class='vtable' style='text-align: left;'>".$text['label-sip_profile_setting_value']."</th>\n";
|
|
|
|
|
echo " <th class='vtable' style='width:70px; text-align: left;'>".$text['label-sip_profile_setting_enabled']."</th>\n";
|
|
|
|
|
echo " <th class='vtable' style='text-align: left;'>".$text['label-sip_profile_setting_description']."</th>\n";
|
|
|
|
|
echo " <th class='vtable'> ".$text['label-sip_profile_setting_name']."</th>\n";
|
|
|
|
|
echo " <th class='vtable'>".$text['label-sip_profile_setting_value']."</th>\n";
|
|
|
|
|
echo " <th class='vtable' style='text-align: center;'>".$text['label-sip_profile_setting_enabled']."</th>\n";
|
|
|
|
|
echo " <th class='vtable'>".$text['label-sip_profile_setting_description']."</th>\n";
|
|
|
|
|
if (
|
|
|
|
|
permission_exists('sip_profile_setting_delete') && (
|
|
|
|
|
(permission_exists('sip_profile_setting_add') && is_array($sip_profile_settings) && @sizeof($sip_profile_settings) > 1) ||
|
|
|
|
|
(!permission_exists('sip_profile_setting_add') && is_array($sip_profile_settings) && @sizeof($sip_profile_settings) != 0)
|
|
|
|
|
)) {
|
|
|
|
|
echo " <td class='vtable edit_delete_checkbox_all' onmouseover=\"swap_display('delete_label_settings', 'delete_toggle_settings');\" onmouseout=\"swap_display('delete_label_settings', 'delete_toggle_settings');\">\n";
|
|
|
|
|
echo " <span id='delete_label_settings'>".$text['label-delete']."</span>\n";
|
|
|
|
|
echo " <span id='delete_toggle_settings'><input type='checkbox' id='checkbox_all_settings' name='checkbox_all' onclick=\"edit_all_toggle('settings');\"></span>\n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
}
|
|
|
|
|
echo " </tr>\n";
|
|
|
|
|
$x = 0;
|
|
|
|
|
foreach ($sip_profile_settings as $row) {
|
|
|
|
|
$bottom_border = !is_uuid($row['sip_profile_setting_uuid']) ? "border-bottom: none;" : null;
|
|
|
|
|
echo " <tr>\n";
|
|
|
|
|
echo " <input type='hidden' name='sip_profile_settings[$x][sip_profile_setting_uuid]' value='".escape($row["sip_profile_setting_uuid"])."'>\n";
|
|
|
|
|
echo " <input type='hidden' name='sip_profile_settings[$x][sip_profile_setting_uuid]' value='".(is_uuid($row["sip_profile_setting_uuid"]) ? $row["sip_profile_setting_uuid"] : uuid())."'>\n";
|
|
|
|
|
echo " <input type='hidden' name='sip_profile_settings[$x][sip_profile_uuid]' value='".escape($row["sip_profile_uuid"])."'>\n";
|
|
|
|
|
echo " <td class='vtablerow' style='' onclick=\"label_to_form('label_sip_profile_setting_name_$x','sip_profile_setting_name_$x');\" nowrap='nowrap'>\n";
|
|
|
|
|
echo " <td class='vtablerow' style='".$bottom_border."' ".(permission_exists('sip_profile_setting_edit') ? "onclick=\"label_to_form('label_sip_profile_setting_name_$x','sip_profile_setting_name_$x');\"" : null)." nowrap='nowrap'>\n";
|
|
|
|
|
echo " <label id='label_sip_profile_setting_name_$x'>".escape($row["sip_profile_setting_name"])."</label>\n";
|
|
|
|
|
echo " <input id='sip_profile_setting_name_$x' class='formfld' style='display: none;' type='text' name='sip_profile_settings[$x][sip_profile_setting_name]' maxlength='255' value=\"".escape($row["sip_profile_setting_name"])."\">\n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td class='vtablerow' style='' onclick=\"label_to_form('label_sip_profile_setting_value_$x','sip_profile_setting_value_$x');\" nowrap='nowrap'>\n";
|
|
|
|
|
echo " <td class='vtablerow' style='".$bottom_border."' ".(permission_exists('sip_profile_setting_edit') ? "onclick=\"label_to_form('label_sip_profile_setting_value_$x','sip_profile_setting_value_$x');\"" : null)." nowrap='nowrap'>\n";
|
|
|
|
|
echo " <label id='label_sip_profile_setting_value_$x'>".escape(substr($row["sip_profile_setting_value"],0,22))." </label>\n";
|
|
|
|
|
echo " <input id='sip_profile_setting_value_$x' class='formfld' style='display: none;' type='text' name='sip_profile_settings[$x][sip_profile_setting_value]' maxlength='255' value=\"".escape($row["sip_profile_setting_value"])."\">\n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td class='vtablerow' style='' onclick=\"label_to_form('label_sip_profile_setting_enabled_$x','sip_profile_setting_enabled_$x');\" nowrap='nowrap'>\n";
|
|
|
|
|
echo " <td class='vtablerow' style='".$bottom_border." text-align: center;' ".(permission_exists('sip_profile_setting_edit') ? "onclick=\"label_to_form('label_sip_profile_setting_enabled_$x','sip_profile_setting_enabled_$x');\"" : null)." nowrap='nowrap'>\n";
|
|
|
|
|
echo " <label id='label_sip_profile_setting_enabled_$x'>".$text['label-'.$row["sip_profile_setting_enabled"]]."</label>\n";
|
|
|
|
|
echo " <select id='sip_profile_setting_enabled_$x' class='formfld' style='display: none;' name='sip_profile_settings[$x][sip_profile_setting_enabled].'>\n";
|
|
|
|
|
echo " <option value=''></option>\n";
|
|
|
|
|
if ($row['sip_profile_setting_enabled'] == "true") {
|
|
|
|
|
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo " <option value='true'>".$text['label-true']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
if ($row['sip_profile_setting_enabled'] == "false") {
|
|
|
|
|
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo " <option value='false'>".$text['label-false']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
echo " <option value='true'>".$text['label-true']."</option>\n";
|
|
|
|
|
echo " <option value='false' ".($row['sip_profile_setting_enabled'] == "false" ? "selected='selected'" : null).">".$text['label-false']."</option>\n";
|
|
|
|
|
echo " </select>\n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td class='vtablerow' style='' onclick=\"label_to_form('label_sip_profile_setting_description_$x','sip_profile_setting_description_$x');\" nowrap='nowrap'>\n";
|
|
|
|
|
echo " <td class='vtablerow' style='".$bottom_border."' ".(permission_exists('sip_profile_setting_edit') ? "onclick=\"label_to_form('label_sip_profile_setting_description_$x','sip_profile_setting_description_$x');\"" : null)." nowrap='nowrap'>\n";
|
|
|
|
|
echo " <label id='label_sip_profile_setting_description_$x'>".escape($row["sip_profile_setting_description"])." </label>\n";
|
|
|
|
|
echo " <input id='sip_profile_setting_description_$x' class='formfld' style='display: none;' type='text' name='sip_profile_settings[$x][sip_profile_setting_description]' maxlength='255' value=\"".escape($row["sip_profile_setting_description"])."\">\n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td class='list_control_icons' style='width: 25px;'>\n";
|
|
|
|
|
if (strlen($row["sip_profile_setting_name"]) > 0) {
|
|
|
|
|
echo " <a href='sip_profile_setting_delete.php?id=".urlencode($row["sip_profile_setting_uuid"])."&sip_profile_uuid=".urlencode($sip_profile_uuid)."&a=delete' alt='delete' onclick=\"return confirm('".$text['confirm-delete']."')\">".$v_link_label_delete."</a>\n";
|
|
|
|
|
if (permission_exists('sip_profile_setting_delete')) {
|
|
|
|
|
if (is_uuid($row['sip_profile_setting_uuid'])) {
|
|
|
|
|
echo " <td class='vtable' style='text-align: center; padding-bottom: 3px;'>";
|
|
|
|
|
echo " <input type='checkbox' name='sip_profile_settings_delete[".$x."][checked]' value='true' class='chk_delete checkbox_settings' onclick=\"edit_delete_action('settings');\">\n";
|
|
|
|
|
echo " <input type='hidden' name='sip_profile_settings_delete[".$x."][uuid]' value='".escape($row['sip_profile_setting_uuid'])."' />\n";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo " <td>\n";
|
|
|
|
|
}
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
}
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " </tr>\n";
|
|
|
|
|
//convert last empty labels to form elements
|
|
|
|
|
if ($row["sip_profile_setting_name"] == '' && $row["sip_profile_setting_value"] == '' && $row["sip_profile_setting_enabled"] == '' && $row["sip_profile_setting_description"] == '') {
|
|
|
|
|
if (permission_exists('sip_profile_setting_add') && !is_uuid($row["sip_profile_setting_uuid"])) {
|
|
|
|
|
echo "<script>\n";
|
|
|
|
|
echo " label_to_form('label_sip_profile_setting_name_$x','sip_profile_setting_name_$x');\n";
|
|
|
|
|
echo " label_to_form('label_sip_profile_setting_value_$x','sip_profile_setting_value_$x');\n";
|
|
|
|
|
|