зеркало из https://github.com/mozilla/gecko-dev.git
Publishing bugs: Keep progress dialog open longer (b=133825), Add support to not upload images (b=134001), Don't save site data if not successfully published (b=132604) all are: r=akkana, sr=kin, a=asa, adt1.0.0+
This commit is contained in:
Родитель
e726ee5f63
Коммит
a7a0d0cd80
|
@ -121,11 +121,12 @@ function BuildHTMLAttributeTable()
|
|||
TrimString( nodeMap[i].nodeName.toLowerCase() ) == "style" ) {
|
||||
continue; // repeated or non-HTML attribute, ignore this one and go to next
|
||||
}
|
||||
var name = nodeMap[i].nodeName.toLowerCase();
|
||||
var value = gElement.getAttribute ( nodeMap[i].nodeName );
|
||||
var name = nodeMap[i].name.toLowerCase();
|
||||
if ( name.indexOf("_moz") != 0 &&
|
||||
AddTreeItem(name, value, "HTMLAList", HTMLAttrs) )
|
||||
AddTreeItem(name, nodeMap[i].value, "HTMLAList", HTMLAttrs) )
|
||||
{
|
||||
added = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (added)
|
||||
|
|
|
@ -51,12 +51,13 @@
|
|||
<description class="wrap" flex="1">&instructions2.label;</description>
|
||||
<radiogroup id="SepRadioGroup" persist="index character" index="0" character="">
|
||||
<radio id="comma" label="&commaRadio.label;" oncommand="SelectCharacter('0');"/>
|
||||
<vbox>
|
||||
<radio id="space" label="&spaceRadio.label;" oncommand="SelectCharacter('1');"/>
|
||||
<radio id="space" label="&spaceRadio.label;" oncommand="SelectCharacter('1');"/>
|
||||
<hbox>
|
||||
<spacer class="radio-spacer"/>
|
||||
<checkbox id="CollapseSpaces" label="&collapseSpaces.label;"
|
||||
style="margin-left:2em" checked="true" persist="checked"
|
||||
checked="true" persist="checked"
|
||||
tooltiptext="&collapseSpaces.tooltip;"/>
|
||||
</vbox>
|
||||
</hbox>
|
||||
<hbox align="center">
|
||||
<radio id="other" label="&otherRadio.label;" oncommand="SelectCharacter('2');"/>
|
||||
<textbox class="narrow" id="SepCharacterInput" oninput="InputSepCharacter()"/>
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
|
||||
<vbox id="LinkLocationBox">
|
||||
<description width="1">&LinkURLEditField.label;</description>
|
||||
<menulist editable="true" id="hrefInput" oninput="ChangeLinkLocation();">
|
||||
<menulist editable="true" class="minWidth20em" id="hrefInput" oninput="ChangeLinkLocation();">
|
||||
<menupopup/>
|
||||
</menulist>
|
||||
<hbox align="center">
|
||||
|
|
|
@ -124,9 +124,6 @@ function Startup()
|
|||
gDialog.SiteList.selectedIndex = siteIndex;
|
||||
var docDir = dirObj.value;
|
||||
|
||||
// Be sure directory found is part of that site's dir list
|
||||
AppendDirToSelectedSite(docDir);
|
||||
|
||||
// Use the directory within site in the editable menulist
|
||||
gPublishSiteData[siteIndex].docDir = docDir;
|
||||
|
||||
|
@ -175,10 +172,6 @@ function Startup()
|
|||
SetTextboxFocus(gDialog.PageTitleInput);
|
||||
}
|
||||
|
||||
//XXX TODO: How do we decide whether or not to save associated files?
|
||||
// And whether to save in same location as page if yes?
|
||||
gDialog.OtherDirCheckbox.checked = true;
|
||||
|
||||
if (gDialog.SiteList.selectedIndex == -1)
|
||||
{
|
||||
// No selected site -- assume same directory
|
||||
|
@ -212,13 +205,11 @@ function FillSiteList()
|
|||
for (i = 0; i < count; i++)
|
||||
{
|
||||
var name = gPublishSiteData[i].siteName;
|
||||
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);
|
||||
|
||||
// We'll truncate label strings to prevent this problem
|
||||
var menuitem = AppendLabelAndValueToMenulist(gDialog.SiteList,
|
||||
TruncateStringAtWordEnd(name, 30, true), name);
|
||||
// Highlight the default site
|
||||
if (name == gDefaultSiteName)
|
||||
{
|
||||
|
@ -253,6 +244,7 @@ function SelectSiteList()
|
|||
var username = "";
|
||||
var password = "";
|
||||
var savePassword = false;
|
||||
var publishOtherFiles = true;
|
||||
|
||||
ClearMenulist(gDialog.DocDirList);
|
||||
ClearMenulist(gDialog.OtherDirList);
|
||||
|
@ -281,6 +273,8 @@ function SelectSiteList()
|
|||
|
||||
gDialog.DocDirList.value = FormatDirForPublishing(gPublishSiteData[selectedSiteIndex].docDir);
|
||||
gDialog.OtherDirList.value = FormatDirForPublishing(gPublishSiteData[selectedSiteIndex].otherDir);
|
||||
publishOtherFiles = gPublishSiteData[selectedSiteIndex].publishOtherFiles;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -294,6 +288,9 @@ function SelectSiteList()
|
|||
gDialog.UsernameInput.value = username;
|
||||
gDialog.PasswordInput.value = password;
|
||||
gDialog.SavePassword.checked = savePassword;
|
||||
gDialog.OtherDirCheckbox.checked = publishOtherFiles;
|
||||
|
||||
doEnabling();
|
||||
}
|
||||
|
||||
function AddNewSite()
|
||||
|
@ -349,9 +346,10 @@ 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();
|
||||
|
||||
// XXX Another hack to workaround bug 131481
|
||||
// Resize dialog to be sure buttons are not cut off the right
|
||||
window.sizeToContent();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -392,29 +390,6 @@ function ChooseDir(menulist)
|
|||
// and build a tree to let user select dir
|
||||
}
|
||||
|
||||
function AppendDirToSelectedSite(dir)
|
||||
{
|
||||
var selectedSiteIndex = gDialog.SiteList.selectedIndex;
|
||||
if (selectedSiteIndex == -1)
|
||||
return;
|
||||
|
||||
var i;
|
||||
var dirFound = false;
|
||||
for (i = 0; i < gPublishSiteData[selectedSiteIndex].dirList.length; i++)
|
||||
{
|
||||
dirFound = (dir == gPublishSiteData[selectedSiteIndex].dirList[i]);
|
||||
if (dirFound)
|
||||
break;
|
||||
}
|
||||
if (!dirFound)
|
||||
{
|
||||
// Append dir to end and sort
|
||||
gPublishSiteData[selectedSiteIndex].dirList[i] = dir;
|
||||
if (gPublishSiteData[selectedSiteIndex].dirList.length > 1)
|
||||
gPublishSiteData[selectedSiteIndex].dirList.sort();
|
||||
}
|
||||
}
|
||||
|
||||
function ValidateSettings()
|
||||
{
|
||||
var siteName = TrimString(gDialog.SiteNameInput.value);
|
||||
|
@ -451,6 +426,7 @@ function ValidateSettings()
|
|||
var username = TrimString(gDialog.UsernameInput.value);
|
||||
var savePassword = gDialog.SavePassword.checked;
|
||||
var password = gDialog.PasswordInput.value;
|
||||
var publishOtherFiles = gDialog.OtherDirCheckbox.checked;
|
||||
|
||||
//XXX If there was a username and/or password in the publishUrl
|
||||
// AND in the input field, which do we use?
|
||||
|
@ -481,6 +457,7 @@ function ValidateSettings()
|
|||
}
|
||||
else
|
||||
{
|
||||
// First time: start entire site array
|
||||
gPublishSiteData = new Array(1);
|
||||
siteIndex = 0;
|
||||
gDefaultSiteIndex = 0;
|
||||
|
@ -490,6 +467,7 @@ function ValidateSettings()
|
|||
gPublishSiteData[siteIndex].docDir = "";
|
||||
gPublishSiteData[siteIndex].otherDir = "";
|
||||
gPublishSiteData[siteIndex].dirList = [""];
|
||||
gPublishSiteData[siteIndex].publishOtherFiles = true;
|
||||
newSite = true;
|
||||
}
|
||||
gPublishSiteData[siteIndex].siteName = siteName;
|
||||
|
@ -500,6 +478,11 @@ function ValidateSettings()
|
|||
gPublishSiteData[siteIndex].password = savePassword ? password : "";
|
||||
gPublishSiteData[siteIndex].savePassword = savePassword;
|
||||
|
||||
if (publishOtherFiles != gPublishSiteData[siteIndex].publishOtherFiles)
|
||||
gSettingsChanged = true;
|
||||
|
||||
gPublishSiteData[siteIndex].publishOtherFiles = publishOtherFiles;
|
||||
|
||||
gDialog.SiteList.selectedIndex = siteIndex;
|
||||
if (siteIndex == gDefaultSiteIndex)
|
||||
gDefaultSiteName = siteName;
|
||||
|
@ -521,27 +504,22 @@ function ValidateSettings()
|
|||
{
|
||||
// Update selected item if sitename changed
|
||||
var selectedItem = gDialog.SiteList.selectedItem;
|
||||
if (selectedItem && selectedItem.getAttribute("value") != siteName)
|
||||
if (selectedItem && selectedItem.getAttribute("label") != siteName)
|
||||
{
|
||||
// XXX More hacks to workaround bug 131481
|
||||
// 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);
|
||||
var truncatedName = TruncateStringAtWordEnd(siteName, 30, true);
|
||||
selectedItem.setAttribute("label", truncatedName);
|
||||
gDialog.SiteList.setAttribute("label", truncatedName);
|
||||
}
|
||||
}
|
||||
|
||||
// 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
|
||||
|
@ -550,9 +528,6 @@ function ValidateSettings()
|
|||
otherDir = docDir;
|
||||
else
|
||||
otherDir = GetOtherDirInput();
|
||||
|
||||
if (gDialog.OtherDirList.selectedIndex == -1)
|
||||
AppendDirToSelectedSite(otherDir);
|
||||
|
||||
gPublishSiteData[siteIndex].otherDir = otherDir;
|
||||
|
||||
|
@ -566,10 +541,8 @@ function ValidateSettings()
|
|||
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.otherDir = gPublishSiteData[siteIndex].otherDir;
|
||||
gReturnData.publishOtherFiles = publishOtherFiles;
|
||||
gReturnData.dirList = gPublishSiteData[siteIndex].dirList;
|
||||
return true;
|
||||
}
|
||||
|
@ -605,18 +578,25 @@ function ShowErrorInPanel(panelId, errorMsgId, widgetWithError)
|
|||
function doHelpButton()
|
||||
{
|
||||
if (gCurrentPanel == gPublishPanel)
|
||||
openHelp("publish_tab");
|
||||
openHelp("comp-doc-publish-publishtab");
|
||||
else
|
||||
openHelp("settings_tab");
|
||||
openHelp("comp-doc-publish-settingstab");
|
||||
}
|
||||
|
||||
function onAccept()
|
||||
{
|
||||
if (ValidateData())
|
||||
{
|
||||
// DON'T save the docDir and otherDir before trying to publish
|
||||
gReturnData.saveDirs = false;
|
||||
|
||||
// We save new site data to prefs only if we are attempting to publish
|
||||
if (gSettingsChanged)
|
||||
SavePublishSiteDataToPrefs(gPublishSiteData, gDefaultSiteName);
|
||||
SavePublishDataToPrefs(gReturnData);
|
||||
|
||||
// Set flag to resave data after publishing
|
||||
// so we save docDir and otherDir if we published successfully
|
||||
gReturnData.savePublishData = true;
|
||||
|
||||
var title = TrimString(gDialog.PageTitleInput.value);
|
||||
if (title != gPreviousTitle)
|
||||
|
|
|
@ -64,8 +64,9 @@
|
|||
<row align="center">
|
||||
<label value="&siteList.label;"/>
|
||||
<!-- Contents filled in at runtime -->
|
||||
<!-- XXX Hack: max-width set to workaroung bug 131481 -->
|
||||
<menulist id="SiteList"
|
||||
style="min-width:15em; max-width:20em;" crop="right"
|
||||
style="min-width:15em; max-width:30em;" crop="right"
|
||||
oncommand="SelectSiteList();"/>
|
||||
<hbox>
|
||||
<button label="&newSiteButton.label;" oncommand="AddNewSite();"/>
|
||||
|
|
|
@ -28,7 +28,8 @@ var gTotalFileCount = 0;
|
|||
var gSucceededCount = 0;
|
||||
var gFinishedCount = 0;
|
||||
var gFinished = false;
|
||||
var gFinalMessage = GetString("PublishCompleted");
|
||||
var gFinalMessage = GetString("PublishFailed");
|
||||
var gTimerID;
|
||||
|
||||
function Startup()
|
||||
{
|
||||
|
@ -65,7 +66,7 @@ function Startup()
|
|||
else
|
||||
document.getElementById("DocSubdir").setAttribute("hidden", "true");
|
||||
|
||||
if (gPublishData.otherDir)
|
||||
if (gPublishData.publishOtherFiles && gPublishData.otherDir)
|
||||
document.getElementById("otherDir").value = gPublishData.otherDir;
|
||||
else
|
||||
document.getElementById("OtherSubdir").setAttribute("hidden", "true");
|
||||
|
@ -76,6 +77,13 @@ function Startup()
|
|||
// Add the document to the "publish to" list as quick as possible!
|
||||
SetProgressStatus(gPublishData.filename, "busy");
|
||||
|
||||
if (gPublishData.publishOtherFiles)
|
||||
{
|
||||
// When publishing images as well, expand list to show more items
|
||||
gDialog.FileList.setAttribute("rows", 5);
|
||||
window.sizeToContent();
|
||||
}
|
||||
|
||||
// Now that dialog is initialized, we can start publishing
|
||||
window.opener.StartPublishing();
|
||||
}
|
||||
|
@ -149,9 +157,10 @@ function SetProgressFinished(filename, networkStatus)
|
|||
if (gFinishedCount == gTotalFileCount || !filename)
|
||||
{
|
||||
gFinished = true;
|
||||
SetStatusMessage(gFinalMessage);
|
||||
gDialog.Close.setAttribute("label", GetString("Close"));
|
||||
gFinalMessage = GetString("PublishCompleted");
|
||||
}
|
||||
SetStatusMessage(gFinalMessage);
|
||||
}
|
||||
|
||||
function SetStatusMessage(message)
|
||||
|
@ -160,8 +169,23 @@ function SetStatusMessage(message)
|
|||
window.sizeToContent();
|
||||
}
|
||||
|
||||
function CheckKeepOpen()
|
||||
{
|
||||
if (gTimerID)
|
||||
{
|
||||
clearTimeout(gTimerID);
|
||||
gTimerID = null;
|
||||
}
|
||||
}
|
||||
|
||||
function onClose()
|
||||
{
|
||||
if (gTimerID)
|
||||
{
|
||||
clearTimeout(gTimerID);
|
||||
gTimerID = null;
|
||||
}
|
||||
|
||||
if (!gFinished && gPersistObj)
|
||||
{
|
||||
try {
|
||||
|
@ -175,16 +199,22 @@ function onClose()
|
|||
return true;
|
||||
}
|
||||
|
||||
function CloseDialog(forceClose)
|
||||
function RequestCloseDialog()
|
||||
{
|
||||
if (forceClose || (gFinished && !gDialog.KeepOpen.checked))
|
||||
if (gFinished && !gDialog.KeepOpen.checked)
|
||||
{
|
||||
SaveWindowLocation();
|
||||
window.opener.FinishPublishing();
|
||||
try {
|
||||
window.close();
|
||||
} catch (e) {}
|
||||
// Leave window open a minimum amount of time
|
||||
gTimerID = setTimeout("CloseDialog();", 3000);
|
||||
}
|
||||
// If window remains open, but sure final message is set
|
||||
// If window remains open, be sure final message is set
|
||||
SetStatusMessage(gFinalMessage);
|
||||
}
|
||||
|
||||
function CloseDialog()
|
||||
{
|
||||
SaveWindowLocation();
|
||||
window.opener.FinishPublishing();
|
||||
try {
|
||||
window.close();
|
||||
} catch (e) {}
|
||||
}
|
|
@ -49,8 +49,7 @@
|
|||
<caption><label id="PublishToSite"/></caption>
|
||||
<label value="&siteUrl.label;"/>
|
||||
<hbox>
|
||||
<spacer class="spacer"/>
|
||||
<label id="PublishUrl" class="bold"/>
|
||||
<label class="indent bold" id="PublishUrl"/>
|
||||
</hbox>
|
||||
<spacer class="spacer"/>
|
||||
<grid id="Subdirectories">
|
||||
|
@ -71,10 +70,10 @@
|
|||
<groupbox>
|
||||
<caption><label value="&fileList.label;"/></caption>
|
||||
<vbox align="center" style="max-width:60em">
|
||||
<label id="StatusMessage" class="bold"/>
|
||||
<label id="StatusMessage" class="bold" value="&status.label;"/>
|
||||
</vbox>
|
||||
<vbox flex="1">
|
||||
<listbox id="FileList" rows="4"/>
|
||||
<listbox id="FileList" rows="1"/>
|
||||
</vbox>
|
||||
<hbox align="center">
|
||||
<spacer class="bigspacer"/>
|
||||
|
@ -86,6 +85,6 @@
|
|||
<label value="&failed.label;"/>
|
||||
</hbox>
|
||||
</groupbox>
|
||||
<checkbox id="KeepOpen" label="&keepOpen;" persist="checked"/>
|
||||
<checkbox id="KeepOpen" label="&keepOpen;" oncommand="CheckKeepOpen();" persist="checked"/>
|
||||
<separator class="groove"/>
|
||||
</dialog>
|
||||
|
|
|
@ -325,7 +325,7 @@ function UpdateSettings()
|
|||
|
||||
function doHelpButton()
|
||||
{
|
||||
openHelp("site_settings");
|
||||
openHelp("comp-doc-publish-site_settings");
|
||||
}
|
||||
|
||||
function onAccept()
|
||||
|
|
Загрузка…
Ссылка в новой задаче