<?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 the Places Organizer.
#
# The Initial Developer of the Original Code is Google Inc.
# Portions created by the Initial Developer are Copyright (C) 2005-2006
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#   Ben Goodger <beng@google.com>
#   Annie Sullivan <annie.sullivan@gmail.com>
#   Asaf Romano <mano@mozilla.com>
#   Ehsan Akhgari <ehsan.akhgari@gmail.com>
#   Dietrich Ayala <dietrich@mozilla.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either 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://browser/content/places/places.css"?>
<?xml-stylesheet href="chrome://browser/content/places/organizer.css"?>

<?xml-stylesheet href="chrome://global/skin/"?>
<?xml-stylesheet href="chrome://browser/skin/places/places.css"?>
<?xml-stylesheet href="chrome://browser/skin/places/organizer.css"?>

<?xul-overlay href="chrome://browser/content/places/editBookmarkOverlay.xul"?>

#ifdef XP_MACOSX
<?xul-overlay href="chrome://browser/content/macBrowserOverlay.xul"?>
#else
<?xul-overlay href="chrome://browser/content/baseMenuOverlay.xul"?>
<?xul-overlay href="chrome://global/content/editMenuOverlay.xul"?>
<?xul-overlay href="chrome://browser/content/places/placesOverlay.xul"?>
#endif

<!DOCTYPE window [
<!ENTITY % placesDTD SYSTEM "chrome://browser/locale/places/places.dtd">
%placesDTD;
<!ENTITY % editMenuOverlayDTD SYSTEM "chrome://global/locale/editMenuOverlay.dtd">
%editMenuOverlayDTD;
<!ENTITY % browserDTD SYSTEM "chrome://browser/locale/browser.dtd">
%browserDTD;
]>

<window id="places"
        title="&places.library.title;" 
        windowtype="Places:Organizer" 
        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
        xmlns:html="http://www.w3.org/1999/xhtml"
        onload="PlacesOrganizer.init();"
        onunload="PlacesOrganizer.destroy();"
        width="&places.library.width;" height="&places.library.height;"
        screenX="10" screenY="10"
        toggletoolbar="true"
        persist="width height screenX screenY sizemode">

  <script type="application/javascript"
          src="chrome://browser/content/places/places.js"/>
  <script type="application/javascript"
          src="chrome://browser/content/utilityOverlay.js"/>
  <script type="application/javascript"
          src="chrome://browser/content/places/editBookmarkOverlay.js"/>

  <stringbundleset id="placesStringSet">
    <stringbundle id="brandStrings" src="chrome://branding/locale/brand.properties"/>
  </stringbundleset>


#ifdef XP_MACOSX
#include ../../../base/content/browserMountPoints.inc
#else
  <commandset id="editMenuCommands"/>
  <commandset id="placesCommands"/>
#endif

  <commandset id="organizerCommandSet">
    <command id="OrganizerCommand_find:all"
             label="&cmd.findInBookmarks.label;"
             accesskey="&cmd.findInBookmarks.accesskey;"
             oncommand="PlacesSearchBox.findAll();"/>
    <command id="OrganizerCommand_find:current"
             label="&cmd.findCurrent.label;"
             accesskey="&cmd.findCurrent.accesskey;"
             oncommand="PlacesSearchBox.findCurrent();"/>
    <command id="OrganizerCommand_export"
             oncommand="PlacesOrganizer.exportBookmarks();"/>
    <command id="OrganizerCommand_import"
             oncommand="PlacesOrganizer.importFromFile();"/>
    <command id="OrganizerCommand_browserImport"
             oncommand="PlacesOrganizer.importFromBrowser();"/>
    <command id="OrganizerCommand_backup"
             oncommand="PlacesOrganizer.backupBookmarks();"/>
    <command id="OrganizerCommand_restoreFromFile"
             oncommand="PlacesOrganizer.onRestoreBookmarksFromFile();"/>
    <command id="OrganizerCommand_search:save"
             oncommand="PlacesOrganizer.saveSearch();"/>
    <command id="OrganizerCommand_search:moreCriteria"
             oncommand="PlacesQueryBuilder.addRow();"/>
    <command id="OrganizerCommand:Back"
             oncommand="PlacesOrganizer.back();"/>
    <command id="OrganizerCommand:Forward"
             oncommand="PlacesOrganizer.forward();"/>
  </commandset>


  <keyset id="placesOrganizerKeyset">
    <!-- Instantiation Keys -->
    <key id="placesKey_close" key="&cmd.close.key;" modifiers="accel" 
         oncommand="close();"/>
         
    <!-- Command Keys -->
    <key id="placesKey_find:all"
         command="OrganizerCommand_find:all" 
         key="&cmd.find.key;"
         modifiers="accel"/>
    <key id="placesKey_find:current"
         command="OrganizerCommand_find:current" 
         key="&cmd.find.key;"
         modifiers="accel,shift"/>

    <!-- Back/Forward Keys Support -->
