diff --git a/gen/calendar.py b/gen/calendar.py index f37d82f..c89b3d4 100644 --- a/gen/calendar.py +++ b/gen/calendar.py @@ -409,16 +409,16 @@ class Calendar(Type): self.createEvent(obj, date, handleEventSpan=False) def deleteEvent(self, obj, date, handleEventSpan=True): - '''Deletes an event. It actually deletes all events at rq['day']. + '''Deletes an event. It actually deletes all events at p_date. If p_handleEventSpan is True, we will use rq["deleteNext"] to delete successive events, too.''' obj = obj.o # Ensure p_obj is not a wrapper. - rq = obj.REQUEST if not self.getEventsAt(obj, date): return daysDict = getattr(obj, self.name)[date.year()][date.month()] # Remember events, in case we must delete similar ones for next days. events = self.getEventsAt(obj, date) del daysDict[date.day()] + rq = obj.REQUEST if handleEventSpan and rq.has_key('deleteNext') and \ (rq['deleteNext'] == 'True'): while True: diff --git a/gen/mixins/__init__.py b/gen/mixins/__init__.py index d957680..c3b33a6 100644 --- a/gen/mixins/__init__.py +++ b/gen/mixins/__init__.py @@ -1476,6 +1476,19 @@ class BaseMixin: return stateShow(self.getWorkflow(), self.appy()) return stateShow + def showTransitions(self, layoutType): + '''Must we show the buttons/icons for triggering transitions on + p_layoutType?''' + # Never show transitions on edit pages. + if layoutType == 'edit': return + # Use the default value if self's class does not specify it. + klass = self.getClass() + if not hasattr(klass, 'showTransitions'): return (layoutType=='view') + showValue = klass.showTransitions + # This value can be a single value or a tuple/list of values. + if isinstance(showValue, basestring): return layoutType == showValue + return layoutType in showValue + def _appy_listStates(self): '''Lists the possible states for this object.''' res = [] diff --git a/gen/ui/appy.css b/gen/ui/appy.css index fb05f4b..9d16fa7 100644 --- a/gen/ui/appy.css +++ b/gen/ui/appy.css @@ -21,7 +21,7 @@ input[type=checkbox] { border: 0; background: none; cursor: pointer } input[type=radio] { border: 0; background: none; cursor: pointer } input[type=file] { border: 0px solid #d0d0d0; background-color: #f8f8f8; cursor: pointer } -input[type=button] { border: 1px solid #d0d0d0; +input[type=button] { border: 1px solid #d0d0d0; margin: 0 3px; background-color: #f8f8f8; cursor: pointer } input[type=submit] { border: 1px solid #d0d0d0; background-color: #f8f8f8; cursor: pointer } diff --git a/gen/ui/appy.js b/gen/ui/appy.js index c9ea01b..b94443f 100644 --- a/gen/ui/appy.js +++ b/gen/ui/appy.js @@ -353,14 +353,14 @@ function submitAppyForm(button) { } // Function used for triggering a workflow transition -function triggerTransition(transitionId, msg) { - var theForm = document.getElementById('triggerTransitionForm'); +function triggerTransition(formId, transitionId, msg) { + var theForm = document.getElementById(formId); theForm.workflow_action.value = transitionId; if (!msg) { theForm.submit(); } else { // Ask the user to confirm. - askConfirm('form', 'triggerTransitionForm', msg, true); + askConfirm('form', formId, msg, true); } } diff --git a/gen/ui/page.pt b/gen/ui/page.pt index 265c937..1f9d9c1 100644 --- a/gen/ui/page.pt +++ b/gen/ui/page.pt @@ -146,10 +146,10 @@ This macro displays an object's transitions(s). It is used by macro "header" below. -
+ @@ -161,7 +161,7 @@ Real button + onClick python: 'triggerTransition(\'%s\',\'%s\',\'%s\')' % (formId,transition['name'],transition['confirm'])"/> Fake button, explaining why the transition can't be triggered
Workflow transitions -
diff --git a/gen/ui/widgets/ref.pt b/gen/ui/widgets/ref.pt index c21e569..1a476ca 100644 --- a/gen/ui/widgets/ref.pt +++ b/gen/ui/widgets/ref.pt @@ -23,6 +23,12 @@
+
+ Workflow transitions + Edit
+ + + +