context: function ValidateSettings(){  var siteName = TrimString(gDialog.SiteNameInput.value);  if (!siteName)  {    ShowErrorInPanel(gSettingsPanel, "MissingSiteNameError", gDialog.SiteNameInput);    return false;  }  if (PublishSiteNameExists(siteName, gPublishSiteData, gDialog.SiteList.selectedIndex))  {    SwitchPanel(gSettingsPanel);    ShowInputErrorMessage(GetString("DuplicateSiteNameError").replace(/%name%/, siteName));                SetTextboxFocus(gDialog.SiteNameInput);    return false;  }  // Extract username and password while removing them from publishingUrl  var urlUserObj = {};  var urlPassObj = {};  var publishUrl = StripUsernamePassword(gDialog.PublishUrlInput.value, urlUserObj, urlPassObj);  if (publishUrl)  {    publishUrl = FormatUrlForPublishing(publishUrl);    gDialog.PublishUrlInput.value = publishUrl;  }  else  {    ShowErrorInPanel(gSettingsPanel, "MissingPublishUrlError", gDialog.PublishUrlInput);    return false;  }  //TODO: If publish scheme = "ftp" we should encourage user to supply the http BrowseUrl  var browseUrl = GetBrowseUrlInput();  var username = TrimString(gDialog.UsernameInput.value);  var savePassword = gDialog.SavePassword.checked;  var password = gDialog.PasswordInput.value;    //XXX If there was a username and/or password in the publishUrl   //    AND in the input field, which do we use?  //    Let's use those in url only if input is empty   if (!username)  {    username = urlUserObj.value;    gDialog.UsernameInput.value = username;    gSettingsChanged = true;  }  if (!password)  {    password = urlPassObj.value;    gDialog.PasswordInput.value = password;    gSettingsChanged = true;  }  // Update or add data for a site   var siteIndex = gDialog.SiteList.selectedIndex;  var newSite = false;  if (siteIndex == -1)  {    // No site is selected, add a new site at the end    if (gPublishSiteData)    {      siteIndex = gPublishSiteData.length;    }    else    {      gPublishSiteData = new Array(1);      siteIndex = 0;      gDefaultSiteIndex = 0;      gDefaultSiteName = siteName;    }        gPublishSiteData[siteIndex] = {};    gPublishSiteData[siteIndex].docDir = "";    gPublishSiteData[siteIndex].otherDir = "";    gPublishSiteData[siteIndex].dirList = [""];    newSite = true;  }  gPublishSiteData[siteIndex].siteName = siteName;  gPublishSiteData[siteIndex].publishUrl = publishUrl;  gPublishSiteData[siteIndex].browseUrl = browseUrl;  gPublishSiteData[siteIndex].username = username;  // Don't save password in data that will be saved in prefs  gPublishSiteData[siteIndex].password = savePassword ? password : "";  gPublishSiteData[siteIndex].savePassword = savePassword;  gDialog.SiteList.selectedIndex = siteIndex;  if (siteIndex == gDefaultSiteIndex)    gDefaultSiteName = siteName;  // Should never be empty, but be sure we have a default site  if (!gDefaultSiteName)  {    gDefaultSiteName = gPublishSiteData[0].siteName;    gDefaultSiteIndex = 0;  }  // Rebuild the site menulist if we added a new site  if (newSite)  {    FillSiteList();    gDialog.SiteList.selectedIndex = siteIndex;  }  else  {    // Update selected item if sitename changed     var selectedItem = gDialog.SiteList.selectedItem;    if (selectedItem && selectedItem.getAttribute("label") != siteName)    {      selectedItem.setAttribute("label", siteName);      gDialog.SiteList.setAttribute("label", siteName);    }  }    // Get the directory name in site to publish to  var docDir = GetDocDirInput();  // Because of the autoselect behavior in editable menulists,  //   selectedIndex = -1 means value in input field is not already in the list,   //   so add it to the list of site directories  if (gDialog.DocDirList.selectedIndex == -1)    AppendDirToSelectedSite(docDir);  gPublishSiteData[siteIndex].docDir = docDir;  // And directory for images and other files  var otherDir = GetOtherDirInput();  if (gDialog.SameLocationRadio.selected)    otherDir = docDir;  else    otherDir = GetOtherDirInput();      if (gDialog.OtherDirList.selectedIndex == -1)    AppendDirToSelectedSite(otherDir);  gPublishSiteData[siteIndex].otherDir = otherDir;  // Fill return data object  gReturnData.siteName = siteName;  gReturnData.publishUrl = publishUrl;  gReturnData.browseUrl = browseUrl;  gReturnData.username = username;  // Note that we use the password for the next publish action   // even if savePassword is false; but we won't save it in PasswordManager database  gReturnData.password = password;  gReturnData.savePassword = savePassword;  gReturnData.docDir = gPublishSiteData[siteIndex].docDir;  // If "Other dir" is not checked, return empty string to indicate "don't save associated files"  gReturnData.otherDir = gDialog.OtherDirCheckbox.checked ? gPublishSiteData[siteIndex].otherDir : "";  gReturnData.dirList = gPublishSiteData[siteIndex].dirList;  return true;}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/c1cb076056223bbabc55f4acf7f8c8c09abbc8a5/EditorPublish.js/buggy/editor/ui/dialogs/content/EditorPublish.js