SIP Profiles: Added Enabled select box to manage the profile state.

This commit is contained in:
Nate Jones
2015-05-02 04:53:45 +00:00
parent b442960964
commit 3d654ad634
5 changed files with 77 additions and 8 deletions

View File

@@ -78,6 +78,10 @@
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(255)";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "sip_profile_enabled";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "sip_profile_description";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the description.";

View File

@@ -85,7 +85,7 @@
case "internal":
$sip_profile_description = "The Internal profile by default requires registration which is used by the endpoints. ";
$sip_profile_description .= "By default the Internal profile binds to port 5060. ";
break;
break;
case "internal-ipv6":
$sip_profile_description = "The Internal IPV6 profile binds to the IP version 6 address and is similar to the Internal profile.\n";
break;
@@ -181,4 +181,13 @@
}
}
//if empty, set sip_profile_enabled = true
if ($domains_processed == 1) {
$sql = "update v_sip_profiles set ";
$sql .= "sip_profile_enabled = 'true' ";
$sql .= "where sip_profile_enabled is null ";
$sql .= "or sip_profile_enabled = '' ";
$db->exec(check_sql($sql));
unset($sql);
}
?>

View File

@@ -79,6 +79,15 @@ $text['message-add']['pt-br'] = "Criação Efetuada";
$text['message-add']['pl'] = "Dodano poprawnie";
$text['message-add']['sv-se'] = "Tillagd";
$text['label-true']['en-us'] = "True";
$text['label-true']['es-cl'] = "Verdadero";
$text['label-true']['pt-pt'] = "Sim";
$text['label-true']['fr-fr'] = "Oui";
$text['label-true']['pt-br'] = "Sim";
$text['label-true']['pl'] = "Tak";
$text['label-true']['uk'] = "Так";
$text['label-true']['sv-se'] = "Sann";
$text['label-setting_value']['en-us'] = "Value";
$text['label-setting_value']['es-cl'] = "Valor";
$text['label-setting_value']['pt-pt'] = "Valor";
@@ -126,6 +135,24 @@ $text['label-hostname']['pt-br'] = "Hostname";
$text['label-hostname']['pl'] = "Nazwa hosta";
$text['label-hostname']['sv-se'] = "Hostname";
$text['label-false']['en-us'] = "False";
$text['label-false']['es-cl'] = "Falso";
$text['label-false']['pt-pt'] = "Não";
$text['label-false']['fr-fr'] = "Non";
$text['label-false']['pt-br'] = "Não";
$text['label-false']['pl'] = "Nie";
$text['label-false']['uk'] = "Ні";
$text['label-false']['sv-se'] = "Falsk";
$text['label-enabled']['en-us'] = "Enabled";
$text['label-enabled']['es-cl'] = "Activado";
$text['label-enabled']['pt-pt'] = "Habilitada";
$text['label-enabled']['fr-fr'] = "Actif";
$text['label-enabled']['pt-br'] = "Habilitado";
$text['label-enabled']['pl'] = "Numer wew włączony?";
$text['label-enabled']['uk'] = "Включено";
$text['label-enabled']['sv-se'] = "Aktiverad";
$text['label-description']['en-us'] = "Description";
$text['label-description']['es-cl'] = "Descripción";
$text['label-description']['pt-pt'] = "Descrição";
@@ -235,6 +262,13 @@ $text['description-hostname']['pt-br'] = "Insira o hostname";
$text['description-hostname']['pl'] = "Wprowadź nazwę hosta / PBXu.";
$text['description-hostname']['sv-se'] = "Fyll i hostname / switchname.";
$text['description-enabled']['en-us'] = "Control the state of the profile.";
$text['description-enabled']['pt-pt'] = "Controlar o estado do perfil.";
$text['description-enabled']['fr-fr'] = "Contrôler l'état du profil.";
$text['description-enabled']['pt-br'] = "Controlar o estado do perfil.";
$text['description-enabled']['pl'] = "Kontroluj stan profilu.";
$text['description-enabled']['sv-se'] = "Styr tillståndet i profilen.";
$text['description-description']['en-us'] = "Enter the description.";
$text['description-description']['es-cl'] = "Ingrese una descripción.";
$text['description-description']['pt-pt'] = "Introduza a descrição.";

