mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-14 10:43:24 +00:00
Clean up new/rename folder dialogs in mail/news (bug 60642), give focus to textfield (bug 60476) and fix warning (bug 60644), r=racham, a=ben
This commit is contained in:
parent
144aa7a24d
commit
4f270e57dd
@ -1,161 +0,0 @@
|
||||
var okCallback = 0;
|
||||
var pickerID = null;
|
||||
var preselectedFolderURI = null;
|
||||
var dualUseFolders = true;
|
||||
var foldersOnly = 0;
|
||||
|
||||
function newFolderNameOnLoad(pickerDOMID)
|
||||
{
|
||||
pickerID = pickerDOMID;
|
||||
|
||||
doSetOKCancel(newFolderNameOKButtonCallback, newFolderNameCancelButtonCallback);
|
||||
|
||||
// look in arguments[0] for parameters
|
||||
if (window.arguments && window.arguments[0]) {
|
||||
if ( window.arguments[0].title ) {
|
||||
// dump("title = " + window.arguments[0].title + "\n");
|
||||
top.window.title = window.arguments[0].title;
|
||||
}
|
||||
|
||||
dualUseFolders = window.arguments[0].dualUseFolders;
|
||||
|
||||
if ( window.arguments[0].okCallback ) {
|
||||
top.okCallback = window.arguments[0].okCallback;
|
||||
}
|
||||
}
|
||||
|
||||
// pre select the folderPicker, based on what they selected in the folder pane
|
||||
if (window.arguments[0].preselectedURI) {
|
||||
try {
|
||||
dump("pick this one: " + window.arguments[0].preselectedURI + "\n");
|
||||
}
|
||||
catch (ex) {
|
||||
dump("failed to preflight the folderPicker thing.\n");
|
||||
}
|
||||
}
|
||||
else {
|
||||
dump("passed null for preselectedURI, do nothing\n");
|
||||
}
|
||||
var picker = document.getElementById(pickerID);
|
||||
if(picker)
|
||||
MsgFolderPickerOnLoad(pickerID);
|
||||
if (!dualUseFolders)
|
||||
{
|
||||
var newFolderTypeBox = document.getElementById("newFolderTypeBox");
|
||||
if (newFolderTypeBox)
|
||||
{
|
||||
newFolderTypeBox.setAttribute("hidden", "false");
|
||||
window.resizeTo(0,0);
|
||||
window.sizeToContent();
|
||||
}
|
||||
}
|
||||
moveToAlertPosition();
|
||||
}
|
||||
|
||||
function newFolderNameOKButtonCallback()
|
||||
{
|
||||
if ( top.okCallback )
|
||||
{
|
||||
var name = document.getElementById("name").value;
|
||||
var picker = document.getElementById(pickerID);
|
||||
var uri = picker.getAttribute("uri");
|
||||
|
||||
// make sure we have a valid name and parent uri
|
||||
if (name.length <= 0 || uri.length <=0)
|
||||
return false;
|
||||
|
||||
//dump("uri,name in callback = " + uri + "," + name + "\n");
|
||||
|
||||
if (!dualUseFolders && foldersOnly && name.charAt(name.length-1) != "/")
|
||||
{
|
||||
top.okCallback(name + "/", uri);
|
||||
}
|
||||
else
|
||||
{
|
||||
top.okCallback(name, uri);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function newFolderNameCancelButtonCallback()
|
||||
{
|
||||
// close the window
|
||||
dump("in newFolderNameCancelButtonCallback\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function renameFolderNameOnLoad(pickerDOMID)
|
||||
{
|
||||
doSetOKCancel(renameFolderNameOKButtonCallback, renameFolderNameCancelButtonCallback);
|
||||
moveToAlertPosition();
|
||||
|
||||
// look in arguments[0] for parameters
|
||||
if (window.arguments && window.arguments[0]) {
|
||||
if ( window.arguments[0].title ) {
|
||||
// dump("title = " + window.arguments[0].title + "\n");
|
||||
top.window.title = window.arguments[0].title;
|
||||
}
|
||||
|
||||
if ( window.arguments[0].okCallback ) {
|
||||
top.okCallback = window.arguments[0].okCallback;
|
||||
}
|
||||
}
|
||||
|
||||
// pre select the folderPicker, based on what they selected in the folder pane
|
||||
if (window.arguments[0].preselectedURI) {
|
||||
try {
|
||||
preselectedFolderURI = window.arguments[0].preselectedURI;
|
||||
dump("pick this one: " + window.arguments[0].preselectedURI + "\n");
|
||||
}
|
||||
catch (ex) {
|
||||
dump("failed to preflight the folderPicker thing.\n");
|
||||
}
|
||||
}
|
||||
else {
|
||||
dump("passed null for preselectedURI, do nothing\n");
|
||||
}
|
||||
|
||||
if(window.arguments[0].name)
|
||||
{
|
||||
var name = document.getElementById("name");
|
||||
name.value = window.arguments[0].name;
|
||||
name.setSelectionRange(0,-1);
|
||||
name.focusTextField();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function renameFolderNameOKButtonCallback()
|
||||
{
|
||||
if ( top.okCallback )
|
||||
{
|
||||
var name = document.getElementById("name").value;
|
||||
var uri = preselectedFolderURI;
|
||||
|
||||
dump("uri,name in callback = " + uri + "," + name + "\n");
|
||||
top.okCallback(name, uri);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function renameFolderNameCancelButtonCallback()
|
||||
{
|
||||
// close the window
|
||||
dump("in renameFolderNameCancelButtonCallback\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
function onFoldersOnly()
|
||||
{
|
||||
foldersOnly = 1;
|
||||
}
|
||||
|
||||
function onMessagesOnly()
|
||||
{
|
||||
foldersOnly = 0;
|
||||
}
|
@ -1,71 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
The contents of this file are subject to the Netscape Public
|
||||
License Version 1.1 (the "License"); you may not use this file
|
||||
except in compliance with the License. You may obtain a copy of
|
||||
the License at http://www.mozilla.org/NPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS
|
||||
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
implied. See the License for the specific language governing
|
||||
rights and limitations under the License.
|
||||
|
||||
The Original Code is Mozilla Communicator client code, released
|
||||
March 31, 1998.
|
||||
|
||||
The Initial Developer of the Original Code is Netscape
|
||||
Communications Corporation. Portions created by Netscape are
|
||||
Copyright (C) 1998-1999 Netscape Communications Corporation. All
|
||||
Rights Reserved.
|
||||
-->
|
||||
|
||||
<?xml-stylesheet href="chrome://messenger/skin/messenger.css" type="text/css"?>
|
||||
|
||||
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
|
||||
<?xul-overlay href="chrome://messenger/content/msgFolderPickerOverlay.xul"?>
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://messenger/locale/newFolderNameDialog.dtd">
|
||||
|
||||
<window xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
align="vertical"
|
||||
class="dialog"
|
||||
onload="newFolderNameOnLoad('msgNewFolderPicker');">
|
||||
|
||||
<script language="JavaScript" src="chrome://global/content/strres.js"/>
|
||||
<script language="JavaScript" src="chrome://messenger/content/mailCommands.js"/>
|
||||
<script language="JavaScript" src="chrome://messenger/content/newFolderNameDialog.js"/>
|
||||
|
||||
<keyset id="keyset"/>
|
||||
|
||||
<box align="vertical" >
|
||||
|
||||
<spring flex="1"/>
|
||||
|
||||
<text value="&name.label;" class="label" accesskey="&name.accesskey;" for="name"/>
|
||||
<textfield tabindex="0" id="name" />
|
||||
<separator/>
|
||||
|
||||
<text value="&newDialogDescription.label;" class="label" accesskey="&description.accesskey;" for="msgNewFolderPicker"/>
|
||||
<box align="horizontal">
|
||||
<menu id="msgNewFolderPicker"/>
|
||||
<spring flex="1"/>
|
||||
</box>
|
||||
<box align="vertical" orient="vertical" hidden="true" id="newFolderTypeBox">
|
||||
<separator class="thin"/>
|
||||
<text value="&folderRestriction1.label;"/>
|
||||
<text value="&folderRestriction2.label;"/>
|
||||
<separator class="thin"/>
|
||||
<radiogroup id="folderGroup">
|
||||
<radio group="folderGroup" oncommand="onFoldersOnly();" value="&foldersOnly.label;"/>
|
||||
<radio group="folderGroup" oncommand="onMessagesOnly();" value="&messagesOnly.label;" checked="true"/>
|
||||
<spring flex="100%"/>
|
||||
</radiogroup>
|
||||
</box>
|
||||
<spring flex="1"/>
|
||||
<separator/>
|
||||
<box id="okCancelButtonsRight"/>
|
||||
|
||||
</box>
|
||||
|
||||
</window>
|
@ -1,53 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
The contents of this file are subject to the Netscape Public
|
||||
License Version 1.1 (the "License"); you may not use this file
|
||||
except in compliance with the License. You may obtain a copy of
|
||||
the License at http://www.mozilla.org/NPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS
|
||||
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
implied. See the License for the specific language governing
|
||||
rights and limitations under the License.
|
||||
|
||||
The Original Code is Mozilla Communicator client code, released
|
||||
March 31, 1998.
|
||||
|
||||
The Initial Developer of the Original Code is Netscape
|
||||
Communications Corporation. Portions created by Netscape are
|
||||
Copyright (C) 1998-1999 Netscape Communications Corporation. All
|
||||
Rights Reserved.
|
||||
-->
|
||||
|
||||
<?xml-stylesheet href="chrome://messenger/skin/messenger.css" type="text/css"?>
|
||||
|
||||
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
|
||||
<?xul-overlay href="chrome://messenger/content/msgFolderPickerOverlay.xul"?>
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://messenger/locale/newFolderNameDialog.dtd">
|
||||
|
||||
<window xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
align="vertical"
|
||||
class="dialog"
|
||||
onload="renameFolderNameOnLoad();" >
|
||||
|
||||
<script language="JavaScript" src="chrome://global/content/strres.js"/>
|
||||
<script language="JavaScript" src="chrome://messenger/content/mailCommands.js"/>
|
||||
<script language="JavaScript" src="chrome://messenger/content/newFolderNameDialog.js"/>
|
||||
|
||||
<keyset id="keyset"/>
|
||||
|
||||
<box align="vertical" >
|
||||
|
||||
<spring flex="100%"/>
|
||||
|
||||
<text value="&rename.label;" />
|
||||
<textfield tabindex="0" id="name" />
|
||||
|
||||
<spring flex="100%"/>
|
||||
<box id="okCancelButtons"/>
|
||||
|
||||
</box>
|
||||
|
||||
</window>
|
@ -1,30 +0,0 @@
|
||||
<!--
|
||||
The contents of this file are subject to the Netscape Public
|
||||
License Version 1.1 (the "License"); you may not use this file
|
||||
except in compliance with the License. You may obtain a copy of
|
||||
the License at http://www.mozilla.org/NPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS
|
||||
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
implied. See the License for the specific language governing
|
||||
rights and limitations under the License.
|
||||
|
||||
The Original Code is Mozilla Communicator client code, released
|
||||
March 31, 1998.
|
||||
|
||||
The Initial Developer of the Original Code is Netscape
|
||||
Communications Corporation. Portions created by Netscape are
|
||||
Copyright (C) 1998-1999 Netscape Communications Corporation. All
|
||||
Rights Reserved.
|
||||
-->
|
||||
|
||||
<!-- Labels -->
|
||||
<!ENTITY name.label "Name:">
|
||||
<!ENTITY name.accesskey "n">
|
||||
<!ENTITY rename.label "Enter the new name for your folder:">
|
||||
<!ENTITY newDialogDescription.label "Create as a subfolder of:">
|
||||
<!ENTITY description.accesskey "c">
|
||||
<!ENTITY folderRestriction1.label "This server restricts folders to two special kinds.">
|
||||
<!ENTITY folderRestriction2.label "Allow your new folder to contain:">
|
||||
<!ENTITY foldersOnly.label "Folders Only">
|
||||
<!ENTITY messagesOnly.label "Messages Only">
|
Loading…
Reference in New Issue
Block a user