#ifndef XP_MACOSX
    <key id="placesKey_goBackKb"
         keycode="VK_LEFT"
         command="OrganizerCommand:Back"
         modifiers="alt"/>
    <key id="placesKey_goForwardKb"
         keycode="VK_RIGHT"
         command="OrganizerCommand:Forward"
         modifiers="alt"/>
#else
    <key id="placesKey_goBackKb"
         keycode="VK_LEFT"
         command="OrganizerCommand:Back"
         modifiers="accel"/>
    <key id="placesKey_goForwardKb"
         keycode="VK_RIGHT"
         command="OrganizerCommand:Forward"
         modifiers="accel"/>
#endif
#ifdef XP_UNIX
    <key id="placesKey_goBackKb2"
         key="&goBackCmd.commandKey;"
         command="OrganizerCommand:Back"
         modifiers="accel"/>
    <key id="placesKey_goForwardKb2"
         key="&goForwardCmd.commandKey;"
         command="OrganizerCommand:Forward"
         modifiers="accel"/>
#endif
  </keyset>

  <keyset id="editMenuKeys">
#ifdef XP_MACOSX
    <key id="key_delete2" keycode="VK_BACK" command="cmd_delete"/>
#endif
  </keyset>

  <popupset id="placesPopupset">
    <menupopup id="placesContext"/>
    <menupopup id="placesColumnsContext"
               onpopupshowing="ViewMenu.fillWithColumns(event, null, null, 'checkbox', null);"
               oncommand="ViewMenu.showHideColumn(event.target); event.stopPropagation();"/>
  </popupset>

  <toolbox id="placesToolbox">
    <toolbar class="chromeclass-toolbar" id="placesToolbar" align="center">
      <toolbarbutton id="back-button"
                     command="OrganizerCommand:Back"
                     tooltiptext="&backButton.tooltip;"
                     disabled="true"/>

      <toolbarbutton id="forward-button"
                     command="OrganizerCommand:Forward"
                     tooltiptext="&forwardButton.tooltip;"
                     disabled="true"/>

#ifdef XP_MACOSX
        <toolbarbutton type="menu" class="tabbable"
              onpopupshowing="document.getElementById('placeContent').focus()"
#else
      <menubar id="placesMenu">
        <menu accesskey="&organize.accesskey;" class="menu-iconic"
#endif
              id="organizeButton" label="&organize.label;"
              tooltiptext="&organize.tooltip;">
          <menupopup id="organizeButtonPopup">
            <menuitem id="newbookmark"
                      command="placesCmd_new:bookmark"
                      label="&cmd.new_bookmark.label;"
                      accesskey="&cmd.new_bookmark.accesskey;"/>
            <menuitem id="newfolder"
                      command="placesCmd_new:folder"
                      label="&cmd.new_folder.label;"
                      accesskey="&cmd.new_folder.accesskey;"/>
            <menuitem id="newseparator"
                      command="placesCmd_new:separator"
                      label="&cmd.new_separator.label;"
                      accesskey="&cmd.new_separator.accesskey;"/>

