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>'; }
public static function getRolesPermissionsXml() { $localeCatalog = new \Innomatic\Locale\LocaleCatalog('innomatic::domain_profiles', \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCurrentUser()->getLanguage()); $rolesList = \Innomatic\Domain\User\Role::getAllRoles(); $rolesCount = count($rolesList); // Build roles/permissions matrix $rolesPermissions = array(); foreach ($rolesList as $roleId => $roleData) { $role = new \Innomatic\Domain\User\Role($roleId); $rolesPermissions[$roleId] = $role->getPermissions(); } $permissionsList = \Innomatic\Domain\User\Permission::getAllPermissions(); // Build table headers $headers = array(); $headerCounter = 1; foreach ($rolesList as $roleId => $roleData) { $headers[$headerCounter++]['label'] = $roleData['title']; } $xml = '<vertgroup><children> <table> <args> <headers type="array">' . WuiXml::encode($headers) . '</headers> </args> <children>'; $row = 0; $prevApplication = ''; foreach ($permissionsList as $permId => $permData) { if ($permData['application'] != $prevApplication) { $xml .= '<label row="' . $row++ . '" col="0" halign="left" valign="middle" nowrap="false" width="" colspan="' . ($rolesCount + 1) . '"><args><label>' . WuiXml::cdata($permData['application']) . '</label><bold>true</bold></args></label>'; } $xml .= '<label row="' . $row . '" col="0" halign="left" valign="middle"><args><label>' . WuiXml::cdata($permData['title']) . '</label><nowrap>false</nowrap></args></label>'; $col = 1; foreach ($rolesList as $roleId => $roleData) { if (isset($rolesPermissions[$roleId][$permId])) { $checked = 'true'; } else { $checked = 'false'; } $xml .= '<checkbox row="' . $row . '" col="' . $col++ . '" halign="center" valign="middle"><name>rolepermissioncb</name><args><id>cbrole_' . $roleId . '-' . $permId . '</id><checked>' . $checked . '</checked></args></checkbox>'; } $prevApplication = $permData['application']; $row++; } $xml .= '</children> </table> <horizbar/> <button><name>save</name> <args><themeimage>buttonok</themeimage><label>' . WuiXml::cdata($localeCatalog->getStr('save_roles_permissions_button')) . '</label><action>javascript:void(0)</action><horiz>true</horiz><frame>false</frame></args> <events> <click>' . WuiXml::cdata("\nvar checkboxes = document.getElementsByName('wui[][evd][rolepermissioncb]');\nvar vals = '';\nfor (var i=0, n=checkboxes.length;i<n;i++) {\n if (checkboxes[i].checked) vals += ','+checkboxes[i].id;\n}\nif (vals) vals = vals.substring(1);\n \t\t\t\nxajax_SaveRolesPermissions(vals);") . '</click> </events></button> </children></vertgroup>'; return $xml; }
/** * Get list of local languages from db Root * @return array list languages */ protected static function getRootLocaleLanguages() { $language_locale = new \Innomatic\Locale\LocaleCatalog('innomatic::localization', \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getLanguage()); $languageQuery = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getDataAccess()->execute('SELECT * FROM locale_languages'); while (!$languageQuery->eof) { $langshort = $languageQuery->getFields('langshort'); $langname = $languageQuery->getFields('langname'); $languages[$langshort] = $language_locale->getStr($langname); $languageQuery->moveNext(); } return $languages; }
public function getWidgetXml() { $container = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer'); // Get the message of the day $message = $container->getCurrentDomain()->getMotd(); // Check if the motd is empty. If it is empty, get the generic welcome message if (!strlen($message)) { $catalog = new \Innomatic\Locale\LocaleCatalog('innomatic::dashboard_welcome', $container->getCurrentUser()->getLanguage()); $message = $catalog->getStr('welcome_message'); } $xml = '<label><args><label>' . \Shared\Wui\WuiXml::cdata(nl2br($message)) . '</label></args></label>'; return $xml; }
function main_localization($eventData) { global $wuiMainFrame, $wuiTitleBar, $innomaticLocale, $actionDispatcher, $wuiMainStatus; $eventData = $actionDispatcher->getEventData(); $countryLocale = new \Innomatic\Locale\LocaleCatalog('innomatic::localization', \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getLanguage()); $selectedCountry = ''; if (isset($eventData['country'])) { $selectedCountry = $eventData['country']; } $wuiVGroup = new WuiVertgroup('vgroup'); $countryQuery = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getDataAccess()->execute('SELECT * FROM locale_countries'); while (!$countryQuery->eof) { $countries[$countryQuery->getFields('countryname')] = $countryLocale->getStr($countryQuery->getFields('countryname')); $countryQuery->moveNext(); } $wuiLocaleGrid = new WuiGrid('localegrid', array('rows' => '1', 'cols' => '3')); $wuiLocaleGrid->addChild(new WuiLabel('countrylabel', array('label' => $innomaticLocale->getStr('country_label'))), 0, 0); $wuiLocaleGrid->addChild(new WuiComboBox('country', array('disp' => 'action', 'elements' => $countries, 'default' => $selectedCountry ? $selectedCountry : \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCountry())), 0, 1); $wuiLocaleGrid->addChild(new WuiSubmit('submit1', array('caption' => $innomaticLocale->getStr('country_submit'))), 0, 2); $wuiVGroup->addChild($wuiLocaleGrid); $formEventsCall = new \Innomatic\Wui\Dispatch\WuiEventsCall(); $formEventsCall->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('action', 'setcountry', '')); $formEventsCall->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('view', 'localization', '')); $wuiForm = new WuiForm('countryform', array('action' => $formEventsCall->getEventsCallString())); $wuiForm->addChild($wuiVGroup); $wuiMainFrame->addChild($wuiForm); $locCountry = new \Innomatic\Locale\LocaleCountry(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCountry()); $countryLanguage = $locCountry->Language(); $languageLocale = new \Innomatic\Locale\LocaleCatalog('innomatic::localization', \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getLanguage()); $selectedLanguage = ''; if (isset($eventData['language'])) { $selectedLanguage = $eventData['language']; } $wuiVGroup = new WuiVertgroup('vgroup'); $languageQuery = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getDataAccess()->execute('SELECT * FROM locale_languages'); while (!$languageQuery->eof) { $languages[$languageQuery->getFields('langshort')] = $languageLocale->getStr($languageQuery->getFields('langname')); $languageQuery->moveNext(); } $wuiLocaleGrid = new WuiGrid('localegrid', array('rows' => '1', 'cols' => '3')); $wuiLocaleGrid->addChild(new WuiLabel('languagelabel', array('label' => $innomaticLocale->getStr('language_label'))), 0, 0); $wuiLocaleGrid->addChild(new WuiComboBox('language', array('disp' => 'action', 'elements' => $languages, 'default' => $selectedLanguage ? $selectedLanguage : \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getLanguage())), 0, 1); $wuiLocaleGrid->addChild(new WuiSubmit('submit1', array('caption' => $innomaticLocale->getStr('language_submit'))), 0, 2); $wuiVGroup->addChild($wuiLocaleGrid); $wuiVGroup->addChild(new WuiHorizBar('horizbar1')); $wuiVGroup->addChild(new WuiLabel('deflanglabel', array('label' => sprintf($innomaticLocale->getStr('countrylanguage_label'), $languages[$countryLanguage])))); $formEventsCall = new \Innomatic\Wui\Dispatch\WuiEventsCall(); $formEventsCall->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('action', 'setlanguage', '')); $formEventsCall->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('view', 'localization', '')); $wuiForm = new WuiForm('languageform', array('action' => $formEventsCall->getEventsCallString())); $wuiForm->addChild($wuiVGroup); $wuiMainFrame->addChild($wuiForm); $wuiTitleBar->mTitle .= ' - ' . $innomaticLocale->getStr('country_title'); }
/** * Returns an array of all the defined roles. * * @return array */ public static function getAllRoles() { $dataAccess = InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCurrentDomain()->getDataAccess(); $rolesQuery = $dataAccess->execute("SELECT * FROM domain_roles ORDER BY application,title"); // Build the roles list $roles = array(); if ($rolesQuery !== false) { $catalog = ''; while (!$rolesQuery->eof) { $title = $rolesQuery->getFields('title'); $description = $rolesQuery->getFields('description'); if (strlen($rolesQuery->getFields('catalog')) > 0) { if ($rolesQuery->getFields('catalog') != $catalog) { $localeCatalog = new \Innomatic\Locale\LocaleCatalog($rolesQuery->getFields('catalog'), InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCurrentUser()->getLanguage()); } $title = $localeCatalog->getStr($title); $description = $localeCatalog->getStr($description); } $catalog = $rolesQuery->getFields('catalog'); $roles[$rolesQuery->getFields('id')] = array('name' => $rolesQuery->getFields('name'), 'title' => $title, 'description' => $description, 'application' => $rolesQuery->getFields('application')); $rolesQuery->moveNext(); } } return $roles; }
protected function generateSourceBegin() { //$style = 'style="-moz-border-radius: 5px;'; //$style .= '-webkit-border-radius:5px; '; $style = 'style="'; if (isset($this->mArgs['display']) and $this->mArgs['display'] == "false") { $style .= 'display: none;'; } else { $style .= 'display: block;'; } if (strlen($this->mArgs['bgcolor'])) { $style .= ' background-color:' . $this->mArgs['bgcolor'] . ';'; } if (isset($this->mArgs['position']) and strlen($this->mArgs['position'])) { $style .= ' position:' . $this->mArgs['position'] . ';'; } if (isset($this->mArgs['top']) and strlen($this->mArgs['top'])) { $style .= ' top:' . $this->mArgs['top'] . ';'; } if (isset($this->mArgs['left']) and strlen($this->mArgs['left'])) { $style .= ' left:' . $this->mArgs['left'] . ';'; } if (isset($this->mArgs['bottom']) and strlen($this->mArgs['bottom'])) { $style .= ' bottom:' . $this->mArgs['bottom'] . ';'; } if (isset($this->mArgs['right']) and strlen($this->mArgs['right'])) { $style .= ' right:' . $this->mArgs['right'] . ';'; } if (isset($this->mArgs['border']) and strlen($this->mArgs['border'])) { $style .= ' border: ' . $this->mArgs['border'] . ';'; } $style .= 'z-index:' . $this->mArgs['zindex'] . ';'; if ($this->mArgs['isdraggable']) { $style .= 'cursor:move;'; $style .= 'padding-top:4px; '; /* if ( $this->mArgs['bgcolor'] == 'white' ) { $style .= 'background-image:url(/innomatic/shared/styles/cleantheme/table_header_background.png);'; $style .= 'background-repeat:repeat-x; background-position:0 -10px;'; } */ } // Generic style if (isset($this->mArgs['style']) and strlen($this->mArgs['style'])) { $style .= ' ' . $this->mArgs['style']; } $style .= $this->mArgs['iscollapsable'] ? '; overflow:hidden;" ' : '" '; if ($this->mArgs['iscollapsable']) { $session_args = $this->retrieveSession(); if (\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->isDomainStarted()) { $language = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCurrentUser()->getLanguage(); } else { $language = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getLanguage(); } $locale = new \Innomatic\Locale\LocaleCatalog('innomatic::wui', $language); } $myLayout = ($this->mComments ? '<!-- begin ' . $this->mName . ' divframe -->' : '') . '<div ' . ($this->mArgs['isdraggable'] ? 'class="drag" ' : '') . $style . ' id="' . $this->mArgs['id'] . '" ' . (strlen($this->mArgs['width']) ? 'width="' . $this->mArgs['width'] . '" ' : '') . ">\n" . ($this->mArgs['iscollapsable'] ? ' <img title="' . $locale->getStr('fix_position') . '" style="padding-left: 2px; padding-right: 2px; margin-bottom: 2px; float: left; cursor:hand; cursor:pointer;" id="pin_' . $this->mName . '" ' . (isset($session_args['top']) ? 'src="' . $this->mThemeHandler->mIconsBase . $this->mThemeHandler->mIconsSet['mini']['lock']['base'] . '/mini/' . $this->mThemeHandler->mIconsSet['mini']['lock']['file'] . '" ' : 'src="' . $this->mThemeHandler->mIconsBase . $this->mThemeHandler->mIconsSet['mini']['flag']['base'] . '/mini/' . $this->mThemeHandler->mIconsSet['mini']['flag']['file'] . '" ') . 'onclick="javascript:xajax_InnomaticStickFrame(new Array(\'' . $this->mName . '\',this.parentNode.offsetTop, this.parentNode.offsetLeft));">' : '') . ((isset($this->mArgs['label']) and strlen($this->mArgs['label'])) ? '<a ' . ($this->mArgs['iscollapsable'] ? 'onclick="javascript:var myTargetDiv = document.getElementById(\'' . $this->mArgs['id'] . '\'); ' . 'if ( myTargetDiv.style.height == \'140px\' ) { myTargetDiv.style.height=\'44px\';} else { myTargetDiv.style.height=\'140px\';}" ' : '') . 'style="padding-left:3px; color:#776666">' . ($this->mArgs['iscollapsable'] ? '<img title="' . $locale->getStr('minimize') . '" style="margin-bottom: 2px; float: left; cursor: pointer; cursor:hand;" src="' . $this->mThemeHandler->mIconsBase . $this->mThemeHandler->mIconsSet['mini']['folder_red_open']['base'] . '/mini/' . $this->mThemeHandler->mIconsSet['mini']['folder_red_open']['file'] . '">' : '') . '<b>' . $this->mArgs['label'] . '</b></a>' : ''); return $myLayout; }
* * 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 */ // NOTE: This is an old-style panel code with a single file // acting as model, view and controller. global $gPageStatus, $gLocale; global $gXmlDefinition, $gLocale, $gPageTitle, $gToolbars; $gLocale = new \Innomatic\Locale\LocaleCatalog('innomatic::root_maintenance', \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getLanguage()); $gWui = \Innomatic\Wui\Wui::instance('\\Innomatic\\Wui\\Wui'); $gWui->loadWidget('xml'); $gWui->loadWidget('innomaticpage'); $gWui->loadWidget('innomatictoolbar'); $gXmlDefinition = $gPageStatus = ''; $gPageTitle = $gLocale->getStr('maintenance.title'); $gToolbars['view'] = array('innomatic' => array('label' => $gLocale->getStr('general.toolbar'), 'themeimage' => 'gear', 'horiz' => 'true', 'action' => \Innomatic\Wui\Dispatch\WuiEventsCall::buildEventsCallString('', array(array('view', 'default', '')))), 'general' => array('label' => $gLocale->getStr('innomatic.toolbar'), 'themeimage' => 'gear', 'horiz' => 'true', 'action' => \Innomatic\Wui\Dispatch\WuiEventsCall::buildEventsCallString('', array(array('view', 'innomatic', ''))))); // Info tool bar // if (file_exists(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getHome() . 'core/log/innomatic.log')) { $innomaticLogAction = new \Innomatic\Wui\Dispatch\WuiEventsCall(); $innomaticLogAction->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('view', 'showrootlog', '')); $gToolbars['info']['rootlog'] = array('label' => $gLocale->getStr('rootlog_button'), 'themeimage' => 'alignjustify', 'horiz' => 'true', 'action' => $innomaticLogAction->getEventsCallString()); } if (file_exists(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getHome() . 'core/log/webservices.log')) {
/** * Launches a panel in the domain desktop. * * If the panel name is one "main" then * no real panel is launched, a domain desktop layout file is included. * * Domain desktop layout files are stored in the folder * core/classes/innomatic/desktop/layout/domain. * * @param string $resource Panel name. */ public function executeDomain($resource) { // Check if this is the default page and if the user is allowed to access the dashboard if (substr($resource, -1, 1) == '/') { $perm = new \Innomatic\Desktop\Auth\DesktopPanelAuthorizator($this->container->getCurrentDomain()->getDataAccess(), $this->container->getCurrentUser()->getGroup()); $node_id = $perm->getNodeIdFromFileName('dashboard'); if ($perm->check($node_id, \Innomatic\Desktop\Auth\DesktopPanelAuthorizator::NODETYPE_PAGE) != \Innomatic\Desktop\Auth\DesktopPanelAuthorizator::NODE_NOTENABLED) { $resource = $resource . 'dashboard'; } } if (substr($resource, -1, 1) != '/') { // Must exit if the user called a page for which he isn't enabled // if (!isset($perm)) { $perm = new \Innomatic\Desktop\Auth\DesktopPanelAuthorizator($this->container->getCurrentDomain()->getDataAccess(), $this->container->getCurrentUser()->getGroup()); } $desktopPanel = basename($resource); if ($this->container->getState() == \Innomatic\Core\InnomaticContainer::STATE_DEBUG) { $dump = \Innomatic\Debug\InnomaticDump::instance('\\Innomatic\\Debug\\InnomaticDump'); $dump->desktopApplication = $desktopPanel; $dump->sessionId = $this->session->getId(); } switch ($desktopPanel) { case 'index': break; default: $node_id = $perm->getNodeIdFromFileName($desktopPanel); if ($node_id) { if ($perm->check($node_id, \Innomatic\Desktop\Auth\DesktopPanelAuthorizator::NODETYPE_PAGE) == \Innomatic\Desktop\Auth\DesktopPanelAuthorizator::NODE_NOTENABLED) { $adloc = new \Innomatic\Locale\LocaleCatalog('innomatic::authentication', $this->container->getCurrentUser()->getLanguage()); $this->container->abort($adloc->getStr('nopageauth')); } } else { $adloc = new \Innomatic\Locale\LocaleCatalog('innomatic::authentication', $this->container->getCurrentUser()->getLanguage()); $this->container->abort($adloc->getStr('nopageauth')); } } if (is_dir($resource . '-panel')) { $panelHome = $resource . '-panel/'; $panelName = basename($resource); $controllerClassName = ucfirst($panelName) . 'PanelController'; // Checks if view file and definition exist if (!(include_once $panelHome . $controllerClassName . '.php')) { throw new \Innomatic\Wui\WuiException(\Innomatic\Wui\WuiException::MISSING_CONTROLLER_FILE); } if (!class_exists($controllerClassName, true)) { throw new \Innomatic\Wui\WuiException(\Innomatic\Wui\WuiException::MISSING_CONTROLLER_CLASS); } $controller = new $controllerClassName(\Innomatic\Core\InnomaticContainer::MODE_DOMAIN, $panelName); $this->container->setPanelController($controller); } else { switch ($desktopPanel) { case 'menu': include 'innomatic/desktop/layout/domain/' . $desktopPanel . '.php'; break; default: include $resource . '.php'; } } } else { if (strlen($this->session->get('INNOMATIC_AUTH_USER'))) { \Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getProcessor()->getResponse()->addHeader('P3P', 'CP="CUR ADM OUR NOR STA NID"'); include 'innomatic/desktop/layout/domain/index.php'; } } }
* 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 */ // NOTE: This is an old-style panel code with a single file // acting as model, view and controller. global $wuiMainStatus, $wuiPage, $wuiMainVertGroup, $gStatus, $gXmlDefinition; global $gPageTitle, $gToolbars, $gLocale, $gPageContent; $log = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getLogger(); $gLocale = new \Innomatic\Locale\LocaleCatalog('innomatic::root_applications', \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getLanguage()); $gPageContent = $gStatus = $gToolbars = $gXmlDefinition = ''; $wui = \Innomatic\Wui\Wui::instance('\\Innomatic\\Wui\\Wui'); $wui->loadAllWidgets(); $gPageTitle = $gLocale->getStr('applications_title'); // Help tool bar // $wuiHelpToolBar = new WuiToolBar('helpbar'); $gViewDispatcher = new WuiDispatcher('view'); $eventName = $gViewDispatcher->getEventName(); if (strcmp($eventName, 'help')) { $helpAction = new \Innomatic\Wui\Dispatch\WuiEventsCall(); $helpAction->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('view', 'help', array('node' => $eventName))); $wuiHelpButton = new WuiButton('helpbutton', array('label' => $gLocale->getStr('help_button'), 'themeimage' => 'info', 'horiz' => 'true', 'action' => $helpAction->getEventsCallString())); $wuiHelpToolBar->addChild($wuiHelpButton); }
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(); }
/** * Starts a tenant. * * @param string $tenantId Tenant identifier name. * @param string $userId User identifier name. * @access public * @return boolean True if the tenant has been started. */ public function startTenant($tenantId, $userId = '') { $result = false; $this->setMode(\Innomatic\Core\InnomaticContainer::MODE_DOMAIN); if (is_object($this->currentTenant) or $this->tenantStarted) { // A domain has been already started return false; } $this->currentTenant = new \Innomatic\Domain\Domain($this->rootDb, $tenantId, null); if ($this->currentTenant->isValid()) { // Check if domain is active // if ($this->getInterface() != \Innomatic\Core\InnomaticContainer::INTERFACE_WEB and $this->currentTenant->domaindata['domainactive'] == $this->rootDb->fmtfalse) { $this->abort('Domain disabled'); } if (!$this->currentTenant->getDataAccess()->isConnected()) { $adloc = new \Innomatic\Locale\LocaleCatalog('innomatic::authentication', $this->language); $this->abort($adloc->getStr('nodb')); } // Adds override classes folder to the include path. set_include_path($this->home . 'core/domains/' . $this->currentTenant->getDomainId() . '/overrides/classes/' . PATH_SEPARATOR . get_include_path()); // User // // TODO check in single tenant edition if the admin@domainid part is ok // $admin_username = '******' // .(\Innomatic\Core\InnomaticContainer::instance( // '\Innomatic\Core\InnomaticContainer' // )->getEdition() == \Innomatic\Core\InnomaticContainer::EDITION_MULTITENANT ? '@'.$domain // : ''); $this->currentUser = new \Innomatic\Domain\User\User($this->currentTenant->domainserial, \Innomatic\Domain\User\User::getUserIdByUsername(strlen($userId) ? $userId : 'admin@' . $tenantId)); $result = true; } $this->tenantStarted = $result; return $result; }
function main_editprofile($eventData) { global $innomaticLocale, $wuiMainFrame, $wuiTitleBar; $profilesQuery = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getDataAccess()->execute('SELECT * FROM webservices_profiles WHERE id=' . $eventData['profileid']); $profileData = $profilesQuery->getFields(); $methodsQuery = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getDataAccess()->execute('SELECT application,name,unsecure,catalog FROM webservices_methods ORDER BY application, name'); if ($methodsQuery->getNumberRows()) { $nodes = $sec = $desc = array(); $prevCatalog = $tmpLocale = ''; while (!$methodsQuery->eof) { $nodes[$methodsQuery->getFields('application')][] = $methodsQuery->getFields('name'); $sec[$methodsQuery->getFields('application')][$methodsQuery->getFields('name')] = $methodsQuery->getFields('unsecure') == \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getDataAccess()->fmttrue ? false : true; $tmpDescription = ''; if (strlen($methodsQuery->getFields('catalog'))) { if ($prevCatalog != $methodsQuery->getFields('catalog')) { $tmpLocale = new \Innomatic\Locale\LocaleCatalog($methodsQuery->getFields('catalog'), \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getLanguage()); } $desc[$methodsQuery->getFields('application')][$methodsQuery->getFields('name')] = $tmpLocale->getStr($methodsQuery->getFields('name')); $prevCatalog = $methodsQuery->getFields('catalog'); } $methodsQuery->moveNext(); } $row = 0; $headers[0]['label'] = ''; $headers[1]['label'] = $innomaticLocale->getStr('xmlrpcapplication_header'); $headers[2]['label'] = ''; $headers[3]['label'] = $innomaticLocale->getStr('webservicesmethod_header'); $headers[4]['label'] = $innomaticLocale->getStr('docstring_header'); $headers[5]['label'] = $innomaticLocale->getStr('security_header'); $wuiMethodsTable = new WuiTable('methodstable', array('headers' => $headers, 'rowsperpage' => '15', 'pagesactionfunction' => 'editprofile_list_action_builder', 'pagenumber' => isset($eventData['editprofilepage']) ? $eventData['editprofilepage'] : '', 'sessionobjectusername' => $eventData['profileid'])); while (list($application, $methods) = each($nodes)) { $xprofile = new \Innomatic\Webservices\WebServicesProfile(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getDataAccess(), $eventData['profileid']); $nodeState = $xprofile->NodeCheck(\Innomatic\Webservices\WebServicesProfile::NODETYPE_APPLICATION, $application); switch ($nodeState) { case \Innomatic\Webservices\WebServicesProfile::APPLICATIONNODE_FULLYENABLED: $icon = $wuiMainFrame->mThemeHandler->mStyle['greenball']; $enabled = true; break; case \Innomatic\Webservices\WebServicesProfile::APPLICATIONNODE_PARTIALLYENABLED: $icon = $wuiMainFrame->mThemeHandler->mStyle['goldball']; $enabled = true; break; case \Innomatic\Webservices\WebServicesProfile::APPLICATIONNODE_NOTENABLED: $icon = $wuiMainFrame->mThemeHandler->mStyle['redball']; $enabled = false; break; } $wuiMethodsTable->addChild(new WuiImage('statusimage' . $row, array('imageurl' => $icon)), $row, 0); $wuiMethodsTable->addChild(new WuiLabel('applicationlabel' . $row, array('label' => $application)), $row, 1); $wuiApplicationToolBar[$row] = new WuiHorizgroup('applicationtoolbar' . $row); if ($enabled) { $disableAction[$row] = new \Innomatic\Wui\Dispatch\WuiEventsCall(); $disableAction[$row]->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('view', 'editprofile', array('profileid' => $eventData['profileid']))); $disableAction[$row]->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('action', 'disablenode', array('nodetype' => \Innomatic\Webservices\WebServicesProfile::NODETYPE_APPLICATION, 'application' => $application, 'profileid' => $eventData['profileid']))); $wuiDisableButton[$row] = new WuiButton('disablebutton' . $row, array('label' => $innomaticLocale->getStr('disablenode_label'), 'horiz' => 'true', 'themeimage' => 'lock', 'themeimagetype' => 'mini', 'action' => $disableAction[$row]->getEventsCallString())); $wuiApplicationToolBar[$row]->addChild($wuiDisableButton[$row]); } if (!$enabled or $nodeState == \Innomatic\Webservices\WebServicesProfile::APPLICATIONNODE_PARTIALLYENABLED) { $enableAction[$row] = new \Innomatic\Wui\Dispatch\WuiEventsCall(); $enableAction[$row]->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('view', 'editprofile', array('profileid' => $eventData['profileid']))); $enableAction[$row]->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('action', 'enablenode', array('nodetype' => \Innomatic\Webservices\WebServicesProfile::NODETYPE_APPLICATION, 'application' => $application, 'profileid' => $eventData['profileid']))); $wuiEnableButton[$row] = new WuiButton('enablebutton' . $row, array('label' => $innomaticLocale->getStr('enablenode_label'), 'horiz' => 'true', 'themeimage' => 'unlock', 'themeimagetype' => 'mini', 'action' => $enableAction[$row]->getEventsCallString())); $wuiApplicationToolBar[$row]->addChild($wuiEnableButton[$row]); } $wuiMethodsTable->addChild($wuiApplicationToolBar[$row], $row, 6); $row++; while (list(, $method) = each($methods)) { $nodeState = $xprofile->NodeCheck(\Innomatic\Webservices\WebServicesProfile::NODETYPE_METHOD, $application, $method); switch ($nodeState) { case \Innomatic\Webservices\WebServicesProfile::METHODNODE_ENABLED: $icon = $wuiMainFrame->mThemeHandler->mStyle['greenball']; $enabled = true; break; case \Innomatic\Webservices\WebServicesProfile::METHODNODE_NOTENABLED: $icon = $wuiMainFrame->mThemeHandler->mStyle['redball']; $enabled = false; break; } $wuiMethodsTable->addChild(new WuiImage('statusimage' . $row, array('imageurl' => $icon)), $row, 2); $wuiMethodsTable->addChild(new WuiLabel('methodlabel' . $row, array('label' => $method)), $row, 3); $img = $sec[$application][$method] == true ? 'buttonok' : 'buttoncancel'; $secureImage = $wuiMethodsTable->mThemeHandler->mIconsBase . $wuiMethodsTable->mThemeHandler->mIconsSet['icons'][$img]['base'] . '/icons/' . $wuiMethodsTable->mThemeHandler->mIconsSet['icons'][$img]['file']; $wuiMethodsTable->addChild(new WuiLabel('desclabel' . $row, array('label' => $desc[$application][$method])), $row, 4); $wuiMethodsTable->addChild(new WuiImage('secure' . $row, array('imageurl' => $secureImage, 'width' => 20, 'heigth' => 20)), $row, 5); $wuiMethodToolbar[$row] = new WuiHorizgroup('methodtoolbar' . $row); if ($enabled) { $disableAction[$row] = new \Innomatic\Wui\Dispatch\WuiEventsCall(); $disableAction[$row]->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('view', 'editprofile', array('profileid' => $eventData['profileid']))); $disableAction[$row]->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('action', 'disablenode', array('nodetype' => \Innomatic\Webservices\WebServicesProfile::NODETYPE_METHOD, 'method' => $method, 'application' => $application, 'profileid' => $eventData['profileid']))); $wuiDisableButton[$row] = new WuiButton('disablebutton' . $row, array('label' => $innomaticLocale->getStr('disablenode_label'), 'horiz' => 'true', 'themeimage' => 'lock', 'themeimagetype' => 'mini', 'action' => $disableAction[$row]->getEventsCallString())); $wuiMethodToolbar[$row]->addChild($wuiDisableButton[$row]); } else { $enableAction[$row] = new \Innomatic\Wui\Dispatch\WuiEventsCall(); $enableAction[$row]->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('view', 'editprofile', array('profileid' => $eventData['profileid']))); $enableAction[$row]->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('action', 'enablenode', array('nodetype' => \Innomatic\Webservices\WebServicesProfile::NODETYPE_METHOD, 'method' => $method, 'application' => $application, 'profileid' => $eventData['profileid']))); $wuiEnableButton[$row] = new WuiButton('enablebutton' . $row, array('label' => $innomaticLocale->getStr('enablenode_label'), 'horiz' => 'true', 'themeimage' => 'unlock', 'themeimagetype' => 'mini', 'action' => $enableAction[$row]->getEventsCallString())); $wuiMethodToolbar[$row]->addChild($wuiEnableButton[$row]); } $wuiMethodsTable->addChild($wuiMethodToolbar[$row], $row, 6); $row++; } } $wuiMainFrame->addChild($wuiMethodsTable); } $wuiTitleBar->mArgs['title'] .= ' - ' . $profileData['profilename'] . ' - ' . $innomaticLocale->getStr('editprofile_title'); }
public function viewShowDomainConfig($eventData) { $dbtypes = \Innomatic\Dataaccess\DataAccessFactory::getDrivers(); $query = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getDataAccess()->execute('SELECT * FROM domains WHERE id=' . $eventData['domainid']); if ($query->getNumberRows()) { $domainData = $query->getFields(); // Retrieves the webapp skeleton catalog and localized name. $skeletonsQuery = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getDataAccess()->execute('SELECT catalog FROM webapps_skeletons ' . 'WHERE name=' . \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getDataAccess()->formatText($domainData['webappskeleton'])); $tmpLocale = new \Innomatic\Locale\LocaleCatalog($skeletonsQuery->getFields('catalog'), \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getLanguage()); $skeletonName = $tmpLocale->getStr($domainData['webappskeleton']); $wuiVGroup = new WuiVertgroup('vgroup'); $wuiDomainGrid = new WuiGrid('showdomaingrid', array('rows' => '6', 'cols' => '4')); // Domain fields // $wuiDomainGrid->addChild(new WuiLabel('basedatalabel', array('label' => $this->_localeCatalog->getStr('domain_base_data'), 'bold' => 'true')), 0, 0); $wuiDomainGrid->addChild(new WuiLabel('namelabel', array('label' => $this->_localeCatalog->getStr('domainname_label'))), 1, 0); $wuiDomainGrid->addChild(new WuiString('domainname', array('disp' => 'action', 'readonly' => 'true', 'value' => $domainData['domainname'])), 1, 1); $wuiDomainGrid->addChild(new WuiLabel('idlabel', array('label' => $this->_localeCatalog->getStr('domainid_label'))), 2, 0); $wuiDomainGrid->addChild(new WuiString('domainid', array('disp' => 'action', 'readonly' => 'true', 'value' => $domainData['domainid'])), 2, 1); $wuiDomainGrid->addChild(new WuiLabel('maxuserslabel', array('label' => $this->_localeCatalog->getStr('maxusers_label'))), 3, 0); $wuiDomainGrid->addChild(new WuiString('maxusers', array('disp' => 'action', 'readonly' => 'true', 'value' => $domainData['maxusers'])), 3, 1); $wuiDomainGrid->addChild(new WuiLabel('basedatalabel', array('label' => $this->_localeCatalog->getStr('webapp_data'), 'bold' => 'true')), 4, 0); $wuiDomainGrid->addChild(new WuiLabel('webappskeletonlabel', array('label' => $this->_localeCatalog->getStr('webappskeleton_label'))), 5, 0); $wuiDomainGrid->addChild(new WuiString('webappskeleton', array('disp' => 'action', 'readonly' => 'true', 'value' => $skeletonName)), 5, 1); $wuiDomainGrid->addChild(new WuiLabel('urllabel', array('label' => $this->_localeCatalog->getStr('webappurl_label'))), 6, 0); $wuiDomainGrid->addChild(new WuiString('webappurl', array('disp' => 'action', 'readonly' => 'true', 'value' => $domainData['webappurl'])), 6, 1); if (\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getEdition() == \Innomatic\Core\InnomaticContainer::EDITION_MULTITENANT) { // Database fields // $wuiDomainGrid->addChild(new WuiLabel('basedatalabel', array('label' => $this->_localeCatalog->getStr('database_data'), 'bold' => 'true')), 0, 2); $wuiDomainGrid->addChild(new WuiLabel('dbtypelabel', array('label' => $this->_localeCatalog->getStr('dataaccesstype_label'))), 1, 2); $wuiDomainGrid->addChild(new WuiString('dataaccesstype', array('disp' => 'action', 'readonly' => 'true', 'value' => $dbtypes[$domainData['dataaccesstype']])), 1, 3); $wuiDomainGrid->addChild(new WuiLabel('dbnamelabel', array('label' => $this->_localeCatalog->getStr('domaindaname_label'))), 2, 2); $wuiDomainGrid->addChild(new WuiString('domaindaname', array('disp' => 'action', 'readonly' => 'true', 'value' => $domainData['domaindaname'])), 2, 3); $wuiDomainGrid->addChild(new WuiLabel('dbhostlabel', array('label' => $this->_localeCatalog->getStr('dataaccesshost_label'))), 3, 2); $wuiDomainGrid->addChild(new WuiString('dataaccesshost', array('disp' => 'action', 'readonly' => 'true', 'value' => $domainData['dataaccesshost'])), 3, 3); $wuiDomainGrid->addChild(new WuiLabel('dbportlabel', array('label' => $this->_localeCatalog->getStr('dataaccessport_label'))), 4, 2); $wuiDomainGrid->addChild(new WuiString('dataaccessport', array('disp' => 'action', 'readonly' => 'true', 'value' => $domainData['dataaccessport'])), 4, 3); $wuiDomainGrid->addChild(new WuiLabel('dbuserlabel', array('label' => $this->_localeCatalog->getStr('dataaccessuser_label'))), 5, 2); $wuiDomainGrid->addChild(new WuiString('dataaccessuser', array('disp' => 'action', 'readonly' => 'true', 'value' => $domainData['dataaccessuser'])), 5, 3); $wuiDomainGrid->addChild(new WuiLabel('dbpasswordlabel', array('label' => $this->_localeCatalog->getStr('dataaccesspassword_label'))), 6, 2); $wuiDomainGrid->addChild(new WuiString('dataaccesspassword', array('disp' => 'action', 'readonly' => 'true', 'value' => $domainData['dataaccesspassword'])), 6, 3); } $wuiVGroup->addChild($wuiDomainGrid); $this->wuiMainframe->addChild($wuiVGroup); } $this->wuiTitlebar->mArgs['title'] .= ' - ' . $this->_localeCatalog->getStr('showdomainconfig_title'); }
public function SendReport($maintenanceResult) { $result = false; $cfg = @parse_ini_file($this->configurationFile); $email = isset($cfg['MaintenanceReportsEmail']) ? $cfg['MaintenanceReportsEmail'] : ''; if (isset($cfg['MaintenanceReportsEnabled']) and $cfg['MaintenanceReportsEnabled'] == '1' and strlen($email) and is_array($maintenanceResult)) { $result_text = ''; $locale = new \Innomatic\Locale\LocaleCatalog('innomatic::maintenance', \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getLanguage()); $tasks_list = $this->getTasksList(); foreach ($maintenanceResult as $task => $result) { $result_text .= "\n" . '--> ' . $tasks_list[$task]['description'] . "\n" . ($result ? $locale->getStr('report_task_ok.label') : $locale->getStr('report_task_failed.label')) . "\n"; } $result = mail($email, '[INNOMATIC MAINTENANCE REPORT] - Scheduled maintenance report about ' . \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getPlatformName() . '.' . \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getPlatformGroup(), 'This is the scheduled maintenance report about ' . \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getPlatformName() . '.' . \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getPlatformGroup() . "\n\n" . '== MAINTENANCE RESULTS ==' . "\n" . $result_text); } return $result; }
* LICENSE * * This source file is subject to the new BSD license that is bundled * 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 */ // NOTE: This is an old-style panel code with a single file // acting as model, view and controller. global $gLocale, $gPageStatus, $alertText; global $gXmlDefinition, $gLocale, $gPageTitle; $alertText = ''; $gLocale = new \Innomatic\Locale\LocaleCatalog('innomatic::root_security', \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getLanguage()); $gWui = \Innomatic\Wui\Wui::instance('\\Innomatic\\Wui\\Wui'); $gWui->loadWidget('xml'); $gWui->loadWidget('innomaticpage'); $gWui->loadWidget('innomatictoolbar'); $gXmlDefinition = $gPageStatus = ''; $gPageTitle = $gLocale->getStr('security.title'); $gToolbars['main'] = array('check' => array('label' => $gLocale->getStr('check.toolbar'), 'themeimage' => 'security', 'horiz' => 'true', 'action' => \Innomatic\Wui\Dispatch\WuiEventsCall::buildEventsCallString('', array(array('view', 'default', '')))), 'settings' => array('label' => $gLocale->getStr('settings.toolbar'), 'themeimage' => 'gear', 'horiz' => 'true', 'action' => \Innomatic\Wui\Dispatch\WuiEventsCall::buildEventsCallString('', array(array('view', 'settings', ''))))); $gToolbars['password'] = array('change_password' => array('label' => $gLocale->getStr('chpasswd_button'), 'themeimage' => 'key', 'horiz' => 'true', 'action' => \Innomatic\Wui\Dispatch\WuiEventsCall::buildEventsCallString('', array(array('view', 'change_password', ''))))); $gToolbars['help'] = array('help' => array('label' => $gLocale->getStr('help.toolbar'), 'themeimage' => 'info', 'horiz' => 'true', 'action' => \Innomatic\Wui\Dispatch\WuiEventsCall::buildEventsCallString('', array(array('view', 'help', ''))))); // ----- Action dispatcher ----- // $gActionDispatcher = new WuiDispatcher('action'); $gActionDispatcher->addEvent('set_security_preset', 'action_set_security_preset'); function action_set_security_preset($eventData) {
/** * 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(); }
private function fillDefinition() { $result = false; $container = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer'); if (!(strlen($this->mItemType) and $this->mItemId)) { return $result; } // Locale $locale = new \Innomatic\Locale\LocaleCatalog('innowork-core::misc', $container->getCurrentUser()->getLanguage()); // Core $tmp_innoworkcore = \Innowork\Core\InnoworkCore::instance('\\Innowork\\Core\\InnoworkCore', $container->getDataAccess(), $container->getCurrentDomain()->getDataAccess()); $summaries = $tmp_innoworkcore->getSummaries(); // Default parent ACL mode $parentAcl = false; // Item object if (isset($summaries[$this->mItemType]) and class_exists($summaries[$this->mItemType]['classname'])) { $class_name = $summaries[$this->mItemType]['classname']; $item_object = new $class_name($container->getDataAccess(), $container->getCurrentDomain()->getDataAccess(), $this->mItemId); $acl = $item_object->mAcl; // Check parent ACL mode if (strlen($item_object->mParentType) and $item_object->mParentId > 0) { $parentAcl = true; } } else { $item_object = null; // Access list require_once 'innowork/core/InnoworkAcl.php'; $acl = new InnoworkAcl($container->getDataAccess(), $container->getCurrentDomain()->getDataAccess(), $this->mItemType, $this->mItemId); } $tmp_acl_type = $acl->getType(); if (strlen($tmp_acl_type)) { $this->mAclType = $tmp_acl_type; } /* $acls_query = $container->getCurrentDomain()->getDataAccess()->execute( 'SELECT groupid, userid, rights '. 'FROM innowork_core_acls '. 'WHERE itemtype='.$container->getCurrentDomain()->getDataAccess()->formatText($acl->mItemType). ' '.'AND itemid='.$acl->mItemId ); */ $owner = ''; // Log if (isset($summaries[$this->mItemType]['loggable']) and $summaries[$this->mItemType]['loggable']) { require_once 'innowork/core/InnoworkItemLog.php'; $item_log = new InnoworkItemLog($this->mItemType, $this->mItemId); } if ($this->mItemOwnerId) { $owner_user = new \Innomatic\Domain\User\User($container->getCurrentDomain()->domaindata['id'], $this->mItemOwnerId); $owner_user_data = $owner_user->getUserData(); $owner = (strlen($owner_user_data['fname']) ? $owner_user_data['fname'] . ' ' : '') . $owner_user_data['lname']; } $acl_mode_sk = new \Shared\Wui\WuiSessionKey('innowork_acl_mode', array('sessionobjectnopage' => 'true')); if ($acl_mode_sk->mValue == 'advanced') { $acl_mode = 'advanced'; } else { $acl_mode = 'simple'; } $row = 0; if ($acl_mode == 'advanced') { $domainDa = $container->getCurrentDomain()->getDataAccess(); $groups_query = $domainDa->execute('SELECT id,groupname FROM domain_users_groups ORDER BY groupname'); $users_query = $domainDa->execute('SELECT id,groupid,username,fname,lname FROM domain_users WHERE disabled IS NULL or disabled <> ' . $domainDa->formatText($domainDa->fmttrue) . ' ORDER BY username'); $limited_acls = array(); $users = array(); while (!$users_query->eof) { $fname = $users_query->getFields('fname'); $lname = $users_query->getFields('lname'); if (strlen($fname) and strlen($lname)) { $tmp_username = $lname . ' ' . $fname; } else { $tmp_username = $users_query->getFields('username'); if (strpos($tmp_username, '@')) { $tmp_username = substr($tmp_username, 0, strpos($tmp_username, '@')); } } $users[$users_query->getFields('groupid')][$users_query->getFields('id')] = $tmp_username; $users_query->moveNext(); } while (!$groups_query->eof) { $group_perms = $acl->checkPermission($groups_query->getFields('id')); switch ($group_perms) { case InnoworkAcl::PERMS_NONE: $limited_acls['g' . $groups_query->getFields('id')] = '[-] ' . $groups_query->getFields('groupname'); break; case InnoworkAcl::PERMS_SEARCH: $limited_acls['g' . $groups_query->getFields('id')] = '[' . $locale->getStr('perm_search_short.label') . '] ' . $groups_query->getFields('groupname'); break; case InnoworkAcl::PERMS_READ: $limited_acls['g' . $groups_query->getFields('id')] = '[' . $locale->getStr('perm_read_short.label') . '] ' . $groups_query->getFields('groupname'); break; case InnoworkAcl::PERMS_EDIT: $limited_acls['g' . $groups_query->getFields('id')] = '[' . $locale->getStr('perm_edit_short.label') . '] ' . $groups_query->getFields('groupname'); break; case InnoworkAcl::PERMS_DELETE: $limited_acls['g' . $groups_query->getFields('id')] = '[' . $locale->getStr('perm_delete_short.label') . '] ' . $groups_query->getFields('groupname'); break; case InnoworkAcl::PERMS_ALL: $limited_acls['g' . $groups_query->getFields('id')] = '[+] ' . $groups_query->getFields('groupname'); break; } /* $limited_acls['g'.$groups_query->getFields( 'id' )] = ( > InnoworkAcl::PERMS_NONE ? '[+] ' : '[-] ' ). $groups_query->getFields( 'groupname' ); */ foreach ($users[$groups_query->getFields('id')] as $id => $username) { $user_perms = $acl->checkPermission('', $id); /* $limited_acls['u'.$id] = '-> '. ( $acl->checkPermission( '', $id ) > InnoworkAcl::PERMS_NONE ? '[+] ' : '[-] ' ). $username; */ if ($id == $this->mItemOwnerId) { $limited_acls['u' . $id] = '- ' . '[+] ' . $username; } else { switch ($user_perms) { case InnoworkAcl::PERMS_NONE: $limited_acls['u' . $id] = '- ' . '[-] ' . $username; break; case InnoworkAcl::PERMS_SEARCH: $limited_acls['u' . $id] = '- ' . '[' . $locale->getStr('perm_search_short.label') . '] ' . $username; break; case InnoworkAcl::PERMS_READ: $limited_acls['u' . $id] = '- ' . '[' . $locale->getStr('perm_read_short.label') . '] ' . $username; break; case InnoworkAcl::PERMS_EDIT: $limited_acls['u' . $id] = '- ' . '[' . $locale->getStr('perm_edit_short.label') . '] ' . $username; break; case InnoworkAcl::PERMS_DELETE: $limited_acls['u' . $id] = '- ' . '[' . $locale->getStr('perm_delete_short.label') . '] ' . $username; break; case InnoworkAcl::PERMS_ALL: $limited_acls['u' . $id] = '- ' . '[+] ' . $username; break; } } } $groups_query->MoveNext(); } $limited_acls['g0'] = '[-] No group'; foreach ($users[0] as $id => $username) { $limited_acls['u' . $id] = '-> ' . ($acl->checkPermission('', $id) > InnoworkAcl::PERMS_NONE ? '[+] ' : '[-] ') . $username; } } // Clippings require_once 'innowork/core/clipping/InnoworkClipping.php'; $innowork_clippings = new InnoworkClipping($container->getDataAccess(), $container->getCurrentDomain()->getDataAccess()); $clippings_search = $innowork_clippings->search(''); $clippings = array(); if ($this->mItemType != 'defaultaclitem' and count($clippings_search)) { foreach ($clippings_search as $id => $data) { $clippings[$id] = $data['name']; } } $item_actions = array(); // Other items widget actions if (is_object($item_object) && $acl->checkPermission('', $container->getCurrentUser()->getUserId()) > InnoworkAcl::PERMS_NONE) { foreach ($summaries as $item_type => $item_desc) { if ($item_type == $this->mItemType) { continue; } $tmp_class = $item_desc['classname']; $tmp_obj = new $tmp_class($container->getDataAccess(), $container->getCurrentDomain()->getDataAccess()); $item_action = $tmp_obj->getExternalItemWidgetXmlData($item_object); if (strlen($item_action)) { $item_actions[] = $item_action; } } } if ($acl->checkPermission('', $container->getCurrentUser()->getUserId()) == InnoworkAcl::PERMS_NONE) { $this->mDefinition = '<empty/>'; } elseif (!$parentAcl and ($this->mItemOwnerId == $container->getCurrentUser()->getUserId() or User::isAdminUser($container->getCurrentUser()->getUserName(), $container->getCurrentDomain()->getDomainId()) or $acl->checkPermission('', $container->getCurrentUser()->getUserId()) >= InnoworkAcl::PERMS_RESPONSIBLE)) { $this->mDefinition = ' <empty><name>innoworkitemacl</name> <children> <form><name>opts' . md5($this->mItemType . '-' . $this->mItemId) . '</name> <args> <action>' . WuiXml::cdata($this->mDefaultAction) . '</action> </args> <children> <formarg><name>aclmode</name> <args> <disp>wui</disp> <value>' . ($acl_mode == 'advanced' ? 'simple' : 'advanced') . '</value> </args> </formarg> </children> </form> <table><name>acl</name> <args> <headers type="array">' . WuiXml::encode(array('0' => array('label' => $locale->getStr('item_properties.label')))) . '</headers> </args> <children>'; if (count($item_actions)) { foreach ($item_actions as $item_action) { $this->mDefinition .= '<vertgroup row="' . $row++ . '" col="0"><children>'; $this->mDefinition .= $item_action; $this->mDefinition .= '</children></vertgroup>'; } } $this->mDefinition .= '<vertgroup row="' . $row++ . '" col="0" halign="" valign="" nowrap="true"> <children> <form><name>itemacl' . md5($this->mItemType . '-' . $this->mItemId) . '</name> <args> <method>post</method> <action>' . WuiXml::cdata($this->mDefaultAction) . '</action> </args> <children> <vertgroup><name>vg</name><children> <horizgroup> <args> <align>middle</align> <width>0%</width> </args> <children> <button> <args> <themeimage>lock</themeimage> <themeimagetype>mini</themeimagetype> <compact>true</compact> </args> </button> <label><name>convert</name> <args> <bold>true</bold> <label type="encoded">' . WuiXml::cdata(urlencode($locale->getStr('access_mode.label'))) . '</label> <compact>true</compact> </args> </label> </children> </horizgroup> '; if (strlen($owner)) { $this->mDefinition .= ' <label><name>owner</name> <args> <bold>true</bold> <label type="encoded">' . WuiXml::cdata(urlencode(sprintf($locale->getStr('owner.label'), $owner))) . '</label> </args> </label>'; } // Only the owner and the root user can change the acl type if ($this->mItemOwnerId == $container->getCurrentUser()->getUserId() or User::isAdminUser($container->getCurrentUser()->getUserName(), $container->getCurrentDomain()->getDomainId())) { $this->mDefinition .= ' <formarg><name>aclitemtype</name><args><disp>wui</disp><value>' . $this->mItemType . '</value></args></formarg> <formarg><name>aclitemid</name><args><disp>wui</disp><value>' . $this->mItemId . '</value></args></formarg> <radio><name>acltype</name> <args> <disp>wui</disp> <value>' . InnoworkAcl::TYPE_PRIVATE . '</value> <label type="encoded">' . WuiXml::cdata(urlencode($locale->getStr('acl_type_private.label'))) . '</label> <checked>' . ($this->mAclType == InnoworkAcl::TYPE_PRIVATE ? 'true' : 'false') . '</checked> </args> </radio> <radio><name>acltype</name> <args> <disp>wui</disp> <value>' . InnoworkAcl::TYPE_PUBLIC . '</value> <label type="encoded">' . WuiXml::cdata(urlencode($locale->getStr('acl_type_public.label'))) . '</label> <checked>' . ($this->mAclType == InnoworkAcl::TYPE_PUBLIC ? 'true' : 'false') . '</checked> </args> </radio> <radio><name>acltype</name> <args> <disp>wui</disp> <value>' . InnoworkAcl::TYPE_ACL . '</value> <label type="encoded">' . WuiXml::cdata(urlencode($locale->getStr('acl_type_acl.label'))) . '</label> <checked>' . ($this->mAclType == InnoworkAcl::TYPE_ACL ? 'true' : 'false') . '</checked> </args> </radio>'; } else { $this->mDefinition .= ' <label><name>acltype</name> <args> <label type="encoded">' . WuiXml::cdata(urlencode($locale->getStr('acl_type_private.label'))) . '</label> <bold>' . ($this->mAclType == InnoworkAcl::TYPE_PRIVATE ? 'true' : 'false') . '</bold> </args> </label> <label><name>acltype</name> <args> <label type="encoded">' . WuiXml::cdata(urlencode($locale->getStr('acl_type_public.label'))) . '</label> <bold>' . ($this->mAclType == InnoworkAcl::TYPE_PUBLIC ? 'true' : 'false') . '</bold> </args> </label> <label><name>acltype</name> <args> <label type="encoded">' . WuiXml::cdata(urlencode($locale->getStr('acl_type_acl.label'))) . '</label> <bold>' . ($this->mAclType == InnoworkAcl::TYPE_ACL ? 'true' : 'false') . '</bold> </args> </label>'; } $this->mDefinition .= ' </children></vertgroup> </children> </form> <horizgroup><args><width>0%</width></args> <children>'; if ($this->mItemOwnerId == $container->getCurrentUser()->getUserId() or $container->getCurrentDomain()->getDomainId() == $container->getCurrentUser()->getUserName()) { $this->mDefinition .= ' <button><name>setactl</name> <args> <action>' . WuiXml::cdata($this->mDefaultAction) . '</action> <formsubmit>itemacl' . md5($this->mItemType . '-' . $this->mItemId) . '</formsubmit> <horiz>true</horiz> <frame>false</frame> <themeimage>buttonok</themeimage> <themeimagetype>mini</themeimagetype> <compact>true</compact> <label type="encoded">' . WuiXml::cdata(urlencode($locale->getStr('apply.submit'))) . '</label> </args> </button>'; } $this->mDefinition .= ' <button><name>setopts</name> <args> <action>' . WuiXml::cdata($this->mDefaultAction) . '</action> <formsubmit>opts' . md5($this->mItemType . '-' . $this->mItemId) . '</formsubmit> <horiz>true</horiz> <frame>false</frame> <themeimage>' . ($acl_mode == 'advanced' ? 'info' : 'info') . '</themeimage> <themeimagetype>mini</themeimagetype> <compact>true</compact> <label type="encoded">' . WuiXml::cdata(urlencode($locale->getStr($acl_mode == 'advanced' ? 'acl_simple.submit' : 'acl_advanced.submit'))) . '</label> </args> </button> </children> </horizgroup> </children> </vertgroup>'; if ($acl_mode == 'advanced') { if ($this->mAclType == InnoworkAcl::TYPE_ACL) { $this->mDefinition .= '<vertgroup row="' . $row++ . '" col="0"> <children> <form><name>limitedacl' . md5($this->mItemType . '-' . $this->mItemId) . '</name> <args> <action>' . WuiXml::cdata($this->mDefaultAction) . '</action> </args> <children> <horizgroup> <args> <align>top</align><width>0%</width> </args> <children> <listbox><name>limitedacl</name> <args> <disp>wui</disp> <elements type="array">' . WuiXml::encode($limited_acls) . '</elements> <multiselect>true</multiselect> <size>10</size> </args> </listbox> <vertgroup> <args> <align>left</align> </args> <children> <radio><name>aclperms</name> <args> <disp>wui</disp> <label type="encoded">' . WuiXml::cdata(urlencode($locale->getStr('perm_all.label'))) . '</label> <value>' . InnoworkAcl::PERMS_ALL . '</value> <checked>true</checked> </args> </radio> <radio><name>aclperms</name> <args> <disp>wui</disp> <label type="encoded">' . WuiXml::cdata(urlencode($locale->getStr('perm_delete.label'))) . '</label> <value>' . InnoworkAcl::PERMS_DELETE . '</value> </args> </radio> <radio><name>aclperms</name> <args> <disp>wui</disp> <label type="encoded">' . WuiXml::cdata(urlencode($locale->getStr('perm_edit.label'))) . '</label> <value>' . InnoworkAcl::PERMS_EDIT . '</value> </args> </radio> <radio><name>aclperms</name> <args> <disp>wui</disp> <label type="encoded">' . WuiXml::cdata(urlencode($locale->getStr('perm_read.label'))) . '</label> <value>' . InnoworkAcl::PERMS_READ . '</value> </args> </radio> <radio><name>aclperms</name> <args> <disp>wui</disp> <label type="encoded">' . WuiXml::cdata(urlencode($locale->getStr('perm_search.label'))) . '</label> <value>' . InnoworkAcl::PERMS_SEARCH . '</value> </args> </radio> </children> </vertgroup> </children> </horizgroup> <formarg><name>aclitemtype</name><args><disp>wui</disp><value>' . $this->mItemType . '</value></args></formarg> <formarg><name>aclitemid</name><args><disp>wui</disp><value>' . $this->mItemId . '</value></args></formarg> </children> </form> <horizgroup> <args><width>0%</width></args> <children> <button><name>add</name> <args> <action>' . WuiXml::cdata($this->mDefaultAction . '&wui[wui][evn]=innoworkacladd') . '</action> <formsubmit>limitedacl' . md5($this->mItemType . '-' . $this->mItemId) . '</formsubmit> <horiz>true</horiz> <frame>false</frame> <themeimage>useradd</themeimage> <themeimagetype>mini</themeimagetype> <compact>true</compact> <label type="encoded">' . WuiXml::cdata(urlencode($locale->getStr('add_acl.submit'))) . '</label> </args> </button> <button><name>remove</name> <args> <action>' . WuiXml::cdata($this->mDefaultAction . '&wui[wui][evn]=innoworkaclremove') . '</action> <formsubmit>limitedacl' . md5($this->mItemType . '-' . $this->mItemId) . '</formsubmit> <horiz>true</horiz> <frame>false</frame> <themeimage>userremove</themeimage> <themeimagetype>mini</themeimagetype> <compact>true</compact> <label type="encoded">' . WuiXml::cdata(urlencode($locale->getStr('remove_acl.submit'))) . '</label> </args> </button> </children> </horizgroup> </children> </vertgroup>'; } /* $this->mDefinition .= '<form row="'.$row++.'" col="0" halign="" valign="" nowrap="true"><name>responsibles'.md5( $this->mItemType.'-'.$this->mItemId ).'</name> <args> </args> <children> <listbox><name>responsibles</name> <args> <disp>wui</disp> <size>2</size> </args> </listbox> </children> </form> <form row="'.$row++.'" col="0" halign="" valign="" nowrap="true"><name>participants'.md5( $this->mItemType.'-'.$this->mItemId ).'</name> <args> </args> <children> <listbox><name>participants</name> <args> <disp>wui</disp> <size>2</size> </args> </listbox> </children> </form>'; */ if ($summaries[$this->mItemType]['loggable']) { $this->mDefinition .= '<vertgroup row="' . $row++ . '" col="0"> <children> <horizgroup> <args> <align>middle</align><width>0%</width> </args> <children> <button> <args> <themeimage>alignright</themeimage> <themeimagetype>mini</themeimagetype> <compact>true</compact> </args> </button> <label><name>itemlog</name> <args> <bold>true</bold> <label type="encoded">' . WuiXml::cdata(urlencode($locale->getStr('history.label'))) . '</label> <compact>true</compact> </args> </label> </children> </horizgroup> <listbox><name>itemlog</name> <args> <readonly>true</readonly> <elements type="array">' . WuiXml::encode(array_reverse($item_log->GetLog())) . '</elements> <size>3</size> </args> </listbox> </children> </vertgroup>'; } if ($summaries[$this->mItemType]['convertible']) { $convert_types = array(); foreach ($summaries as $type => $item) { if ($item['convertible'] and $type != $this->mItemType) { $tmp_locale = new \Innomatic\Locale\LocaleCatalog($item['catalog'], $container->getCurrentUser()->getLanguage()); $convert_types[$type] = $tmp_locale->getStr($type); unset($tmp_locale); } } if (count($convert_types)) { $this->mDefinition .= '<vertgroup row="' . $row++ . '" col="0"> <children> <horizgroup> <args> <align>middle</align><width>0%</width> </args> <children> <button> <args> <themeimage>elementadd</themeimage> <themeimagetype>mini</themeimagetype> <compact>true</compact> </args> </button> <label><name>convert</name> <args> <bold>true</bold> <label type="encoded">' . WuiXml::cdata(urlencode($locale->getStr('convert.label'))) . '</label> <compact>true</compact> </args> </label> </children> </horizgroup> <form><name>convert' . md5($this->mItemType . '-' . $this->mItemId) . '</name> <args> <action>' . WuiXml::cdata($this->mDefaultAction) . '</action> </args> <children> <horizgroup> <args> <align>middle</align><width>0%</width> </args> <children> <combobox><name>type</name> <args> <disp>wui</disp> <elements type="array">' . WuiXml::encode($convert_types) . '</elements> </args> </combobox> <button><name>convert</name> <args> <horiz>true</horiz> <frame>false</frame> <themeimage>arrowright</themeimage> <themeimagetype>mini</themeimagetype> <compact>true</compact> <formsubmit>convert' . md5($this->mItemType . '-' . $this->mItemId) . '</formsubmit> <action>' . WuiXml::cdata($this->mDefaultAction . '&wui[wui][evn]=innoworkconvert') . '</action> </args> </button> <formarg><name>aclitemtype</name><args><disp>wui</disp><value>' . $this->mItemType . '</value></args></formarg> <formarg><name>aclitemid</name><args><disp>wui</disp><value>' . $this->mItemId . '</value></args></formarg> </children> </horizgroup> </children> </form> </children> </vertgroup>'; } } // Clippings if (count($clippings)) { $this->mDefinition .= '<vertgroup row="' . $row++ . '" col="0"> <children> <horizgroup> <args> <align>middle</align><width>0%</width> </args> <children> <button> <args> <themeimage>clip</themeimage> <themeimagetype>mini</themeimagetype> <compact>true</compact> </args> </button> <label><name>clipping</name> <args> <bold>true</bold> <label type="encoded">' . WuiXml::cdata(urlencode($locale->getStr('clipping.label'))) . '</label> <compact>true</compact> </args> </label> </children> </horizgroup> <form><name>clipping' . md5($this->mItemType . '-' . $this->mItemId) . '</name> <args> <action>' . WuiXml::cdata($this->mDefaultAction) . '</action> </args> <children> <horizgroup> <args> <align>middle</align><width>0%</width> </args> <children> <combobox><name>clippingid</name> <args> <disp>wui</disp> <elements type="array">' . WuiXml::encode($clippings) . '</elements> </args> </combobox> <button><name>clipping</name> <args> <horiz>true</horiz> <frame>false</frame> <themeimage>arrowright</themeimage> <themeimagetype>mini</themeimagetype> <compact>true</compact> <formsubmit>clipping' . md5($this->mItemType . '-' . $this->mItemId) . '</formsubmit> <action>' . WuiXml::cdata($this->mDefaultAction . '&wui[wui][evn]=innoworkaddtoclipping') . '</action> </args> </button> <formarg><name>aclitemtype</name><args><disp>wui</disp><value>' . $this->mItemType . '</value></args></formarg> <formarg><name>aclitemid</name><args><disp>wui</disp><value>' . $this->mItemId . '</value></args></formarg> </children> </horizgroup> </children> </form> </children> </vertgroup>'; } } if (isset($GLOBALS['innoworkcore']['itemacl'][$this->mItemType][$this->mItemId])) { $this->mDefinition .= '<label row="' . $row++ . '" col="0"> <args> <label type="encoded">' . WuiXml::cdata(urlencode($locale->getStr('acl_changed.label'))) . '</label> <bold>true</bold> </args> </label>'; } $this->mDefinition .= ' </children> </table> </children> </empty>'; } else { $this->mDefinition = ' <empty><name>innoworkitemacl</name> <children> <form><name>opts' . md5($this->mItemType . '-' . $this->mItemId) . '</name> <args> <action>' . WuiXml::cdata($this->mDefaultAction) . '</action> </args> <children> <formarg><name>aclmode</name> <args> <disp>wui</disp> <value>' . ($acl_mode == 'advanced' ? 'simple' : 'advanced') . '</value> </args> </formarg> </children> </form> <table><name>acl</name> <args> <headers type="array">' . WuiXml::encode(array('0' => array('label' => $locale->getStr('item_properties.label')))) . '</headers> </args> <children>'; if (count($item_actions)) { foreach ($item_actions as $item_action) { $this->mDefinition .= '<vertgroup row="' . $row++ . '" col="0"><children>'; $this->mDefinition .= $item_action; $this->mDefinition .= '</children></vertgroup>'; } } $this->mDefinition .= ' <vertgroup row="' . $row++ . '" col="0" halign="" valign="" nowrap="true"><name>vg</name><children> <horizgroup> <args> <align>middle</align><width>0%</width> </args> <children> <button> <args> <themeimage>lock</themeimage> <themeimagetype>mini</themeimagetype> <compact>true</compact> </args> </button> <label><name>convert</name> <args> <bold>true</bold> <label type="encoded">' . WuiXml::cdata(urlencode($locale->getStr('access_mode.label'))) . '</label> <compact>true</compact> </args> </label> </children> </horizgroup>'; if (strlen($owner)) { $this->mDefinition .= ' <label><name>owner</name> <args> <bold>true</bold> <label type="encoded">' . WuiXml::cdata(urlencode(sprintf($locale->getStr('owner.label'), $owner))) . '</label> </args> </label>'; } $this->mDefinition .= ' <label><name>acltype</name> <args> <label type="encoded">' . WuiXml::cdata(urlencode($locale->getStr('acl_type_private.label'))) . '</label> <bold>' . ($this->mAclType == InnoworkAcl::TYPE_PRIVATE ? 'true' : 'false') . '</bold> </args> </label> <label><name>acltype</name> <args> <label type="encoded">' . WuiXml::cdata(urlencode($locale->getStr('acl_type_public.label'))) . '</label> <bold>' . ($this->mAclType == InnoworkAcl::TYPE_PUBLIC ? 'true' : 'false') . '</bold> </args> </label> <label><name>acltype</name> <args> <label type="encoded">' . WuiXml::cdata(urlencode($locale->getStr('acl_type_acl.label'))) . '</label> <bold>' . ($this->mAclType == InnoworkAcl::TYPE_ACL ? 'true' : 'false') . '</bold> </args> </label> <horizgroup><args><width>0%</width></args> <children> <button><name>setopts</name> <args> <action>' . WuiXml::cdata($this->mDefaultAction) . '</action> <formsubmit>opts' . md5($this->mItemType . '-' . $this->mItemId) . '</formsubmit> <horiz>true</horiz> <frame>false</frame> <themeimage>' . ($acl_mode == 'advanced' ? 'info' : 'info') . '</themeimage> <themeimagetype>mini</themeimagetype> <compact>true</compact> <label type="encoded">' . WuiXml::cdata(urlencode($locale->getStr($acl_mode == 'advanced' ? 'acl_simple.submit' : 'acl_advanced.submit'))) . '</label> </args> </button> </children> </horizgroup> </children> </vertgroup>'; if ($acl_mode == 'advanced') { if ($this->mAclType == InnoworkAcl::TYPE_ACL) { $this->mDefinition .= '<form row="' . $row++ . '" col="0"><name>limitedacl' . md5($this->mItemType . '-' . $this->mItemId) . '</name> <args> <action>' . WuiXml::cdata($this->mDefaultAction) . '</action> </args> <children> <listbox><name>limitedacl</name> <args> <disp>wui</disp> <elements type="array">' . WuiXml::encode($limited_acls) . '</elements> <multiselect>true</multiselect> <size>10</size> </args> </listbox> <formarg><name>aclitemtype</name><args><disp>wui</disp><value>' . $this->mItemType . '</value></args></formarg> <formarg><name>aclitemid</name><args><disp>wui</disp><value>' . $this->mItemId . '</value></args></formarg> </children> </form>'; } if ($summaries[$this->mItemType]['loggable']) { $this->mDefinition .= '<vertgroup row="' . $row++ . '" col="0"> <children> <horizgroup> <args> <align>middle</align><width>0%</width> </args> <children> <button> <args> <themeimage>alignright</themeimage> <themeimagetype>mini</themeimagetype> <compact>true</compact> </args> </button> <label><name>convert</name> <args> <bold>true</bold> <label type="encoded">' . WuiXml::cdata(urlencode($locale->getStr('history.label'))) . '</label> <compact>true</compact> </args> </label> </children> </horizgroup> <listbox><name>itemlog</name> <args> <readonly>true</readonly> <elements type="array">' . WuiXml::encode(array_reverse($item_log->GetLog())) . '</elements> <size>3</size> </args> </listbox> </children> </vertgroup>'; } if ($summaries[$this->mItemType]['convertible']) { $convert_types = array(); foreach ($summaries as $type => $item) { if ($item['convertible'] and $type != $this->mItemType) { $tmp_locale = new \Innomatic\Locale\LocaleCatalog($item['catalog'], $container->getCurrentUser()->getLanguage()); $convert_types[$type] = $tmp_locale->getStr($type); unset($tmp_locale); } } if (count($convert_types)) { $this->mDefinition .= '<vertgroup row="' . $row++ . '" col="0"> <children> <horizgroup> <args> <align>middle</align><width>0%</width> </args> <children> <button> <args> <themeimage>elementadd</themeimage> <themeimagetype>mini</themeimagetype> <compact>true</compact> </args> </button> <label><name>convert</name> <args> <bold>true</bold> <label type="encoded">' . WuiXml::cdata(urlencode($locale->getStr('convert.label'))) . '</label> <compact>true</compact> </args> </label> </children> </horizgroup> <form><name>convert' . md5($this->mItemType . '-' . $this->mItemId) . '</name> <args> <action>' . WuiXml::cdata($this->mDefaultAction) . '</action> </args> <children> <horizgroup> <args> <align>middle</align><width>0%</width> </args> <children> <combobox><name>type</name> <args> <disp>wui</disp> <elements type="array">' . WuiXml::encode($convert_types) . '</elements> </args> </combobox> <button><name>convert</name> <args> <horiz>true</horiz> <frame>false</frame> <themeimage>arrowright</themeimage> <themeimagetype>mini</themeimagetype> <compact>true</compact> <formsubmit>convert' . md5($this->mItemType . '-' . $this->mItemId) . '</formsubmit> <action>' . WuiXml::cdata($this->mDefaultAction . '&wui[wui][evn]=innoworkconvert') . '</action> </args> </button> <formarg><name>aclitemtype</name><args><disp>wui</disp><value>' . $this->mItemType . '</value></args></formarg> <formarg><name>aclitemid</name><args><disp>wui</disp><value>' . $this->mItemId . '</value></args></formarg> </children> </horizgroup> </children> </form> </children> </vertgroup>'; } } // Clippings if (count($clippings)) { $this->mDefinition .= '<vertgroup row="' . $row++ . '" col="0"> <children> <horizgroup> <args> <align>middle</align><width>0%</width> </args> <children> <button> <args> <themeimage>clip</themeimage> <themeimagetype>mini</themeimagetype> <compact>true</compact> </args> </button> <label><name>clipping</name> <args> <bold>true</bold> <label type="encoded">' . WuiXml::cdata(urlencode($locale->getStr('clipping.label'))) . '</label> <compact>true</compact> </args> </label> </children> </horizgroup> <form><name>clipping' . md5($this->mItemType . '-' . $this->mItemId) . '</name> <args> <action>' . WuiXml::cdata($this->mDefaultAction) . '</action> </args> <children> <horizgroup> <args> <align>middle</align><width>0%</width> </args> <children> <combobox><name>clippingid</name> <args> <disp>wui</disp> <elements type="array">' . WuiXml::encode($clippings) . '</elements> </args> </combobox> <button><name>clipping</name> <args> <horiz>true</horiz> <frame>false</frame> <themeimage>arrowright</themeimage> <themeimagetype>mini</themeimagetype> <compact>true</compact> <formsubmit>clipping' . md5($this->mItemType . '-' . $this->mItemId) . '</formsubmit> <action>' . WuiXml::cdata($this->mDefaultAction . '&wui[wui][evn]=innoworkaddtoclipping') . '</action> </args> </button> <formarg><name>aclitemtype</name><args><disp>wui</disp><value>' . $this->mItemType . '</value></args></formarg> <formarg><name>aclitemid</name><args><disp>wui</disp><value>' . $this->mItemId . '</value></args></formarg> </children> </horizgroup> </children> </form> </children> </vertgroup>'; } } $this->mDefinition .= ' </children> </table> </children> </empty>'; } $result = true; }
if (!strlen($country)) { $country = $container->getCountry(); } $args['dbname'] = $container->getConfig()->value('RootDatabaseName'); $args['dbhost'] = $container->getConfig()->value('RootDatabaseHost'); $args['dbport'] = $container->getConfig()->value('RootDatabasePort'); $args['dbuser'] = $container->getConfig()->value('RootDatabaseUser'); $args['dbpass'] = $container->getConfig()->value('RootDatabasePassword'); $args['dbtype'] = $container->getConfig()->value('RootDatabaseType'); $args['dblog'] = $container->getHome() . 'core/log/innomatic_root_db.log'; $dasn_string = $args['dbtype'] . '://' . $args['dbuser'] . ':' . $args['dbpass'] . '@' . $args['dbhost'] . ':' . $args['dbport'] . '/' . $args['dbname'] . '?' . 'logfile=' . $args['dblog']; $tmpdb = \Innomatic\Dataaccess\DataAccessFactory::getDataAccess(new \Innomatic\Dataaccess\DataAccessSourceName($dasn_string)); if ($tmpdb->Connect()) { $loc_country = new \Innomatic\Locale\LocaleCountry($country); $country_language = $loc_country->Language(); $language_locale = new \Innomatic\Locale\LocaleCatalog('innomatic::localization', $container->getLanguage()); $selected_language = $actionDispatcher->getEventData(); if (isset($selected_language['language'])) { $selected_language = $selected_language['language']; } else { $selected_language = false; } $wui_vgroup = new WuiVertgroup('vgroup'); $language_query = $tmpdb->execute('SELECT * FROM locale_languages'); while (!$language_query->eof) { $languages[$language_query->getFields('langshort')] = $language_locale->getStr($language_query->getFields('langname')); $language_query->moveNext(); } $wui_locale_grid = new WuiGrid('localegrid'); $wui_locale_grid->addChild(new WuiLabel('languagelabel', array('label' => $innomaticLocale->getStr('language_label'))), 0, 0); $wui_locale_grid->addChild(new WuiComboBox('language', array('disp' => 'action', 'elements' => $languages, 'default' => $selected_language ? $selected_language : $country_language)), 0, 1);