Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function showCalendar() {
- dojo.require("dojo.dnd.move");
- dojo.require("dojox.layout.FloatingPane");
- require([
- 'dojox/calendar/Calendar',
- 'dojox/calendar/CalendarBase',
- 'dojo/store/Memory',
- 'dojo/store/Observable',
- 'dojo/when',
- 'dojo/parser',
- 'dojo/domReady!'],
- function(Calendar, CalendarBase, Memory, Observable, when) {
- var divA = document.getElementById('rcg');
- divA.style.display = 'block';
- divA.style.visibility = 'visible';
- document.body.appendChild(divA);
- var ParentConstrainedFloatingPane = dojo.declare(dojox.layout.FloatingPane, {
- postCreate: function () {
- this.close = function () {
- this.domNode.style.display = "none";
- this.domNode.style.visibility = "hidden";
- };
- this.inherited(arguments);
- this.moveable = new dojo.dnd.move.parentConstrainedMoveable(
- this.domNode, {
- handle: this.focusNode,
- area: "content",
- within: true
- }
- );
- }
- });
- var BoxConstrainedFloatingPane = dojo.declare(dojox.layout.FloatingPane, {
- postCreate: function() {
- this.inherited(arguments);
- this.moveable = new dojo.dnd.move.boxConstrainedMoveable(
- this.domNode, {
- handle: this.focusNode,
- box: { l: 0, t: 0, w: 0, h: 0 },
- within: false
- }
- );
- }
- });
- var ConstrainedFloatingPane = dojo.declare(dojox.layout.FloatingPane, {
- postCreate: function() {
- this.inherited(arguments);
- this.close = function () {
- this.domNode.style.display = "none";
- this.domNode.style.visibility = "hidden";
- };
- this.moveable = new dojo.dnd.move.constrainedMoveable(
- this.domNode, {
- handle: this.focusNode,
- constraints: function() {
- var coordsBody = dojo.coords(dojo.body());
- // or
- var coordsWindow = {
- l: 0,
- t: 0,
- w: window.innerWidth,
- h: window.innerHeight
- };
- return coordsWindow;
- },
- within: true
- }
- );
- }
- });
- var fpaner = new ParentConstrainedFloatingPane({
- title: "Koledar",
- resizable: true,
- maxable: true,
- dockable: true,
- closable: true,
- //constrainToContainer: true,
- style: "position:absolute;top:110px;left:335px;width:700px;height:650px;"
- }, "rcg");
- var someData = [
- {
- id: 0,
- summary: "Event 1",
- startTime: new Date(2013, 5, 17, 10),
- endTime: new Date(2013, 5, 17, 12),
- calendar: "Calendar1"
- },
- {
- id: 1,
- summary: "Event 2",
- startTime: new Date(2013, 5, 17, 14),
- endTime: new Date(2013, 5, 17, 15),
- calendar: "Calendar2"
- }
- ];
- var someData2 = [
- {
- id: 30,
- summary: "Event 3",
- startTime: new Date(2013, 6, 29, 10),
- endTime: new Date(2013, 6, 29, 12),
- calendar: "Calendar1"
- },
- {
- id: 40,
- summary: "Event 4",
- startTime: new Date(2013, 6, 27, 14),
- endTime: new Date(2013, 6, 27, 15),
- calendar: "Calendar2"
- }
- ];
- var calendar = new Calendar({
- date: new Date(2013, 5, 17),
- dateInterval: "month",
- columnViewProps: { minHours: 0, maxHours: 24 },
- style: "position:relative;height:100%"
- });
- calendar.on("timeIntervalChange", function(e) {
- var YYYY = e.startTime;
- var MM = e.startTime.getMonth() + 1;
- var DD = e.startTime.getDay();
- var YYYYend = e.endTime.getFullYear();
- var MMend = e.endTime.getMonth() + 1;
- var DDend = e.startTime.getDay();
- if (MM < 10)
- { MM = '0' + MM };
- if (MMend < 10)
- { MMend = '0' + MMend };
- if (MM == "06") {
- calendar.set('store', new Observable(new Memory({ data: someData })));
- }
- else if (MM == "07") {
- calendar.set('store', new Observable(new Memory({ data: someData2 })));
- }
- });
- calendar.placeAt(fpaner);
- fpaner.startup();
- fpaner.show();
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement