function main_default($eventData)
{
    global $env, $gEnv, $hui_mainframe, $amp_locale, $hui_mainstatus;
    $modules_query =& $env['ampdb']->Execute('SELECT * ' . 'FROM modules ' . 'ORDER BY category,modid');
    if ($modules_query->NumRows() > 0) {
        $headers[0]['label'] = $amp_locale->GetStr('modid_header');
        $headers[1]['label'] = $amp_locale->GetStr('modauthor_header');
        $headers[2]['label'] = $amp_locale->GetStr('modversion_header');
        $headers[3]['label'] = $amp_locale->GetStr('moddate_header');
        $row = 0;
        $current_category = '';
        while (!$modules_query->eof) {
            $tmp_data = $modules_query->Fields();
            if ($tmp_data['category'] == '') {
                $tmp_data['category'] = 'various';
            }
            $modules_array[$tmp_data['category']][] = $tmp_data;
            $modules_query->MoveNext();
        }
        ksort($modules_array);
        $categories = array();
        while (list(, $tmp_data) = each($modules_array)) {
            while (list(, $data) = each($tmp_data)) {
                if ($data['category'] != $current_category) {
                    $hui_modules_table[$data['category']] = new HuiTable('modulestable', array('headers' => $headers, 'rowsperpage' => '10', 'pagesactionfunction' => 'modules_list_action_builder', 'pagenumber' => isset($eventData['modulespage']) ? $eventData['modulespage'] : '', 'sessionobjectusername' => $data['category']));
                    $current_category = $data['category'];
                    $categories[] = $data['category'];
                    $row = 0;
                    //$hui_modules_table->AddChild( new HuiLabel( 'modcategory'.$row, array( 'label' => '<strong><font color="red">'.ucfirst( $data['category'] ).'</font></strong>' ) ), $row, 0 );
                    //$row++;
                }
                $hui_modules_table[$data['category']]->AddChild(new HuiLabel('modidlabel' . $row, array('label' => '<strong>' . $data['modid'] . '</strong><br />' . $data['moddesc'])), $row, 0);
                $hui_modules_table[$data['category']]->AddChild(new HuiLink('modauthorlabel' . $row, array('label' => $data['author'], 'link' => $data['authorsite'])), $row, 1);
                $hui_modules_table[$data['category']]->AddChild(new HuiLabel('modversionlabel' . $row, array('label' => $data['modversion'])), $row, 2);
                $hui_modules_table[$data['category']]->AddChild(new HuiLabel('moddatedatelabel' . $row, array('label' => $data['moddate'])), $row, 3);
                $hui_module_toolbar[$data['category']][$row] = new HuiToolBar('moduletoolbar' . $row);
                $details_action[$data['category']][$row] = new HuiEventsCall();
                $details_action[$data['category']][$row]->AddEvent(new HuiEvent('main', 'details', array('modid' => $data['id'])));
                $hui_details_button[$data['category']][$row] = new HuiButton('detailsbutton' . $row, array('label' => $amp_locale->GetStr('moddetails_label'), 'themeimage' => 'viewmag', 'action' => $details_action[$data['category']][$row]->GetEventsCallString(), 'horiz' => 'true'));
                $hui_module_toolbar[$data['category']][$row]->AddChild($hui_details_button[$data['category']][$row]);
                if ($gEnv['core']['state'] == AMP_STATE_DEVELOPMENT or $gEnv['core']['state'] == AMP_STATE_DEBUG) {
                    $show_action[$data['category']][$row] = new HuiEventsCall();
                    $show_action[$data['category']][$row]->AddEvent(new HuiEvent('main', 'showmodule', array('modid' => $data['id'])));
                    $hui_show_button[$data['category']][$row] = new HuiButton('showbutton' . $row, array('label' => $amp_locale->GetStr('showmodule_label'), 'themeimage' => 'viewmag+', 'action' => $show_action[$data['category']][$row]->GetEventsCallString(), 'horiz' => 'true'));
                    $hui_module_toolbar[$data['category']][$row]->AddChild($hui_show_button[$data['category']][$row]);
                    $hooks_action[$data['category']][$row] = new HuiEventsCall();
                    $hooks_action[$data['category']][$row]->AddEvent(new HuiEvent('main', 'modulehooks', array('modid' => $data['id'])));
                    $hui_hooks_button[$data['category']][$row] = new HuiButton('hooksbutton' . $row, array('label' => $amp_locale->GetStr('modulehooks.label'), 'themeimage' => 'attach', 'action' => $hooks_action[$data['category']][$row]->GetEventsCallString(), 'horiz' => 'true'));
                    $hui_module_toolbar[$data['category']][$row]->AddChild($hui_hooks_button[$data['category']][$row]);
                }
                if (strcmp($data['modid'], 'ampoliros')) {
                    $deps_action[$data['category']][$row] = new HuiEventsCall();
                    $deps_action[$data['category']][$row]->AddEvent(new HuiEvent('main', 'dependencies', array('modid' => $data['id'])));
                    $hui_deps_button[$data['category']][$row] = new HuiButton('depsbutton' . $row, array('label' => $amp_locale->GetStr('moduledeps_label'), 'themeimage' => 'view_tree', 'action' => $deps_action[$data['category']][$row]->GetEventsCallString(), 'horiz' => 'true'));
                    $hui_module_toolbar[$data['category']][$row]->AddChild($hui_deps_button[$data['category']][$row]);
                    $remove_action[$data['category']][$row] = new HuiEventsCall();
                    $remove_action[$data['category']][$row]->AddEvent(new HuiEvent('main', 'default', ''));
                    $remove_action[$data['category']][$row]->AddEvent(new HuiEvent('pass', 'uninstall', array('modid' => $data['id'])));
                    $hui_remove_button[$data['category']][$row] = new HuiButton('removebutton' . $row, array('label' => $amp_locale->GetStr('removemodule_label'), 'themeimage' => 'edittrash', 'action' => $remove_action[$data['category']][$row]->GetEventsCallString(), 'needconfirm' => 'true', 'confirmmessage' => sprintf($amp_locale->GetStr('removemodulequestion_label'), $data['modid']), 'horiz' => 'true'));
                    $hui_module_toolbar[$data['category']][$row]->AddChild($hui_remove_button[$data['category']][$row]);
                }
                if (file_exists(MODULE_PATH . $data['modid'] . '/module.log')) {
                    $log_action[$data['category']][$row] = new HuiEventsCall();
                    $log_action[$data['category']][$row]->AddEvent(new HuiEvent('main', 'modulelog', array('modid' => $data['id'])));
                    $hui_log_button[$data['category']][$row] = new HuiButton('logbutton' . $row, array('label' => $amp_locale->GetStr('modlog_label'), 'themeimage' => 'toggle_log', 'action' => $log_action[$data['category']][$row]->GetEventsCallString(), 'horiz' => 'true'));
                    $hui_module_toolbar[$data['category']][$row]->AddChild($hui_log_button[$data['category']][$row]);
                }
                $hui_modules_table[$data['category']]->AddChild($hui_module_toolbar[$data['category']][$row], $row, 4);
                $row++;
            }
            while (list(, $category) = each($categories)) {
                $tabs[]['label'] = ucfirst($category);
            }
            reset($categories);
            $tab = new HuiTab('modulestab', array('tabactionfunction' => 'modules_tab_action_builder', 'tabs' => $tabs, 'activetab' => isset($eventData['activetab']) ? $eventData['activetab'] : ''));
            while (list(, $category) = each($categories)) {
                $tab->AddChild($hui_modules_table[$category]);
            }
        }
        $hui_mainframe->AddChild($tab);
    } else {
        $hui_mainstatus->mArgs['status'] = $amp_locale->GetStr('no_available_modules_status');
    }
}
function main_default($eventData)
{
    global $env, $hui_mainframe, $hui_titlebar, $amp_locale, $pass_disp, $hui_mainstatus;
    $mod_cfg = new ModuleConfig($env['ampdb'], 'ampoliros');
    // OEM
    //
    $oem_frame = new HuiVertFrame('oemframe');
    $oem_vgroup = new HuiVertGroup('oemvgroup', array('width' => '100%'));
    $oem_vgroup->AddChild(new HuiLabel('oemlabel', array('label' => $amp_locale->GetStr('oemframe_label'), 'bold' => 'true')));
    $oem_grid = new HuiGrid('oemgrid', array('rows' => '4', 'cols' => '2'));
    // OEM name
    //
    $oem_grid->AddChild(new HuiLabel('oemname_label', array('label' => $amp_locale->GetStr('oemname_label'))), 0, 0);
    $oem_grid->AddChild(new HuiString('oemname', array('disp' => 'pass', 'size' => '30', 'value' => $mod_cfg->GetKey('oem-name'))), 0, 1);
    // OEM url
    //
    $oem_grid->AddChild(new HuiLabel('oemurl_label', array('label' => $amp_locale->GetStr('oemurl_label'))), 1, 0);
    $oem_grid->AddChild(new HuiString('oemurl', array('disp' => 'pass', 'size' => '30', 'value' => $mod_cfg->GetKey('oem-url'))), 1, 1);
    // OEM big logo
    //
    $oem_grid->AddChild(new HuiLabel('oembiglogo_label', array('label' => $amp_locale->GetStr('oembiglogo_label'))), 2, 0);
    $oem_grid->AddChild(new HuiFile('oembiglogo', array('disp' => 'pass')), 2, 1);
    // OEM link logo
    //
    $oem_grid->AddChild(new HuiLabel('oemlogo_label', array('label' => $amp_locale->GetStr('oemlogo_label'))), 3, 0);
    $oem_grid->AddChild(new HuiFile('oemlinklogo', array('disp' => 'pass')), 3, 1);
    $oem_vgroup->AddChild($oem_grid);
    $oem_vgroup->AddChild(new HuiSubmit('oemsubmit', array('caption' => $amp_locale->GetStr('oem_submit'))));
    $form_events_call = new HuiEventsCall();
    $form_events_call->AddEvent(new HuiEvent('pass', 'setoem', ''));
    $form_events_call->AddEvent(new HuiEvent('main', 'default', ''));
    $oem_form = new HuiForm('setoemform', array('action' => $form_events_call->GetEventsCallString()));
    $oem_form->AddChild($oem_vgroup);
    // Enabled icons
    //
    $enable_vgroup = new HuiVertGroup('enablevgroup', array('width' => '100%'));
    $enable_vgroup->AddChild(new HuiLabel('enablelabel', array('label' => $amp_locale->GetStr('enabled_icons_label'), 'bold' => 'true')));
    $enable_grid = new HuiGrid('enablegrid', array('rows' => '5', 'cols' => '2'));
    // Ampoliros site link
    //
    $enable_grid->AddChild(new HuiLabel('ampiconlabel', array('label' => $amp_locale->GetStr('amp_link_enabled_label'))), 0, 1);
    $enable_grid->AddChild(new HuiCheckBox('ampicon', array('disp' => 'pass', 'checked' => $mod_cfg->GetKey('ampoliros-link-disabled') ? 'false' : 'true')), 0, 0);
    // Solarix site link
    //
    $enable_grid->AddChild(new HuiLabel('solarixiconlabel', array('label' => $amp_locale->GetStr('solarix_link_enabled_label'))), 1, 1);
    $enable_grid->AddChild(new HuiCheckBox('solarixicon', array('disp' => 'pass', 'checked' => $mod_cfg->GetKey('solarix-link-disabled') ? 'false' : 'true')), 1, 0);
    // OEM link
    //
    $enable_grid->AddChild(new HuiLabel('oemiconlabel', array('label' => $amp_locale->GetStr('oem_link_enabled_label'))), 2, 1);
    $enable_grid->AddChild(new HuiCheckBox('oemicon', array('disp' => 'pass', 'checked' => $mod_cfg->GetKey('oem-link-disabled') ? 'false' : 'true')), 2, 0);
    // Ampoliros big logo
    //
    $enable_grid->AddChild(new HuiLabel('ampbigiconlabel', array('label' => $amp_locale->GetStr('amp_biglogo_enabled_label'))), 3, 1);
    $enable_grid->AddChild(new HuiCheckBox('ampbigicon', array('disp' => 'pass', 'checked' => $mod_cfg->GetKey('ampoliros-biglogo-disabled') ? 'false' : 'true')), 3, 0);
    // OEM logo
    //
    $enable_grid->AddChild(new HuiLabel('oemiconlabel', array('label' => $amp_locale->GetStr('oem_biglogo_enabled_label'))), 4, 1);
    $enable_grid->AddChild(new HuiCheckBox('oembigicon', array('disp' => 'pass', 'checked' => $mod_cfg->GetKey('oem-biglogo-disabled') ? 'false' : 'true')), 4, 0);
    $enable_vgroup->AddChild($enable_grid);
    $enable_vgroup->AddChild(new HuiSubmit('enablesubmit', array('caption' => $amp_locale->GetStr('enable_submit'))));
    $form_events_call = new HuiEventsCall();
    $form_events_call->AddEvent(new HuiEvent('pass', 'setenabledicons', ''));
    $form_events_call->AddEvent(new HuiEvent('main', 'default', ''));
    $enable_form = new HuiForm('setenableform', array('action' => $form_events_call->GetEventsCallString()));
    $enable_form->AddChild($enable_vgroup);
    // Advanced settings
    //
    $advanced_vgroup = new HuiVertGroup('enablevgroup', array('width' => '100%'));
    $advanced_vgroup->AddChild(new HuiLabel('enablelabel', array('label' => $amp_locale->GetStr('advancedsettings_label'), 'bold' => 'true')));
    $advanced_grid = new HuiGrid('enablegrid', array('rows' => '2', 'cols' => '2'));
    // Compressed output buffering
    //
    $advanced_grid->AddChild(new HuiLabel('compressed-ob-label', array('label' => $amp_locale->GetStr('compressed-ob_label'))), 0, 1);
    if (!strlen($compressed_ob)) {
        if (AMP_COMPRESSED_OB) {
            $compressed_ob = 'true';
        } else {
            $compressed_ob = 'false';
        }
    }
    $advanced_grid->AddChild(new HuiCheckBox('compressed-ob', array('disp' => 'pass', 'checked' => $compressed_ob)), 0, 0);
    // HUI code comments
    //
    $advanced_grid->AddChild(new HuiLabel('hui-comments-label', array('label' => $amp_locale->GetStr('hui-comments_label'))), 1, 1);
    if (!strlen($hui_comments)) {
        if (AMP_HUI_COMMENTS) {
            $hui_comments = 'true';
        } else {
            $hui_comments = 'false';
        }
    }
    $advanced_grid->AddChild(new HuiCheckBox('hui-comments', array('disp' => 'pass', 'checked' => $hui_comments)), 1, 0);
    $advanced_vgroup->AddChild($advanced_grid);
    $advanced_vgroup->AddChild(new HuiSubmit('enablesubmit', array('caption' => $amp_locale->GetStr('advanced_submit'))));
    $form_events_call = new HuiEventsCall();
    $form_events_call->AddEvent(new HuiEvent('pass', 'setadvanced', ''));
    $form_events_call->AddEvent(new HuiEvent('main', 'default', ''));
    $advanced_form = new HuiForm('setenableform', array('action' => $form_events_call->GetEventsCallString()));
    $advanced_form->AddChild($advanced_vgroup);
    $tab_headers[0]['label'] = $amp_locale->GetStr('oemframe_label');
    $tab_headers[1]['label'] = $amp_locale->GetStr('enabled_icons_label');
    $tab_headers[2]['label'] = $amp_locale->GetStr('advancedsettings_label');
    $tab = new HuiTab('interface', array('tabactionfunction' => 'interface_tab_action_builder', 'activetab' => isset($eventData['activetab']) ? $eventData['activetab'] : '', 'tabs' => $tab_headers));
    $tab->AddChild($oem_form);
    $tab->AddChild($enable_form);
    $tab->AddChild($advanced_form);
    $hui_mainframe->AddChild($tab);
    $hui_titlebar->mTitle .= ' - ' . $amp_locale->GetStr('default_title');
}