Example #1
0
 public function __construct()
 {
     $this->myMMapGetApp = MMapGetApp::getInstance();
 }
Example #2
0
 public static function getInstance()
 {
     self::$Logger = Logger::getLogger('system.services.MMap.MMapGetApp');
     return parent::getInstance(__CLASS__);
 }
Example #3
0
 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
 }
Example #4
0
 private static function startLogin(MMapResponse $response)
 {
     // start Process
     $loginProcess = new Process('login');
     ProcManager::getInstance()->execute($loginProcess);
     // prepare context and execute application
     $loginAppDesc = new EyeosApplicationDescriptor('login');
     $appContext = new AppExecutionContext();
     $appContext->setApplicationDescriptor($loginAppDesc);
     $appContext->setIncludeBody(true);
     $appContext->setProcess($loginProcess);
     MMapGetApp::getInstance()->processRequest(MMapManager::getCurrentRequest(), $response, $appContext);
 }