public function getHTML()
 {
     $locale_catalog = new \Innomatic\Locale\LocaleCatalog('innowork-core::misc', InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCurrentUser()->getLanguage());
     $theme = \Innomatic\Wui\Wui::instance('\\Innomatic\\Wui\\Wui')->getTheme();
     $icon = $theme->mIconsBase . $theme->mIconsSet['light']['trash']['base'] . '/light/' . $theme->mIconsSet['light']['trash']['file'];
     return '<a href="' . \Innomatic\Wui\Dispatch\WuiEventsCall::buildEventsCallString('1innoworkcore', array(array('view', 'trashcan', ''))) . '" alt="' . $locale_catalog->getStr('trashcan.menu') . '"><img width="25" height="25" align="right" src="' . $icon . '" alt="' . $locale_catalog->getStr('trashcan.menu') . '" /></a>';
 }
예제 #2
0
 public function __construct(\Innomatic\Desktop\Panel\PanelController $controller)
 {
     $this->controller = $controller;
     // Deprecated
     $this->_controller = $controller;
     // Sets Wui container instance
     $this->wuiContainer = \Innomatic\Wui\Wui::instance('\\Innomatic\\Wui\\Wui');
     // Deprecated
     $this->_wuiContainer = $this->wuiContainer;
 }
 public function executesettheme($eventData)
 {
     $userCfg = new UserSettings(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCurrentDomain()->getDataAccess(), \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCurrentUser()->getUserId());
     $userCfg->setKey('wui-theme', $eventData['theme']);
     if (User::isAdminUser(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCurrentUser()->getUserName(), \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCurrentDomain()->getDomainId())) {
         $domainCfg = new DomainSettings(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCurrentDomain()->getDataAccess());
         $domainCfg->EditKey('wui-theme', $eventData['theme']);
     }
     $wui = \Innomatic\Wui\Wui::instance('\\Innomatic\\Wui\\Wui');
     $wui->setTheme($eventData['theme']);
     \Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getProcessor()->getResponse()->addHeader('Location', WuiEventsCall::buildEventsCallString('', array(array('view', 'default', ''), array('action', 'settheme2', ''))));
 }
예제 #4
0
function main_showrootwebserviceslog($eventData)
{
    global $gLocale, $gPageTitle, $gXmlDefinition, $gToolbars;
    $gWui = \Innomatic\Wui\Wui::instance('\\Innomatic\\Wui\\Wui');
    $gWui->loadWidget('vertgroup');
    $gWui->loadWidget('toolbars');
    $logContent = '';
    if (file_exists(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getHome() . 'core/log/webservices.log')) {
        $cleanLogAction = new \Innomatic\Wui\Dispatch\WuiEventsCall();
        $cleanLogAction->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('view', 'showrootwebserviceslog', ''));
        $cleanLogAction->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('action', 'cleanrootwebserviceslog', ''));
        $gToolbars['logs']['cleanlog'] = array('view' => array('label' => $gLocale->getStr('cleanlog_button'), 'themeimage' => 'documentdelete', 'horiz' => 'true', 'action' => $cleanLogAction->getEventsCallString()));
        if (file_exists(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getHome() . 'core/log/webservices.log')) {
            $logContent = file_get_contents(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getHome() . 'core/log/webservices.log');
        }
    }
    $gXmlDefinition = '<vertgroup><name />
    <children>
      <text><name>rootlog</name>
        <args>
          <disp>action</disp>
          <readonly>true</readonly>
          <rows>20</rows>
          <cols>120</cols>
          <value type="encoded">' . urlencode(\Innomatic\Wui\Wui::utf8_entities($logContent)) . '</value>
        </args>
      </text>
    </children>
    </vertgroup>';
    $gPageTitle .= ' - ' . $gLocale->getStr('rootwebserviceslog_title');
}
 /**
  * Launches a panel in the base Innomatic desktop.
  *
  * @param string $resource Panel name.
  */
 public function executeBase($resource)
 {
     $path = 'base';
     // TODO verificare se e' ancora necessario dopo aver creato \Innomatic\Wui\Wui::setTheme()
     if (!($this->container->getState() == \Innomatic\Core\InnomaticContainer::STATE_SETUP)) {
         $appCfg = new \Innomatic\Application\ApplicationSettings('innomatic');
         if (strlen($appCfg->getKey('wui-root-theme'))) {
             \Innomatic\Wui\Wui::instance('\\Innomatic\\Wui\\Wui')->setTheme($appCfg->getKey('wui-root-theme'));
         }
         unset($appCfg);
     } else {
         $path = 'setup';
     }
     if (substr($resource, -1, 1) != '/') {
         include 'innomatic/desktop/layout/' . $path . '/' . basename($resource) . '.php';
     } else {
         \Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getProcessor()->getResponse()->addHeader('P3P', 'CP="CUR ADM OUR NOR STA NID"');
         include 'innomatic/desktop/layout/' . $path . '/index.php';
     }
 }
 public function viewDefault($eventData)
 {
     $def_width = 380;
     $def_height = 250;
     $widgets = $this->getController()->getWidgetsList();
     $widget_counter = 0;
     $columns = 3;
     $start_column = true;
     $end_column = false;
     $rows_per_column = floor(count($widgets) / $columns) + (count($widgets) % $columns > 0 ? 1 : 0);
     $wui_xml = '<horizgroup><children>';
     foreach ($widgets as $widget) {
         $width = 0;
         $height = 0;
         $class = $widget['class'];
         // Check if the class exists
         if (class_exists($class, true)) {
             // Fetch the widget xml definition
             $widget_obj = new $class();
             // Check if the widget is visible
             if (!$widget_obj->isVisible()) {
                 continue;
             }
             $width = $widget_obj->getWidth() * $def_width;
             $height = $widget_obj->getHeight();
         } else {
             continue;
         }
         // If this is the start of a column, add the vertical group opener
         if ($start_column) {
             $wui_xml .= '<vertgroup><children>';
             $start_column = false;
         }
         // Add ajax setup call
         \Innomatic\Wui\Wui::instance('\\Innomatic\\Wui\\Wui')->registerAjaxSetupCall('xajax_GetDashboardWidget(\'' . $widget['name'] . '\')');
         // Check width and height parameters
         if ($width == 0) {
             $width = $def_width;
         }
         if ($height == 0) {
             $height = $def_height;
         }
         // Widget title
         $widget_locale = new LocaleCatalog($widget['catalog'], $this->container->getCurrentUser()->getLanguage());
         $headers = array();
         $headers[0]['label'] = $widget_locale->getStr($widget['title']);
         // Draw the widget
         $wui_xml .= '<table halign="left" valign="top"><args><headers type="array">' . WuiXml::encode($headers) . '</headers></args><children><vertgroup row="0" col="0" halign="left" valign="top"><args><width>' . $width . '</width><height>' . $height . '</height><groupvalign>top</groupvalign></args><children><divframe><args><id>widget_' . $widget['name'] . '</id><width>300</width></args><children><void/></children></divframe></children></vertgroup></children></table>';
         $widget_counter++;
         // Check if this last widget for each column
         if ($widget_counter % $rows_per_column == 0) {
             $end_column = true;
         }
         // If this is the last widget, end the column anyway
         if ($widget_counter == count($widgets)) {
             $end_column = true;
         }
         // If this the end of a column, close the vertical group
         if ($end_column) {
             $wui_xml .= '</children></vertgroup>';
             $start_column = true;
             $end_column = false;
         }
     }
     $wui_xml .= '</children></horizgroup>';
     $this->wuiMainframe->addChild(new WuiXml('', array('definition' => $wui_xml)));
 }
