Update phrase_edit.php
Add domain select list to phrase_edit.php
This commit is contained in:
parent
3113220faf
commit
7cd3e54f04
|
|
@ -24,18 +24,20 @@
|
|||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
include "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
require_once "resources/functions/save_phrases_xml.php";
|
||||
//includes
|
||||
include "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
require_once "resources/functions/save_phrases_xml.php";
|
||||
|
||||
if (permission_exists('phrase_add') || permission_exists('phrase_edit')) {
|
||||
//check permissions
|
||||
if (permission_exists('phrase_add') || permission_exists('phrase_edit')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
|
|
@ -51,7 +53,10 @@ else {
|
|||
}
|
||||
|
||||
//get the form value and set to php variables
|
||||
if (count($_POST)>0) {
|
||||
if (count($_POST) > 0) {
|
||||
if (permission_exists('phrase_domain')) {
|
||||
$domain_uuid = check_str($_POST["domain_uuid"]);
|
||||
}
|
||||
$phrase_name = check_str($_POST["phrase_name"]);
|
||||
$phrase_language = check_str($_POST["phrase_language"]);
|
||||
$phrase_enabled = check_str($_POST["phrase_enabled"]);
|
||||
|
|
@ -62,15 +67,16 @@ else {
|
|||
$phrase_name = str_replace("'", "", $phrase_name);
|
||||
}
|
||||
|
||||
//process the changes from the http post
|
||||
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
$msg = '';
|
||||
//get the uuid
|
||||
if ($action == "update") {
|
||||
$phrase_uuid = check_str($_POST["phrase_uuid"]);
|
||||
}
|
||||
|
||||
//check for all required data
|
||||
$msg = '';
|
||||
if (strlen($phrase_name) == 0) { $msg .= $text['message-required']." ".$text['label-name']."<br>\n"; }
|
||||
if (strlen($phrase_language) == 0) { $msg .= $text['message-required']." ".$text['label-language']."<br>\n"; }
|
||||
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
|
@ -86,7 +92,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||
return;
|
||||
}
|
||||
|
||||
//add or update the database
|
||||
//add the phrase
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
if ($action == "add" && permission_exists('phrase_add')) {
|
||||
//add the phrase to the database
|
||||
|
|
@ -169,6 +175,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||
return;
|
||||
} //if ($action == "add")
|
||||
|
||||
//update the phrase
|
||||
if ($action == "update" && permission_exists('phrase_edit')) {
|
||||
//update the database with the new data
|
||||
$sql = "update v_phrases set ";
|
||||
|
|
@ -240,7 +247,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
|
||||
//pre-populate the form
|
||||
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
|
||||
|
|
@ -525,6 +532,32 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||
echo "</td>";
|
||||
echo "</tr>";
|
||||
|
||||
if (permission_exists('phrase_domain')) {
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-domain']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable'>\n";
|
||||
echo " <select name='domain_uuid' class='formfld'>\n";
|
||||
if (strlen($domain_uuid) == 0) {
|
||||
echo " <option value='' selected='selected'>".$text['label-global']."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value=''>".$text['label-global']."</option>\n";
|
||||
}
|
||||
foreach ($_SESSION['domains'] as $row) {
|
||||
if ($row['domain_uuid'] == $domain_uuid) {
|
||||
echo " <option value='".$row['domain_uuid']."' selected='selected'>".$row['domain_name']."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='".$row['domain_uuid']."'>".$row['domain_name']."</option>\n";
|
||||
}
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-enabled']."\n";
|
||||
|
|
|
|||
Loading…
Reference in New Issue