View File

@@ -71,8 +71,9 @@ else {
//get http post variables and set them to php variables
if (count($_POST) > 0) {
$sip_profile_name = check_str($_POST["sip_profile_name"]);
$sip_profile_description = check_str($_POST["sip_profile_description"]);
$sip_profile_hostname = check_str($_POST["sip_profile_hostname"]);
$sip_profile_description = check_str($_POST["sip_profile_description"]);
$sip_profile_enabled = check_str($_POST["sip_profile_enabled"]);
}
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
@@ -107,7 +108,8 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$sql .= "sip_profile_uuid, ";
$sql .= "sip_profile_name, ";
$sql .= "sip_profile_hostname, ";
$sql .= "sip_profile_description ";
$sql .= "sip_profile_description, ";
$sql .= "sip_profile_enabled ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
@@ -119,7 +121,8 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
else {
$sql .= "null, ";
}
$sql .= "'$sip_profile_description' ";
$sql .= "'$sip_profile_description', ";
$sql .= "'$sip_profile_enabled' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
@@ -135,7 +138,8 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
else {
$sql .= "sip_profile_hostname = null, ";
}
$sql .= "sip_profile_description = '$sip_profile_description' ";
$sql .= "sip_profile_description = '$sip_profile_description', ";
$sql .= "sip_profile_enabled = '$sip_profile_enabled' ";
$sql .= "where sip_profile_uuid = '$sip_profile_uuid'";
$db->exec(check_sql($sql));
unset($sql);
@@ -173,6 +177,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$sip_profile_name = $row["sip_profile_name"];
$sip_profile_hostname = $row["sip_profile_hostname"];
$sip_profile_description = $row["sip_profile_description"];
$sip_profile_enabled = $row["sip_profile_enabled"];
break; //limit to 1 row
}
unset ($prep_statement);
@@ -221,6 +226,20 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-enabled']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='sip_profile_enabled'>\n";
echo " <option value='true' ".(($sip_profile_enabled == "true") ? "selected='selected'" : null).">".$text['label-true']."</option>\n";
echo " <option value='false' ".(($sip_profile_enabled == "false") ? "selected='selected'" : null).">".$text['label-false']."</option>\n";
echo " </select>\n";
echo "<br />\n";
echo $text['description-enabled']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-description']."\n";
@@ -231,6 +250,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo $text['description-description']."\n";
echo "</td>\n";
echo "</tr>\n";
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
if ($action == "update") {

View File

@@ -104,8 +104,9 @@ require_once "resources/paging.php";
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo th_order_by('sip_profile_name', $text['label-name'], $order_by, $order);
echo "<th align='left' >".$text['label-hostname']."</th>\n";
echo "<th align='left' width='60%'>".$text['label-description']."</th>\n";
echo "<th align='left'>".$text['label-hostname']."</th>\n";
echo "<th align='left'>".$text['label-enabled']."</th>\n";
echo "<th align='left' width='50%'>".$text['label-description']."</th>\n";
echo "<td class='list_control_icons'>";
if (permission_exists('sip_profile_add')) {
echo "<a href='sip_profile_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
@@ -126,6 +127,7 @@ require_once "resources/paging.php";
}
echo " </td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['sip_profile_hostname']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$text['label-'.$row['sip_profile_enabled']]."&nbsp;</td>\n";
echo " <td valign='top' class='row_stylebg'>".$row['sip_profile_description']."&nbsp;</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('sip_profile_edit')) {
@@ -142,7 +144,7 @@ require_once "resources/paging.php";
} //end if results
echo "<tr>\n";
echo "<td colspan='4' align='left'>\n";
echo "<td colspan='5' align='left'>\n";
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td width='33%' nowrap>&nbsp;</td>\n";