Fixed publish dialog ui, b=130721, r=brade, sr=hewitt, a=asa

This commit is contained in:
cmanske%netscape.com 2002-03-27 03:52:37 +00:00
parent 6df0276bf8
commit b31b2d731b
5 changed files with 57 additions and 44 deletions

View File

@ -521,14 +521,14 @@ function PublishSiteNameExists(name, publishSiteData, skipSiteIndex)
// docUrl: Document URL with or without filename
// (Must end in "/" if no filename)
// dirObj.value = the directory of the document URL
// relative to the base publishing URL, using "/" if none
// relative to the base publishing URL, using "" if none
//
// XXX: Currently finds the site with the longest-matching url;
// should we look for the shortest instead? Or match just the host portion?
function FindSiteIndexAndDocDir(publishSiteData, docUrl, dirObj)
{
if (dirObj)
dirObj.value = "/";
dirObj.value = "";
if (!publishSiteData || !docUrl || GetScheme(docUrl) == "file")
return -1;
@ -559,7 +559,7 @@ function FindSiteIndexAndDocDir(publishSiteData, docUrl, dirObj)
}
}
// Get directory name from the end of url (may be just "/")
// Get directory name from the end of url
if (dirObj && siteIndex >= 0 && urlLen > siteUrlLen)
dirObj.value = FormatDirForPublishing(docUrl.slice(siteUrlLen));

View File

@ -184,18 +184,15 @@ function Startup()
// No selected site -- assume same directory
gDialog.OtherDirRadiogroup.selectedItem = gDialog.SameLocationRadio;
}
else
else if (gPublishSiteData[gDialog.SiteList.selectedIndex].docDir ==
gPublishSiteData[gDialog.SiteList.selectedIndex].otherDir)
{
// For now, check "same location" if dirs are already set to same directory
if (gPublishSiteData[gDialog.SiteList.selectedIndex].docDir ==
gPublishSiteData[gDialog.SiteList.selectedIndex].otherDir)
{
gDialog.OtherDirRadiogroup.selectedItem = gDialog.SameLocationRadio;
}
else
{
gDialog.OtherDirRadiogroup.selectedItem = gDialog.OtherDirRadiogroup;
}
gDialog.OtherDirRadiogroup.selectedItem = gDialog.SameLocationRadio;
}
else
{
gDialog.OtherDirRadiogroup.selectedItem = gDialog.UseSubdirRadio;
}
doEnabling();
@ -215,7 +212,13 @@ function FillSiteList()
for (i = 0; i < count; i++)
{
var name = gPublishSiteData[i].siteName;
var menuitem = AppendStringToMenulist(gDialog.SiteList, name);
var menuitem = AppendLabelAndValueToMenulist(gDialog.SiteList, name);
// XXX Bug 131481: Using "max-width" style and "crop" attribute
// don't constrain grid width properly, resulting in cut-off buttons
// One workaround is to truncate label strings to prevent this problem
// ...TruncateStringAtWordEnd(name, 20, true), name);
// Highlight the default site
if (name == gDefaultSiteName)
{
@ -346,6 +349,9 @@ function SwitchPanel(panel)
gDialog.SettingsTab.selected = null;
}
gCurrentPanel = panel;
// This is done to show/compensate for bug 131481
// Dialog is resized to incorrect size, but at least buttons aren't cut off!
// window.sizeToContent();
}
}
@ -440,7 +446,6 @@ function ValidateSettings()
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);
@ -516,8 +521,13 @@ function ValidateSettings()
{
// Update selected item if sitename changed
var selectedItem = gDialog.SiteList.selectedItem;
if (selectedItem && selectedItem.getAttribute("label") != siteName)
if (selectedItem && selectedItem.getAttribute("value") != siteName)
{
// The real sitename
selectedItem.setAttribute("value", siteName);
// Truncate string to show in the menulist
//var truncatedName = TruncateStringAtWordEnd(siteName, 20, true);
selectedItem.setAttribute("label", siteName);
gDialog.SiteList.setAttribute("label", siteName);
}
@ -579,7 +589,6 @@ function ValidateData()
ShowErrorInPanel(gPublishPanel, "MissingPublishFilename", gDialog.FilenameInput);
return false;
}
gReturnData.filename = filename;
return true;