예제 #7
0
 protected function generateSourceEnd()
 {
     $container = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer');
     // Add titlebar
     $this->mLayout = str_replace('{[wui-titlebar-title]}', isset($GLOBALS['wui']['titlebar-title']) ? $GLOBALS['wui']['titlebar-title'] : '', $this->mLayout);
     // Extract toolbars
     $string = '';
     preg_match_all("/<!\\[WUITOOLBAR\\[(.*?)\\]\\]>/s", $this->mLayout, $string);
     $toolbars = implode($string[0]);
     $toolbars = str_replace('<![WUITOOLBAR[', '', $toolbars);
     $toolbars = str_replace(']]>', '', $toolbars);
     // Strip toolbars template
     $this->mLayout = preg_replace("/<!\\[WUITOOLBAR\\[(.*?)\\]\\]>/s", '', $this->mLayout);
     // Add toolbars
     $this->mLayout = str_replace('{[wui-toolbars]}', $toolbars, $this->mLayout);
     $block = '';
     $block .= "</td></tr>\n</table>\n";
     if (isset($GLOBALS['gEnv']['runtime']['wui_menu']['footer'])) {
         $block .= $GLOBALS['gEnv']['runtime']['wui_menu']['footer'];
     }
     $block .= "</td></tr></table>\n";
     // Ajax support.
     if (\Innomatic\Wui\Wui::instance('\\Innomatic\\Wui\\Wui')->countRegisteredAjaxCalls() > 0) {
         $xajax = \Innomatic\Ajax\Xajax::instance('Xajax');
         // Show the ajax loader?
         $xajax->ajaxLoader = $this->mArgs['ajaxloader'] == 'true' ? true : false;
         // Set debug mode
         if ($container->getState() == \Innomatic\Core\InnomaticContainer::STATE_DEBUG) {
             $xajax->debugOn();
         }
         $block .= $xajax->getJavascript($container->getBaseUrl() . '/shared', 'xajax.js');
         // Setup calls.
         if (\Innomatic\Wui\Wui::instance('\\Innomatic\\Wui\\Wui')->countRegisteredAjaxSetupCalls() > 0) {
             $setup_calls = \Innomatic\Wui\Wui::instance('\\Innomatic\\Wui\\Wui')->getRegisteredAjaxSetupCalls();
             $block .= '<script type="text/javascript">' . "\n";
             foreach ($setup_calls as $call) {
                 $block .= $call . ";\n";
             }
             $block .= '</script>' . "\n";
         }
     }
     $block .= "<script type=\"text/javascript\">\n";
     $block .= "\n        \$( document ).ready(function() {\n            resizeSubTopMenu()\n        });\n        \$( window ).resize(function() {\n          resizeSubTopMenu()\n        });\n\n        function resizeSubTopMenu(){\n            heigthThead = \$('#sub-top-menu').height()-35;\n            \$('#page-tbody tr td:first').css({ 'padding-top': heigthThead+'px'});\n        }";
     $block .= "</script>\n";
     $block .= "</body>\n</html>\n";
     return $block;
 }
 public function viewdefault($eventData)
 {
     //$app_cfg = new ApplicationSettings(
     //    'innomatic' );
     $themesQuery = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getDataAccess()->execute('SELECT name,catalog FROM wui_themes');
     while (!$themesQuery->eof) {
         $tmpLocale = new LocaleCatalog($themesQuery->getFields('catalog'), \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCurrentDomain()->getLanguage());
         $elements[$themesQuery->getFields('name')] = $tmpLocale->getStr($themesQuery->getFields('name'));
         $themesQuery->moveNext();
     }
     asort($elements);
     $xmlDef = '<vertgroup><name>vgroup</name><args><halign>center</halign></args><children>
 <form><name>theme</name><args><action type="encoded">' . urlencode(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($this->localeCatalog->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($this->localeCatalog->getStr('settheme_submit')) . '</caption></args></submit>
   </children></form>
 </children></vertgroup>';
     $this->wuiMainframe->addChild(new WuiXml('page', array('definition' => $xmlDef)));
     $this->wuiTitlebar->mArgs['title'] .= ' - ' . $this->localeCatalog->getStr('themes_title');
 }
