]> code.citadel.org Git - citadel.git/blob - webcit/tiny_mce/plugins/save/editor_plugin_src.js
7966553fd383b7fb182b6fc107a020af5808a90a
[citadel.git] / webcit / tiny_mce / plugins / save / editor_plugin_src.js
1 /* Import plugin specific language pack */
2 tinyMCE.importPluginLanguagePack('save', 'en,sv,zh_cn,cs,fa,fr_ca,fr,de,pl,pt_br,nl,he');
3
4 function TinyMCE_save_getInfo() {
5         return {
6                 longname : 'Save',
7                 author : 'Moxiecode Systems',
8                 authorurl : 'http://tinymce.moxiecode.com',
9                 infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_save.html',
10                 version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
11         };
12 };
13
14 /**
15  * Returns the HTML contents of the save control.
16  */
17 function TinyMCE_save_getControlHTML(control_name) {
18         switch (control_name) {
19                 case "save":
20                         return '<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceSave\');" onmousedown="return false;"><img id="{$editor_id}_save" src="{$pluginurl}/images/save.gif" title="{$lang_save_desc}" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.switchClass(this,\'mceButtonNormal\');" onmousedown="tinyMCE.switchClass(this,\'mceButtonDown\');" /></a>';
21         }
22
23         return "";
24 }
25
26 /**
27  * Executes the save command.
28  */
29 function TinyMCE_save_execCommand(editor_id, element, command, user_interface, value) {
30         // Handle commands
31         switch (command) {
32                 case "mceSave":
33                         var formObj = tinyMCE.selectedInstance.formElement.form;
34
35                         if (formObj) {
36                                 tinyMCE.triggerSave();
37
38                                 // Disable all UI form elements that TinyMCE created
39                                 for (var i=0; i<formObj.elements.length; i++) {
40                                         var elementId = formObj.elements[i].name ? formObj.elements[i].name : formObj.elements[i].id;
41
42                                         if (elementId.indexOf('mce_editor_') == 0)
43                                                 formObj.elements[i].disabled = true;
44                                 }
45
46                                 tinyMCE.isNotDirty = true;
47                                 tinyMCE.selectedInstance.formElement.form.submit();
48                         } else
49                                 alert("Error: No form element found.");
50
51                         return true;
52         }
53         // Pass to next handler in chain
54         return false;
55 }