IVR Menu: Implement Enabled toggle control on Options.
This commit is contained in:
@@ -478,6 +478,13 @@
|
||||
$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'] = "ivr_menu_option_enabled";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "boolean";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['toggle'] = ['true','false'];
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "insert_date";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'timestamptz';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'date';
|
||||
|
||||
@@ -83,6 +83,14 @@ if ($domains_processed == 1) {
|
||||
$ivr_menus = $database->select($sql, null, 'all');
|
||||
unset($sql);
|
||||
|
||||
//enable existing ivr menu options by default
|
||||
$sql = "update v_ivr_menu_options ";
|
||||
$sql .= "set ivr_menu_option_enabled = true ";
|
||||
$sql .= "where ivr_menu_option_enabled is null; ";
|
||||
$database = new database;
|
||||
$database->execute($sql, null);
|
||||
unset($sql);
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -326,6 +326,7 @@
|
||||
}
|
||||
$array['ivr_menus'][0]['ivr_menu_options'][$y]["ivr_menu_option_order"] = $row["ivr_menu_option_order"];
|
||||
$array['ivr_menus'][0]['ivr_menu_options'][$y]["ivr_menu_option_description"] = $row["ivr_menu_option_description"];
|
||||
$array['ivr_menus'][0]["ivr_menu_options"][$y]["ivr_menu_option_enabled"] = $row['ivr_menu_option_enabled'] ?: 'false';
|
||||
$y++;
|
||||
}
|
||||
}
|
||||
@@ -540,6 +541,7 @@
|
||||
$ivr_menu_options[$id]['ivr_menu_option_param'] = '';
|
||||
$ivr_menu_options[$id]['ivr_menu_option_order'] = '';
|
||||
$ivr_menu_options[$id]['ivr_menu_option_description'] = '';
|
||||
$ivr_menu_options[$id]['ivr_menu_option_enabled'] = '';
|
||||
$id++;
|
||||
}
|
||||
|
||||
@@ -1031,6 +1033,7 @@
|
||||
echo " <td class='vtable'>".$text['label-destination']."</td>\n";
|
||||
echo " <td class='vtable'>".$text['label-order']."</td>\n";
|
||||
echo " <td class='vtable'>".$text['label-description']."</td>\n";
|
||||
echo " <td class='vtable'>".$text['label-enabled']."</td>\n";
|
||||
if ($show_option_delete && permission_exists('ivr_menu_option_delete')) {
|
||||
echo " <td class='vtable edit_delete_checkbox_all' onmouseover=\"swap_display('delete_label_options', 'delete_toggle_options');\" onmouseout=\"swap_display('delete_label_options', 'delete_toggle_options');\">\n";
|
||||
echo " <span id='delete_label_options'>".$text['label-delete']."</span>\n";
|
||||
@@ -1048,7 +1051,15 @@
|
||||
}
|
||||
|
||||
echo "<td class='formfld' align='center'>\n";
|
||||
echo " <input class='formfld' style='width: 50px; text-align: center;' type='text' name='ivr_menu_options[".$x."][ivr_menu_option_digits]' maxlength='255' value='".escape($field['ivr_menu_option_digits'])."'>\n";
|
||||
if (!is_uuid($field['ivr_menu_option_uuid'])) { // new record
|
||||
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
|
||||
$onkeyup = "onkeyup=\"document.getElementById('ivr_menu_options_".$x."_ivr_menu_option_enabled').checked = (this.value != '' ? true : false);\""; // switch
|
||||
}
|
||||
else {
|
||||
$onkeyup = "onkeyup=\"document.getElementById('ivr_menu_options_".$x."_ivr_menu_option_enabled').value = (this.value != '' ? true : false);\""; // select
|
||||
}
|
||||
}
|
||||
echo " <input class='formfld' style='width: 50px; text-align: center;' type='text' name='ivr_menu_options[".$x."][ivr_menu_option_digits]' maxlength='255' value='".escape($field['ivr_menu_option_digits'])."' ".$onkeyup.">\n";
|
||||
echo "</td>\n";
|
||||
|
||||
echo "<td class='formfld' align='left' nowrap='nowrap'>\n";
|
||||
@@ -1081,7 +1092,22 @@
|
||||
echo "<td class='formfld' align='left'>\n";
|
||||
echo " <input class='formfld' style='width:100px' type='text' name='ivr_menu_options[".$x."][ivr_menu_option_description]' maxlength='255' value=\"".escape($field['ivr_menu_option_description'])."\">\n";
|
||||
echo "</td>\n";
|
||||
|
||||
echo "<td class='formfld'>\n";
|
||||
// switch
|
||||
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
|
||||
echo " <label class='switch'>\n";
|
||||
echo " <input type='checkbox' id='ivr_menu_options_".$x."_ivr_menu_option_enabled' name='ivr_menu_options[".$x."][ivr_menu_option_enabled]' value='true' ".($field['ivr_menu_option_enabled'] == 'true' ? "checked='checked'" : null).">\n";
|
||||
echo " <span class='slider'></span>\n";
|
||||
echo " </label>\n";
|
||||
}
|
||||
// select
|
||||
else {
|
||||
echo " <select class='formfld' id='ivr_menu_options_".$x."_ivr_menu_option_enabled' name='ivr_menu_options[".$x."][ivr_menu_option_enabled]'>\n";
|
||||
echo " <option value='false'>".$text['option-false']."</option>\n";
|
||||
echo " <option value='true' ".($field['ivr_menu_option_enabled'] == 'true' ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
|
||||
echo " </select>\n";
|
||||
}
|
||||
echo "</td>\n";
|
||||
if ($show_option_delete && permission_exists('ivr_menu_option_delete')) {
|
||||
if (is_uuid($field['ivr_menu_option_uuid'])) {
|
||||
echo "<td class='vtable' style='text-align: center; padding-bottom: 3px;'>";
|
||||
|
||||
Reference in New Issue
Block a user