X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/3e7fab96d7874067884348df10bbdcdefa4a89ad..e08b42e8ad054ec67522d7ac1aaae5dc68cb3d01:/wp-includes/js/tinymce/utils/form_utils.js diff --git a/wp-includes/js/tinymce/utils/form_utils.js b/wp-includes/js/tinymce/utils/form_utils.js index 110a720e..6f62fe60 100644 --- a/wp-includes/js/tinymce/utils/form_utils.js +++ b/wp-includes/js/tinymce/utils/form_utils.js @@ -1,31 +1,26 @@ /** - * $Id: form_utils.js 162 2007-01-03 16:16:52Z spocke $ + * form_utils.js * - * Various form utilitiy functions. + * Copyright 2009, Moxiecode Systems AB + * Released under LGPL License. * - * @author Moxiecode - * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved. + * License: http://tinymce.moxiecode.com/license + * Contributing: http://tinymce.moxiecode.com/contributing */ -var themeBaseURL = tinyMCE.baseURL + '/themes/' + tinyMCE.getParam("theme"); +var themeBaseURL = tinyMCEPopup.editor.baseURI.toAbsolute('themes/' + tinyMCEPopup.getParam("theme")); function getColorPickerHTML(id, target_form_element) { - var h = ""; + var h = "", dom = tinyMCEPopup.dom; - h += ''; - h += ''; + if (label = dom.select('label[for=' + target_form_element + ']')[0]) { + label.id = label.id || dom.uniqueId(); + } - return h; -} + h += ''; + h += ' '; -function pickColor(e, target_form_element) { - if ((e.keyCode == 32 || e.keyCode == 13) || e.type == "mousedown") - tinyMCEPopup.pickColor(e, target_form_element); + return h; } function updateColor(img_id, form_element_id) { @@ -40,34 +35,32 @@ function setBrowserDisabled(id, state) { if (state) { lnk.setAttribute("realhref", lnk.getAttribute("href")); lnk.removeAttribute("href"); - tinyMCE.switchClass(img, 'mceButtonDisabled', true); + tinyMCEPopup.dom.addClass(img, 'disabled'); } else { - lnk.setAttribute("href", lnk.getAttribute("realhref")); - tinyMCE.switchClass(img, 'mceButtonNormal', false); + if (lnk.getAttribute("realhref")) + lnk.setAttribute("href", lnk.getAttribute("realhref")); + + tinyMCEPopup.dom.removeClass(img, 'disabled'); } } } function getBrowserHTML(id, target_form_element, type, prefix) { - var option = prefix + "_" + type + "_browser_callback"; - var cb = tinyMCE.getParam(option, tinyMCE.getParam("file_browser_callback")); - if (cb == null) - return ""; + var option = prefix + "_" + type + "_browser_callback", cb, html; - var html = ""; + cb = tinyMCEPopup.getParam(option, tinyMCEPopup.getParam("file_browser_callback")); - html += ''; - html += ''; + if (!cb) + return ""; + + html = ""; + html += ''; + html += ' '; return html; } -function openBrower(img_id, target_form_element, type, option) { +function openBrowser(img_id, target_form_element, type, option) { var img = document.getElementById(img_id); if (img.className != "mceButtonDisabled") @@ -78,6 +71,9 @@ function selectByValue(form_obj, field_name, value, add_custom, ignore_case) { if (!form_obj || !form_obj.elements[field_name]) return; + if (!value) + value = ""; + var sel = form_obj.elements[field_name]; var found = false; @@ -104,7 +100,7 @@ function selectByValue(form_obj, field_name, value, add_custom, ignore_case) { function getSelectValue(form_obj, field_name) { var elm = form_obj.elements[field_name]; - if (elm == null || elm.options == null) + if (elm == null || elm.options == null || elm.selectedIndex === -1) return ""; return elm.options[elm.selectedIndex].value; @@ -119,8 +115,8 @@ function addSelectValue(form_obj, field_name, name, value) { function addClassesToList(list_id, specific_option) { // Setup class droplist var styleSelectElm = document.getElementById(list_id); - var styles = tinyMCE.getParam('theme_advanced_styles', false); - styles = tinyMCE.getParam(specific_option, styles); + var styles = tinyMCEPopup.getParam('theme_advanced_styles', false); + styles = tinyMCEPopup.getParam(specific_option, styles); if (styles) { var stylesAr = styles.split(';'); @@ -136,10 +132,9 @@ function addClassesToList(list_id, specific_option) { } } } else { - // Use auto impored classes - var csses = tinyMCE.getCSSClasses(tinyMCE.getWindowArg('editor_id')); - for (var i=0; i