예제 #9
0
 /**
  * Class constructor.
  *
  * @param string $elemName Widget instance unique name.
  * @param array $elemArgs Widget arguments and attributes.
  * @param string $elemTheme Theme name to be applied to the element. Not used anymore.
  * @param array $dispEvents Dispatcher events.
  */
 public function __construct($elemName, $elemArgs = '', $elemTheme = '', $dispEvents = '')
 {
     $this->mName = $elemName;
     $this->mArgs =& $elemArgs;
     $this->mComments = \Innomatic\Wui\Wui::showSourceComments();
     $container = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer');
     $wuiContainer = \Innomatic\Wui\Wui::instance('\\Innomatic\\Wui\\Wui');
     if (is_array($dispEvents)) {
         $this->mDispEvents =& $dispEvents;
     }
     $currentWuiTheme = $wuiContainer->getThemeName();
     if (strlen($elemTheme) and $elemTheme != $currentWuiTheme) {
         $this->mTheme = $elemTheme;
         $this->mThemeHandler = new \Innomatic\Wui\WuiTheme($container->getDataAccess(), $this->mTheme);
     } else {
         $this->mTheme = $currentWuiTheme;
         $this->mThemeHandler = $wuiContainer->getTheme();
     }
     if (isset($this->mArgs['usesession']) and ($this->mArgs['usesession'] == 'true' or $this->mArgs['usesession'] == 'false')) {
         $this->mUseSession = $this->mArgs['usesession'];
     } else {
         $this->mUseSession = 'true';
     }
     // Initialise session parameters.
     if (isset($this->mArgs['sessionobjectnouser'])) {
         $this->mSessionObjectNoUser = $this->mArgs['sessionobjectnouser'];
     }
     if (isset($this->mArgs['sessionobjectnopage'])) {
         $this->mSessionObjectNoPage = $this->mArgs['sessionobjectnopage'];
     }
     if (isset($this->mArgs['sessionobjectnotype'])) {
         $this->mSessionObjectNoType = $this->mArgs['sessionobjectnotype'];
     }
     if (isset($this->mArgs['sessionobjectnoname'])) {
         $this->mSessionObjectNoName = $this->mArgs['sessionobjectnoname'];
     }
     if (isset($this->mArgs['sessionobjectusername'])) {
         $this->mSessionObjectUserName = $this->mArgs['sessionobjectusername'];
     }
     $url_path = '';
     if ($this->mSessionObjectNoPage != 'true') {
         $url_path = $_SERVER['REQUEST_URI'];
         if (strpos($url_path, '?')) {
             $url_path = substr($url_path, 0, strpos($url_path, '?'));
         }
         $url_path .= '_';
     }
     $this->mSessionObjectName = ($this->mSessionObjectNoUser == 'true' ? '' : (is_object($container->getCurrentUser()) ? $container->getCurrentUser()->getUserName() : 'root') . '_') . $url_path . ($this->mSessionObjectNoType == 'true' ? '' : get_class($this) . '_') . ($this->mSessionObjectNoName == 'true' ? '' : $this->mName) . (strlen($this->mSessionObjectUserName) ? '_' . $this->mSessionObjectUserName : '');
     // Check if the widget should be prepared once for all instances
     $widgetName = substr(get_class($this), 3);
     if (!isset($wuiContainer->preparedWidgets[$widgetName])) {
         // Register action ajax calls
         $theObject = new \ReflectionObject($this);
         $methods = $theObject->getMethods();
         foreach ($methods as $method) {
             // Ignore private methods
             $theMethod = new \ReflectionMethod($theObject->getName(), $method->getName());
             if (!$theMethod->isPublic()) {
                 continue;
             }
             // Expose only methods beginning with "ajax" prefix
             if (!(substr($method->getName(), 0, 4) == 'ajax')) {
                 continue;
             }
             // Register the ajax call
             $call_name = substr($method->getName(), 4);
             $wuiContainer->registerAjaxCall($call_name);
             $wuiContainer->getXajax()->registerExternalFunction(array($call_name, get_class($this), $method->getName()), 'shared/wui/' . get_class($this) . '.php');
         }
         // Set the widget as prepared
         $wuiContainer->preparedWidgets[$widgetName] = $widgetName;
     }
 }
