Beispiel #1
0
 /**
  *
  * @param string $type
  */
 public static function loadAll($type = NULL)
 {
     foreach (self::$editors as $editorId => $data) {
         if ($type !== NULL and is_string($type)) {
             if ($type != $data['type']) {
                 continue;
             }
         }
         self::$loaded[$editorId] = $data;
         Assets::package($data['package']);
     }
 }
 public function getEdit($id)
 {
     Assets::package(['backbone', 'jquery-ui']);
     WYSIWYG::loadAll();
     $page = $this->getPage($id);
     $this->setTitle(trans('pages::core.title.pages.edit', ['title' => $page->title]));
     $this->templateScripts['PAGE'] = $page;
     $updator = $page->updatedBy()->first();
     $creator = $page->createdBy()->first();
     $pagesMap = $page->getSitemap();
     $behaviorList = BehaviorManager::formChoices();
     $this->setContent('pages.edit', compact('page', 'updator', 'creator', 'pagesMap', 'behaviorList'));
 }
 public function registerMedia()
 {
     parent::registerMedia();
     $this->templateScripts['ACE_THEME'] = config('cms.default_ace_theme', 'textmate');
     $this->templateScripts['DEFAULT_HTML_EDITOR'] = config('cms.default_html_editor', '');
     $this->templateScripts['DEFAULT_CODE_EDITOR'] = config('cms.default_code_editor', '');
     Assets::package(['libraries', 'core']);
     $file = $this->getRouterController();
     if (app('module.loader')->findFile('resources/js', $file, 'js')) {
         Assets::js('controller.' . $file, \CMS::backendResourcesURL() . '/js/' . $file . '.js', 'global', FALSE, 999);
     }
     // TODO: разобраться с подключением событий и локалей в контроллер
     //Assets::group('global', 'events', '<script type="text/javascript">' . Assets::merge_files('js/events', 'js') . '</script>', 'global');
 }
 public function registerMedia()
 {
     parent::registerMedia();
     Assets::package(['libraries', 'core']);
 }
 public function getFile($filename = NULL)
 {
     if (is_array($this->editors)) {
         Assets::package($this->editors);
     }
     if (is_null($filename)) {
         return $this->collection->newFile();
     }
     if ($file = $this->collection->findFile($filename)) {
         return $file;
     }
     $this->throwFailException($this->smartRedirect()->withErrors(trans("{$this->moduleNamespace}{$this->sectionPrefix}.messages.not_found")));
 }
 public function popup()
 {
     Assets::package(array('elfinder', 'jquery-ui'));
     $this->setContent('popup');
 }
 public function after()
 {
     parent::after();
     if ($this->autoRender === TRUE) {
         if ($this->onlyContent) {
             $this->template = $this->template->content;
         } else {
             $scrpit = '';
             foreach ($this->templateScripts as $var => $value) {
                 $value = json_encode($value);
                 $scrpit .= "var {$var} = {$value};\n";
             }
             Assets::group('global', 'templateScripts', '<script type="text/javascript">' . $scrpit . '</script>', 'global');
         }
     }
 }