<%@ Page Title="" Language="C#" MasterPageFile="~/Book/Book.master"     AutoEventWireup="true" CodeBehind="WeeklyView.aspx.cs" Inherits="Book.Book.WeeklyView" %>
<%@ Register src="../UserControls/area.ascx" tagname="area" tagprefix="uc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="cont_form" runat="server">

 <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
     
    <link href="../style/themes.css" rel="stylesheet" />
     
    <script src="../javascript/modal.js"></script>
        <style>
            option {
     color:#1970c0; font-size:15px;  
       } 
    
     </style>
    
   
 
    


 

<script type="text/javascript">


    function createEvent(start, end, resource, t) {

        resource = $("#room option:selected").val();
        
        var modal = new DayPilot.Modal();
        modal.top = 120;
        modal.width = 600;
        modal.height = 280;
        modal.opacity = 0;
        modal.border = "2px solid #aaaaaa";

        modal.closed = function () {
            if (this.result == "OK") {
                dpc1.commandCallBack('refresh');
            }
            dpc1.clearSelection();
        };

        if (t == 1) {
            modal.showUrl("quickbook.aspx?start=" + start.toStringSortable() + "&end=" + end.toStringSortable() + "&roomid=" + resource);

        }

        if (t == 2) {
            window.location = "addbook.aspx?from=" + start.toStringSortable() + "&to=" + end.toStringSortable() + "&roomid=" + resource + "&date=" + start.toStringSortable();

        }
    }




    function ask(e) {

        // 正常会议
        if (!e.recurrent()) {
            edit(e);
            return;
        }

        // 循环会议，但是是一个例外的会议
        if (e.value() !== null) {
            edit(e);
            return;
        }

        var modal = new DayPilot.Modal();
        modal.top = 150;
        modal.width = 300;
        modal.height = 200;
        modal.opacity = 0;
        modal.border = "10px solid #d0d0d0";
        modal.closed = function () {
            if (this.result != "cancel") {
                edit(e, this.result);
            }
        };
        modal.showUrl("RecurrentEditMode.html");
    }


    function ref() {
        dpc1.commandCallBack('refresh');

    }

    function edit(e, mode) {


        var url = "RecurrentEventEdit.aspx?q=1"
        if (e.recurrentMasterId() !== null) {
            url += "&master=" + e.recurrentMasterId();
        }
        if (e.value() !== null) {
            url += "&id=" + e.value();
        }
        if (mode == "this") {
            url += "&start=" + e.start().toStringSortable();
        }

        layer.open({
            type: 2,
            area: ['700px', '550px'],
            fix: false, //不固定
            maxmin: true,
            content: url
        });

        return;

    }

</script>




    
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">

        <ContentTemplate>
 


  <%=iseng?"Select Date":"选择日期" %> <input type="text" class="form-control _dt" style=" width:150px; display:inline-block" id="txt_startdate" runat="server"     />

  
      &nbsp;&nbsp;
     <uc1:area ID="area1" runat="server" OnAreaChanged="area1_changed" />
    &nbsp;&nbsp;
    <asp:Button ID="btn_Search" runat="server" Text="查询" class="btn btn-primary btn-sm" 
        onclick="btn_Search_click"  />
   
     
            &nbsp;&nbsp; | &nbsp;&nbsp;
               <div class="btn-group">
                  <asp:Button ID="btn_pre"  CssClass="btn btn-primary"  runat="server" Text="前7天" OnClick="btn_pre_Click" />
                  <asp:Button ID="btn_today"  CssClass="btn btn-danger  "   runat="server" Text="今天" OnClick="btn_today_Click" />
                  <asp:Button ID="btn_next" CssClass="btn btn-primary" runat="server" Text="后7天" OnClick="btn_next_Click" />
              </div>

 &nbsp;&nbsp; | &nbsp;&nbsp;
         
 
             
    <span class="btn btn-flat btn-xs " title="红色背景表示内部会议" style="background-color:#3399cc;  cursor:help; color:#ffffff">内部会议</span>
         <span class="btn btn-flat  btn-xs"  title="蓝色背景表示外部会议"  style="background-color:#ff99cc; cursor:help; color:#ffffff">外部会议</span> 


   <span class="btn btn-flat  btn-xs"   style="background-color:#808080;  color:#ffffff">鼠标右键预定</span> 
   <span class="btn btn-flat  btn-xs"   style="background-color:#808080;  color:#ffffff">双击编辑</span> 


      <table style="width:99%; margin-top:20px;"> 
          <tr  valign="top">
              <td width="180px">