예제 #10
0
 public static function setDomainTheme()
 {
     $container = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer');
     // Wui theme
     //
     $user_settings = new \Innomatic\Domain\User\UserSettings($container->getCurrentDomain()->getDataAccess(), $container->getCurrentUser()->getUserId());
     $user_theme = $user_settings->getKey('wui-theme', true);
     if (!strlen($user_theme)) {
         $app_cfg = new \Innomatic\Application\ApplicationSettings('innomatic');
         if (strlen($app_cfg->getKey('wui-root-theme'))) {
             $user_theme = $app_cfg->getKey('wui-root-theme');
             if (!strlen($user_theme)) {
                 $user_theme = \Innomatic\Wui\Wui::DEFAULT_THEME;
             }
         } else {
             $user_theme = \Innomatic\Wui\Wui::DEFAULT_THEME;
         }
         unset($app_cfg);
     }
     \Innomatic\Wui\Wui::instance('\\Innomatic\\Wui\\Wui')->setTheme($user_theme);
 }
    public function abort($text, $forceInterface = '')
    {
        if (strlen($forceInterface)) {
            $interface = $forceInterface;
        } else {
            $interface = $this->interface;
        }
        if ($interface == \Innomatic\Core\InnomaticContainer::INTERFACE_EXTERNAL) {
            /*
            if (
                isset(
                    $GLOBALS['gEnv']['runtime']
                   ['external_interface_error_handler'])
               and function_exists(
                        $GLOBALS['gEnv']['runtime']['external_interface_error_handler'])) {
            $func = $GLOBALS['gEnv']['runtime']
               ['external_interface_error_handler'];
            $func ($text);
            } else {
            */
            $interface = \Innomatic\Core\InnomaticContainer::INTERFACE_WEB;
            $this->interface = \Innomatic\Core\InnomaticContainer::INTERFACE_WEB;
            //}
        }
        switch ($interface) {
            case \Innomatic\Core\InnomaticContainer::INTERFACE_GUI:
                // break was intentionally omitted
            // break was intentionally omitted
            case \Innomatic\Core\InnomaticContainer::INTERFACE_UNKNOWN:
                // break was intentionally omitted
            // break was intentionally omitted
            case \Innomatic\Core\InnomaticContainer::INTERFACE_WEBSERVICES:
                // break was intentionally omitted
            // break was intentionally omitted
            case \Innomatic\Core\InnomaticContainer::INTERFACE_EXTERNAL:
                break;
            case \Innomatic\Core\InnomaticContainer::INTERFACE_CONSOLE:
                echo "\n" . $text . "\n";
                break;
            case \Innomatic\Core\InnomaticContainer::INTERFACE_WEB:
                $tmpWui = \Innomatic\Wui\Wui::instance('\\Innomatic\\Wui\\Wui');
                $tmpWui->loadWidget('empty');
                //$tmp_elem = new WuiEmpty('empty');
                $dieImage = \Innomatic\Wui\Wui::instance('\\Innomatic\\Wui\\Wui')->getTheme()->mStyle['biglogo'];
                ?>
<html>
<head>
<basefont face="Verdana" />
<title>Innomatic</title>
<link rel="stylesheet" type="text/css"
    href="<?php 
                echo \Innomatic\Wui\Wui::instance('\\Innomatic\\Wui\\Wui')->getTheme()->mStyle['css'];
                ?>
">
</head>

<body bgcolor="white">

<table border="0" cellspacing="0" cellpadding="0" align="center"
    width="200" height="100%">
    <tr>
        <td height="50%">

    </tr>
    <tr>
        <td align="center" valign="middle"><a
            href="<?php 
                echo \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getExternalBaseUrl();
                ?>
"
            target="_top"><img src="<?php 
                echo $dieImage;
                ?>
"
            alt="Innomatic" border="0"></a></td>
    </tr>
    <tr>
        <td>&nbsp;</td>
    </tr>
    <tr>
        <td align="center"><?php 
                echo $text;
                ?>
</td>
    </tr>
    <tr>
        <td height="50%">

    </tr>
</table>

</body>
</html>
        <?php 
                break;
        }
        $this->halt();
    }
예제 #12
0
 * with this package in the file LICENSE.
 *
 * @copyright  1999-2014 Innomatic Company
 * @license    http://www.innomatic.io/license/ New BSD License
 * @link       http://www.innomatic.io
 * @since      Class available since Release 5.0
*/
namespace Shared\Wui\Validators;

