示例#1
0
文件: data.php 项目: ZerGabriel/cms-1
 public function action_index()
 {
     Assets::package('jquery-ui');
     $cur_ds_id = (int) Arr::get($this->request->query(), 'ds_id', Cookie::get('ds_id'));
     $tree = Datasource_Data_Manager::get_tree();
     $cur_ds_id = Datasource_Data_Manager::exists($cur_ds_id) ? $cur_ds_id : Datasource_Data_Manager::$first_section;
     $ds = $this->section($cur_ds_id);
     $this->template->content = View::factory('datasource/content', array('content' => View::factory('datasource/data/index'), 'menu' => View::factory('datasource/data/menu', array('tree' => $tree, 'folders' => Datasource_Folder::get_all()))));
     $this->template->footer = NULL;
     $this->template->breadcrumbs = NULL;
     if ($ds instanceof Datasource_Section) {
         $this->set_title($ds->name);
         $limit = (int) Arr::get($this->request->query(), 'limit', Cookie::get('limit'));
         Cookie::set('ds_id', $cur_ds_id);
         $keyword = $this->request->query('keyword');
         if (!empty($limit)) {
             Cookie::set('limit', $limit);
             $this->section()->headline()->limit($limit);
         }
         $this->template->content->content->headline = $this->section()->headline()->render();
         $this->template->content->content->toolbar = View::factory('datasource/' . $ds->type() . '/toolbar', array('keyword' => $keyword));
         $this->template->set_global(array('datasource' => $ds));
         $this->template_js_params['DS_ID'] = $this->_section->id();
         $this->template_js_params['DS_TYPE'] = $this->_section->type();
     } else {
         $this->template->content->content = NULL;
     }
 }
示例#2
0
 public function before()
 {
     parent::before();
     if ($this->auto_render === TRUE) {
         Assets::js('jquery', ADMIN_RESOURCES . 'libs/jquery.min.js');
         Assets::package(array('jquery-ui', 'backbone', 'notify', 'underscore', 'select2', 'core', 'bootstrap'));
     }
 }
示例#3
0
 public function action_view()
 {
     Assets::package('ace');
     $file = $this->request->param('file');
     $backup = Model_Backup::factory(BACKUP_PLUGIN_FOLDER . $file);
     $this->template->title = __('Backup view :file', array(':file' => $file));
     $this->template->content = View::factory('backup/view', array('model' => $backup, 'filename' => $file));
 }
示例#4
0
 public static function load_filters()
 {
     foreach (self::$filters as $key => $filter) {
         Assets::package($key);
     }
     foreach (self::$plugins as $plugin) {
         Assets::package($plugin);
     }
 }
示例#5
0
 public function action_index()
 {
     Assets::package('jquery-ui');
     Assets::css('fullcalendar', ADMIN_RESOURCES . 'libs/fullcalendar-2.1.0/fullcalendar.min.css', 'global');
     Assets::js('fullcalendar', ADMIN_RESOURCES . 'libs/fullcalendar-2.1.0/fullcalendar.min.js', 'jquery');
     Assets::js('fullcalendar.lang', ADMIN_RESOURCES . 'libs/fullcalendar-2.1.0/lang/' . I18n::lang_short() . '.js', 'fullcalendar');
     $this->set_title(__('Calendar'), FALSE);
     $this->template->content = View::factory('calendar/index', array('colors' => array('default', 'darken', 'danger', 'info', 'primary', 'success', 'warning'), 'icons' => array('info', 'warning', 'check', 'user', 'lock', 'clock-o')));
 }
示例#6
0
 /**
  * Get a Response object representing the exception
  *
  * @uses    Kohana_Exception::text
  * @param   Exception  $e
  * @return  Response
  */
 public static function response(Exception $e)
 {
     if (Config::get('site', 'debug') == Config::YES or Kohana::$environment !== Kohana::PRODUCTION) {
         Assets::package(array('jquery', 'core', 'backbone', 'notify', 'underscore'));
         // Show the normal Kohana error page.
         return parent::response($e);
     }
     // Show the custom Kodicms error page.
     return self::_show_custom_error($e);
 }
