XOOPS Cube Legacy base repository
Revisão | 143f14f326932150ea9de2864478c920a8f02b52 (tree) |
---|---|
Hora | 2013-03-10 10:37:59 |
Autor | HIKAWA Kilica <kilica.hikawa@gmai...> |
Commiter | HIKAWA Kilica |
Merge pull request #68 from nao-pon/formdhtmltarea
support editor delegate with xoopsform dhtmltarea
@@ -64,7 +64,22 @@ class XoopsFormDhtmlTextArea extends XoopsFormTextArea | ||
64 | 64 | * @access private |
65 | 65 | */ |
66 | 66 | var $_hiddenText; |
67 | - | |
67 | + | |
68 | + /** | |
69 | + * Editor type | |
70 | + * @var string | |
71 | + * @access private | |
72 | + */ | |
73 | + private $_editor; | |
74 | + | |
75 | + /** | |
76 | + * Editor check for recursive prevention | |
77 | + * @static | |
78 | + * @var array | |
79 | + * @access private | |
80 | + */ | |
81 | + private static $_editorCheck = array(); | |
82 | + | |
68 | 83 | /** |
69 | 84 | * Constructor |
70 | 85 | * |
@@ -89,6 +104,35 @@ class XoopsFormDhtmlTextArea extends XoopsFormTextArea | ||
89 | 104 | function render() |
90 | 105 | { |
91 | 106 | $root =& XCube_Root::getSingleton(); |
107 | + | |
108 | + $editor = $this->getEditor(); | |
109 | + if ($editor && !isset(self::$_editorCheck[$id])) { | |
110 | + self::$_editorCheck[$id] = true; | |
111 | + $params['name'] = trim($this->getName(false)); | |
112 | + $params['class'] = trim($this->getClass()); | |
113 | + $params['cols'] = $this->getCols(); | |
114 | + $params['rows'] = $this->getRows(); | |
115 | + $params['value'] = $this->getValue(); | |
116 | + $params['id'] = $this->getId(); | |
117 | + $params['editor'] = $editor; | |
118 | + | |
119 | + $html = ''; | |
120 | + switch ($params['editor']) { | |
121 | + case 'html': | |
122 | + XCube_DelegateUtils::call('Site.TextareaEditor.HTML.Show', new XCube_Ref($html), $params); | |
123 | + break; | |
124 | + case 'none': | |
125 | + XCube_DelegateUtils::call('Site.TextareaEditor.None.Show', new XCube_Ref($html), $params); | |
126 | + break; | |
127 | + case 'bbcode': | |
128 | + default: | |
129 | + XCube_DelegateUtils::call('Site.TextareaEditor.BBCode.Show', new XCube_Ref($html), $params); | |
130 | + break; | |
131 | + } | |
132 | + | |
133 | + return $html; | |
134 | + } | |
135 | + | |
92 | 136 | $renderSystem =& $root->getRenderSystem(XOOPSFORM_DEPENDENCE_RENDER_SYSTEM); |
93 | 137 | |
94 | 138 | $renderTarget =& $renderSystem->createRenderTarget('main'); |
@@ -129,5 +173,24 @@ class XoopsFormDhtmlTextArea extends XoopsFormTextArea | ||
129 | 173 | |
130 | 174 | return $renderTarget->getResult(); |
131 | 175 | } |
176 | + | |
177 | + /** | |
178 | + * set editor mode for XCL 2.2 | |
179 | + * | |
180 | + * @param string editor type | |
181 | + */ | |
182 | + function setEditor($editor) { | |
183 | + $this->_editor = strtolower($editor); | |
184 | + } | |
185 | + | |
186 | + /** | |
187 | + * get the "editor" value | |
188 | + * | |
189 | + * @return string editor type | |
190 | + */ | |
191 | + function getEditor() { | |
192 | + return $this->_editor; | |
193 | + } | |
194 | + | |
132 | 195 | } |
133 | 196 | ?> |