<?xml version="1.0"?>

<!--

 ***** BEGIN LICENSE BLOCK *****
 Version: MPL 1.1/GPL 2.0/LGPL 2.1

 The contents of this file are subject to the Mozilla 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/MPL/

 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 the Initial Developer are Copyright (C) 1998-2003
 the Initial Developer. All Rights Reserved.

 Contributor(s):
   Håkan Waara <hwaara@chello.se>
   bienvenu@nventure.com
   Matthew Willis <mattwillis@gmail.com>

 Alternatively, the contents of this file may be used under the terms of
 either of the GNU General Public License Version 2 or later (the "GPL"),
 or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 in which case the provisions of the GPL or the LGPL are applicable instead
 of those above. If you wish to allow use of your version of this file only
 under the terms of either the GPL or the LGPL, and not to allow others to
 use your version of this file under the terms of the MPL, indicate your
 decision by deleting the provisions above and replace them with the notice
 and other provisions required by the GPL or the LGPL. If you do not delete
 the provisions above, a recipient may use your version of this file under
 the terms of any one of the MPL, the GPL or the LGPL.

 ***** END LICENSE BLOCK ***** -->

<?xml-stylesheet href="chrome://messenger/skin/accountManage.css" type="text/css"?>
<?xml-stylesheet href="chrome://messenger/skin/messenger.css" type="text/css"?>
<?xml-stylesheet href="chrome://messenger/skin/folderMenus.css" type="text/css"?>

<!DOCTYPE page [
<!ENTITY % trashDTD SYSTEM "chrome://messenger/locale/am-server-top.dtd">%trashDTD;
<!ENTITY % pickerDTD SYSTEM "chrome://messenger/locale/msgFolderPickerOverlay.dtd"> %pickerDTD;
]>