View File

@ -64,17 +64,15 @@
<row align="center">
<label value="&siteList.label;"/>
<!-- Contents filled in at runtime -->
<menulist id="SiteList" class="minWidth15" oncommand="SelectSiteList();"/>
<menulist id="SiteList"
style="min-width:15em; max-width:20em;" crop="right"
oncommand="SelectSiteList();"/>
<hbox>
<button label="&newSiteButton.label;" oncommand="AddNewSite();"/>
<spacer flex="1"/>
</hbox>
</row>
<row>
<spacer class="spacer"/>
<spacer class="spacer"/>
<spacer class="spacer"/>
</row>
<spacer class="spacer"/>
<row align="center">
<label value="&pageTitle.label;"/>
<textbox id="PageTitleInput" class="minWidth15"/>
@ -98,27 +96,33 @@
-->
</hbox>
<spacer class="spacer"/>
<checkbox id="OtherDirCheckbox" label="&publishImgCheckbox.label;" oncommand="doEnabling();"/>
<radiogroup id="OtherDirRadiogroup">
<groupbox>
<caption>
<checkbox id="OtherDirCheckbox" label="&publishImgCheckbox.label;" oncommand="doEnabling();"/>
</caption>
<vbox>
<radiogroup id="OtherDirRadiogroup">
<hbox>
<spacer class="checkbox-spacer"/>
<radio id="SameLocationRadio" label="&sameLocationRadio.label;" oncommand="doEnabling();"/>
</hbox>
<hbox>
<spacer class="checkbox-spacer"/>
<radio id="UseSubdirRadio" label="&useSubdirRadio.label;" oncommand="doEnabling();"/>
</hbox>
</radiogroup>
</vbox>
<hbox>
<spacer class="checkbox-spacer"/>
<radio id="SameLocationRadio" label="&sameLocationRadio.label;" oncommand="doEnabling();"/>
</hbox>
<hbox>
<spacer class="checkbox-spacer"/>
<radio id="UseSubdirRadio" label="&useSubdirRadio.label;" oncommand="doEnabling();"/>
</hbox>
</radiogroup>
<hbox>
<spacer class="checkbox-spacer"/>
<spacer class="radio-spacer"/>
<!-- Contents filled in at runtime -->
<menulist id="OtherDirList" class="minWidth20" editable="true" flex="1"
oninput="onInputSettings();"/>
<spacer class="radio-spacer"/>
<!-- Contents filled in at runtime -->
<menulist id="OtherDirList" class="minWidth20" editable="true" flex="1"
oninput="onInputSettings();"/>
<!--
<button label="&chooseDirButton.label;" oncommand="ChooseDir(gDialog.OtherDirList);" disabled="true"/>
<button label="&chooseDirButton.label;" oncommand="ChooseDir(gDialog.OtherDirList);" disabled="true"/>
-->
</hbox>
</hbox>
</groupbox>
<spacer flex="1"/>
</vbox><!-- Publish Panel -->

View File

@ -35,7 +35,7 @@
<caption label="&serverInfo.label;"/>
<hbox align="center">
<label value="&siteName.label;"/>
<textbox id="SiteNameInput" class="MinWidth20em" oninput="onInputSettings();"/>
<textbox id="SiteNameInput" class="MinWidth20em" oninput="onInputSettings();" flex="1"/>
</hbox>
<spacer class="spacer"/>
<label value="&siteUrl.label;"/>

View File

@ -285,9 +285,9 @@ function UpdateSettings()
{
// Init new site profile
gPublishSiteData[gCurrentSiteIndex] = {};
gPublishSiteData[gCurrentSiteIndex].docDir = "/";
gPublishSiteData[gCurrentSiteIndex].otherDir = "/";
gPublishSiteData[gCurrentSiteIndex].dirList = ["/"];
gPublishSiteData[gCurrentSiteIndex].docDir = "";
gPublishSiteData[gCurrentSiteIndex].otherDir = "";
gPublishSiteData[gCurrentSiteIndex].dirList = [""];
}
gPublishSiteData[gCurrentSiteIndex].siteName = newName;