示例#1
0
 /**
  *  Загрузка скриптов
  */
 public function load()
 {
     $this->toolbar = Core_ArrayObject::transform($this->toolbar);
     $folder = cogear()->redactor->folder . DS . 'redactor' . DS;
     $options = new Core_ArrayObject();
     event('redactor.options', $options);
     $options->lang = config('i18n.lang', 'ru');
     $options->shortcuts = TRUE;
     $options->minHeight = 300;
     $options->buttons = array('formatting', 'alignment', '|', 'bold', 'italic', 'deleted', '|', 'unorderedlist', 'orderedlist', 'outdent', 'indent', '|', 'table', 'link', 'image', '|', 'fontcolor', 'backcolor', '|', 'horizontalrule', '|', 'html');
     //        $options->imageUpload = l('/redactor/upload/');
     $options->fixed = TRUE;
     $options->observeImages = TRUE;
     $options->convertLinks = TRUE;
     $options->cleanup = FALSE;
     $options->focus = TRUE;
     $options->convertDivs = FALSE;
     role() == 1 && ($options->fixedTop = 40);
     js($folder . $options->lang . '.js', 'after');
     //        $this->toolbar->markupSet->uasort('Core_ArrayObject::sortByOrder');
     //            $(document).ready(function(){
     css($folder . 'redactor.css');
     js($folder . 'redactor.min.js', 'after');
     inline_js("\$('[name={$this->name}]').redactor(" . $options->toJSON() . ")", 'after');
 }
示例#2
0
 /**
  * Render
  * 
  * @return string
  */
 public function render()
 {
     $this->options['lang'] = config('site.locale', 'en');
     extract((array) $this->options);
     cogear()->elfinder->load();
     inline_js("\$(document).ready(\r\n\t\tfunction()\r\n\t\t{\r\n                  var opts = {\r\n                    lang: '{$lang}',\r\n                    styleWithCSS: " . ($styleWithCSS ? 'true' : 'false') . ",\r\n                    width: '{$width}',\r\n                    height: {$height},\r\n                    toolbar: '{$toolbar}',\r\n                    cssfiles : ['" . Url::gear('elrte') . "/css/elrte-inner.css'],\r\n                    fmAllow: true,\r\n                    fmOpen: function(callback){\r\n                        \$(\"<div id='{$this->getId()}-elfinder'>\").elfinder({\r\n                            url: '" . Url::gear('elfinder') . "connector/',\r\n                            lang: '{$lang}',\r\n                            dialog : { width : 900, modal : true, title : '" . t('Files') . "' }, // открываем в диалоговом окне\r\n                            closeOnEditorCallback : true, // закрываем после выбора файла\r\n                            editorCallback : callback\r\n                        })\r\n                    }\r\n                };\r\n         \$('#{$this->getId()} textarea').elrte(opts);\r\n\t\t}\r\n\t);");
     event('elRTE.load', $this);
     return parent::render();
 }
示例#3
0
 /**
  * Load scripts
  */
 public function load()
 {
     $folder = cogear()->markitup->folder . '/';
     css($folder . 'skins/simple/style.css');
     css($folder . 'sets/default/style.css');
     js($folder . 'js/jquery.markitup.js', 'after');
     $toolbar = Core_ArrayObject::transform($toolbar = array('nameSpace' => 'html', 'onCtrlEnter' => array('keepDefault' => FALSE, 'openWith' => "\n<p>", 'closeWith' => "</p>\n"), 'onTab' => array('keepDefault' => false, 'openWith' => '  '), 'markupSet' => array(array('name' => t('Bold'), 'key' => 'B', 'openWith' => '<b>', 'closeWith' => '</b>', 'className' => 'markItUpBold'), array('name' => t('Italic'), 'key' => 'I', 'openWith' => '<i>', 'closeWith' => '</i>', 'className' => 'markItUpItalic'), array('name' => t('Underlined'), 'key' => 'U', 'openWith' => '<u>', 'closeWith' => '</u>', 'className' => 'markItUpUndeline'), array('name' => t('Strike through'), 'key' => 'S', 'openWith' => '<s>', 'closeWith' => '</s>', 'className' => 'markItUpStrike'), array('name' => t('Heading 1'), 'key' => '1', 'openWith' => '<h1>', 'closeWith' => '</h1>', 'className' => 'markItUpH1'), array('name' => t('Heading 2'), 'key' => '2', 'openWith' => '<h2>', 'closeWith' => '</h2>', 'className' => 'markItUpH2'), array('name' => t('Heading 3'), 'key' => '3', 'openWith' => '<h3>', 'closeWith' => '</h3>', 'className' => 'markItUpH3'), array('name' => t('UL'), 'multiline' => true, 'openBlockWith' => "<ul>\n", 'closeBlockWith' => "\n</ul>\n", 'openWith' => " <li>", 'closeWith' => "</li>", 'className' => 'markItUpUl'), array('name' => t('OL'), 'multiline' => true, 'openBlockWith' => "<ol>\n", 'closeBlockWith' => "\n</ol>\n", 'openWith' => " <li>", 'closeWith' => "</li>", 'className' => 'markItUpOl'), array('name' => t('Picture'), 'key' => 'P', 'replaceWith' => '<img src="[![Source:!:http://]!]" alt="" />', 'className' => 'markItUpPicture'), array('name' => t('Link'), 'key' => 'L', 'openWith' => '<a href="[![Link:!:http://]!]">', 'closeWith' => '</a>', 'className' => 'markItUpLink'), array('name' => t('User'), 'key' => 'U', 'openWith' => '[user=[![User]!]]', 'className' => 'markItUpUser'), array('name' => t('Code'), 'key' => 'O', 'openWith' => '<pre class="prettyprint linenums"><code>', 'closeWith' => '</code></pre>', 'className' => 'markItUpCode'))));
     event('markitup.toolbar', $toolbar);
     inline_js("\$('[name={$this->name}]').markItUp(" . $toolbar->toJSON() . ")", 'after');
 }
