Exemplo n.º 1
0
Arquivo: Maps.php Projeto: techart/tao
 /**
  * @param string $service
  * @param string $id
  * @param array $options
  * @return string
  */
 public function map($t, $service, $map_id, $name, $options = array(), $path_to_template = '../tao/views/helpers/maps')
 {
     if (!is_array($options)) {
         $options = (array) $options;
     }
     $json_string = json_encode($options);
     $lang = 'ru';
     if ($options['properties']['lang'] != null) {
         $lang = $options['properties']['lang'];
     }
     if ($service == null) {
         $service = 'google';
     }
     switch ($service) {
         case 'google':
             $t->use_script('https://maps.google.com/maps/api/js?sensor=false&language=' . $lang, array('type' => 'lib', 'weight' => -21));
             $t->use_script('http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobubble/src/infobubble-compiled.js', array('type' => 'lib', 'weight' => -20));
             break;
         case 'yandex':
             $t->use_script('http://api-maps.yandex.ru/2.0/?load=package.full&lang=' . $lang, array('type' => 'lib', 'weight' => -21));
             break;
         default:
             return;
     }
     $t->use_script(CMS::stdfile_url('scripts/maps.js'), array('type' => 'lib', 'weight' => -19));
     return $t->partial($path_to_template, array('json_string' => $json_string, 'map' => $service . '_maps', 'name' => $name, 'map_id' => $map_id));
 }
Exemplo n.º 2
0
 protected function layout_preprocess($l, $name, $data)
 {
     $js_file = $this->get_js_file($data);
     $l->use_scripts(CMS::stdfile_url('scripts/jquery/ui.js'));
     $l->use_scripts($js_file);
     $l->use_style(CMS::stdfile_url('styles/jquery/ui.css'));
     return parent::layout_preprocess($l, $name, $data);
 }
Exemplo n.º 3
0
 protected function render_tree()
 {
     $fform = $this->create_filters_form();
     $filters_form_fields = $this->prepare_filter_forms();
     $t = $this->render('tree', array('c' => $this, 'title' => $this->title_list(), 'count' => $this->get_tree_count(), 'message_norows' => $this->message_norows(), 'can_add' => $this->access_add(), 'add_url' => $this->action_url('add', $this->page), 'add_button_caption' => $this->button_add(), 'filters_form' => $fform, 'filters_form_fields' => $filters_form_fields));
     if ($this->enable_checkcolumn) {
         $t->use_scripts(CMS::stdfile_url('scripts/extjs/CheckColumn.js'))->use_styles(CMS::stdfile_url('styles/extjs/CheckHeader.css'));
     }
     return $t;
 }
Exemplo n.º 4
0
 protected function layout_preprocess($l, $name, $data)
 {
     $id = $this->url_class();
     $code = "; \$(function() { \$('.{$id} div.tree_select').filter('.name_{$name}').each(\n\t\t\t\t\tfunction() {\n\t \t\t\t\t\tTAO.fields.tree_select(\$(this));\n\t\t\t\t\t\t}\n\t\t)});";
     $l->append_to('js', $code);
     $l->with('url_class', $id);
     $l->use_scripts(CMS::stdfile_url('scripts/fields/tree-select.js'));
     $l->use_styles(CMS::stdfile_url('styles/fields/tree-select.css'));
     $l->use_scripts(CMS::stdfile_url('scripts/jquery/scroll-to.js'));
     return parent::layout_preprocess($l, $name, $data);
 }
Exemplo n.º 5
0
 protected function preprocess($template, $name, $data)
 {
     $item = $this->get_item($name, $data);
     if ($item) {
         $prefix = $item->code ? str_replace($item->code, '', $item->full_code) : CMS::vars()->db()->find($this->request('parent_id'))->code . '.';
         // var_dump();
         $template->with('prefix', $prefix);
     }
     $template->use_script(CMS::stdfile_url('scripts/fields/varcode.js'));
     $template->use_style(CMS::stdfile_url('styles/fields/varcode.css'));
     return parent::preprocess($template, $name, $data);
 }
Exemplo n.º 6
0
 public function preprocess($template, $name, $data)
 {
     $template->use_scripts(CMS::stdfile_url('scripts/jquery/tabby.js'));
     parent::preprocess($template, $name, $data);
     $parms = $template->parms;
     $class = isset($parms['tagparms']['class']) ? $parms['tagparms']['class'] : '';
     $class .= ' use-tab-key';
     $class = trim($class);
     $template->update_parm('tagparms', array('class' => $class));
     if (empty($parms['tagparms']['style'])) {
         $template->update_parm('tagparms', array('style' => 'width: 300px;height:100px;'));
     }
     return $template;
 }
Exemplo n.º 7
0
 protected function get_lang_file($data)
 {
     $lang_file = false;
     $lang_file = $data['lang_file'];
     $lang = $this->get_lang($data);
     $path = "jquery/lang/{$lang}.js";
     if ($data['lang_file']) {
         $lang_file = $data['lang_file'];
     } elseif (IO_FS::exists('scripts/' . $path)) {
         $lang_file = $path;
     } elseif (IO_FS::exists(CMS::stdfile('scripts/' . $path))) {
         $lang_file = CMS::stdfile_url('scripts/' . $path);
     }
     return $lang_file;
 }
