[pLog-svn] r7043 - in plog/branches/lifetype-1.2/js/tinymce/plugins/insertaudio: . langs

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Wed Sep 22 14:58:32 EDT 2010


Author: jondaley
Date: 2010-09-22 14:58:32 -0400 (Wed, 22 Sep 2010)
New Revision: 7043

Added:
   plog/branches/lifetype-1.2/js/tinymce/plugins/insertaudio/dialog.htm
   plog/branches/lifetype-1.2/js/tinymce/plugins/insertaudio/editor_plugin_src.js
   plog/branches/lifetype-1.2/js/tinymce/plugins/insertaudio/img/
   plog/branches/lifetype-1.2/js/tinymce/plugins/insertaudio/langs/en_dlg.js
Removed:
   plog/branches/lifetype-1.2/js/tinymce/plugins/insertaudio/audioinput.html
   plog/branches/lifetype-1.2/js/tinymce/plugins/insertaudio/editor_plugin.js
   plog/branches/lifetype-1.2/js/tinymce/plugins/insertaudio/images/
Modified:
   plog/branches/lifetype-1.2/js/tinymce/plugins/insertaudio/langs/en.js
Log:
first shot at upgrading insertaudio plugin

Deleted: plog/branches/lifetype-1.2/js/tinymce/plugins/insertaudio/audioinput.html
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/plugins/insertaudio/audioinput.html	2010-09-22 18:29:19 UTC (rev 7042)
+++ plog/branches/lifetype-1.2/js/tinymce/plugins/insertaudio/audioinput.html	2010-09-22 18:58:32 UTC (rev 7043)
@@ -1,40 +0,0 @@
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-	<title>{$lang_insertaudio_desc}</title>
-	<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
-	<script language="javascript" type="text/javascript" src="../../tiny_mce-plog-resourcelist.js"></script>	
-	<base target="_self" />
-</head>
-<body style="display: none">
-	<form name="audio" id="audio" method="post" action="#">
-	<div class="tabs">
-	  <ul>
-	   <li id="general_tab" class="current"><span>{$lang_insertaudio_desc}</span></li>
-	  </ul>
-	</div>
-	<div class="panel_wrapper">
-	  <div id="general_panel" class="panel_current">
-	     <legend>{$lang_insertaudio_panellegend}</legend>	     	     
-	     <table border="0" cellpadding="4" cellspacing="0">
-	      <tr>
-	       <td nowrap="nowrap">{$lang_insertaudio_url}</td>
-	       <td><input type="text" id="url" name="url" value="" {$lang_insertaudio_inputurlstyle} /></td>
-	      </tr>		
-		 </table>		    
-		</div>
-		</div>
-		<div class="mceActionPanel">
-		  <div style="float:left">		
-			<input type="button" name="insert" value="{$lang_insert}" 
-                   onClick="insertMediaPlayer(document.audio.url.value,
-                            true,'20','300')" id="insert" />
-		  </div>
-		  <div style="float:right">
-		    <input type="button" name="cancel" value="{$lang_close}" onclick="tinyMCEPopup.close();" id="cancel" />
-		  </div>
-		</div>
-	 </div>
-	</div>				
-	 </form>
-</body>
-</html>

Copied: plog/branches/lifetype-1.2/js/tinymce/plugins/insertaudio/dialog.htm (from rev 7042, plog/branches/lifetype-1.2/js/tinymce/plugins/insertaudio/audioinput.html)
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/plugins/insertaudio/dialog.htm	                        (rev 0)
+++ plog/branches/lifetype-1.2/js/tinymce/plugins/insertaudio/dialog.htm	2010-09-22 18:58:32 UTC (rev 7043)
@@ -0,0 +1,43 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+	<title>{#insertaudio_dlg.title}</title>
+	<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+	<script type="text/javascript">
+       tinyMCEPopup.requireLangPack();
+    </script>
+	<script type="text/javascript" src="../../tiny_mce-plog-resourcelist.js"></script>	
+	<base target="_self" />
+</head>
+<body style="display: none">
+	<form name="audio" id="audio" method="post" action="#">
+	<div class="tabs">
+	  <ul>
+	   <li id="general_tab" class="current"><span>{#insertaudio_dlg.title}</span></li>
+	  </ul>
+	</div>
+	<div class="panel_wrapper">
+	  <div id="general_panel" class="panel_current">
+	     <legend>{#insertaudio_dlg.panel_legend}</legend>
+	     <table border="0" cellpadding="4" cellspacing="0">
+	      <tr>
+	       <td nowrap="nowrap">{#insertaudio_dlg.audio_url}</td>
+	       <td><input type="text" id="url" name="url" value="" {#insertaudio_dlg.inputurlstyle} /></td>
+	      </tr>		
+		 </table>		    
+		</div>
+		</div>
+		<div class="mceActionPanel">
+		  <div style="float:left">		
+			<input type="button" name="insert" value="{#insert}" 
+                   onClick="insertMediaPlayer(document.audio.url.value,
+                            true,'20','300')" id="insert" />
+		  </div>
+		  <div style="float:right">
+		    <input type="button" name="cancel" value="{#close}" onclick="tinyMCEPopup.close();" id="cancel" />
+		  </div>
+		</div>
+	 </div>
+	</div>				
+	 </form>
+</body>
+</html>

Deleted: plog/branches/lifetype-1.2/js/tinymce/plugins/insertaudio/editor_plugin.js
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/plugins/insertaudio/editor_plugin.js	2010-09-22 18:29:19 UTC (rev 7042)
+++ plog/branches/lifetype-1.2/js/tinymce/plugins/insertaudio/editor_plugin.js	2010-09-22 18:58:32 UTC (rev 7043)
@@ -1,60 +0,0 @@
-/* Import plugin specific language pack */
-tinyMCE.importPluginLanguagePack('insertaudio', 'en,fr'); // <- Add a comma separated list of all supported languages
-
-// Singleton class
-var TinyMCE_insertaudioPlugin = {
-	getInfo : function() {
-		return {
-			longname : 'insertaudio plugin',
-			author : 'Gabriel ROUSSEAU',
-			authorurl : 'http://grvg.free.fr',
-			infourl : 'http://grvg.free.fr',
-			version : "0.4"
-		};
-	},
-
-	getControlHTML : function(cn) {
-		switch (cn) {
-			case "insertaudio":
-				return tinyMCE.getButtonHTML(cn, 'lang_insertaudio_desc', '{$pluginurl}/images/insertaudio.png', 'mceinsertaudio', true);
-		}
-
-		return "";
-	},
-
-	/**
-	 * Executes a specific command, this function handles plugin commands.
-	 *
-	 * @param {string} editor_id TinyMCE editor instance id that issued the command.
-	 * @param {HTMLElement} element Body or root element for the editor instance.
-	 * @param {string} command Command name to be executed.
-	 * @param {string} user_interface True/false if a user interface should be presented.
-	 * @param {mixed} value Custom value argument, can be anything.
-	 * @return true/false if the command was executed by this plugin or not.
-	 * @type
-	 */
-	execCommand : function(editor_id, element, command, user_interface, value) {
-		// Handle commands		
-		switch (command) {
-			// Remember to have the "mce" prefix for commands so they don't intersect with built in ones in the browser.
-			case "mceinsertaudio":
-				// Show UI/Popup
-				if (user_interface) {
-					// Open a popup window and send in some custom data in a window argument
-					var insertaudio = new Array();
-
-					insertaudio['file'] = '../../plugins/insertaudio/audioinput.html'; // Relative to theme
-					insertaudio['width'] = 500;
-					insertaudio['height'] = 120;
-
-					tinyMCE.openWindow(insertaudio, {editor_id : editor_id, resizable : "no", scrollbars : "no", inline : "yes"});	
-			}
-				return true;
-		}
-
-	   // Pass to next handler in chain
-	   return false;
-	}
-};
-
-tinyMCE.addPlugin("insertaudio", TinyMCE_insertaudioPlugin );

Copied: plog/branches/lifetype-1.2/js/tinymce/plugins/insertaudio/editor_plugin_src.js (from rev 7042, plog/branches/lifetype-1.2/js/tinymce/plugins/insertaudio/editor_plugin.js)
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/plugins/insertaudio/editor_plugin_src.js	                        (rev 0)
+++ plog/branches/lifetype-1.2/js/tinymce/plugins/insertaudio/editor_plugin_src.js	2010-09-22 18:58:32 UTC (rev 7043)
@@ -0,0 +1,73 @@
+(function() {
+	// Load plugin specific language pack
+	tinymce.PluginManager.requireLangPack('insertaudio');
+
+	tinymce.create('tinymce.plugins.InsertAudioPlugin', {
+		/**
+		 * Initializes the plugin, this will be executed after the plugin has been created.
+		 * This call is done before the editor instance has finished it's initialization so use the onInit event
+		 * of the editor instance to intercept that event.
+		 *
+		 * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
+		 * @param {string} url Absolute URL to where the plugin is located.
+		 */
+		init : function(ed, url) {
+			// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceInsertAudio');
+			ed.addCommand('mceInsertAudio', function() {
+				ed.windowManager.open({
+					file : url + '/dialog.htm',
+					width : 500 + parseInt(ed.getLang('InsertAudio.delta_width', 0)),
+					height : 120 + parseInt(ed.getLang('InsertAudio.delta_height', 0)),
+					inline : 1
+				}, {
+					plugin_url : url, // Plugin absolute URL
+				});
+			});
+
+			// Register insertAudio button
+			ed.addButton('insertaudio', {
+				title : 'insertaudio.desc',
+				cmd : 'mceInsertAudio',
+				image : url + '/img/insertaudio.png'
+			});
+
+			// Add a node change handler, selects the button in the UI when a image is selected
+			ed.onNodeChange.add(function(ed, cm, n) {
+				cm.setActive('insertaudio', n.nodeName == 'IMG');
+			});
+		},
+
+		/**
+		 * Creates control instances based in the incomming name. This method is normally not
+		 * needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons
+		 * but you sometimes need to create more complex controls like listboxes, split buttons etc then this
+		 * method can be used to create those.
+		 *
+		 * @param {String} n Name of the control to create.
+		 * @param {tinymce.ControlManager} cm Control manager to use inorder to create new control.
+		 * @return {tinymce.ui.Control} New control instance or null if no control was created.
+		 */
+		createControl : function(n, cm) {
+			return null;
+		},
+
+		/**
+		 * Returns information about the plugin as a name/value array.
+		 * The current keys are longname, author, authorurl, infourl and version.
+		 *
+		 * @return {Object} Name/value array containing information about the plugin.
+		 */
+		getInfo : function() {
+			return {
+				longname : 'InsertAudio plugin',
+				author : 'LifeType',
+				authorurl : 'http://lifetype.net',
+				infourl : '',
+				version : "1.0"
+			};
+		}
+	});
+
+	// Register plugin
+	tinymce.PluginManager.add('insertaudio', tinymce.plugins.InsertAudioPlugin);
+})();

Modified: plog/branches/lifetype-1.2/js/tinymce/plugins/insertaudio/langs/en.js
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/plugins/insertaudio/langs/en.js	2010-09-22 18:29:19 UTC (rev 7042)
+++ plog/branches/lifetype-1.2/js/tinymce/plugins/insertaudio/langs/en.js	2010-09-22 18:58:32 UTC (rev 7043)
@@ -1,7 +1,3 @@
-// UK lang variables
-tinyMCE.addToLang('',{
-lang_insertaudio_desc : 'Insert Audio',
-lang_insertaudio_panellegend : 'Please provide a link to an mp3 audio file.',
-lang_insertaudio_url : 'Audio URL:',
-lang_insertaudio_inputurlstyle : 'style="width:350px"'
+tinyMCE.addI18n('en.insertaudio',{
+	desc : 'Insert Audio'
 });

Added: plog/branches/lifetype-1.2/js/tinymce/plugins/insertaudio/langs/en_dlg.js
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/plugins/insertaudio/langs/en_dlg.js	                        (rev 0)
+++ plog/branches/lifetype-1.2/js/tinymce/plugins/insertaudio/langs/en_dlg.js	2010-09-22 18:58:32 UTC (rev 7043)
@@ -0,0 +1,6 @@
+tinyMCE.addI18n('en.insertaudio_dlg',{
+      title : 'Insert audio',
+      panel_legend : 'Please provide a link to an mp3 audio file.',
+      audio_url : 'Audio URL:',
+      inputurlstyle : 'style="width:350px"'
+});



More information about the pLog-svn mailing list