Update to Composer Publishing UI, b=88208, r=brade, sr=kin, a=asa
git-svn-id: svn://10.0.0.236/trunk@116110 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -61,14 +61,13 @@ function Startup()
|
||||
gDialog.SiteList = document.getElementById("SiteList");
|
||||
gDialog.DocDirList = document.getElementById("DocDirList");
|
||||
gDialog.OtherDirCheckbox = document.getElementById("OtherDirCheckbox");
|
||||
gDialog.OtherDirRadiogroup = document.getElementById("OtherDirRadiogroup");
|
||||
gDialog.SameLocationRadio = document.getElementById("SameLocationRadio");
|
||||
gDialog.UseSubdirRadio = document.getElementById("UseSubdirRadio");
|
||||
gDialog.OtherDirList = document.getElementById("OtherDirList");
|
||||
|
||||
gDialog.MoreSection = document.getElementById("MoreSection");
|
||||
gDialog.MoreFewerButton = document.getElementById("MoreFewerButton");
|
||||
|
||||
// Settings Panel
|
||||
gDialog.SettingsPanel = document.getElementById("SettingsPanel");
|
||||
gDialog.ServerSettingsBox = document.getElementById("ServerSettingsBox");
|
||||
gDialog.SiteNameInput = document.getElementById("SiteNameInput");
|
||||
gDialog.PublishUrlInput = document.getElementById("PublishUrlInput");
|
||||
gDialog.BrowseUrlInput = document.getElementById("BrowseUrlInput");
|
||||
@@ -85,31 +84,22 @@ function Startup()
|
||||
gDefaultSiteName = GetDefaultPublishSiteName();
|
||||
gPreviousDefaultSite = gDefaultSiteName;
|
||||
|
||||
InitDialog();
|
||||
|
||||
SeeMore = (gDialog.MoreFewerButton.getAttribute("more") != "1");
|
||||
onMoreFewerPublish();
|
||||
|
||||
// If there's no current site data, start a new item in the Settings panel
|
||||
if (!gPublishSiteData)
|
||||
AddNewSite();
|
||||
else
|
||||
SetTextboxFocus(gDialog.PageTitleInput);
|
||||
|
||||
// This sets enable states on buttons
|
||||
doEnabling();
|
||||
|
||||
SetWindowLocation();
|
||||
}
|
||||
|
||||
function InitDialog()
|
||||
{
|
||||
var addNewSite = false;
|
||||
if (gPublishSiteData)
|
||||
{
|
||||
FillSiteList();
|
||||
}
|
||||
else
|
||||
{
|
||||
// No current site data, start a new item in the Settings panel
|
||||
AddNewSite();
|
||||
addNewSite = true;
|
||||
}
|
||||
|
||||
var docUrl = GetDocumentUrl();
|
||||
var scheme = GetScheme(docUrl);
|
||||
var filename = "";
|
||||
|
||||
if (scheme)
|
||||
{
|
||||
filename = GetFilename(docUrl);
|
||||
@@ -123,7 +113,7 @@ function InitDialog()
|
||||
var dirObj = {};
|
||||
var siteIndex = FindSiteIndexAndDocDir(gPublishSiteData, docUrl, dirObj);
|
||||
|
||||
// Select this site only if the same as user's intended site, or there wasnt' one
|
||||
// Select this site only if the same as user's intended site, or there wasn't one
|
||||
if (siteIndex != -1 && (gInitialSiteIndex == -1 || siteIndex == gInitialSiteIndex))
|
||||
{
|
||||
// Select the site we found
|
||||
@@ -139,17 +129,30 @@ function InitDialog()
|
||||
//XXX HOW DO WE DECIDE WHAT "OTHER" DIR TO USE?
|
||||
//gPublishSiteData[siteIndex].otherDir = docDir;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Not found in site database
|
||||
// Setup for a new site and use data from a remote URL
|
||||
if (!addNewSite)
|
||||
AddNewSite();
|
||||
|
||||
addNewSite = true;
|
||||
|
||||
var publishData = CreatePublishDataFromUrl(docUrl);
|
||||
if (publishData)
|
||||
{
|
||||
filename = publishData.filename;
|
||||
gDialog.SiteNameInput.value = publishData.siteName;
|
||||
gDialog.PublishUrlInput.value = publishData.publishUrl;
|
||||
gDialog.BrowseUrlInput.value = publishData.browseUrl;
|
||||
gDialog.UsernameInput.value = publishData.username;
|
||||
gDialog.PasswordInput.value = publishData.password;
|
||||
gDialog.SavePassword.checked = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// We haven't selected a site -- use initial or default site
|
||||
if (gDialog.SiteList.selectedIndex == -1)
|
||||
gDialog.SiteList.selectedIndex = (gInitialSiteIndex != -1) ? gInitialSiteIndex : gDefaultSiteIndex;
|
||||
|
||||
// Fill in all the site data for currently-selected site
|
||||
SelectSiteList();
|
||||
|
||||
try {
|
||||
gPreviousTitle = editorShell.GetDocumentTitle();
|
||||
} catch (e) {}
|
||||
@@ -157,8 +160,43 @@ function InitDialog()
|
||||
gDialog.PageTitleInput.value = gPreviousTitle;
|
||||
gDialog.FilenameInput.value = filename;
|
||||
|
||||
if (!addNewSite)
|
||||
{
|
||||
// If not adding a site and we haven't selected a site -- use initial or default site
|
||||
if (gDialog.SiteList.selectedIndex == -1)
|
||||
gDialog.SiteList.selectedIndex = (gInitialSiteIndex != -1) ? gInitialSiteIndex : gDefaultSiteIndex;
|
||||
|
||||
// Fill in all the site data for currently-selected site
|
||||
SelectSiteList();
|
||||
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
|
||||
gDialog.OtherDirRadiogroup.selectedItem = gDialog.selectedItem = gDialog.SameLocationRadio;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 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.selectedItem = gDialog.SameLocationRadio;
|
||||
}
|
||||
else
|
||||
{
|
||||
gDialog.OtherDirRadiogroup.selectedItem = gDialog.selectedItem = gDialog.OtherDirRadiogroup;
|
||||
}
|
||||
}
|
||||
|
||||
doEnabling();
|
||||
|
||||
SetWindowLocation();
|
||||
}
|
||||
|
||||
function FillSiteList()
|
||||
@@ -192,7 +230,10 @@ function FillSiteList()
|
||||
|
||||
function doEnabling()
|
||||
{
|
||||
gDialog.OtherDirList.disabled = !gDialog.OtherDirCheckbox.checked;
|
||||
var disableOther = !gDialog.OtherDirCheckbox.checked;
|
||||
gDialog.SameLocationRadio.disabled = disableOther;
|
||||
gDialog.UseSubdirRadio.disabled = disableOther;
|
||||
gDialog.OtherDirList.disabled = (disableOther || gDialog.SameLocationRadio.selected);
|
||||
}
|
||||
|
||||
function SelectSiteList()
|
||||
@@ -236,8 +277,8 @@ function SelectSiteList()
|
||||
}
|
||||
else
|
||||
{
|
||||
gDialog.DocDirList.value = "/";
|
||||
gDialog.OtherDirList.value = "/";
|
||||
gDialog.DocDirList.value = "";
|
||||
gDialog.OtherDirList.value = "";
|
||||
}
|
||||
|
||||
gDialog.SiteNameInput.value = siteName;
|
||||
@@ -248,30 +289,6 @@ function SelectSiteList()
|
||||
gDialog.SavePassword.checked = savePassword;
|
||||
}
|
||||
|
||||
function onMoreFewerPublish()
|
||||
{
|
||||
if (SeeMore)
|
||||
{
|
||||
gDialog.MoreSection.setAttribute("collapsed","true");
|
||||
gDialog.ServerSettingsBox.setAttribute("collapsed","true");
|
||||
window.sizeToContent();
|
||||
|
||||
gDialog.MoreFewerButton.setAttribute("more","0");
|
||||
gDialog.MoreFewerButton.setAttribute("label",GetString("More"));
|
||||
SeeMore = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
gDialog.MoreSection.removeAttribute("collapsed");
|
||||
gDialog.ServerSettingsBox.removeAttribute("collapsed");
|
||||
window.sizeToContent();
|
||||
|
||||
gDialog.MoreFewerButton.setAttribute("more","1");
|
||||
gDialog.MoreFewerButton.setAttribute("label",GetString("Less"));
|
||||
SeeMore = true;
|
||||
}
|
||||
}
|
||||
|
||||
function AddNewSite()
|
||||
{
|
||||
// Button in Publish panel allows user
|
||||
@@ -320,22 +337,9 @@ function SwitchPanel(panel)
|
||||
// Trigger setting of style for the tab widgets
|
||||
gDialog.SettingsTab.selected = "true";
|
||||
gDialog.PublishTab.selected = null;
|
||||
|
||||
// We collapse part of the Settings panel so the Publish Panel can be more compact
|
||||
if (gDialog.ServerSettingsBox.getAttribute("collapsed"))
|
||||
{
|
||||
gDialog.ServerSettingsBox.removeAttribute("collapsed");
|
||||
window.sizeToContent();
|
||||
}
|
||||
} else {
|
||||
gDialog.PublishTab.selected = "true";
|
||||
gDialog.SettingsTab.selected = null;
|
||||
|
||||
if (!SeeMore)
|
||||
{
|
||||
gDialog.ServerSettingsBox.setAttribute("collapsed","true");
|
||||
window.sizeToContent();
|
||||
}
|
||||
}
|
||||
gCurrentPanel = panel;
|
||||
}
|
||||
@@ -410,8 +414,16 @@ function ValidateSettings()
|
||||
return false;
|
||||
}
|
||||
|
||||
var publishUrl = GetPublishUrlInput();
|
||||
if (!publishUrl)
|
||||
// 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;
|
||||
@@ -420,11 +432,25 @@ function ValidateSettings()
|
||||
//TODO: If publish scheme = "ftp" we should encourage user to supply the http BrowseUrl
|
||||
var browseUrl = GetBrowseUrlInput();
|
||||
|
||||
//XXXX We don't get a prompt dialog if username is missing (bug ?????)
|
||||
// If not, we must force user to supply one here
|
||||
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;
|
||||
@@ -445,9 +471,9 @@ function ValidateSettings()
|
||||
gDefaultSiteName = siteName;
|
||||
}
|
||||
gPublishSiteData[siteIndex] = {};
|
||||
gPublishSiteData[siteIndex].docDir = "/";
|
||||
gPublishSiteData[siteIndex].otherDir = "/";
|
||||
gPublishSiteData[siteIndex].dirList = ["/"];
|
||||
gPublishSiteData[siteIndex].docDir = "";
|
||||
gPublishSiteData[siteIndex].otherDir = "";
|
||||
gPublishSiteData[siteIndex].dirList = [""];
|
||||
newSite = true;
|
||||
}
|
||||
gPublishSiteData[siteIndex].siteName = siteName;
|
||||
@@ -499,6 +525,11 @@ function ValidateSettings()
|
||||
|
||||
// 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);
|
||||
|
||||
@@ -569,7 +600,11 @@ function onAccept()
|
||||
|
||||
var title = TrimString(gDialog.PageTitleInput.value);
|
||||
if (title != gPreviousTitle)
|
||||
editorShell.SetDocumentTitle(title);
|
||||
{
|
||||
try {
|
||||
editorShell.SetDocumentTitle(title);
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
SaveWindowLocation();
|
||||
window.opener.ok = true;
|
||||
|
||||
@@ -88,44 +88,38 @@
|
||||
</rows>
|
||||
</grid>
|
||||
<spacer class="spacer"/>
|
||||
<hbox>
|
||||
<button id="MoreFewerButton" oncommand="onMoreFewerPublish()"
|
||||
persist="more" style="min-width:6em !important"/>
|
||||
<spacer flex="1"/>
|
||||
<label value="&docDirList.label;"/>
|
||||
<hbox align="center">
|
||||
<!-- Contents filled in at runtime -->
|
||||
<menulist id="DocDirList" class="minWidth20" editable="true" flex="1"
|
||||
oninput="onInputSettings();"/>
|
||||
<!--
|
||||
<button label="&chooseDirButton.label;" oncommand="ChooseDir(gDialog.DocDirList);" disabled="true"/>
|
||||
-->
|
||||
</hbox>
|
||||
|
||||
<vbox id="MoreSection" align="stretch">
|
||||
<label value="&docDirList.label;"/>
|
||||
<hbox align="center">
|
||||
<!-- Contents filled in at runtime -->
|
||||
<menulist id="DocDirList" class="minWidth20" editable="true" flex="1"
|
||||
oninput="onInputSettings();"/>
|
||||
<!--
|
||||
<button label="&chooseDirButton.label;" oncommand="ChooseDir(gDialog.DocDirList);" disabled="true"/>
|
||||
-->
|
||||
<spacer class="spacer"/>
|
||||
<checkbox id="OtherDirCheckbox" label="&publishImgCheckbox.label;" oncommand="doEnabling();"/>
|
||||
<radiogroup id="OtherDirRadiogroup">
|
||||
<hbox>
|
||||
<spacer class="checkbox-spacer"/>
|
||||
<radio id="SameLocationRadio" label="&sameLocationRadio.label;" oncommand="doEnabling();"/>
|
||||
</hbox>
|
||||
<spacer class="spacer"/>
|
||||
<checkbox id="OtherDirCheckbox" label="&otherDirList.label;" oncommand="doEnabling();"/>
|
||||
<hbox align="center">
|
||||
<!-- 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"/>
|
||||
-->
|
||||
<hbox>
|
||||
<spacer class="checkbox-spacer"/>
|
||||
<radio id="UseSubdirRadio" label="&useSubdirRadio.label;" oncommand="doEnabling();"/>
|
||||
</hbox>
|
||||
<spacer flex="1"/>
|
||||
<!-- FOR FUTURE USE: Tree of associated files for more control over destination, whether to upload, etc.
|
||||
<groupbox>
|
||||
<caption label="&relatedDocs.label;"/>
|
||||
<tree rows="6" class="list" id="RelatedDocsList" flex="1">
|
||||
<treecolgroup>
|
||||
<treecol flex="1"/>
|
||||
</treecolgroup>
|
||||
</tree>
|
||||
</groupbox>
|
||||
</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();"/>
|
||||
<!--
|
||||
<button label="&chooseDirButton.label;" oncommand="ChooseDir(gDialog.OtherDirList);" disabled="true"/>
|
||||
-->
|
||||
</vbox>
|
||||
</hbox>
|
||||
<spacer flex="1"/>
|
||||
</vbox><!-- Publish Panel -->
|
||||
|
||||
<!-- SETTINGS PANEL -->
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
<spacer class="spacer"/>
|
||||
<label value="&browseUrl.label;"/>
|
||||
<textbox id="BrowseUrlInput" class="MinWidth20em" oninput="onInputSettings();"/>
|
||||
<spacer class="spacer"/>
|
||||
</groupbox>
|
||||
<groupbox id="LoginSettingsBox">
|
||||
<caption label="&loginInfo.label;"/>
|
||||
@@ -62,6 +63,7 @@
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<spacer class="spacer"/>
|
||||
</groupbox>
|
||||
</vbox>
|
||||
|
||||
|
||||
@@ -28,7 +28,8 @@ var gPreviousDefaultSite;
|
||||
var gPreviousTitle;
|
||||
var gSettingsChanged = false;
|
||||
var gSiteDataChanged = false;
|
||||
var gNewSite = false;
|
||||
var gAddNewSite = false;
|
||||
var gCurrentSiteIndex = -1;
|
||||
|
||||
// Dialog initialization code
|
||||
function Startup()
|
||||
@@ -72,7 +73,10 @@ function InitDialog()
|
||||
|
||||
function FillSiteList()
|
||||
{
|
||||
// Prevent triggering SelectSiteList() actions
|
||||
gIsSelecting = true;
|
||||
ClearListbox(gDialog.SiteList);
|
||||
gIsSelecting = false;
|
||||
gDefaultSiteIndex = -1;
|
||||
|
||||
// Fill the site list
|
||||
@@ -102,12 +106,12 @@ function SetPublishItemStyle(item)
|
||||
function AddNewSite()
|
||||
{
|
||||
// Save any pending changes locally first
|
||||
if (gSettingsChanged && !UpdateSettings())
|
||||
if (!ApplyChanges())
|
||||
return;
|
||||
|
||||
// Initialize Setting widgets to none of the selected sites
|
||||
InitSiteSettings(-1);
|
||||
gNewSite = true;
|
||||
gAddNewSite = true;
|
||||
|
||||
SetTextboxFocus(gDialog.SiteNameInput);
|
||||
}
|
||||
@@ -122,6 +126,7 @@ function RemoveSite()
|
||||
if (index != -1)
|
||||
{
|
||||
item = gDialog.SiteList.selectedItems[0];
|
||||
var nameToRemove = item.getAttribute("label");
|
||||
|
||||
// Remove one item from site data array
|
||||
gPublishSiteData.splice(index, 1);
|
||||
@@ -134,6 +139,12 @@ function RemoveSite()
|
||||
index--;
|
||||
InitSiteSettings(index);
|
||||
|
||||
if (nameToRemove == gDefaultSiteName)
|
||||
{
|
||||
// Deleting current default -- set to new selected item
|
||||
// Arbitrary, but what else to do?
|
||||
SetDefault();
|
||||
}
|
||||
gSiteDataChanged = true;
|
||||
}
|
||||
}
|
||||
@@ -159,7 +170,8 @@ function SetDefault()
|
||||
}
|
||||
}
|
||||
|
||||
// Recursion prevention: InitSiteSettings() changes selected item
|
||||
// Recursion prevention:
|
||||
// Use when you don't want to trigger ApplyChanges and InitSiteSettings
|
||||
var gIsSelecting = false;
|
||||
|
||||
function SelectSiteList()
|
||||
@@ -168,22 +180,34 @@ function SelectSiteList()
|
||||
return;
|
||||
|
||||
gIsSelecting = true;
|
||||
var newIndex = gDialog.SiteList.selectedIndex;
|
||||
|
||||
// Save any pending changes locally first
|
||||
if (gSettingsChanged && !UpdateSettings())
|
||||
if (!ApplyChanges())
|
||||
return;
|
||||
|
||||
InitSiteSettings(gDialog.SiteList.selectedIndex);
|
||||
InitSiteSettings(newIndex);
|
||||
|
||||
gIsSelecting = false;
|
||||
}
|
||||
|
||||
function InitSiteSettings(selectedSiteIndex)
|
||||
// Use this to prevent recursion in SelectSiteList
|
||||
function SetSelectedSiteIndex(index)
|
||||
{
|
||||
gIsSelecting = true;
|
||||
gDialog.SiteList.selectedIndex = index;
|
||||
gIsSelecting = false;
|
||||
}
|
||||
|
||||
function InitSiteSettings(selectedSiteIndex)
|
||||
{
|
||||
// Index to the site we will need to update if settings changed
|
||||
gCurrentSiteIndex = selectedSiteIndex;
|
||||
|
||||
var savePassord = false;
|
||||
|
||||
SetSelectedSiteIndex(selectedSiteIndex);
|
||||
var haveData = (gPublishSiteData && selectedSiteIndex != -1);
|
||||
gDialog.SiteList.selectedIndex = selectedSiteIndex;
|
||||
|
||||
gDialog.SiteNameInput.value = haveData ? gPublishSiteData[selectedSiteIndex].siteName : "";
|
||||
gDialog.PublishUrlInput.value = haveData ? gPublishSiteData[selectedSiteIndex].publishUrl : "";
|
||||
@@ -204,6 +228,17 @@ function onInputSettings()
|
||||
gSettingsChanged = true;
|
||||
}
|
||||
|
||||
function ApplyChanges()
|
||||
{
|
||||
if (gSettingsChanged && !UpdateSettings())
|
||||
{
|
||||
// Restore selection to previously current site
|
||||
SetSelectedSiteIndex(gCurrentSiteIndex);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function UpdateSettings()
|
||||
{
|
||||
// Validate and add new site
|
||||
@@ -220,81 +255,67 @@ function UpdateSettings()
|
||||
return false;
|
||||
}
|
||||
|
||||
var siteIndex = -1;
|
||||
// Start assuming we're updating existing site at gCurrentSiteIndex
|
||||
var newSiteData = false;
|
||||
|
||||
if (!gPublishSiteData)
|
||||
{
|
||||
// Create the first site profile
|
||||
// First time used - Create the first site profile
|
||||
gPublishSiteData = new Array(1);
|
||||
siteIndex = 0;
|
||||
gNewSite = true;
|
||||
gCurrentSiteIndex = 0;
|
||||
newSiteData = true;
|
||||
}
|
||||
else
|
||||
else if (gCurrentSiteIndex == -1)
|
||||
{
|
||||
// No currently-selected site,
|
||||
// must be adding a new site
|
||||
// Add new data at the end of list
|
||||
siteIndex = gPublishSiteData.length;
|
||||
gCurrentSiteIndex = gPublishSiteData.length;
|
||||
newSiteData = true;
|
||||
}
|
||||
|
||||
if (gNewSite || gDialog.SiteList.selectedIndex == -1)
|
||||
if (newSiteData)
|
||||
{
|
||||
// Init new site object
|
||||
gPublishSiteData[siteIndex] = {};
|
||||
gPublishSiteData[siteIndex].docDir = "/";
|
||||
gPublishSiteData[siteIndex].otherDir = "/";
|
||||
gPublishSiteData[siteIndex].dirList = ["/"];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Update existing site profile
|
||||
siteIndex = gDialog.SiteList.selectedIndex;
|
||||
// Init new site profile
|
||||
gPublishSiteData[gCurrentSiteIndex] = {};
|
||||
gPublishSiteData[gCurrentSiteIndex].docDir = "/";
|
||||
gPublishSiteData[gCurrentSiteIndex].otherDir = "/";
|
||||
gPublishSiteData[gCurrentSiteIndex].dirList = ["/"];
|
||||
}
|
||||
|
||||
gPublishSiteData[siteIndex].siteName = newName;
|
||||
gPublishSiteData[siteIndex].publishUrl = newUrl;
|
||||
gPublishSiteData[siteIndex].browseUrl = FormatUrlForPublishing(gDialog.BrowseUrlInput.value);
|
||||
gPublishSiteData[siteIndex].username = TrimString(gDialog.UsernameInput.value);
|
||||
gPublishSiteData[siteIndex].password= gDialog.PasswordInput.value;
|
||||
gPublishSiteData[siteIndex].savePassword = gDialog.SavePassword.checked;
|
||||
gPublishSiteData[gCurrentSiteIndex].siteName = newName;
|
||||
gPublishSiteData[gCurrentSiteIndex].publishUrl = newUrl;
|
||||
gPublishSiteData[gCurrentSiteIndex].browseUrl = FormatUrlForPublishing(gDialog.BrowseUrlInput.value);
|
||||
gPublishSiteData[gCurrentSiteIndex].username = TrimString(gDialog.UsernameInput.value);
|
||||
gPublishSiteData[gCurrentSiteIndex].password= gDialog.PasswordInput.value;
|
||||
gPublishSiteData[gCurrentSiteIndex].savePassword = gDialog.SavePassword.checked;
|
||||
|
||||
if (siteIndex == gDefaultSiteIndex)
|
||||
if (gCurrentSiteIndex == gDefaultSiteIndex)
|
||||
gDefaultSiteName = newName;
|
||||
|
||||
var count = gPublishSiteData.length;
|
||||
if (count > 1)
|
||||
{
|
||||
// XXX Ascii sort, not locale-aware
|
||||
gPublishSiteData.sort();
|
||||
|
||||
//Find previous items in sorted list
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
if (gPublishSiteData[i].siteName == newName)
|
||||
{
|
||||
siteIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// When adding the very first site, assume that's the default
|
||||
if (count == 1 && !gDefaultSiteName)
|
||||
if (gPublishSiteData.length == 1 && !gDefaultSiteName)
|
||||
{
|
||||
gDefaultSiteName = gPublishSiteData[0].siteName;
|
||||
gDefaultSiteIndex = 0;
|
||||
}
|
||||
|
||||
FillSiteList();
|
||||
gDialog.SiteList.selectedIndex = siteIndex;
|
||||
|
||||
// Select current site in list
|
||||
SetSelectedSiteIndex(gCurrentSiteIndex);
|
||||
|
||||
// Signal saving data to prefs
|
||||
gSiteDataChanged = true;
|
||||
|
||||
// Clear current site flags
|
||||
gSettingsChanged = false;
|
||||
gNewSite = false;
|
||||
gAddNewSite = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function doHelpButton()
|
||||
{
|
||||
openHelp("site_settings");
|
||||
@@ -303,7 +324,7 @@ function doHelpButton()
|
||||
function onAccept()
|
||||
{
|
||||
// Save any pending changes locally first
|
||||
if (gSettingsChanged && !UpdateSettings())
|
||||
if (!ApplyChanges())
|
||||
return false;
|
||||
|
||||
if (gSiteDataChanged)
|
||||
|
||||
@@ -32,8 +32,10 @@
|
||||
<!ENTITY siteList.label "Site Name:">
|
||||
<!ENTITY newSiteButton.label "New Site">
|
||||
<!ENTITY siteDirList.label "Select or type a directory name in your publishing site:">
|
||||
<!ENTITY docDirList.label "Directory for web page:">
|
||||
<!ENTITY otherDirList.label "Save images and other files to this directory:">
|
||||
<!ENTITY docDirList.label "Subdirectory for this page:">
|
||||
<!ENTITY publishImgCheckbox.label "Include images and other files">
|
||||
<!ENTITY sameLocationRadio.label "Use same location as page">
|
||||
<!ENTITY useSubdirRadio.label "Use this subdirectory:">
|
||||
<!ENTITY chooseDirButton.label "Choose...">
|
||||
<!ENTITY pageTitle.label "Page Title:">
|
||||
<!ENTITY pageTitleExample.label "e.g.: "My Web Page"">
|
||||
@@ -49,8 +51,8 @@
|
||||
<!ENTITY serverInfo.label "Server Information">
|
||||
<!ENTITY loginInfo.label "Login Information">
|
||||
<!ENTITY siteName.label "Site Name:">
|
||||
<!ENTITY siteUrl.label "Publishing Location (provided by your ISP or Sys Admin.):">
|
||||
<!ENTITY browseUrl.label "Home Page Location (if different from above):">
|
||||
<!ENTITY username.label "Username:">
|
||||
<!ENTITY siteUrl.label "Publishing URL (provided by your ISP or Sys Admin.):">
|
||||
<!ENTITY browseUrl.label "HTTP address to browse to:">
|
||||
<!ENTITY username.label "User name:">
|
||||
<!ENTITY password.label "Password:">
|
||||
<!ENTITY savePassword.label "Save Password">
|
||||
|
||||
Reference in New Issue
Block a user