示例#4
0
文件: Gear.php 项目: romartyn/cogear
 /**
  * Show flashed messages
  */
 public function finish()
 {
     if ($this->session->messages) {
         foreach ($this->session->messages as $offset => $data) {
             call_user_func_array(array($this, 'show'), $data);
         }
         $this->session->destroy('messages');
     }
     if (config('messages.type', 'plain') == 'pop') {
         inline_js('$(document).ready(function(){$(".msg").message();})');
     }
     inline_js("\$(document).ready(function(){window.Messenger.render()});");
 }
示例#5
0
文件: Tab.php 项目: romartyn/cogear
 /**
  * Initiate tabs
  * 
  * @param string $code 
  */
 public function initTabs($form)
 {
     $prepend = '<div class="tabs"><ul>' . "\n";
     foreach (self::$tabs as $id => $label) {
         $prepend .= "\t" . '<li id="tab-' . $id . '"><a href="#tab-' . $id . '">' . $label . '</a></li>' . "\n";
     }
     $prepend .= "</ul></div>";
     $form->code = preg_replace('(<form([^>]*)>)', '$0' . $prepend, $form->code);
     inline_js('$(document).ready(function(){
         $("div.tabs > ul").cgTabs("#' . $this->form->getId() . ' > .tab",{
             handler: "li",
         });
     })');
 }
示例#6
0
文件: List.php 项目: brussens/cogear2
    /**
     * Настройки
     */
    public function settings()
    {
        $form = new Form(array('#name' => 'widget.pages.list', 'root' => array('type' => 'select', 'validate' => array('Required'), 'value' => $this->options->root, 'values' => page()->getSelectValues(), 'label' => t('Выберите корневую страницу')), 'current' => array('type' => 'checkbox', 'label' => t('Использовать текущую страницу как корневую'), 'value' => $this->options->current), 'template' => array('type' => 'text', 'value' => $this->options->template, 'label' => t('Шаблон для вывода'), 'description' => t('Будьте внимательны! Указывайте только существующий шаблон во избежание ошибок.')), 'actions' => array('#class' => 'form-actions', 'save' => array())));
        inline_js('$(document).ready(function(){
            $("input[type=checkbox]").on("change",function(){
                if($(this).attr("checked")){
                    $("#form-widget-pages-list-root").slideUp("fast");
                }
                else {
                    $("#form-widget-pages-list-root").slideDown("fast");
                }
            }).trigger("change");

        })');
        if ($result = $form->result()) {
            $this->options->root = $result->root;
            $this->options->template = $result->template;
            $this->options->current = (bool) $result->current;
            if ($this->save()) {
                return TRUE;
            }
        }
        $form->show();
    }
示例#7
0
 /**
  * Render
  * 
  * @return string
  */
 public function render()
 {
     inline_js("\$(document).ready(\r\n\t\tfunction()\r\n\t\t{\r\n\t\t\t\$('#{$this->getId()} textarea').editor(" . json_encode((array) $this->options) . ");\r\n\t\t}\r\n\t);");
     return parent::render();
 }