[limb-svn] r6735 - in 3.x/trunk/limb/wysiwyg: settings src src/macro src/wact
svn at limb-project.com
svn at limb-project.com
Wed Jan 23 17:07:39 MSK 2008
Author: serega
Date: 2008-01-23 17:07:39 +0300 (Wed, 23 Jan 2008)
New Revision: 6735
URL: http://fisheye.limb-project.com/changelog/limb/?cs=6735
Added:
3.x/trunk/limb/wysiwyg/settings/macro_wysiwyg.ini
3.x/trunk/limb/wysiwyg/settings/wact_wysiwyg.ini
3.x/trunk/limb/wysiwyg/src/macro/
3.x/trunk/limb/wysiwyg/src/macro/lmbMacroBaseWysiwygWidget.class.php
3.x/trunk/limb/wysiwyg/src/macro/lmbMacroFCKEditorWidget.class.php
3.x/trunk/limb/wysiwyg/src/macro/lmbMacroTinyMCEWidget.class.php
3.x/trunk/limb/wysiwyg/src/macro/wysiwyg.tag.php
Removed:
3.x/trunk/limb/wysiwyg/settings/wysiwyg.ini
Modified:
3.x/trunk/limb/wysiwyg/src/wact/lmbTinyMCEComponent.class.php
3.x/trunk/limb/wysiwyg/src/wact/wysiwyg.tag.php
Log:
-- added initial version of MACRO {{wysiwyg}} tag. Macro {{wysiwyg}} tag uses macro_wysiwyg.ini file for settings.
-- WACT <wysiwyg> tag now uses wact_wysiwyg.ini file for settings. BC should be kept
Added: 3.x/trunk/limb/wysiwyg/settings/macro_wysiwyg.ini
===================================================================
--- 3.x/trunk/limb/wysiwyg/settings/macro_wysiwyg.ini (rev 0)
+++ 3.x/trunk/limb/wysiwyg/settings/macro_wysiwyg.ini 2008-01-23 14:07:39 UTC (rev 6735)
@@ -0,0 +1,51 @@
+;============================
+; WYSIWYG configuration file
+;============================
+
+profile = FCKEditor
+
+[FCKEditor]
+widget_include_file = limb/wysiwyg/src/macro/lmbMacroFCKEditorWidget.class.php
+widget_class_name = lmbMacroFCKEditorWidget
+width = 600px
+height = 400px
+cols = 100
+rows = 15
+base_path = /shared/wysiwyg/fckeditor/
+Config[CustomConfigurationsPath] = /shared/wysiwyg/fckeditor/fckconfig.js
+ToolbarSet = Default
+
+[TinyMCE]
+widget_include_file = limb/wysiwyg/src/macro/lmbMacroTinyMCEWidget.class.php
+widget_class_name = lmbMacroTinyMCEWidget
+width = 600px
+height = 400px
+cols = 100
+rows = 15
+base_path = /shared/wysiwyg/tiny_mce/
+editor[mode] = "textareas"
+editor[theme] = "advanced"
+editor[plugins] = "spellchecker,style,layer,table,save,advhr,advimage,ibrowser,advlink,emotions,iespell,insertdatetime,preview,zoom,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template"
+editor[theme_advanced_buttons1_add_before] = "save,newdocument,separator"
+editor[theme_advanced_buttons1_add] = "fontselect,fontsizeselect"
+editor[theme_advanced_buttons2_add] = "separator,insertdate,inserttime,preview,separator,forecolor,backcolor"
+editor[theme_advanced_buttons2_add_before] = "cut,copy,paste,pastetext,pasteword,separator,search,replace,separator"
+editor[theme_advanced_buttons3_add_before] = "tablecontrols,separator"
+editor[theme_advanced_buttons3_add] = "ibrowser, emotions,iespell,media,advhr,separator,print,separator,ltr,rtl,separator,fullscreen"
+editor[theme_advanced_buttons4] = "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,spellchecker,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template"
+editor[theme_advanced_toolbar_location] = "top"
+editor[theme_advanced_toolbar_align] = "left"
+editor[theme_advanced_path_location] = "bottom"
+#editor[content_css] = "/example_data/example_full.css"
+editor[plugin_insertdate_dateFormat] = "%Y-%m-%d"
+editor[plugin_insertdate_timeFormat] = "%H:%M:%S"
+editor[extended_valid_elements] = "hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style],p[lang]"
+editor[external_link_list_url] "example_data/example_link_list.js"
+editor[external_image_list_url] = "example_data/example_image_list.js"
+editor[flash_external_list_url] = "example_data/example_flash_list.js"
+editor[template_external_list_url] = "example_data/example_template_list.js"
+#editor[file_browser_callback] = "icallback"
+editor[theme_advanced_resize_horizontal] = false
+editor[theme_advanced_resizing] = true
+editor[apply_source_formatting] = true
+editor[spellchecker_languages] = "+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv"
\ No newline at end of file
Added: 3.x/trunk/limb/wysiwyg/settings/wact_wysiwyg.ini
===================================================================
--- 3.x/trunk/limb/wysiwyg/settings/wact_wysiwyg.ini (rev 0)
+++ 3.x/trunk/limb/wysiwyg/settings/wact_wysiwyg.ini 2008-01-23 14:07:39 UTC (rev 6735)
@@ -0,0 +1,51 @@
+;============================
+; WYSIWYG configuration file
+;============================
+
+profile = FCKEditor
+
+[FCKEditor]
+runtimeIncludeFile = limb/wysiwyg/src/wact/lmbFCKEditorComponent.class.php
+runtimeComponentName = lmbFCKEditorComponent
+width = 600px
+height = 400px
+cols = 100
+rows = 15
+base_path = /shared/wysiwyg/fckeditor/
+Config[CustomConfigurationsPath] = /shared/wysiwyg/fckeditor/fckconfig.js
+ToolbarSet = Default
+
+[TinyMCE]
+runtimeIncludeFile = limb/wysiwyg/src/wact/lmbTinyMCEComponent.class.php
+runtimeComponentName = lmbTinyMCEComponent
+width = 600px
+height = 400px
+cols = 100
+rows = 15
+base_path = /shared/wysiwyg/tiny_mce/
+editor[mode] = "textareas"
+editor[theme] = "advanced"
+editor[plugins] = "spellchecker,style,layer,table,save,advhr,advimage,ibrowser,advlink,emotions,iespell,insertdatetime,preview,zoom,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template"
+editor[theme_advanced_buttons1_add_before] = "save,newdocument,separator"
+editor[theme_advanced_buttons1_add] = "fontselect,fontsizeselect"
+editor[theme_advanced_buttons2_add] = "separator,insertdate,inserttime,preview,separator,forecolor,backcolor"
+editor[theme_advanced_buttons2_add_before] = "cut,copy,paste,pastetext,pasteword,separator,search,replace,separator"
+editor[theme_advanced_buttons3_add_before] = "tablecontrols,separator"
+editor[theme_advanced_buttons3_add] = "ibrowser, emotions,iespell,media,advhr,separator,print,separator,ltr,rtl,separator,fullscreen"
+editor[theme_advanced_buttons4] = "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,spellchecker,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template"
+editor[theme_advanced_toolbar_location] = "top"
+editor[theme_advanced_toolbar_align] = "left"
+editor[theme_advanced_path_location] = "bottom"
+#editor[content_css] = "/example_data/example_full.css"
+editor[plugin_insertdate_dateFormat] = "%Y-%m-%d"
+editor[plugin_insertdate_timeFormat] = "%H:%M:%S"
+editor[extended_valid_elements] = "hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style],p[lang]"
+editor[external_link_list_url] "example_data/example_link_list.js"
+editor[external_image_list_url] = "example_data/example_image_list.js"
+editor[flash_external_list_url] = "example_data/example_flash_list.js"
+editor[template_external_list_url] = "example_data/example_template_list.js"
+#editor[file_browser_callback] = "icallback"
+editor[theme_advanced_resize_horizontal] = false
+editor[theme_advanced_resizing] = true
+editor[apply_source_formatting] = true
+editor[spellchecker_languages] = "+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv"
\ No newline at end of file
Deleted: 3.x/trunk/limb/wysiwyg/settings/wysiwyg.ini
===================================================================
--- 3.x/trunk/limb/wysiwyg/settings/wysiwyg.ini 2008-01-23 13:48:48 UTC (rev 6734)
+++ 3.x/trunk/limb/wysiwyg/settings/wysiwyg.ini 2008-01-23 14:07:39 UTC (rev 6735)
@@ -1,51 +0,0 @@
-;============================
-; WYSIWYG configuration file
-;============================
-
-profile = FCKEditor
-
-[FCKEditor]
-runtimeIncludeFile = limb/wysiwyg/src/wact/lmbFCKEditorComponent.class.php
-runtimeComponentName = lmbFCKEditorComponent
-width = 600px
-height = 400px
-cols = 100
-rows = 15
-base_path = /shared/wysiwyg/fckeditor/
-Config[CustomConfigurationsPath] = /shared/wysiwyg/fckeditor/fckconfig.js
-ToolbarSet = Default
-
-[TinyMCE]
-runtimeIncludeFile = limb/wysiwyg/src/wact/lmbTinyMCEComponent.class.php
-runtimeComponentName = lmbTinyMCEComponent
-width = 600px
-height = 400px
-cols = 100
-rows = 15
-base_path = /shared/wysiwyg/tiny_mce/
-editor[mode] = "textareas"
-editor[theme] = "advanced"
-editor[plugins] = "spellchecker,style,layer,table,save,advhr,advimage,ibrowser,advlink,emotions,iespell,insertdatetime,preview,zoom,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template"
-editor[theme_advanced_buttons1_add_before] = "save,newdocument,separator"
-editor[theme_advanced_buttons1_add] = "fontselect,fontsizeselect"
-editor[theme_advanced_buttons2_add] = "separator,insertdate,inserttime,preview,separator,forecolor,backcolor"
-editor[theme_advanced_buttons2_add_before] = "cut,copy,paste,pastetext,pasteword,separator,search,replace,separator"
-editor[theme_advanced_buttons3_add_before] = "tablecontrols,separator"
-editor[theme_advanced_buttons3_add] = "ibrowser, emotions,iespell,media,advhr,separator,print,separator,ltr,rtl,separator,fullscreen"
-editor[theme_advanced_buttons4] = "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,spellchecker,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template"
-editor[theme_advanced_toolbar_location] = "top"
-editor[theme_advanced_toolbar_align] = "left"
-editor[theme_advanced_path_location] = "bottom"
-#editor[content_css] = "/example_data/example_full.css"
-editor[plugin_insertdate_dateFormat] = "%Y-%m-%d"
-editor[plugin_insertdate_timeFormat] = "%H:%M:%S"
-editor[extended_valid_elements] = "hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style],p[lang]"
-editor[external_link_list_url] "example_data/example_link_list.js"
-editor[external_image_list_url] = "example_data/example_image_list.js"
-editor[flash_external_list_url] = "example_data/example_flash_list.js"
-editor[template_external_list_url] = "example_data/example_template_list.js"
-#editor[file_browser_callback] = "icallback"
-editor[theme_advanced_resize_horizontal] = false
-editor[theme_advanced_resizing] = true
-editor[apply_source_formatting] = true
-editor[spellchecker_languages] = "+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv"
\ No newline at end of file
Added: 3.x/trunk/limb/wysiwyg/src/macro/lmbMacroBaseWysiwygWidget.class.php
===================================================================
--- 3.x/trunk/limb/wysiwyg/src/macro/lmbMacroBaseWysiwygWidget.class.php (rev 0)
+++ 3.x/trunk/limb/wysiwyg/src/macro/lmbMacroBaseWysiwygWidget.class.php 2008-01-23 14:07:39 UTC (rev 6735)
@@ -0,0 +1,55 @@
+<?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/macro/src/tags/form/lmbMacroFormElementWidget.class.php');
+
+/**
+ * @package macro
+ * @version $Id$
+ */
+class lmbMacroBaseWysiwygWidget extends lmbMacroFormElementWidget
+{
+ protected $skip_render = array('value','profile','ini_name');
+ protected $ini;
+
+ function renderWysiwyg()
+ {
+ echo '<textarea';
+ $this->renderAttributes();
+ echo '>';
+ echo htmlspecialchars($this->getValue(), ENT_QUOTES);
+ echo '</textarea>';
+ }
+
+ function getIniOption($option)
+ {
+ if(!$this->ini)
+ $this->ini = lmbToolkit :: instance()->getConf($this->getAttribute('ini_name'));
+ if($this->ini && ($value = $this->ini->getOption($option, $this->getAttribute('profile'))))
+ return $value;
+ return '';
+ }
+
+ function _initWysiwyg()
+ {
+ 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'));
+ }
+
+}
+
Added: 3.x/trunk/limb/wysiwyg/src/macro/lmbMacroFCKEditorWidget.class.php
===================================================================
--- 3.x/trunk/limb/wysiwyg/src/macro/lmbMacroFCKEditorWidget.class.php (rev 0)
+++ 3.x/trunk/limb/wysiwyg/src/macro/lmbMacroFCKEditorWidget.class.php 2008-01-23 14:07:39 UTC (rev 6735)
@@ -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/wysiwyg/src/macro/lmbMacroBaseWysiwygWidget.class.php');
+ at define('LIMB_FCKEDITOR_DIR', 'limb/wysiwyg/lib/FCKeditor/');
+/**
+ * @package wysiwyg
+ * @version $Id$
+ */
+class lmbMacroFCKEditorWidget extends lmbMacroBaseWysiwygWidget
+{
+ protected $dir = '';
+
+ function renderWysiwyg()
+ {
+ $this->_initWysiwyg();
+
+ $this->_renderEditor();
+ }
+
+ protected function _renderEditor()
+ {
+ include_once(LIMB_FCKEDITOR_DIR . '/fckeditor.php');
+
+ $editor = new FCKeditor($this->getAttribute('name')) ;
+
+ $this->_setEditorParameters($editor);
+
+ $editor->Value = $this->getValue();
+
+ $editor->Create();
+ }
+
+ protected 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');
+ }
+}
Added: 3.x/trunk/limb/wysiwyg/src/macro/lmbMacroTinyMCEWidget.class.php
===================================================================
--- 3.x/trunk/limb/wysiwyg/src/macro/lmbMacroTinyMCEWidget.class.php (rev 0)
+++ 3.x/trunk/limb/wysiwyg/src/macro/lmbMacroTinyMCEWidget.class.php 2008-01-23 14:07:39 UTC (rev 6735)
@@ -0,0 +1,77 @@
+<?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/macro/lmbMacroBaseWysiwygWidget.class.php');
+
+/**
+ * @package wysiwyg
+ * @version $Id$
+ */
+class lmbMacroTinyMCEWidget extends lmbMacroBaseWysiwygWidget
+{
+ protected $_base_path;
+ protected $_css_class;
+
+ public static $is_included = false;
+
+ function renderWysiwyg()
+ {
+ $this->_initWysiwyg();
+
+ $this->_setEditorParameters();
+
+ $this->_renderEditor();
+
+ parent :: renderWysiwyg();
+ }
+
+ protected function _renderEditor()
+ {
+ 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>
+ ';
+ }
+
+ protected 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);
+ }
+
+ protected 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);
+ }
+ }
+
+}
Added: 3.x/trunk/limb/wysiwyg/src/macro/wysiwyg.tag.php
===================================================================
--- 3.x/trunk/limb/wysiwyg/src/macro/wysiwyg.tag.php (rev 0)
+++ 3.x/trunk/limb/wysiwyg/src/macro/wysiwyg.tag.php 2008-01-23 14:07:39 UTC (rev 6735)
@@ -0,0 +1,62 @@
+<?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/macro/src/tags/form/textarea.tag.php');
+
+/**
+ * Macro wysiwyg tag
+ * @tag wysiwyg
+ * @package wysiwyg
+ * @version $Id$
+ */
+class lmbMacroWysiwygTag extends lmbMacroTextAreaTag
+{
+ protected $ini_file_name = 'macro_wysiwyg.ini';
+ protected $profile;
+
+ function preParse($compiler)
+ {
+ parent :: preParse($compiler);
+
+ // always has closing tag
+ $this->has_closing_tag = true;
+
+ $this->_determineWidgetType();
+ }
+
+ protected function _determineWidgetType()
+ {
+ $ini = lmbToolkit :: instance()->getConf($this->ini_file_name);
+ if ($this->has('profile'))
+ {
+ $this->profile = $this->get('profile');
+ }
+ else
+ $this->profile = $ini->getOption('profile');
+
+ if($this->profile)
+ {
+ if($ini->getOption('widget_include_file', $this->profile))
+ $this->widget_include_file = $ini->getOption('widget_include_file', $this->profile);
+ if($ini->getOption('widget_class_name', $this->profile))
+ $this->widget_class_name = $ini->getOption('widget_class_name', $this->profile);
+
+ $this->html_tag = 'wysiwyg';
+ $this->has_closing_tag = false;
+ $this->set('ini_name',$this->ini_file_name);
+ $this->set('profile', $this->profile);
+ }
+ }
+
+ protected function _generateContent($code)
+ {
+ $widget = $this->getRuntimeVar();
+ $code->writePHP("{$widget}->renderWysiwyg();\n");
+ }
+}
Modified: 3.x/trunk/limb/wysiwyg/src/wact/lmbTinyMCEComponent.class.php
===================================================================
--- 3.x/trunk/limb/wysiwyg/src/wact/lmbTinyMCEComponent.class.php 2008-01-23 13:48:48 UTC (rev 6734)
+++ 3.x/trunk/limb/wysiwyg/src/wact/lmbTinyMCEComponent.class.php 2008-01-23 14:07:39 UTC (rev 6735)
@@ -19,6 +19,7 @@
protected $_base_path;
protected $_css_class;
public static $is_included = false;
+
function renderContents()
{
$this->renderEditor();
Modified: 3.x/trunk/limb/wysiwyg/src/wact/wysiwyg.tag.php
===================================================================
--- 3.x/trunk/limb/wysiwyg/src/wact/wysiwyg.tag.php 2008-01-23 13:48:48 UTC (rev 6734)
+++ 3.x/trunk/limb/wysiwyg/src/wact/wysiwyg.tag.php 2008-01-23 14:07:39 UTC (rev 6735)
@@ -18,7 +18,6 @@
{
var $runtimeComponentName = 'lmbWysiwygComponent';
var $runtimeIncludeFile = 'limb/wysiwyg/src/wact/lmbWysiwygComponent.class.php';
- var $ini_file_name = 'wysiwyg.ini';
var $profile;
function prepare()
@@ -28,7 +27,14 @@
function determineComponent()
{
- $ini = lmbToolkit :: instance()->getConf($this->ini_file_name);
+ try
+ {
+ $ini = lmbToolkit :: instance()->getConf('wact_wisywyg.ini');
+ }
+ catch(lmbException $e){}
+
+ if(!$ini)
+ $ini = lmbToolkit :: instance()->getConf('wisywyg.ini');
if(($this->profile = $this->getAttribute('profile')) == '' &&
($this->profile = $ini->getOption('profile')) == '')
@@ -41,7 +47,6 @@
$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)
More information about the limb-svn
mailing list