function main_default($eventData)
{
    global $wuiMainFrame, $gLocale, $gPageContent;
    $gPageContent = new WuiVertgroup('apps');
    $applicationsQuery = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getDataAccess()->execute('SELECT * FROM applications ORDER BY category,appid');
    if ($applicationsQuery->getNumberRows() > 0) {
        $headers[1]['label'] = $gLocale->getStr('appid_header');
        $headers[2]['label'] = $gLocale->getStr('modauthor_header');
        $headers[3]['label'] = $gLocale->getStr('appversion_header');
        $headers[4]['label'] = $gLocale->getStr('appdate_header');
        $row = 0;
        $currentCategory = '';
        while (!$applicationsQuery->eof) {
            $tmpData = $applicationsQuery->getFields();
            if ($tmpData['category'] == '') {
                $tmpData['category'] = 'various';
            }
            $applicationsArray[$tmpData['category']][] = $tmpData;
            $applicationsQuery->moveNext();
        }
        ksort($applicationsArray);
        $categories = array();
        while (list(, $tmpData) = each($applicationsArray)) {
            while (list(, $data) = each($tmpData)) {
                if ($data['category'] != $currentCategory) {
                    $wuiApplicationsTable[$data['category']] = new WuiTable('applicationstable', array('headers' => $headers, 'rowsperpage' => '10', 'pagesactionfunction' => 'applications_list_action_builder', 'pagenumber' => isset($eventData['applicationspage']) ? $eventData['applicationspage'] : '', 'sessionobjectusername' => $data['category']));
                    $currentCategory = $data['category'];
                    $categories[] = $data['category'];
                    $row = 0;
                    //$wui_applications_table->addChild(
                    //    new WuiLabel(
                    //        'modcategory'.$row,
                    //        array(
                    //            'label' => '<strong><font color="red">'.ucfirst($data['category']).'</font></strong>'
                    //        )
                    //    ),
                    //    $row, 0
                    //);
                    //$row++;
                }
                if (strlen($data['iconfile'])) {
                    $wuiApplicationsTable[$data['category']]->addChild(new WuiImage('icon' . $row, array('hint' => $data['appid'], 'imageurl' => \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getBaseUrl(false) . '/core/applications/' . $data['appid'] . '/' . $data['iconfile'])), $row, 0, 'center');
                }
                $wuiApplicationsTable[$data['category']]->addChild(new WuiLabel('appidlabel' . $row, array('label' => '<strong>' . $data['appid'] . '</strong><br />' . $data['appdesc'], 'nowrap' => 'false')), $row, 1);
                $wuiApplicationsTable[$data['category']]->addChild(new WuiLink('modauthorlabel' . $row, array('label' => $data['author'], 'link' => $data['authorsite'])), $row, 2);
                $wuiApplicationsTable[$data['category']]->addChild(new WuiLabel('appversionlabel' . $row, array('label' => $data['appversion'])), $row, 3);
                $wuiApplicationsTable[$data['category']]->addChild(new WuiLabel('appdatedatelabel' . $row, array('label' => $data['appdate'])), $row, 4);
                $wuiApplicationToolbar[$data['category']][$row] = new WuiHorizgroup('applicationtoolbar' . $row);
                $detailsAction[$data['category']][$row] = new \Innomatic\Wui\Dispatch\WuiEventsCall();
                $detailsAction[$data['category']][$row]->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('view', 'details', array('appid' => $data['id'])));
                $wuiDetailsButton[$data['category']][$row] = new WuiButton('detailsbutton' . $row, array('label' => $gLocale->getStr('moddetails_label'), 'themeimage' => 'zoom', 'action' => $detailsAction[$data['category']][$row]->getEventsCallString(), 'horiz' => 'true'));
                $wuiApplicationToolbar[$data['category']][$row]->addChild($wuiDetailsButton[$data['category']][$row]);
                if (strcmp($data['appid'], 'innomatic')) {
                    $depsAction[$data['category']][$row] = new \Innomatic\Wui\Dispatch\WuiEventsCall();
                    $depsAction[$data['category']][$row]->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('view', 'dependencies', array('appid' => $data['id'])));
                    $wuiDepsButton[$data['category']][$row] = new WuiButton('depsbutton' . $row, array('label' => $gLocale->getStr('applicationdeps_label'), 'themeimage' => 'listbulletleft', 'action' => $depsAction[$data['category']][$row]->getEventsCallString(), 'horiz' => 'true'));
                    $wuiApplicationToolbar[$data['category']][$row]->addChild($wuiDepsButton[$data['category']][$row]);
                    $removeAction[$data['category']][$row] = new \Innomatic\Wui\Dispatch\WuiEventsCall();
                    $removeAction[$data['category']][$row]->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('view', 'default', ''));
                    $removeAction[$data['category']][$row]->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('action', 'uninstall', array('appid' => $data['id'])));
                    $wuiRemoveButton[$data['category']][$row] = new WuiButton('removebutton' . $row, array('label' => $gLocale->getStr('removeapplication_label'), 'themeimage' => 'trash', 'action' => $removeAction[$data['category']][$row]->getEventsCallString(), 'needconfirm' => 'true', 'confirmmessage' => sprintf($gLocale->getStr('removeapplicationquestion_label'), $data['appid']), 'horiz' => 'true'));
                    $wuiApplicationToolbar[$data['category']][$row]->addChild($wuiRemoveButton[$data['category']][$row]);
                }
                if (file_exists(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getHome() . 'core/applications/' . $data['appid'] . '/application.log')) {
                    $logAction[$data['category']][$row] = new \Innomatic\Wui\Dispatch\WuiEventsCall();
                    $logAction[$data['category']][$row]->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('view', 'applicationlog', array('appid' => $data['id'])));
                    $wuiLogButton[$data['category']][$row] = new WuiButton('logbutton' . $row, array('label' => $gLocale->getStr('modlog_label'), 'themeimage' => 'alignjustify', 'action' => $logAction[$data['category']][$row]->getEventsCallString(), 'horiz' => 'true'));
                    $wuiApplicationToolbar[$data['category']][$row]->addChild($wuiLogButton[$data['category']][$row]);
                }
                $wuiApplicationsTable[$data['category']]->addChild($wuiApplicationToolbar[$data['category']][$row], $row, 5);
                $row++;
            }
            while (list(, $category) = each($categories)) {
                $tabs[]['label'] = ucfirst($category);
            }
            reset($categories);
            $wuiTabs = new WuiTab('applicationstab', array('tabactionfunction' => 'applications_tab_action_builder', 'tabs' => $tabs, 'activetab' => isset($eventData['activetab']) ? $eventData['activetab'] : ''));
            while (list(, $category) = each($categories)) {
                $wuiTabs->addChild($wuiApplicationsTable[$category]);
            }
        }
        $gPageContent->addChild($wuiTabs);
        $gPageContent->addChild(new WuiHorizBar('hb'));
    } else {
        $gStatus = $gLocale->getStr('no_available_applications_status');
    }
    $gXmlDef = '<vertgroup>
  <children>

    <form><name>newapplicationform</name>
      <args>
        <action type="encoded">' . urlencode(\Innomatic\Wui\Dispatch\WuiEventsCall::buildEventsCallString('', array(array('view', 'default'), array('action', 'install')))) . '</action>
      </args>
      <children>

        <grid>
          <children>

            <label row="0" col="0">
              <args>
                <label type="encoded">' . urlencode($gLocale->getStr('applicationfile_label')) . '</label>
              </args>
            </label>

            <file row="0" col="1"><name>applicationfile</name>
              <args>
                <disp>action</disp>
              </args>
            </file>

    <button row="0" col="2">
      <args>
        <horiz>true</horiz>
        <frame>false</frame>
        <themeimage>mathadd</themeimage>
        <formsubmit>newapplicationform</formsubmit>
        <label type="encoded">' . urlencode($gLocale->getStr('newapplication_submit')) . '</label>
        <action type="encoded">' . urlencode(\Innomatic\Wui\Dispatch\WuiEventsCall::buildEventsCallString('', array(array('view', 'default'), array('action', 'install')))) . '</action>
      </args>
    </button>

          </children>
        </grid>

      </children>
    </form>

  </children>
