mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
Display message for limits instead of hiding add and copy buttons (#7681)
* Display message for limits instead of hiding add and copy buttons * Update ivr_menus.php * Update gateways.php * Update extensions.php * Update devices.php * Update call_center_queues.php * Update app_languages.php * Update voicemail_greetings.php * Update users.php * Update voicemail_greetings.php * Update call_center_queues.php
This commit is contained in:
@@ -53,7 +53,7 @@
|
||||
$order = $_GET["order"] ?? '';
|
||||
|
||||
//set the back button url
|
||||
$_SESSION['back'][$_SERVER['PHP_SELF']] = !empty($_GET['back']) ? urldecode($_GET['back']) : $_SESSION['back'][$_SERVER['PHP_SELF']];
|
||||
$_SESSION['back'][$_SERVER['PHP_SELF']] = !empty($_GET['back']) ? urldecode($_GET['back']) : $_SESSION['back'][$_SERVER['PHP_SELF']] ?? '';
|
||||
|
||||
//define order by default
|
||||
if ($order_by == '') {
|
||||
@@ -158,6 +158,13 @@
|
||||
exit;
|
||||
}
|
||||
|
||||
//greeting limit
|
||||
if (!empty($_POST['limit_reached']) && $_POST['limit_reached'] == 'true'){
|
||||
message::add($text['message-maximum_voicemail_greetings'].' 9', 'negative');
|
||||
header('Location: voicemail_greetings.php?id='.urlencode($voicemail_id));
|
||||
exit;
|
||||
}
|
||||
|
||||
//upload the greeting
|
||||
if (!empty($_POST['a']) && $_POST['a'] == "upload" && permission_exists('voicemail_greeting_upload')
|
||||
&& $_POST['type'] == 'rec' && is_uploaded_file($_FILES['file']['tmp_name'])) {
|
||||
@@ -182,12 +189,12 @@
|
||||
|
||||
//find the next available greeting id starting at 1
|
||||
$greeting_id = 1;
|
||||
while (true) {
|
||||
for ($i = 1; $i <= 9; $i++) {
|
||||
$found_existing_file = false;
|
||||
|
||||
//check for wav, mp3, and ogg files with the current greeting id
|
||||
foreach ($allowed_extensions as $extension) {
|
||||
$potential_file_name = "greeting_{$greeting_id}.{$extension}";
|
||||
$potential_file_name = "greeting_{$i}.{$extension}";
|
||||
if (file_exists($greeting_dir . '/' . $potential_file_name)) {
|
||||
$found_existing_file = true;
|
||||
break;
|
||||
@@ -195,10 +202,10 @@
|
||||
}
|
||||
|
||||
if (!$found_existing_file) {
|
||||
//found an available greeting id
|
||||
$greeting_id = $i;
|
||||
break;
|
||||
}
|
||||
|
||||
$greeting_id++;
|
||||
}
|
||||
|
||||
//set the greeting file name
|
||||
@@ -363,24 +370,31 @@
|
||||
echo " <div class='actions'>\n";
|
||||
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$settings->get('theme', 'button_icon_back'),'id'=>'btn_back','link'=>$_SESSION['back'][$_SERVER['PHP_SELF']]]);
|
||||
$margin_left = false;
|
||||
if (permission_exists('voicemail_greeting_add') && is_array($greetings) && @sizeof($greetings) < 9 && $speech_enabled == 'true') {
|
||||
if (permission_exists('voicemail_greeting_add') && is_array($greetings) && $speech_enabled == 'true') {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$settings->get('theme', 'button_icon_add'),'id'=>'btn_add','style'=>'margin-left: 15px;','link'=>'voicemail_greeting_edit.php?voicemail_id='.urlencode($voicemail_id)]);
|
||||
$margin_left = true;
|
||||
}
|
||||
if (permission_exists('voicemail_greeting_upload') && is_array($greetings) && @sizeof($greetings) < 9) {
|
||||
echo "<form id='form_upload' class='inline' method='post' enctype='multipart/form-data'>\n";
|
||||
echo "<input name='a' type='hidden' value='upload'>\n";
|
||||
echo "<input type='hidden' name='id' value='".escape($voicemail_id)."'>\n";
|
||||
echo "<input type='hidden' name='type' value='rec'>\n";
|
||||
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
|
||||
echo " <form id='form_upload' class='inline' method='post' enctype='multipart/form-data'>\n";
|
||||
echo " <input name='a' type='hidden' value='upload'>\n";
|
||||
echo " <input type='hidden' name='id' value='".escape($voicemail_id)."'>\n";
|
||||
echo " <input type='hidden' name='type' value='rec'>\n";
|
||||
echo " <input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
|
||||
echo button::create(['type'=>'button','label'=>$text['button-upload'],'icon'=>$settings->get('theme', 'button_icon_add'),'id'=>'btn_upload','style'=>(!$margin_left ? 'margin-left: 15px;' : null),'onclick'=>"$(this).fadeOut(250, function(){ $('span#form_upload').fadeIn(250); document.getElementById('ulfile').click(); });"]);
|
||||
echo "<span id='form_upload' style='display: none;'>";
|
||||
echo " <span id='form_upload' style='display: none;'>";
|
||||
echo button::create(['label'=>$text['button-cancel'],'icon'=>$settings->get('theme', 'button_icon_cancel'),'type'=>'button','id'=>'btn_upload_cancel','style'=>'margin-left: 15px;','onclick'=>"$('span#form_upload').fadeOut(250, function(){ document.getElementById('form_upload').reset(); $('#btn_upload').fadeIn(250) });"]);
|
||||
echo "<input type='text' class='txt' style='width: 100px; cursor: pointer;' id='filename' placeholder='Select...' onclick=\"document.getElementById('ulfile').click(); this.blur();\" onfocus='this.blur();'>";
|
||||
echo "<input type='file' id='ulfile' name='file' style='display: none;' accept='.wav,.mp3,.ogg' onchange=\"document.getElementById('filename').value = this.files.item(0).name; check_file_type(this);\">";
|
||||
echo " <input type='text' class='txt' style='width: 100px; cursor: pointer;' id='filename' placeholder='Select...' onclick=\"document.getElementById('ulfile').click(); this.blur();\" onfocus='this.blur();'>";
|
||||
echo " <input type='file' id='ulfile' name='file' style='display: none;' accept='.wav,.mp3,.ogg' onchange=\"document.getElementById('filename').value = this.files.item(0).name; check_file_type(this);\">";
|
||||
echo button::create(['type'=>'submit','label'=>$text['button-upload'],'icon'=>$settings->get('theme', 'button_icon_upload')]);
|
||||
echo "</span>\n";
|
||||
echo "</form>";
|
||||
echo " </span>\n";
|
||||
echo " </form>\n";
|
||||
$margin_left = true;
|
||||
}
|
||||
else if (permission_exists('voicemail_greeting_upload') && is_array($greetings) && @sizeof($greetings) >= 9) {
|
||||
echo " <form class='inline' method='post'>\n";
|
||||
echo " <input type='hidden' name='limit_reached' value='true'>\n";
|
||||
echo button::create(['type'=>'submit','label'=>$text['button-upload'],'icon'=>$settings->get('theme', 'button_icon_add')]);
|
||||
echo " </form>\n";
|
||||
$margin_left = true;
|
||||
}
|
||||
if (permission_exists('voicemail_greeting_delete') && $greetings) {
|
||||
|
||||
Reference in New Issue
Block a user