/**
  * Generates JS package files given in the manifests, including extensions.
  */
 public function main()
 {
     $ds = DIRECTORY_SEPARATOR;
     $this->_msg('Generating JSB2 packages');
     $abslen = strlen($this->_projectPath);
     foreach ($this->_arcavias->getCustomPaths('client/extjs') as $base => $paths) {
         foreach ($paths as $path) {
             $jsbPath = $base . $ds . $path;
             $message = sprintf('Package: %1$s ', $jsbPath);
             $this->_msg(sprintf('Package: %1$s ', $jsbPath));
             if (!is_file($jsbPath) || !is_readable($jsbPath)) {
                 $this->_msg($message, 'failed');
                 $this->_msg(sprintf('No manifest file found in %1$s', $jsbPath));
                 continue;
             }
             try {
                 $jsbParser = new MW_Jsb2_Default($jsbPath);
                 $jsbParser->deploy('js');
                 $this->_msg($message, 'done');
             } catch (Exception $e) {
                 $this->_msg($message, 'failed');
                 $this->_msg(sprintf('Error: %1$s', $e->getMessage()));
             }
         }
     }
 }
Exemplo n.º 2
0
 /**
  * Returns the initial HTML view for the admin interface.
  *
  * @return Response Response object containing the generated output
  */
 public function indexAction()
 {
     $site = \Input::get('site', 'default');
     $lang = \Input::get('lang', 'en');
     $aimeos = app('\\Aimeos\\Shop\\Base\\Aimeos')->get();
     $cntlPaths = $aimeos->getCustomPaths('controller/extjs');
     $context = app('\\Aimeos\\Shop\\Base\\Context')->get(false);
     $context = $this->setLocale($context, $site, $lang);
     $controller = new \Controller_ExtJS_JsonRpc($context, $cntlPaths);
     $cssFiles = $jsFiles = array();
     foreach ($aimeos->getCustomPaths('client/extjs') as $base => $paths) {
         foreach ($paths as $path) {
             $jsbAbsPath = $base . '/' . $path;
             if (!is_file($jsbAbsPath)) {
                 throw new Exception(sprintf('JSB2 file "%1$s" not found', $jsbAbsPath));
             }
             $jsb2 = new \MW_Jsb2_Default($jsbAbsPath, dirname($path));
             $cssFiles = array_merge($cssFiles, $jsb2->getUrls('css'));
             $jsFiles = array_merge($jsFiles, $jsb2->getUrls('js'));
         }
     }
     $params = array('site' => '{site}', 'lang' => '{lang}', 'tab' => '{tab}');
     $adminUrl = route('aimeos_shop_admin', $params);
     $jsonUrl = route('aimeos_shop_admin_json', array('_token' => csrf_token()));
     $vars = array('lang' => $lang, 'jsFiles' => $jsFiles, 'cssFiles' => $cssFiles, 'languages' => $this->getJsonLanguages($context), 'config' => $this->getJsonClientConfig($context), 'site' => $this->getJsonSiteItem($context, \Input::get('site', 'default')), 'i18nContent' => $this->getJsonClientI18n($aimeos->getI18nPaths(), $lang), 'searchSchemas' => $controller->getJsonSearchSchemas(), 'itemSchemas' => $controller->getJsonItemSchemas(), 'smd' => $controller->getJsonSmd($jsonUrl), 'urlTemplate' => urldecode($adminUrl), 'uploaddir' => \Config::get('shop::uploaddir'), 'activeTab' => \Input::get('tab', 0), 'version' => $this->getVersion());
     return \View::make('shop::admin.index', $vars);
 }
Exemplo n.º 3
0
 /**
  * Returns the JS file content
  *
  * @return Response Response object
  */
 public function fileAction()
 {
     $jsFiles = array();
     $aimeos = $this->aimeos->get();
     foreach ($aimeos->getCustomPaths('client/extjs') as $base => $paths) {
         foreach ($paths as $path) {
             $jsbAbsPath = $base . '/' . $path;
             $jsb2 = new \MW_Jsb2_Default($jsbAbsPath, dirname($jsbAbsPath));
             $jsFiles = array_merge($jsFiles, $jsb2->getUrls('js', ''));
         }
     }
     foreach ($jsFiles as $file) {
         if (($content = file_get_contents($file)) !== false) {
             $this->response->appendContent($content);
         }
     }
     $this->response->setHeader('Content-Type', 'application/javascript');
     return $this->response;
 }
Exemplo n.º 4
0
 /**
  * Returns the JS file content
  *
  * @return Response Response object
  */
 public function fileAction()
 {
     $contents = '';
     $jsFiles = array();
     $aimeos = app('\\Aimeos\\Shop\\Base\\Aimeos')->get();
     foreach ($aimeos->getCustomPaths('client/extjs') as $base => $paths) {
         foreach ($paths as $path) {
             $jsbAbsPath = $base . '/' . $path;
             $jsb2 = new \MW_Jsb2_Default($jsbAbsPath, dirname($jsbAbsPath));
             $jsFiles = array_merge($jsFiles, $jsb2->getUrls('js', ''));
         }
     }
     foreach ($jsFiles as $file) {
         if (($content = file_get_contents($file)) !== false) {
             $contents .= $content;
         }
     }
     return response($contents)->header('Content-Type', 'application/javascript');
 }
Exemplo n.º 5
0
 /**
  * Returns the JS file content
  *
  * @return Response Response object
  */
 public function fileAction()
 {
     $contents = '';
     $jsFiles = array();
     foreach (Base::getAimeos()->getCustomPaths('client/extjs') as $base => $paths) {
         foreach ($paths as $path) {
             $jsbAbsPath = $base . '/' . $path;
             $jsb2 = new \MW_Jsb2_Default($jsbAbsPath, dirname($jsbAbsPath));
             $jsFiles = array_merge($jsFiles, $jsb2->getUrls('js', ''));
         }
     }
     foreach ($jsFiles as $file) {
         if (($content = file_get_contents($file)) === false) {
             throw new \Exception(sprintf('File "%1$s" not found', $jsbAbsPath));
         }
         $contents .= $content;
     }
     $response = $this->getControllerContext()->getResponse();
     $response->setHeader('Content-Type', 'application/javascript');
     $response->setContent($contents);
     return $response;
 }