You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by ra...@apache.org on 2010/11/08 08:25:22 UTC

svn commit: r1032476 - in /lenya/branches/BRANCH_2_1_X/src/modules/tinymce/resources/tinymce/jscripts/tiny_mce/plugins: simplebrowser/ simplebrowser/langs/ unloadhandler/ unloadhandler/langs/

Author: rainer
Date: Mon Nov  8 07:25:21 2010
New Revision: 1032476

URL: http://svn.apache.org/viewvc?rev=1032476&view=rev
Log:
TinyMCE Integration:
  - Upgrade simplebrowser and unloadhandler plugins for Tiny 3.x
  - Add french translation of message for unloadhandler plugin.

Added:
    lenya/branches/BRANCH_2_1_X/src/modules/tinymce/resources/tinymce/jscripts/tiny_mce/plugins/unloadhandler/langs/fr.js
Removed:
    lenya/branches/BRANCH_2_1_X/src/modules/tinymce/resources/tinymce/jscripts/tiny_mce/plugins/simplebrowser/langs/
Modified:
    lenya/branches/BRANCH_2_1_X/src/modules/tinymce/resources/tinymce/jscripts/tiny_mce/plugins/simplebrowser/editor_plugin.js
    lenya/branches/BRANCH_2_1_X/src/modules/tinymce/resources/tinymce/jscripts/tiny_mce/plugins/unloadhandler/editor_plugin.js
    lenya/branches/BRANCH_2_1_X/src/modules/tinymce/resources/tinymce/jscripts/tiny_mce/plugins/unloadhandler/langs/de.js
    lenya/branches/BRANCH_2_1_X/src/modules/tinymce/resources/tinymce/jscripts/tiny_mce/plugins/unloadhandler/langs/en.js

Modified: lenya/branches/BRANCH_2_1_X/src/modules/tinymce/resources/tinymce/jscripts/tiny_mce/plugins/simplebrowser/editor_plugin.js
URL: http://svn.apache.org/viewvc/lenya/branches/BRANCH_2_1_X/src/modules/tinymce/resources/tinymce/jscripts/tiny_mce/plugins/simplebrowser/editor_plugin.js?rev=1032476&r1=1032475&r2=1032476&view=diff
==============================================================================
--- lenya/branches/BRANCH_2_1_X/src/modules/tinymce/resources/tinymce/jscripts/tiny_mce/plugins/simplebrowser/editor_plugin.js (original)
+++ lenya/branches/BRANCH_2_1_X/src/modules/tinymce/resources/tinymce/jscripts/tiny_mce/plugins/simplebrowser/editor_plugin.js Mon Nov  8 07:25:21 2010
@@ -15,80 +15,85 @@
   limitations under the License.
 */
 
