Exemplo n.º 1
0
function voicemail_draw_vmxgui($extdisplay, $disable)
{
    global $display;
    $vmxobj = new vmxObject($extdisplay);
    $dval = $vmxobj->isEnabled() ? '' : 'disabled="true"';
    $vmx_unavail_enabled_value = $vmxobj->getState("unavail") == "enabled" ? "checked" : "";
    $vmx_unavail_enabled_text_box_options = $dval;
    $vmx_busy_enabled_value = $vmxobj->getState("busy") == "enabled" ? "checked" : "";
    $vmx_busy_enabled_text_box_options = $dval;
    $vmx_play_instructions = $vmxobj->getVmPlay() ? "checked" : "";
    $vmx_play_instructions_text_box_options = $dval;
    $follow_me_disabled = !$vmxobj->hasFollowMe();
    if (!$follow_me_disabled) {
        $vmx_option_1_system_default_text_box_options = $dval;
        if ($vmxobj->isFollowMe()) {
            $vmx_option_1_number_text_box_options = 'disabled="true"';
            $vmx_option_1_number = '';
            $vmx_option_1_system_default = 'checked';
        } else {
            $vmx_option_1_number_text_box_options = $dval;
            $vmx_option_1_number = $vmxobj->getMenuOpt(1);
            $vmx_option_1_system_default = '';
        }
    } else {
        $vmx_option_1_number_text_box_options = $dval;
        $vmx_option_1_number = $vmxobj->getMenuOpt(1);
    }
    $vmx_option_0_system_default_text_box_options = $disable ? 'disabled="true"' : '';
    $vmx_option_0_number = $vmxobj->getMenuOpt(0);
    if ($vmx_option_0_number == "") {
        $vmx_option_0_number_text_box_options = 'disabled="true"';
        $vmx_option_0_system_default = 'checked';
    } else {
        $vmx_option_0_number_text_box_options = $disable ? 'disabled="true"' : '';
        $vmx_option_0_system_default = '';
    }
    $vmx_option_2_number_text_box_options = $dval;
    $vmx_option_2_number = $vmxobj->getMenuOpt(2);
    $tabindex = guielement::gettabindex();
    $tabindex_text = "tabindex='{$tabindex}'";
    $set_vmx_text = "\n\t\t\t<tr>\n\t\t\t\t<td><a href='#' class='info'>" . _("Use When:") . "<span>" . _("Menu options below are available during your personal voicemail greeting playback. <br/><br/>Check both to use at all times.") . "<br></span></a></td> <td>\n\t\t\t\t\t<input {$tabindex_text} {$vmx_unavail_enabled_text_box_options} {$vmx_unavail_enabled_value} type=checkbox name='vmx_unavail_enabled' id='vmx_unavail_enabled' value='checked'>\n\t\t\t\t\t<small>" . _("unavailable") . "</small>&nbsp;&nbsp;\n\t\t\t\t\t<input {$tabindex_text} {$vmx_busy_enabled_text_box_options} {$vmx_busy_enabled_value} type=checkbox name='vmx_busy_enabled' id='vmx_busy_enabled' value='checked'>\n\t\t\t\t\t<small>" . _("busy") . "</small>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td><a href='#' class='info'>" . _("Voicemail Instructions:") . "<span>" . _("Uncheck to play a beep after your personal voicemail greeting.") . "<br></span></a></td>\n\t\t\t\t<td>\n\t\t\t\t\t<input {$tabindex_text} {$vmx_play_instructions_text_box_options} {$vmx_play_instructions} type=checkbox name='vmx_play_instructions' id='vmx_play_instructions' value='checked'>\n\t\t\t\t\t<small>" . _("Standard voicemail prompts.") . "</small>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\n\t\t<br>\n\t\t<br>\n\t\t<table class='settings'>\n\t\t\t<tr>\n\t\t\t\t<td><a href='#' class='info'>" . _("Press 0:") . "<span>" . _("Pressing 0 during your personal voicemail greeting goes to the Operator. Uncheck to enter another destination here. This feature can be used while still disabling VmX to allow an alternative Operator extension without requiring the VmX feature for the user.") . "<br></span></a>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<input {$tabindex_text} {$vmx_option_0_number_text_box_options} name='vmx_option_0_number' id='vmx_option_0_number' type='text' size=24 value='{$vmx_option_0_number}'>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<input {$tabindex_text} {$vmx_option_0_system_default_text_box_options} {$vmx_option_0_system_default} type=checkbox name='vmx_option_0_system_default' id='vmx_option_0_system_default' value='checked' OnClick=\"frm_{$display}_vmx_disable_fields();\">\n\t\t\t\t\t<small>" . _("Go To Operator") . "</small>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td><a href='#' class='info'>" . _("Press 1:") . "<span>";
    if ($follow_me_disabled) {
        $set_vmx_text .= _("The remaining options can have internal extensions, ringgroups, queues and external numbers that may be rung. It is often used to include your cell phone. You should run a test to make sure that the number is functional any time a change is made so you don't leave a caller stranded or receiving invalid number messages.");
    } else {
        $set_vmx_text .= _("Enter an alternate number here, then change your personal voicemail greeting to let callers know to press 1 to reach that number. <br/><br/>If you'd like to use your Follow Me List, check \"Send to Follow Me\" and disable Follow Me above.");
    }
    $set_vmx_text .= "\t\t\t<br></span></a>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<input {$tabindex_text} {$vmx_option_1_number_text_box_options}  name='vmx_option_1_number' id='vmx_option_1_number' type='text' size=24 value='{$vmx_option_1_number}'>\n\t\t\t\t</td>\n\t\t\t\t<td>";
    if (!$follow_me_disabled) {
        $set_vmx_text .= "<input {$tabindex_text} {$vmx_option_1_system_default_text_box_options} {$vmx_option_1_system_default} type=checkbox name='vmx_option_1_system_default' id='vmx_option_1_system_default' value='checked' OnClick=\"frm_{$display}_vmx_disable_fields(); \"><small>" . _("Send to Follow-Me") . "</small>";
    }
    $set_vmx_text .= "\t\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td><a href='#' class='info'>" . _("Press 2:") . "<span>" . _("Use any extensions, ringgroups, queues or external numbers. <br/><br/>Remember to re-record your personal voicemail greeting and include instructions. Run a test to make sure that the number is functional.") . "<br></span></a></td>\n\t\t\t\t<td>\n\t\t\t\t\t<input {$tabindex_text} {$vmx_option_2_number_text_box_options} name='vmx_option_2_number' id='vmx_option_2_number' type='text' size=24 value='{$vmx_option_2_number}'>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t";
    return $set_vmx_text;
}
Exemplo n.º 2
0
function voicemail_draw_vmxgui($extdisplay, $vmdisable)
{
    global $currentcomponent;
    global $display;
    $display_mode = "advanced";
    $mode = \FreePBX::Config()->get("FPBXOPMODE");
    if (!empty($mode)) {
        $display_mode = $mode;
    }
    if ($display_mode == "basic") {
        return true;
    }
    $section = _("VmX Locater&trade;");
    $group = "vmxgroup";
    $category = "Voicemail";
    $vmxobj = new vmxObject($extdisplay);
    $disable = $vmxobj->isEnabled() && !$vmdisable ? false : true;
    $uw = array();
    if ($vmxobj->getState("unavail") == "enabled") {
        $uw[] = "vmx_unavail_enabled";
    }
    if ($vmxobj->getState("busy") == "enabled") {
        $uw[] = "vmx_busy_enabled";
    }
    if ($vmxobj->getState("temp") == "enabled") {
        $uw[] = "vmx_temp_enabled";
    }
    $follow_me_disabled = !$vmxobj->hasFollowMe();
    $vmxsettings = array();
    $vmxsettings['option'][0] = array("disabled" => false, "value" => $vmxobj->getMenuOpt(0), "checked" => false);
    if ($vmxsettings['option'][0]['value'] == '') {
        $vmxsettings['option'][0]['disabled'] = true;
        $vmxsettings['option'][0]['checked'] = true;
    }
    if (!$follow_me_disabled) {
        if ($vmxobj->isFollowMe()) {
            $vmxsettings['option'][1] = array("disabled" => true, "value" => "", "checked" => true);
        } else {
            $val = !$disable ? $vmxobj->getMenuOpt(1) : '';
            $vmxsettings['option'][1] = array("disabled" => empty($val), "value" => $val, "checked" => empty($val));
        }
    } else {
        $val = !$disable ? $vmxobj->getMenuOpt(1) : '';
        $vmxsettings['option'][1] = array("disabled" => empty($val), "value" => $val, "checked" => empty($val));
    }
    $vmxsettings['option'][2] = array("value" => !$disable ? $vmxobj->getMenuOpt(2) : '');
    $guidefaults = array("elemname" => "", "prompttext" => "", "helptext" => "", "currentvalue" => "", "valarray" => array(), "jsonclick" => '', "jsvalidation" => "", "failvalidationmsg" => "", "canbeempty" => true, "maxchars" => 0, "disable" => false, "inputgroup" => false, "class" => "", "cblabel" => 'Enable', "disabled_value" => 'DEFAULT', "check_enables" => 'true', "cbdisable" => false, "cbclass" => '');
    $el = array("elemname" => "vmx_state", "prompttext" => _('Enabled'), "helptext" => _("Enable/Disable the VmX (Virtual Machine eXtension) Locater feature for this user. The VMX locator allows for advanced control of a user's voicemail system. It is somewhat similar to the Follow Me feature; however it gives callers more control. In essence, the VMX locater is a mini-IVR (interactive voice response) for voicemail"), "currentvalue" => $disable ? 'disabled' : 'enabled', "valarray" => $currentcomponent->getoptlist('vmena'), "jsonclick" => "frm_{$display}_vmxEnabled()", "class" => "fpbx-voicemail", "disable" => $vmdisable, "pairedvalues" => false);
    $currentcomponent->addguielem($section, new gui_radio(array_merge($guidefaults, $el)), 5, 6, $category);
    $el = array("elemname" => "vmx_use_when", "prompttext" => _('Use When:'), "helptext" => _("When to use VMX"), "currentvalue" => $uw, "valarray" => $currentcomponent->getoptlist('vmxuw'), "class" => $group, "disable" => $disable);
    $currentcomponent->addguielem($section, new gui_checkset(array_merge($guidefaults, $el)), $category);
    $el = array("elemname" => "vmx_play_instructions", "prompttext" => _("Voicemail Instructions:"), "helptext" => _("Uncheck to play a beep after your personal Voicemail greeting."), "currentvalue" => $vmxobj->getVmPlay() ? "yes" : "no", "valarray" => $currentcomponent->getoptlist('vmyn'), "class" => $group, "disable" => $disable, "pairedvalues" => false);
    $currentcomponent->addguielem($section, new gui_radio(array_merge($guidefaults, $el)), $category);
    $el = array("elemname" => "vmx_option_0_number", "prompttext" => _("Press 0:"), "helptext" => _("Pressing 0 during your personal Voicemail greeting goes to the Operator. Uncheck to enter another destination here. This feature can be used while still disabling VmX to allow an alternative Operator extension without requiring the VmX feature for the user."), "currentvalue" => $vmxsettings['option'][0]['value'], "disable" => false, "class" => '', "disabled_value" => $vmxsettings['option'][0]['value'], "cblabel" => _("Go To Operator"), "cbelemname" => "vmx_option_0_system_default", "check_enables" => 'false', "cbdisable" => false, "cbclass" => $group, "cbchecked" => $vmxsettings['option'][0]['checked']);
    $currentcomponent->addguielem($section, new gui_textbox_check(array_merge($guidefaults, $el)), $category);
    if ($follow_me_disabled) {
        $el = array("elemname" => "vmx_option_1_number", "prompttext" => _('Press 1:'), "helptext" => _("The remaining options can have internal extensions, ringgroups, queues and external numbers that may be rung. It is often used to include your cell phone. You should run a test to make sure that the number is functional any time a change is made so you don't leave a caller stranded or receiving invalid number messages."), "currentvalue" => $vmxobj->getMenuOpt(1), "class" => $group, "disable" => $disable);
        $currentcomponent->addguielem($section, new gui_textbox(array_merge($guidefaults, $el)), $category);
    } else {
        $el = array("elemname" => "vmx_option_1_number", "prompttext" => _("Press 1:"), "helptext" => _("Enter an alternate number here, then change your personal Voicemail greeting to let callers know to press 1 to reach that number. <br/><br/>If you'd like to use your Follow Me List, check \"Send to Follow Me\" and disable Follow Me otherwise the call will go to Follow Me first and skip VmX Locater."), "currentvalue" => $vmxsettings['option'][1]['value'], "disable" => $vmxsettings['option'][1]['disabled'], "class" => '', "disabled_value" => $vmxsettings['option'][0]['value'], "cblabel" => _("Send to Follow-Me"), "cbelemname" => "vmx_option_1_system_default", "check_enables" => 'false', "cbdisable" => $disable, "cbclass" => $group, "cbchecked" => $vmxsettings['option'][1]['checked']);
        $currentcomponent->addguielem($section, new gui_textbox_check(array_merge($guidefaults, $el)), $category);
    }
    $el = array("elemname" => "vmx_option_2_number", "prompttext" => _('Press 2:'), "helptext" => _("Use any extensions, ringgroups, queues or external numbers. <br/><br/>Remember to re-record your personal Voicemail greeting and include instructions. Run a test to make sure that the number is functional."), "currentvalue" => $vmxobj->getMenuOpt(2), "class" => $group, "disable" => $disable);
    $currentcomponent->addguielem($section, new gui_textbox(array_merge($guidefaults, $el)), $category);
}