2 * $Id: editor_plugin_src.js 201 2008-04-17 15:56:56Z cindy $
\r
5 * @copyright Copyright © 2008, ATutor, All rights reserved.
\r
9 // Load plugin specific language pack
\r
10 tinymce.PluginManager.requireLangPack('acheck');
\r
12 tinymce.create('tinymce.plugins.AcheckPlugin', {
\r
14 * Initializes the plugin, this will be executed after the plugin has been created.
\r
15 * This call is done before the editor instance has finished it's initialization so use the onInit event
\r
16 * of the editor instance to intercept that event.
\r
18 * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
\r
19 * @param {string} url Absolute URL to where the plugin is located.
\r
21 init : function(ed, url) {
\r
22 // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceACheck');
\r
23 ed.addCommand('mceACheck', function() {
\r
25 var theCode = '<html><body onLoad="document.accessform.submit();"> \n';
\r
26 theCode += '<h1>Submitting Code for Accessibility Checking.....</h1>\n';
\r
27 theCode += '<form action="http://achecker.ca/checker/index.php" name="accessform" method="post"> \n';
\r
28 theCode += '<input type="hidden" name="gid[]" value="8" /> \n';
\r
29 theCode += '<textarea name="validate_content">' + tinyMCE.activeEditor.getContent() + '</textarea>\n';
\r
30 theCode += '<input type="submit" /></form> \n';
\r
31 theCode += '</body></html> \n';
\r
32 accessWin = window.open('', 'accessWin', '');
\r
33 accessWin.document.writeln(theCode);
\r
34 accessWin.document.close();
\r
37 // Register ACheck button
\r
38 ed.addButton('acheck', {
\r
39 title : 'acheck.desc',
\r
41 image : url + '/img/acheck.gif'
\r
44 // Add a node change handler, selects the button in the UI when a image is selected
\r
45 ed.onNodeChange.add(function(ed, cm, n) {
\r
46 cm.setActive('acheck', n.nodeName == 'acheck');
\r
51 * Creates control instances based in the incomming name. This method is normally not
\r
52 * needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons
\r
53 * but you sometimes need to create more complex controls like listboxes, split buttons etc then this
\r
54 * method can be used to create those.
\r
56 * @param {String} n Name of the control to create.
\r
57 * @param {tinymce.ControlManager} cm Control manager to use inorder to create new control.
\r
58 * @return {tinymce.ui.Control} New control instance or null if no control was created.
\r
60 createControl : function(n, cm) {
\r
65 * Returns information about the plugin as a name/value array.
\r
66 * The current keys are longname, author, authorurl, infourl and version.
\r
68 * @return {Object} Name/value array containing information about the plugin.
\r
70 getInfo : function() {
\r
72 longname : 'ACheck Plugin',
\r
74 authorurl : 'http://www.atutor.ca',
\r
75 infourl : 'http://www.atutor.ca',
\r
82 tinymce.PluginManager.add('acheck', tinymce.plugins.AcheckPlugin);
\r