From b2f168040225ec99f51bcd654dc2bc316daede86 Mon Sep 17 00:00:00 2001 From: hjkhjk54 Date: Wed, 2 Nov 2011 18:00:04 +0000 Subject: [PATCH] updates to include tinymce in the default data property editing form --- webapp/web/js/edit/initTinyMce.js | 29 +++++++++++++++++++ webapp/web/js/tiny_mce/jquery-tinymce.js | 18 ++++++++++++ .../edit/forms/defaultDataPropertyForm.ftl | 4 +-- .../edit/forms/defaultFormScripts.ftl | 8 +++-- 4 files changed, 54 insertions(+), 5 deletions(-) create mode 100644 webapp/web/js/edit/initTinyMce.js create mode 100644 webapp/web/js/tiny_mce/jquery-tinymce.js diff --git a/webapp/web/js/edit/initTinyMce.js b/webapp/web/js/edit/initTinyMce.js new file mode 100644 index 000000000..fb95f2602 --- /dev/null +++ b/webapp/web/js/edit/initTinyMce.js @@ -0,0 +1,29 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +var initTinyMCE = { + // Initial page setup + onLoad: function() { + this.mergeFromTemplate(); + this.initObjects(); + this.initEditor(); + + }, + + // Add variables from menupage template + mergeFromTemplate: function() { + $.extend(this, customFormData); + }, + initObjects: function() { + this.wsywigFields = $(".useTinyMce"); + }, + // Create references to frequently used elements for convenience + initEditor: function() { + initTinyMCE.wsywigFields.tinymce(initTinyMCE.tinyMCEData); + + } +}; + +$(document).ready(function() { + initTinyMCE.onLoad(); +}); + diff --git a/webapp/web/js/tiny_mce/jquery-tinymce.js b/webapp/web/js/tiny_mce/jquery-tinymce.js new file mode 100644 index 000000000..9a9d76f6b --- /dev/null +++ b/webapp/web/js/tiny_mce/jquery-tinymce.js @@ -0,0 +1,18 @@ +/** + * jQuery TinyMCE (http://mktgdept.com/jquery-tinymce-plugin) + * A jQuery plugin for unobtrusive TinyMCE + * + * v0.0.2 - 28 August 2009 + * + * Copyright (c) 2009 Chad Smith (http://twitter.com/chadsmith) + * Dual licensed under the MIT and GPL licenses. + * http://www.opensource.org/licenses/mit-license.php + * http://www.opensource.org/licenses/gpl-license.php + * + * Add TinyMCE to an element using: $(element).tinymce([settings]); + * Note that TinyMCE has released a Jquery version of itself that includes a plugin for jquery + * and we should probably use that instead but that would require overwriting the tiny mce javscript + * that currently exists + * + **/ +;jQuery.fn.tinymce=jQuery.fn.tinyMCE=jQuery.fn.TinyMCE=function(d,e){return this.each(function(i){var a,b,c=this.id=this.id||this.name||(this.className||'jMCE')+i;if(d&&Object===d.constructor){e=d;d=null}if(!d&&tinyMCE.get(c)){d='remove';b=true}switch(d){case'remove':a='mceRemoveControl';break;case'toggle':a='mceToggleEditor';break;default:a='mceAddControl'}tinyMCE.settings=e;tinyMCE.execCommand(a,false,c);if(b)$(this).tinyMCE(e)})}; \ No newline at end of file diff --git a/webapp/web/templates/freemarker/edit/forms/defaultDataPropertyForm.ftl b/webapp/web/templates/freemarker/edit/forms/defaultDataPropertyForm.ftl index 7c91c5e5a..7d7638cc0 100644 --- a/webapp/web/templates/freemarker/edit/forms/defaultDataPropertyForm.ftl +++ b/webapp/web/templates/freemarker/edit/forms/defaultDataPropertyForm.ftl @@ -11,9 +11,9 @@ - + value="${literalValues}" class="useTinyMce">${literalValues}
diff --git a/webapp/web/templates/freemarker/edit/forms/defaultFormScripts.ftl b/webapp/web/templates/freemarker/edit/forms/defaultFormScripts.ftl index af4fd770a..df8c180c1 100644 --- a/webapp/web/templates/freemarker/edit/forms/defaultFormScripts.ftl +++ b/webapp/web/templates/freemarker/edit/forms/defaultFormScripts.ftl @@ -25,13 +25,14 @@ <#-- Set up data --> <#-- Script to enable browsing individuals within a class -->