Exemplo n.º 8
0
    protected function layout_preprocess($l, $name, $data)
    {
        $item = $this->get_item($name, $data);
        $l->use_styles(CMS::stdfile_url('styles/SlickGrid/slick.grid.css'), CMS::stdfile_url('styles/SlickGrid/slick-default-theme.css'), CMS::stdfile_url('styles/SlickGrid/slick.css'), CMS::stdfile_url('styles/jquery/ui.css'), CMS::stdfile_url('styles/fields/documents-grid.css'));
        $l->use_scripts(CMS::stdfile_url('scripts/tao/data.js'), CMS::stdfile_url('scripts/tao/oop.js'), CMS::stdfile_url('scripts/fields/documents-grid.js'), CMS::stdfile_url('scripts/jquery/ui.js'), CMS::stdfile_url('scripts/jquery/event.drag.js'), CMS::stdfile_url('scripts/jquery/event.drop.js'), CMS::stdfile_url('scripts/SlickGrid/slick.core.js'), CMS::stdfile_url('scripts/SlickGrid/slick.formatters.js'), CMS::stdfile_url('scripts/SlickGrid/slick.editors.js'), CMS::stdfile_url('scripts/SlickGrid/slick.grid.js'), CMS::stdfile_url('scripts/SlickGrid/slick.table.js'), CMS::stdfile_url('scripts/SlickGrid/plugins/slick.rowmovemanager.js'), CMS::stdfile_url('scripts/SlickGrid/plugins/slick.rowselectionmodel.js'), CMS::stdfile_url('scripts/tao/data.js'));
        $id = $this->url_class();
        $l->with('url_class', $id);
        if ($item && !$item->is_phantom()) {
            $code = <<<JS
\t\t\$(window).load(function () { \$('.{$id}.field-{$name}').each(function() {TAO.fields.documents_grid.process(\$(this))}) })
JS;
            $l->append_to('js', $code);
        }
        Templates_HTML::add_scripts_settings(array('fields' => array($name => array('fields' => $this->get_fields($name, $data), 'api' => array('read' => CMS::$current_controller->field_action_url($name, 'load', $data['__item']), 'update' => CMS::$current_controller->field_action_url($name, 'update', $data['__item']), 'destroy' => CMS::$current_controller->field_action_url($name, 'delete', $data['__item']), 'save' => CMS::$current_controller->field_action_url($name, 'save', $data['__item']))))));
        return parent::layout_preprocess($l, $name, $data);
    }
Exemplo n.º 9
0
 /**
  * Настройки по умолчанию
  *
  * @return array
  */
 public function default_settings()
 {
     return array('fullPanel' => true, 'iconsPath' => CMS::stdfile_url('images/nicEditor/nicEditorIcons.gif'));
 }
Exemplo n.º 10
0
 public function scripts()
 {
     return array('jquery.js', CMS::stdfile_url('scripts/admin/tree.js'));
 }
Exemplo n.º 11
0
 /**
  * @param string $name
  *
  * @return string
  */
 static function component_icon($name)
 {
     return CMS::stdfile_url('images/components/default.gif');
 }
Exemplo n.º 12
0
 public function lazy($parms = array())
 {
     $this->lazy = true;
     $this->lazy_parms = array_merge($this->lazy_parms, $parms);
     $this->template()->root->use_script(CMS::stdfile_url('scripts/jquery/lazyload.js'));
     $this->template()->add_scripts_settings(array('lazyload' => $this->lazy_parms['settings']), true);
     return $this;
 }
Exemplo n.º 13
0
    protected function layout_preprocess($l, $name, $data)
    {
        $formats = $this->get_formats($name, $data);
        foreach ($formats as $code => $format) {
            if (!empty($format['__langs_name'])) {
                foreach ($format['__langs_name'] as $lang => $lname) {
                    $format['__type']->layout_preprocess($l, $lname, $format['__data']);
                }
            } else {
                $format['__type']->layout_preprocess($l, $format['__name'], $format['__data']);
            }
        }
        $l->update_parm('formats', $formats);
        $l->use_scripts(CMS::stdfile_url('scripts/fields/content.js'));
        $l->use_styles(CMS::stdfile_url('styles/fields/content.css'));
        $id = $this->url_class();
        $code = <<<JS
\$(function() {
\$(".{$id}.field-{$name}").each(function() {TAO.fields.content(\$(this));});
});
JS;
        $l->append_to('js', $code);
        $l->with('url_class', $id);
        return parent::layout_preprocess($l, $name, $data);
    }
