Further work on Moodle 1.9 integration.
[moodle/mihaisucan.git] / lib / editor / tinymce / jscripts / tiny_mce / plugins / paintweb / js / newimage.js
blob43a9bde6f8944d115753ed360f740397e804b417
1 /*
2  * Copyright (C) 2009 Mihai Şucan
3  *
4  * This file is part of PaintWeb.
5  *
6  * PaintWeb is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * PaintWeb is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with PaintWeb.  If not, see <http://www.gnu.org/licenses/>.
18  *
19  * $URL: http://code.google.com/p/paintweb $
20  * $Date: 2009-08-19 20:09:54 +0300 $
21  */
23 /**
24  * @author <a lang="ro" href="http://www.robodesign.ro/mihai">Mihai Şucan</a>
25  * @fileOverview This script allows the user to create a new image to edit 
26  * inside PaintWeb, directly from TinyMCE.
27  */
29 tinyMCEPopup.requireLangPack();
31 tinyMCEPopup.onInit.add(function() {
32   var newImageForm = document.getElementById('newimageform'),
33       imgWidth     = document.getElementById('imgWidth'),
34       imgHeight    = document.getElementById('imgHeight'),
35       imgBgrColor  = document.getElementById('imgBgrColor'),
36       imgTitle     = document.getElementById('imgTitle'),
37       altText      = document.getElementById('altText'),
38       btnCancel    = document.getElementById('cancel');
40   newImageForm.onsubmit = function (ev) {
41     var fn = tinyMCEPopup.getWindowArg('newImageFn');
43     if (fn) {
44       fn(imgWidth.value, imgHeight.value, imgBgrColor.value, altText.value, 
45         imgTitle.value);
46     }
48     tinyMCEPopup.close();
49   };
51   imgBgrColor.parentNode.lastChild.innerHTML 
52     = ' ' + getColorPickerHTML('imgBgrColor_pick',
53     'imgBgrColor');
55   imgBgrColor.onchange = function () { updateColor('imgBgrColor_pick', 
56       'imgBgrColor'); };
58   updateColor('imgBgrColor_pick', 'imgBgrColor');
60   btnCancel.onclick = function () { tinyMCEPopup.close(); };
61 });
63 // vim:set spell spl=en fo=wan1croqlt tw=80 ts=2 sw=2 sts=2 sta et ai cin fenc=utf-8 ff=unix: