1: <?php
2:
3: 4: 5: 6: 7: 8: 9:
10:
11: defined('_JOOS_CORE') or exit();
12:
13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24:
25: class pluginEditorElrte
26: {
27: public static function init()
28: {
29: joosDocument::instance()
30: ->add_css(JPATH_APP_PLUGINS_SITE . '/editors/elrte/css/smoothness/jquery-ui-1.8.13.custom.css')
31: ->add_css(JPATH_APP_PLUGINS_SITE . '/editors/elrte/css/elrte.min.css')
32: ->add_js_file(JPATH_APP_PLUGINS_SITE . '/editors/elrte/js/elrte.min.js')
33: ->add_js_file(JPATH_APP_PLUGINS_SITE . '/editors/elrte/js/i18n/elrte.ru.js');
34: }
35:
36: public static function display($name, $content, $hiddenField, $width, $height, $col, $row, $params)
37: {
38: 39: 40: 41: 42: 43: 44:
45: $toolbar = isset($params['toolbar']) ? $params['toolbar'] : 'maxi';
46:
47: $code_on_ready = <<< EOD
48: elRTE.prototype.filter.prototype.replaceTags = false;
49:
50: $().ready(function() {
51: $('#$name').elrte({
52: cssClass : 'el-rte',
53: lang : 'ru',
54: height : '$height',
55: width: '$width',
56: toolbar : '$toolbar',
57: fmAllow: true,
58: fmOpen: function(callback) {
59: $('<div id="finder" />').elfinder({
60: url : '/ajax.index.php?option=finder',
61: lang : 'ru',
62: view : 'icons',
63: dialog : { width : 900, modal : true, title : 'elFinder - менеджер файлов' },
64: closeOnEditorCallback : true,
65: editorCallback : callback,
66: places: '',
67: placesFirst : false
68: })
69: }
70:
71:
72: });
73: });
74: EOD;
75: joosDocument::instance()->add_js_code($code_on_ready);
76:
77: return '<div id="finder"></div><textarea name="' . $hiddenField . '" id="' . $hiddenField . '" cols="' . $col . '" rows="' . $row . '" style="width:' . $width . ';height:' . $height . ';">' . $content . '</textarea>';
78: }
79:
80: public static function get_content($name, $params = array())
81: {
82: return isset($params['js_wrap']) ? joosHtml::js_code('$(\'#' . $name . '\').elrte("updateSource");') : '$(\'#' . $name . '\').elrte("updateSource");';
83: }
84:
85: }
86: