Time Conditions: Change how preset destinations function (when a Preset is checked, the Alternate Destination is required and used, unless a Default Destination is selected, or a Destination is set on the individual Presets themselves. Interface also adjusts if Presets are NOT available.
This commit is contained in:
parent
8935ff7624
commit
61f0db8294
|
|
@ -70,10 +70,10 @@
|
|||
$text['description-template']['pt-pt'] = "Os templates oferecem uma lista condições temporais.";
|
||||
$text['description-template']['fr-fr'] = "Le modèle fourni une liste de présélection.";
|
||||
|
||||
$text['label-custom']['en-us'] = "Custom";
|
||||
$text['label-custom']['es-cl'] = "Costumbre";
|
||||
$text['label-custom']['pt-pt'] = "Personalizado";
|
||||
$text['label-custom']['fr-fr'] = "Coutume";
|
||||
$text['label-settings']['en-us'] = "Settings";
|
||||
$text['label-settings']['es-cl'] = "Ajustes";
|
||||
$text['label-settings']['pt-pt'] = "Definições";
|
||||
$text['label-settings']['fr-fr'] = "Paramètres";
|
||||
|
||||
$text['label-conditions']['en-us'] = "Conditions";
|
||||
$text['label-conditions']['es-cl'] = "Condición";
|
||||
|
|
@ -90,10 +90,10 @@
|
|||
$text['label-label']['pt-pt'] = "Etiqueta";
|
||||
$text['label-label']['fr-fr'] = "étiquette";
|
||||
|
||||
$text['description-conditions']['en-us'] = "Define custom conditions necessary to execute the destination selected above.";
|
||||
$text['description-conditions']['es-cl'] = "Definir las condiciones personalizados necesarios para ejecutar el destino seleccionado anteriormente.";
|
||||
$text['description-conditions']['pt-pt'] = "Definir condições personalizadas necessárias para executar o destino selecionado acima.";
|
||||
$text['description-conditions']['fr-fr'] = "Définir les conditions nécessaires pour exécuter la destination sélectionnée ci-dessus personnalisés.";
|
||||
$text['description-settings']['en-us'] = "Define custom conditions necessary to execute the destination selected above.";
|
||||
$text['description-settings']['es-cl'] = "Definir las condiciones personalizados necesarios para ejecutar el destino seleccionado anteriormente.";
|
||||
$text['description-settings']['pt-pt'] = "Definir condições personalizadas necessárias para executar o destino selecionado acima.";
|
||||
$text['description-settings']['fr-fr'] = "Définir les conditions nécessaires pour exécuter la destination sélectionnée ci-dessus personnalisés.";
|
||||
|
||||
$text['label-condition_parameter']['en-us'] = "Parameter";
|
||||
$text['label-condition_parameter']['es-cl'] = "Parámetro";
|
||||
|
|
@ -115,10 +115,15 @@
|
|||
$text['label-presets']['pt-pt'] = "Presets";
|
||||
$text['label-presets']['fr-fr'] = "Présélections";
|
||||
|
||||
$text['description-presets']['en-us'] = "Select pre-defined conditions, and the default destination for all checked. Click the preset name to further customize the conditions and/or destination for each.";
|
||||
$text['description-presets']['es-cl'] = "Seleccione condiciones predefinidas, y el destino predeterminado para todos marcada. Haga clic en el nombre del preset para personalizar aún más las condiciones y / o destino de cada uno.";
|
||||
$text['description-presets']['pt-pt'] = "Selecione as condições pré-definidas, e o destino padrão para todos marcada. Clique no nome da predefinição para personalizar ainda mais as condições e / ou destino para cada um.";
|
||||
$text['description-presets']['fr-fr'] = "Sélectionnez les conditions pré-définies, et la destination par défaut pour tous les bagages. Cliquez sur le nom de la présélection pour personnaliser davantage les conditions et / ou pour chaque destination.";
|
||||
$text['description-presets']['en-us'] = "Select from available presets. Click a preset name to further customize the conditions and/or destination of each.";
|
||||
$text['description-presets']['es-cl'] = "Choisissez parmi préréglages disponibles. Cliquez sur un nom prédéfini pour personnaliser davantage les conditions et/ou la destination de chacun.";
|
||||
$text['description-presets']['pt-pt'] = "Selecione a partir de predefinições disponíveis. Clique em um nome pré-definido para personalizar ainda mais as condições e/ou destino de cada um.";
|
||||
$text['description-presets']['fr-fr'] = "Choisissez parmi préréglages disponibles. Cliquez sur un nom prédéfini pour personnaliser davantage les conditions et/ou la destination de chacun.";
|
||||
|
||||
$text['description-presets_advanced']['en-us'] = "Select a Default Destination above to be <i>applied</i> to each preset checked (without a destination already defined).";
|
||||
$text['description-presets_advanced']['es-cl'] = "Seleccione un destino predeterminado por encima de ser <i>apliqué</i> para cada preset facturado (sin destino ya definido).";
|
||||
$text['description-presets_advanced']['pt-pt'] = "Selecione um destino padrão acima para ser <i>aplicado</i> para cada predefinição marcada (sem um destino já definido).";
|
||||
$text['description-presets_advanced']['fr-fr'] = "Sélectionnez une destination par défaut ci-dessus pour être <i>appliqué</i> pour chaque preset vérifié (sans destination déjà défini).";
|
||||
|
||||
$text['label-preset_new_years_day']['en-us'] = "New Year's Day";
|
||||
$text['label-preset_new_years_day']['es-cl'] = "Año Nuevo";
|
||||
|
|
@ -255,6 +260,11 @@
|
|||
$text['label-select_destination']['pt-pt'] = "Selecione um Destino";
|
||||
$text['label-select_destination']['fr-fr'] = "Choisissez une Destination";
|
||||
|
||||
$text['label-select_default_destination']['en-us'] = "Select Default Destination";
|
||||
$text['label-select_default_destination']['es-cl'] = "Seleccionar Destino Predeterminado";
|
||||
$text['label-select_default_destination']['pt-pt'] = "Selecione Padrão Destino";
|
||||
$text['label-select_default_destination']['fr-fr'] = "Sélectionnez Par défaut Destinations";
|
||||
|
||||
$text['label-alternate-destination']['en-us'] = "Alternate Destination";
|
||||
$text['label-alternate-destination']['es-cl'] = "Destino Alternativo";
|
||||
$text['label-alternate-destination']['pt-pt'] = "Destino Alternativo";
|
||||
|
|
@ -300,6 +310,11 @@
|
|||
$text['message-update']['pt-pt'] = "Actualização Efectuada";
|
||||
$text['message-update']['fr-fr'] = "Mis à jour";
|
||||
|
||||
$text['message-alternate_destination_required']['en-us'] = "Alternate Destination Required";
|
||||
$text['message-alternate_destination_required']['es-cl'] = "Destino Alternativo Requerido";
|
||||
$text['message-alternate_destination_required']['pt-pt'] = "Destino Alternativo Obrigatório";
|
||||
$text['message-alternate_destination_required']['fr-fr'] = "Autre Destination Requise";
|
||||
|
||||
$text['message-add']['en-us'] = "Add Complete";
|
||||
$text['message-add']['es-cl'] = "Agregar Completado";
|
||||
$text['message-add']['fr-fr'] = "Ajouté";
|
||||
|
|
@ -313,5 +328,5 @@
|
|||
$text['message-delete']['en-us'] = "Delete Completed";
|
||||
$text['message-delete']['es-cl'] = "Eliminar Completado";
|
||||
$text['message-delete']['pt-pt'] = "Apagar Concluído";
|
||||
$text['message-delete']['fr-fr'] = "Supprimer Terminé";
|
||||
$text['message-delete']['fr-fr'] = "Supprimer Terminé"
|
||||
?>
|
||||
|
|
@ -204,9 +204,12 @@ require_once "resources/header.php";
|
|||
}
|
||||
}
|
||||
|
||||
//remove groups where an action (or default_preset_action, if a preset group) isn't defined
|
||||
//remove groups where an action (or default_preset_action - if a preset group - or dialplan_anti_action) isn't defined
|
||||
foreach ($_REQUEST['variable'] as $group_id => $meh) {
|
||||
if ( (in_array($group_id, $_REQUEST['preset']) && $_REQUEST['dialplan_action'][$group_id] == '' && $_REQUEST['default_preset_action'] == '') || (!in_array($group_id, $_REQUEST['preset']) && $_REQUEST['dialplan_action'][$group_id] == '') ) {
|
||||
if (
|
||||
(in_array($group_id, $_REQUEST['preset']) && $_REQUEST['dialplan_action'][$group_id] == '' && $_REQUEST['default_preset_action'] == '' && $_REQUEST['dialplan_anti_action'] == '') ||
|
||||
(!in_array($group_id, $_REQUEST['preset']) && $_REQUEST['dialplan_action'][$group_id] == '')
|
||||
) {
|
||||
unset($_REQUEST['variable'][$group_id]);
|
||||
unset($_REQUEST['value'][$group_id]);
|
||||
unset($_REQUEST['dialplan_action'][$group_id]);
|
||||
|
|
@ -303,7 +306,12 @@ require_once "resources/header.php";
|
|||
$dialplan_action = check_str($_REQUEST["dialplan_action"][$group_id]);
|
||||
if ($dialplan_action == '') {
|
||||
if ($is_preset) {
|
||||
$dialplan_action = check_str($_REQUEST['default_preset_action']);
|
||||
if (check_str($_REQUEST['default_preset_action']) != '') {
|
||||
$dialplan_action = check_str($_REQUEST['default_preset_action']);
|
||||
}
|
||||
else if (check_str($_REQUEST['dialplan_anti_action']) != '') {
|
||||
$dialplan_action = check_str($_REQUEST['dialplan_anti_action']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -490,19 +498,21 @@ require_once "resources/header.php";
|
|||
}
|
||||
}
|
||||
|
||||
//loop through available presets
|
||||
foreach ($available_presets as $preset_number => $preset) {
|
||||
foreach ($preset as $preset_name => $preset_variables) {
|
||||
//loop through each condition group
|
||||
foreach ($current_conditions as $group_id => $condition_variables) {
|
||||
$matches = 0;
|
||||
foreach ($condition_variables as $condition_variable_name => $condition_variable_value) {
|
||||
//count matching variable values
|
||||
if ($preset_variables[$condition_variable_name] == $condition_variable_value) { $matches++; }
|
||||
}
|
||||
//if all preset variables found, then condition is a preset
|
||||
if ($matches == sizeof($preset_variables)) {
|
||||
$current_presets[$preset_number] = $group_id;
|
||||
//loop through available presets (if any)
|
||||
if (isset($available_presets) && sizeof($available_presets) > 0) {
|
||||
foreach ($available_presets as $preset_number => $preset) {
|
||||
foreach ($preset as $preset_name => $preset_variables) {
|
||||
//loop through each condition group
|
||||
foreach ($current_conditions as $group_id => $condition_variables) {
|
||||
$matches = 0;
|
||||
foreach ($condition_variables as $condition_variable_name => $condition_variable_value) {
|
||||
//count matching variable values
|
||||
if ($preset_variables[$condition_variable_name] == $condition_variable_value) { $matches++; }
|
||||
}
|
||||
//if all preset variables found, then condition is a preset
|
||||
if ($matches == sizeof($preset_variables)) {
|
||||
$current_presets[$preset_number] = $group_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -712,10 +722,50 @@ require_once "resources/header.php";
|
|||
obj.parentNode.removeChild(obj);
|
||||
}
|
||||
|
||||
function alternate_destination_required() {
|
||||
require_default_or_alt_destination = false;
|
||||
<?php foreach ($available_presets as $preset_number => $meh) { ?>
|
||||
if (document.getElementById('preset_<?php echo $preset_number; ?>').checked) {
|
||||
preset_group_id = document.getElementById('preset_<?php echo $preset_number; ?>').value;
|
||||
preset_destination = $('#dialplan_action_' + preset_group_id).val();
|
||||
if (preset_destination == '') { require_default_or_alt_destination = true; }
|
||||
}
|
||||
<?php } ?>
|
||||
|
||||
if (require_default_or_alt_destination && $('#default_preset_action').val() == '') {
|
||||
$('#td_alt_dest').attr('class', 'vncellreq');
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
$('#td_alt_dest').attr('class', 'vncell');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function check_submit() {
|
||||
<?php
|
||||
// output pre-submit preset check, if they exist
|
||||
if (isset($available_presets) && sizeof($available_presets) > 0) {
|
||||
?>
|
||||
if (alternate_destination_required() && $('#dialplan_anti_action').val() == '') {
|
||||
display_message("<?php echo $text['message-alternate_destination_required']; ?>", 'negative', 3000);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
<?php
|
||||
}
|
||||
else {
|
||||
echo "return true;";
|
||||
}
|
||||
?>
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<?php
|
||||
echo "<form method='post' name='frm' action=''>\n";
|
||||
echo "<form method='post' name='frm' action='' onsubmit=\"return check_submit();\">\n";
|
||||
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
|
|
@ -765,7 +815,7 @@ function add_custom_condition($group_id, $dialplan_action = '') {
|
|||
global $text, $v_link_label_add;
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
|
||||
echo " ".$text['label-custom'];
|
||||
echo " ".$text['label-settings'];
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <table border='0' cellpadding='2' cellspacing='0' style='margin: -2px;'>\n";
|
||||
|
|
@ -785,7 +835,7 @@ function add_custom_condition($group_id, $dialplan_action = '') {
|
|||
echo " </tr>";
|
||||
echo " </table>";
|
||||
echo " <br />";
|
||||
echo " ".$text['description-conditions'];
|
||||
echo " ".$text['description-settings'];
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
|
|
@ -823,7 +873,7 @@ if ($action == 'update') {
|
|||
}
|
||||
}
|
||||
|
||||
// add first/new set of custom condition fields
|
||||
//add first/new set of custom condition fields
|
||||
if ($action != 'update' || ($action == 'update' && $largest_group_id == 0)) {
|
||||
$group_id = 500;
|
||||
}
|
||||
|
|
@ -838,107 +888,107 @@ if ($action == 'update') {
|
|||
}
|
||||
echo "</script>";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
|
||||
echo " ".$text['label-presets']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
//if presets exist, show the preset section
|
||||
if (isset($available_presets) && sizeof($available_presets) > 0) {
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
|
||||
echo " ".$text['label-presets']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
|
||||
foreach ($available_presets as $preset_number => $preset) {
|
||||
foreach ($preset as $preset_name => $preset_variables) {
|
||||
$checked = (is_array($current_presets) && $current_presets[$preset_number] != '') ? "checked='checked'" : null;
|
||||
if ($checked) {
|
||||
$preset_group_id = $current_presets[$preset_number];
|
||||
foreach ($available_presets as $preset_number => $preset) {
|
||||
foreach ($preset as $preset_name => $preset_variables) {
|
||||
$checked = (is_array($current_presets) && $current_presets[$preset_number] != '') ? "checked='checked'" : null;
|
||||
$preset_group_id = ($checked) ? $current_presets[$preset_number] : $preset_group_id = $preset_number * 5 + 100;
|
||||
echo "<input type='checkbox' name='preset[".$preset_number."]' id='preset_".$preset_number."' value='".$preset_group_id."' onclick=\"alternate_destination_required();\" ".$checked."> <a href='javascript:void(0);' onclick=\"$('#preset_fields_".$preset_group_id."').slideToggle(400);\">".$text['label-preset_'.$preset_name]."</a><br>\n";
|
||||
echo "<div id='preset_fields_".$preset_group_id."' style='display: none; margin: 4px 0px 0px 20px;'>";
|
||||
echo " <table border='0' cellpadding='2' cellspacing='0' style='margin: -2px; margin-bottom: 10px;'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td class='vtable' style='width: 108px;'>".$text['label-condition']."</td>\n";
|
||||
echo " <td class='vtable' style='width: 125px;'>".$text['label-condition_value']."</td>\n";
|
||||
echo " <td class='vtable' style='width: 114px;'>".$text['label-condition_range']."</td>\n";
|
||||
echo " <td style='text-align: right;'><a href='javascript:void(0);' onclick=\"add_condition(".$preset_group_id.",'preset');\">".$v_link_label_add."</a></td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " <tr>";
|
||||
echo " <td colspan='4' style='white-space: nowrap;' id='group_".$preset_group_id."'></td>";
|
||||
echo " </tr>";
|
||||
echo " <tr>";
|
||||
echo " <td colspan='4' style='padding-top: 10px;'>";
|
||||
switch_select_destination("dialplan", $text['label-select_destination'], "dialplan_action[".$preset_group_id."]", $dialplan_action, 'width: 300px;', '', 'alternate_destination_required();');
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo " </table>";
|
||||
echo " <br />";
|
||||
echo "</div>";
|
||||
if ($action == 'update' && is_array($current_presets) && $current_presets[$preset_number] != '') {
|
||||
//add (potentially customized) preset conditions and populate
|
||||
foreach ($current_conditions[$preset_group_id] as $cond_var => $cond_val) {
|
||||
$range_indicator = ($cond_var == 'date-time') ? '~' : '-';
|
||||
$tmp = explode($range_indicator, $cond_val);
|
||||
$cond_val_start = $tmp[0];
|
||||
$cond_val_stop = $tmp[1];
|
||||
unset($tmp);
|
||||
echo "<script>\n";
|
||||
echo " condition_id = add_condition(".$preset_group_id.",'preset');\n";
|
||||
echo " $('#variable_".$preset_group_id."_' + condition_id + ' option[value=\"".$cond_var."\"]').prop('selected', true);\n";
|
||||
if ($cond_var == 'date-time') {
|
||||
echo " change_to_input(document.getElementById('value_".$preset_group_id."_' + condition_id + '_start'));\n";
|
||||
echo " change_to_input(document.getElementById('value_".$preset_group_id."_' + condition_id + '_stop'));\n";
|
||||
echo " $('#value_".$preset_group_id."_' + condition_id + '_start').val('".$cond_val_start."');\n";
|
||||
echo " $('#value_".$preset_group_id."_' + condition_id + '_stop').val('".$cond_val_stop."');\n";
|
||||
}
|
||||
else {
|
||||
echo " load_value_fields(".$preset_group_id.", condition_id, '".$cond_var."');\n";
|
||||
echo " $('#value_".$preset_group_id."_' + condition_id + '_start option[value=\"".$cond_val_start."\"]').prop('selected', true);\n";
|
||||
echo " $('#value_".$preset_group_id."_' + condition_id + '_stop option[value=\"".$cond_val_stop."\"]').prop('selected', true);\n";
|
||||
}
|
||||
echo " $('#dialplan_action_".$preset_group_id." option[value=\"".$dialplan_actions[$preset_group_id]."\"]').prop('selected', true);\n\n";
|
||||
echo "</script>";
|
||||
}
|
||||
}
|
||||
else {
|
||||
//add default preset conditions and populate
|
||||
foreach ($preset_variables as $preset_variable => $preset_value) {
|
||||
$range_indicator = ($preset_variable == 'date-time') ? '~' : '-';
|
||||
$tmp = explode($range_indicator, $preset_value);
|
||||
$preset_value_start = $tmp[0];
|
||||
$preset_value_stop = $tmp[1];
|
||||
unset($tmp);
|
||||
echo "<script>\n";
|
||||
echo " condition_id = add_condition(".$preset_group_id.",'preset');\n";
|
||||
echo " $('#variable_".$preset_group_id."_' + condition_id + ' option[value=\"".$preset_variable."\"]').prop('selected', true);\n";
|
||||
echo " load_value_fields(".$preset_group_id.", condition_id, '".$preset_variable."');\n";
|
||||
echo " $('#value_".$preset_group_id."_' + condition_id + '_start option[value=\"".$preset_value_start."\"]').prop('selected', true);\n";
|
||||
echo " $('#value_".$preset_group_id."_' + condition_id + '_stop option[value=\"".$preset_value_stop."\"]').prop('selected', true);\n";
|
||||
echo "</script>\n\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$preset_group_id = $preset_number * 5 + 100;
|
||||
}
|
||||
echo "<input type='checkbox' name='preset[".$preset_number."]' id='preset_".$preset_number."' value='".$preset_group_id."' ".$checked."> <a href='javascript:void(0);' onclick=\"$('#preset_fields_".$preset_group_id."').slideToggle(400);\">".$text['label-preset_'.$preset_name]."</a><br>\n";
|
||||
echo "<div id='preset_fields_".$preset_group_id."' style='display: none; margin: 4px 0px 0px 20px;'>";
|
||||
echo " <table border='0' cellpadding='2' cellspacing='0' style='margin: -2px; margin-bottom: 10px;'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td class='vtable' style='width: 108px;'>".$text['label-condition']."</td>\n";
|
||||
echo " <td class='vtable' style='width: 125px;'>".$text['label-condition_value']."</td>\n";
|
||||
echo " <td class='vtable' style='width: 114px;'>".$text['label-condition_range']."</td>\n";
|
||||
echo " <td style='text-align: right;'><a href='javascript:void(0);' onclick=\"add_condition(".$preset_group_id.",'preset');\">".$v_link_label_add."</a></td>\n";
|
||||
echo " </tr>\n";
|
||||
|
||||
echo " <br />\n";
|
||||
echo " <table border='0' cellpadding='2' cellspacing='0' style='margin: -2px;'>\n";
|
||||
echo " <tr>";
|
||||
echo " <td colspan='4' style='white-space: nowrap;' id='group_".$preset_group_id."'></td>";
|
||||
echo " </tr>";
|
||||
echo " <tr>";
|
||||
echo " <td colspan='4' style='padding-top: 10px;'>";
|
||||
switch_select_destination("dialplan", $text['label-select_destination'], "dialplan_action[".$preset_group_id."]", $dialplan_action, 'width: 300px;', '');
|
||||
echo " <td>";
|
||||
echo " <input type='button' class='btn' name='' alt='".$text['button-advanced']."' onclick=\"$(this).fadeOut(400, function() { $('#default_preset_destination').fadeIn(400); document.getElementById('default_preset_destination_description').innerHTML += ' ".$text['description-presets_advanced']."'; });\" value='".$text['button-advanced']."'>\n";
|
||||
echo " <span id='default_preset_destination' style=' display: none;'>";
|
||||
switch_select_destination("dialplan", $text['label-select_default_destination'], "default_preset_action", $dialplan_action, 'width: 300px;', '', 'alternate_destination_required();');
|
||||
echo " </span>";
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo " </table>";
|
||||
echo " <br />";
|
||||
echo "</div>";
|
||||
if ($action == 'update' && is_array($current_presets) && $current_presets[$preset_number] != '') {
|
||||
//add (potentially customized) preset conditions and populate
|
||||
foreach ($current_conditions[$preset_group_id] as $cond_var => $cond_val) {
|
||||
$range_indicator = ($cond_var == 'date-time') ? '~' : '-';
|
||||
$tmp = explode($range_indicator, $cond_val);
|
||||
$cond_val_start = $tmp[0];
|
||||
$cond_val_stop = $tmp[1];
|
||||
unset($tmp);
|
||||
echo "<script>\n";
|
||||
echo " condition_id = add_condition(".$preset_group_id.",'preset');\n";
|
||||
echo " $('#variable_".$preset_group_id."_' + condition_id + ' option[value=\"".$cond_var."\"]').prop('selected', true);\n";
|
||||
if ($cond_var == 'date-time') {
|
||||
echo " change_to_input(document.getElementById('value_".$preset_group_id."_' + condition_id + '_start'));\n";
|
||||
echo " change_to_input(document.getElementById('value_".$preset_group_id."_' + condition_id + '_stop'));\n";
|
||||
echo " $('#value_".$preset_group_id."_' + condition_id + '_start').val('".$cond_val_start."');\n";
|
||||
echo " $('#value_".$preset_group_id."_' + condition_id + '_stop').val('".$cond_val_stop."');\n";
|
||||
}
|
||||
else {
|
||||
echo " load_value_fields(".$preset_group_id.", condition_id, '".$cond_var."');\n";
|
||||
echo " $('#value_".$preset_group_id."_' + condition_id + '_start option[value=\"".$cond_val_start."\"]').prop('selected', true);\n";
|
||||
echo " $('#value_".$preset_group_id."_' + condition_id + '_stop option[value=\"".$cond_val_stop."\"]').prop('selected', true);\n";
|
||||
}
|
||||
echo " $('#dialplan_action_".$preset_group_id." option[value=\"".$dialplan_actions[$preset_group_id]."\"]').prop('selected', true);\n\n";
|
||||
echo "</script>";
|
||||
}
|
||||
}
|
||||
else {
|
||||
//add default preset conditions and populate
|
||||
foreach ($preset_variables as $preset_variable => $preset_value) {
|
||||
$range_indicator = ($preset_variable == 'date-time') ? '~' : '-';
|
||||
$tmp = explode($range_indicator, $preset_value);
|
||||
$preset_value_start = $tmp[0];
|
||||
$preset_value_stop = $tmp[1];
|
||||
unset($tmp);
|
||||
echo "<script>\n";
|
||||
echo " condition_id = add_condition(".$preset_group_id.",'preset');\n";
|
||||
echo " $('#variable_".$preset_group_id."_' + condition_id + ' option[value=\"".$preset_variable."\"]').prop('selected', true);\n";
|
||||
echo " load_value_fields(".$preset_group_id.", condition_id, '".$preset_variable."');\n";
|
||||
echo " $('#value_".$preset_group_id."_' + condition_id + '_start option[value=\"".$preset_value_start."\"]').prop('selected', true);\n";
|
||||
echo " $('#value_".$preset_group_id."_' + condition_id + '_stop option[value=\"".$preset_value_stop."\"]').prop('selected', true);\n";
|
||||
echo "</script>\n\n";
|
||||
}
|
||||
}
|
||||
echo " <span id='default_preset_destination_description'>".$text['description-presets']."</span><br />\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
}
|
||||
|
||||
echo " <br />\n";
|
||||
echo " <table border='0' cellpadding='2' cellspacing='0' style='margin: -2px;'>\n";
|
||||
echo " <tr>";
|
||||
echo " <td>";
|
||||
switch_select_destination("dialplan", $text['label-select_destination'], "default_preset_action", $dialplan_action, 'width: 300px;', '');
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo " </table>";
|
||||
echo " <br />";
|
||||
echo " ".$text['description-presets']."<br />\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
|
||||
echo "<td id='td_alt_dest' class='vncell' valign='top' align='left' nowrap>\n";
|
||||
echo " ".$text['label-alternate-destination']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
switch_select_destination("dialplan", ' ', "dialplan_anti_action", $dialplan_anti_action, 'width: 300px;', '');
|
||||
echo " <div id='desc_anti_action_data_1'></div>\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
|
|
|
|||
|
|
@ -392,7 +392,7 @@ function ListFiles($dir) {
|
|||
}
|
||||
}
|
||||
|
||||
function switch_select_destination($select_type, $select_label, $select_name, $select_value, $select_style, $action='') {
|
||||
function switch_select_destination($select_type, $select_label, $select_name, $select_value, $select_style, $action='', $onchange='') {
|
||||
//select_type can be ivr, dialplan, call_center_contact or bridge
|
||||
global $text, $config, $db, $domain_uuid;
|
||||
|
||||
|
|
@ -411,6 +411,10 @@ function switch_select_destination($select_type, $select_label, $select_name, $s
|
|||
echo " tb.className='formfld';\n";
|
||||
echo " tb.setAttribute('id', '".$select_id."');\n";
|
||||
echo " tb.setAttribute('style', '".$select_style."');\n";
|
||||
if ($onchange != '') {
|
||||
echo " tb.setAttribute('onchange', \"".$onchange."\");\n";
|
||||
echo " tb.setAttribute('onkeyup', \"".$onchange."\");\n";
|
||||
}
|
||||
echo " tb.value=obj.options[obj.selectedIndex].value;\n";
|
||||
echo " document.getElementById('btn_select_to_input_".$select_id."').style.visibility = 'hidden';\n";
|
||||
echo " tbb=document.createElement('INPUT');\n";
|
||||
|
|
@ -431,6 +435,9 @@ function switch_select_destination($select_type, $select_label, $select_name, $s
|
|||
echo " obj[0].parentNode.removeChild(obj[1]);\n";
|
||||
echo " obj[0].parentNode.removeChild(obj[2]);\n";
|
||||
echo " document.getElementById('btn_select_to_input_".$select_id."').style.visibility = 'visible';\n";
|
||||
if ($onchange != '') {
|
||||
echo " ".$onchange.";\n";
|
||||
}
|
||||
echo "}\n";
|
||||
echo "</script>\n";
|
||||
echo "\n";
|
||||
|
|
@ -439,21 +446,19 @@ function switch_select_destination($select_type, $select_label, $select_name, $s
|
|||
//default selection found to false
|
||||
$selection_found = false;
|
||||
|
||||
echo " <select name='".$select_name."' id='".$select_id."' class='formfld' style='".$select_style."'>\n";
|
||||
echo " <select name='".$select_name."' id='".$select_id."' class='formfld' style='".$select_style."' onchange=\"".$onchange."\">\n";
|
||||
|
||||
//display a default select label (specified explicitly or from the language file) if no selected value is passed in
|
||||
if ($select_value == '') {
|
||||
if ($select_label != '') {
|
||||
$options[] = "<option value=''>".$select_label."</option>";
|
||||
$options[] = "<option value='' disabled='disabled'></option>";
|
||||
}
|
||||
else if ($select_label == '' && $text['label-select_destination'] != '') {
|
||||
$options[] = "<option value=''>".$text['label-select_destination']."</option>";
|
||||
$options[] = "<option value='' disabled='disabled'></option>";
|
||||
}
|
||||
else {
|
||||
$options[] = "<option value=''></option>";
|
||||
}
|
||||
if ($select_value == '' && $select_label != '' && $select_label != ' ') {
|
||||
$options[] = "<option value=''>".$select_label."</option>";
|
||||
$options[] = "<option value='' disabled='disabled'></option>";
|
||||
}
|
||||
else if ($select_value == '' && $select_label == '' && $text['label-select_destination'] != '') {
|
||||
$options[] = "<option value=''>".$text['label-select_destination']."</option>";
|
||||
$options[] = "<option value='' disabled='disabled'></option>";
|
||||
}
|
||||
else {
|
||||
$options[] = "<option value=''></option>";
|
||||
}
|
||||
|
||||
//call center queues
|
||||
|
|
|
|||
Loading…
Reference in New Issue