[gen] Calendar: display weekend days in a special way.
This commit is contained in:
		
							parent
							
								
									614ce576af
								
							
						
					
					
						commit
						ba148c51aa
					
				
					 6 changed files with 26 additions and 11 deletions
				
			
		|  | @ -141,6 +141,7 @@ class Calendar(Type): | |||
| 
 | ||||
|     def getEventsAt(self, obj, date, asDict=True): | ||||
|         '''Returns the list of events that exist at some p_date (=day).''' | ||||
|         obj = obj.o # Ensure p_obj is not a wrapper. | ||||
|         if not hasattr(obj, self.name): return | ||||
|         years = getattr(obj, self.name) | ||||
|         year = date.year() | ||||
|  | @ -267,4 +268,18 @@ class Calendar(Type): | |||
|             return self.createEvent(obj, DateTime(rq['day'])) | ||||
|         elif action == 'deleteEvent': | ||||
|             return self.deleteEvent(obj, DateTime(rq['day'])) | ||||
| 
 | ||||
|     def getCellStyle(self, obj, date, today): | ||||
|         '''What CSS classes must apply to the table cell representing p_date | ||||
|            in the calendar?''' | ||||
|         res = [] | ||||
|         # We must distinguish between past and future dates. | ||||
|         if date < today: | ||||
|             res.append('even') | ||||
|         else: | ||||
|             res.append('odd') | ||||
|         # Week-end days must have a specific style. | ||||
|         if date.aDay() in ('Sat', 'Sun'): | ||||
|             res.append('cellDashed') | ||||
|         return ' '.join(res) | ||||
| # ------------------------------------------------------------------------------ | ||||
|  |  | |||
|  | @ -570,11 +570,8 @@ class ToolClassDescriptor(ClassDescriptor): | |||
|         groupName = classDescr.klass.__name__ | ||||
|         # Adds a field allowing to show/hide completely any workflow-related | ||||
|         # information for a given class. | ||||
|         defaultValue = False | ||||
|         if classDescr.isRoot() or issubclass(classDescr.klass, ModelClass): | ||||
|             defaultValue = True | ||||
|         fieldName = 'showWorkflowFor%s' % className | ||||
|         fieldType = gen.Boolean(default=defaultValue, page='userInterface', | ||||
|         fieldType = gen.Boolean(default=True, page='userInterface', | ||||
|                                 group=groupName) | ||||
|         self.addField(fieldName, fieldType) | ||||
|         # Adds the boolean field for showing all states in current state or not. | ||||
|  |  | |||
|  | @ -9,7 +9,7 @@ import appy.gen as gen | |||
| from appy.gen.utils import * | ||||
| from appy.gen.layout import Table, defaultPageLayouts | ||||
| from appy.gen.descriptors import WorkflowDescriptor, ClassDescriptor | ||||
| from appy.shared.utils import sequenceTypes | ||||
| from appy.shared.utils import sequenceTypes, normalizeText | ||||
| from appy.shared.data import rtlLanguages | ||||
| 
 | ||||
| # ------------------------------------------------------------------------------ | ||||
|  | @ -1215,7 +1215,7 @@ class BaseMixin: | |||
| 
 | ||||
|     def SortableTitle(self): | ||||
|         '''Returns the title as must be stored in index "SortableTitle".''' | ||||
|         return self.Title() | ||||
|         return normalizeText(self.Title()) | ||||
| 
 | ||||
|     def SearchableText(self): | ||||
|         '''This method concatenates the content of every field with | ||||
|  |  | |||
|  | @ -97,6 +97,7 @@ img { border: 0; vertical-align: middle} | |||
|            border-bottom: 2px solid grey; padding: 2px 2px;} | ||||
| .grid td { padding-right: 5px; } | ||||
| .cellGap { padding-right: 0.4em; } | ||||
| .cellDashed { border: 1px dashed grey !important } | ||||
| .noStyle { border: 0 !important; padding: 0 !important; margin: 0 !important; } | ||||
| .noStyle td { border:0 !important; padding:0 !important; margin:0 !important; } | ||||
| .translationLabel { background-color: #EAEAEA; border-bottom: 1px dashed grey; | ||||
|  |  | |||
|  | @ -61,10 +61,10 @@ | |||
|    <tal:cell repeat="date row"> | ||||
|     <tal:cel define="tooEarly python: startDate and (date < startDate); | ||||
|                      tooLate python: endDate and not tooEarly and (date > endDate); | ||||
|                      inRange python: not tooEarly and not tooLate"> | ||||
|                      inRange python: not tooEarly and not tooLate; | ||||
|                      cssClasses python: contextObj.callField(fieldName, 'getCellStyle', contextObj, date, today)"> | ||||
|      <tal:comment replace="nothing">Dump an empty cell if we are out of the supported date range</tal:comment> | ||||
|      <td tal:condition="not: inRange" | ||||
|          tal:attributes="class python: test(date < today, 'even', 'odd');"> | ||||
|      <td tal:condition="not: inRange" tal:attributes="class cssClasses"> | ||||
|      </td> | ||||
|      <tal:comment replace="nothing">Dump a normal cell if we are in range</tal:comment> | ||||
|      <tal:td condition="inRange"> | ||||
|  | @ -73,7 +73,7 @@ | |||
|                      mayCreate python: mayEdit and not events; | ||||
|                      mayDelete python: mayEdit and events;" | ||||
|          tal:attributes="style python: test(date.isCurrentDay(), 'font-weight:bold', 'font-weight:normal'); | ||||
|                          class python: test(date < today, 'even', 'odd'); | ||||
|                          class cssClasses; | ||||
|                          onmouseover python: test(mayEdit, 'this.getElementsByTagName(\'img\')[0].style.visibility=\'visible\'', ''); | ||||
|                          onmouseout python: test(mayEdit, 'this.getElementsByTagName(\'img\')[0].style.visibility=\'hidden\'', '')"> | ||||
|       <tal:day define="day date/day; | ||||
|  |  | |||
|  | @ -94,7 +94,9 @@ class AbstractWrapper(object): | |||
|         '''Gets the attribute named p_name. Lot of cheating here.''' | ||||
|         if name == 'o': return object.__getattribute__(self, name) | ||||
|         elif name == 'tool': return self.o.getTool().appy() | ||||
|         elif name == 'request': return self.o.REQUEST | ||||
|         elif name == 'request': | ||||
|             # The request may not be present, ie if we are at Zope startup. | ||||
|             return getattr(self.o, 'REQUEST', None) | ||||
|         elif name == 'session': return self.o.REQUEST.SESSION | ||||
|         elif name == 'typeName': return self.__class__.__bases__[-1].__name__ | ||||
|         elif name == 'id': return self.o.id | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Gaetan Delannay
						Gaetan Delannay