public static function __run(AppExecutionContext $context, MMapResponse $response) { $myMemoryManager = MemoryManager::getInstance(); Kernel::enterSystemMode(); $isExternLogin = $myMemoryManager->get('isExternLogin'); $loginPage = $myMemoryManager->get('loginPage'); Kernel::exitSystemMode(); $context->getArgs()->append($isExternLogin); if ($isExternLogin) { $context->getArgs()->append($loginPage); } }
public static function __run(AppExecutionContext $context, MMapResponse $response) { // Kill "login" process if any $PM = ProcManager::getInstance(); $procList = $PM->getProcessesTable(); foreach ($procList as $proc) { switch ($proc->getName()) { case 'init': break; case 'session': break; default: try { $PM->kill($proc); } catch (Exception $e) { Logger::getLogger('eyeosmobile.session')->warn('Cannot kill login process ' . $proc . ': ' . $e->getMessage()); } break; } } $args = $context->getArgs(); // User information (cached in eyeos.js) $args[0] = EyeosApplicationExecutable::__callModule('UserInfo', 'getCurrentUserInfo', array()); // Initial application(s) to launch (= static list $initApps excluding already running processes) // $procList = ProcManager::getInstance()->getProcessesList(); //$args[1] = array_diff(self::$initApps, $procList); // $args[1] = array_values(array_diff(self::$initApps, $procList)); //For the moment we just restore init application $args[1] = self::$initApps; }
public static function __run(AppExecutionContext $context, MMapResponse $response) { $currentUser = $context->getProcess()->getLoginContext()->getEyeosUser(); $groups = UMManager::getInstance()->getAllGroupsByPrincipal($currentUser); $isAdmin = 0; if ($currentUser->getPrimaryGroupId() == 'eyeID_EyeosGroup_root' || $currentUser->getPrimaryGroupId() == 'eyeID_EyeosGroup_admin') { $isAdmin = 1; } else { foreach ($groups as $group) { if ($group->getId() == 'eyeID_EyeosGroup_admin') { $isAdmin = 1; } } } $context->getArgs()->offsetSet(0, $isAdmin); //get the applications $myApplicationsManager = new EyeosApplicationsManager(); $applications = $myApplicationsManager->getAllApplications(); $return = array(); foreach ($applications as $appDesc) { $appMeta = $appDesc->getMeta(); $systemParameters = $appMeta->get('eyeos.application.systemParameters'); $currentApplicationGroup = 'eyeID_EyeosGroup_' . $systemParameters['group']; $currentUserGroup = ProcManager::getInstance()->getCurrentProcess()->getLoginContext()->getEyeosUser()->getPrimaryGroupId(); if ($currentUserGroup == 'eyeID_EyeosGroup_users' && $currentApplicationGroup == 'eyeID_EyeosGroup_users' || $currentUserGroup != 'eyeID_EyeosGroup_users') { $sysParams = $appMeta->get('eyeos.application.systemParameters'); $imagePath = $appMeta->get('eyeos.application.iconUrl'); $imageIsValid = true; $imagePath = str_replace('48x48', '22x22', $imagePath); $imagePath = str_replace('64x64', '22x22', $imagePath); try { $file = FSI::getFile($imagePath); } catch (Exception $e) { $imageIsValid = false; } if ($imageIsValid && !$file->isReadable()) { $imageIsValid = false; } if (!$imageIsValid) { $imagePath = 'sys:///extern/images/22x22/apps/preferences-desktop-default-applications.png'; } $return[] = array('name' => $appDesc->getName(), 'displayName' => $appMeta->get('eyeos.application.name') !== null ? $appMeta->get('eyeos.application.name') : $appDesc->getName(), 'app' => $appDesc->getName(), 'shortDescription' => $appMeta->get('eyeos.application.description'), 'image' => FSI::toExternalUrl($imagePath), 'favorite' => $myApplicationsManager->isApplicationFavorite($appDesc) ? 1 : 0, 'lists' => $appMeta->get('eyeos.application.category'), 'listable' => $sysParams['listable'] == 'true' ? 1 : 0); } } $context->getArgs()->offsetSet(1, $return); }
public static function __run(AppExecutionContext $context, MMapResponse $response) { $currentUser = $context->getProcess()->getLoginContext()->getEyeosUser(); $files = EyeosApplicationExecutable::__callModule('FileSystem', 'browsePath', array('home:///Desktop/', null, null)); $context->getArgs()->offsetSet(0, $currentUser->getName()); $context->getArgs()->offsetSet(1, $files); if ($context->getIncludeBody()) { $buffer = ''; $itemsPath = EYE_ROOT . '/' . APPS_DIR . '/desktop/'; $buffer .= file_get_contents($itemsPath . '/desktop.WidgetManager.js'); $buffer .= file_get_contents($itemsPath . '/desktop.SelectionManager.js'); $buffer .= file_get_contents($itemsPath . '/desktop.actionManager.js'); $buffer .= file_get_contents($itemsPath . '/desktop.chatManager.js'); $buffer .= file_get_contents($itemsPath . '/widgets/desktop.widget.events.js'); $buffer .= file_get_contents($itemsPath . '/widgets/desktop.widget.favorites.js'); $buffer .= file_get_contents($itemsPath . '/widgets/desktop.widget.files.js'); $buffer .= file_get_contents($itemsPath . '/widgets/desktop.widget.groups.js'); $buffer .= file_get_contents($itemsPath . '/widgets/desktop.widget.notes.js'); $buffer .= file_get_contents($itemsPath . '/widgets/desktop.widget.desktop.js'); $response->appendToBody($buffer); } }
public static function __run(AppExecutionContext $context, MMapResponse $response) { $currentUser = $context->getProcess()->getLoginContext()->getEyeosUser(); $groups = UMManager::getInstance()->getAllGroupsByPrincipal($currentUser); $isAdmin = 0; if ($currentUser->getPrimaryGroupId() == 'eyeID_EyeosGroup_root' || $currentUser->getPrimaryGroupId() == 'eyeID_EyeosGroup_admin') { $isAdmin = 1; } else { foreach ($groups as $group) { if ($group->getId() == 'eyeID_EyeosGroup_admin') { $isAdmin = 1; } } } $context->getArgs()->offsetSet(0, $isAdmin); $eventManager = new EventNotificationManager(); $from = 0; $to = 1000; $result = $eventManager->getAllQuestionEvents($from, $to); $result = self::toArray($result); $context->getArgs()->offsetSet(1, $result); }
public static function __run(AppExecutionContext $context, MMapResponse $response) { $currentUser = $context->getProcess()->getLoginContext()->getEyeosUser(); $groups = UMManager::getInstance()->getAllGroupsByPrincipal($currentUser); $isAdmin = 0; if ($currentUser->getPrimaryGroupId() == 'eyeID_EyeosGroup_root' || $currentUser->getPrimaryGroupId() == 'eyeID_EyeosGroup_admin') { $isAdmin = 1; } else { foreach ($groups as $group) { if ($group->getId() == 'eyeID_EyeosGroup_admin') { $isAdmin = 1; } } } $context->getArgs()->offsetSet(0, $isAdmin); }
public static function __run(AppExecutionContext $context, MMapResponse $response) { //if ($context->getIncludeBody()) { $buffer = ''; $itemsPath = EYE_ROOT . '/' . APPS_DIR . '/viewer/library'; $dir = new DirectoryIterator($itemsPath); foreach ($dir as $file) { $fileName = $file->getBasename(); if (!$file->isDot() && $fileName[0] != '.' && strchr($fileName, '.js')) { $buffer .= file_get_contents($itemsPath . '/' . $fileName); } } $response->appendToBody($buffer); //} $instance = MemoryManager::getInstance(); $instance->set('playList', $context->getArgs()->getArrayCopy()); }
public static function __run(AppExecutionContext $context, MMapResponse $response) { $directory = new DirectoryIterator(EYE_ROOT . '/' . APPS_DIR); $applications = array(); foreach ($directory as $fileInfo) { $fileInfoName = $fileInfo->getFilename(); $mobilePath = EYE_ROOT . '/' . APPS_DIR . '/' . $fileInfo->getFilename() . '/mobile'; if ($fileInfo->isDir() && $fileInfoName[0] != '.' && is_dir($mobilePath)) { $appDesc = new EyeMobileApplicationDescriptor($fileInfoName); $appMeta = $appDesc->getMeta(); $sysParams = $appMeta->get('eyeos.application.systemParameters'); if ($sysParams['listable'] == 'true') { $applications[] = array('name' => $appDesc->getName(), 'displayName' => $appMeta->get('eyeos.application.name') !== null ? $appMeta->get('eyeos.application.name') : $appDesc->getName(), 'description' => $appMeta->get('eyeos.application.description'), 'image' => FSI::toExternalUrl($appMeta->get('eyeos.application.iconUrl'))); } } } $args = $context->getArgs(); $args[0] = $applications; }
public static function __run(AppExecutionContext $context, MMapResponse $response) { $args = $context->getArgs(); if (!isset($args[0]) || !is_string($args[0])) { throw new EyeMissingArgumentException('Missing filename to open.'); } try { $file = FSI::getFile($args[0]); } catch (Exception $e) { throw new EyeInvalidArgumentException('args[0] must be a valid path to a file.', 0, $e); } $appName = false; if ($file->isDirectory()) { $appName = 'files'; } else { $extension = utf8_strtolower($file->getExtension()); // TODO: Currently hard-coded here but in the future associations will be read from a DB. // We must have general entries, common to all the users of the system, that will be used // as default, and then user-customized entries with a higher priority on the general ones. switch ($extension) { // // VIEWER // case 'jpg': case 'gif': case 'jpeg': case 'png': case 'htm': case 'html': case 'flv': case 'm4a': case 'mp3': $appName = 'viewer'; break; // // EDITOR // // // EDITOR // case 'txt': case 'xml': case 'ini': case 'js': case 'sql': case 'log': $appName = 'femto'; break; } } // Association found: execute matching application if ($appName) { $myProcess = ProcManager::getInstance()->getCurrentProcess(); // prepare context and execute application $currentAppDesc = new EyeosApplicationDescriptor($appName); $appContext = new AppExecutionContext(); $appContext->setParentProcess($myProcess); $appContext->setApplicationDescriptor($currentAppDesc); $appContext->setArgs(clone $args); MMapGetApp::getInstance()->processRequest(MMapManager::getCurrentRequest(), $response, $appContext); // Kill our process $context->setExecuteJavascript(false); ProcManager::getInstance()->kill($myProcess); return; } // Otherwise, show the OpenWith dialog }