<div id="room">

  <asp:listbox     Width="95%"  Height="600px"
       ID="rbl_meetingroom" runat="server"  
         AutoPostBack="True"   
        onselectedindexchanged="rbl_meetingroom_SelectedIndexChanged"     >
     
  </asp:listbox>

</div>
  
              </td>

              <td>


    <daypilot:daypilotcalendar  
         
 
                    ContextMenuSelectionID="DayPilotMenuSelection"
                    ContextMenuID="DayPilotMenuSelection"  
                    TimeFormat="Auto" 
                    CellHeight="30"
                    
                    id="DayPilotCalendar1" 
                    runat="server" 
                    
                    datastartfield="begintime" 
                    dataendfield="endtime" 
                    datatextfield="title" 
                    datavaluefield="id" 
                    DataTagFields="userid,others2"
                    DataRecurrenceField="rec"
                    EventCorners="Regular" 
                      
                      
                    CssClassPrefix="calendar_silver_"
                    Days="7" 
                    ClientObjectName="dpc1" 
                   
                   TimeRangeSelectedHandling="Hold" 
                   
                   BusinessBeginsHour="8"
                   BusinessEndsHour="20"
                    
                   EventDoubleClickHandling="JavaScript"
                   EventDoubleClickJavaScript="ask(e)"
                   EventClickHandling="JavaScript"
                   EventClickJavaScript="_open(e)"      
                      
                   BackColor="white"
                   NonBusinessBackColor = "#FFFFCE"
                   EventBackColor="#638EDE"
                   EventBorderColor="#2951A5"
                   HourNameBackColor="#F3F3F9"
                   HourFontColor="#42658C"
                   HeaderFontColor="#42658C"
                   EventFontColor="white"
                   EventFontFamily="Tahoma,Verdana,Sans-serif"
                   BorderColor="#CED2CE"
                   CellBorderColor="#DEDFDE"
                   AllDayEventBackColor="#2951a5"
                   AllDayEventFontColor="#ffffff"
                   AllDayEventBorderColor="transparent"
                   HourBorderColor="#DEDFDE"
                   HourHalfBorderColor="#EBEDEB"
                   HourNameBorderColor="#DEDFDE" 
         
                   EventDeleteHandling="JavaScript" 
                   OnEventDelete="DayPilotCalendar1_EventDelete"
                   EventDeleteJavaScript="if (confirm('确定删除此事件吗 Are you sure to delete?')) dpc1.eventDeleteCallBack(e);" 
                   
                   RecurrentEventImage="style/Media/recur10x9.png"
                    
                   RecurrentEventExceptionImage="style/Media/recurex10x9.png" 
                   Onbeforeeventrender="DayPilotCalendar1_BeforeEventRender" 
                   OnCommand="DayPilotCalendar1_Command"
       
                   DurationBarVisible="False" 
                   ShowEventStartEnd="False"
                   OnBeforeHeaderRender="DayPilotCalendar1_BeforeHeaderRender" 
         
                     
                    >


    </daypilot:daypilotcalendar>
            
   



   
    <DayPilot:DayPilotMenu ID="DayPilotMenuSelection" runat="server" CssClassPrefix="menu_">
        <DayPilot:MenuItem Action="JavaScript"     JavaScript="createEvent(e.start, e.end,e.resource,1);"    Text="快速预定" />
        <DayPilot:MenuItem Action="JavaScript"     JavaScript="createEvent(e.start, e.end,e.resource,2);"    Text="常规预定" />
    </DayPilot:DayPilotMenu>

                   

              </td>
          </tr>

      </table>       
          

          
        




 
 
 

  
     





        </ContentTemplate>

    </asp:UpdatePanel>
   



      <script>
          function _open(e) {
              id = e.text().split(',')[1].split(']')[0].replace("ID", "");
              var newTab = window.open("details.aspx?id=" +id);
              isBad = newTab;
              if (!isBad)
              {
                  alert("浏览器屏蔽了弹窗功能，请开启");
              }
             
          }




    </script>

            
</asp:Content>