示例#7
0
 public function action_index()
 {
     // Подключение media пакета
     Assets::package(array('skeleton'));
     // Вывод в глобальный шаблон JavaScript параметра
     // Все параметры проходят через функцию json_encode
     $this->template_js_params['PARAM'] = '...';
     $this->set_title(__('Skeleton'));
     $this->template->content = View::factory('skeleton/index', array('param' => '....'));
 }
示例#8
0
文件: WYSIWYG.php 项目: kodicms/core
 /**
  * 
  * @param string $type
  */
 public static function load_all($type = NULL)
 {
     foreach (self::$_editors as $editor_id => $data) {
         if ($type !== NULL and is_string($type)) {
             if ($type != $data['type']) {
                 continue;
             }
         }
         self::$_loaded[$editor_id] = $data;
         Assets::package($data['package']);
     }
 }
示例#9
0
 public function action_settings()
 {
     $this->set_title(__('Settings'));
     Assets::package('ace');
     $site_pages = array();
     foreach (Model_Navigation::get()->sections() as $section) {
         foreach ($section->get_pages() as $item) {
             $url = trim(str_replace(ADMIN_DIR_NAME, '', $item->url()), '/');
             $site_pages[$section->name()][$url] = $item->name();
         }
     }
     $this->template->content = View::factory('system/settings', array('filters' => Arr::merge(array('--none--'), WYSIWYG::findAll()), 'dates' => Date::formats(), 'site_pages' => $site_pages, 'default_status_id' => array(Model_Page::STATUS_DRAFT => __('Draft'), Model_Page::STATUS_PUBLISHED => __('Published'))));
 }
示例#10
0
 public function action_view()
 {
     Assets::package('backbone');
     $id = (int) $this->request->query('id');
     $doc = $this->_get_document($id);
     WYSIWYG::load_filters();
     $this->_load_session_data($doc);
     $doc->onControllerLoad();
     $this->breadcrumbs->add($this->section()->name, Route::get('datasources')->uri(array('directory' => 'datasources', 'controller' => 'data')) . URL::query(array('ds_id' => $this->section()->id()), FALSE));
     $this->template_js_params['API_FORM_ACTION'] = '/datasource-document.' . ($doc->loaded() ? 'update' : 'create');
     $this->template_js_params['SECTION_ID'] = (int) $this->section()->id();
     $this->template_js_params['DOCUMENT_ID'] = $id;
     if (!$doc->loaded()) {
         $this->set_title(__('New document'));
     } else {
         $this->set_title($doc->header);
     }
     $this->_load_template($doc);
 }
示例#11
0
 public function action_edit()
 {
     $layout_name = $this->request->param('id');
     $layout = new Model_File_Layout($layout_name);
     if (!$layout->is_exists()) {
         if (($found_file = $layout->find_file()) !== FALSE) {
             $layout = new Model_File_Layout($found_file);
         } else {
             Messages::errors(__('Layout not found!'));
             $this->go();
         }
     }
     $this->set_title($layout_name);
     // check if trying to save
     if (Request::current()->method() == Request::POST and ACL::check('layout.edit')) {
         return $this->_edit($layout);
     }
     Assets::package('ace');
     $this->template->content = View::factory('layout/edit', array('action' => 'edit', 'layout' => $layout));
 }
示例#12
0
 public function action_edit()
 {
     $snippet_name = $this->request->param('id');
     $snippet = new Model_File_Snippet($snippet_name);
     if (!$snippet->is_exists()) {
         if (($found_file = $snippet->find_file()) !== FALSE) {
             $snippet = new Model_File_Snippet($found_file);
         } else {
             Messages::errors(__('Snippet not found!'));
             $this->go();
         }
     }
     $this->template->title = __('Edit snippet');
     $this->breadcrumbs->add($snippet_name);
     // check if trying to save
     if (Request::current()->method() == Request::POST and ACL::check('snippet.edit')) {
         return $this->_edit($snippet_name);
     }
     Assets::package('ace');
     $this->template->content = View::factory('snippet/edit', array('action' => 'edit', 'filters' => WYSIWYG::findAll(), 'snippet' => $snippet));
 }
