diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f2c9190 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +node_modules/ +.DS_Store +npm-debug.log \ No newline at end of file diff --git a/CalenStyleJsonGenerator/.jshintrc b/CalenStyleJsonGenerator/.jshintrc new file mode 100644 index 0000000..9b52704 --- /dev/null +++ b/CalenStyleJsonGenerator/.jshintrc @@ -0,0 +1,128 @@ +{ + // -------------------------------------------------------------------- + // JSHint Nodeclipse Configuration v0.15.1 + // Strict Edition with some relaxations and switch to Node.js, no `use strict` + // by Ory Band, Michael Haschke, Paul Verest + // https://github.com/Nodeclipse/nodeclipse-1/blob/master/org.nodeclipse.ui/templates/common-templates/.jshintrc + // JSHint Documentation is at http://www.jshint.com/docs/options/ + // JSHint Integration v0.9.9 comes with JSHInt 2.1.10 , see https://github.com/eclipsesource/jshint-eclipse + // Known issues: + // newer JSHint can't be used https://github.com/eclipsesource/jshint-eclipse/issues/75 that depends on JSHint issues. + // -------------------------------------------------------------------- + // from https://gist.github.com/haschek/2595796 + // + // @author http://michael.haschke.biz/ + // @license http://unlicense.org/ + // + // This is a options template for [JSHint][1], using [JSHint example][2] + // and [Ory Band's example][3] as basis and setting config values to + // be most strict: + // + // * set all enforcing options to true + // * set all relaxing options to false + // * set all environment options to false, except the node value + // * set all JSLint legacy options to false + // + // [1]: http://www.jshint.com/ + // [2]: https://github.com/jshint/node-jshint/blob/master/example/config.json //404 + // [3]: https://github.com/oryband/dotfiles/blob/master/jshintrc //404 + // [4]: http://www.jshint.com/options/ + + // == Enforcing Options =============================================== + // + // These options tell JSHint to be more strict towards your code. Use + // them if you want to allow only a safe subset of JavaScript, very + // useful when your codebase is shared with a big number of developers + // with different skill levels. Was all true. + + "bitwise" : true, // Prohibit bitwise operators (&, |, ^, etc.). + "curly" : true, // Require {} for every new block or scope. + "eqeqeq" : true, // Require triple equals i.e. `===`. + "forin" : true, // Tolerate `for in` loops without `hasOwnPrototype`. + "immed" : true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );` + "latedef" : true, // Prohibit variable use before definition. + "newcap" : true, // Require capitalization of all constructor functions e.g. `new F()`. + "noarg" : true, // Prohibit use of `arguments.caller` and `arguments.callee`. + "noempty" : true, // Prohibit use of empty blocks. + "nonew" : true, // Prohibit use of constructors for side-effects. + "plusplus" : false, // Prohibit use of `++` & `--`. //coding style related only + "regexp" : true, // Prohibit `.` and `[^...]` in regular expressions. + "undef" : true, // Require all non-global variables be declared before they are used. + "strict" : false, // Require `use strict` pragma in every file. + "trailing" : true, // Prohibit trailing whitespaces. + + // == Relaxing Options ================================================ + // + // These options allow you to suppress certain types of warnings. Use + // them only if you are absolutely positive that you know what you are + // doing. Was all false. + "asi" : false, // Tolerate Automatic Semicolon Insertion (no semicolons). + "boss" : false, // Tolerate assignments inside if, for & while. Usually conditions & loops are for comparison, not assignments. + "debug" : false, // Allow debugger statements e.g. browser breakpoints. + "eqnull" : false, // Tolerate use of `== null`. + "es5" : true, // Allow EcmaScript 5 syntax. // es5 is default https://github.com/jshint/jshint/issues/1411 + "esnext" : false, // Allow ES.next (ECMAScript 6) specific features such as `const` and `let`. + "evil" : false, // Tolerate use of `eval`. + "expr" : false, // Tolerate `ExpressionStatement` as Programs. + "funcscope" : false, // Tolerate declarations of variables inside of control structures while accessing them later from the outside. + "globalstrict" : false, // Allow global "use strict" (also enables 'strict'). + "iterator" : false, // Allow usage of __iterator__ property. + "lastsemic" : false, // Tolerat missing semicolons when the it is omitted for the last statement in a one-line block. + "laxbreak" : false, // Tolerate unsafe line breaks e.g. `return [\n] x` without semicolons. + "laxcomma" : true, // Suppress warnings about comma-first coding style. + "loopfunc" : false, // Allow functions to be defined within loops. + "maxerr" : 100, // This options allows you to set the maximum amount of warnings JSHint will produce before giving up. Default is 50. + "moz" : false, // This options tells JSHint that your code uses Mozilla JavaScript extensions. Unless you develop specifically for the Firefox web browser you don't need this option. + "multistr" : false, // Tolerate multi-line strings. + "onecase" : false, // Tolerate switches with just one case. + "proto" : false, // Tolerate __proto__ property. This property is deprecated. + "regexdash" : false, // Tolerate unescaped last dash i.e. `[-...]`. + "scripturl" : false, // Tolerate script-targeted URLs. + "smarttabs" : false, // Tolerate mixed tabs and spaces when the latter are used for alignmnent only. + "shadow" : false, // Allows re-define variables later in code e.g. `var x=1; x=2;`. + "sub" : false, // Tolerate all forms of subscript notation besides dot notation e.g. `dict['key']` instead of `dict.key`. + "supernew" : false, // Tolerate `new function () { ... };` and `new Object;`. + "validthis" : false, // Tolerate strict violations when the code is running in strict mode and you use this in a non-constructor function. + + // == Environments ==================================================== + // + // These options pre-define global variables that are exposed by + // popular JavaScript libraries and runtime environments—such as + // browser or node.js. TODO JSHint Documentation has more, but it is not clear since what JSHint version they appeared + "browser" : false, // Standard browser globals e.g. `window`, `document`. + "couch" : false, // Enable globals exposed by CouchDB. + "devel" : false, // Allow development statements e.g. `console.log();`. + "dojo" : false, // Enable globals exposed by Dojo Toolkit. + "jquery" : false, // Enable globals exposed by jQuery JavaScript library. + "mootools" : false, // Enable globals exposed by MooTools JavaScript framework. + "node" : true, // Enable globals available when code is running inside of the NodeJS runtime environment. + "nonstandard" : false, // Define non-standard but widely adopted globals such as escape and unescape. + "phantom" : false, //?since version? This option defines globals available when your core is running inside of the PhantomJS runtime environment. + "prototypejs" : false, // Enable globals exposed by Prototype JavaScript framework. + "rhino" : false, // Enable globals available when your code is running inside of the Rhino runtime environment. + "worker" : false, //?since version? This option defines globals available when your code is running inside of a Web Worker. + "wsh" : false, // Enable globals available when your code is running as a script for the Windows Script Host. + "yui" : false, //?since version? This option defines globals exposed by the YUI JavaScript framework. + + // == JSLint Legacy =================================================== + // + // These options are legacy from JSLint. Aside from bug fixes they will + // not be improved in any way and might be removed at any point. + "nomen" : false, // Prohibit use of initial or trailing underbars in names. + "onevar" : false, // Allow only one `var` statement per function. + "passfail" : false, // Stop on first error. + "white" : false, // Check against strict whitespace and indentation rules. + + // == Undocumented Options ============================================ + // + // While Michael have found these options in [example1][2] and [example2][3] (already gone 404) + // they are not described in the [JSHint Options documentation][4]. + + "predef" : [ // Extra globals. + //"exampleVar", + //"anotherCoolGlobal", + //"iLoveDouglas" + "Java", "JavaFX", "$ARG" //no effect + ] + //, "indent" : 2 // Specify indentation spacing +} diff --git a/CalenStyleJsonGenerator/.project b/CalenStyleJsonGenerator/.project new file mode 100644 index 0000000..abcc7b3 --- /dev/null +++ b/CalenStyleJsonGenerator/.project @@ -0,0 +1,24 @@ + + + CalenStyleJsonGenerator + + + + + + tern.eclipse.ide.core.ternBuilder + + + + + com.eclipsesource.jshint.ui.builder + + + + + + org.nodeclipse.ui.NodeNature + org.eclipse.wst.jsdt.core.jsNature + tern.eclipse.ide.core.ternnature + + diff --git a/CalenStyleJsonGenerator/.settings/.jsdtscope b/CalenStyleJsonGenerator/.settings/.jsdtscope new file mode 100644 index 0000000..01deca6 --- /dev/null +++ b/CalenStyleJsonGenerator/.settings/.jsdtscope @@ -0,0 +1,7 @@ + + + + + + + diff --git a/CalenStyleJsonGenerator/.settings/com.eclipsesource.jshint.ui.prefs b/CalenStyleJsonGenerator/.settings/com.eclipsesource.jshint.ui.prefs new file mode 100644 index 0000000..8cf3f3f --- /dev/null +++ b/CalenStyleJsonGenerator/.settings/com.eclipsesource.jshint.ui.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +excluded=//*.json\:bower_components//*\:node_lib//*\:node_modules//* +included=//*.jjs\://*.js\://*.jshintrc\://*.mjs\://*.njs\://*.pjs\://*.vjs +projectSpecificOptions=true diff --git a/CalenStyleJsonGenerator/.settings/org.eclipse.wst.jsdt.core.prefs b/CalenStyleJsonGenerator/.settings/org.eclipse.wst.jsdt.core.prefs new file mode 100644 index 0000000..feebde5 --- /dev/null +++ b/CalenStyleJsonGenerator/.settings/org.eclipse.wst.jsdt.core.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +semanticValidation=disabled diff --git a/CalenStyleJsonGenerator/.settings/org.eclipse.wst.jsdt.ui.superType.container b/CalenStyleJsonGenerator/.settings/org.eclipse.wst.jsdt.ui.superType.container new file mode 100644 index 0000000..49c8cd4 --- /dev/null +++ b/CalenStyleJsonGenerator/.settings/org.eclipse.wst.jsdt.ui.superType.container @@ -0,0 +1 @@ +org.eclipse.wst.jsdt.launching.JRE_CONTAINER \ No newline at end of file diff --git a/CalenStyleJsonGenerator/.settings/org.eclipse.wst.jsdt.ui.superType.name b/CalenStyleJsonGenerator/.settings/org.eclipse.wst.jsdt.ui.superType.name new file mode 100644 index 0000000..11006e2 --- /dev/null +++ b/CalenStyleJsonGenerator/.settings/org.eclipse.wst.jsdt.ui.superType.name @@ -0,0 +1 @@ +Global \ No newline at end of file diff --git a/CalenStyleJsonGenerator/.tern-project b/CalenStyleJsonGenerator/.tern-project new file mode 100644 index 0000000..d3bbad0 --- /dev/null +++ b/CalenStyleJsonGenerator/.tern-project @@ -0,0 +1 @@ +{"libs":["ecma5"],"plugins":{"node":{}},"ide":{}} \ No newline at end of file diff --git a/CalenStyleJsonGenerator/README.md b/CalenStyleJsonGenerator/README.md new file mode 100644 index 0000000..2c91083 --- /dev/null +++ b/CalenStyleJsonGenerator/README.md @@ -0,0 +1,109 @@ + + +# CalenStyleJsonGenerator + +In distribution folder, CalJsonGenerator.js file contains code to generate data needed to supply to CalenStyle. +Sometimes, this process of generating data on frontend itself may result in degraded performance of Calenstyle View. To tackle this problem CalenStyleJsonGenerator is provided. +CalenStyleJsonGenerator can be used to generate data(events, appointments) needed to supply to CalenStyle. + +## Usage + +# Start Node Server "CalenStyleJsonGenerator" + +1. Make sure that node.js is installed. +2. Change directory to path of CalenStyleJsonGenerator + (for example, cd "/Volumes/MyVolume1/CalenStyleJsonGenerator") +3. Run command "node app.js" + +After running this, you can see "Express server listening on port 3000" + +# Use Request Data on "CalenStyleJsonGenerator" + +1. Find your IP address/ Localhost IP address + For example, http://192.168.1.4 + + Mac : http://osxdaily.com/2010/11/21/find-ip-address-mac/ + + +2. Append port number on which node server is listening to localhost address + For example, http://192.168.1.4:3000 + + +3. Events + + Append "events" + For example, http://192.168.1.4:3000/events + + calDataSource: + [ + { + sourceFetchType: "DateRange", + sourceType: "URL", + source: "http://192.168.1.4:3000/events" + } + ] + + +4. Appointments + + Append "slotavailability" + For example, http://192.168.1.4:3000/slotavailability + + calDataSource: + [ + { + sourceFetchType: "DateRange", + sourceType: "URL", + source: "http://192.168.1.4:3000/slotavailability" + } + ] + + +5. Calendar + + Append "eventcalendar" + For example, http://192.168.1.4:3000/eventcalendar + + +6. Event or Task Status + + Append "eventortaskstatus" + For example, http://192.168.1.4:3000/eventortaskstatus + + +7. Blocked Times + + Append "blockedtimes" + For example, http://192.168.1.4:3000/blockedtimes + +8. Filter Criteria + + Append "filtercriteria" + For example, http://192.168.1.4:3000/filtercriteria + + +9. Multiple Sources + + Append "misc?types=events,eventcalendar,eventortaskstatus" + For example, http://192.168.1.4:3000/misc?types=events,eventcalendar,eventortaskstatus + + calDataSource: + [ + { + sourceFetchType: "DateRange", + sourceType: "URL", + source: "http://192.168.1.4:3000/misc?types=events,eventcalendar,eventortaskstatus" + } + ] + + +## Developing + + + +### Tools + +Created with [Nodeclipse](https://github.com/Nodeclipse/nodeclipse-1) + ([Eclipse Marketplace](http://marketplace.eclipse.org/content/nodeclipse), [site](http://www.nodeclipse.org)) + +Nodeclipse is free open-source project that grows with your contributions. diff --git a/CalenStyleJsonGenerator/app.js b/CalenStyleJsonGenerator/app.js new file mode 100644 index 0000000..179ec1c --- /dev/null +++ b/CalenStyleJsonGenerator/app.js @@ -0,0 +1,51 @@ + +/** + * Module dependencies. + */ + +var express = require('express') + , routes = require('./routes') + , user = require('./routes/user') + , http = require('http') + , path = require('path'); + +var app = express(); + +// all environments +app.set('port', process.env.PORT || 3000); +app.set('views', __dirname + '/views'); +app.set('view engine', 'ejs'); +app.use(express.favicon()); +app.use(express.logger('dev')); +app.use(express.bodyParser()); +app.use(express.methodOverride()); +app.use(app.router); +app.use(express.static(path.join(__dirname, 'public'))); + +app.all('*', function(req, res, next) { + res.header("Access-Control-Allow-Origin", "*");// restrict it to the required domain + res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS'); + // Set custom headers for CORS + res.header('Access-Control-Allow-Headers', 'Content-type,Accept,X-Access-Token,X-Key'); + next(); +}); + +// development only +if ('development' === app.get('env')) +{ + app.use(express.errorHandler()); +} +app.get('/',function(req,res){ + res.json('hello'); +}); +app.get('/events', routes.events); +app.get('/eventcalender', routes.eventcalender); +app.get('/eventcount', routes.eventcount); +app.get('/timeslotcount', routes.timeslotcount); +app.get('/slotavailability', routes.slotavailability); +app.get('/filtercriteria', routes.filtercriteria); +app.get('/misc', routes.misc); + +http.createServer(app).listen(app.get('port'), function(){ + console.log('Express server listening on port ' + app.get('port')); +}); diff --git a/CalenStyleJsonGenerator/package.json b/CalenStyleJsonGenerator/package.json new file mode 100644 index 0000000..113b82f --- /dev/null +++ b/CalenStyleJsonGenerator/package.json @@ -0,0 +1,12 @@ +{ + "name": "CalenStyleJsonGenerator", + "version": "0.0.1", + "private": true, + "scripts": { + "start": "node app.js" + }, + "dependencies": { + "express": "3.2.6", + "ejs": "*" + } +} diff --git a/CalenStyleJsonGenerator/public/stylesheets/style.css b/CalenStyleJsonGenerator/public/stylesheets/style.css new file mode 100644 index 0000000..30e047d --- /dev/null +++ b/CalenStyleJsonGenerator/public/stylesheets/style.css @@ -0,0 +1,8 @@ +body { + padding: 50px; + font: 14px "Lucida Grande", Helvetica, Arial, sans-serif; +} + +a { + color: #00B7FF; +} \ No newline at end of file diff --git a/CalenStyleJsonGenerator/routes/index.js b/CalenStyleJsonGenerator/routes/index.js new file mode 100644 index 0000000..f5ee08d --- /dev/null +++ b/CalenStyleJsonGenerator/routes/index.js @@ -0,0 +1,1841 @@ + +/* + * GET home page. + */ + +exports.events = function(req, res) +{ + var dFromDate = new Date(req.query.startdatetime); + var dToDate = new Date(req.query.enddatetime); + //console.log("dFromDate : "+dFromDate + " "+ " & dToDate : "+dToDate); + var sResult = generateJsonEvents(dFromDate, dToDate); + //console.log("sResult : "+sResult); + res.json(sResult); +}; + +exports.eventcalender = function(req, res) +{ + var dFromDate = new Date(req.query.startdatetime); + var dToDate = new Date(req.query.enddatetime); + //console.log("dFromDate : "+dFromDate + " "+ " & dToDate : "+dToDate); + var sResult = getEventCalendarList(dFromDate, dToDate); + //console.log("sResult : "+sResult); + res.json(sResult); +}; + +exports.eventcount = function(req, res) +{ + var dFromDate = new Date(req.query.startdatetime); + var dToDate = new Date(req.query.enddatetime); + //console.log("dFromDate : "+dFromDate + " "+ " & dToDate : "+dToDate); + var sResult = getJsonEventCount(dFromDate, dToDate); + //console.log("sResult : "+sResult); + res.json(sResult); +}; + +exports.timeslotcount = function(req, res) +{ + var dFromDate = new Date(req.query.startdatetime); + var dToDate = new Date(req.query.enddatetime); + var bIsFree = (req.query.isfree === "true"); + //console.log("dFromDate : "+dFromDate + " "+ " & dToDate : "+dToDate + " & bIsFree : " + bIsFree); + var sResult = getJsonTimeSlotCount(dFromDate, dToDate, bIsFree); + //console.log("sResult : "+sResult); + res.json(sResult); +}; + +exports.slotavailability = function(req, res) +{ + var dFromDate = new Date(req.query.startdatetime); + var dToDate = new Date(req.query.enddatetime); + //console.log("dFromDate : "+dFromDate + " "+ " & dToDate : "+dToDate); + var sResult = generateJsonSlotAvailability(dFromDate, dToDate); + //console.log("sResult : "+sResult); + res.json(sResult); +}; + +exports.filtercriteria = function(req, res) +{ + var bIsFilled = (req.query.isfilled === "true"); + //console.log("bIsFilled : "+bIsFilled); + var sResult = setEventFilterCriteriaArray(bIsFilled); + //console.log("sResult : "+sResult); + res.json(sResult); +}; + +exports.misc = function(req, res) +{ + var dFromDate = new Date(req.query.startdatetime); + var dToDate = new Date(req.query.enddatetime); + var bIsFree = false; + var sTypes = req.query.types; + var sArrTypes = sTypes.split(","); + console.log("dFromDate : " + dFromDate + " & dToDate : " + dToDate + " & bIsFree : " + bIsFree); + console.log("Types : " + sTypes); + console.log(sArrTypes); + + var oArrJson = {}; + var sResult = "", oResult = {}; + for(var iTempIndex = 0; iTempIndex < sArrTypes.length; iTempIndex++) + { + var sType = sArrTypes[iTempIndex]; + if(sType === "events") + { + sResult = generateJsonEvents(dFromDate, dToDate); + oResult = JSON.parse(sResult); + oArrJson.eventSource = oResult.eventSource; + } + else if(sType === "eventcalendar") + { + sResult = getEventCalendarList(dFromDate, dToDate); + oResult = JSON.parse(sResult); + oArrJson.eventCalendarSource = oResult.eventCalendarSource; + } + else if(sType === "eventcount") + { + sResult = getJsonEventCount(dFromDate, dToDate); + oResult = JSON.parse(sResult); + oArrJson.sourceCount = oResult.sourceCount; + } + else if(sType === "timeslotcount") + { + bIsFree = (req.query.isfree === "true"); + sResult = getJsonTimeSlotCount(dFromDate, dToDate, bIsFree); + oResult = JSON.parse(sResult); + oArrJson.sourceCount = oResult.sourceCount; + } + else if(sType === "slotavailability") + { + sResult = generateJsonSlotAvailability(dFromDate, dToDate); + oResult = JSON.parse(sResult); + oArrJson.slotAvailabilitySource = oResult.slotAvailabilitySource; + } + else if(sType === "filtercriteria") + { + bIsFree = (req.query.isfree === "true"); + sResult = setEventFilterCriteriaArray(bIsFree); + oResult = JSON.parse(sResult); + oArrJson.filtercriteria = oResult.filtercriteria; + } + } + sResult = JSON.stringify(oArrJson); + + res.json(sResult); +}; + + +/* ---------------------------- CalJsonGenerator Start ------------------------------------------ */ + +var bShowMore = true; +var iUnitTimeIntervalCJG = 20; +var iMS = { m: 6E4, h: 36E5, d: 864E5, w: 6048E5 }; + +var sDateTimeSeparatorCJG = " "; +var sDateSeparatorCJG = "-"; +var sTimeSeparatorCJG = ":"; + +var sHourFormatCJG = "24-Hour"; +var sArrTimeCJG; +var sArrEventCalendarCJG; +var sURLCJG = ""; // "http://www.google.com/"; +var sDescCJG = ""; + +var sArrDayNameShort = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; +var sArrDayNameFull = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; + +var sArrTags = ["Tag1", "Tag2", "Tag3"]; +var sArrUsers = ["Person1", "Person2", "Person3"]; +var sArrEventStatus = ["Scheduled", "Postponed", "Cancelled", "Attended"]; +var iArrTimeDurations = [10, 20, 30, 60]; +var dToday = new Date(); + +/* ---------------------------- Event Prototype Start ------------------------------------------ */ + + +function CalEvent(ceIdentifier, ceAllDay, ceStartDate, ceEndDate, ceType, ceTitle, ceDescription, ceUrl) +{ + this.id = ceIdentifier; + this.isAllDay = ceAllDay; + this.start = ceStartDate; + this.end = ceEndDate; + this.type = ceType; + this.title = ceTitle; + this.desc = ceDescription; + this.url = ceUrl; +} + +CalEvent.prototype ={ + + constructor : CalEvent + + }; + + +/* ---------------------------- Event Prototype End -------------------------------------------- */ + + +Array.prototype.random = function (length) +{ + return this[Math.floor((Math.random() * length))]; +}; + + +/* ---------------------------- Event Json Generation Start --------------------------------- */ + + +function getEventCalendarsArray() +{ + var sArrEventCalendar = []; + sArrEventCalendar = ["Fitness", "Birthday", "Personal", "Entertainment", "Work"]; + return sArrEventCalendar; +} + +sArrEventCalendarCJG = getEventCalendarsArray(); + +function getEventCalendarColors(sEventCalendar) +{ + var sEventCalendarColor = ""; + + if(sEventCalendar === "Fitness") + { + sEventCalendarColor = "16A085"; + } + else if(sEventCalendar === "Birthday") + { + sEventCalendarColor = "D35400"; + } + else if(sEventCalendar === "Personal") + { + sEventCalendarColor = "D2527F"; + } + else if(sEventCalendar === "Entertainment") + { + sEventCalendarColor = "3498DB"; + } + else if(sEventCalendar === "Work") + { + sEventCalendarColor = "8E44AD"; + } + + return sEventCalendarColor; +} + +function getDaysArray(iNumberOfDays) +{ + var sArrDays = []; + + for(var iDay = 1; iDay <= iNumberOfDays; iDay++) + { + var sDay = ""; + if(iDay > 9){ + sDay = iDay; + } + else{ + sDay = "0" + iDay; + } + sArrDays.push(sDay); + } + + return sArrDays; +} + +function getTimeArray(sHourFormatCJG, sTimeSeparatorCJG) +{ + var sArrTimeCJG = []; + var iMaxHour; + + if(sHourFormatCJG === "24-Hour"){ + iMaxHour = 24; + } + else if(sHourFormatCJG === "12-Hour"){ + iMaxHour = 12; + } + + for(var iHour = 0; iHour < 24; iHour++) + { + var sTime1, sTime2; + + if(iHour < 10) + { + sTime1 = "0" + iHour + sTimeSeparatorCJG + "00"; + sTime2 = "0" + iHour + sTimeSeparatorCJG + "30"; + } + else + { + sTime1 = iHour + sTimeSeparatorCJG + "00"; + sTime2 = iHour + sTimeSeparatorCJG + "30"; + } + + if(iMaxHour === 12) + { + if(iHour < 12) + { + sTime1 += " AM"; + sTime2 += " AM"; + } + else + { + sTime1 += " PM"; + sTime2 += " PM"; + } + } + + sArrTimeCJG.push(sTime1); + sArrTimeCJG.push(sTime2); + } + + return sArrTimeCJG; +} + +sArrTimeCJG = getTimeArray("24-Hour", sTimeSeparatorCJG); + +function getTimeString(sHourFormatCJG, sTimeSeparatorCJG, iHourValue, iMinuteValue) +{ + var sTimeString = ""; + + if(sHourFormatCJG === "12-Hour") + { + if(iHourValue > 12) + { + iHourValue -= 12; + } + } + + if(iHourValue > 9) + { + sTimeString = iHourValue + sTimeSeparatorCJG + iMinuteValue; + } + else + { + sTimeString = "0" + iHourValue + sTimeSeparatorCJG + iMinuteValue; + } + + if(sHourFormatCJG === "12-Hour") + { + if(iHourValue < 12) + { + sTimeString += " AM"; + } + else + { + sTimeString += " PM"; + } + } + + return sTimeString; +} + +function compareDates(dTempDate1, dTempDate2) +{ + dTempDate1 = new Date(dTempDate1.getFullYear(), dTempDate1.getMonth(), dTempDate1.getDate(), 0, 0, 0, 0); + dTempDate2 = new Date(dTempDate2.getFullYear(), dTempDate2.getMonth(), dTempDate2.getDate(), 0, 0, 0, 0); + var iDateDiff = Math.floor((dTempDate1.getTime() - dTempDate2.getTime())/iMS.d); + return (iDateDiff === 0) ? iDateDiff: (iDateDiff/Math.abs(iDateDiff)); +} + +function compareDateTimes(dTempDate1, dTempDate2) +{ + var iDateTimeDiff = (dTempDate1.getTime() - dTempDate2.getTime())/iMS.m; + return (iDateTimeDiff === 0) ? iDateTimeDiff: (iDateTimeDiff/Math.abs(iDateTimeDiff)); +} + +var oEventsTemplate = +[ + //--------------------------------- Birthdays ------------------------------------------------------ + + { + "type": "Birthday", + "date": 15, + "month": 0, + "title": "Ted's Birthday", + "tagIndex": 1 + }, + { + "type": "Birthday", + "date": 23, + "month": 0, + "title": "Remi's Birthday", + "tagIndex": 2 + }, + { + "type": "Birthday", + "date": 2, + "month": 1, + "title": "Mili's Birthday", + "tagIndex": 3 + }, + { + "type": "Birthday", + "date": 17, + "month": 1, + "title": "Alice's Birthday", + "tagIndex": 4 + }, + { + "type": "Birthday", + "date": 12, + "month": 2, + "title": "Saara's Birthday", + "tagIndex": 5 + }, + { + "type": "Birthday", + "date": 30, + "month": 2, + "title": "Jack's Birthday", + "tagIndex": 6 + }, + { + "type": "Birthday", + "date": 7, + "month": 3, + "title": "Meet's Birthday", + "tagIndex": 7 + }, + { + "type": "Birthday", + "date": 19, + "month": 3, + "title": "Stuart's Birthday", + "tagIndex": 8 + }, + { + "type": "Birthday", + "date": 6, + "month": 4, + "title": "Ana's Birthday", + "tagIndex": 9 + }, + { + "type": "Birthday", + "date": 25, + "month": 4, + "title": "Paulin's Birthday", + "tagIndex": 10 + }, + { + "type": "Birthday", + "date": 8, + "month": 5, + "title": "Matt's Birthday", + "tagIndex": 11 + }, + { + "type": "Birthday", + "date": 23, + "month": 5, + "title": "Purva's Birthday", + "tagIndex": 12 + }, + { + "type": "Birthday", + "date": 6, + "month": 6, + "title": "Penny's Birthday", + "tagIndex": 13 + }, + { + "type": "Birthday", + "date": 17, + "month": 6, + "title": "Sam's Birthday", + "tagIndex": 14 + }, + { + "type": "Birthday", + "date": 2, + "month": 7, + "title": "Mac's Birthday", + "tagIndex": 15 + }, + { + "type": "Birthday", + "date": 26, + "month": 7, + "title": "Sandra's Birthday", + "tagIndex": 16 + }, + { + "type": "Birthday", + "date": 3, + "month": 8, + "title": "Nia's Birthday", + "tagIndex": 17 + }, + { + "type": "Birthday", + "date": 13, + "month": 8, + "title": "Merlin's Birthday", + "tagIndex": 18 + }, + { + "type": "Birthday", + "date": 31, + "month": 9, + "title": "Kelly's Birthday", + "tagIndex": 19 + }, + { + "type": "Birthday", + "date": 14, + "month": 9, + "title": "Phil's Birthday", + "tagIndex": 20 + }, + { + "type": "Birthday", + "date": 4, + "month": 10, + "title": "Dinky's Birthday", + "tagIndex": 21 + }, + { + "type": "Birthday", + "date": 21, + "month": 10, + "title": "Gary's Birthday", + "tagIndex": 22 + }, + { + "type": "Birthday", + "date": 7, + "month": 11, + "title": "Liley's Birthday", + "tagIndex": 23 + }, + { + "type": "Birthday", + "date": 29, + "month": 11, + "title": "Diana's Birthday", + "tagIndex": 24 + }, + + //-------------------------------- Exercise ----------------------------------------- + + { + "type": "Cycling", + "title": "Cycling", + "day": ["Monday", "Wednesday", "Friday"], + "startTime": 6, + "endTime": 7, + "tagIndex": 25 + }, + + { + "type": "Running", + "title": "Running", + "day": ["Tuesday", "Thursday"], + "startTime": 6, + "endTime": 7, + "tagIndex": 26 + }, + + { + "type": "Swimming", + "title": "Swimming", + "day": ["Saturday"], + "startTime": 6, + "endTime": 7, + "tagIndex": 25 + }, + + { + "type": "Gym", + "title": "Gym", + "day": ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], + "startTime": 12, + "endTime": 13, + "tagIndex": 25 + }, + + { + "type": "Hiking", + "title": "Hiking", + "day": ["Saturday"], + "startTime": 17, + "endTime": 15, + "tagIndex": 26 + }, + + { + "type": "Movie", + "title": "Movie", + "day": ["Sunday"], + "startTime": 18, + "endTime": 20, + "tagIndex": 25 + }, + + { + "type": "RegularMeeting", + "title": "Meeting", + "day": ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"], + "startTime": 11, + "endTime": 12, + "tagIndex": 26 + }, + + { + "type": "ClientCall", + "title": "Client Call", + "day": ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"], + "startTime": 14, + "endTime": 15, + "tagIndex": 26 + }, + + { + "type": "RegularDinner", + "title": "Dinner", + "day": ["Sunday"], + "startTime": 21, + "endTime": 22, + "tagIndex": 26 + }, + + //---------------------------------- Coffee -------------------------------------------- + + { + "type": "Coffee", + "date": 3, + "month": 0, + "startTime": 17, + "endTime": 18, + "title": "Coffee with Victor", + "people": ["Victor"], + "tagIndex": 1 + }, + { + "type": "Coffee", + "date": 26, + "month": 1, + "startTime": 17, + "endTime": 18, + "title": "Coffee with Merlin", + "people": ["Merlin"], + "tagIndex": 3 + }, + { + "type": "Coffee", + "date": 16, + "month": 2, + "startTime": 17, + "endTime": 18, + "title": "Coffee with Kelvin", + "people": ["Kelvin"], + "tagIndex": 5 + }, + { + "type": "Coffee", + "date": 24, + "month": 3, + "startTime": 17, + "endTime": 18, + "title": "Coffee with Roger", + "people": ["Roger"], + "tagIndex": 7 + }, + { + "type": "Coffee", + "date": 9, + "month": 4, + "startTime": 17, + "endTime": 18, + "title": "Coffee with Agnes", + "people": ["Agnes"], + "tagIndex": 9 + }, + { + "type": "Coffee", + "date": 22, + "month": 5, + "startTime": 17, + "endTime": 18, + "title": "Coffee with Celine", + "people": ["Celine"], + "tagIndex": 11 + }, + { + "type": "Coffee", + "date": 9, + "month": 6, + "startTime": 17, + "endTime": 18, + "title": "Coffee with Dora", + "people": ["Dora"], + "tagIndex": 13 + }, + { + "type": "Coffee", + "date": 20, + "month": 7, + "startTime": 17, + "endTime": 18, + "title": "Coffee with Arnold", + "people": ["Arnold"], + "tagIndex": 15 + }, + { + "type": "Coffee", + "date": 16, + "month": 8, + "startTime": 17, + "endTime": 18, + "title": "Coffee with Edwin", + "people": ["Edwin"], + "tagIndex": 17 + }, + { + "type": "Coffee", + "date": 19, + "month": 9, + "startTime": 17, + "endTime": 18, + "title": "Coffee with Felicia", + "people": ["Felicia"], + "tagIndex": 19 + }, + { + "type": "Coffee", + "date": 14, + "month": 10, + "startTime": 17, + "endTime": 18, + "title": "Coffee with Jennifer", + "people": ["Jennifer"], + "tagIndex": 21 + }, + { + "type": "Coffee", + "date": 23, + "month": 11, + "startTime": 17, + "endTime": 18, + "title": "Coffee with Warren", + "people": ["Warren"], + "tagIndex": 23 + }, + + //--------------------------------- Lunch ---------------------------------------- + + { + "type": "Lunch", + "date": 27, + "month": 0, + "startTime": 12, + "endTime": 13, + "title": "Lunch with Victor", + "people": ["Victor"], + "tagIndex": 2 + }, + { + "type": "Lunch", + "date": 2, + "month": 1, + "startTime": 13, + "endTime": 14, + "title": "Lunch with Merlin", + "people": ["Merlin"], + "tagIndex": 4 + }, + { + "type": "Lunch", + "date": 5, + "month": 2, + "startTime": 12, + "endTime": 13, + "title": "Lunch with Kelvin", + "people": ["Kelvin"], + "tagIndex": 6 + }, + { + "type": "Lunch", + "date": 25, + "month": 3, + "startTime": 13, + "endTime": 14, + "title": "Lunch with Roger", + "people": ["Roger"], + "tagIndex": 8 + }, + { + "type": "Lunch", + "date": 23, + "month": 4, + "startTime": 12, + "endTime": 13, + "title": "Lunch with Agnes", + "people": ["Agnes"], + "tagIndex": 10 + }, + { + "type": "Lunch", + "date": 7, + "month": 5, + "startTime": 13, + "endTime": 14, + "title": "Lunch with Celine", + "people": ["Celine"], + "tagIndex": 12 + }, + { + "type": "Lunch", + "date": 21, + "month": 6, + "startTime": 12, + "endTime": 13, + "title": "Lunch with Dora", + "people": ["Dora"], + "tagIndex": 14 + }, + { + "type": "Lunch", + "date": 10, + "month": 7, + "startTime": 13, + "endTime": 14, + "title": "Lunch with Arnold", + "people": ["Arnold"], + "tagIndex": 16 + }, + { + "type": "Lunch", + "date": 20, + "month": 8, + "startTime": 12, + "endTime": 13, + "title": "Lunch with Edwin", + "people": ["Edwin"], + "tagIndex": 18 + }, + { + "type": "Lunch", + "date": 14, + "month": 9, + "startTime": 13, + "endTime": 14, + "title": "Lunch with Felicia", + "people": ["Felicia"], + "tagIndex": 20 + }, + { + "type": "Lunch", + "date": 17, + "month": 10, + "startTime": 12, + "endTime": 13, + "title": "Lunch with Jennifer", + "people": ["Jennifer"], + "tagIndex": 22 + }, + { + "type": "Lunch", + "date": 13, + "month": 11, + "startTime": 13, + "endTime": 14, + "title": "Lunch with Warren", + "people": ["Warren"], + "tagIndex": 24 + }, + + //------------------------------ Dinner --------------------------------------------- + + { + "type": "Dinner", + "date": 15, + "month": 0, + "startTime": 21, + "endTime": 22, + "title": "Dinner with Kelvin", + "people": ["Kelvin"], + "tagIndex": 25 + }, + { + "type": "Dinner", + "date": 23, + "month": 1, + "startTime": 22, + "endTime": 23, + "title": "Dinner with Roger", + "people": ["Roger"], + "tagIndex": 25 + }, + { + "type": "Dinner", + "date": 21, + "month": 2, + "startTime": 21, + "endTime": 22, + "title": "Dinner with Victor", + "people": ["Victor"], + "tagIndex": 25 + }, + { + "type": "Dinner", + "date": 20, + "month": 3, + "startTime": 22, + "endTime": 23, + "title": "Dinner with Merlin", + "people": ["Merlin"], + "tagIndex": 25 + }, + { + "type": "Dinner", + "date": 2, + "month": 4, + "startTime": 21, + "endTime": 22, + "title": "Dinner with Dora", + "people": ["Dora"], + "tagIndex": 25 + }, + { + "type": "Dinner", + "date": 16, + "month": 5, + "startTime": 22, + "endTime": 23, + "title": "Dinner with Arnold", + "people": ["Arnold"], + "tagIndex": 25 + }, + { + "type": "Dinner", + "date": 26, + "month": 6, + "startTime": 21, + "endTime": 22, + "title": "Dinner with Agnes", + "people": ["Agnes"], + "tagIndex": 25 + }, + { + "type": "Dinner", + "date": 17, + "month": 7, + "startTime": 22, + "endTime": 23, + "title": "Dinner with Celine", + "people": ["Celine"], + "tagIndex": 25 + }, + { + "type": "Dinner", + "date": 12, + "month": 8, + "startTime": 21, + "endTime": 22, + "title": "Dinner with Jennifer", + "people": ["Jennifer"], + "tagIndex": 25 + }, + { + "type": "Dinner", + "date": 14, + "month": 9, + "startTime": 22, + "endTime": 23, + "title": "Dinner with Matt", + "people": ["Warren"], + "tagIndex": 25 + }, + { + "type": "Dinner", + "date": 3, + "month": 10, + "startTime": 21, + "endTime": 22, + "title": "Dinner with Edwin", + "people": ["Edwin"], + "tagIndex": 25 + }, + { + "type": "Dinner", + "date": 18, + "month": 11, + "startTime": 22, + "endTime": 23, + "title": "Dinner with Felicia", + "people": ["Felicia"], + "tagIndex": 25 + }, + + //------------------------------ Meeting with Colleagues ------------------------------------------ + + { + "type": "Meeting", + "date": 31, + "month": 0, + "startTime": 10, + "endTime": 12, + "title": "Meeting with Colleagues", + "people": ["Merlin", "Agnes", "Dora"], + "tagIndex": 26 + }, + { + "type": "Meeting", + "date": 28, + "month": 1, + "startTime": 10, + "endTime": 12, + "title": "Meeting with Colleagues", + "people": ["Merlin", "Agnes", "Dora"], + "tagIndex": 26 + }, + { + "type": "Meeting", + "date": 31, + "month": 2, + "startTime": 10, + "endTime": 12, + "title": "Meeting with Colleagues", + "people": ["Merlin", "Agnes", "Dora", "Edwin"], + "tagIndex": 26 + }, + { + "type": "Meeting", + "date": 30, + "month": 3, + "startTime": 10, + "endTime": 12, + "title": "Meeting with Colleagues", + "people": ["Merlin", "Agnes", "Dora", "Victor"], + "tagIndex": 26 + }, + { + "type": "Meeting", + "date": 31, + "month": 4, + "startTime": 10, + "endTime": 12, + "title": "Meeting with Colleagues", + "people": ["Merlin", "Agnes", "Dora", "Edwin"], + "tagIndex": 26 + }, + { + "type": "Meeting", + "date": 30, + "month": 5, + "startTime": 10, + "endTime": 12, + "title": "Meeting with Colleagues", + "people": ["Merlin", "Agnes", "Dora", "Victor"], + "tagIndex": 26 + }, + { + "type": "Meeting", + "date": 31, + "month": 6, + "startTime": 10, + "endTime": 12, + "title": "Meeting with Colleagues", + "people": ["Merlin", "Agnes", "Dora", "Edwin"], + "tagIndex": 26 + }, + { + "type": "Meeting", + "date": 31, + "month": 7, + "startTime": 10, + "endTime": 12, + "title": "Meeting with Colleagues", + "people": ["Merlin", "Agnes", "Dora", "Victor"], + "tagIndex": 26 + }, + { + "type": "Meeting", + "date": 30, + "month": 8, + "startTime": 10, + "endTime": 12, + "title": "Meeting with Colleagues", + "people": ["Merlin", "Agnes", "Dora", "Edwin"], + "tagIndex": 26 + }, + { + "type": "Meeting", + "date": 31, + "month": 9, + "startTime": 10, + "endTime": 12, + "title": "Meeting with Colleagues", + "people": ["Merlin", "Agnes", "Dora", "Victor"], + "tagIndex": 26 + }, + { + "type": "Meeting", + "date": 30, + "month": 10, + "startTime": 10, + "endTime": 12, + "title": "Meeting with Colleagues", + "people": ["Merlin", "Agnes", "Dora", "Edwin"], + "tagIndex": 26 + }, + { + "type": "Meeting", + "date": 31, + "month": 11, + "startTime": 10, + "endTime": 12, + "title": "Meeting with Colleagues", + "people": ["Merlin", "Agnes", "Dora", "Victor"], + "tagIndex": 26 + }, + + //------------------------------- Meeting --------------------------------------- + + { + "type": "Meeting", + "date": 5, + "month": 0, + "startTime": 17, + "endTime": 18, + "title": "Meeting with Sam", + "people": ["Sam"], + "tagIndex": 26 + }, + { + "type": "Meeting", + "date": 6, + "month": 1, + "startTime": 17, + "endTime": 18, + "title": "Meeting with Kelvin", + "people": ["Kelvin"], + "tagIndex": 26 + }, + { + "type": "Meeting", + "date": 7, + "month": 3, + "startTime": 17, + "endTime": 18, + "title": "Meeting with Matt", + "people": ["Matt"], + "tagIndex": 26 + }, + { + "type": "Meeting", + "date": 8, + "month": 4, + "startTime": 17, + "endTime": 18, + "title": "Meeting with Sandra", + "people": ["Sandra"], + "tagIndex": 26 + }, + { + "type": "Meeting", + "date": 9, + "month": 5, + "startTime": 17, + "endTime": 18, + "title": "Meeting with Celine", + "people": ["Celine"], + "tagIndex": 26 + }, + { + "type": "Meeting", + "date": 11, + "month": 6, + "startTime": 17, + "endTime": 18, + "title": "Meeting with Donna", + "people": ["Donna"], + "tagIndex": 26 + }, + { + "type": "Meeting", + "date": 12, + "month": 7, + "startTime": 17, + "endTime": 18, + "title": "Meeting with Arnold", + "people": ["Arnold"], + "tagIndex": 26 + }, + { + "type": "Meeting", + "date": 13, + "month": 8, + "startTime": 17, + "endTime": 18, + "title": "Meeting with Richard", + "people": ["Richard"], + "tagIndex": 26 + }, + { + "type": "Meeting", + "date": 14, + "month": 9, + "startTime": 17, + "endTime": 18, + "title": "Meeting with Ana", + "people": ["Ana"], + "tagIndex": 26 + }, + { + "type": "Meeting", + "date": 15, + "month": 10, + "startTime": 17, + "endTime": 18, + "title": "Meeting with Jennifer", + "people": ["Jennifer"], + "tagIndex": 26 + }, + { + "type": "Meeting", + "date": 14, + "month": 11, + "startTime": 17, + "endTime": 18, + "title": "Meeting with Scott", + "people": ["Scott"], + "tagIndex": 26 + } + + //--------------------------------------------------------------------------------------- +]; + +function generateJsonEvents(dFromDate, dToDate) +{ + var iMaxIdentifier = 0, + iEventsIndex = 1, + oArrJson = [], + sStatus = "", + + iTimeDiff = dToDate.getTime() - dFromDate.getTime(), + iNumOfDays = Math.floor(iTimeDiff / iMS.d) + 1, + iFromDate = dFromDate.getDate(), + iFromMonth = dFromDate.getMonth(), + iFromYear = dFromDate.getFullYear(), + iToDate = dToDate.getDate(), + iToMonth = dToDate.getMonth(), + iToYear = dToDate.getFullYear(), + + iEventCount = 0 + + iArrMonths = []; + + if(iFromYear === iToYear && iFromMonth === iToMonth) + { + iArrMonths.push([iFromMonth, iFromYear]); + } + else + { + for(var iYearIndex = iFromYear; iYearIndex <= iToYear; iYearIndex++) + { + var iNumOfMonths, iStartMonth, iEndMonth; + if(iFromYear === iToYear) + { + iNumOfMonths = iToMonth - iFromMonth; + iStartMonth = iFromMonth; + iEndMonth = iToMonth; + } + else if(iYearIndex === iFromYear) + { + iNumOfMonths = 12 - iFromMonth; + iStartMonth = iFromMonth; + iEndMonth = 11; + } + else if(iYearIndex === iToYear) + { + iNumOfMonths = iToMonth; + iStartMonth = 0; + iEndMonth = iToMonth; + } + else + { + iNumOfMonths = 12; + iStartMonth = 0; + iEndMonth = 11; + } + for(var iMonthIndex = iStartMonth; iMonthIndex <= iEndMonth; iMonthIndex++) + { + iArrMonths.push([iMonthIndex, iYearIndex]); + } + } + } + + var sIdentifier = iMaxIdentifier + iEventsIndex, + iTempIndex, iTempIndex1, iTempIndex2, + dStartDateTime, dEndDateTime, + thisObject, sDesc; + for(iTempIndex = 0; iTempIndex < oEventsTemplate.length; iTempIndex++) + { + var oEvent = oEventsTemplate[iTempIndex], + bWeeklyEvents = (oEvent.type === "Swimming" || + oEvent.type === "Running" || + oEvent.type === "Cycling" || + oEvent.type === "Movie" || + oEvent.type === "Hiking" || + oEvent.type === "Gym" || + oEvent.type === "RegularMeeting" || + oEvent.type === "ClientCall" || + oEvent.type === "RegularDinner" + ); + + if(bWeeklyEvents) + { + var dTempDate = new Date(dFromDate), + iTempDate = dTempDate.getTime(); + iEventCount = 0; + + for(iTempIndex1 = 0; iTempIndex1 < iNumOfDays; iTempIndex1++) + { + var sTempDay = sArrDayNameFull[dTempDate.getDay()]; + var oArrDays = oEvent.day; + + for(iTempIndex2 = 0; iTempIndex2 < oArrDays.length; iTempIndex2++) + { + iEventCount++; + + var sDay = oArrDays[iTempIndex2]; + var bMovie = (oEvent.type === "Movie") ? true : false; + var bValidate = bMovie ? (sDay === sTempDay && dTempDate.getDate() >= 21 && dTempDate.getDate() <= 31) : (sDay === sTempDay); + + if(bShowMore) + { + if(bValidate) + { + dStartDateTime = new Date(dTempDate); + dStartDateTime.setHours(oEvent.startTime); + dStartDateTime.setMinutes(0); + dStartDateTime.setSeconds(0); + + dEndDateTime = new Date(dTempDate); + if(oEvent.type === "Hiking") + { + dEndDateTime.setHours(oEvent.startTime + 52); + } + else if(oEvent.type === "Gym") + { + dStartDateTime.setMinutes(30); + + dEndDateTime.setHours(oEvent.endTime); + dEndDateTime.setMinutes(30); + } + else + { + if(oEvent.type === "Running") + { + dEndDateTime.setHours(oEvent.startTime); + dEndDateTime.setMinutes(30); + } + else + { + dEndDateTime.setHours(oEvent.endTime); + dEndDateTime.setMinutes(0); + } + } + + dEndDateTime.setSeconds(0); + + sDesc = oEvent.title + " is of type " + oEvent.type; + + var thisObject = new CalEvent(sIdentifier, false, dStartDateTime.getTime(), dEndDateTime.getTime(), oEvent.type, oEvent.title, sDesc, sURLCJG); + + if(oEvent.type === "Swimming" || oEvent.type === "Running" || oEvent.type === "Cycling" || oEvent.type === "Gym") + { + thisObject.calendarId = "Fitness"; + } + else if(oEvent.type === "Movie" || oEvent.type === "Hiking") + { + thisObject.calendarId = "Entertainment"; + } + else if(oEvent.type === "RegularMeeting" || oEvent.type === "ClientCall") + { + thisObject.calendarId = "Work"; + } + else if(oEvent.type === "RegularDinner") + { + thisObject.calendarId = "Personal"; + } + + if(oEvent.type === "Running") + { + if(sDay === "Tuesday") + thisObject.droppableId = "Madang"; + } + else if(oEvent.type === "Cycling") + { + if(sDay === "Friday") + thisObject.droppableId = "AliceBlue,Madang"; + } + else if(oEvent.type === "Movie") + { + thisObject.droppableId = "CapeHoney,AliceBlue"; + } + + var sIconName = "cs-icon-" + oEvent.type; + if(oEvent.type === "RegularMeeting") + sIconName = ""; // "cs-icon-Meeting"; + else if(oEvent.type === "ClientCall") + sIconName = "cs-icon-Call"; + else if(oEvent.type === "RegularDinner") + sIconName = "cs-icon-Dinner"; + + //thisObject.backgroundColor = getEventCalendarColors(thisObject.calendarId); + thisObject.singleColor = getEventCalendarColors(thisObject.calendarId); + thisObject.title = oEvent.title; + thisObject.tag = "Personal"; + thisObject.icon = sIconName; + thisObject.tagIndex = oEvent.tagIndex; + + if(oEvent.type === "Swimming") + { + thisObject.isResizeInDetailView = false; + thisObject.isDragNDropInDetailView = false; + } + + if(dStartDateTime.getMonth() !== 7) + { + if(iEventCount % 3 === 0) + thisObject.status = "Overdue"; + else if(iEventCount % 3 === 1) + thisObject.status = "Completed"; + else if(iEventCount % 3 === 2) + thisObject.status = "InProgress"; + } + + sStatus += thisObject.status + " "; + + //thisObject.backgroundColor = "FF66FF"; + //thisObject["location"] = "Mumbai"; + //thisObject["popovertitle"] = "this popover title"; + //thisObject["popovercontent"] = "this popover content"; + //if(compareDateTimes(dToDate, dEndDateTime) >= 0 && (compareDateTimes(dStartDateTime, dToday) <= 0 && compareDateTimes(dEndDateTime, dToday) >= 0)) + if(compareDateTimes(dToDate, dEndDateTime) >= 0) + { + oArrJson.push(thisObject); + } + + sIdentifier++; + } + } + } + + iTempDate += iMS.d; + dTempDate = new Date(iTempDate); + } + } + else + { + for(iTempIndex1 = 0; iTempIndex1 < iArrMonths.length; iTempIndex1++) + { + var iMonthYear = iArrMonths[iTempIndex1]; + + var bValidate1 = (iMonthYear[0] === iFromMonth) && (iFromMonth === oEvent.month && iFromDate < oEvent.date); + var bValidate2 = (iMonthYear[0] !== iFromMonth && iMonthYear[0] !== iToMonth); + var bValidate3 = (iMonthYear[0] === iToMonth) && (iToMonth === oEvent.month && iToDate > oEvent.date); + + if(bValidate1 || bValidate2 || bValidate3) + { + if(iMonthYear[0] === oEvent.month) + { + if(oEvent.type === "Birthday") + { + dStartDateTime = new Date(iMonthYear[1], iMonthYear[0], oEvent.date, 0, 0, 0, 0); + dEndDateTime = new Date(iMonthYear[1], iMonthYear[0], oEvent.date + 1, 0, 0, 0, 0); + } + else + { + dStartDateTime = new Date(iMonthYear[1], iMonthYear[0], oEvent.date, oEvent.startTime, 0, 0, 0); + dEndDateTime = new Date(iMonthYear[1], iMonthYear[0], oEvent.date, oEvent.endTime, 0, 0, 0); + } + + var sEventTitle = oEvent.title; + sDesc = oEvent.title + " is of type " + oEvent.type; + + thisObject = new CalEvent(sIdentifier, false, dStartDateTime, dEndDateTime, oEvent.type, sEventTitle, sDesc, sURLCJG); + thisObject.icon = "cs-icon-" + oEvent.type; + + if(oEvent.type !== "Birthday") + { + if(oEvent.type === "Dinner") + { + thisObject.calendarId = "Personal"; + thisObject.tag = "Personal"; + } + else + { + thisObject.calendarId = "Work"; + thisObject.tag = "Work"; + } + thisObject.people = oEvent.people || []; + } + else + { + thisObject.calendarId = "Birthday"; + thisObject.tag = "Personal"; + thisObject.isAllDay = true; + thisObject.isMarked = true; + thisObject.icon = null; + } + + if(oEvent.type === "Birthday") + { + var sBaseColor = getEventCalendarColors(thisObject.calendarId); + //thisObject.backgroundColor = sBaseColor; + //thisObject.textColor = "FFFFFF"; + + thisObject.singleColor = getEventCalendarColors(thisObject.calendarId); + } + else + { + thisObject.singleColor = getEventCalendarColors(thisObject.calendarId); + //thisObject.backgroundColor = getEventCalendarColors(thisObject.calendarId); + } + + thisObject.tagIndex = oEvent.tagIndex; + + if(dStartDateTime.getMonth() !== 7) + { + if(iTempIndex % 3 === 0) + thisObject.status = "Overdue"; + else if(iTempIndex % 3 === 1) + thisObject.status = "Completed"; + else if(iTempIndex % 3 === 2) + thisObject.status = "InProgress"; + } + + sStatus += thisObject.status + " "; + + if(oEvent.type !== "Dinner" || (oEvent.type === "Dinner" && dStartDateTime.getDay() !== 0)) + { + oArrJson.push(thisObject); + sIdentifier++; + } + } + } + } + } + } + + //console.log("oArrJson"); + //console.log(oArrJson); + + var oJsonStr = {}; + oJsonStr.eventSource = oArrJson; + + var sJsonStr = JSON.stringify(oJsonStr); + return sJsonStr; +} + +function getEventCalendarList(dFromDate, dToDate) +{ + var oArrEventCalendars = []; + + for(var iTempIndex = 0; iTempIndex < sArrEventCalendarCJG.length; iTempIndex++) + { + var sEventCalendar = sArrEventCalendarCJG[iTempIndex]; + + var oTempCalendar = {}; + oTempCalendar.calendarId = sEventCalendar; + oTempCalendar.calendar = sEventCalendar; + oTempCalendar.icon = "cs-icon-" + sEventCalendar; + oTempCalendar.color = getEventCalendarColors(sEventCalendar); + oTempCalendar.displayStatus = "show"; + oTempCalendar.isSelected = true; + oArrEventCalendars.push(oTempCalendar); + } + + var oJsonStr = {}; + oJsonStr.eventCalendarSource = oArrEventCalendars; + + var sJsonStr = JSON.stringify(oJsonStr); + return sJsonStr; +} + +function getJsonEventCount(dFromDate, dToDate) +{ + var oArrEventJson = generateJsonEvents(dFromDate, dToDate), + oJsonCount = []; + + var dTempDate = new Date(dFromDate); + if(typeof oArrEventJson === "string") + oArrEventJson = JSON.parse(oArrEventJson); + while(compareDateTimes(dTempDate, dToDate) <= 0) + { + var iDateEventCount = 0; + for(var iTempIndex = 0; iTempIndex < oArrEventJson.length; iTempIndex++) + { + var oEvent = oArrEventJson[iTempIndex], + dEventStartDate = new Date(oEvent.start), + dEventEndDate = new Date(oEvent.end), + + iCompStartDate = compareDates(dTempDate, dEventStartDate), + iCompEndDate = compareDates(dTempDate, dEventEndDate), + + bGTStartDate = (iCompStartDate >= 0), + bLTEndDate = (iCompEndDate <= 0); + + if(bGTStartDate && bLTEndDate) + iDateEventCount++; + } + + var oTempCount = {}; + oTempCount.date = new Date(dTempDate); + oTempCount.count = iDateEventCount; + oJsonCount.push(oTempCount); + + dTempDate = new Date(dTempDate.getTime() + iMS.d); + } + + var sJsonStr = JSON.stringify(oJsonCount); + return sJsonStr; +} + +function getJsonTimeSlotCount(dFromDate, dToDate, bIsFree) +{ + var oArrTimeSlotJson = generateJsonSlotAvailability(dFromDate, dToDate), + oJsonCount = []; + + var dTempDate = new Date(dFromDate); + if(typeof oArrTimeSlotJson === "string") + oArrTimeSlotJson = JSON.parse(oArrTimeSlotJson); + while(compareDateTimes(dTempDate, dToDate) <= 0) + { + var iDateTimeSlotCount = 0; + for(var iTempIndex = 0; iTempIndex < oArrTimeSlotJson.length; iTempIndex++) + { + var oTimeSlot = oArrTimeSlotJson[iTempIndex], + dSlotStartDate = new Date(oTimeSlot.start), + dSlotEndDate = new Date(oTimeSlot.end), + + iCompStartDate = compareDates(dTempDate, dSlotStartDate), + iCompEndDate = compareDates(dTempDate, dSlotEndDate), + + bGTStartDate = (iCompStartDate >= 0), + bLTEndDate = (iCompEndDate <= 0); + + if(bGTStartDate && bLTEndDate && (bIsFree === (oTimeSlot.status === "Free"))) + { + iDateTimeSlotCount++; + } + } + + var oTempCount = {}; + oTempCount.date = new Date(dTempDate); + oTempCount.count = iDateTimeSlotCount; + oJsonCount.push(oTempCount); + + dTempDate = new Date(dTempDate.getTime() + iMS.d); + } + + var sJsonStr = JSON.stringify(oJsonCount); + return sJsonStr; +} + + +/* ---------------------------- Event Json Generation End --------------------------------- */ + +/* ----------------------- Available Time Json Generation Start -------------------------- */ + + +function TimeString(dStartTime, dEndTime) +{ + this.startTime = dStartTime; + this.endTime = dEndTime; +} + +TimeString.prototype = +{ + constructor : TimeString +}; + +function DateTimeString(dStartDateTime, dEndDateTime) +{ + this.start = dStartDateTime; + this.end = dEndDateTime; +} + +DateTimeString.prototype = +{ + constructor : DateTimeString +}; + +function BusinessHoursArray(sDayName, dArrTime) +{ + this.dayName = sDayName; + this.times = dArrTime; +} + +BusinessHoursArray.prototype = +{ + constructor : BusinessHoursArray +}; + +function generateJsonBusinessHours() +{ + var oArrBusinessHours = []; + var oArrTimes, sDayName; + + for(var iDayIndex = 0; iDayIndex < 7; iDayIndex++) + { + sDayName = sArrDayNameFull[iDayIndex]; + + oArrTimes = []; + oArrTimes.push(new TimeString("10:00", "15:00")); + if(iDayIndex % 2 === 0){ + oArrTimes.push(new TimeString("17:00", "19:00")); + } + + oArrBusinessHours.push(new BusinessHoursArray(sDayName, oArrTimes)); + } + + var sJsonStr = JSON.stringify(oArrBusinessHours); + return sJsonStr; +} + +/* ----------------------- Available Time Json Generation End -------------------------- */ + + +function generateJsonSlotAvailability(dFromDate, dToDate) +{ + var iThisDate = dToday.getTime(), + dNextDay1 = new Date(iThisDate + iMS.d), + dNextDay2 = new Date(iThisDate + (2 * iMS.d)), + + oArrJson = [], + + sArrStatus = ["Free", "Busy"], + iArrCount = [0, 1, 2, 3, 4, 5], + iNumOfDays = Math.floor((dToDate.getTime() - dFromDate.getTime()) / iMS.d) + 1, + dThisDate = new Date(dFromDate), + iCounter = 0; + + for(var iTempIndex = 0; iTempIndex < iNumOfDays; iTempIndex++) + { + var iTimeSlotDuration = iArrTimeDurations.random(iArrTimeDurations.length); + + var iThisDateDay = dThisDate.getDate(); + var iThisDateMonth = dThisDate.getMonth(); + var iThisDateYear = dThisDate.getFullYear(); + + var iStartHour = 8; + var iEndHour = 22; + + var iThisHour = iStartHour; + var dTempDate = new Date(iThisDateYear, iThisDateMonth, iThisDateDay, iThisHour, 0, 0, 0); + var iTempCount = (iEndHour - iStartHour) * (60 / iTimeSlotDuration); + + for(var iTempIndex1 = 0; iTempIndex1 < iTempCount; iTempIndex1++) + { + iCounter++; + + var dStartDate = new Date(dTempDate); + var iStartDateMS = dStartDate.getTime(); + var iEndDateMS = iStartDateMS + (iTimeSlotDuration * iMS.m) - iMS.m; + var dEndDate = new Date(iEndDateMS); + + var sStartTimeString = getTimeString(sHourFormatCJG, sTimeSeparatorCJG, dStartDate.getHours(), dStartDate.getMinutes()); + var sEndTimeString = getTimeString(sHourFormatCJG, sTimeSeparatorCJG, dEndDate.getHours(), dEndDate.getMinutes()); + + var sStartDateTime = dStartDate.getDate() + sDateSeparatorCJG + dStartDate.getMonth() + sDateSeparatorCJG + dStartDate.getFullYear() + sDateTimeSeparatorCJG + sStartTimeString; + var sEndDateTime = dEndDate.getDate() + sDateSeparatorCJG + dEndDate.getMonth() + sDateSeparatorCJG + dEndDate.getFullYear() + sDateTimeSeparatorCJG + sEndTimeString; + + var oJson = {}; + oJson.start = dStartDate; // dStartDate (ISO) || sStartDateTime (String) + oJson.end = dEndDate; // dEndDate(ISO) || sEndDateTime (String) + if(iCounter % 4 === 0) + { + oJson.count = iArrCount.random(iArrCount.length); + if(oJson.count === 0) + oJson.status = "Busy"; + else + oJson.status = "Free"; + } + else + oJson.status = sArrStatus.random(sArrStatus.length); + + oArrJson.push(oJson); + + dTempDate = new Date(iEndDateMS + iMS.m); + } + + iThisDate = dThisDate.getTime() + iMS.d; + dThisDate = new Date(iThisDate); + } + + var oJsonStr = {}; + oJsonStr.slotAvailabilitySource = oArrJson; + + var sJsonStr = JSON.stringify(oJsonStr); + return sJsonStr; +} + +/* ----------------------- Event Filter related functions Start -------------------- */ + + +function setEventFilterCriteriaArray(isFilledTag) +{ + //["Swimming", "Running", "Cycling", "Birthday", "Coffee", "Lunch", "Dinner", "Meeting", "Movie"] + + var oArrValuesType = ["Meeting", "Coffee", "Lunch", "Dinner"]; + var oArrValuesSelectedType = []; + if(isFilledTag) + { + oArrValuesSelectedType = ["Meeting", "Coffee", "Lunch", "Dinner"]; + } + var sArrDisplayStatusType = ["show", "show", "show", "show"]; + + var oArrValuesPeople = ["Merlin", "Agnes", "Dora", "Victor", "Edwin", "Sam", "Kelvin", "Matt", "Sandra", "Celine", "Donna", "Arnold", "Richard", "Felicia", "Jennifer", "Scott"]; + var oArrValuesSelectedPeople = []; + if(isFilledTag) + { + oArrValuesSelectedPeople = ["Merlin", "Agnes", "Dora", "Victor", "Edwin", "Sam", "Kelvin", "Matt", "Sandra", "Celine", "Donna", "Arnold", "Richard", "Felicia", "Jennifer", "Scott"]; + } + + var oArrValuesTag = ["Personal", "Work"]; + var oArrValuesSelectedTag = []; + if(isFilledTag) + { + oArrValuesSelectedTag = ["Personal", "Work"]; + } + var sArrDisplayStatusTag = ["show", "show"]; + + var oArrValuesTagIndex = []; + for(var iTempIndex = 1; iTempIndex < 27; iTempIndex++) + { + oArrValuesTagIndex.push(iTempIndex); + } + var oArrValuesSelectedTagIndex = [25, 26]; + + var oFilter1 = setFilterObject("type", "Type", "String", oArrValuesType, oArrValuesSelectedType, sArrDisplayStatusType); + var oFilter2 = setFilterObject("people", "People", "Array", oArrValuesPeople, oArrValuesSelectedPeople, []); + var oFilter3 = setFilterObject("tag", "Tag", "String", oArrValuesTag, oArrValuesSelectedTag, sArrDisplayStatusType); + var oFilter4 = setFilterObject("tagIndex", "TagIndex", "Number", oArrValuesTagIndex, oArrValuesSelectedTagIndex, []); + + var sArrEventFilterCriteria = []; + sArrEventFilterCriteria.push(oFilter3); + sArrEventFilterCriteria.push(oFilter1); + sArrEventFilterCriteria.push(oFilter2); + //sArrEventFilterCriteria.push(oFilter4); + + var sJsonStr = JSON.stringify(sArrEventFilterCriteria); + return sJsonStr; +} + +function setFilterObject(sKeyName, sDisplayName, sDataType, oArrValues, oArrSelectedValues, sArrDisplayStatus) +{ + var oFilter = {}; + + oFilter.keyName = sKeyName; + oFilter.keyDisplayName = sDisplayName; + oFilter.dataType = sDataType; + oFilter.values = oArrValues; + oFilter.selectedValues = oArrSelectedValues; + oFilter.displayStatus = sArrDisplayStatus; + + return oFilter; +} + + +/* ----------------------- Event Filter related functions End -------------------- */ diff --git a/CalenStyleJsonGenerator/routes/user.js b/CalenStyleJsonGenerator/routes/user.js new file mode 100644 index 0000000..d5b34aa --- /dev/null +++ b/CalenStyleJsonGenerator/routes/user.js @@ -0,0 +1,8 @@ + +/* + * GET users listing. + */ + +exports.list = function(req, res){ + res.send("respond with a resource"); +}; \ No newline at end of file diff --git a/CalenStyleJsonGenerator/views/index.ejs b/CalenStyleJsonGenerator/views/index.ejs new file mode 100644 index 0000000..1500071 --- /dev/null +++ b/CalenStyleJsonGenerator/views/index.ejs @@ -0,0 +1,11 @@ + + + + <%= title %> + + + +

<%= title %>

+

Welcome to <%= title %>

+ + \ No newline at end of file diff --git a/ConfigPreview/ConfigPreview.css b/ConfigPreview/ConfigPreview.css new file mode 100644 index 0000000..dd793ea --- /dev/null +++ b/ConfigPreview/ConfigPreview.css @@ -0,0 +1,293 @@ +/*----------------------------------------------------------------------------*/ + +.popover-content +{ + font-size: 80%; +} + +.calendarContOuterParent +{ + width: 100%; + height: 700px; +} + +.calendarContOuter +{ + margin: 10px auto 0px auto; +} + +.calendarContOuterWeb +{ + width: 90%; + height: 600px; + font-size: 14px; +} + +.calendarContOuterTablet +{ + width: 768px; + height: 1024px; + font-size: 14px; +} + +.calendarContOuterPhone +{ + /* iPhone 5 */ width: 320px;height: 568px; + /* iPhone 6 width: 375px;height: 667px;*/ + /* iPhone 6 Plus width: 414px;height: 736px;*/ + font-size: 13px; +} + +.cEventResizeHandle +{ + background: #FFFFFF; + opacity: 0.5; +} + +.cHandleSouth +{ + background-image: url('images/resize-handle.png'); + background-size: 10px 10px; + width: 10px; + height:10px; + margin: -4px auto 0px auto; +} + +/*----------------------------------------------------------------------------*/ + +.pluginSettingsBg +{ + position: absolute; + top: 0px; + left: 0px; + + width: 100%; + min-height: 100%; + + background: #000000; + opacity: 0.5; + + z-index: 1000; +} + +.pluginSettings +{ + display: inline-block; + width: 740px; + min-height: 100%; + + position: absolute; + left: -1px; + top: 0px; + + z-index: 1001; +} + +.pluginSettingsSwitch +{ + display: inline-block; + width: 40px; + height: 40px; + + position: absolute; + right: 0px; + top: 0px; + + background: #22313F; + box-shadow: 1px 1px 15px #888888; +} + +.pluginSettingsSwitch img +{ + width: 40px; + height: 40px; +} + +.pluginSettingsHeader +{ + font-size: 160%; + text-align: center; + padding-bottom: 8px !important; + color: #FF3B30; +} + +.pluginSettingsHeader hr +{ + margin-top: 5px; + margin-bottom: 0px; +} + +.pluginSettingsCont +{ + display: inline-block; + width: 700px; + height: 88%; + + padding: 20px; + + background: #FFFFFF; + overflow-y: auto; + overflow-x: hidden; + box-shadow: 1px 1px 15px #888888; +} + +.pluginSettingsCont td:nth-child(2) +{ + width: 300px; +} + +.pluginSettingsCont td +{ + padding-bottom: 20px; +} + +.pluginSettingsCont .title +{ + width: 360px; + max-width: 360px; + padding-right: 10px; + + color: #666666; + word-wrap: break-word; + font-size: 120%; +} + +.pluginSettingsCont .variableName +{ + color: #888888; +} + +.small-textbox +{ + width: 50%; +} + +/*----------------------------------------------------------------------------*/ + +.cFilterBar +{ + text-align: center; +} + +.cFilterBarHeader +{ + text-align: center; + color: #FF3B30; + font-weight: bold; + font-size: 110%; + + height: 30px; + line-height: 30px; +} + +.filterBox +{ + position: relative; + + display: inline-block; + height: 140px; + width: 150px; + + margin: 10px; + + border: 1px solid #CCCCCC; +} + +input[type='checkbox'] +{ + margin: 6px 0px 0px 6px; +} + +.filterBoxTitle +{ + position: absolute; + top: 0px; + left: 0px; + + padding: 0px 0px 0px 4px; + + display: inline-block; + width: 100%; + height: 30px; + line-height: 30px; + + color: #444444; + font-size: 80%; + font-weight: bold; + background: #F8F8F8; + text-align: center; + + border-bottom: 1px solid #CCCCCC; +} + +.filterBoxContent +{ + position: absolute; + top: 35px; + left: 0px; + + width: 100%; + height: 100px; + + overflow: auto; + + text-align: left; + font-size: 80%; +} + +/*----------------------------------------------------------------------------*/ + +.dropdown-menu>.active>a, +.dropdown-menu>.active>a:hover, +.dropdown-menu>.active>a:focus +{ + background-color: #F9F2F4; +} + +.dropdown-menu>.active>a>label, +.dropdown-menu>.active>a:hover>label, +.dropdown-menu>.active>a:focus>label +{ + color: #333333; + font-weight: bold; +} + +.dropdown-menu>.disabled>a:hover *, .dropdown-menu>.disabled>a:focus * +{ + cursor: not-allowed; +} + +.dropdown-menu>li>a +{ + padding: 6px 20px; +} + +/* --------------------- Small Scrollbar Start --------------------- */ + +.small-scroll::-webkit-scrollbar +{ + width: 3px; + height: 10px; +} + +.small-scroll::-webkit-scrollbar-button:start:decrement, +.small-scroll::-webkit-scrollbar-button:end:increment +{ + height: 0px; + display: block; + background-color: transparent; +} + +.small-scroll::-webkit-scrollbar-track-piece +{ + background-color: #FFFFFF; +} + +.small-scroll::-webkit-scrollbar-thumb:vertical +{ + height: 50px; + background-color: #555555; + border: 1px solid #555555; +} + +/* --------------------- Small Scrollbar End --------------------- */ diff --git a/ConfigPreview/ConfigPreview.htm b/ConfigPreview/ConfigPreview.htm new file mode 100644 index 0000000..1b1b453 --- /dev/null +++ b/ConfigPreview/ConfigPreview.htm @@ -0,0 +1,490 @@ + + + + + + + Config Preview - CalenStyle + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ CalenStyle Settings +
+
+
View on Device
+
+ +
+
Display View
+
visibleView
+
+ +
+
Add Sections
+
sectionsList
+
+ +
+
Views Switch
+
viewsToDisplay
+
+ +
+
Components in Left Header Section
+
headerSectionsList.left
+
+ +
+
Components in Center Header Section
+
headerSectionsList.center
+
+ +
+
Components in Right Header Section
+
headerSectionsList.right
+
+ +
+
Elements in Header Dropdown Menu
+
dropdownMenuElements
+
+ +
+
Hide Event Icon
+
hideEventIcon
+
+ +
+
Hide Event Time
+
hideEventTime
+
+ +
+
Hide Extra Events In DetailedMonthView
+
hideExtraEvents
+
+ +
+
Event Indicator in Month View
+
eventIndicatorInMonthView
+
+ +
+
Average Events Per Day For Day Highlight View
+
averageEventsPerDayForDayHighlightView
+
+ +
+
Event Indicator in Month View
+
actionOnDayClickInMonthView
+
+ +
+
Number of Days in Custom View
+
daysInCustomView
+
+ +
+
Number of Days in Day List View
+
daysInDayListView
+
+ +
+
Number of Days in Appointment View
+
daysInAppointmentView
+
+ +
+
Duration of Agenda View
+
agendaViewDuration
+
+ +
+
Number of Days in Agenda View
+
daysInAgendaView
+
+ +
+
Duration of Quick Agenda View
+
quickAgendaViewDuration
+
+ +
+
Number of Days in Quick Agenda View
+
daysInQuickAgendaView
+
+ +
+
Duration of Task Planner View
+
taskPlannerViewDuration
+
+ +
+
Number of Days in Task Planner View
+
daysInTaskPlannerView
+
+ +
+
Display WeekNumber Column in Month View?
+
displayWeekNumInMonthView
+
+ +
+
Add restrictedSectionSource
+
restrictedSectionSource
+
+ +
+
Allow to Drop Events In Restricted Section
+
isRestrictedSectionDroppable
+
+ +
+
Allow to Drop Events In Non-Business Hours
+
isNonBusinessHoursDroppable
+
+ +
+
Set FilterBar Position
+
filterBarPosition
+
+ +
+ +
+ +
+
+
+ + + + \ No newline at end of file diff --git a/ConfigPreview/ConfigPreview.js b/ConfigPreview/ConfigPreview.js new file mode 100644 index 0000000..dd3d815 --- /dev/null +++ b/ConfigPreview/ConfigPreview.js @@ -0,0 +1,1206 @@ +var sArrSectionsList = null, +bDisplayEventList = false, +bDisplayFilterBar = false, +sFilterBarPosition = "", +bDisplayActionBar = false, +sArrViewsToDisplay = null, +sPluginStyleBoxOpen = true, +options = {}; + +var dToday = new Date(); +var dStartDate = new Date(); +dStartDate.setFullYear(dToday.getFullYear() - 1); +var dEndDate = new Date(); +dEndDate.setFullYear(dToday.getFullYear() + 1); + +function getEventsFromSource() +{ + var oJsonEvents = generateJsonEvents(dStartDate, dEndDate); + if(typeof oJsonEvents === "string") + return JSON.parse(oJsonEvents); + else if(typeof oJsonEvents === "object") + return oJsonEvents; +} + +var oCalenStyle = null; + +var oInitialize = function() +{ + oCalenStyle = this; +}; + +var oDisplayEventList = function(listStartDate, listEndDate) +{ + return displayEventsInList(this, listStartDate, listEndDate); +}; + +var oDisplayEventListAgenda = function(oViewDetails) +{ + return displayEventsInListAgenda(this, oViewDetails); +}; + +var oEventsAddedInView = function(visibleView, eventClass) +{ + var thisObj = this; + + $(thisObj.elem).find(eventClass).popover( + { + + placement: "top", + + trigger: "hover", + + html: true, + + container: "body", + + content: function() + { + var oTooltipContent = $(this).data("tooltipcontent"), + sTooltipText = "
" + oTooltipContent.title + "
" + oTooltipContent.startDateTime + "
" + oTooltipContent.endDateTime + "
"; + return sTooltipText; + } + + }); +}; + +var oTimeSlotsAddedInView = function(visibleView, eventClass) +{ + var thisObj = this; + + $(thisObj.elem).find(eventClass).popover( + { + placement: "top", + + trigger: "hover", + + html: true, + + container: "body", + + content: function() + { + return $(this).data("tooltipcontent"); + } + }); +}; + +var oTimeSlotClicked = function(oTimeSlotData, oTimeSlotElement) +{ + var thisObj = this; + + if(oTimeSlotData.status === "Free") + { + if($.cf.isValid(oTimeSlotData.count)) + { + if(oTimeSlotData.count > 0) + oTimeSlotData.count = --oTimeSlotData.count; + } + else + oTimeSlotData.status = "Busy"; + } + + setTimeout(function() + { + thisObj.modifyAppointmentSlot(oTimeSlotData, oTimeSlotElement); + }, 1000); +}; + +var oSaveChangesOnEventDrop = function(oDraggedEvent, startDateBeforeDrop, endDateBeforeDrop, startDateAfterDrop, endDateAfterDrop) +{ + $(".popover").hide(); +}; + +var sArrHeaderComponents = ["DatePickerIcon", "FullscreenButton", "PreviousButton", "NextButton", "TodayButton", "HeaderLabel", "HeaderLabelWithDropdownMenuArrow", "MenuSegmentedTab", "MenuDropdownIcon"]; + +var oEventListAppended = function() +{ + adjustList(); +}; + +var bChangedDevice = false, +bChangedCVDays = false, +bChangedDLVDays = false, +bChangedCAVDays = false, +bChangedCQAVDays = false, +bChangedCTPVDays = false; + +$(document).ready(function() +{ + //$.widget.bridge('tooltip', $.ui.tooltip); + + /*----------------------------------------------------------------------------*/ + + $(".calendarContOuter").CalenStyle( + { + initialize: oInitialize + }); + + $(window).resize(function() + { + adjustElements(); + adjustList(); + }); + + $(".calendarContOuter").resizable(); + + /*----------------------------------------------------------------------------*/ + + $(".pluginSettingsSwitch").click(function() + { + if(!sPluginStyleBoxOpen) + { + $(".pluginSettingsBg").css("display", "block"); + $(".pluginSettings").animate({"left": -1}); + sPluginStyleBoxOpen = true; + } + else + { + $(".pluginSettings").animate({"left": -700}); + setTimeout(function() + { + $(".pluginSettingsBg").css("display", "none"); + sPluginStyleBoxOpen = false; + }, 500); + } + }); + + $(".pluginSettingsBg").click(function() + { + if(sPluginStyleBoxOpen) + { + $(".pluginSettings").animate({"left": -700}); + setTimeout(function() + { + $(".pluginSettingsBg").css("display", "none"); + sPluginStyleBoxOpen = false; + }, 500); + } + }); + + $(".devices").multiselect( + { + onChange: function(element, checked) + { + bChangedDevice = true; + changePluginProperties(); + } + }); + + $(".sectionsList").multiselect( + { + numberDisplayed: 1, + + onChange: function(element, checked) + { + getSectionsList(); + changePluginProperties(); + } + }); + + $(".viewsToDisplay").multiselect( + { + numberDisplayed: 1, + + onChange: function(element, checked) + { + sArrViewsToDisplay = $(".viewsToDisplay").val(); + setDataForVisibleView(); + setViewsToDisplay(); + changePluginProperties(); + } + }); + + $(".headerSectionsListLeft").multiselect( + { + numberDisplayed: 1, + + onChange: function(element, checked) + { + changePluginProperties(); + } + }); + + $(".headerSectionsListCenter").multiselect( + { + numberDisplayed: 1, + + onChange: function(element, checked) + { + changePluginProperties(); + } + }); + + $(".headerSectionsListRight").multiselect( + { + numberDisplayed: 1, + + onChange: function(element, checked) + { + changePluginProperties(); + } + }); + + $(".dropdownMenuElements").multiselect( + { + numberDisplayed: 1, + + onChange: function(element, checked) + { + changePluginProperties(); + } + }); + + $(".visibleView").multiselect( + { + onChange: function(element, checked) + { + getSectionsList(); + setViewsToDisplay(); + changePluginProperties(); + } + }); + + $(".hideEventIcon").multiselect( + { + onChange: function(element, checked) + { + changePluginProperties(); + } + }); + + $(".hideEventTime").multiselect( + { + onChange: function(element, checked) + { + changePluginProperties(); + } + }); + + $(".hideExtraEvents").multiselect( + { + onChange: function(element, checked) + { + changePluginProperties(); + } + }); + + $(".cmvEventIndicator").multiselect( + { + onChange: function(element, checked) + { + setViewsToDisplay(); + changePluginProperties(); + } + }); + + $(".averageEvents").blur(function() + { + changePluginProperties(); + }); + + $(".actionOnDayClickInMonthView").multiselect( + { + onChange: function(element, checked) + { + changePluginProperties(); + } + }); + + $(".cvDays").multiselect( + { + onChange: function(element, checked) + { + bChangedCVDays = true; + changePluginProperties(); + } + }); + + $(".dlvDays").multiselect( + { + onChange: function(element, checked) + { + bChangedDLVDays = true; + changePluginProperties(); + } + }); + + $(".cavDays").multiselect( + { + onChange: function(element, checked) + { + bChangedCAVDays = true; + changePluginProperties(); + } + }); + + $(".cagvDuration").multiselect( + { + onChange: function(element, checked) + { + setViewsToDisplay(); + changePluginProperties(); + } + }); + + $(".cagvDays").blur(function() + { + changePluginProperties(); + }); + + $(".cqavDuration").multiselect( + { + onChange: function(element, checked) + { + bChangedCQAVDuration = true; + setViewsToDisplay(); + changePluginProperties(); + } + }); + + $(".cqavDays").multiselect( + { + onChange: function(element, checked) + { + bChangedCQAVDays = true; + changePluginProperties(); + } + }); + + $(".ctpvDuration").multiselect( + { + onChange: function(element, checked) + { + setViewsToDisplay(); + changePluginProperties(); + } + }); + + $(".ctpvDays").multiselect( + { + onChange: function(element, checked) + { + bChangedCTPVDays = true; + changePluginProperties(); + } + }); + + $(".weekNumber").multiselect( + { + onChange: function(element, checked) + { + changePluginProperties(); + } + }); + + $(".restrictedSection").multiselect( + { + onChange: function(element, checked) + { + changePluginProperties(); + } + }); + + $(".isRestrictedSectionDroppable").multiselect( + { + onChange: function(element, checked) + { + changePluginProperties(); + } + }); + + $(".isNonBusinessHoursDroppable").multiselect( + { + onChange: function(element, checked) + { + changePluginProperties(); + } + }); + + $(".filterBarPosition").multiselect( + { + onChange: function(element, checked) + { + sFilterBarPosition = $(".filterBarPosition").val(); + changePluginProperties(); + } + }); + + getSectionsList(); + setDataForVisibleView(); + setViewsToDisplay(); + changePluginProperties(); +}); + +function adjustElements() +{ + var iDocHeight = $(document).outerHeight(), + iBodyHeight = $("body").height(); + $(".pluginSettingsBg").css({"height": iDocHeight}); + $(".pluginSettings").css({"height": iBodyHeight}); +} + +function adjustList() +{ + if($(".cListOuterCont").width() < 420) + $(".cListEventDetails").css({"width": "50%"}); + else + $(".cListEventDetails").css({"width": "70%"}); +} + +function getSectionsList() +{ + sArrSectionsList = $(".sectionsList").val(); + var sVisibleView = $(".visibleView").val(); + + if(sArrSectionsList === undefined || sArrSectionsList === null) + { + sArrSectionsList = ["Header", "Calendar"]; + var sArrListJson = [ + {label: "Header", value: "Header"}, + {label: "Calendar", value: "Calendar"} + ]; + $(".sectionsList").multiselect("dataprovider", sArrListJson); + } + + bDisplayFilterBar = false; + bDisplayActionBar = false; + bDisplayEventList = false; + + for(var iTempIndex = 0; iTempIndex < sArrSectionsList.length; iTempIndex++) + { + var sSection = sArrSectionsList[iTempIndex]; + if(sSection === "FilterBar") + { + bDisplayFilterBar = true; + $(".row-filterBarPosition").show(); + sFilterBarPosition = $(".filterBarPosition").val(); + } + else if(sSection === "ActionBar") + bDisplayActionBar = true; + else if(sSection === "EventList") + bDisplayEventList = true; + } + + if(sVisibleView === "DayEventListView" && !bDisplayEventList) + { + bDisplayEventList = true; + $(".sectionsList").multiselect("select", "EventList") + } +} + +var bDetailedMonthView, bCMVEventIndicator, bRowCVDays, bRowDLVDays, bRowCAVDays, bRowCAGVDuration, bRowCAGVDays, bRowCQAVDuration, bRowCQAVDays, bRowCTPVDuration, bRowCTPVDays, bRowWeekNumber, bRowRestrictedSection, bRowNonBusinessHoursDroppable; +function setViewsToDisplay() +{ + $(".row-hideExtraEvents").hide(); + $(".row-cmvEventIndicator").hide(); + $(".row-averageEventsPerDay").hide(); + $(".row-actionOnDayClickInMonthView").hide(); + $(".row-cvDays").hide(); + $(".row-dlvDays").hide(); + $(".row-cavDays").hide(); + $(".row-cagvDuration").hide(); + $(".row-cagvDays").hide(); + $(".row-cqavDuration").hide(); + $(".row-cqavDays").hide(); + $(".row-ctpvDuration").hide(); + $(".row-ctpvDays").hide(); + $(".row-weekNumber").hide(); + $(".row-restrictedSection").hide(); + $(".row-isRestrictedSectionDroppable").hide(); + $(".row-isNonBusinessHoursDroppable").hide(); + $(".row-filterBarPosition").hide(); + bDetailedMonthView = false, bCMVEventIndicator = false, bRowCVDays = false, bRowDLVDays = false, bRowCAVDays = false, bRowCAGVDuration = false, bRowCAGVDays = false, bRowCQAVDuration = false, bRowCQAVDays = false, bRowCTPVDuration = false, bRowCTPVDays = false, bRowWeekNumber = false; + + if(sArrViewsToDisplay !== null) + { + for(var iTempIndex = 0; iTempIndex < sArrViewsToDisplay.length; iTempIndex++) + { + var sViewValue = sArrViewsToDisplay[iTempIndex]; + setVisibilityOfViews(sViewValue); + } + } + + setVisibilityOfViews($(".visibleView").val()); +} + +function setVisibilityOfViews(sViewValue) +{ + if(sViewValue === "CustomView") + { + $(".row-cvDays").show(); + bRowCVDays = true; + } + + if(sViewValue === "DayEventListView" || sViewValue === "DayEventDetailView") + { + $(".row-dlvDays").show(); + bRowDLVDays = true; + } + + if(sViewValue === "AppointmentView") + { + $(".row-cavDays").show(); + bRowCAVDays = true; + } + + if(sViewValue === "DetailedMonthView") + { + $(".row-hideExtraEvents").show(); + bDetailedMonthView = true; + } + + if(sViewValue === "DetailedMonthView" || sViewValue === "MonthView") + { + $(".row-weekNumber").show(); + bRowWeekNumber = true; + } + + if(sViewValue === "DetailedMonthView" || sViewValue === "MonthView" || sViewValue === "WeekView" || sViewValue === "DayView" || sViewValue === "CustomView" || sViewValue === "DayEventDetailView" || sViewValue === "QuickAgendaView") + { + $(".row-restrictedSection").show(); + $(".row-isRestrictedSectionDroppable").show(); + bRowRestrictedSection = true; + + $(".row-isNonBusinessHoursDroppable").show(); + bRowNonBusinessHoursDroppable = true; + } + + if(sViewValue === "AgendaView") + { + $(".row-cagvDuration").show(); + bRowCAGVDuration = true; + } + + if(sViewValue === "AgendaView" && $(".cagvDuration").val() === "CustomDays") + { + $(".row-cagvDays").show(); + bRowCAGVDays = true; + } + + if(sViewValue === "QuickAgendaView") + { + $(".row-cqavDuration").show(); + bRowCQAVDuration = true; + } + + if(sViewValue === "QuickAgendaView" && $(".cqavDuration").val() === "CustomDays") + { + $(".row-cqavDays").show(); + bRowCQAVDays = true; + } + + if(sViewValue === "TaskPlannerView") + { + $(".row-ctpvDuration").show(); + bRowCTPVDuration = true; + } + + if(sViewValue === "TaskPlannerView" && $(".ctpvDuration").val() === "CustomDays") + { + $(".row-ctpvDays").show(); + bRowCTPVDays = true; + } + + if(sViewValue === "MonthView") + { + $(".row-cmvEventIndicator").show(); + $(".row-actionOnDayClickInMonthView").show(); + bCMVEventIndicator = true; + } + + if((bCMVEventIndicator && $(".cmvEventIndicator").val() === "DayHighlight") || sViewValue === "DayEventListView" || sViewValue === "DayEventDetailView") + { + $(".row-averageEventsPerDay").show(); + } +} + +function setDataForVisibleView() +{ + var data = []; + + var bRefreshViewsToDisplayData = false; + if(sArrViewsToDisplay === undefined || sArrViewsToDisplay === null) + { + sArrViewsToDisplay = ["DetailedMonthView", "WeekView", "DayView", "AgendaView"]; + bRefreshViewsToDisplayData = true; + } + + if(sArrViewsToDisplay !== null) + { + $('.row-visibleView').show(); + if(bRefreshViewsToDisplayData) + $('.viewToDisplay').multiselect("dataprovider", data); + } +} + +function getViewsToDisplayArray() +{ + var data = []; + + for(var iTempIndex = 0; iTempIndex < sArrViewsToDisplay.length; iTempIndex++) + { + var sViewValue = sArrViewsToDisplay[iTempIndex]; + + var viewOptions = {}; + if(sViewValue === "DetailedMonthView") + { + viewOptions.viewName = "DetailedMonthView"; + viewOptions.viewDisplayName = "Month"; + } + else if(sViewValue === "MonthView") + { + viewOptions.viewName = "MonthView"; + viewOptions.viewDisplayName = "Month"; + } + else if(sViewValue === "WeekView") + { + viewOptions.viewName = "WeekView"; + viewOptions.viewDisplayName = "Week"; + } + else if(sViewValue === "DayView") + { + viewOptions.viewName = "DayView"; + viewOptions.viewDisplayName = "Day"; + } + else if(sViewValue === "AgendaView") + { + viewOptions.viewName = "AgendaView"; + viewOptions.viewDisplayName = "Agenda"; + } + else if(sViewValue === "QuickAgendaView") + { + viewOptions.viewName = "QuickAgendaView"; + viewOptions.viewDisplayName = "QuickAgenda"; + } + else if(sViewValue === "CustomView") + { + var iNumberOfDays = $(".cvDays").val(); + + viewOptions.viewName = "CustomView"; + viewOptions.viewDisplayName = iNumberOfDays + " Days"; + } + else if(sViewValue === "DatePicker") + { + viewOptions.viewName = "DatePicker"; + viewOptions.viewDisplayName = "DatePicker"; + } + else if(sViewValue === "DayEventListView") + { + var iNumberOfDays = $(".dlvDays").val(); + + viewOptions.viewName = "DayEventListView"; + viewOptions.viewDisplayName = iNumberOfDays + " Days"; + } + else if(sViewValue === "DayEventDetailView") + { + var iNumberOfDays = $(".dlvDays").val(); + + viewOptions.viewName = "DayEventDetailView"; + viewOptions.viewDisplayName = iNumberOfDays + " Days"; + } + else if(sViewValue === "AppointmentView") + { + var iNumberOfDays = $(".cavDays").val(); + + viewOptions.viewName = "AppointmentView"; + viewOptions.viewDisplayName = iNumberOfDays + " Days"; + } + data.push(viewOptions); + } + + return data; +} + +function getPluginData(bEventCalendar, bEvent, bRestrictedSection, bSlotAvailability) +{ + var iJsonCount = 0; + if(bEventCalendar) + iJsonCount++; + if(bEvent) + iJsonCount++; + if(bRestrictedSection) + iJsonCount++; + if(bSlotAvailability) + iJsonCount++; + + var sJson = [ + { + sourceFetchType: "DateRange", + sourceType: "FUNCTION", + + source: function(fetchStartDate, fetchEndDate, durationStartDate, durationEndDate, oConfig, loadViewCallback) + { + var calObj1 = this; + calObj1.incrementDataLoadingCount(iJsonCount); + + if(bEventCalendar) + { + var oEventCalendarResponse = getEventCalendarList(fetchStartDate, fetchEndDate); + if(oEventCalendarResponse !== undefined) + { + if(oEventCalendarResponse[0]) + { + calObj1.parseDataSource("eventCalendarSource", oEventCalendarResponse[1], durationStartDate, durationEndDate, loadViewCallback, {}, false); + } + } + } + + if(bEvent) + { + var oEventResponse = generateJsonEvents(fetchStartDate, fetchEndDate); + if(oEventResponse !== undefined) + { + if(oEventResponse[0]) + { + calObj1.parseDataSource("eventSource", oEventResponse[1], durationStartDate, durationEndDate, loadViewCallback, oConfig, false); + } + } + } + + if(bRestrictedSection) + { + var oRestrictedSectionResponse = generateJsonRestrictedSection(fetchStartDate, fetchEndDate); + if(oRestrictedSectionResponse !== undefined) + { + if(oRestrictedSectionResponse[0]) + { + calObj1.parseDataSource("restrictedSectionSource", oRestrictedSectionResponse[1], durationStartDate, durationEndDate, loadViewCallback, {}, false); + } + } + } + + if(bSlotAvailability) + { + var oSlotAvailabilityResponse = generateJsonSlotAvailability(fetchStartDate, fetchEndDate); + if(oSlotAvailabilityResponse !== undefined) + { + if(oSlotAvailabilityResponse[0]) + { + calObj1.parseDataSource("slotAvailabilitySource", oSlotAvailabilityResponse[1], durationStartDate, durationEndDate, loadViewCallback, {}, false); + } + } + } + } + } + ]; + + return sJson; +} + +var bDropdownMenuElement = false, bFullscreenElement = false; +function setHeaderSectionsListDropdownArray(sArrHeaderSections) +{ + var sArrSections = ["Left", "Center", "Right"]; + bDropdownMenuElement = false, bFullscreenElement = false; + + for(iSectionIndex = 0; iSectionIndex < 3; iSectionIndex++) + { + var sArrHeaderSectionsDropdown = []; + for(var iTempIndex1 = 0; iTempIndex1 < sArrHeaderComponents.length; iTempIndex1++) + { + var bElemSelected = false, bElemDisabled = false, + sComponent = sArrHeaderComponents[iTempIndex1]; + + for(var iTempIndex2 = 0; iTempIndex2 < 3; iTempIndex2++) + { + var sArrHeaderSection = sArrHeaderSections[iTempIndex2]; + + if($.cf.isValid(sArrHeaderSection)) + { + for(var iTempIndex3 = 0; iTempIndex3 < sArrHeaderSection.length; iTempIndex3++) + { + if(sComponent === sArrHeaderSection[iTempIndex3]) + { + if(iSectionIndex === iTempIndex2) + bElemSelected = true; + else + bElemDisabled = true; + + if(sComponent === "MenuDropdownIcon" || sComponent === "HeaderLabelWithDropdownMenuArrow") + bDropdownMenuElement = true; + if(sComponent === "FullscreenButton") + bFullscreenElement = true; + } + } + } + } + + sArrHeaderSectionsDropdown.push({label: sComponent, value: sComponent, disabled: bElemDisabled, selected: bElemSelected}); + } + $(".headerSectionsList" + sArrSections[iSectionIndex]).multiselect("dataprovider", sArrHeaderSectionsDropdown); + } +} + +function changePluginProperties() +{ + var bEventCalendar, bEvent, bRestrictedSection, bSlotAvailability; + options = {}; + options.initialize = oInitialize; + + var sDevice = $(".devices").val(), + bWeb = (sDevice === "Web"), + bTab = (sDevice === "Tablet"), + bPhone = (sDevice === "Phone"), + sDeviceClass = ""; + $(".calendarContOuter").removeClass("calendarContOuterWeb calendarContOuterTablet calendarContOuterPhone"); + if(bWeb) + sDeviceClass = "calendarContOuterWeb"; + else if(bTab) + sDeviceClass = "calendarContOuterTablet"; + else if(bPhone) + sDeviceClass = "calendarContOuterPhone"; + $(".calendarContOuter").addClass(sDeviceClass); + $(".calendarContOuter").removeAttr("style"); + + options.sectionsList = sArrSectionsList; + + options.viewsToDisplay = getViewsToDisplayArray(); + + var sArrHeaderSections = [], sArrHeaderSectionsDropdown = []; + sArrHeaderSections.push($(".headerSectionsListLeft").val()); + sArrHeaderSections.push($(".headerSectionsListCenter").val()); + sArrHeaderSections.push($(".headerSectionsListRight").val()); + + setHeaderSectionsListDropdownArray(sArrHeaderSections); + + options.headerSectionsList = {}; + options.headerSectionsList.left = sArrHeaderSections[0]; + options.headerSectionsList.center = sArrHeaderSections[1]; + options.headerSectionsList.right = sArrHeaderSections[2]; + + if(bDropdownMenuElement) + { + options.dropdownMenuElements = $(".dropdownMenuElements").val(); + $(".row-dropdownMenuElements").show(); + } + else + $(".row-dropdownMenuElements").hide(); + + options.visibleView = $(".visibleView").val(); + + options.hideEventIcon = {Default: ($(".hideEventIcon").val() === "true") ? true : false}; + + options.hideEventTime = {Default: ($(".hideEventTime").val() === "true") ? true : false}; + + if(options.visibleView === "DetailedMonthView") + { + options.hideExtraEvents = ($(".hideExtraEvents").val() === "true") ? true : false; + } + + if(bCMVEventIndicator) + options.eventIndicatorInMonthView = $(".cmvEventIndicator").val(); + + if((bCMVEventIndicator && options.eventIndicatorInMonthView === "DayHighlight") || options.visibleView === "DayEventListView" || options.visibleView === "DayEventDetailView") + options.averageEventsPerDayForDayHighlightView = parseInt($(".averageEvents").val()) || 5; + + if(bCMVEventIndicator) + options.actionOnDayClickInMonthView = $(".actionOnDayClickInMonthView").val(); + + if(bRowCVDays) + { + if(bChangedCVDays) + options.daysInCustomView = parseInt($(".cvDays").val()); + else + { + if(bPhone) + options.daysInCustomView = 2; + else if(bTab) + options.daysInCustomView = 3; + else if(bWeb) + options.daysInCustomView = 7; + + $(".cvDays *").attr('selected', false); + $(".cvDays option[value='" + options.daysInCustomView + "']").attr('selected', true); + $(".cvDays").multiselect('refresh'); + } + } + bChangedCVDays = false; + + if(bRowDLVDays) + { + if(bChangedDLVDays) + options.daysInDayListView = parseInt($(".dlvDays").val()); + else + { + if(bPhone) + options.daysInDayListView = 3; + else if(bTab) + options.daysInDayListView = 7; + else if(bWeb) + options.daysInDayListView = 7; + + $(".dlvDays *").attr('selected', false); + $(".dlvDays option[value='" + options.daysInDayListView + "']").attr('selected', true); + $(".dlvDays").multiselect('refresh'); + } + } + bChangedDLVDays = false; + + if(bRowCAVDays) + { + if(bChangedCAVDays) + options.daysInAppointmentView = parseInt($(".cavDays").val()); + else + { + if(bPhone) + options.daysInAppointmentView = 2; + else if(bTab) + options.daysInAppointmentView = 3; + else if(bWeb) + options.daysInAppointmentView = 4; + + $(".cavDays *").attr('selected', false); + $(".cavDays option[value='" + options.daysInAppointmentView + "']").attr('selected', true); + $(".cavDays").multiselect('refresh'); + } + } + + if(bRowWeekNumber) + options.displayWeekNumInMonthView = ($(".weekNumber").val() === "true") ? true : false; + + if(bRowCAGVDuration) + options.agendaViewDuration = $(".cagvDuration").val(); + + if(bRowCAGVDays) + options.daysInAgendaView = parseInt($(".cagvDays").val()) || 15; + + + if(bRowCQAVDuration) + { + options.quickAgendaViewDuration = $(".cqavDuration").val(); + + if((!bRowCQAVDays || (bRowCQAVDays && !bChangedCQAVDays)) && (bPhone || bTab)) + { + options.quickAgendaViewDuration = "CustomDays"; + $(".cqavDuration *").attr('selected', false); + $(".cqavDuration option[value='" + options.quickAgendaViewDuration + "']").attr('selected', true); + $(".cqavDuration").multiselect('refresh'); + + $(".row-cqavDays").show(); + bRowCQAVDays = true; + } + } + if(bRowCQAVDays) + { + if(bChangedCQAVDays) + options.daysInQuickAgendaView = parseInt($(".cqavDays").val()); + else + { + if(bPhone) + options.daysInQuickAgendaView = 2; + else if(bTab) + options.daysInQuickAgendaView = 3; + else if(bWeb) + options.daysInQuickAgendaView = 7; + } + + $(".cqavDays *").attr('selected', false); + $(".cqavDays option[value='" + options.daysInQuickAgendaView + "']").attr('selected', true); + $(".cqavDays").multiselect('refresh'); + } + bChangedCQAVDays = false; + + + if(bRowCTPVDuration) + { + options.taskPlannerViewDuration = $(".ctpvDuration").val(); + + if((!bRowCTPVDays || (bRowCTPVDays && !bChangedCTPVDays)) && (bPhone || bTab)) + { + options.taskPlannerViewDuration = "CustomDays"; + $(".ctpvDuration *").attr('selected', false); + $(".ctpvDuration option[value='" + options.taskPlannerViewDuration + "']").attr('selected', true); + $(".ctpvDuration").multiselect('refresh'); + + $(".row-ctpvDays").show(); + bRowCTPVDays = true; + } + } + if(bRowCTPVDays) + { + if(bChangedCTPVDays) + options.daysInTaskPlannerView = parseInt($(".ctpvDays").val()); + else + { + if(bPhone) + options.daysInTaskPlannerView = 2; + else if(bTab) + options.daysInTaskPlannerView = 3; + else if(bWeb) + options.daysInTaskPlannerView = 7; + + $(".ctpvDays *").attr('selected', false); + $(".ctpvDays option[value='" + options.daysInTaskPlannerView + "']").attr('selected', true); + $(".ctpvDays").multiselect('refresh'); + } + } + bChangedCTPVDays = false; + + + if(options.visibleView !== "DatePicker" && options.visibleView !== "AppointmentView") + { + bEvent = true; + + options.eventsAddedInView = oEventsAddedInView; + + options.saveChangesOnEventDrop = oSaveChangesOnEventDrop; + + if(bDisplayFilterBar) + { + bEventCalendar = true; + options.eventFilterCriteria = getFilterCriteriaSource(); + + var oFilterBarContent = function(oFilterBarElement, oArrEventFilterCriteria, oArrEventFilterCount) + { + var thisObj = this; + + var bFilterCount = (oArrTempFilterCount !== null) ? ((oArrTempFilterCount.length > 0) ? true : false) : false; + + $(oFilterBarElement).html("
Filters
"); + + for(var iTempIndex = 0; iTempIndex < oArrEventFilterCriteria.length; iTempIndex++) + { + var oArrTempFilter = oArrEventFilterCriteria[iTempIndex]; + var sTempKeyName = oArrTempFilter["keyName"]; + var sTempKeyDisplayName = oArrTempFilter.keyDisplayName || sTempKeyName; + var oArrTempDataType = oArrTempFilter.dataType; + var oArrTempValues = oArrTempFilter.values; + var oArrTempSelectedValues = oArrTempFilter.selectedValues; + + var oArrTempFilterCount; + for(var iTempIndex2 = 0; iTempIndex2 < oArrEventFilterCount.length; iTempIndex2++) + { + var oTempFilterCount = oArrEventFilterCount[iTempIndex2]; + if(oTempFilterCount["keyName"] === sTempKeyName) + { + oArrTempFilterCount = oTempFilterCount; + break; + } + } + + var sTempStr = ""; + + sTempStr += "
"; + + sTempStr += "
" + sTempKeyDisplayName + "
"; + + sTempStr += "
"; + + for(var iTempIndex2 = 0; iTempIndex2 < oArrTempValues.length; iTempIndex2++) + { + var sTempValue = oArrTempValues[iTempIndex2]; + var iTempValueCount = bFilterCount ? oArrTempFilterCount[sTempValue] : 0; + + var sChecked = ""; + for(iTempIndex3 = 0; iTempIndex3 < oArrTempSelectedValues.length; iTempIndex3++) + { + if(sTempValue === oArrTempSelectedValues[iTempIndex3]) + { + sChecked = "checked"; + break; + } + } + + sTempStr += "
"; + + sTempStr += ""; + + sTempStr += " " + sTempValue; + + if(bFilterCount) + sTempStr += "(" + iTempValueCount + ")"; + + sTempStr += "
"; + } + + sTempStr += "
"; + + sTempStr += "
"; + + $(oFilterBarElement).append(sTempStr); + } + + $("input[type='checkbox']").change(function() + { + var $this = $(this), + bInputStatus = $this.is(':checked'), + sInputValue = $this.val(), + + $parent = $this.parent().parent().parent(), + childCheckbox = $parent.find("input[type='checkbox']"), + sKeyName = $parent.find('.filterBoxTitle').text(); + + for(var iTempIndex1 = 0; iTempIndex1 < oArrEventFilterCriteria.length; iTempIndex1++) + { + var oTempFilter = oArrEventFilterCriteria[iTempIndex1]; + if(thisObj.compareStrings(oTempFilter["keyName"], sKeyName)) + { + var oArrSelected = []; + for(var iTempIndex2 = 0; iTempIndex2 < childCheckbox.length; iTempIndex2++) + { + var $checkbox = $(childCheckbox[iTempIndex2]); + if($checkbox.is(':checked')) + oArrSelected.push($checkbox.val()); + } + + oArrEventFilterCriteria[iTempIndex1].selectedValues = oArrSelected; + thisObj.applyFilter(oArrEventFilterCriteria); + break; + } + } + }); + }; + + options.modifyFilterBarView = oFilterBarContent; + + options.filterBarPosition = $(".filterBarPosition").val(); + } + } + + if(options.visibleView === "AppointmentView") + { + bSlotAvailability = true; + options.timeSlotsAddedInView = oTimeSlotsAddedInView; + + options.clickedAppointmentSlot = oTimeSlotClicked; + } + + if(bRowNonBusinessHoursDroppable) + options.isNonBusinessHoursDroppable = ($(".isNonBusinessHoursDroppable").val() === "true") ? true : false; + + if(bRowRestrictedSection && $(".restrictedSection").val() === "nonempty") + { + bRestrictedSection = true; + + options.isRestrictedSectionDroppable = ($(".isRestrictedSectionDroppable").val() === "true") ? true : false; + } + + if(bDisplayEventList && (options.visibleView === "DayEventListView" || options.visibleView === "MonthView")) + { + options.displayEventsForPeriodInList = oDisplayEventList; + options.eventListAppended = oEventListAppended; + } + + if(bDisplayEventList && (options.visibleView === "AgendaView")) + { + options.displayEventsForPeriodInList = oDisplayEventListAgenda; + options.eventListAppended = oEventListAppended; + } + + if(options.visibleView === "MonthView") + options.displayWeekNumInMonthView = ($(".weekNumber").val() === "true") ? true : false; + + options.calDataSource = getPluginData(bEventCalendar, bEvent, bRestrictedSection, bSlotAvailability); + oCalenStyle.modifySettings(options); + oCalenStyle.loadView(); + + $(".calendarContOuter").resizable("destroy"); + setTimeout(function() + { + $(".calendarContOuter").resizable(); + adjustElements(); + adjustList(); + + }, 100); +} diff --git a/ConfigPreview/bootstrap-multiselect.css b/ConfigPreview/bootstrap-multiselect.css new file mode 100644 index 0000000..13de57b --- /dev/null +++ b/ConfigPreview/bootstrap-multiselect.css @@ -0,0 +1 @@ +.multiselect-container{position:absolute;list-style-type:none;margin:0;padding:0}.multiselect-container .input-group{margin:5px}.multiselect-container>li{padding:0}.multiselect-container>li>a.multiselect-all label{font-weight:700}.multiselect-container>li.multiselect-group label{margin:0;padding:3px 20px 3px 20px;height:100%;font-weight:700}.multiselect-container>li.multiselect-group-clickable label{cursor:pointer}.multiselect-container>li>a{padding:0}.multiselect-container>li>a>label{margin:0;height:100%;cursor:pointer;font-weight:400;padding:3px 20px 3px 40px}.multiselect-container>li>a>label.radio,.multiselect-container>li>a>label.checkbox{margin:0}.multiselect-container>li>a>label>input[type=checkbox]{margin-bottom:5px}.btn-group>.btn-group:nth-child(2)>.multiselect.btn{border-top-left-radius:4px;border-bottom-left-radius:4px}.form-inline .multiselect-container label.checkbox,.form-inline .multiselect-container label.radio{padding:3px 20px 3px 40px}.form-inline .multiselect-container li a label.checkbox input[type=checkbox],.form-inline .multiselect-container li a label.radio input[type=radio]{margin-left:-20px;margin-right:0} \ No newline at end of file diff --git a/ConfigPreview/bootstrap-multiselect.js b/ConfigPreview/bootstrap-multiselect.js new file mode 100644 index 0000000..cdeaed7 --- /dev/null +++ b/ConfigPreview/bootstrap-multiselect.js @@ -0,0 +1,44 @@ +/** + * Bootstrap Multiselect (https://github.com/davidstutz/bootstrap-multiselect) + * + * Apache License, Version 2.0: + * Copyright (c) 2012 - 2015 David Stutz + * + * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * BSD 3-Clause License: + * Copyright (c) 2012 - 2015 David Stutz + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of David Stutz nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +!function(t){"use strict";function e(t,e){for(var i=0;ithis.numberDisplayed)return e.length+" "+this.nSelectedText;var s="";return e.each(function(){var e=void 0!==t(this).attr("label")?t(this).attr("label"):t(this).text();s+=e+", "}),s.substr(0,s.length-2)},buttonTitle:function(e){if(0===e.length)return this.nonSelectedText;var i="";return e.each(function(){i+=t(this).text()+", "}),i.substr(0,i.length-2)},optionLabel:function(e){return t(e).attr("label")||t(e).text()},onChange:function(){},onDropdownShow:function(){},onDropdownHide:function(){},onDropdownShown:function(){},onDropdownHidden:function(){},onSelectAll:function(){},buttonClass:"btn btn-default",inheritClass:!1,buttonWidth:"auto",buttonContainer:'
',dropRight:!1,selectedClass:"active",maxHeight:!1,checkboxName:!1,includeSelectAllOption:!1,includeSelectAllIfMoreThan:0,selectAllText:" Select all",selectAllValue:"multiselect-all",selectAllName:!1,selectAllNumber:!0,enableFiltering:!1,enableCaseInsensitiveFiltering:!1,enableClickableOptGroups:!1,filterPlaceholder:"Search",filterBehavior:"text",includeFilterClearBtn:!0,preventInputChangeEvent:!1,nonSelectedText:"None selected",nSelectedText:"selected",allSelectedText:"All selected",numberDisplayed:3,disableIfEmpty:!1,templates:{button:'',ul:'',filter:'
  • ',filterClearBtn:'',li:'
  • ',divider:'
  • ',liGroup:'
  • '}},constructor:i,buildContainer:function(){this.$container=t(this.options.buttonContainer),this.$container.on("show.bs.dropdown",this.options.onDropdownShow),this.$container.on("hide.bs.dropdown",this.options.onDropdownHide),this.$container.on("shown.bs.dropdown",this.options.onDropdownShown),this.$container.on("hidden.bs.dropdown",this.options.onDropdownHidden)},buildButton:function(){this.$button=t(this.options.templates.button).addClass(this.options.buttonClass),this.$select.attr("class")&&this.options.inheritClass&&this.$button.addClass(this.$select.attr("class")),this.$select.prop("disabled")?this.disable():this.enable(),this.options.buttonWidth&&"auto"!==this.options.buttonWidth&&(this.$button.css({width:this.options.buttonWidth,overflow:"hidden","text-overflow":"ellipsis"}),this.$container.css({width:this.options.buttonWidth}));var e=this.$select.attr("tabindex");e&&this.$button.attr("tabindex",e),this.$container.prepend(this.$button)},buildDropdown:function(){this.$ul=t(this.options.templates.ul),this.options.dropRight&&this.$ul.addClass("pull-right"),this.options.maxHeight&&this.$ul.css({"max-height":this.options.maxHeight+"px","overflow-y":"auto","overflow-x":"hidden"}),this.$container.append(this.$ul)},buildDropdownOptions:function(){this.$select.children().each(t.proxy(function(e,i){var s=t(i),l=s.prop("tagName").toLowerCase();s.prop("value")!==this.options.selectAllValue&&("optgroup"===l?this.createOptgroup(i):"option"===l&&("divider"===s.data("role")?this.createDivider():this.createOptionValue(i)))},this)),t("li input",this.$ul).on("change",t.proxy(function(e){var i=t(e.target),s=i.prop("checked")||!1,l=i.val()===this.options.selectAllValue;this.options.selectedClass&&(s?i.closest("li").addClass(this.options.selectedClass):i.closest("li").removeClass(this.options.selectedClass));var o=i.val(),n=this.getOptionByValue(o),a=t("option",this.$select).not(n),p=t("input",this.$container).not(i);return l&&(s?this.selectAll():this.deselectAll()),l||(s?(n.prop("selected",!0),this.options.multiple?n.prop("selected",!0):(this.options.selectedClass&&t(p).closest("li").removeClass(this.options.selectedClass),t(p).prop("checked",!1),a.prop("selected",!1),this.$button.click()),"active"===this.options.selectedClass&&a.closest("a").css("outline","")):n.prop("selected",!1)),this.$select.change(),this.updateButtonText(),this.updateSelectAll(),this.options.onChange(n,s),this.options.preventInputChangeEvent?!1:void 0},this)),t("li a",this.$ul).on("mousedown",function(t){return t.shiftKey?!1:void 0}),t("li a",this.$ul).on("touchstart click",t.proxy(function(e){e.stopPropagation();var i=t(e.target);if(e.shiftKey&&this.options.multiple){i.is("label")&&(e.preventDefault(),i=i.find("input"),i.prop("checked",!i.prop("checked")));var s=i.prop("checked")||!1;if(null!==this.lastToggledInput&&this.lastToggledInput!==i){var l=i.closest("li").index(),o=this.lastToggledInput.closest("li").index();if(l>o){var n=o;o=l,l=n}++o;var a=this.$ul.find("li").slice(l,o).find("input");a.prop("checked",s),this.options.selectedClass&&a.closest("li").toggleClass(this.options.selectedClass,s);for(var p=0,r=a.length;r>p;p++){var c=t(a[p]),h=this.getOptionByValue(c.val());h.prop("selected",s)}}i.trigger("change")}i.is("input")&&!i.closest("li").is(".multiselect-item")&&(this.lastToggledInput=i),i.blur()},this)),this.$container.off("keydown.multiselect").on("keydown.multiselect",t.proxy(function(e){if(!t('input[type="text"]',this.$container).is(":focus"))if(9===e.keyCode&&this.$container.hasClass("open"))this.$button.click();else{var i=t(this.$container).find("li:not(.divider):not(.disabled) a").filter(":visible");if(!i.length)return;var s=i.index(i.filter(":focus"));38===e.keyCode&&s>0?s--:40===e.keyCode&&s").attr("type",o);this.options.checkboxName&&p.attr("name",this.options.checkboxName),a.append(p);var r=i.prop("selected")||!1;p.val(l),l===this.options.selectAllValue&&(n.addClass("multiselect-item multiselect-all"),p.parent().parent().addClass("multiselect-all")),a.append(" "+s),a.attr("title",i.attr("title")),this.$ul.append(n),i.is(":disabled")&&p.attr("disabled","disabled").prop("disabled",!0).closest("a").attr("tabindex","-1").closest("li").addClass("disabled"),p.prop("checked",r),r&&this.options.selectedClass&&p.closest("li").addClass(this.options.selectedClass)},createDivider:function(){var e=t(this.options.templates.divider);this.$ul.append(e)},createOptgroup:function(e){var i=t(e).prop("label"),s=t(this.options.templates.liGroup);t("label",s).text(i),this.options.enableClickableOptGroups&&s.addClass("multiselect-group-clickable"),this.$ul.append(s),t(e).is(":disabled")&&s.addClass("disabled"),t("option",e).each(t.proxy(function(t,e){this.createOptionValue(e)},this))},buildSelectAll:function(){"number"==typeof this.options.selectAllValue&&(this.options.selectAllValue=this.options.selectAllValue.toString());var e=this.hasSelectAll();if(!e&&this.options.includeSelectAllOption&&this.options.multiple&&t("option",this.$select).length>this.options.includeSelectAllIfMoreThan){this.options.includeSelectAllDivider&&this.$ul.prepend(t(this.options.templates.divider));var i=t(this.options.templates.li);t("label",i).addClass("checkbox"),t("label",i).append(this.options.selectAllName?'':'');var s=t("input",i);s.val(this.options.selectAllValue),i.addClass("multiselect-item multiselect-all"),s.parent().parent().addClass("multiselect-all"),t("label",i).append(" "+this.options.selectAllText),this.$ul.prepend(i),s.prop("checked",!1)}},buildFilter:function(){if(this.options.enableFiltering||this.options.enableCaseInsensitiveFiltering){var e=Math.max(this.options.enableFiltering,this.options.enableCaseInsensitiveFiltering);if(this.$select.find("option").length>=e){if(this.$filter=t(this.options.templates.filter),t("input",this.$filter).attr("placeholder",this.options.filterPlaceholder),this.options.includeFilterClearBtn){var i=t(this.options.templates.filterClearBtn);i.on("click",t.proxy(function(){clearTimeout(this.searchTimeout),this.$filter.find(".multiselect-search").val(""),t("li",this.$ul).show().removeClass("filter-hidden"),this.updateSelectAll()},this)),this.$filter.find(".input-group").append(i)}this.$ul.prepend(this.$filter),this.$filter.val(this.query).on("click",function(t){t.stopPropagation()}).on("input keydown",t.proxy(function(e){13===e.which&&e.preventDefault(),clearTimeout(this.searchTimeout),this.searchTimeout=this.asyncFunction(t.proxy(function(){if(this.query!==e.target.value){this.query=e.target.value;var i,s;t.each(t("li",this.$ul),t.proxy(function(e,l){var o=t("input",l).length>0?t("input",l).val():"",n=t("label",l).text(),a="";if("text"===this.options.filterBehavior?a=n:"value"===this.options.filterBehavior?a=o:"both"===this.options.filterBehavior&&(a=n+"\n"+o),o!==this.options.selectAllValue&&n){var p=!1;this.options.enableCaseInsensitiveFiltering&&a.toLowerCase().indexOf(this.query.toLowerCase())>-1?p=!0:a.indexOf(this.query)>-1&&(p=!0),t(l).toggle(p).toggleClass("filter-hidden",!p),t(l).hasClass("multiselect-group")?(i=l,s=p):(p&&t(i).show().removeClass("filter-hidden"),!p&&s&&t(l).show().removeClass("filter-hidden"))}},this))}this.updateSelectAll()},this),300,this)},this))}}},destroy:function(){this.$container.remove(),this.$select.show(),this.$select.data("multiselect",null)},refresh:function(){t("option",this.$select).each(t.proxy(function(e,i){var s=t("li input",this.$ul).filter(function(){return t(this).val()===t(i).val()});t(i).is(":selected")?(s.prop("checked",!0),this.options.selectedClass&&s.closest("li").addClass(this.options.selectedClass)):(s.prop("checked",!1),this.options.selectedClass&&s.closest("li").removeClass(this.options.selectedClass)),t(i).is(":disabled")?s.attr("disabled","disabled").prop("disabled",!0).closest("li").addClass("disabled"):s.prop("disabled",!1).closest("li").removeClass("disabled")},this)),this.updateButtonText(),this.updateSelectAll()},select:function(e,i){t.isArray(e)||(e=[e]);for(var s=0;s").attr({label:o.label||"Group "+s,disabled:!!o.disabled}),e(o.children,function(e){n.append(t("