function fax_configpageload() { global $currentcomponent; global $display; $extdisplay = isset($_REQUEST['extdisplay']) ? $_REQUEST['extdisplay'] : ''; $extensions = isset($_REQUEST['extensions']) ? $_REQUEST['extensions'] : ''; $users = isset($_REQUEST['users']) ? $_REQUEST['users'] : ''; if ($display == 'extensions' || $display == 'users') { if ($extdisplay != '') { $fax = fax_get_user($extdisplay); $faxenabled = $fax['faxenabled']; $faxemail = $fax['faxemail']; } //get settings in to variables $section = _('Fax'); $toggleemail = 'if($(this).attr(\'checked\')){$(\'[id^=fax]\').removeAttr(\'disabled\');}else{$(\'[id^=fax]\').attr(\'disabled\',\'true\');$(this).removeAttr(\'disabled\');}'; //check for fax prequsits, and alert the user if something is amiss $fax = fax_detect(); if (!$fax['module']) { //missing modules $currentcomponent->addguielem($section, new gui_label('error', '<font color="red">' . _('ERROR: No FAX modules detected! Fax-related dialplan will <b>NOT</b> be generated. This module requires Fax for Asterisk or spandsp based app_fax or app_rxfax to function.') . '</font>')); } elseif ($fax['module'] == 'res_fax' && $fax['license'] < 1) { //missing licese $currentcomponent->addguielem($section, new gui_label('error', '<font color="gray">' . _('NOTICE: No Fax license detected. Fax-related dialplan will not be generated! This module has detected that Fax for Asterisk is installed without a license. At least one license is required (it is available for free) and must be installed.') . '</font>')); } $usage_list = framework_display_destination_usage(fax_getdest($extdisplay)); if (!empty($usage_list)) { $currentcomponent->addguielem('_top', new gui_link_label('faxdests', " Fax" . $usage_list['text'], $usage_list['tooltip'], true), 5); } $currentcomponent->addguielem($section, new gui_checkbox('faxenabled', $faxenabled, _('Enabled'), _('Enable this user to receive faxes'), 'true', '', $toggleemail)); $currentcomponent->addguielem($section, new gui_textbox('faxemail', $faxemail, _('Fax Email'), _('Enter an email address where faxes sent to this extension will be delivered.'), '!isEmail()', _('Please Enter a valid email address for fax delivery.'), TRUE, '', $faxenabled == 'true' ? '' : 'true')); } }
/** * @verb GET * @returns - a list of users' fax settings * @uri /fax/users */ function get_fax_users_id($params) { $users = fax_get_user($params['id']); if (isset($users['user'])) { unset($users['user']); } return $users ? $users : false; }
function fax_getdestinfo($dest) { global $amp_conf; if (substr(trim($dest), 0, 8) == 'ext-fax,') { $usr = explode(',', $dest); $usr = $usr[1]; $thisusr = fax_get_user($usr); if (empty($thisusr)) { return array(); } else { return array('description' => sprintf(_("Fax user %s"), $usr), 'edit_url' => 'config.php?display=userman&action=showuser&user=' . urlencode($usr)); } } else { return false; } }