示例#13
0
 public function action_index()
 {
     Assets::package('gridster');
     $widgets_array = Model_User_Meta::get('dashboard', array());
     $widget_settings = Model_User_Meta::get('dashboard_widget_settings', array());
     foreach ($widgets_array as $i => $data) {
         if (!isset($data['widget_id'])) {
             unset($widgets_array[$i]);
             continue;
         }
         $widget_object = Arr::get($widget_settings, $data['widget_id']);
         if (!$widget_object instanceof Model_Widget_Decorator_Dashboard) {
             unset($widgets_array[$i]);
             continue;
         }
         $widget_object->on_page_load();
         $widgets_array[$i]['widget'] = $widget_object;
     }
     $this->set_title(__('Dashboard'), FALSE);
     $this->template->content = View::factory('dashboard/index', array('widgets' => $widgets_array, 'columns' => Config::get('dashboard', 'columns', array())));
 }
示例#14
0
文件: page.php 项目: ZerGabriel/cms-1
 public function action_edit()
 {
     WYSIWYG::load_filters();
     Assets::package('backbone');
     $page_id = (int) $this->request->param('id');
     $page = ORM::factory('page', $page_id);
     if (!$page->loaded()) {
         Messages::errors(__('Page not found!'));
         $this->go();
     }
     // Проверка пользователя на доступ к редактированию текущей страницы
     if (!Auth::has_permissions($page->get_permissions())) {
         Messages::errors(__('You do not have permission to access the requested page!'));
         $this->go();
     }
     // check if trying to save
     if ($this->request->method() == Request::POST) {
         return $this->_edit($page);
     }
     $this->set_page_js_params($page);
     $this->set_title($page->title);
     $this->template->content = View::factory('page/edit', array('action' => 'edit', 'page' => $page, 'permissions' => ORM::factory('role')->find_all()->as_array('id', 'name'), 'page_permissions' => $page->get_permissions()));
 }
示例#15
0
 public function init_media()
 {
     parent::init_media();
     $this->template_js_params['ACE_THEME'] = Config::get('ace', 'theme', 'textmate');
     $this->template_js_params['DEFAULT_FILTER'] = Config::get('site', 'default_filter_id', '');
     Assets::package(array('jquery', 'bootstrap', 'notify', 'select2', 'dropzone', 'fancybox', 'datepicker', 'underscore', 'core'));
     foreach (array('.js', '-message.js') as $file_name) {
         $filename = Kohana::$cache_dir . DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, array('i18n', NULL)) . I18n::lang() . $file_name;
         if (file_exists($filename)) {
             Assets::js('i18n', BASE_URL . 'cms/cache/i18n/' . I18n::lang() . $file_name, 'global', FALSE, 0);
         }
     }
     $file = $this->request->controller();
     $directory = $this->request->directory();
     if (!empty($directory)) {
         $file = $directory . '/' . $file;
     }
     $file = strtolower($file);
     if (Kohana::find_file('media', FileSystem::normalize_path('js/controller/' . $file), 'js')) {
         Assets::js('controller.' . $file, ADMIN_RESOURCES . 'js/controller/' . $file . '.js', 'global', FALSE, 999);
     }
     Assets::group('global', 'events', '<script type="text/javascript">' . Assets::merge_files('js/events', 'js') . '</script>', 'global');
 }
示例#16
0
 public function action_database()
 {
     Assets::package('ace');
     $this->set_title(__('Database'));
     $this->template->content = View::factory('update/database', array('actions' => Update::check_database(FALSE)));
 }
示例#17
0
 public function action_template()
 {
     $id = (int) $this->request->param('id');
     $widget = Widget_Manager::load($id);
     if (!$widget) {
         Messages::errors(__('Widget not found!'));
         $this->go_back();
     }
     Assets::package('ace');
     $template = $widget->default_template();
     $data = file_get_contents($template);
     $this->template->content = View::factory('widgets/default_template', array('data' => $data));
 }