// Handling of uploaded files wui eventdata
//
if (isset($_FILES['wuifiles']) and is_array($_FILES['wuifiles']) and count($_FILES['wuifiles'])) {
    reset($_FILES);
    $disps = array();
    while (list($key, $val) = each($_FILES['wuifiles']['name'])) {
        $disps[] = $key;
    }
    $args[0] = 'name';
    $args[1] = 'type';
    $args[2] = 'tmp_name';
    $args[3] = 'size';
    for ($i = 0; $i < 4; $i++) {
        reset($disps);
        reset($_FILES);
        while (list(, $disp) = each($disps)) {
            while (list($eventdataname, $eventdatacontent) = each($_FILES['wuifiles'][$args[$i]][$disp]['evd'])) {
                \Innomatic\Wui\Wui::instance('\\Innomatic\\Wui\\Wui')->parameters['wui'][$disp]['evd'][$eventdataname][$args[$i]] = $eventdatacontent;
            }
        }
    }
}
예제 #13
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');
}
예제 #14
0
/**
 * Innomatic
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.
 *
 * @copyright  1999-2014 Innoteam Srl
 * @license    http://www.innomatic.io/license/ New BSD License
 * @link       http://www.innomatic.io
 * @since      Class available since Release 5.0
*/
function main_page()
{
    $innomatic_locale = new \Innomatic\Locale\LocaleCatalog('innomatic::root_menu', \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getLanguage());
    $app_cfg = new \Innomatic\Application\ApplicationSettings('innomatic');
    if (is_object(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getDataAccess()) and !(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getState() == \Innomatic\Core\InnomaticContainer::STATE_SETUP)) {
        $app_cfg = new \Innomatic\Application\ApplicationSettings('innomatic');
        $innomatic_logo_disabled = $app_cfg->getKey('innomatic-biglogo-disabled');
    } else {
        $innomatic_logo_disabled = 0;
    }
    $wui = \Innomatic\Wui\Wui::instance('\\Innomatic\\Wui\\Wui', true);
    $wui->loadWidget('page');
    $wui->loadWidget('vertgroup');
    $wui->loadWidget('button');
    $wui->loadWidget('horizbar');
    $wui->loadWidget('horizgroup');
    $wui->loadWidget('label');
    $page_params['title'] = 'Innomatic' . (strlen(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getPlatformName()) ? ' - ' . \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getPlatformName() . (strlen(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getPlatformGroup()) ? '.' . \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getPlatformGroup() : '') : '');
    $page_params['border'] = 'false';
    $wui_page = new WuiPage('page', $page_params);
    $wui_vertgroup = new WuiVertgroup('vertgroup', array('align' => 'center', 'groupalign' => 'center', 'groupvalign' => 'middle', 'height' => '100%', 'width' => '0%'));
    $wui_center_group = new WuiVertgroup('center_group', array('align' => 'center', 'groupalign' => 'center', 'groupvalign' => 'middle', 'height' => '0%'));
    $wui_buttons_group = new WuiHorizgroup('buttons', array('align' => 'middle', 'groupalign' => 'center', 'width' => '0%'));
    $query = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getDataAccess()->execute('SELECT count(id) AS domains FROM domains');
    if ($query->getFields('domains') > 0) {
        $wui_buttons_group->addChild(new WuiButton('domain', array('label' => $innomatic_locale->getStr('domainadmin'), 'image' => $wui_page->mThemeHandler->mStyle['domainaccess'], 'horiz' => 'true', 'action' => 'domain/', 'width' => 32, 'height' => 32)));
    }
    $wui_buttons_group->addChild(new WuiButton('root', array('label' => $innomatic_locale->getStr('rootadmin'), 'image' => $wui_page->mThemeHandler->mStyle['rootaccess'], 'horiz' => 'true', 'action' => 'root/', 'width' => 32, 'height' => 32)));
    if ($app_cfg->getKey('innomatic-link-disabled') != '1') {
        $wui_buttons_group->addChild(new WuiButton('innomaticlogo', array('label' => $innomatic_locale->getStr('innomatichome'), 'image' => $wui_page->mThemeHandler->mStyle['innomaticminilogo'], 'horiz' => 'true', 'action' => 'http://www.innomatic.io/', 'width' => 32, 'height' => 32)));
    }
    if ($app_cfg->getKey('serviceprovider-link-disabled') != '1') {
        $serviceprovider_link_filename = $app_cfg->getKey('serviceprovider-link-filename');
        if (strlen($serviceprovider_link_filename) and file_exists(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getHome() . 'shared/' . $serviceprovider_link_filename)) {
            $wui_buttons_group->addChild(new WuiButton('userlogo', array('label' => $app_cfg->getKey('serviceprovider-name'), 'image' => \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getBaseUrl(false) . '/shared/' . $serviceprovider_link_filename, 'horiz' => 'true', 'action' => $app_cfg->getKey('serviceprovider-url'))));
        }
    }
    $wui_logos_group = new WuiVertgroup('buttons_group', array('align' => 'center', 'groupalign' => 'center', 'groupvalign' => 'middle', 'height' => '0%'));
    if ($innomatic_logo_disabled != '1') {
        if (\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getEdition() == \Innomatic\Core\InnomaticContainer::EDITION_MULTITENANT) {
            $edition = '_asp';
        } else {
            $edition = '_enterprise';
        }
        if (isset($wui_page->mThemeHandler->mStyle['biglogo' . $edition])) {
            $biglogo_image = $wui_page->mThemeHandler->mStyle['biglogo' . $edition];
        } else {
            $biglogo_image = $wui_page->mThemeHandler->mStyle['biglogo'];
        }
        $wui_button = new WuiButton('button', array('action' => ' http://www.innomatic.io', 'target' => '_top', 'image' => $biglogo_image, 'highlight' => 'false'));
        $wui_logos_group->addChild($wui_button);
    }
    if (is_object(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getDataAccess()) and \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getState() != \Innomatic\Core\InnomaticContainer::STATE_SETUP) {
        // Service Provider personalization
        //
        $serviceprovider_biglogo_filename = $app_cfg->getKey('serviceprovider-biglogo-filename');
        $serviceprovider_url = $app_cfg->getKey('serviceprovider-url');
        if ($app_cfg->getKey('serviceprovider-biglogo-disabled') != '1') {
            if (strlen($serviceprovider_biglogo_filename) and file_exists(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getHome() . 'shared/' . $serviceprovider_biglogo_filename)) {
                $serviceprovider_button = new WuiButton('serviceproviderbutton', array('action' => strlen($serviceprovider_url) ? $serviceprovider_url : ' http://www.innomatic.io', 'target' => '_top', 'image' => \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getBaseUrl(false) . '/shared/' . $serviceprovider_biglogo_filename, 'highlight' => 'false'));
                $wui_logos_group->addChild($serviceprovider_button);
            }
        }
    }
    $wui_center_group->addChild($wui_buttons_group);
    $wui_center_group->addChild(new WuiHorizBar('hb'));
    $wui_center_group->addChild($wui_logos_group);
    $label_text = strlen(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getPlatformName()) ? \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getPlatformName() . (strlen(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getPlatformGroup()) ? '.' . \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getPlatformGroup() : '') : '';
    if (strlen($label_text)) {
        //$wui_center_group->addChild(new WuiHorizBar('hb'));
        $wui_center_group->addChild(new WuiLabel('label', array('label' => $label_text, 'color' => $wui_page->mThemeHandler->mColorsSet['buttons']['text'])));
    }
    $wui_vertgroup->addChild($wui_center_group);
    $wui_page->addChild($wui_vertgroup);
    $wui->addChild($wui_page);
    $wui->render();
}
예제 #15
0
 public function __construct($mode, $application)
 {
     $container = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer');
     // Builds the application home path
     $home = $container->getHome();
     switch ($mode) {
         case \Innomatic\Core\InnomaticContainer::MODE_ROOT:
             $home .= 'root/';
             break;
         case \Innomatic\Core\InnomaticContainer::MODE_DOMAIN:
             $home .= 'domain/';
             break;
     }
     $home .= $application . '-panel/';
     // Checks if the application exists and is valid
     if (file_exists($home)) {
         $this->mode = $mode;
         $this->applicationHome = $home;
         $this->application = $application;
     } else {
         throw new \Innomatic\Wui\WuiException(\Innomatic\Wui\WuiException::INVALID_APPLICATION);
     }
     // TODO Verificare, dopo questa impostazione, quanto ancora sia utile di WuiDispatcher
     $view = null;
     $action = null;
     // View initialization
     $viewDispatcher = new \Innomatic\Wui\Dispatch\WuiDispatcher('view');
     $viewEvent = $viewDispatcher->getEventName();
     if (!strlen($viewEvent)) {
         $viewEvent = 'default';
     }
     $viewClassName = ucfirst($this->application) . 'PanelViews';
     // Checks if view file and definition exist
     // @todo update to new namespaces model
     if (!(include_once $this->applicationHome . $viewClassName . '.php')) {
         throw new \Innomatic\Wui\WuiException(\Innomatic\Wui\WuiException::MISSING_VIEWS_FILE);
     }
     if (!class_exists($viewClassName, true)) {
         throw new \Innomatic\Wui\WuiException(\Innomatic\Wui\WuiException::MISSING_VIEWS_CLASS);
     }
     // Instantiate views class
     $this->view = new $viewClassName($this);
     $this->_view = $this->view;
     $this->view->beginHelper();
     // Action initialization
     $actionClassName = ucfirst($this->application) . 'PanelActions';
     // Checks if class file and definition exist
     if (!(include_once $this->applicationHome . $actionClassName . '.php')) {
         throw new \Innomatic\Wui\WuiException(\Innomatic\Wui\WuiException::MISSING_ACTIONS_FILE);
     }
     if (!class_exists($actionClassName, true)) {
         throw new \Innomatic\Wui\WuiException(\Innomatic\Wui\WuiException::MISSING_ACTIONS_CLASS);
     }
     // AJAX
     $ajax_request_uri = $_SERVER['REQUEST_URI'];
     if (strpos($ajax_request_uri, '?')) {
         $ajax_request_uri = substr($ajax_request_uri, 0, strpos($ajax_request_uri, '?'));
     }
     $this->ajax = \Innomatic\Ajax\Xajax::instance('Xajax', $ajax_request_uri);
     // Set debug mode
     if ($container->getState() == \Innomatic\Core\InnomaticContainer::STATE_DEBUG) {
         $this->ajax->debugOn();
     }
     $this->ajax->setLogFile($container->getHome() . 'core/log/ajax.log');
     // Register action ajax calls
     $this->registerClassAjaxCalls($actionClassName, $this->applicationHome . $actionClassName . '.php');
     // Register WUI widgets ajax calls
     $wui = \Innomatic\Wui\Wui::instance('\\Innomatic\\Wui\\Wui');
     $wui->loadAllWidgets();
     foreach ($wui->mLoadedWidgets as $widget) {
         $this->registerClassAjaxCalls('\\Shared\\Wui\\Wui' . ucfirst($widget), $container->getHome() . 'core/classes/shared/wui/Wui' . ucfirst($widget) . '.php', 'Wui' . ucfirst($widget));
     }
     // Process ajax requests, if any (if so, then it exits)
     $this->ajax->processRequests();
     // Action execution, if set
     $actionDispatcher = new \Innomatic\Wui\Dispatch\WuiDispatcher('action');
     $actionEvent = $actionDispatcher->getEventName();
     if (strlen($actionEvent)) {
         $this->action = new $actionClassName($this);
         $this->_action = $this->action;
         $this->action->addObserver($this);
         if (is_object($this->view)) {
             $this->action->addObserver($this->view);
         }
         $this->action->beginHelper();
         // Executes the action
         $actionResult = $this->action->execute($actionEvent, $actionDispatcher->getEventData());
         $this->action->endHelper();
     }
     // Displays the view result
     if (is_object($this->view)) {
         $this->view->execute($viewEvent, $viewDispatcher->getEventData());
         $this->view->endHelper();
         $this->view->display();
     } else {
         throw new \Innomatic\Wui\WuiException(\Innomatic\Wui\WuiException::NO_VIEW_DEFINED);
     }
 }
