• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

XOOPS Cube Legacy base repository


Commit MetaInfo

Revision03f70fc15d8a69189192646061c1760241edc08e (tree)
Zeit2013-02-04 17:24:15
Autornao-pon <hypweb@gmai...>
Commiternao-pon

Log Message

support editor delegate with xoopsform dhtmltarea

ex.
php
$tarea = new XoopsFormDhtmlTextArea(, 'body' , ) ;
if (method_exists($tarea, 'setEditor')) {
$tarea->setEditor($allow_html? 'html' : 'bbcode');
}

[ja]XCL 2.2 から採用された HTML エディタ仕様に対応した
XoopsFormDhtmlTextArea です。Smarty テンプレートを利用しないフォームでも
HTML エディタの切り替えが可能になります。[/ja]

Ändern Zusammenfassung

Diff

--- a/html/class/xoopsform/formdhtmltextarea.php
+++ b/html/class/xoopsform/formdhtmltextarea.php
@@ -64,6 +64,13 @@ class XoopsFormDhtmlTextArea extends XoopsFormTextArea
6464 * @access private
6565 */
6666 var $_hiddenText;
67+
68+ /**
69+ * Editor type
70+ * @var string
71+ * @access private
72+ */
73+ private $_editor;
6774
6875 /**
6976 * Constructor
@@ -89,6 +96,33 @@ class XoopsFormDhtmlTextArea extends XoopsFormTextArea
8996 function render()
9097 {
9198 $root =& XCube_Root::getSingleton();
99+
100+ if ($this->_editor) {
101+ $params['name'] = trim($this->getName(false));
102+ $params['class'] = trim($this->getClass());
103+ $params['cols'] = $this->getCols();
104+ $params['rows'] = $this->getRows();
105+ $params['value'] = $this->getValue();
106+ $params['id'] = $this->getId();
107+ $params['editor'] = $this->getEditor();
108+
109+ $html = '';
110+ switch ($params['editor']) {
111+ case 'html':
112+ XCube_DelegateUtils::call('Site.TextareaEditor.HTML.Show', new XCube_Ref($html), $params);
113+ break;
114+ case 'none':
115+ XCube_DelegateUtils::call('Site.TextareaEditor.None.Show', new XCube_Ref($html), $params);
116+ break;
117+ case 'bbcode':
118+ default:
119+ XCube_DelegateUtils::call('Site.TextareaEditor.BBCode.Show', new XCube_Ref($html), $params);
120+ break;
121+ }
122+
123+ return $html;
124+ }
125+
92126 $renderSystem =& $root->getRenderSystem(XOOPSFORM_DEPENDENCE_RENDER_SYSTEM);
93127
94128 $renderTarget =& $renderSystem->createRenderTarget('main');
@@ -129,5 +163,24 @@ class XoopsFormDhtmlTextArea extends XoopsFormTextArea
129163
130164 return $renderTarget->getResult();
131165 }
166+
167+ /**
168+ * set editor mode for XCL 2.2
169+ *
170+ * @param string editor type
171+ */
172+ function setEditor($editor) {
173+ $this->_editor = strtolower($editor);
174+ }
175+
176+ /**
177+ * get the "editor" value
178+ *
179+ * @return string editor type
180+ */
181+ function getEditor() {
182+ return $this->_editor;
183+ }
184+
132185 }
133186 ?>