示例#18
0
 /**
  * Функция запоскается через обсервер frontpage_found
  * 
  * @see Context::init_widgets()
  */
 public function on_page_load()
 {
     if (!empty($this->media)) {
         foreach ($this->media as $link) {
             if (strpos($link, '.css') !== FALSE) {
                 Assets::css($link, $link);
             } else {
                 if (strpos($link, '.js') !== FALSE) {
                     Assets::js($link, $link);
                 }
             }
         }
     }
     if (!empty($this->media_packages)) {
         Assets::package($this->media_packages);
     }
 }
示例#19
0
 public function before()
 {
     parent::before();
     Assets::package(array('jquery', 'elfinder', 'jquery-ui', 'backbone', 'core', 'underscore'));
 }
示例#20
0
文件: meta.php 项目: ZerGabriel/cms-1
 /**
  * Добавление пакетов
  * 
  *		Meta::factory($page)
  *			->package('jquery-ui')
  *			->package(array('jquery-ui', 'fancybox'));
  * 
  * @param string $handle
  * @param string $content
  * @param array $params
  * @param string $deps
  * @return \KodiCMS_Meta
  */
 public function package($name, $footer = FALSE)
 {
     Assets::package($name, $footer);
     return $this;
 }
示例#21
0
 public function onControllerLoad()
 {
     Assets::package('colorpicker');
     parent::onControllerLoad();
 }
示例#22
0
 }
 public function action_index()
 {
     Assets::package('backbone');
     $this->template->content = View::factory('plugins/index');
     $this->set_title(__('Plugins'), FALSE);
示例#23
0
 public function action_index()
 {
     $this->set_title(__('File manager'));
     Assets::package(array('elfinder', 'jquery-ui', 'ace'));
     $this->template->content = View::factory('elfinder/filemanager');
 }
示例#24
0
 public function before()
 {
     parent::before();
     $this->breadcrumbs->add(__('Messages'), Route::get('backend')->uri(array('controller' => 'messages')));
     Assets::package('redactor');
 }
示例#25
0
文件: init.php 项目: ZerGabriel/cms-1
<?php

defined('SYSPATH') or die('No direct access allowed.');
Assets_Package::add('parts')->css(NULL, ADMIN_RESOURCES . 'css/parts.css');
Observer::observe('view_page_edit_plugins_top', function ($page) {
    if ($page->loaded()) {
        echo View::factory('part/items');
    }
});
Observer::observe('controller_before_page_edit', function () {
    Assets::package(array('jquery-ui', 'parts'));
});
// Если страницы загружена, загружаем части страниц в качестве виджетов и помещаем
// в блоки с названием частей страниц
Observer::observe('frontpage_found', function ($page) {
    $layout = $page->get_layout_object();
    $widgets = array();
    foreach ($layout->blocks() as $block) {
        if (!Part::exists($page, $block)) {
            continue;
        }
        $widgets['part_' . $block] = new Model_Widget_Part($block, Part::get($page, $block));
    }
    Context::instance()->register_widgets($widgets);
});
// Загрузка JS кода на страницы редактирования
Observer::observe(array('controller_before_page_edit', 'controller_before_page_add'), function () {
    Assets::js('controller.parts', ADMIN_RESOURCES . 'js/controller/parts.js', 'global');
});
// Сохранение контента частей страниц
Observer::observe('page_edit_after_save', function ($page) {
示例#26
0
 public function action_config()
 {
     Assets::package('ace');
     $this->set_title(__('Config'));
     $this->template->content = View::factory('sphinx/config', array('config' => Config::get('search', 'sphinx', array())));
 }
示例#27
0
 public function action_index()
 {
     Assets::package(array('select2', 'validate', 'install', 'steps'));
     $this->template->title = __(':cms_name &rsaquo; installation', array(':cms_name' => CMS_NAME));
     $this->template->content = View::factory('install/index', array('data' => Session::instance()->get_once('install_data', $this->_installer->default_params()), 'env_test' => View::factory('install/env_test'), 'cache_types' => $this->_installer->cache_types(), 'session_types' => $this->_installer->session_types(), 'database_drivers' => $this->_installer->database_drivers(), 'title' => $this->template->title, 'dates' => Date::formats()));
 }