Skip to content

Commit

Permalink
Merge 28e2b1d into 9ca983a
Browse files Browse the repository at this point in the history
  • Loading branch information
deiferni committed Oct 28, 2013
2 parents 9ca983a + 28e2b1d commit ff37f32
Show file tree
Hide file tree
Showing 16 changed files with 942 additions and 710 deletions.
9 changes: 9 additions & 0 deletions seantis/reservation/css/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,15 @@ body .event-unavailable .fc-event-time {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAMAAACelLz8AAAAOVBMVEXY2Nj////d7h7d7h7d7h7d7h7///////////////////////////////////////////////////+4yo5sAAAAQklEQVQoke3LqQ3AMADAQKP8b/cftjjAUgaI6cmEmHKprY+59seRSkAlopJQyagUVCoqDZWOykBlorJQ2aj48+Rafr0hD9knm0tJAAAAAElFTkSuQmCC);
background-repeat: repeat;
border: solid #ccc 1px;
color: #444;
padding-left: .2em;
padding-right: .2em;
}

.calendar-blocked {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAMAAACelLz8AAAAOVBMVEXY2Nj////d7h7d7h7d7h7d7h7///////////////////////////////////////////////////+4yo5sAAAAQklEQVQoke3LqQ3AMADAQKP8b/cftjjAUgaI6cmEmHKprY+59seRSkAlopJQyagUVCoqDZWOykBlorJQ2aj48+Rafr0hD9knm0tJAAAAAElFTkSuQmCC);
background-repeat: repeat;
border: solid #ccc 1px;
}

.calendar-blocked {
Expand Down
21 changes: 15 additions & 6 deletions seantis/reservation/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@
AffectedPendingReservationError,
AffectedReservationError,
AlreadyReservedError,
InvalidAllocationError,
InvalidQuota,
InvalidReservationError,
InvalidReservationToken,
NoRecurringReservationError,
NoReservedSlotsLeftError,
NotReservableError,
OverlappingAllocationError,
ReservationTooLong,
Expand All @@ -37,11 +43,12 @@
QuotaOverLimit,
InvalidQuota,
QuotaImpossible,
InvalidAllocationError,
QuotaOverLimit,
ReservationOutOfBounds,
NoRecurringReservationError,
NoReservedSlotsLeftError,
ReservationParametersInvalid,
ReservationTooLong,
UnblockableAlreadyReservedError,

)
from seantis.reservation.session import serialized
from seantis.reservation.raster import rasterize_span, MIN_RASTER_VALUE
Expand Down Expand Up @@ -914,7 +921,7 @@ def _reserve_sanity_check(self, dates, quota):
raise ReservationOutOfBounds

def _create_reservation(self, email, dates, group, data, session_id,
quota, rrule, token):
quota, rrule, token, description):
reservation = None
# groups are reserved by group-identifier - so all members of a group
# or none of them. As such there's no start / end date which is defined
Expand Down Expand Up @@ -974,11 +981,12 @@ def _create_reservation(self, email, dates, group, data, session_id,
reservation.session_id = session_id
reservation.data = data
reservation.resource = self.uuid
reservation.description = description
return reservation

@serialized
def reserve(self, email, dates=None, group=None, data=None,
session_id=None, quota=1, rrule=None):
session_id=None, quota=1, rrule=None, description=None):
""" First step of the reservation.
Seantis.reservation uses a two-step reservation process. The first
Expand All @@ -1005,7 +1013,8 @@ def reserve(self, email, dates=None, group=None, data=None,

self._reserve_sanity_check(dates, quota)
reservation = self._create_reservation(email, dates, group, data,
session_id, quota, rrule, token)
session_id, quota, rrule, token,
description)
if reservation:
Session.add(reservation)
notify(ReservationMadeEvent(reservation, self.language))
Expand Down
8 changes: 4 additions & 4 deletions seantis/reservation/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,14 @@ class UnblockableAlreadyReservedError(ReservationError):
InvalidAllocationError:
_(u'The resulting allocation would be invalid'),

UnblockableAlreadyReservedError:
_(u"Can't block period because a reservation already exists."),

NoRecurringReservationError:
_('This is not a recurring reservation'),

NoReservedSlotsLeftError:
_('No reserved slots would be left after this operation'),

UnblockableAlreadyReservedError:
_(u"Can't block period because a reservation already exists."),
_('No reserved slots would be left after this operation')
}

if HAS_PSYCOPG2:
Expand Down
24 changes: 9 additions & 15 deletions seantis/reservation/form.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,26 @@
from datetime import datetime
from functools import wraps

from Products.CMFPlone.utils import safe_unicode
from five import grok
from functools import wraps
from plone.directives import form
from plone.memoize import instance
from plone.memoize import view
from plone.z3cform.fieldsets import utils as z3cutils
from zope.component import getMultiAdapter
from z3c.form import interfaces
from sqlalchemy import null
from z3c.form import field
from z3c.form import interfaces
from z3c.form.group import GroupForm
from z3c.form.interfaces import IDataConverter
from zope.browserpage.viewpagetemplatefile import ViewPageTemplateFile

from sqlalchemy import null
from zope.component import getMultiAdapter
from zope.component.hooks import getSite
from zope.i18n import translate

from seantis.reservation import _
from seantis.reservation import utils
from seantis.reservation.models import Allocation, Reservation
from seantis.reservation.interfaces import IResourceBase


from zope.browserpage.viewpagetemplatefile import ViewPageTemplateFile
from plone.z3cform.fieldsets import utils as z3cutils
from zope.component.hooks import getSite
from zope.i18n import translate
from plone.memoize import instance
from Products.CMFPlone.utils import safe_unicode
from z3c.form.interfaces import IDataConverter
from seantis.reservation.models import Allocation, Reservation


def extract_action_data(fn):
Expand Down
6 changes: 6 additions & 0 deletions seantis/reservation/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,12 @@ class IReservation(Interface):
required=True
)

description = schema.TextLine(
title=_(u'Description'),
description=_('Visible on the calendar'),
required=False,
)

recurrence = schema.Text(
title=_(u'Recurrence'),
required=False,
Expand Down
19 changes: 12 additions & 7 deletions seantis/reservation/js/calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,20 +198,25 @@ var CalendarGroups = function() {
}

var free = _.template('<div style="height:<%= height %>%;"></div>');
var reserved = _.template('<div style="height:<%= height %>%;" class="calendar-occupied"></div>');
var reserved = _.template('<div style="height:<%= height %>%;" class="calendar-occupied"><%= name %></div>');
var blocked = _.template('<div style="height:<%= height %>%;" class="calendar-blocked"></div>');
var partition_block = _.template('<div style="height:<%= height %>px;"><%= partitions %></div>');

// build the individual partitions
var partitions = '';

_.each(event.partitions, function(partition) {
var partition_type = partition[1];
if (partition_type === 'reserved') {
partitions += reserved({height: partition[0]});
} else if (partition_type === 'blocked') {
partitions += blocked({height: partition[0]});
} else {
partitions += free({height: partition[0]});
var height = partition[0];
var name;
if (partition_type === null) {
partitions += free({height: height});
} else if (partition_type[0] === 'reserved') {
name = partition_type[1] ? partition_type[1] : '';
partitions += reserved({height: height,
name: name});
} else if (partition_type[0] === 'blocked') {
partitions += blocked({height: height});
}
});

Expand Down

0 comments on commit ff37f32

Please sign in to comment.