1 /** |
1 /** |
2 * $Id: form_utils.js 1184 2009-08-11 11:47:27Z spocke $ |
2 * form_utils.js |
3 * |
3 * |
4 * Various form utilitiy functions. |
4 * Copyright 2009, Moxiecode Systems AB |
|
5 * Released under LGPL License. |
5 * |
6 * |
6 * @author Moxiecode |
7 * License: http://tinymce.moxiecode.com/license |
7 * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. |
8 * Contributing: http://tinymce.moxiecode.com/contributing |
8 */ |
9 */ |
9 |
10 |
10 var themeBaseURL = tinyMCEPopup.editor.baseURI.toAbsolute('themes/' + tinyMCEPopup.getParam("theme")); |
11 var themeBaseURL = tinyMCEPopup.editor.baseURI.toAbsolute('themes/' + tinyMCEPopup.getParam("theme")); |
11 |
12 |
12 function getColorPickerHTML(id, target_form_element) { |
13 function getColorPickerHTML(id, target_form_element) { |
13 var h = ""; |
14 var h = "", dom = tinyMCEPopup.dom; |
14 |
15 |
15 h += '<a id="' + id + '_link" href="javascript:;" onclick="tinyMCEPopup.pickColor(event,\'' + target_form_element +'\');" onmousedown="return false;" class="pickcolor">'; |
16 if (label = dom.select('label[for=' + target_form_element + ']')[0]) { |
16 h += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '"> </span></a>'; |
17 label.id = label.id || dom.uniqueId(); |
|
18 } |
|
19 |
|
20 h += '<a role="button" aria-labelledby="' + id + '_label" id="' + id + '_link" href="javascript:;" onclick="tinyMCEPopup.pickColor(event,\'' + target_form_element +'\');" onmousedown="return false;" class="pickcolor">'; |
|
21 h += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '"> <span id="' + id + '_label" class="mceVoiceLabel mceIconOnly" style="display:none;">' + tinyMCEPopup.getLang('browse') + '</span></span></a>'; |
17 |
22 |
18 return h; |
23 return h; |
19 } |
24 } |
20 |
25 |
21 function updateColor(img_id, form_element_id) { |
26 function updateColor(img_id, form_element_id) { |
64 |
69 |
65 function selectByValue(form_obj, field_name, value, add_custom, ignore_case) { |
70 function selectByValue(form_obj, field_name, value, add_custom, ignore_case) { |
66 if (!form_obj || !form_obj.elements[field_name]) |
71 if (!form_obj || !form_obj.elements[field_name]) |
67 return; |
72 return; |
68 |
73 |
|
74 if (!value) |
|
75 value = ""; |
|
76 |
69 var sel = form_obj.elements[field_name]; |
77 var sel = form_obj.elements[field_name]; |
70 |
78 |
71 var found = false; |
79 var found = false; |
72 for (var i=0; i<sel.options.length; i++) { |
80 for (var i=0; i<sel.options.length; i++) { |
73 var option = sel.options[i]; |
81 var option = sel.options[i]; |