#ifndef XP_MACOSX
            <menuseparator id="orgUndoSeparator"/>

            <menuitem id="orgUndo"
                      command="cmd_undo"
                      label="&undoCmd.label;"
                      key="key_undo"
                      accesskey="&undoCmd.accesskey;"/>
            <menuitem id="orgRedo"
                      command="cmd_redo"
                      label="&redoCmd.label;"
                      key="key_redo"
                      accesskey="&redoCmd.accesskey;"/>

            <menuseparator id="orgCutSeparator"/>

            <menuitem id="orgCut"
                      command="cmd_cut"
                      label="&cutCmd.label;"
                      key="key_cut"
                      accesskey="&cutCmd.accesskey;"
                      selection="separator|link|folder|mixed"/>
            <menuitem id="orgCopy"
                      command="cmd_copy"
                      label="&copyCmd.label;"
                      key="key_copy"
                      accesskey="&copyCmd.accesskey;"
                      selection="separator|link|folder|mixed"/>
            <menuitem id="orgPaste"
                      command="cmd_paste"
                      label="&pasteCmd.label;"
                      key="key_paste"
                      accesskey="&pasteCmd.accesskey;"
                      selection="mutable"/>
            <menuitem id="orgDelete"
                      command="cmd_delete"
                      label="&deleteCmd.label;"
                      key="key_delete"
                      accesskey="&deleteCmd.accesskey;"/>

            <menuseparator id="selectAllSeparator"/>

            <menuitem id="orgSelectAll"
                      command="cmd_selectAll"
                      label="&selectAllCmd.label;"
                      key="key_selectAll"
                      accesskey="&selectAllCmd.accesskey;"/>

#endif
            <menuseparator id="orgMoveSeparator"/>

            <menuitem id="orgMoveBookmarks"
                      command="placesCmd_moveBookmarks"
                      label="&cmd.moveBookmarks.label;"
                      accesskey="&cmd.moveBookmarks.accesskey;"/>
#ifdef XP_MACOSX
            <menuitem id="orgDelete"
                      command="cmd_delete"
                      label="&deleteCmd.label;"
                      key="key_delete"
                      accesskey="&deleteCmd.accesskey;"/>
#else
            <menuseparator id="orgCloseSeparator"/>

            <menuitem id="orgClose"
                      key="placesKey_close" 
                      label="&file.close.label;"
                      accesskey="&file.close.accesskey;" 
                      oncommand="close();"/>
#endif
          </menupopup>
#ifdef XP_MACOSX
        </toolbarbutton>
        <toolbarbutton type="menu" class="tabbable"
#else
        </menu>
        <menu accesskey="&views.accesskey;" class="menu-iconic"
#endif
              id="viewMenu" label="&views.label;"
              tooltiptext="&views.tooltip;">
          <menupopup id="viewMenuPopup">

            <menu id="viewColumns" 
                  label="&view.columns.label;" accesskey="&view.columns.accesskey;">
              <menupopup onpopupshowing="ViewMenu.fillWithColumns(event, null, null, 'checkbox', null);"
                         oncommand="ViewMenu.showHideColumn(event.target); event.stopPropagation();"/>
            </menu>

            <menu id="viewSort" label="&view.sort.label;"
                  accesskey="&view.sort.accesskey;">
              <menupopup onpopupshowing="ViewMenu.populateSortMenu(event);"
                         oncommand="ViewMenu.setSortColumn(event.target.column, null);">
                <menuitem id="viewUnsorted" type="radio" name="columns" 
                          label="&view.unsorted.label;" accesskey="&view.unsorted.accesskey;"
                          oncommand="ViewMenu.setSortColumn(null, null);"/>
                <menuseparator id="directionSeparator"/>
                <menuitem id="viewSortAscending" type="radio" name="direction" 
                          label="&view.sortAscending.label;" accesskey="&view.sortAscending.accesskey;"
                          oncommand="ViewMenu.setSortColumn(null, 'ascending'); event.stopPropagation();"/>
                <menuitem id="viewSortDescending" type="radio" name="direction" 
                          label="&view.sortDescending.label;" accesskey="&view.sortDescending.accesskey;"
                          oncommand="ViewMenu.setSortColumn(null, 'descending'); event.stopPropagation();"/>
              </menupopup>
            </menu>
          </menupopup>
#ifdef XP_MACOSX
        </toolbarbutton>
        <toolbarbutton type="menu" class="tabbable"
#else
        </menu>
        <menu accesskey="&maintenance.accesskey;" class="menu-iconic"
