rem:   var src = TrimString(gDialog.srcInput.value); globalElement.setAttribute("src", src);     var alt = gDialog.altTextInput.value; if (doAltTextError && !alt) { AlertWithTitle(null, GetString("NoAltText")); SetTextboxFocus(gDialog.altTextInput); doAltTextError = false; return false; } globalElement.setAttribute("alt", alt);  var width = ""; var height = "";  if (!gDialog.actualSizeRadio.selected) {  width = ValidateNumber(gDialog.widthInput, gDialog.widthUnitsMenulist, 1, maxPixels, globalElement, "width", false, true); if (gValidationError) return false;  height = ValidateNumber(gDialog.heightInput, gDialog.heightUnitsMenulist, 1, maxPixels, globalElement, "height", false, true); if (gValidationError) return false; }    if (!width) width = actualWidth; if (!height) height = actualHeight;    var srcChanged = (src != gOriginalSrc); if (width) globalElement.setAttribute("width", width); else if (srcChanged) globalElement.removeAttribute("width");  if (height) globalElement.setAttribute("height", height); else if (srcChanged) globalElement.removeAttribute("height");    ValidateNumber(gDialog.imagelrInput, null, 0, maxPixels, globalElement, "hspace", false, true, true); if (gValidationError) return false;  ValidateNumber(gDialog.imagetbInput, null, 0, maxPixels, globalElement, "vspace", false, true); if (gValidationError) return false;   ValidateNumber(gDialog.border, null, 0, maxPixels, globalElement, "border", false, true); if (gValidationError) return false;      switch ( gDialog.alignTypeSelect.value ) { case "top": case "middle": case "right": case "left": globalElement.setAttribute( "align", gDialog.alignTypeSelect.value ); break; default: globalElement.removeAttribute( "align" ); }  return true; 
add: return ValidateImage(); 
context: function ValidateData(){  //TODO: WE NEED TO DO SOME URL VALIDATION HERE, E.G.:  // We must convert to "file:///" or "http://" format else image doesn't load!  var src = TrimString(gDialog.srcInput.value);  globalElement.setAttribute("src", src);  // Note: allow typing spaces,  // Warn user if empty string just once per dialog session  //   but don't consider this a failure  var alt = gDialog.altTextInput.value;  if (doAltTextError && !alt)  {    AlertWithTitle(null, GetString("NoAltText"));    SetTextboxFocus(gDialog.altTextInput);    doAltTextError = false;    return false;  }  globalElement.setAttribute("alt", alt);  var width = "";  var height = "";  if (!gDialog.actualSizeRadio.selected)  {    // Get user values for width and height    width = ValidateNumber(gDialog.widthInput, gDialog.widthUnitsMenulist, 1, maxPixels,                            globalElement, "width", false, true);    if (gValidationError)      return false;    height = ValidateNumber(gDialog.heightInput, gDialog.heightUnitsMenulist, 1, maxPixels,                             globalElement, "height", false, true);    if (gValidationError)      return false;  }  // We always set the width and height attributes, even if same as actual.  //  This speeds up layout of pages since sizes are known before image is loaded  if (!width)    width = actualWidth;  if (!height)    height = actualHeight;  // Remove existing width and height only if source changed  //  and we couldn't obtain actual dimensions  var srcChanged = (src != gOriginalSrc);  if (width)    globalElement.setAttribute("width", width);  else if (srcChanged)    globalElement.removeAttribute("width");  if (height)    globalElement.setAttribute("height", height);  else if (srcChanged)     globalElement.removeAttribute("height");  // spacing attributes  ValidateNumber(gDialog.imagelrInput, null, 0, maxPixels,                  globalElement, "hspace", false, true, true);  if (gValidationError)    return false;  ValidateNumber(gDialog.imagetbInput, null, 0, maxPixels,                  globalElement, "vspace", false, true);  if (gValidationError)    return false;  // note this is deprecated and should be converted to stylesheets  ValidateNumber(gDialog.border, null, 0, maxPixels,                  globalElement, "border", false, true);  if (gValidationError)    return false;  // Default or setting "bottom" means don't set the attribute  // Note that the attributes "left" and "right" are opposite  //  of what we use in the UI, which describes where the TEXT wraps,  //  not the image location (which is what the HTML describes)  switch ( gDialog.alignTypeSelect.value )  {    case "top":    case "middle":    case "right":    case "left":      globalElement.setAttribute( "align", gDialog.alignTypeSelect.value );      break;    default:      globalElement.removeAttribute( "align" );  }  return true;}
meta: 5872	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/5872/3e2628c49ccf1805b920541f0b94037b6fa5f83e/EdImageProps.js/clean/editor/ui/dialogs/content/EdImageProps.js