[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [12995] use ckeditor for rich text editor
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [12995] use ckeditor for rich text editor |
Date: |
Sat, 11 Apr 2015 16:30:42 +0000 |
Revision: 12995
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=12995
Author: sigurdne
Date: 2015-04-11 16:30:41 +0000 (Sat, 11 Apr 2015)
Log Message:
-----------
use ckeditor for rich text editor
Modified Paths:
--------------
branches/dev-syncromind/phpgwapi/inc/class.jquery.inc.php
branches/dev-syncromind/phpgwapi/inc/class.uicommon_jquery.inc.php
Modified: branches/dev-syncromind/phpgwapi/inc/class.jquery.inc.php
===================================================================
--- branches/dev-syncromind/phpgwapi/inc/class.jquery.inc.php 2015-04-10
23:09:59 UTC (rev 12994)
+++ branches/dev-syncromind/phpgwapi/inc/class.jquery.inc.php 2015-04-11
16:30:41 UTC (rev 12995)
@@ -267,4 +267,31 @@
return $output;
}
+ public static function init_ckeditor($target)
+ {
+ self::load_widget('core');
+ $GLOBALS['phpgw']->js->validate_file('ckeditor', 'ckeditor');
+ $GLOBALS['phpgw']->js->validate_file('ckeditor',
'adapters/jquery');
+ $userlang =
isset($GLOBALS['phpgw_info']['server']['default_lang']) &&
$GLOBALS['phpgw_info']['server']['default_lang']?
$GLOBALS['phpgw_info']['server']['default_lang'] : 'en';
+ if (
isset($GLOBALS['phpgw_info']['user']['preferences']['common']['lang']) )
+ {
+ $userlang =
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'];
+ }
+
+
+ $js = <<<JS
+
+ $( document ).ready( function() {
+ $( 'textarea#{$target}' ).ckeditor(
+ {
+ uiColor: '#9AB8F3',
+ language: '{$userlang}'
+ }
+ );
+ } );
+JS;
+ $GLOBALS['phpgw']->js->add_code('', $js);
+
+ }
+
}
\ No newline at end of file
Modified: branches/dev-syncromind/phpgwapi/inc/class.uicommon_jquery.inc.php
===================================================================
--- branches/dev-syncromind/phpgwapi/inc/class.uicommon_jquery.inc.php
2015-04-10 23:09:59 UTC (rev 12994)
+++ branches/dev-syncromind/phpgwapi/inc/class.uicommon_jquery.inc.php
2015-04-11 16:30:41 UTC (rev 12995)
@@ -520,77 +520,30 @@
return $result;
}
- public function use_yui_editor($targets)
+ /**
+ * Initiate rich text editor for selected targets
+ * @param array $targets
+ */
+ public function rich_text_editor($targets)
{
- /*
-
self::add_stylesheet('phpgwapi/js/yahoo/assets/skins/sam/skin.css');
- self::add_javascript('yahoo', 'yahoo/editor',
'simpleeditor-min.js');
- */
if(!is_array($targets))
{
$targets = array($targets);
}
-
- $lang_font_style = lang('Font Style');
- $lang_lists = lang('Lists');
- $lang_insert_item = lang('Insert Item');
- $js = '';
foreach ( $targets as $target )
{
- $js .= <<<SCRIPT
- (function() {
- var Dom = YAHOO.util.Dom,
- Event = YAHOO.util.Event;
-
- var editorConfig = {
- toolbar:
- {buttons: [
- { group: 'textstyle',
label: '{$lang_font_style}',
- buttons: [
- { type:
'push', label: 'Fet CTRL + SHIFT + B', value: 'bold' }
- ]
- },
- { type: 'separator' },
- { group: 'indentlist',
label: '{$lang_lists}',
- buttons: [
- { type:
'push', label: 'Opprett punktliste', value: 'insertunorderedlist' },
- { type:
'push', label: 'Opprett nummerert liste', value: 'insertorderedlist' }
- ]
- },
- { type: 'separator' },
- { group: 'insertitem',
label: '{$lang_insert_item}',
- buttons: [
- { type:
'push', label: 'HTML Lenke CTRL + SHIFT + L', value: 'createlink', disabled:
true },
- { type:
'push', label: 'Sett inn bilde', value: 'insertimage' }
- ]
- },
- { type: 'separator' },
- { group: 'undoredo',
label: 'Angre/Gjenopprett',
- buttons: [
- { type:
'push', label: 'Angre', value: 'undo' },
- { type:
'push', label: 'Gjenopprett', value: 'redo' }
- ]
- }
- ]
- },
- height: '200px',
- width: '700px',
- animate: true,
- dompath: true,
- handleSubmit: true
- };
-
- var editorWidget = new
YAHOO.widget.Editor('{$target}', editorConfig);
- editorWidget.render();
- })();
-
-SCRIPT;
+ phpgwapi_jquery::init_ckeditor($target);
}
+ }
-
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/editor/assets/skins/sam/editor.css');
- phpgw::import_class('phpgwapi.yui');
- phpgwapi_yui::load_widget('editor');
- $GLOBALS['phpgw']->js->add_event('load', $js);
+
+ /**
+ * Initiate rich text editor for selected targets
+ * @param array $targets
+ */
+ public function use_yui_editor($targets)
+ {
+ $this->rich_text_editor($targets);
}
public function render($template,$local_variables = array())
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [12995] use ckeditor for rich text editor,
Sigurd Nes <=