Exemplo n.º 14
0
 public function render($type = 'render/default', $exclude_fields = array('path'))
 {
     $template = $this->template()->spawn($this->type->template($this->data, $type));
     $template->use_styles(CMS::stdfile_url('styles/fields/documents.css'));
     return $template->with(array('files' => $this->filelist(), 'dir' => $this->dir(), 'files_data' => $this->type->files_data($this->name, $this->data, $this->item), 'container' => $this, 'exclude_fields' => $exclude_fields))->render();
 }
Exemplo n.º 15
0
    protected function layout_preprocess($l, $name, $data)
    {
        $this->use_styles(CMS::stdfile_url('styles/fields/gallery.css'));
        $this->use_scripts(CMS::stdfile_url('scripts/jquery/dragsort.js'));
        //$this->use_scripts(CMS::stdfile_url('scripts/jquery/json.js'));
        $this->use_scripts(CMS::stdfile_url('scripts/fields/gallery.js'));
        $l->use_scripts(CMS::stdfile_url('scripts/jquery/block.js'));
        $id = $this->url_class();
        $code = <<<JS
\t\t\$(function () { \$('.{$id}.field-{$name}').each(function() {TAO.fields.gallery.process(\$(this))}) });;
JS;
        $item = $this->get_item($name, $data);
        if ($item && method_exists($item, 'is_phantom') && !$item->is_phantom()) {
            $l->append_to('js', $code);
        }
        $l->with('url_class', $id);
        return parent::layout_preprocess($l, $name, $data);
    }
Exemplo n.º 16
0
 public function icon()
 {
     return CMS::stdfile_url('images/icons/document.png');
 }
Exemplo n.º 17
0
    protected function layout_preprocess($l, $name, $data)
    {
        $l->use_scripts(CMS::stdfile_url('scripts/fields/attaches.js'));
        if ($this->block_on_upload) {
            $l->use_scripts(CMS::stdfile_url('scripts/jquery/block.js'));
        }
        if (!empty($data['__item_id']) || !empty($data['__item']) && !empty($data['__item']->id)) {
            $id = $this->url_class();
            $code = <<<JS

\$(function() {
\$(".{$id}.field-{$name}").each(function() {TAO.fields.attaches.process(\$(this));});
});

JS;
            $l->append_to('js', $code);
            $l->with('url_class', $id);
            Templates_HTML::add_scripts_settings(array('fields' => array($name => array('confirm' => CMS::lang()->_common->ta_dfconfirm, 'block' => $this->block_on_upload))));
        }
        parent::layout_preprocess($l, $name, $data);
    }
Exemplo n.º 18
0
 protected function preprocess_render($t)
 {
     $t->use_styles(CMS::stdfile_url('styles/admin/table.css'), CMS::stdfile_url('styles/SlickGrid/slick.grid.css'), CMS::stdfile_url('styles/SlickGrid/slick.css'), CMS::stdfile_url('styles/SlickGrid/controls/slick.pager.css'));
     $t->use_scripts(CMS::stdfile_url('scripts/tao.js'), CMS::stdfile_url('scripts/tao/oop.js'), CMS::stdfile_url('scripts/jquery/ui.js'), CMS::stdfile_url('scripts/jquery/event.drag.js'), CMS::stdfile_url('scripts/jquery/event.drop.js'), CMS::stdfile_url('scripts/SlickGrid/slick.core.js'), CMS::stdfile_url('scripts/SlickGrid/slick.formatters.js'), CMS::stdfile_url('scripts/SlickGrid/slick.editors.js'), CMS::stdfile_url('scripts/SlickGrid/slick.grid.js'), CMS::stdfile_url('scripts/SlickGrid/slick.dataview.js'), CMS::stdfile_url('scripts/SlickGrid/controls/slick.remotepager.js'), CMS::stdfile_url('scripts/SlickGrid/slick.remotestore.js'), CMS::stdfile_url('scripts/SlickGrid/slick.table.js'), CMS::stdfile_url('scripts/SlickGrid/slick.tree.class.js'), CMS::stdfile_url('scripts/SlickGrid/plugins/slick.rowmovemanager.js'), CMS::stdfile_url('scripts/SlickGrid/plugins/slick.rowselectionmodel.js'), $this->app_js_file());
     return $t;
 }
Exemplo n.º 19
0
 protected function layout_preprocess($l, $name, $data)
 {
     $l->use_script(CMS::stdfile_url('scripts/fields/multivalue.js'));
     $l->use_style(CMS::stdfile_url('styles/fields/multivalue.css'));
     return parent::layout_preprocess($l, $name, $data);
 }
Exemplo n.º 20
0
 public function action_parms($id, $parms = array())
 {
     $id = (int) $id;
     $item = $parms['item'];
     if ($id < 1) {
         return $this->default();
     }
     //FIXME
     if (!$item) {
         $item = CMS::vars()->db()->find($id);
     }
     return $this->render('index', array('title' => $this->get_title($item), 'id' => $id, 'item' => $item, 'error' => $parms['error'], 'component' => $this->component, '_change' => $this->make_url('change', $id), '_addfile' => $this->make_url('addfile', $id), '_up' => $this->make_url()))->use_style(CMS::stdfile_url('styles/admin/table.css'));
 }