[limb-svn] r6727 - 3.x/trunk/limb/wysiwyg/src/wact
svn at limb-project.com
svn at limb-project.com
Tue Jan 22 12:03:49 MSK 2008
Author: serega
Date: 2008-01-22 12:03:48 +0300 (Tue, 22 Jan 2008)
New Revision: 6727
URL: http://fisheye.limb-project.com/changelog/limb/?cs=6727
Added:
3.x/trunk/limb/wysiwyg/src/wact/lmbFCKEditorComponent.class.php
3.x/trunk/limb/wysiwyg/src/wact/lmbTinyMCEComponent.class.php
3.x/trunk/limb/wysiwyg/src/wact/lmbWysiwygComponent.class.php
3.x/trunk/limb/wysiwyg/src/wact/wysiwyg.tag.php
Removed:
3.x/trunk/limb/wysiwyg/src/wact/components/
3.x/trunk/limb/wysiwyg/src/wact/tags/
Log:
-- WACT related folders renaming and movements in WYSIWYG package
Copied: 3.x/trunk/limb/wysiwyg/src/wact/lmbFCKEditorComponent.class.php (from rev 6726, 3.x/trunk/limb/wysiwyg/src/wact/components/lmbFCKEditorComponent.class.php)
===================================================================
--- 3.x/trunk/limb/wysiwyg/src/wact/lmbFCKEditorComponent.class.php (rev 0)
+++ 3.x/trunk/limb/wysiwyg/src/wact/lmbFCKEditorComponent.class.php 2008-01-22 09:03:48 UTC (rev 6727)
@@ -0,0 +1,57 @@
+<?php
+/*
+ * Limb PHP Framework
+ *
+ * @link http://limb-project.com
+ * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com)
+ * @license LGPL http://www.gnu.org/copyleft/lesser.html
+ */
+lmb_require('limb/wysiwyg/src/template/components/lmbWysiwygComponent.class.php');
+
+ at define('LIMB_FCKEDITOR_DIR', 'limb/wysiwyg/lib/FCKeditor/');
+
+/**
+ * class lmbFCKEditorComponent.
+ *
+ * @package wysiwyg
+ * @version $Id$
+ */
+class lmbFCKEditorComponent extends lmbWysiwygComponent
+{
+ var $dir = '';
+
+ function renderContents()
+ {
+ $this->renderEditor();
+ }
+
+ function renderEditor()
+ {
+ include_once(LIMB_FCKEDITOR_DIR . '/fckeditor.php');
+
+ $editor = new FCKeditor($this->getAttribute('name')) ;
+ $this->_setEditorParameters($editor);
+ $editor->Value = $this->getValue();
+
+ $editor->Create();
+ }
+
+ function _setEditorParameters($editor)
+ {
+ if($this->getIniOption('base_path'))
+ $editor->BasePath = $this->getIniOption('base_path');
+ else
+ $editor->BasePath = '/FCKEditor/';
+
+ if($this->getIniOption('Config'))
+ $editor->Config = $this->getIniOption('Config');
+
+ if($this->getIniOption('ToolbarSet'))
+ $editor->ToolbarSet = $this->getIniOption('ToolbarSet');
+
+ $editor->Width = $this->getAttribute('width');
+ $editor->Height = $this->getAttribute('height');
+ }
+}
+
+
Copied: 3.x/trunk/limb/wysiwyg/src/wact/lmbTinyMCEComponent.class.php (from rev 6726, 3.x/trunk/limb/wysiwyg/src/wact/components/lmbTinyMCEComponent.class.php)
===================================================================
--- 3.x/trunk/limb/wysiwyg/src/wact/lmbTinyMCEComponent.class.php (rev 0)
+++ 3.x/trunk/limb/wysiwyg/src/wact/lmbTinyMCEComponent.class.php 2008-01-22 09:03:48 UTC (rev 6727)
@@ -0,0 +1,73 @@
+<?php
+/*
+ * Limb PHP Framework
+ *
+ * @link http://limb-project.com
+ * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com)
+ * @license LGPL http://www.gnu.org/copyleft/lesser.html
+ */
+lmb_require('limb/wysiwyg/src/template/components/lmbWysiwygComponent.class.php');
+
+/**
+ * class lmbTinyMCEComponent.
+ *
+ * @package wysiwyg
+ * @version $Id$
+ */
+class lmbTinyMCEComponent extends lmbWysiwygComponent
+{
+ protected $_base_path;
+ protected $_css_class;
+ public static $is_included = false;
+ function renderContents()
+ {
+ $this->renderEditor();
+ parent::renderContents();
+ }
+
+ function renderEditor()
+ {
+ $this->_setEditorParameters();
+ if(!self::$is_included)
+ {
+ echo '<script language="javascript" type="text/javascript" src="'.$this->_base_path.'tiny_mce.js"></script>';
+ self::$is_included = true;
+
+ }
+ echo '
+ <script language="javascript" type="text/javascript">
+ tinyMCE.init({
+ '.$this->_renderEditorParameters().'
+ });
+ </script>
+ ';
+ }
+
+ function _renderEditorParameters()
+ {
+ $items = array();
+
+ $items[] = 'editor_selector : "'.$this->_css_class.'"';
+
+ if ($config = $this->getIniOption('editor') and count($config))
+ {
+ foreach ($config as $key => $val)
+ $items[] = $key . ': "'. $val . '"';
+ }
+
+ return implode (",\n", $items);
+ }
+
+ function _setEditorParameters()
+ {
+ if($this->getIniOption('base_path'))
+ $this->_base_path = $this->getIniOption('base_path');
+
+ if (!$this->_css_class = $this->getAttribute('class')){
+ $this->_css_class = $this->getAttribute('name');
+ $this->setAttribute('class', $this->_css_class);
+ }
+ }
+}
+
+
Copied: 3.x/trunk/limb/wysiwyg/src/wact/lmbWysiwygComponent.class.php (from rev 6726, 3.x/trunk/limb/wysiwyg/src/wact/components/lmbWysiwygComponent.class.php)
===================================================================
--- 3.x/trunk/limb/wysiwyg/src/wact/lmbWysiwygComponent.class.php (rev 0)
+++ 3.x/trunk/limb/wysiwyg/src/wact/lmbWysiwygComponent.class.php 2008-01-22 09:03:48 UTC (rev 6727)
@@ -0,0 +1,56 @@
+<?php
+/*
+ * Limb PHP Framework
+ *
+ * @link http://limb-project.com
+ * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com)
+ * @license LGPL http://www.gnu.org/copyleft/lesser.html
+ */
+lmb_require('limb/wact/src/components/form/form.inc.php');
+
+/**
+ * class lmbWysiwygComponent.
+ *
+ * @package wysiwyg
+ * @version $Id$
+ */
+class lmbWysiwygComponent extends WactTextAreaComponent
+{
+ var $ini = null;
+ var $group = null;
+
+ function renderContents()
+ {
+ echo '<textarea';
+ $this->renderAttributes();
+ echo '>';
+ echo htmlspecialchars($this->getValue(), ENT_QUOTES);
+ echo '</textarea>';
+ }
+
+ function getIniOption($option)
+ {
+ if($value = $this->ini->getOption($option, $this->group))
+ return $value;
+ return '';
+ }
+
+ function initWysiwyg($ini_file_name, $group = null)
+ {
+ $this->ini = lmbToolkit :: instance()->getConf($ini_file_name);
+ $this->group = $group;
+
+ if(!$this->getAttribute('rows'))
+ $this->setAttribute('rows', $this->getIniOption('rows'));
+
+ if(!$this->getAttribute('cols'))
+ $this->setAttribute('cols', $this->getIniOption('cols'));
+
+ if(!$this->getAttribute('width'))
+ $this->setAttribute('width', $this->getIniOption('width'));
+
+ if(!$this->getAttribute('height'))
+ $this->setAttribute('height', $this->getIniOption('height'));
+ }
+}
+
Copied: 3.x/trunk/limb/wysiwyg/src/wact/wysiwyg.tag.php (from rev 6726, 3.x/trunk/limb/wysiwyg/src/wact/tags/wysiwyg.tag.php)
===================================================================
--- 3.x/trunk/limb/wysiwyg/src/wact/wysiwyg.tag.php (rev 0)
+++ 3.x/trunk/limb/wysiwyg/src/wact/wysiwyg.tag.php 2008-01-22 09:03:48 UTC (rev 6727)
@@ -0,0 +1,67 @@
+<?php
+/*
+ * Limb PHP Framework
+ *
+ * @link http://limb-project.com
+ * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com)
+ * @license LGPL http://www.gnu.org/copyleft/lesser.html
+ */
+require_once('limb/wact/src/tags/form/control.inc.php');
+define('LIMB_WYSIWYG_DIR', dirname(__FILE__) . '/../../../');
+
+/**
+ * @tag richedit,wysiwyg
+ * @package wysiwyg
+ * @version $Id$
+ */
+class lmbWysiwygTag extends WactControlTag
+{
+ var $runtimeComponentName = 'lmbWysiwygComponent';
+ var $runtimeIncludeFile = 'limb/wysiwyg/src/template/components/lmbWysiwygComponent.class.php';
+ var $ini_file_name = 'wysiwyg.ini';
+ var $profile;
+
+ function prepare()
+ {
+ $this->determineComponent();
+ }
+
+ function determineComponent()
+ {
+ $ini = lmbToolkit :: instance()->getConf($this->ini_file_name);
+
+ if(($this->profile = $this->getAttribute('profile')) == '' &&
+ ($this->profile = $ini->getOption('profile')) == '')
+ {
+ $this->profile = null;
+ return;
+ }
+
+ if($ini->getOption('runtimeIncludeFile', $this->profile))
+ $this->runtimeIncludeFile = $ini->getOption('runtimeIncludeFile', $this->profile);
+ if($ini->getOption('runtimeComponentName', $this->profile))
+ $this->runtimeComponentName = $ini->getOption('runtimeComponentName', $this->profile);
+
+ }
+
+ protected function _renderOpenTag($code_writer)
+ {
+ }
+
+ protected function _renderCloseTag($code_writer)
+ {
+ }
+
+ function generateTagContent($code)
+ {
+ if(isset($this->attributeNodes['name']) && !$this->attributeNodes['name']->isConstant())
+ {
+ $code->writePhp($this->getComponentRefCode() . '->setAttribute("name", ');
+ $code->writePhp($this->attributeNodes['name']->generateExpression($code));
+ $code->writePhp(');' . "\n");
+ }
+ $code->writePhp($this->getComponentRefCode() . '->initWysiwyg("'. $this->ini_file_name . '","'.$this->profile.'" );' . "\n");
+ $code->writePhp($this->getComponentRefCode() . '->renderContents();' . "\n");
+ }
+}
+
More information about the limb-svn
mailing list