#endif
              id="maintenanceButton" label="&maintenance.label;"
              tooltiptext="&maintenance.tooltip;">
          <menupopup id="maintenanceButtonPopup">
            <menuitem id="backupBookmarks"
                      command="OrganizerCommand_backup"
                      label="&cmd.backup.label;"
                      accesskey="&cmd.backup.accesskey;"/>
            <menu id="fileRestoreMenu" label="&cmd.restore2.label;"
                      accesskey="&cmd.restore2.accesskey;">
              <menupopup id="fileRestorePopup" onpopupshowing="PlacesOrganizer.populateRestoreMenu();">
                <menuitem id="restoreFromFile"
                          command="OrganizerCommand_restoreFromFile"
                          label="&cmd.restoreFromFile.label;"
                          accesskey="&cmd.restoreFromFile.accesskey;"/>
              </menupopup>
            </menu>
            <menuseparator/>
            <menuitem id="fileImport"
                      command="OrganizerCommand_import"
                      label="&importBookmarksFromHTML.label;"
                      accesskey="&importBookmarksFromHTML.accesskey;"/>
            <menuitem id="fileExport"
                      command="OrganizerCommand_export"
                      label="&exportBookmarksToHTML.label;"
                      accesskey="&exportBookmarksToHTML.accesskey;"/>
            <menuseparator/>
            <menuitem id="browserImport"
                      command="OrganizerCommand_browserImport"
                      label="&importOtherBrowser.label;"
                      accesskey="&importOtherBrowser.accesskey;"/>
          </menupopup>
#ifdef XP_MACOSX
        </toolbarbutton>
#else
        </menu>
      </menubar>
