Commit 34533687 authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_travel_expense: add calendar gadget to display events in a person agenda

parent a2f00639
...@@ -200,6 +200,12 @@ chartist.min.js\n ...@@ -200,6 +200,12 @@ chartist.min.js\n
chartist.min.css\n chartist.min.css\n
gadget_hr_jio.html\n gadget_hr_jio.html\n
gadget_hr_jio.js\n gadget_hr_jio.js\n
gadget_officejs_page_calendar.js\n
gadget_officejs_page_calendar.html\n
\n
\n
\n
>>>>>>> e7eb1b5... erp5_travel_expense: add calendar gadget to display events in a person agenda
NETWORK:\n NETWORK:\n
* *
...@@ -338,7 +344,11 @@ NETWORK:\n ...@@ -338,7 +344,11 @@ NETWORK:\n
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<<<<<<< HEAD
<value> <string>955.64169.17995.61457</string> </value> <value> <string>955.64169.17995.61457</string> </value>
=======
<value> <string>956.35741.51905.15616</string> </value>
>>>>>>> e7eb1b5... erp5_travel_expense: add calendar gadget to display events in a person agenda
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -356,7 +366,11 @@ NETWORK:\n ...@@ -356,7 +366,11 @@ NETWORK:\n
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<<<<<<< HEAD
<float>1481818221.17</float> <float>1481818221.17</float>
=======
<float>1484044668.41</float>
>>>>>>> e7eb1b5... erp5_travel_expense: add calendar gadget to display events in a person agenda
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
<!DOCTYPE html>
<html manifest="gadget_officejs_calendar.appcache">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<title>ERP5 Calendar</title>
<!-- renderjs -->
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<link rel='stylesheet' href='fullcalendar.min.css' />
<script src='jquery.js'></script>
<script src='moment.min.js'></script>
<script src='fullcalendar.min.js'></script>
<script src="gadget_officejs_calendar.js" type="text/javascript"></script>
</head>
<body>
<div id ="calendar"></div>
</body>
</html>
\ No newline at end of file
/*global window, rJS, RSVP, Handlebars, calculatePageTitle */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS, RSVP) {
"use strict";
/////////////////////////////////////////////////////////////////
// Handlebars
/////////////////////////////////////////////////////////////////
// Precompile the templates while loading the first gadget instance
var gadget_klass = rJS(window);
gadget_klass
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("changeUrl", "changeUrl")
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod("render", function (options) {
var gadget = this;
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'listDay,listWeek,month'
},
height: "auto",
aspectRatio: 0.7,
contentHeight: "auto",
// customize the button names,
// otherwise they'd all just say "list"
views: {
listDay: { buttonText: 'list day' },
listWeek: { buttonText: 'list week' }
},
eventClick: function(event) {
if (event.url) {
//xxx should return false to prevent url change
//https://fullcalendar.io/docs/mouse/eventClick/
gadget.changeUrl({jio_key: event.url});
return false;
}
},
defaultView: 'month',
navLinks: true, // can click day/week names to navigate views
editable: true,
eventLimit: true, // allow "more" link when too many events
events: options.events
});
});
}(window, rJS, RSVP));
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<title>ERP5 Page Calendar</title>
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<script src='gadget_global.js'></script>
<script src="gadget_officejs_page_calendar.js" text="text/javascript"></script>
</head>
<body>
<div class='container'></div>
</body>
</html>
\ No newline at end of file
/*global window, rJS, RSVP, Handlebars, calculatePageTitle */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS, RSVP, loopEventListener) {
"use strict";
var gadget_klass = rJS(window);
gadget_klass
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("redirect", "redirect")
.allowPublicAcquisition("changeUrl", function (options) {
return this.redirect({
jio_key: options[0].jio_key,
page: "view"
});
})
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod("render", function (options) {
})
.declareService(function () {
var gadget = this,
iframe,
events = [];
return gadget.declareGadget('gadget_officejs_calendar.html', {
element: gadget.element.querySelector('.container'),
sandbox: 'iframe'
})
.push(function (calendar) {
iframe = gadget.element.querySelector('iframe');
iframe.setAttribute(
'style',
'width:100%; border: 0 none; height: 600px'
);
return gadget.jio_allDocs({
query: '(portal_type: "Travel Request Record" AND simulation_state:("draft","sent","stopped")) ' +
'OR (portal_type: "Leave Request Record" AND simulation_state:("draft","sent","stopped"))',
select_list: ['title', 'start_date', 'stop_date'],
limit: [0, 12345678]
})
.push(function (result) {
var i;
for (i = 0; i < result.data.total_rows; i += 1) {
events.push({
title: result.data.rows[i].value.title,
start: result.data.rows[i].value.start_date,
end: result.data.rows[i].value.stop_date,
url: result.data.rows[i].id
});
}
return calendar.render({events: events});
});
});
});
}(window, rJS, RSVP, loopEventListener));
\ No newline at end of file
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
<li><a href="#page=expense_record_list" data-i18n="Expenses">Expenses</a></li> <li><a href="#page=expense_record_list" data-i18n="Expenses">Expenses</a></li>
<li><a href="#page=travel_request_record_list" data-i18n="Missions">Missions</a></li> <li><a href="#page=travel_request_record_list" data-i18n="Missions">Missions</a></li>
<li><a href="#page=leave_request_record_list" data-i18n="Leaves">Leaves</a></li> <li><a href="#page=leave_request_record_list" data-i18n="Leaves">Leaves</a></li>
<li><a href="#page=calendar" data-i18n="Calendar">Calendar</a></li>
<li><a href="#page=expense_report" data-i18n="Reports">Reports</a></li> <li><a href="#page=expense_report" data-i18n="Reports">Reports</a></li>
<!-- li><a href="#page=jio_configurator" data-i18n="Storage Configuration">Storage Configuration</a></li --> <!-- li><a href="#page=jio_configurator" data-i18n="Storage Configuration">Storage Configuration</a></li -->
<!-- li><a href="#page=sync" data-i18n="Synchronization">Synchronization</a></li --> <!-- li><a href="#page=sync" data-i18n="Synchronization">Synchronization</a></li -->
......
...@@ -255,7 +255,7 @@ ...@@ -255,7 +255,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>supercedriclen</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -269,7 +269,7 @@ ...@@ -269,7 +269,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>955.64162.27468.50670</string> </value> <value> <string>956.25652.62697.44885</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -287,7 +287,7 @@ ...@@ -287,7 +287,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1481817822.09</float> <float>1483976094.09</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment