Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

minor changes

  • Loading branch information...
commit 6c974f6637f92af2343cc9c2f66815fcc8684af0 1 parent 9f432a6
Claude Bossy authored
View
7 getEvent.py
@@ -16,7 +16,6 @@ def eventDays():
event_id = request.args.get('eventID')
isEventInDB = query_session.query(Event).filter(Event.id==event_id)
if isEventInDB.count()==0:
- print 'addEvent'
addEventToDB(event_id)
days = []
for day in query_session.query(Day).filter(Day.eventId == event_id):
@@ -30,7 +29,6 @@ def eventDay():
day_date = request.args.get('dayDate')
day = query_session.query(Day).filter(Day.eventId==event_id, Day.date==day_date)[0]
day._field_values.pop('mongo_id')
- print day._field_values
return json.dumps(day._field_values)
@getEvent.route('/eventSession', methods=['GET'])
@@ -61,7 +59,6 @@ def eventSession():
end_date = session._field_values.pop('endDate')
session._field_values['endDate'] = {'date':end_date.strftime('%Y-%m-%d') , 'time':end_date.strftime('%H:%M:%S')}
session._field_values.pop('mongo_id')
- print session._field_values
return json.dumps(session._field_values)
@getEvent.route('/eventContribution', methods=['GET'])
@@ -94,7 +91,6 @@ def eventContribution():
end_date = contribution._field_values.pop('endDate')
contribution._field_values['endDate'] = {'date':end_date.strftime('%Y-%m-%d') , 'time':end_date.strftime('%H:%M:%S')}
contribution._field_values.pop('mongo_id')
- print contribution._field_values
return json.dumps(contribution._field_values)
@getEvent.route('/daySessions', methods=['GET'])
@@ -348,7 +344,6 @@ def eventInfo():
isEventInDB = query_session.query(Event).filter(Event.id==event_id)
if isEventInDB.count()>0:
event = isEventInDB[0]
- print event
chairs = []
for chair in event._field_values['chairs']:
chair._field_values.pop('mongo_id')
@@ -361,7 +356,6 @@ def eventInfo():
event._field_values.pop('mongo_id')
return json.dumps(event._field_values)
else:
- print 'else'
req = urllib2.Request('http://'+current_app.config['SERVER_URL']+'/indico/export/event/'+event_id+'.json?ak='+current_app.config['API_KEY'])
opener = urllib2.build_opener()
f = opener.open(req)
@@ -382,7 +376,6 @@ def searchEvent():
events = query_session.db.Event.find({'title': {'$regex':search, '$options':'i'}},{'_id':0,'id':1,'title':1,'startDate':1})
results = []
for event in events:
- print event
start_date = event.pop('startDate')
event['startDate'] = {'date':start_date.strftime('%Y-%m-%d') , 'time':start_date.strftime('%H:%M:%S')}
results.append(event)
View
93 static/js/clickEvents.js
@@ -1,96 +1,3 @@
-getDays = function(eventId){
- var days;
- $.ajax({
- type : "GET",
- url : "/eventDays",
- dataType : "json",
- async: false,
- data : {
- eventID: eventId,
- },
- success: function(resp){
- days=resp;
- }
- });
- console.log(days)
- return new Days(days);
-
-}
-
-getDaySessions = function(eventId, day){
- var sessions;
- $.ajax({
- type : "GET",
- url : "/daySessions",
- dataType : "json",
- async: false,
- data : {
- eventID: eventId,
- day: day
- },
- success: function(resp){
- sessions=resp;
- }
- });
- return new Slots(sessions);
-}
-
-getSessionContributions = function(eventId, day, sessionId){
- var contributions;
- $.ajax({
- type : "GET",
- url : "/sessionContributions",
- dataType : "json",
- async: false,
- data : {
- eventID: eventId,
- day: day,
- sessionId: sessionId
- },
- success: function(resp){
- contributions=resp;
- }
- });
- return new Contributions(contributions);
-
-}
-
-getEventContributions = function(eventId){
- var contributions;
- $.ajax({
- type : "GET",
- url : "/eventContributions",
- dataType : "json",
- async: false,
- data : {
- eventID: eventId
- },
- success: function(resp){
- contributions=resp;
- }
- });
- return new Contributions(contributions);
-
-}
-
-getEventSessions = function(eventId){
- var sessions;
- $.ajax({
- type : "GET",
- url : "/eventSessions",
- dataType : "json",
- async: false,
- data : {
- eventID: eventId
- },
- success: function(resp){
- sessions=resp;
- }
- });
- return new Slots(sessions);
-
-}
-
$('a[id="dayButton"]').live('click', function(event) {
var eventId = $(this).attr('eventId');
View
79 static/js/editAgenda.js
@@ -1,82 +1,3 @@
-getDay = function(eventId, dayDate){
- var day;
- $.ajax({
- type : "GET",
- url : "/eventDay",
- dataType : "json",
- async: false,
- data : {
- eventID: eventId,
- dayDate: dayDate
- },
- success: function(resp){
- day=resp;
- }
- });
- return new Day(day);
-
-}
-
-getEvent = function(eventId){
- console.log(eventId)
- var event;
- $.ajax({
- type : "GET",
- url : "/eventInfo",
- dataType : "json",
- async: false,
- data : {
- eventID: eventId,
- },
- success: function(resp){
- event=resp;
- }
- });
- return new Event(event);
-
-}
-
-getSession = function(eventId, dayDate, sessionId){
- var session;
- $.ajax({
- type : "GET",
- url : "/eventSession",
- dataType : "json",
- async: false,
- data : {
- eventID: eventId,
- dayDate: dayDate,
- sessionId: sessionId
- },
- success: function(resp){
- session=resp;
- }
- });
- return new Slot(session);
-
-}
-
-getContribution = function(eventId, dayDate, sessionId, contributionId){
- var contribution;
- $.ajax({
- type : "GET",
- url : "/eventContribution",
- dataType : "json",
- async: false,
- data : {
- eventID: eventId,
- dayDate: dayDate,
- sessionId: sessionId,
- contributionId: contributionId
- },
- success: function(resp){
- contribution=resp;
- }
- });
- return new Contribution(contribution);
-
-}
-
$('#addContributionToAgenda').live('click', function(event) {
if(!window.localStorage) {
alert('Your browser is not compatible');
View
221 static/js/getFromDB.js
@@ -0,0 +1,221 @@
+getDays = function(eventId){
+ var days;
+ $.ajax({
+ type : "GET",
+ url : "/eventDays",
+ dataType : "json",
+ async: false,
+ data : {
+ eventID: eventId,
+ },
+ success: function(resp){
+ days=resp;
+ }
+ });
+ console.log(days)
+ return new Days(days);
+
+};
+
+getDaySessions = function(eventId, day){
+ var sessions;
+ $.ajax({
+ type : "GET",
+ url : "/daySessions",
+ dataType : "json",
+ async: false,
+ data : {
+ eventID: eventId,
+ day: day
+ },
+ success: function(resp){
+ sessions=resp;
+ }
+ });
+ return new Slots(sessions);
+};
+
+getSessionContributions = function(eventId, day, sessionId){
+ var contributions;
+ $.ajax({
+ type : "GET",
+ url : "/sessionContributions",
+ dataType : "json",
+ async: false,
+ data : {
+ eventID: eventId,
+ day: day,
+ sessionId: sessionId
+ },
+ success: function(resp){
+ contributions=resp;
+ }
+ });
+ return new Contributions(contributions);
+
+};
+
+getEventContributions = function(eventId){
+ var contributions;
+ $.ajax({
+ type : "GET",
+ url : "/eventContributions",
+ dataType : "json",
+ async: false,
+ data : {
+ eventID: eventId
+ },
+ success: function(resp){
+ contributions=resp;
+ }
+ });
+ return new Contributions(contributions);
+
+};
+
+getEventSessions = function(eventId){
+ var sessions;
+ $.ajax({
+ type : "GET",
+ url : "/eventSessions",
+ dataType : "json",
+ async: false,
+ data : {
+ eventID: eventId
+ },
+ success: function(resp){
+ sessions=resp;
+ }
+ });
+ return new Slots(sessions);
+
+};
+
+getDay = function(eventId, dayDate){
+ var day;
+ $.ajax({
+ type : "GET",
+ url : "/eventDay",
+ dataType : "json",
+ async: false,
+ data : {
+ eventID: eventId,
+ dayDate: dayDate
+ },
+ success: function(resp){
+ day=resp;
+ }
+ });
+ return new Day(day);
+
+}
+
+getEvent = function(eventId){
+ console.log(eventId)
+ var event;
+ $.ajax({
+ type : "GET",
+ url : "/eventInfo",
+ dataType : "json",
+ async: false,
+ data : {
+ eventID: eventId,
+ },
+ success: function(resp){
+ event=resp;
+ }
+ });
+ return new Event(event);
+
+}
+
+getSession = function(eventId, dayDate, sessionId){
+ var session;
+ $.ajax({
+ type : "GET",
+ url : "/eventSession",
+ dataType : "json",
+ async: false,
+ data : {
+ eventID: eventId,
+ dayDate: dayDate,
+ sessionId: sessionId
+ },
+ success: function(resp){
+ session=resp;
+ }
+ });
+ return new Slot(session);
+
+}
+
+getContribution = function(eventId, dayDate, sessionId, contributionId){
+ var contribution;
+ $.ajax({
+ type : "GET",
+ url : "/eventContribution",
+ dataType : "json",
+ async: false,
+ data : {
+ eventID: eventId,
+ dayDate: dayDate,
+ sessionId: sessionId,
+ contributionId: contributionId
+ },
+ success: function(resp){
+ contribution=resp;
+ }
+ });
+ return new Contribution(contribution);
+
+}
+
+isSessionInAgenda = function(sessionId, eventId, dayDate){
+ var myAgendaContributions = loadAgendaContributions();
+ var myAgendaSessions = loadAgendaSessions();
+
+ var contribInAgenda = myAgendaContributions.filter(function(contrib){
+ return contrib.get('eventId')==eventId && contrib.get('sessionId')==sessionId && contrib.get('dayDate') == dayDate;
+ });
+
+ var sessionInAgenda = myAgendaSessions.find(function(session){
+ return session.get('sessionId')==sessionId && session.get('eventId')==eventId && session.get('dayDate')==dayDate;
+ });
+
+ var session = getSession(eventId, dayDate, sessionId);
+
+ if (contribInAgenda.length == session.get('numContributions') && sessionInAgenda){
+ return true;
+ }
+ else{
+ return false;
+ }
+};
+
+isEventInAgenda = function(eventId){
+ var myAgendaContributions = loadAgendaContributions();
+ var myAgendaSessions = loadAgendaSessions();
+
+ var contribInAgenda = myAgendaContributions.filter(function(contrib){
+ return contrib.get('eventId')==eventId;
+ });
+
+ var sessionsInAgenda = myAgendaSessions.filter(function(session){
+ return session.get('eventId')==eventId;
+ });
+
+ var event = getEvent(eventId);
+
+ if (contribInAgenda.length == event.get('numContributions') &&
+ sessionsInAgenda.length == event.get('numSessions')){
+ if (contribInAgenda.length == 0 && sessionsInAgenda.length==0){
+ return false;
+ }
+ else{
+ return true;
+ }
+ }
+ else{
+ return false;
+ }
+};
View
49 static/js/loadAgenda.js
@@ -1,21 +1,3 @@
-loadAgenda = function(){
- var myAgenda = null;
- if(localStorage.getItem('agenda')) {
- myAgenda = new Days(JSON.parse(localStorage.getItem('agenda')));
- myAgenda.each(function(event){
- event.set('days', new Days(event.get('days')));
- event.get('days').each(function(day) {
- day.set('slots', new Slots(day.get('slots')));
- day.get('slots').each(function(slot) {
- var tempContribs = new Contributions();
- slot.set('contributions', new Contributions(slot.get('contributions')));
- });
- });
- });
- }
- return myAgenda;
-}
-
loadAgendaContributions = function(){
var myAgendaContributions = new Contributions();
if(localStorage.getItem('contributions')) {
@@ -55,34 +37,3 @@ loadHistory = function(){
}
return myHistory;
}
-
-loadAgendaFromServer = function(){
- var agenda;
- $.ajax({
- type : "GET",
- url : "/load",
- dataType : "json",
- async: false,
- data : {
- name:'claude'
- },
- success: function(resp){
- agenda=resp['agenda'];
- }
- });
-
- if(agenda) {
- var myAgenda = new Days(agenda);
- myAgenda.each(function(event){
- event.set('days', new Days(event.get('days')));
- event.get('days').each(function(day) {
- day.set('slots', new Slots(day.get('slots')));
- day.get('slots').each(function(slot) {
- var tempContribs = new Contributions();
- slot.set('contributions', new Contributions(slot.get('contributions')));
- });
- });
- });
- }
- return myAgenda;
-}
View
31 static/js/view/EventsListView.js
@@ -73,33 +73,4 @@ var EventsListView = Backbone.View.extend({
return this;
}
-});
-
-
-isEventInAgenda = function(eventId){
- var myAgendaContributions = loadAgendaContributions();
- var myAgendaSessions = loadAgendaSessions();
-
- var contribInAgenda = myAgendaContributions.filter(function(contrib){
- return contrib.get('eventId')==eventId;
- });
-
- var sessionsInAgenda = myAgendaSessions.filter(function(session){
- return session.get('eventId')==eventId;
- });
-
- var event = getEvent(eventId);
-
- if (contribInAgenda.length == event.get('numContributions') &&
- sessionsInAgenda.length == event.get('numSessions')){
- if (contribInAgenda.length == 0 && sessionsInAgenda.length==0){
- return false;
- }
- else{
- return true;
- }
- }
- else{
- return false;
- }
-};
+});
View
55 static/js/view/HistoryListView.js
@@ -24,47 +24,24 @@ var HistoryListView = Backbone.View.extend({
};
events.sort();
var dates = [];
- events.each(function(event){
- var date = new Date(parseInt(event.get('viewedAt')));
- listView.append('<li data-role="list-divider">'+date+'</li>');
+ if (events.size()>0){
+ events.each(function(event){
+ var date = new Date(parseInt(event.get('viewedAt')));
+ listView.append('<li data-role="list-divider">'+date+'</li>');
- if (isEventInAgenda(event.get('id'))){
- listView.append(template2(event));
- }
- else{
- listView.append(template1(event));
- }
- });
- container.html(listView);
- container.trigger('create');
- return this;
- }
-});
-
-isEventInAgenda = function(eventId){
- var myAgendaContributions = loadAgendaContributions();
- var myAgendaSessions = loadAgendaSessions();
-
- var contribInAgenda = myAgendaContributions.filter(function(contrib){
- return contrib.get('eventId')==eventId;
- });
-
- var sessionsInAgenda = myAgendaSessions.filter(function(session){
- return session.get('eventId')==eventId;
- });
-
- var event = getEvent(eventId);
-
- if (contribInAgenda.length == event.get('numContributions') &&
- sessionsInAgenda.length == event.get('numSessions')){
- if (contribInAgenda.length == 0 && sessionsInAgenda.length==0){
- return false;
+ if (isEventInAgenda(event.get('id'))){
+ listView.append(template2(event));
+ }
+ else{
+ listView.append(template1(event));
+ }
+ });
+ container.html(listView);
}
else{
- return true;
+ container.html('<h4>No history yet.</h4>');
}
+ container.trigger('create');
+ return this;
}
- else{
- return false;
- }
-};
+});
View
33 static/js/view/RecentEventsView.js
@@ -19,8 +19,7 @@ var RecentEventsView = Backbone.View.extend({
template1 = this.template1,
template2 = this.template2,
part = this.options.part,
- listView = $(this.el),
- myAgenda=loadAgenda();
+ listView = $(this.el);
if (events==null){
container.html('<h3>No future events for the moment.</h3>');
@@ -77,32 +76,4 @@ var RecentEventsView = Backbone.View.extend({
container.trigger('create');
return this;
}
-});
-
-isEventInAgenda = function(eventId){
- var myAgendaContributions = loadAgendaContributions();
- var myAgendaSessions = loadAgendaSessions();
-
- var contribInAgenda = myAgendaContributions.filter(function(contrib){
- return contrib.get('eventId')==eventId;
- });
-
- var sessionsInAgenda = myAgendaSessions.filter(function(session){
- return session.get('eventId')==eventId;
- });
-
- var event = getEvent(eventId);
-
- if (contribInAgenda.length == event.get('numContributions') &&
- sessionsInAgenda.length == event.get('numSessions')){
- if (contribInAgenda.length == 0 && sessionsInAgenda.length==0){
- return false;
- }
- else{
- return true;
- }
- }
- else{
- return false;
- }
-};
+});
View
22 static/js/view/SlotsView.js
@@ -70,25 +70,3 @@ var SlotsView = Backbone.View.extend({
return this;
}
});
-
-isSessionInAgenda = function(sessionId, eventId, dayDate){
- var myAgendaContributions = loadAgendaContributions();
- var myAgendaSessions = loadAgendaSessions();
-
- var contribInAgenda = myAgendaContributions.filter(function(contrib){
- return contrib.get('eventId')==eventId && contrib.get('sessionId')==sessionId && contrib.get('dayDate') == dayDate;
- });
-
- var sessionInAgenda = myAgendaSessions.find(function(session){
- return session.get('sessionId')==sessionId && session.get('eventId')==eventId && session.get('dayDate')==dayDate;
- });
-
- var session = getSession(eventId, dayDate, sessionId);
-
- if (contribInAgenda.length == session.get('numContributions') && sessionInAgenda){
- return true;
- }
- else{
- return false;
- }
-};
View
1  templates/agendaEvent.html
@@ -15,6 +15,7 @@
<script src="{{url_for('static',filename='js/view/AgendaDaysDetailView.js')}}"></script>
<script src="{{url_for('static',filename='js/view/AgendaContributionView.js')}}"></script>
<script src="{{url_for('static',filename='js/view/AgendaEventsListView.js')}}"></script>
+ <script src="{{url_for('static',filename='js/getFromDB.js')}}"></script>
<script src="{{url_for('static',filename='js/clickEvents.js')}}"></script>
<script src="{{url_for('static',filename='js/loadAgenda.js')}}"></script>
<script src="{{url_for('static',filename='js/editAgenda.js')}}"></script>
View
1  templates/events.html
@@ -16,6 +16,7 @@
<script src="{{url_for('static',filename='js/view/ContributionView.js')}}"></script>
<script src="{{url_for('static',filename='js/view/EventsListView.js')}}"></script>
<script src="{{url_for('static',filename='js/view/RecentEventsView.js')}}"></script>
+ <script src="{{url_for('static',filename='js/getFromDB.js')}}"></script>
<script src="{{url_for('static',filename='js/clickEvents.js')}}"></script>
<script src="{{url_for('static',filename='js/loadAgenda.js')}}"></script>
<script src="{{url_for('static',filename='js/editAgenda.js')}}"></script>
View
1  templates/history.html
@@ -15,6 +15,7 @@
<script src="{{url_for('static',filename='js/view/DaysDetailView.js')}}"></script>
<script src="{{url_for('static',filename='js/view/ContributionView.js')}}"></script>
<script src="{{url_for('static',filename='js/view/HistoryListView.js')}}"></script>
+ <script src="{{url_for('static',filename='js/getFromDB.js')}}"></script>
<script src="{{url_for('static',filename='js/clickEvents.js')}}"></script>
<script src="{{url_for('static',filename='js/loadAgenda.js')}}"></script>
<script src="{{url_for('static',filename='js/editAgenda.js')}}"></script>
View
1  templates/search.html
@@ -16,6 +16,7 @@
<script src="{{url_for('static',filename='js/view/ContributionView.js')}}"></script>
<script src="{{url_for('static',filename='js/view/EventsListView.js')}}"></script>
<script src="{{url_for('static',filename='js/view/RecentEventsView.js')}}"></script>
+ <script src="{{url_for('static',filename='js/getFromDB.js')}}"></script>
<script src="{{url_for('static',filename='js/clickEvents.js')}}"></script>
<script src="{{url_for('static',filename='js/loadAgenda.js')}}"></script>
<script src="{{url_for('static',filename='js/editAgenda.js')}}"></script>
Please sign in to comment.
Something went wrong with that request. Please try again.