<?xml version="1.0"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
   - License, v. 2.0. If a copy of the MPL was not distributed with this
   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->

<!DOCTYPE overlay
[
    <!ENTITY % dtd1 SYSTEM "chrome://calendar/locale/global.dtd" > %dtd1;
    <!ENTITY % dtd2 SYSTEM "chrome://lightning/locale/lightning.dtd" > %dtd2;
    <!ENTITY % dtd3 SYSTEM "chrome://messenger/locale/messenger.dtd" > %dtd3;
    <!ENTITY % dtd4 SYSTEM "chrome://calendar/locale/calendar.dtd" > %dtd4;
    <!ENTITY % dtd5 SYSTEM "chrome://global/locale/global.dtd" > %dtd5;
    <!ENTITY % dtd6 SYSTEM "chrome://calendar/locale/calendar-event-dialog.dtd"> %dtd6;
]>

<?xml-stylesheet href="chrome://calendar/skin/today-pane.css" type="text/css"?>
<?xml-stylesheet href="chrome://calendar/content/widgets/calendar-widget-bindings.css" type="text/css"?>

<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

<script type="application/javascript" src="chrome://calendar/content/today-pane.js"/>
<script type="application/javascript" src="chrome://calendar/content/agenda-listbox.js"/>
<script type="application/javascript" src="chrome://calendar/content/calendar-management.js"/>
<script type="application/javascript" src="chrome://calendar/content/calendar-dnd-listener.js"/>
<script type="application/javascript" src="chrome://calendar/content/calendar-item-editing.js"/>

    <modevbox id="today-pane-panel"
              mode="mail,calendar,task" modewidths="200,200,200" modesplitterstates="open,open,open"
              refcontrol="calendar_toggle_todaypane_command"
              broadcaster="modeBroadcaster" persist="modewidths">
      <sidebarheader align="center">
        <label id ="today-pane-header"/>
        <spacer flex="1"/>
        <modehbox mode="mail,calendar" broadcaster="modeBroadcaster">
          <toolbarbutton id="today-pane-cycler-prev"
                         dir="prev"
                         class="today-pane-cycler"
                         oncommand="TodayPane.cyclePaneView(-1);"/>
          <toolbarbutton id="today-pane-cycler-next"
                         dir="next"
                         class="today-pane-cycler"
                         oncommand="TodayPane.cyclePaneView(1);"/>
        </modehbox>
        <spacer id="buttonspacer"/>
        <toolbarbutton id="today-closer" class="today-closebutton"
                       oncommand="document.getElementById('today-pane-panel').setVisible(false, true, true);
                                  TodayPane.setTodayHeader();
                                  TodayPane.updateSplitterState();"/>
      </sidebarheader>
      <vbox flex="1">
        <modevbox id="agenda-panel"
                  flex="1"
                  mode="mail,calendar,task"
                  collapsedinmodes="calendar"
                  persist="collapsed height collapsedinmodes"
                  broadcaster="modeBroadcaster">
              <modebox id="today-none-box"
                       mode="mail,calendar,task"
                       collapsedinmodes="mail,calendar,task"
                       broadcaster="modeBroadcaster"
                       refcontrol="ltnTodayPaneDisplayNone"
                       persist="collapsedinmodes"/>
              <modehbox id="today-minimonth-box"
                        pack="center"
                        class="today-subpane"
                        mode="mail,calendar,task"
                        broadcaster="modeBroadcaster"
                        collapsedinmodes="mail,calendar,task"
                        refcontrol="ltnTodayPaneDisplayMinimonth"
                        persist="collapsedinmodes">
                <minimonth id="today-Minimonth" freebusy="true" onchange="TodayPane.setDaywithjsDate(this.value);"/>
              </modehbox>
              <modebox id="mini-day-box"
                       mode="mail,calendar,task"
                       class="today-subpane"
                       refcontrol="ltnTodayPaneDisplayMiniday"
                       broadcaster="modeBroadcaster"
                       collapsedinmodes=""
                       persist="collapsedinmodes"
                       onDOMMouseScroll="TodayPane.advance(event.detail > 0 ? 1 : -1);">
                <stack flex="1">
                  <image id="mini-day-image" flex="1"/>
                  <hbox flex="1">
                    <stack id="dateContainer">
                      <hbox pack="center"
                            align="center">
                        <label id="datevalue-label" class="dateValue"
                               ondblclick="TodayPane.onDoubleClick(event);"
                               onmousedown="TodayPane.onMousedown(event);"/>
                      </hbox>
                      <hbox flex="1" pack="center" align="center" mousethrough="always">
                        <image id="dragCenter-image" hidden="true"/>
                      </hbox>
                    </stack>
                    <vbox flex="1">
                      <hbox pack="center">
                        <deck id="weekdayNameContainer" pack="center"
                              ondblclick="TodayPane.onDoubleClick(event);">
                          <label/><!-- workaround for bug 1070491-->
                          <label/>
                          <label/>
                          <label/>
                          <label/>
                          <label/>
                          <label/>
                          <label/>
                        </deck>
                        <spacer id="weekspacer" flex="1"/>
                        <hbox pack="end">
                          <toolbarbutton id="previous-day-button"
                                         class="miniday-nav-buttons"
                                         tooltiptext="&onedaybackward.tooltip;"
                                         onmousedown="TodayPane.onMousedown(event, parseInt(this.getAttribute('dir')));"
                                         dir="-1"/>
                          <toolbarbutton id="today-button"
                                         class="miniday-nav-buttons"
                                         tooltiptext="&showToday.tooltip;"
                                         oncommand="TodayPane.setDay(now());"/>
                          <toolbarbutton id="next-day-button"
                                         class="miniday-nav-buttons"
                                         tooltiptext="&onedayforward.tooltip;"
                                         onmousedown="TodayPane.onMousedown(event, parseInt(this.getAttribute('dir')));"
                                         dir="1"/>
                        </hbox>
                      </hbox>
                      <hbox pack="start">
                        <deck id ="monthNameContainer" class="monthlabel"
                              ondblclick="TodayPane.onDoubleClick(event);">
                          <label/>
                          <label/>
                          <label/>
                          <label/>
                          <label/>
                          <label/>
                          <label/>
                          <label/>
                          <label/>
                          <label/>
                          <label/>
                          <label/>
                        </deck>
                        <label id="currentWeek-label" class="monthlabel"
                               ondblclick="TodayPane.onDoubleClick(event);"/>
                        <spacer flex="1"/>
                      </hbox>
                    </vbox>
                    <toolbarbutton id="miniday-dropdown-button"
                                   tooltiptext="&showselectedday.tooltip;"
                                   type="menu">
                      <panel id="miniday-month-panel" position="after_end">
                        <minimonth id="todayMinimonth"
                                   flex="1"
                                   onchange="TodayPane.setDaywithjsDate(this.value);
                                             document.getElementById('miniday-month-panel').hidePopup();"/>
                      </panel>
                   </toolbarbutton>
                 </hbox>
                </stack>
              </modebox>
            <vbox flex="1">
              <hbox id="agenda-toolbar" iconsize="small">
                <toolbarbutton id="todaypane-new-event-button"
                               mode="mail"
                               iconsize="small"
                               orient="horizontal"
                               label="&calendar.newevent.button.label;"
                               tooltiptext="&calendar.newevent.button.tooltip;"
                               oncommand="agendaListbox.createNewEvent(event)">
                  <observes element="calendar_new_event_command" attribute="disabled"/>
                </toolbarbutton>
             </hbox>
             <vbox id="richlistitem-container" hidden="true">
                <agenda-checkbox-richlist-item id="today-header-hidden"
                                               title="&calendar.today.button.label;"
                                               checked="true"
                                               persist="checked"/>
                <agenda-checkbox-richlist-item id="tomorrow-header-hidden"
                                               title="&calendar.tomorrow.button.label;"
                                               checked="false"
                                               persist="checked"/>
                <agenda-checkbox-richlist-item id="nextweek-header-hidden"
                                               title="&calendar.upcoming.button.label;"
                                               checked="false"
                                               persist="checked"/>
              </vbox>
              <richlistbox id="agenda-listbox" flex="1" context="_child"
                           onblur="agendaListbox.onBlur();"
                           onfocus="agendaListbox.onFocus();"
                           onkeypress="agendaListbox.onKeyPress(event);"
                           ondblclick="agendaListbox.createNewEvent(event);"
                           ondragstart="nsDragAndDrop.startDrag(event, calendarCalendarButtonDNDObserver);"
                           ondragover="nsDragAndDrop.dragOver(event, calendarCalendarButtonDNDObserver);"
                           ondrop="nsDragAndDrop.drop(event, calendarCalendarButtonDNDObserver);">
                <menupopup id="agenda-menupopup" onpopupshowing="return agendaListbox.setupContextMenu(event.target)">
                  <menuitem label="&calendar.context.modifyorviewitem.label;"
                           accesskey="&calendar.context.modifyorviewitem.accesskey;"
                           observes="agenda_edit_event_command"/>
                  <menu id="agenda-context-menu-convert-menu"
                       label="&calendar.context.convertmenu.label;"
                       accesskey="&calendar.context.convertmenu.accesskey.calendar;">
                   <menupopup id="agenda-context-menu-convert-menupopup">
                     <menuitem id="agenda-context-menu-convert-message-menuitem"
                               label="&calendar.context.convertmenu.message.label;"
                               accesskey="&calendar.context.convertmenu.message.accesskey;"
                               oncommand="calendarMailButtonDNDObserver.onDropItems(agendaListbox.getSelectedItems())"/>
                     <menuitem id="agenda-context-menu-convert-task-menuitem"
                               class="event-only"
                               label="&calendar.context.convertmenu.task.label;"
                               accesskey="&calendar.context.convertmenu.task.accesskey;"
                               oncommand="calendarTaskButtonDNDObserver.onDropItems(agendaListbox.getSelectedItems())"/>
                   </menupopup>
                  </menu>
                  <menuseparator id="calendar-today-pane-menuseparator-before-delete"/>
                  <menuitem label="&calendar.context.deleteevent.label;"
                           accesskey="&calendar.context.deleteevent.accesskey;"
                           key="calendar-delete-item-key"
                           observes="agenda_delete_event_command"/>
                  <menu id="calendar-today-pane-menu-attendance-menu"
                       class="attendance-menu"
                       label="&calendar.context.attendance.menu.label;"
                       accesskey="&calendar.context.attendance.menu.accesskey;"
                       oncommand="setContextPartstat(event.target.value, event.target.getAttribute('scope'), agendaListbox.getSelectedItems({}))"
                       observes="calendar_attendance_command">
                   <menupopup id="calendar-today-pane-menu-attendance-menupopup">
                     <label id="calendar-today-pane-attendance-thisoccurrence-label"
                            class="calendar-context-heading-label"
                            scope="all-occurrences"
                            value="&calendar.context.attendance.occurrence.label;"/>
                     <menuitem id="calendar-today-pane-menu-attend-accept-menuitem"
                               type="radio"
                               scope="this-occurrence"
                               name="calendar-today-pane-attendance"
                               label="&read.only.accept.label;" value="ACCEPTED"/>
                     <menuitem id="calendar-today-pane-menu-attend-tentative-menuitem"
                               type="radio"
                               scope="this-occurrence"
                               name="calendar-today-pane-attendance"
                               label="&read.only.tentative.label;" value="TENTATIVE"/>
                     <menuitem id="calendar-today-pane-menu-attend-declined-menuitem"
                               type="radio"
                               scope="this-occurrence"
                               name="calendar-today-pane-attendance"
                               label="&read.only.decline.label;" value="DECLINED"/>
                     <menuitem id="calendar-today-pane-menu-attend-needsaction-menuitem"
                               type="radio"
                               scope="this-occurrence"
                               name="calendar-today-pane-attendance"
                               label="&read.only.needs.action.label;" value="NEEDS-ACTION"/>
                     <label id="calendar-today-pane-attendance-alloccurrence-label"
                            class="calendar-context-heading-label"
                            scope="all-occurrences"
                            value="&calendar.context.attendance.all.label;"/>
                     <menuitem id="calendar-today-pane-menu-attend-accept-all-menuitem"
                               type="radio"
                               scope="all-occurrences"
                               name="calendar-today-pane-attendance-all"
                               label="&read.only.accept.label;" value="ACCEPTED"/>
                     <menuitem id="calendar-today-pane-menu-attend-tentative-all-menuitem"
                               type="radio"
                               scope="all-occurrences"
                               name="calendar-today-pane-attendance-all"
                               label="&read.only.tentative.label;" value="TENTATIVE"/>
                     <menuitem id="calendar-today-pane-menu-attend-declined-all-menuitem"
                               type="radio"
                               scope="all-occurrences"
                               name="calendar-today-pane-attendance-all"
                               label="&read.only.decline.label;" value="DECLINED"/>
                     <menuitem id="calendar-today-pane-menu-attend-needsaction-all-menuitem"
                               type="radio"
                               scope="all-occurrences"
                               name="calendar-today-pane-attendance-all"
                               label="&read.only.needs.action.label;" value="NEEDS-ACTION"/>
                   </menupopup>
                  </menu>
                </menupopup>
              </richlistbox>
            </vbox>
        </modevbox>
        <splitter id="today-pane-splitter" persist="hidden"/>
        <modevbox id="todo-tab-panel" flex="1" mode="mail,calendar"
                  collapsedinmodes="mail,task"
                  broadcaster="modeBroadcaster"
                  persist="height collapsedinmodes"
                  ondragstart="nsDragAndDrop.startDrag(event, calendarTaskButtonDNDObserver);"
                  ondragover="nsDragAndDrop.dragOver(event, calendarTaskButtonDNDObserver);"
                  ondrop="nsDragAndDrop.drop(event, calendarTaskButtonDNDObserver);"/>
    </vbox>
  </modevbox>

  <commandset id="calendar_commands">
    <command id="calendar_toggle_todaypane_command" oncommand="TodayPane.toggleVisibility(event)"/>
  </commandset>
</overlay>
