Music on Hold: Add ability (and permission) to edit Name. Add check for required fields (Name and Path).
This commit is contained in:
parent
8e8454ff19
commit
ef787dafbf
|
|
@ -51,6 +51,9 @@
|
|||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "admin";
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = "music_on_hold_name";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = "music_on_hold_domain";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||
$y++;
|
||||
|
|
|
|||
|
|
@ -101,6 +101,17 @@ $text['message-nofiles']['uk'] = "Файлів не знайдено";
|
|||
$text['message-nofiles']['de-at'] = "Es wurden keine Dateien gefunden.";
|
||||
$text['message-nofiles']['he'] = "לא נמצאו קבצים";
|
||||
|
||||
$text['message-missing_required_fields']['en-us'] = "Missing Required Fields";
|
||||
$text['message-missing_required_fields']['es-cl'] = "Missing Campos requeridos";
|
||||
$text['message-missing_required_fields']['pt-pt'] = "Faltando Campos obrigatórios";
|
||||
$text['message-missing_required_fields']['fr-fr'] = "Manquant Champs obligatoires";
|
||||
$text['message-missing_required_fields']['pt-br'] = "Faltando Campos obrigatórios";
|
||||
$text['message-missing_required_fields']['pl'] = "Brakujące pola wymagane";
|
||||
$text['message-missing_required_fields']['sv-se'] = "Saknas Obligatoriska fält";
|
||||
$text['message-missing_required_fields']['uk'] = "Відсутні поля обов'язкові для заповнення";
|
||||
$text['message-missing_required_fields']['de-at'] = "Fehlende Pflichtangaben ";
|
||||
$text['message-missing_required_fields']['he'] = "חסרים שדות חובה";
|
||||
|
||||
$text['message-event-socket']['en-us'] = "Connection to Event Socket failed.";
|
||||
$text['message-event-socket']['es-cl'] = "Conexión a socket fallida.";
|
||||
$text['message-event-socket']['pt-pt'] = "A Conexão ao Event Socket falhou.";
|
||||
|
|
|
|||
|
|
@ -56,45 +56,55 @@ else {
|
|||
|
||||
if (is_array($_POST) && sizeof($_POST) > 0) {
|
||||
//retrieve posted values
|
||||
$moh_uuid = check_str($_POST['uuid']);
|
||||
$moh_shuffle = check_str($_POST['shuffle']);
|
||||
$moh_channels = check_str($_POST['channels']);
|
||||
$moh_interval = check_str($_POST['interval']);
|
||||
$moh_chime_list = check_str($_POST['chime_list']);
|
||||
$moh_chime_freq = check_str($_POST['chime_freq']);
|
||||
$moh_chime_max = check_str($_POST['chime_max']);
|
||||
$moh_domain_uuid = check_str($_POST['domain_uuid']);
|
||||
$moh_path = check_str($_POST['path']);
|
||||
$moh = $_POST;
|
||||
|
||||
//update the moh record
|
||||
$sql = "update v_music_on_hold set ";
|
||||
if (permission_exists('music_on_hold_domain')) {
|
||||
$sql .= "domain_uuid = ".(($moh_domain_uuid != '') ? "'".$moh_domain_uuid."'" : 'null').", ";
|
||||
//check required fields
|
||||
if (permission_exists('music_on_hold_name') && $moh['name'] == '') { $missing_fields[] = $text['label-name']; }
|
||||
if (permission_exists('music_on_hold_path') && $moh['path'] == '') { $missing_fields[] = $text['label-path']; }
|
||||
if (is_array($missing_fields) && sizeof($missing_fields > 0)) {
|
||||
//set message
|
||||
$_SESSION["message_mood"] = 'negative';
|
||||
$_SESSION["message"] = $text['message-missing_required_fields'].': '.implode(', ', $missing_fields);
|
||||
}
|
||||
if (permission_exists('music_on_hold_path')) {
|
||||
$sql .= "music_on_hold_path = ".(($moh_path != '') ? "'".$moh_path."'" : '$${sounds_dir}/music').", ";
|
||||
}
|
||||
$sql .= "music_on_hold_shuffle = '".$moh_shuffle."', ";
|
||||
$sql .= "music_on_hold_channels = ".$moh_channels.", ";
|
||||
$sql .= "music_on_hold_interval = ".(($moh_interval != '') ? $moh_interval : '20').", ";
|
||||
$sql .= "music_on_hold_timer_name = 'soft', ";
|
||||
$sql .= "music_on_hold_chime_list = '".$moh_chime_list."', ";
|
||||
$sql .= "music_on_hold_chime_freq = ".(($moh_chime_freq != '') ? $moh_chime_freq : 'null').", ";
|
||||
$sql .= "music_on_hold_chime_max = ".(($moh_chime_max != '') ? $moh_chime_max : 'null')." ";
|
||||
$sql .= "where music_on_hold_uuid = '".$moh_uuid."' ";
|
||||
if (!permission_exists('music_on_hold_domain')) {
|
||||
$sql .= "and domain_uuid = '".$domain_uuid."' ";
|
||||
}
|
||||
//echo $sql."<br>"; exit;
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
else {
|
||||
//check strings
|
||||
foreach ($_POST as $field => $value) {
|
||||
$moh[$field] = check_str($value);
|
||||
}
|
||||
|
||||
//set message
|
||||
$_SESSION["message"] = $text['message-update'];
|
||||
//update the moh record
|
||||
$sql = "update v_music_on_hold set ";
|
||||
if (permission_exists('music_on_hold_domain')) {
|
||||
$sql .= "domain_uuid = ".(($moh['domain_uuid'] != '') ? "'".$moh['domain_uuid']."'" : 'null').", ";
|
||||
}
|
||||
if (permission_exists('music_on_hold_name')) {
|
||||
$sql .= "music_on_hold_name = '".$moh['name']."', ";
|
||||
}
|
||||
if (permission_exists('music_on_hold_path')) {
|
||||
$sql .= "music_on_hold_path = ".(($moh['path'] != '') ? "'".$moh['path']."'" : '$${sounds_dir}/music').", ";
|
||||
}
|
||||
$sql .= "music_on_hold_shuffle = '".$moh['shuffle']."', ";
|
||||
$sql .= "music_on_hold_channels = ".$moh['channels'].", ";
|
||||
$sql .= "music_on_hold_interval = ".(($moh['interval'] != '') ? $moh['interval'] : '20').", ";
|
||||
$sql .= "music_on_hold_timer_name = 'soft', ";
|
||||
$sql .= "music_on_hold_chime_list = '".$moh['chime_list']."', ";
|
||||
$sql .= "music_on_hold_chime_freq = ".(($moh['chime_freq'] != '') ? $moh['chime_freq'] : 'null').", ";
|
||||
$sql .= "music_on_hold_chime_max = ".(($moh['chime_max'] != '') ? $moh['chime_max'] : 'null')." ";
|
||||
$sql .= "where music_on_hold_uuid = '".$moh['uuid']."' ";
|
||||
if (!permission_exists('music_on_hold_domain')) {
|
||||
$sql .= "and domain_uuid = '".$domain_uuid."' ";
|
||||
}
|
||||
//echo $sql."<br>"; exit;
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
//redirect
|
||||
header("Location: music_on_hold.php");
|
||||
exit;
|
||||
//set message
|
||||
$_SESSION["message"] = $text['message-update'];
|
||||
|
||||
//redirect
|
||||
header("Location: music_on_hold.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
//show the header
|
||||
|
|
@ -146,6 +156,17 @@ if (is_array($_POST) && sizeof($_POST) > 0) {
|
|||
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
|
||||
if (permission_exists('music_on_hold_name')) {
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' width='30%'>\n";
|
||||
echo " ".$text['label-name']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left' width='70%'>\n";
|
||||
echo " <input class='formfld' type='text' name='name' value='".$moh['name']."'>\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' width='30%'>\n";
|
||||
echo " ".$text['label-shuffle']."\n";
|
||||
|
|
@ -317,7 +338,7 @@ if (is_array($_POST) && sizeof($_POST) > 0) {
|
|||
|
||||
if (permission_exists('music_on_hold_path')) {
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' width='30%'>\n";
|
||||
echo "<td class='vncellreq' width='30%'>\n";
|
||||
echo " ".$text['label-path']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left' width='70%'>\n";
|
||||
|
|
|
|||
Loading…
Reference in New Issue