<page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
      title="&serverSettings.label;"
      onload="parent.onPanelLoaded('am-server.xul');">

  <vbox flex="1" style="overflow: auto;">
    <script type="application/javascript" src="chrome://messenger/content/AccountManager.js"/>
    <script type="application/javascript" src="chrome://messenger/content/am-server.js"/>
    <script type="application/javascript" src="chrome://messenger/content/am-prefs.js"/>
    <script type="application/javascript" src="chrome://messenger/content/amUtils.js"/>
    <script type="application/javascript" src="chrome://messenger/content/widgetglue.js"/>
    <stringbundle id="bundle_messenger" src="chrome://messenger/locale/messenger.properties"/>

    <label hidden="true" wsm_persist="true" id="server.type"/>

    <dialogheader title="&serverSettings.label;"/>

    <grid>
      <columns>
        <column/>
        <column/>
      </columns>
      <rows>      
        <row align="center">
          <label value="&serverType.label;"/>
          <label id="servertype.verbose"/>
        </row>
        <row align="center">
          <hbox>
              <label value="&serverName.label;" accesskey="&serverName.accesskey;"
                     control="server.realHostName"/>
          </hbox>
          <hbox align="center">
              <label id="fixedServerName" collapsed="true" use="server.realHostName"/>
              <textbox wsm_persist="true" size="20" id="server.realHostName"
                       prefstring="mail.server.%serverkey%.realhostname" class="uri-element"/>
              <label hidefor="movemail" value="&port.label;"
                     accesskey="&port.accesskey;" control="server.port"/>
              <label id="fixedServerPort" hidefor="movemail" 
                     collapsed="true" use="server.port"/>
              <textbox wsm_persist="true" size="3" id="server.port"
                       preftype="int" hidefor="movemail" 
                       prefstring="mail.server.%serverkey%.port"
                       type="number" max="65535"/>
              <label value="&serverPortDefault.label;" hidefor="movemail"/>
              <label id="defaultPort" hidefor="movemail"/>
          </hbox>
        </row>
        <row align="center">
          <hbox align="center" hidefor="nntp">
              <label value="&userName.label;"
                     accesskey="&userName.accesskey;"
                     control="server.realUsername"/>
          </hbox>
          <hbox align="center" hidefor="nntp">
              <label id="fixedUserName" collapsed="true" use="server.realUsername"/>
              <textbox wsm_persist="true" size="20" id="server.realUsername"
                       prefstring="mail.server.%serverkey%.realusername"/>
          </hbox>
        </row>
      </rows>
    </grid>

    <separator class="thin"/>
  
    <groupbox hidefor="movemail">
      <caption label="&securitySettings.label;"/>

      <grid flex="1">
        <columns>
          <column/>
          <column/>
        </columns>
        <rows>
          <row align="center">
            <label value="&connectionSecurity.label;"
                   accesskey="&connectionSecurity.accesskey;"
                   control="server.socketType"/>
            <menulist wsm_persist="true" id="server.socketType"
                      oncommand="secureSelect();">
              <menupopup id="server.socketTypePopup">
                <menuitem value="0" label="&connectionSecurityType-0.label;"/>
                <menuitem id="connectionSecurityType-1"
                          value="1" label="&connectionSecurityType-1.label;"
                          disabled="true"/>
                <menuitem value="2" label="&connectionSecurityType-2.label;"
                          hidefor="nntp"/>
                <menuitem value="3" label="&connectionSecurityType-3.label;"/>
              </menupopup>
            </menulist>
          </row>
          <row align="center" hidefor="nntp,movemail">
            <label value="&authMethod.label;"
                   accesskey="&authMethod.accesskey;"
                   control="server.authMethod"/>
            <!-- same in smtpEditOverlay.xul/js -->
            <menulist id="server.authMethod"
                      wsm_persist="true"
                      preftype="int" type="number"
                      prefstring="mail.server.%serverkey%.authMethod">
              <menupopup id="server.authMethodPopup">
                <menuitem id="authMethod-no" value="1"/>
                <menuitem id="authMethod-old" value="2"/>
                <menuitem id="authMethod-password-cleartext" value="3"/>
                <menuitem id="authMethod-password-encrypted" value="4"/>
                <menuitem id="authMethod-kerberos" value="5"/>
                <menuitem id="authMethod-ntlm" value="6"/>
                <menuitem id="authMethod-external" value="7"/>
                <menuitem id="authMethod-anysecure" value="8"/>
                <menuitem id="authMethod-any" value="9"/>
              </menupopup>
            </menulist>
          </row>
        </rows>
      </grid>
    </groupbox>

    <groupbox>
      <caption label="&serverSettings.label;"/>
      <vbox align="start">
      <checkbox wsm_persist="true"
                id="server.loginAtStartUp" 
                label="&loginAtStartup.label;"
                accesskey="&loginAtStartup.accesskey;"
                prefattribute="value"
                prefstring="mail.server.%serverkey%.login_at_startup"/>
    </vbox>
    <hbox align="center">
      <checkbox wsm_persist="true" id="server.doBiff" label="&biffStart.label;"
                accesskey="&biffStart.accesskey;"
                oncommand="onCheckItem('server.biffMinutes', 'server.doBiff');"
                prefattribute="value"
                prefstring="mail.server.%serverkey%.check_new_mail"/>
      <textbox wsm_persist="true" id="server.biffMinutes" size="3"
               aria-labelledby="server.doBiff server.biffMinutes biffEnd"
               preftype="int" type="number"
               onchange="onBiffMinChange(this.value);"
               prefstring="mail.server.%serverkey%.check_time"/>
      <label id="biffEnd" control="server.biffMinutes" value="&biffEnd.label;"/>
    </hbox>
    <!-- Necessary for POP3 and Movemail (Bug 480945) -->
    <!-- https://bugzilla.mozilla.org/show_bug.cgi?id=480945 -->
    <vbox align="start" hidefor="imap,nntp">
      <checkbox wsm_persist="true" id="server.downloadOnBiff"
                label="&downloadOnBiff.label;" prefattribute="value"
                accesskey="&downloadOnBiff.accesskey;"
                prefstring="mail.server.%serverkey%.download_on_biff"/>
    </vbox>
    <!-- POP3 -->
    <vbox align="start" hidefor="imap,nntp,movemail">
      <checkbox wsm_persist="true" id="pop3.headersOnly"
                label="&headersOnly.label;"
                accesskey="&headersOnly.accesskey;"
                prefattribute="value"
                prefstring="mail.server.%serverkey%.headers_only"/>

      <checkbox wsm_persist="true" id="pop3.leaveMessagesOnServer"
                label="&leaveOnServer.label;" oncommand="setupMailOnServerUI();"
                accesskey="&leaveOnServer.accesskey;"
                prefattribute="value"
                prefstring="mail.server.%serverkey%.leave_on_server"/>

      <hbox align="center">
        <checkbox wsm_persist="true" id="pop3.deleteByAgeFromServer" class="indent"
                  label="&deleteByAgeFromServer.label;" oncommand="setupAgeMsgOnServerUI();"
                  accesskey="&deleteByAgeFromServer.accesskey;"
                  prefattribute="value"
                  prefstring="mail.server.%serverkey%.delete_by_age_from_server"/>
        <textbox wsm_persist="true" id="pop3.numDaysToLeaveOnServer" size="3" 
                 aria-labelledby="pop3.deleteByAgeFromServer pop3.numDaysToLeaveOnServer daysEnd"
                 preftype="int"
                 prefstring="mail.server.%serverkey%.num_days_to_leave_on_server"/>
        <label id="daysEnd" control="pop3.numDaysToLeaveOnServer" value="&daysEnd.label;"/>
      </hbox>

      <checkbox wsm_persist="true" id="pop3.deleteMailLeftOnServer" class="indent"
                label="&deleteOnServer2.label;"
                accesskey="&deleteOnServer2.accesskey;"
                prefattribute="value"
                prefstring="mail.server.%serverkey%.delete_mail_left_on_server"/>

    <!-- hidden elements for data transfer to and from advanced... dialog -->
    <hbox flex="1" hidefor="imap,nntp,movemail" hidden="true">
      <checkbox hidden="true" wsm_persist="true" id="pop3.deferGetNewMail"
                prefattribute="value"
                prefstring="mail.server.%serverkey%.deferGetNewMail"/>
      <label hidden="true" wsm_persist="true" id="pop3.deferredToAccount"
                prefattribute="value"
                prefstring="mail.server.%serverkey%.deferredToAccount"/>

    </hbox>
    </vbox>
    <!-- IMAP -->
    <label hidden="true" wsm_persist="true" id="imap.trashFolderName" 
                  prefattribute="value"
                  prefstring="mail.server.%serverkey%.trash_folder_name"/>

    <hbox align="center" hidefor="pop3,nntp,movemail">
      <label value="&deleteMessagePrefix.label;" align="left"
             control="imap.deleteModel"/>
    </hbox>
    <hbox align="center" id="imap.deleteModel.box" hidefor="pop3,nntp,movemail">
      <radiogroup wsm_persist="true" id="imap.deleteModel"
                  oncommand="selectImapDeleteModel(this.value)"
                  prefstring="mail.server.%serverkey%.delete_model">
        <grid class="specialFolderPickerGrid">
          <columns>
            <column/>
            <column flex="1"/>
          </columns>
          <rows>
            <row align="center">
              <radio id="modelMoveToTrash"
                     value="1" label="&modelMoveToTrash.label;"
                     accesskey="&modelMoveToTrash.accesskey;"/>
              <menulist id="msgTrashFolderPicker"
                        aria-labelledby="modelMoveToTrash"
                        oncommand="folderPickerChange(event)">
                <menupopup id="msgTrashFolderPopup" type="folder" mode="filing"
                           showFileHereLabel="true"
                           fileHereLabel="&filemessageschoosethis.label;"/>
              </menulist>
            </row>
            <row align="center">
              <radio id="modelMarkDeleted"
                     value="0" label="&modelMarkDeleted.label;"
                     accesskey="&modelMarkDeleted.accesskey;"/>
            </row>
            <row align="center">
              <radio id="modelDeleteImmediately"
                     value="2" label="&modelDeleteImmediately.label;"
                     accesskey="&modelDeleteImmediately.accesskey;"/>
            </row>
          </rows>
        </grid>
      </radiogroup>
    </hbox>

    <!-- Advanced IMAP settings -->
    <hbox flex="1" hidefor="pop3,nntp,movemail" hidden="true">
      <checkbox hidden="true" wsm_persist="true" id="imap.dualUseFolders"
                prefattribute="value"
                prefstring="mail.server.%serverkey%.dual_use_folders"/>
      <checkbox hidden="true" wsm_persist="true" id="imap.usingSubscription"
                prefattribute="value"
                prefstring="mail.server.%serverkey%.using_subscription"/>
      <checkbox hidden="true" wsm_persist="true" id="imap.useIdle"
                prefattribute="value"
                prefstring="mail.server.%serverkey%.use_idle"/>
      <label hidden="true" wsm_persist="true" id="imap.maximumConnectionsNumber"/>
      <label hidden="true" wsm_persist="true" id="imap.personalNamespace"/>
      <label hidden="true" wsm_persist="true" id="imap.publicNamespace"/>
      <label hidden="true" wsm_persist="true" id="imap.otherUsersNamespace"/>
      <label hidden="true" wsm_persist="true" id="imap.serverDirectory"/>
      <checkbox hidden="true" wsm_persist="true" id="imap.overrideNamespaces"
                prefattribute="value"
                prefstring="mail.server.%serverkey%.override_namespaces"/>
    </hbox>

    <!-- NNTP -->
    <hbox hidefor="pop3,imap,movemail" align="center">
      <checkbox wsm_persist="true" id="nntp.notifyOn"
                label="&maxMessagesStart.label;"
                accesskey="&maxMessagesStart.accesskey;"
                oncommand="onCheckItem('nntp.maxArticles', 'nntp.notifyOn');"
                prefattribute="value"
                prefstring="mail.server.%serverkey%.notify.on"/>
      <textbox wsm_persist="true" id="nntp.maxArticles"
               size="4" type="number" min="1" increment="10"
               aria-labelledby="nntp.notifyOn nntp.maxArticles maxMessagesEnd"
               preftype="int"
               prefstring="mail.server.%serverkey%.max_articles"/>
      <label control="nntp.maxArticles" value="&maxMessagesEnd.label;" id="maxMessagesEnd"/>
    </hbox>
    <checkbox hidefor="pop3,imap,movemail" wsm_persist="true" id="nntp.pushAuth"
              label="&alwaysAuthenticate.label;"
              accesskey="&alwaysAuthenticate.accesskey;"
              prefattribute="value"
              prefstring="mail.server.%serverkey%.always_authenticate"/>

  <!-- take out for now - bug 45079
      <hbox flex="1" hidefor="pop3,imap,movemail">
        <groupbox>
           <caption class="header" label="&abbreviate.label;"/>
  
           <radiogroup wsm_persist="true" id="nntp.abbreviate">
             <radio wsm_persist="true" value="true"
                    label="&abbreviateOn.label;"/>
             <radio wsm_persist="true" value="false" 
                    label="&abbreviateOff.label;"/>
           </radiogroup>
        </groupbox>
      </hbox>
  -->

    <hbox align="end">
      <vbox align="start" flex="1" id="exitHandlingBox=">
        <checkbox hidefor="pop3,nntp,movemail" wsm_persist="true" id="imap.cleanupInboxOnExit"
                  label="&expungeOnExit.label;"
                  accesskey="&expungeOnExit.accesskey;"
                  prefattribute="value"
                  prefstring="mail.server.%serverkey%.cleanup_inbox_on_exit"/>
        <checkbox hidefor="nntp" wsm_persist="true" id="server.emptyTrashOnExit" 
                  label="&emptyTrashOnExit.label;"
                  accesskey="&emptyTrashOnExit.accesskey;"
                  prefattribute="value"
                  prefstring="mail.server.%serverkey%.empty_trash_on_exit"/>
      </vbox>
      <button label="&advancedButton.label;"
              accesskey="&advancedButton.accesskey;"
              oncommand="onAdvanced();"
              wsm_persist="true" id="server.advancedbutton" 
              prefstring="mail.server.%serverkey%.advanced.disable"
              hidefor="nntp,movemail"/>
    </hbox>

    <vbox hidefor="imap,pop3,movemail">
      <label value="&newsrcFilePath.label;" control="nntp.newsrcFilePath"/>
      <hbox align="center">
        <textbox readonly="true" wsm_persist="true" flex="1" id="nntp.newsrcFilePath"
                 datatype="nsILocalFile"
                 prefstring="mail.server.%serverkey%.newsrc.file" class="uri-element"/>
        <button id="browseForNewsrc" label="&browseNewsrc.label;" filepickertitle="&newsrcPicker.label;"
                accesskey="&browseNewsrc.accesskey;" oncommand="BrowseForNewsrc()"/>
      </hbox>
    </vbox>
    </groupbox>

    <separator class="thin"/>
    <vbox>
      <label value="&localPath.label;" control="server.localPath"/>
      <hbox align="center">
        <textbox readonly="true" wsm_persist="true" flex="1" id="server.localPath" datatype="nsILocalFile"
                 prefstring="mail.server.%serverkey%.directory" class="uri-element"/>
        <button id="browseForLocalFolder" label="&browseFolder.label;" filepickertitle="&localFolderPicker.label;"
                accesskey="&browseFolder.accesskey;" oncommand="BrowseForLocalFolders()"/>
      </hbox>
    </vbox>
    <separator class="thin"/>
     <hbox hidefor="imap,pop3,movemail" align="center" valign="middle" iscontrolcontainer="true">
       <label value="&serverDefaultCharset.label;" control="nntp.charset"/>
       <menulist hidable="true" hidefor="imap,pop3,movemail" wsm_persist="true" id="nntp.charset" 
                   ref="NC:DecodersRoot" datasources="rdf:charset-menu"
                   preftype="string" prefstring="mail.server.%serverkey%.charset"> 
         <template>
           <menupopup>
             <menuitem label="rdf:http://home.netscape.com/NC-rdf#Name" value="..." uri="..."/>
           </menupopup>
         </template>
       </menulist>
     </hbox>
  </vbox>
</page>