예제 #16
0
 public static function dispatchersList()
 {
     $result = array();
     if (isset(\Innomatic\Wui\Wui::instance('\\Innomatic\\Wui\\Wui')->parameters['wui']) and is_array(\Innomatic\Wui\Wui::instance('\\Innomatic\\Wui\\Wui')->parameters['wui'])) {
         reset(\Innomatic\Wui\Wui::instance('\\Innomatic\\Wui\\Wui')->parameters['wui']);
         while (list($dispatcher_name) = each(\Innomatic\Wui\Wui::instance('\\Innomatic\\Wui\\Wui')->parameters['wui'])) {
             $result[] = $dispatcher_name;
         }
         reset(\Innomatic\Wui\Wui::instance('\\Innomatic\\Wui\\Wui')->parameters['wui']);
     }
     return $result;
 }
예제 #17
0
 * @license    http://www.innomatic.io/license/ New BSD License
 * @link       http://www.innomatic.io
 * @since      Class available since Release 5.0
*/
// NOTE: This is an old-style panel code with a single file
// acting as model, view and controller.
use Innomatic\Core\InnomaticContainer;
use Innomatic\Wui\Widgets;
use Innomatic\Wui\Dispatch;
use Innomatic\Locale\LocaleCatalog;
use Innomatic\Domain\User;
use Shared\Wui;
global $wuiMainStatus, $wuiMainFrame, $innomaticLocale, $wuiTitleBar;
$log = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getLogger();
$innomaticLocale = new LocaleCatalog('innomatic::domain_password', \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCurrentUser()->getLanguage());
$wui = \Innomatic\Wui\Wui::instance('\\Innomatic\\Wui\\Wui');
$wui->loadWidget('button');
$wui->loadWidget('checkbox');
$wui->loadWidget('combobox');
$wui->loadWidget('date');
$wui->loadWidget('empty');
$wui->loadWidget('file');
$wui->loadWidget('formarg');
$wui->loadWidget('form');
$wui->loadWidget('grid');
$wui->loadWidget('helpnode');
$wui->loadWidget('horizbar');
$wui->loadWidget('horizframe');
$wui->loadWidget('horizgroup');
$wui->loadWidget('image');
$wui->loadWidget('label');
 public static function doAuth($wrong = false, $reason = '')
 {
     $container = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer');
     $innomatic_locale = new \Innomatic\Locale\LocaleCatalog('innomatic::authentication', $container->getLanguage());
     $innomatic = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer');
     $wui = \Innomatic\Wui\Wui::instance('\\Innomatic\\Wui\\Wui');
     $wui->loadWidget('button');
     $wui->loadWidget('empty');
     $wui->loadWidget('formarg');
     $wui->loadWidget('form');
     $wui->loadWidget('grid');
     $wui->loadWidget('horizbar');
     $wui->loadWidget('horizframe');
     $wui->loadWidget('horizgroup');
     $wui->loadWidget('image');
     $wui->loadWidget('label');
     $wui->loadWidget('link');
     $wui->loadWidget('page');
     $wui->loadWidget('sessionkey');
     $wui->loadWidget('statusbar');
     $wui->loadWidget('string');
     $wui->loadWidget('submit');
     $wui->loadWidget('titlebar');
     $wui->loadWidget('vertframe');
     $wui->loadWidget('vertgroup');
     $wui_page = new WuiPage('loginpage', array('title' => $innomatic_locale->getStr('rootlogin'), 'border' => 'false', 'align' => 'center', 'valign' => 'middle'));
     $wui_topgroup = new WuiVertgroup('topgroup', array('align' => 'center', 'groupalign' => 'center', 'groupvalign' => 'middle', 'height' => '100%', 'width' => '0%'));
     $wui_maingroup = new WuiVertgroup('maingroup', array('align' => 'center'));
     $wui_titlebar = new WuiTitleBar('titlebar', array('title' => $innomatic_locale->getStr('rootlogin')));
     $wui_mainbframe = new WuiVertframe('vframe', array('align' => 'center'));
     $wui_mainframe = new WuiHorizgroup('horizframe');
     $wui_mainstatus = new WuiStatusBar('mainstatusbar');
     // Main frame
     //
     $wui_grid = new WuiGrid('grid', array('rows' => '2', 'cols' => '2'));
     $wui_grid->addChild(new WuiLabel('usernamelabel', array('label' => $innomatic_locale->getStr('username'))), 0, 0);
     $wui_grid->addChild(new WuiString('username', array('disp' => 'login')), 0, 1);
     $wui_grid->addChild(new WuiLabel('passwordlabel', array('label' => $innomatic_locale->getStr('password'))), 1, 0);
     $wui_grid->addChild(new WuiString('password', array('disp' => 'login', 'password' => 'true')), 1, 1);
     $wui_vgroup = new WuiVertgroup('vertgroup', array('align' => 'center'));
     // $wui_vgroup->addChild( new WuiLabel( 'titlelabel', array( 'label' => $innomatic_locale->getStr( 'rootlogin' ) ) ) );
     $wui_vgroup->addChild($wui_grid);
     $wui_vgroup->addChild(new WuiSubmit('submit', array('caption' => $innomatic_locale->getStr('enter'))));
     $form_events_call = new \Innomatic\Wui\Dispatch\WuiEventsCall();
     $form_events_call->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('login', 'login', ''));
     $form_events_call->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('view', 'default', ''));
     $wui_form = new WuiForm('form', array('action' => $form_events_call->getEventsCallString()));
     $wui_hgroup = new WuiHorizgroup('horizgroup', array('align' => 'middle'));
     $wui_hgroup->addChild(new WuiButton('password', array('themeimage' => 'keyhole', 'themeimagetype' => 'big', 'action' => $innomatic->getBaseUrl() . '/', 'highlight' => false)));
     $wui_hgroup->addChild($wui_vgroup);
     $wui_form->addChild($wui_hgroup);
     $wui_mainframe->addChild($wui_form);
     // Wrong account check
     //
     $session = \Innomatic\Desktop\Controller\DesktopFrontController::instance('\\Innomatic\\Desktop\\Controller\\DesktopFrontController')->session;
     if ($wrong) {
         if ($innomatic->getConfig()->Value('SecurityAlertOnWrongLocalRootLogin') == '1') {
             $innomatic_security = new \Innomatic\Security\SecurityManager();
             $innomatic_security->sendAlert('Wrong root local login from remote address ' . $_SERVER['REMOTE_ADDR']);
             $innomatic_security->logFailedAccess('', true, $_SERVER['REMOTE_ADDR']);
             unset($innomatic_security);
         }
         $sleep_time = $innomatic->getConfig()->Value('WrongLoginDelay');
         if (!strlen($sleep_time)) {
             $sleep_time = 1;
         }
         $max_attempts = $innomatic->getConfig()->Value('MaxWrongLogins');
         if (!strlen($max_attempts)) {
             $max_attempts = 3;
         }
         sleep($sleep_time);
         if ($session->isValid('root_login_attempts')) {
             $session->put('root_login_attempts', $session->get('root_login_attempts') + 1);
             if ($session->get('root_login_attempts') >= $max_attempts) {
                 $innomatic->abort($innomatic_locale->getStr('wrongpwd'));
             }
         } else {
             $session->put('root_login_attempts', 1);
         }
         if ($reason) {
             $wui_mainstatus->mArgs['status'] = $innomatic_locale->getStr($reason);
         } else {
             $wui_mainstatus->mArgs['status'] = $innomatic_locale->getStr('wrongpwd');
         }
     } else {
         $session->put('domain_login_attempts', 0);
     }
     // Page render
     //
     $wui_maingroup->addChild($wui_titlebar);
     // $wui_maingroup->addChild( new WuiButton( 'innomaticlogo', array( 'image' => $innomatic->getBaseUrl(false).'/shared/styles/cleantheme/innomatic_big_asp.png', 'action' => $innomatic->getBaseUrl().'/' ) ) );
     $wui_mainbframe->addChild($wui_mainframe);
     $wui_mainbframe->addChild(new WuiHorizBar('hb'));
     $wui_mainbframe->addChild(new WuiLink('copyright', array('label' => $innomatic_locale->getStr('auth_copyright.label'), 'link' => 'http://www.innomatic.io/', 'target' => '_blank')));
     $wui_maingroup->addChild($wui_mainbframe);
     $wui_maingroup->addChild($wui_mainstatus);
     $wui_topgroup->addChild($wui_maingroup);
     $wui_page->addChild($wui_topgroup);
     $wui->addChild($wui_page);
     $wui->render();
     $innomatic->halt();
 }