-tinyMCE.importPluginLanguagePack('simplebrowser', 'en');
-
-var TinyMCE_SimpleBrowserPlugin = {
+(function() {
+    tinymce.create('tinymce.plugins.SimpleBrowserPlugin',{
 	options : {},
-	getInfo : function() {
-		return {
-			longname : '',
-			author : '',
-			authorurl : '',
-			infourl : '',
-			version : ""
-		};
-	},
 
-	initInstance : function(inst) {
-		// You can take out plugin specific parameters
-		//alert("Initialization parameter:" + tinyMCE.getParam("template_someparam", false));
-		tinyMCE.settings['file_browser_callback'] = "TinyMCE_SimpleBrowserPlugin_browse";
-		TinyMCE_SimpleBrowserPlugin.options = {
-			width : tinyMCE.getParam("plugin_simplebrowser_width", '800'),
-			height : tinyMCE.getParam("plugin_simplebrowser_height", '600'),
-			browseimageurl : tinyMCE.getParam("plugin_simplebrowser_browseimageurl", false),
-			browselinkurl : tinyMCE.getParam("plugin_simplebrowser_browselinkurl", false),
-			browseflashurl : tinyMCE.getParam("plugin_simplebrowser_browseflashurl", false)
-		}
-	},
+        init : function(ed, url) {
+		var t = this;
+		TinyMCE_SimpleBrowserPlugin = t;
+		t.editor = ed;
+
+		ed.settings.file_browser_callback = this.browse;
+
+		// settings
+		tinymce.each({
+			openServerBrowser : this.openServerBrowser,
+			width : ed.getParam("plugin_simplebrowser_width", '800'),
+			height : ed.getParam("plugin_simplebrowser_height", '600'),
+			browseimageurl : ed.getParam("plugin_simplebrowser_browseimageurl", false),
+			browselinkurl : ed.getParam("plugin_simplebrowser_browselinkurl", false),
+			browseflashurl : ed.getParam("plugin_simplebrowser_browseflashurl", false),
+		      }, function(value, key) {
+			key = 'simplebrowser_' + key;
+			
+			if (ed.settings[key] === undefined)
+			    ed.settings[key] = value;
+		 });
+
+	    },
+
+	openServerBrowser : function(field_name, current_url, link_type, win, browse_url)
+		{
+			this.options['field'] = field_name;
+			this.options['curl'] = current_url;
+			this.options['type'] = link_type;
+			this.options['target'] = win;
+
+			var sOptions = "toolbar=no,scrollbars=yes,status=no,resizable=yes,dependent=yes";
+			sOptions += ",width=" + this.options['width'];
+			sOptions += ",height=" + this.options['height'];
+			if (tinymce.isIE)	{
+			    // The following change has been made otherwise IE will open the file 
+			    // browser on a different server session (on some cases):
+			    // http://support.microsoft.com/default.aspx?scid=kb;en-us;831678
+			    // by Simone Chiaretta.
+			    var oWindow = window.open(browse_url, "TinyMCESimpleBrowserWindow", sOptions ) ;
+			    oWindow.opener = window;
+			} else {
+			    window.open(browse_url, "TinyMCESimpleBrowserWindow", sOptions );
+			}
+		},
 
 	browse : function(field_name, current_url, type, win) {
+
+		var ed = tinyMCE.activeEditor;
+		var pl = ed.plugins['simplebrowser'];
+
 		switch(type.toLowerCase()) {
 			case 'image':
-				if(TinyMCE_SimpleBrowserPlugin.options['browseimageurl']) {
-					TinyMCE_SimpleBrowserPlugin.openServerBrowser(field_name, current_url, type, win, TinyMCE_SimpleBrowserPlugin.options['browseimageurl']);
+				if(ed.settings['simplebrowser_browseimageurl']) {
+					pl.openServerBrowser(field_name, current_url, type, win, ed.settings['simplebrowser_browseimageurl']);
 				} else {
 					alert("Image browser URL not set.");
 				}
 				break;
 			case 'flash':
-				if(TinyMCE_SimpleBrowserPlugin.options['browseflashurl']) {
-					TinyMCE_SimpleBrowserPlugin.openServerBrowser(field_name, current_url, type, win, TinyMCE_SimpleBrowserPlugin.options['browseflashurl']);
+				if(ed.settings['simplebrowser_browseflashurl']) {
+					pl.openServerBrowser(field_name, current_url, type, win, ed.settings['simplebrowser_browseflashurl']);
 				} else {
 					alert("Flash browser URL not set.");
 				}
 				break;
 			default:
-				if(TinyMCE_SimpleBrowserPlugin.options['browselinkurl']) {
-					TinyMCE_SimpleBrowserPlugin.openServerBrowser(field_name, current_url, type, win, TinyMCE_SimpleBrowserPlugin.options['browselinkurl']);
+				if(ed.settings['simplebrowser_browselinkurl']) {
+					pl.openServerBrowser(field_name, current_url, type, win, ed.settings['simplebrowser_browselinkurl']);
 				} else {
 					alert("Link browser URL not set.");
 				}
 		}
 	},
 
-	openServerBrowser : function(field_name, current_url, link_type, win, browse_url)
-	{
-			TinyMCE_SimpleBrowserPlugin.options['field'] = field_name;
-			TinyMCE_SimpleBrowserPlugin.options['curl'] = current_url;
-			TinyMCE_SimpleBrowserPlugin.options['type'] = link_type;
-			TinyMCE_SimpleBrowserPlugin.options['target'] = win;
-
-		var sOptions = "toolbar=no,scrollbars=yes,status=no,resizable=yes,dependent=yes";
-		sOptions += ",width=" + TinyMCE_SimpleBrowserPlugin.options['width'];
-		sOptions += ",height=" + TinyMCE_SimpleBrowserPlugin.options['height'];
-		if (tinyMCE.isMSIE)	{
-			// The following change has been made otherwise IE will open the file 
-			// browser on a different server session (on some cases):
-			// http://support.microsoft.com/default.aspx?scid=kb;en-us;831678
-			// by Simone Chiaretta.
-			var oWindow = window.open(browse_url, "TinyMCESimpleBrowserWindow", sOptions ) ;
-			oWindow.opener = window;
-		} else {
-			window.open(browse_url, "TinyMCESimpleBrowserWindow", sOptions );
-		}
-	},
-
 	browserCallback : function(returnValue) {
 		if(!returnValue) return;
 		TinyMCE_SimpleBrowserPlugin.options['target'].document.forms[0].elements[TinyMCE_SimpleBrowserPlugin.options['field']].value = returnValue.url;
@@ -104,11 +109,22 @@ var TinyMCE_SimpleBrowserPlugin = {
 		if ((returnValue.title != null) && (TinyMCE_SimpleBrowserPlugin.options['target'].document.forms[0].elements.alt != null)) {    		
     		TinyMCE_SimpleBrowserPlugin.options['target'].document.forms[0].elements.alt.value = returnValue.title;
 		}
+
+	},
+
+	getInfo : function() {
+		return {
+		    longname : 'Simple Browser Plugin for Lenya / TinyMCE',
+		    author : 'lenya',
+		    authorurl : 'http://lenya.apache.org',
+		    infourl : 'http://lenya.apache.org',
+		    version : '2.0.X'
+		       };
 	}
-};
 
-function TinyMCE_SimpleBrowserPlugin_browse(field_name, current_url, type, win) {
-	TinyMCE_SimpleBrowserPlugin.browse(field_name, current_url, type, win)
-};
+	});
+
+    tinymce.PluginManager.add('simplebrowser', tinymce.plugins.SimpleBrowserPlugin);
+
+})();
 
-tinyMCE.addPlugin("simplebrowser", TinyMCE_SimpleBrowserPlugin);
\ No newline at end of file

Modified: lenya/branches/BRANCH_2_1_X/src/modules/tinymce/resources/tinymce/jscripts/tiny_mce/plugins/unloadhandler/editor_plugin.js
URL: http://svn.apache.org/viewvc/lenya/branches/BRANCH_2_1_X/src/modules/tinymce/resources/tinymce/jscripts/tiny_mce/plugins/unloadhandler/editor_plugin.js?rev=1032476&r1=1032475&r2=1032476&view=diff
==============================================================================
--- lenya/branches/BRANCH_2_1_X/src/modules/tinymce/resources/tinymce/jscripts/tiny_mce/plugins/unloadhandler/editor_plugin.js (original)
+++ lenya/branches/BRANCH_2_1_X/src/modules/tinymce/resources/tinymce/jscripts/tiny_mce/plugins/unloadhandler/editor_plugin.js Mon Nov  8 07:25:21 2010
@@ -16,28 +16,34 @@
 */
 
 /* Import plugin specific language pack 
- * this could be written in a more generic way (possibly in the editors module) */
-tinyMCE.importPluginLanguagePack('unloadhandler');
+ * this could be written in a more generic way (possibly in the editors module)
+ */
 
-var TinyMCE_UnloadHandlerPlugin = {
-  getInfo : function() {
-    return {
-      longname : 'Unload Handler Plugin for Lenya / TinyMCE',
-      author : 'lenya',
-      authorurl : 'http://lenya.apache.org',
-      infourl : 'http://lenya.apache.org',
-      version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
-    };
-  },
-
-  // Private plugin internal methods
-
-  _beforeUnloadHandler : function() {
-    var msg = tinyMCE.getLang("lang_unloadhandler_unload_msg");
-    return msg;
-  }
-};
+(function() {
+
+    tinymce.create('tinymce.plugins.UnloadPlugin', {
+
+	    init : function(ed, url) {
+		tinymce.DOM.win.onbeforeunload = function() {
+		    var msg = ed.getLang("unloadhandler.unload_msg");
+		    return msg;
+		}
+	    },
+
+	    getInfo : function() {
+		return {
+		    longname : 'Unload Handler Plugin for Lenya / TinyMCE',
+		    author : 'lenya',
+		    authorurl : 'http://lenya.apache.org',
+		    infourl : 'http://lenya.apache.org',
+		    version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
+		       };
+	    }
+
+	});
+	
+    tinymce.PluginManager.add("unloadhandler", tinymce.plugins.UnloadPlugin);
+    tinymce.PluginManager.requireLangPack('unloadhandler');
+})();
 
-window.onbeforeunload = TinyMCE_UnloadHandlerPlugin._beforeUnloadHandler;
 
-tinyMCE.addPlugin("unloadhandler", TinyMCE_UnloadHandlerPlugin);

Modified: lenya/branches/BRANCH_2_1_X/src/modules/tinymce/resources/tinymce/jscripts/tiny_mce/plugins/unloadhandler/langs/de.js
URL: http://svn.apache.org/viewvc/lenya/branches/BRANCH_2_1_X/src/modules/tinymce/resources/tinymce/jscripts/tiny_mce/plugins/unloadhandler/langs/de.js?rev=1032476&r1=1032475&r2=1032476&view=diff
==============================================================================
--- lenya/branches/BRANCH_2_1_X/src/modules/tinymce/resources/tinymce/jscripts/tiny_mce/plugins/unloadhandler/langs/de.js (original)
+++ lenya/branches/BRANCH_2_1_X/src/modules/tinymce/resources/tinymce/jscripts/tiny_mce/plugins/unloadhandler/langs/de.js Mon Nov  8 07:25:21 2010
@@ -17,6 +17,6 @@
 
 // DE lang variables
 
-tinyMCE.addToLang('',{
-unloadhandler_unload_msg : 'Achtung: wenn Sie den Editor mit OK verlassen verlieren Sie alle Änderungen und das Dokument verbleibt «checked out».'
-});
\ No newline at end of file
+tinyMCE.addI18n('de.unloadhandler',{
+    unload_msg : 'Achtung: wenn Sie den Editor mit OK verlassen verlieren Sie alle Änderungen und das Dokument verbleibt «checked out».'
+});

Modified: lenya/branches/BRANCH_2_1_X/src/modules/tinymce/resources/tinymce/jscripts/tiny_mce/plugins/unloadhandler/langs/en.js
URL: http://svn.apache.org/viewvc/lenya/branches/BRANCH_2_1_X/src/modules/tinymce/resources/tinymce/jscripts/tiny_mce/plugins/unloadhandler/langs/en.js?rev=1032476&r1=1032475&r2=1032476&view=diff
==============================================================================
--- lenya/branches/BRANCH_2_1_X/src/modules/tinymce/resources/tinymce/jscripts/tiny_mce/plugins/unloadhandler/langs/en.js (original)
+++ lenya/branches/BRANCH_2_1_X/src/modules/tinymce/resources/tinymce/jscripts/tiny_mce/plugins/unloadhandler/langs/en.js Mon Nov  8 07:25:21 2010
@@ -6,7 +6,6 @@
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at
 
-      http://www.apache.org/licenses/LICENSE-2.0
 
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
@@ -17,6 +16,6 @@
 
 // EN lang variables
 
-tinyMCE.addToLang('',{
-unloadhandler_unload_msg : 'Warning: if you leave the editor by clicking OK edits will be lost and the document will be left checked out.'
+tinyMCE.addI18n('en.unloadhandler',{
+   unload_msg : 'Warning: if you leave the editor by clicking OK edits will be lost and the document will be left checked out.'
 });

Added: lenya/branches/BRANCH_2_1_X/src/modules/tinymce/resources/tinymce/jscripts/tiny_mce/plugins/unloadhandler/langs/fr.js
URL: http://svn.apache.org/viewvc/lenya/branches/BRANCH_2_1_X/src/modules/tinymce/resources/tinymce/jscripts/tiny_mce/plugins/unloadhandler/langs/fr.js?rev=1032476&view=auto
==============================================================================
--- lenya/branches/BRANCH_2_1_X/src/modules/tinymce/resources/tinymce/jscripts/tiny_mce/plugins/unloadhandler/langs/fr.js (added)
+++ lenya/branches/BRANCH_2_1_X/src/modules/tinymce/resources/tinymce/jscripts/tiny_mce/plugins/unloadhandler/langs/fr.js Mon Nov  8 07:25:21 2010
@@ -0,0 +1,23 @@
+/*
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+*/
+
+// FR lang variables
+
+tinyMCE.addI18n('fr.unloadhandler',{
+    unload_msg : 'Attention: si vous sortez de l'éditeur en cliquant sur OK modifications seront perdues et le document sera laissée «checked out».'
+});
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org