]> code.citadel.org Git - citadel.git/blob - webcit/tiny_mce/plugins/preview/editor_plugin_src.js
Test to see if log is updated automatically
[citadel.git] / webcit / tiny_mce / plugins / preview / editor_plugin_src.js
1 /* Import plugin specific language pack */
2 tinyMCE.importPluginLanguagePack('preview', 'cs,de,el,en,fr_ca,it,ko,pt,sv,zh_cn,fa,fr,pl,pt_br,nl,da,he,no,hu');
3
4 function TinyMCE_preview_getInfo() {
5         return {
6                 longname : 'Preview',
7                 author : 'Moxiecode Systems',
8                 authorurl : 'http://tinymce.moxiecode.com',
9                 infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_preview.html',
10                 version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
11         };
12 };
13
14 /**
15  * Returns the HTML contents of the preview control.
16  */
17 function TinyMCE_preview_getControlHTML(control_name) {
18         switch (control_name) {
19                 case "preview":
20                         return '<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcePreview\');" target="_self" onmousedown="return false;"><img id="{$editor_id}_preview" src="{$pluginurl}/images/preview.gif" title="{$lang_preview_desc}" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>';
21         }
22
23         return "";
24 }
25
26 /**
27  * Executes the mcePreview command.
28  */
29 function TinyMCE_preview_execCommand(editor_id, element, command, user_interface, value) {
30         // Handle commands
31         switch (command) {
32                 case "mcePreview":
33                         var previewPage = tinyMCE.getParam("plugin_preview_pageurl", null);
34                         var previewWidth = tinyMCE.getParam("plugin_preview_width", "550");
35                         var previewHeight = tinyMCE.getParam("plugin_preview_height", "600");
36
37                         // Use a custom preview page
38                         if (previewPage) {
39                                 var template = new Array();
40
41                                 template['file'] = previewPage;
42                                 template['width'] = previewWidth;
43                                 template['height'] = previewHeight;
44
45                                 tinyMCE.openWindow(template, {editor_id : editor_id, resizable : "yes", scrollbars : "yes", inline : "yes", content : tinyMCE.getContent(), content_css : tinyMCE.getParam("content_css")});
46                         } else {
47                                 var win = window.open("", "mcePreview", "menubar=no,toolbar=no,scrollbars=yes,resizable=yes,left=20,top=20,width=" + previewWidth + ",height="  + previewHeight);
48                                 var html = "";
49
50                                 html += '<!doctype html public "-//w3c//dtd html 4.0 transitional//en">';
51                                 html += '<html>';
52                                 html += '<head>';
53                                 html += '<title>' + tinyMCE.getLang('lang_preview_desc') + '</title>';
54                                 html += '<base href="' + tinyMCE.getParam("document_base_url") + '">';
55                                 html += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">';
56                                 html += '<link href="' + tinyMCE.getParam("content_css") + '" rel="stylesheet" type="text/css">';
57                                 html += '</head>';
58                                 html += '<body>';
59                                 html += tinyMCE.getContent();
60                                 html += '</body>';
61                                 html += '</html>';
62
63                                 win.document.write(html);
64                                 win.document.close();
65                         }
66
67                         return true;
68         }
69
70         return false;
71 }