示例#1
0
/**
 * Returns switch model add form
 * 
 * @return string
 */
function web_SwitchModelAddForm()
{
    $allSnmpTemplates = zb_SwitchModelsSnmpTemplatesGetAll();
    $addinputs = wf_TextInput('newsm', 'Model', '', true);
    $addinputs .= wf_TextInput('newsmp', 'Ports', '', true, '5');
    $addinputs .= wf_Selector('newsst', $allSnmpTemplates, 'SNMP template', '');
    $addinputs .= wf_delimiter() . web_add_icon() . ' ' . wf_Submit('Create');
    $addform = wf_Form('', 'POST', $addinputs, 'glamour');
    $result = $addform;
    return $result;
}
示例#2
0
        $navlinks = wf_modal(wf_img('skins/add_icon.png') . ' ' . __('Create'), __('Create'), web_SwitchModelAddForm(), 'ubButton', '420', '250');
        $navlinks .= wf_Link('?module=switches', wf_img('skins/ymaps/switchdir.png') . ' ' . __('Available switches'), true, 'ubButton');
        show_window('', $navlinks);
        show_window(__('Available switch models'), web_SwitchModelsShow());
    } else {
        //show editing form
        $editid = vf($_GET['edit'], 3);
        //if someone post changes
        if (wf_CheckPost(array('editmodelname'))) {
            simple_update_field('switchmodels', 'modelname', $_POST['editmodelname'], "WHERE `id`='" . $editid . "' ");
            if (wf_CheckPost(array('editports'))) {
                simple_update_field('switchmodels', 'ports', $_POST['editports'], "WHERE `id`='" . $editid . "' ");
            }
            simple_update_field('switchmodels', 'snmptemplate', $_POST['editsnmptemplate'], "WHERE `id`='" . $editid . "' ");
            log_register("SWITCHMODEL CHANGE " . $editid);
            rcms_redirect("?module=switchmodels");
        }
        $modeldata = zb_SwitchModelGetData($editid);
        $allSnmpTemplates = zb_SwitchModelsSnmpTemplatesGetAll();
        $editinputs = wf_TextInput('editmodelname', 'Model', $modeldata['modelname'], true, '20');
        $editinputs .= wf_TextInput('editports', 'Ports', $modeldata['ports'], true, '5');
        $editinputs .= wf_Selector('editsnmptemplate', $allSnmpTemplates, 'SNMP template', $modeldata['snmptemplate']);
        $editinputs .= wf_delimiter();
        $editinputs .= wf_Submit('Save');
        $editform = wf_Form('', 'POST', $editinputs, 'glamour');
        show_window(__('Switch model edit'), $editform);
        show_window('', wf_Link('?module=switchmodels', 'Back', true, 'ubButton'));
    }
} else {
    show_error(__('Access denied'));
}