#endif

      <spacer flex="1"/>

      <textbox id="searchFilter"
               clickSelectsAll="true"
               type="search"
               aria-controls="placeContent"
               oncommand="PlacesSearchBox.search(this.value);"
               collection="bookmarks">
      </textbox>
    </toolbar>
  </toolbox>

  <hbox flex="1" id="placesView">
    <tree id="placesList"
          class="plain placesTree"
          type="places"
          hidecolumnpicker="true" context="placesContext"
          onselect="PlacesOrganizer.onPlaceSelected(true);"
          onclick="PlacesOrganizer.onTreeClick(event);"
          onfocus="PlacesOrganizer.onTreeFocus(event);"
          seltype="single"
          persist="width"
          width="200"
          minwidth="100"
          maxwidth="400">
      <treecols>
        <treecol anonid="title" flex="1" primary="true" hideheader="true"/>
      </treecols>
      <treechildren flex="1"/>
    </tree>
    <splitter collapse="none" persist="state"></splitter>
    <vbox id="contentView" flex="4">
      <toolbox id="searchModifiers" hidden="true">
        <toolbar id="organizerScopeBar" class="chromeclass-toolbar" align="center">
          <label id="scopeBarTitle" value="&search.in.label;"/>
          <toolbarbutton id="scopeBarAll" class="small-margin"
                         type="radio" group="scopeBar"
                         oncommand="PlacesQueryBuilder.onScopeSelected(this);"
                         label="&search.scopeBookmarks.label;"
                         accesskey="&search.scopeBookmarks.accesskey;"/>
          <!--
          <toolbarbutton id="scopeBarDownloads" class="small-margin"
                         type="radio" group="scopeBar"
                         oncommand="PlacesQueryBuilder.onScopeSelected(this);"
                         label="&search.scopeDownloads.label;"
                         accesskey="&search.scopeDownloads.accesskey;"/>
          -->
          <toolbarbutton id="scopeBarHistory" class="small-margin"
                         type="radio" group="scopeBar"
                         oncommand="PlacesQueryBuilder.onScopeSelected(this);"
                         label="&search.scopeHistory.label;"
                         accesskey="&search.scopeHistory.accesskey;"/>
          <toolbarbutton id="scopeBarFolder" class="small-margin"
                         type="radio" group="scopeBar"
                         oncommand="PlacesQueryBuilder.onScopeSelected(this);"
                         accesskey="&search.scopeFolder.accesskey;"
                         emptytitle="&search.scopeFolder.label;" flex="1"/>
          <!-- The folder scope button should flex but not take up more room
                than its label needs.  The only simple way to do that is to
                set a really big flex on the spacer, e.g., 2^31 - 1. -->
          <spacer flex="2147483647"/>
          <button id="saveSearch" class="small-margin"
                  label="&saveSearch.label;" accesskey="&saveSearch.accesskey;"
                  command="OrganizerCommand_search:save"/>
        </toolbar>
      </toolbox>
      <tree id="placeContent"
            class="plain placesTree"
            context="placesContext"
            hidecolumnpicker="true"
            flex="1"
            type="places"
            flatList="true"
            enableColumnDrag="true"
            onkeypress="if (event.keyCode == KeyEvent.DOM_VK_RETURN) PlacesOrganizer.openSelectedNode(event);"
            onopenflatcontainer="PlacesOrganizer.openFlatContainer(aContainer);"
            onselect="PlacesOrganizer.onContentTreeSelect();"
            onfocus="PlacesOrganizer.onTreeFocus(event);"
            onclick="PlacesOrganizer.onTreeClick(event);">
        <treecols id="placeContentColumns" context="placesColumnsContext">
          <treecol label="&col.name.label;" id="placesContentTitle" anonid="title" flex="5" primary="true" ordinal="1" 
                    persist="width hidden ordinal sortActive sortDirection"/>
          <splitter class="tree-splitter"/>
          <treecol label="&col.tags.label;" id="placesContentTags" anonid="tags" flex="2"
                    persist="width hidden ordinal sortActive sortDirection"/>
          <splitter class="tree-splitter"/>
          <treecol label="&col.url.label;" id="placesContentUrl" anonid="url" flex="5"
                    persist="width hidden ordinal sortActive sortDirection"/>
          <splitter class="tree-splitter"/>
          <treecol label="&col.lastvisit.label;" id="placesContentDate" anonid="date" flex="1" hidden="true"
                    persist="width hidden ordinal sortActive sortDirection"/>
          <splitter class="tree-splitter"/>
          <treecol label="&col.visitcount.label;" id="placesContentVisitCount" anonid="visitCount" flex="1" hidden="true"
                    persist="width hidden ordinal sortActive sortDirection"/>
          <splitter class="tree-splitter"/>
          <treecol label="&col.keyword.label;" id="placesContentKeyword" anonid="keyword" flex="1" hidden="true"
                    persist="width hidden ordinal sortActive sortDirection"/>
          <splitter class="tree-splitter"/>
          <treecol label="&col.description.label;" id="placesContentDescription" anonid="description" flex="1" hidden="true"
                    persist="width hidden ordinal sortActive sortDirection"/>
          <splitter class="tree-splitter"/>
          <treecol label="&col.dateadded.label;" id="placesContentDateAdded" anonid="dateAdded" flex="1" hidden="true"
                    persist="width hidden ordinal sortActive sortDirection"/>
          <splitter class="tree-splitter"/>
          <treecol label="&col.lastmodified.label;" id="placesContentLastModified" anonid="lastModified" flex="1" hidden="true"
                    persist="width hidden ordinal sortActive sortDirection"/>
        </treecols>
        <treechildren flex="1"/>
      </tree>
      <deck id="detailsDeck" style="height: 11em;">
        <vbox id="itemsCountBox" align="center">
          <spacer flex="3"/>
          <label id="itemsCountText"/>
          <spacer flex="1"/>
          <description id="selectItemDescription">
              &detailsPane.selectAnItemText.description;
          </description>
          <spacer flex="3"/>
        </vbox>
        <vbox id="infoBox" minimal="true">
          <vbox id="editBookmarkPanelContent" flex="1"/>
          <hbox id="infoBoxExpanderWrapper" align="center">

            <button type="image" id="infoBoxExpander"
                    class="expander-down"
                    oncommand="PlacesOrganizer.toggleAdditionalInfoFields();"
                    observes="paneElementsBroadcaster"/>

            <label id="infoBoxExpanderLabel"
                    lesslabel="&detailsPane.less.label;"
                    lessaccesskey="&detailsPane.less.accesskey;"
                    morelabel="&detailsPane.more.label;"
                    moreaccesskey="&detailsPane.more.accesskey;"
                    value="&detailsPane.more.label;"
                    accesskey="&detailsPane.more.accesskey;"
                    control="infoBoxExpander"/>

          </hbox>
        </vbox>
      </deck>
    </vbox>
  </hbox>
</window>