</vertgroup>';
    $gPageContent->addChild(new WuiXml('newapp', array('definition' => $gXmlDef)));
}
Example #2
0
function main_default($eventData)
{
    global $wuiMainFrame, $wuiTitleBar, $innomaticLocale, $actionDispatcher, $wuiMainStatus, $wuiComments, $compressedOb;
    $appCfg = new \Innomatic\Application\ApplicationSettings('innomatic');
    $themesQuery = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getDataAccess()->execute('SELECT name,catalog FROM wui_themes ');
    while (!$themesQuery->eof) {
        $tmpLocale = new \Innomatic\Locale\LocaleCatalog($themesQuery->getFields('catalog'), \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getLanguage());
        $elements[$themesQuery->getFields('name')] = $tmpLocale->getStr($themesQuery->getFields('name'));
        $themesQuery->moveNext();
    }
    asort($elements);
    $themesXmlDef = '<vertgroup><name>vgroup</name><args><halign>center</halign></args><children>
        <form><name>theme</name><args><action type="encoded">' . urlencode(\Innomatic\Wui\Dispatch\WuiEventsCall::buildEventsCallString('', array(array('view', 'default', ''), array('action', 'settheme', '')))) . '</action></args><children>
        <grid><name>themegrid</name><children>
            <label row="0" col="0"><name>themelabel</name><args><label type="encoded">' . urlencode($innomaticLocale->getStr('themes_label')) . '</label><bold>true</bold></args></label>
            <listbox row="1" col="0"><name>theme</name><args><elements type="array">' . WuiXml::encode($elements) . '</elements><default>' . \Innomatic\Wui\Wui::instance('\\Innomatic\\Wui\\Wui')->getThemeName() . '</default><disp>action</disp><size>10</size></args></listbox>
        </children></grid>
        <submit><name>submit</name><args><caption type="encoded">' . urlencode($innomaticLocale->getStr('settheme_submit')) . '</caption></args></submit>
      </children></form>
    </children></vertgroup>';
    // Service provider settings
    // Service Provider
    //
    $serviceProviderFrame = new WuiVertframe('serviceproviderframe');
    $serviceProviderVGroup = new WuiVertgroup('serviceprovidervgroup', array('width' => '100%'));
    $serviceProviderVGroup->addChild(new WuiLabel('serviceproviderlabel', array('label' => $innomaticLocale->getStr('serviceproviderframe_label'), 'bold' => 'true')));
    $serviceProviderGrid = new WuiGrid('serviceprovidergrid', array('rows' => '4', 'cols' => '2'));
    // Service Provider name
    //
    $serviceProviderGrid->addChild(new WuiLabel('serviceprovidername_label', array('label' => $innomaticLocale->getStr('serviceprovidername_label'))), 0, 0);
    $serviceProviderGrid->addChild(new WuiString('serviceprovidername', array('disp' => 'action', 'size' => '30', 'value' => $appCfg->getKey('serviceprovider-name'))), 0, 1);
    // Service Provider url
    //
    $serviceProviderGrid->addChild(new WuiLabel('serviceproviderurl_label', array('label' => $innomaticLocale->getStr('serviceproviderurl_label'))), 1, 0);
    $serviceProviderGrid->addChild(new WuiString('serviceproviderurl', array('disp' => 'action', 'size' => '30', 'value' => $appCfg->getKey('serviceprovider-url'))), 1, 1);
    // Service Provider big logo
    //
    $serviceProviderGrid->addChild(new WuiLabel('serviceproviderbiglogo_label', array('label' => $innomaticLocale->getStr('serviceproviderbiglogo_label'))), 2, 0);
    $serviceProviderGrid->addChild(new WuiFile('serviceproviderbiglogo', array('disp' => 'action')), 2, 1);
    // Service Provider link logo
    //
    $serviceProviderGrid->addChild(new WuiLabel('serviceproviderlogo_label', array('label' => $innomaticLocale->getStr('serviceproviderlogo_label'))), 3, 0);
    $serviceProviderGrid->addChild(new WuiFile('serviceproviderlinklogo', array('disp' => 'action')), 3, 1);
    $serviceProviderVGroup->addChild($serviceProviderGrid);
    $serviceProviderVGroup->addChild(new WuiSubmit('serviceprovidersubmit', array('caption' => $innomaticLocale->getStr('serviceprovider_submit'))));
    $formEventsCall = new \Innomatic\Wui\Dispatch\WuiEventsCall();
    $formEventsCall->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('action', 'setserviceprovider', ''));
    $formEventsCall->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('view', 'default', ''));
    $serviceProviderForm = new WuiForm('setserviceproviderform', array('action' => $formEventsCall->getEventsCallString()));
    $serviceProviderForm->addChild($serviceProviderVGroup);
    // Enabled icons
    //
    $enableVGroup = new WuiVertgroup('enablevgroup', array('width' => '100%'));
    $enableVGroup->addChild(new WuiLabel('enablelabel', array('label' => $innomaticLocale->getStr('enabled_icons_label'), 'bold' => 'true')));
    $enableGrid = new WuiGrid('enablegrid', array('rows' => '5', 'cols' => '2'));
    // Innomatic site link
    //
    $enableGrid->addChild(new WuiLabel('innomaticlabel', array('label' => $innomaticLocale->getStr('innomatic_link_enabled_label'))), 0, 1);
    $enableGrid->addChild(new WuiCheckBox('innomaticicon', array('disp' => 'action', 'checked' => $appCfg->getKey('innomatic-link-disabled') ? 'false' : 'true')), 0, 0);
    // Service Provider link
    //
    $enableGrid->addChild(new WuiLabel('serviceprovidericonlabel', array('label' => $innomaticLocale->getStr('serviceprovider_link_enabled_label'))), 1, 1);
    $enableGrid->addChild(new WuiCheckBox('serviceprovidericon', array('disp' => 'action', 'checked' => $appCfg->getKey('serviceprovider-link-disabled') ? 'false' : 'true')), 1, 0);
    // Innomatic big logo
    //
    $enableGrid->addChild(new WuiLabel('innomaticbigiconlabel', array('label' => $innomaticLocale->getStr('innomatic_biglogo_enabled_label'))), 2, 1);
    $enableGrid->addChild(new WuiCheckBox('innomaticbigicon', array('disp' => 'action', 'checked' => $appCfg->getKey('innomatic-biglogo-disabled') ? 'false' : 'true')), 2, 0);
    // Service Provider logo
    //
    $enableGrid->addChild(new WuiLabel('serviceprovidericonlabel', array('label' => $innomaticLocale->getStr('serviceprovider_biglogo_enabled_label'))), 3, 1);
    $enableGrid->addChild(new WuiCheckBox('serviceproviderbigicon', array('disp' => 'action', 'checked' => $appCfg->getKey('serviceprovider-biglogo-disabled') ? 'false' : 'true')), 3, 0);
    $enableVGroup->addChild($enableGrid);
    $enableVGroup->addChild(new WuiSubmit('enablesubmit', array('caption' => $innomaticLocale->getStr('enable_submit'))));
    $formEventsCall = new \Innomatic\Wui\Dispatch\WuiEventsCall();
    $formEventsCall->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('action', 'setenabledicons', ''));
    $formEventsCall->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('view', 'default', ''));
    $enableForm = new WuiForm('setenableform', array('action' => $formEventsCall->getEventsCallString()));
    $enableForm->addChild($enableVGroup);
    // Advanced settings
    //
    $advancedVGroup = new WuiVertgroup('enablevgroup', array('width' => '100%'));
    $advancedVGroup->addChild(new WuiLabel('enablelabel', array('label' => $innomaticLocale->getStr('advancedsettings_label'), 'bold' => 'true')));
    $advancedGrid = new WuiGrid('enablegrid', array('rows' => '2', 'cols' => '2'));
    // Compressed output buffering
    //
    $advancedGrid->addChild(new WuiLabel('compressed-ob-label', array('label' => $innomaticLocale->getStr('compressed-ob_label'))), 0, 1);
    if (!strlen($compressedOb)) {
        if (\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getConfig()->value('CompressedOutputBuffering') == '1') {
            $compressedOb = 'true';
        } else {
            $compressedOb = 'false';
        }
    }
    $advancedGrid->addChild(new WuiCheckBox('compressed-ob', array('disp' => 'action', 'checked' => $compressedOb)), 0, 0);
    // WUI code comments
    //
    $advancedGrid->addChild(new WuiLabel('wui-comments-label', array('label' => $innomaticLocale->getStr('wui-comments_label'))), 1, 1);
    if (!strlen($wuiComments)) {
        if (\Innomatic\Wui\Wui::showSourceComments()) {
            $wuiComments = 'true';
        } else {
            $wuiComments = 'false';
        }
    }
    $advancedGrid->addChild(new WuiCheckBox('wui-comments', array('disp' => 'action', 'checked' => $wuiComments)), 1, 0);
    $advancedVGroup->addChild($advancedGrid);
    $advancedVGroup->addChild(new WuiSubmit('enablesubmit', array('caption' => $innomaticLocale->getStr('advanced_submit'))));
    $formEventsCall = new \Innomatic\Wui\Dispatch\WuiEventsCall();
    $formEventsCall->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('action', 'setadvanced', ''));
    $formEventsCall->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('view', 'default', ''));
    $advancedForm = new WuiForm('setenableform', array('action' => $formEventsCall->getEventsCallString()));
    $advancedForm->addChild($advancedVGroup);
    $tabHeaders[0]['label'] = $innomaticLocale->getStr('themes_title');
    $tabHeaders[1]['label'] = $innomaticLocale->getStr('serviceproviderframe_label');
    $tabHeaders[2]['label'] = $innomaticLocale->getStr('enabled_icons_label');
    $tabHeaders[3]['label'] = $innomaticLocale->getStr('advancedsettings_label');
    $tab = new WuiTab('interface', array('tabactionfunction' => 'interface_tab_action_builder', 'activetab' => isset($eventData['activetab']) ? $eventData['activetab'] : '', 'tabs' => $tabHeaders));
    $tab->addChild(new WuiXml('page', array('definition' => $themesXmlDef)));
    $tab->addChild($serviceProviderForm);
    $tab->addChild($enableForm);
    $tab->addChild($advancedForm);
    $wuiMainFrame->addChild($tab);
    $wuiTitleBar->mTitle .= ' - ' . $innomaticLocale->getStr('default_title');
}