- Timestamp:
- 13 Nov 2014, 14:40:27 (10 years ago)
- Location:
- main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba
- Files:
-
- 14 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/widgets/__init__.py
r7817 r11949 1 """JS-driven widgets for Kofa.1 """JS-driven widgets for Ikoba. 2 2 """ -
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/widgets/datetimewidget.py
r8944 r11949 26 26 from zope.formlib.interfaces import ConversionError 27 27 from zope.formlib.textwidgets import DatetimeWidget 28 from waeup. kofa.utils.helpers import to_timezone29 from waeup. kofa.interfaces import IKofaUtils28 from waeup.ikoba.utils.helpers import to_timezone 29 from waeup.ikoba.interfaces import IIkobaUtils 30 30 31 31 class _DummyUtils(object): 32 32 tzinfo = pytz.utc 33 33 34 # A fallback, if no I KofaUtils can be found34 # A fallback, if no IIkobaUtils can be found 35 35 _DUMMY_UTILS = _DummyUtils() 36 36 … … 85 85 return value 86 86 if value.tzinfo is None: 87 utils = queryUtility(I KofaUtils, default=_DUMMY_UTILS)87 utils = queryUtility(IIkobaUtils, default=_DUMMY_UTILS) 88 88 value = utils.tzinfo.localize(value) 89 89 return value.astimezone(pytz.utc) -
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/widgets/datewidget.py
r9498 r11949 26 26 from zope.formlib.widget import renderElement, CustomWidgetFactory 27 27 from zope.interface import implements 28 from waeup. kofa.interfaces import IKofaUtils29 from waeup. kofa.utils.helpers import to_timezone28 from waeup.ikoba.interfaces import IIkobaUtils 29 from waeup.ikoba.utils.helpers import to_timezone 30 30 31 31 … … 82 82 If the widget is bound to a schema field with respective 83 83 attributes, it reads its `show_year` and `date_format` attributes 84 (see waeup. kofa.schema.FormattedDate for an example) and sets a84 (see waeup.ikoba.schema.FormattedDate for an example) and sets a 85 85 CSS tag according to these values. 86 86 … … 141 141 It can also be used for displaying datetimes. If used to display a 142 142 datetime (not a date), the widget returns local datetime with 143 timezone set according to KofaUtils.143 timezone set according to IkobaUtils. 144 144 """ 145 145 date_format = '%Y-%m-%d' … … 167 167 # shift value to local timezone 168 168 tz = pytz.utc 169 utils = queryUtility(I KofaUtils)169 utils = queryUtility(IIkobaUtils) 170 170 if utils is not None: 171 171 tz = utils.tzinfo -
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/widgets/htmlwidget.py
r8361 r11949 20 20 from zope.component import getUtility 21 21 from zope.formlib.widget import renderElement, DisplayWidget 22 from waeup. kofa.interfaces import IKofaUtils22 from waeup.ikoba.interfaces import IIkobaUtils 23 23 24 24 … … 35 35 language separator - usually the first part has no language 36 36 descriptor - are interpreted as texts in the portal's language. 37 The latter can be configured in waeup.srp.utils.utils. KofaUtils.37 The latter can be configured in waeup.srp.utils.utils.IkobaUtils. 38 38 """ 39 39 if self._renderedValueSet(): … … 45 45 parts = value.split('>>') 46 46 elements = {} 47 lang = getUtility(I KofaUtils).PORTAL_LANGUAGE47 lang = getUtility(IIkobaUtils).PORTAL_LANGUAGE 48 48 for part in parts: 49 49 if part[2:4] == u'<<': -
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/widgets/objectwidget.py
r7819 r11949 25 25 from zope.schema import getFieldNamesInOrder 26 26 27 class KofaObjectWidgetView(ObjectWidgetView):27 class IkobaObjectWidgetView(ObjectWidgetView): 28 28 template = ViewPageTemplateFile('objectwidget.pt') 29 29 30 class KofaObjectWidget(ObjectWidget):30 class IkobaObjectWidget(ObjectWidget): 31 31 32 32 def __init__(self, context, request, factory, **kw): … … 58 58 59 59 def _getView(self, request): 60 return KofaObjectWidgetView(self, request)60 return IkobaObjectWidgetView(self, request) 61 61 62 62 63 class KofaObjectDisplayWidget(KofaObjectWidget):63 class IkobaObjectDisplayWidget(IkobaObjectWidget): 64 64 65 65 implementsOnly(IDisplayWidget) -
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/widgets/overrides.zcml
r8200 r11949 5 5 zope.publisher.interfaces.browser.IBrowserRequest" 6 6 provides="zope.formlib.interfaces.ISimpleInputWidget" 7 factory="waeup. kofa.widgets.datewidget.FormattedDateWidget"7 factory="waeup.ikoba.widgets.datewidget.FormattedDateWidget" 8 8 permission="zope.Public" 9 9 /> 10 10 11 11 <adapter 12 for="waeup. kofa.schema.interfaces.IFormattedDate12 for="waeup.ikoba.schema.interfaces.IFormattedDate 13 13 zope.publisher.interfaces.browser.IBrowserRequest" 14 14 provides="zope.formlib.interfaces.ISimpleInputWidget" 15 factory="waeup. kofa.widgets.datewidget.DateLEWidget"15 factory="waeup.ikoba.widgets.datewidget.DateLEWidget" 16 16 permission="zope.Public" 17 17 /> 18 18 19 19 <adapter 20 for="waeup. kofa.schema.interfaces.IFormattedDate20 for="waeup.ikoba.schema.interfaces.IFormattedDate 21 21 zope.publisher.interfaces.browser.IBrowserRequest" 22 22 provides="zope.formlib.interfaces.IDisplayWidget" 23 factory="waeup. kofa.widgets.datewidget.DateLEDisplayWidget"23 factory="waeup.ikoba.widgets.datewidget.DateLEDisplayWidget" 24 24 permission="zope.Public" 25 25 /> … … 27 27 <!-- Register edit widget for PhoneNumbers --> 28 28 <adapter 29 for="waeup. kofa.schema.interfaces.IPhoneNumber29 for="waeup.ikoba.schema.interfaces.IPhoneNumber 30 30 zope.publisher.interfaces.browser.IBrowserRequest" 31 31 provides="zope.formlib.interfaces.ISimpleInputWidget" 32 factory="waeup. kofa.widgets.phonewidget.PhoneWidget"32 factory="waeup.ikoba.widgets.phonewidget.PhoneWidget" 33 33 permission="zope.Public" 34 34 /> … … 39 39 zope.publisher.interfaces.browser.IBrowserRequest" 40 40 provides="zope.formlib.interfaces.ISimpleInputWidget" 41 factory="waeup. kofa.widgets.datetimewidget.PytzDatetimeWidget"41 factory="waeup.ikoba.widgets.datetimewidget.PytzDatetimeWidget" 42 42 permission="zope.Public" 43 43 /> -
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/widgets/phonewidget.py
r11254 r11949 26 26 from zope.formlib.textwidgets import ( 27 27 TextWidget, renderElement, ConversionError) 28 from waeup. kofa.interfaces import IKofaUtils29 from waeup. kofa.interfaces import MessageFactory as _30 from waeup. kofa.utils.utils import KofaUtils28 from waeup.ikoba.interfaces import IIkobaUtils 29 from waeup.ikoba.interfaces import MessageFactory as _ 30 from waeup.ikoba.utils.utils import IkobaUtils 31 31 32 32 RE_INT_PREFIX = re.compile('^\+\d+') … … 41 41 def _renderPrefixWidget(self, value): 42 42 prefix_func = getattr( 43 queryUtility(I KofaUtils), 'sorted_phone_prefixes',44 KofaUtils.sorted_phone_prefixes)43 queryUtility(IIkobaUtils), 'sorted_phone_prefixes', 44 IkobaUtils.sorted_phone_prefixes) 45 45 options = [] 46 46 for ptitle, pval in prefix_func(request=self.request): -
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/widgets/restwidget.py
r7819 r11949 20 20 from zope.component import getUtility 21 21 from zope.formlib.widget import renderElement, DisplayWidget 22 from waeup. kofa.utils.helpers import ReST2HTML23 from waeup. kofa.interfaces import IKofaUtils22 from waeup.ikoba.utils.helpers import ReST2HTML 23 from waeup.ikoba.interfaces import IIkobaUtils 24 24 25 25 … … 36 36 language separator - usually the first part has no language 37 37 descriptor - are interpreted as texts in the portal's language. 38 The latter can be configured in waeup.srp.utils.utils. KofaUtils.38 The latter can be configured in waeup.srp.utils.utils.IkobaUtils. 39 39 """ 40 40 if self._renderedValueSet(): … … 46 46 parts = value.split('>>') 47 47 elements = {} 48 lang = getUtility(I KofaUtils).PORTAL_LANGUAGE48 lang = getUtility(IIkobaUtils).PORTAL_LANGUAGE 49 49 for part in parts: 50 50 if part[2:4] == u'<<': -
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/widgets/sequencewidget.pt
r11496 r11949 1 <table i18n:domain="waeup. kofa">1 <table i18n:domain="waeup.ikoba"> 2 2 <tr tal:repeat="widget view/widgets"> 3 3 <td> … … 27 27 tal:attributes="name string:${view/name}.remove" 28 28 i18n:translate="remove-selected-items">Remove selected items</button> 29 <a id=" kofa-scroll-target"30 tal:condition="view/_ kofa_seq_len_changed" />29 <a id="ikoba-scroll-target" 30 tal:condition="view/_ikoba_seq_len_changed" /> 31 31 </td> 32 32 </tr> -
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/widgets/sequencewidget.py
r11495 r11949 31 31 32 32 33 class KofaSequenceWidget(ListSequenceWidget):33 class IkobaSequenceWidget(ListSequenceWidget): 34 34 """A sequence widget for lists. 35 35 … … 38 38 """ 39 39 template = ViewPageTemplateFile('sequencewidget.pt') 40 _ kofa_seq_len_changed = False40 _ikoba_seq_len_changed = False 41 41 42 42 def _generateSequence(self): 43 result = super( KofaSequenceWidget, self)._generateSequence()43 result = super(IkobaSequenceWidget, self)._generateSequence() 44 44 if ((self.name + '.add' in self.request.form) or 45 45 (self.name + '.remove' in self.request.form)): 46 self._ kofa_seq_len_changed = True46 self._ikoba_seq_len_changed = True 47 47 return result 48 48 49 49 50 class KofaSequenceDisplayWidget(SequenceDisplayWidget):50 class IkobaSequenceDisplayWidget(SequenceDisplayWidget): 51 51 """A sequence widget for lists. 52 52 … … 100 100 @grok.implementer(IInputWidget) 101 101 def seq_input_widget(obj, field, req, *args, **kw): 102 return KofaSequenceWidget(obj, field, req, *args, **kw)102 return IkobaSequenceWidget(obj, field, req, *args, **kw) 103 103 104 104 … … 106 106 @grok.implementer(IDisplayWidget) 107 107 def seq_display_widget(obj, field, req, *args, **kw): 108 return KofaSequenceDisplayWidget(obj, field, req, *args, **kw)108 return IkobaSequenceDisplayWidget(obj, field, req, *args, **kw) -
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/widgets/tests/test_datetimewidget.py
r8208 r11949 12 12 from zope.interface.verify import verifyClass, verifyObject 13 13 from zope.publisher.browser import TestRequest 14 from waeup. kofa.interfaces import IKofaUtils15 from waeup. kofa.widgets.datetimewidget import PytzDatetimeWidget14 from waeup.ikoba.interfaces import IIkobaUtils 15 from waeup.ikoba.widgets.datetimewidget import PytzDatetimeWidget 16 16 17 17 class IContent(Interface): … … 30 30 class FakeUtils(object): 31 31 # Fake app-wide set timezone. 32 implements(I KofaUtils)32 implements(IIkobaUtils) 33 33 tzinfo = pytz.timezone('America/Sao_Paulo') 34 34 -
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/widgets/tests/test_datewidget.py
r9499 r11949 29 29 SimpleInputWidgetTest, BrowserWidgetTest, ) 30 30 from zope.formlib.interfaces import IInputWidget, IDisplayWidget 31 from waeup. kofa.widgets.datewidget import (31 from waeup.ikoba.widgets.datewidget import ( 32 32 FormattedDateWidget, FormattedDateDisplayWidget, ) 33 33 from zope.formlib.widgets import DateI18nWidget -
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/widgets/tests/test_objectwidget.py
r7819 r11949 37 37 from zope.formlib.interfaces import IWidgetInputErrorView 38 38 39 from waeup. kofa.widgets.objectwidget import KofaObjectWidget as ObjectWidget40 from waeup. kofa.widgets.objectwidget import (41 KofaObjectDisplayWidget as ObjectDisplayWidget)39 from waeup.ikoba.widgets.objectwidget import IkobaObjectWidget as ObjectWidget 40 from waeup.ikoba.widgets.objectwidget import ( 41 IkobaObjectDisplayWidget as ObjectDisplayWidget) 42 42 43 43 class ITestContact(Interface): -
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/widgets/tests/test_phonewidget.py
r8168 r11949 30 30 from zope.publisher.browser import TestRequest 31 31 from zope.schema.interfaces import ITextLine 32 from waeup. kofa.widgets.phonewidget import PhoneWidget32 from waeup.ikoba.widgets.phonewidget import PhoneWidget 33 33 34 34 # Dummy content
Note: See TracChangeset for help on using the changeset viewer.