示例#1
0
from dependencies.dependency import ClassSecurityInfo
from dependencies.dependency import TypesWidget
from dependencies.dependency import registerWidget
from dependencies.dependency import registerPropertyType
from lims.browser import ulocalized_time as ut


class DateTimeWidget(TypesWidget):
    _properties = TypesWidget._properties.copy()
    _properties.update(
        {
            "show_time": False,
            "macro": "bika_widgets/datetimewidget",
            "helper_js": ("bika_widgets/datetimewidget.js",),
            "helper_css": ("bika_widgets/datetimewidget.css",),
        }
    )

    security = ClassSecurityInfo()

    def ulocalized_time(self, time, context, request):
        val = ut(time, long_format=self._properties["show_time"], time_only=False, context=context, request=request)
        return val


registerWidget(
    DateTimeWidget, title="DateTimeWidget", description=("Simple text field, with a jquery date widget attached.")
)

registerPropertyType("show_time", "boolean")
示例#2
0
文件: decimal.py 项目: nafwa03/olims
from dependencies.dependency import DecimalWidget as _d
from dependencies.dependency import registerPropertyType
from dependencies.dependency import registerWidget

from dependencies.dependency import ClassSecurityInfo

_marker = []


class DecimalWidget(_d):
    _properties = _d._properties.copy()
    _properties.update({
        'macro': "bika_widgets/decimal",
        'unit': '',
    })

    security = ClassSecurityInfo()


registerWidget(DecimalWidget,
               title='Decimal',
               description=('Renders a HTML text input box which '
                            'accepts a fixed point value'),
               )

registerPropertyType('unit', 'string', DecimalWidget)
示例#3
0
文件: integer.py 项目: pureboy8/OLiMS
from dependencies.dependency import IntegerWidget as _i
from dependencies.dependency import registerPropertyType
from dependencies.dependency import registerWidget

from dependencies.dependency import ClassSecurityInfo

_marker = []


class IntegerWidget(_i):
    _properties = _i._properties.copy()
    _properties.update({
        'macro': "bika_widgets/integer",
        'unit': '',
    })

    security = ClassSecurityInfo()


registerWidget(
    IntegerWidget,
    title='Integer',
    description=('Renders a HTML text input box which '
                 'accepts a integer value'),
)

registerPropertyType('unit', 'string', IntegerWidget)
示例#4
0
from dependencies.dependency import DecimalWidget as _d
from dependencies.dependency import registerPropertyType
from dependencies.dependency import registerWidget

from dependencies.dependency import ClassSecurityInfo

_marker = []


class DecimalWidget(_d):
    _properties = _d._properties.copy()
    _properties.update({
        'macro': "bika_widgets/decimal",
        'unit': '',
    })

    security = ClassSecurityInfo()


registerWidget(
    DecimalWidget,
    title='Decimal',
    description=('Renders a HTML text input box which '
                 'accepts a fixed point value'),
)

registerPropertyType('unit', 'string', DecimalWidget)
示例#5
0
文件: integer.py 项目: nafwa03/olims
from dependencies.dependency import IntegerWidget as _i
from dependencies.dependency import registerPropertyType
from dependencies.dependency import registerWidget

from dependencies.dependency import ClassSecurityInfo

_marker = []


class IntegerWidget(_i):
    _properties = _i._properties.copy()
    _properties.update({
        'macro': "bika_widgets/integer",
        'unit': '',
    })

    security = ClassSecurityInfo()

registerWidget(IntegerWidget,
               title='Integer',
               description=('Renders a HTML text input box which '
                            'accepts a integer value'),
               )

registerPropertyType('unit', 'string', IntegerWidget)
示例#6
0
from dependencies.dependency import registerPropertyType
from lims.browser import ulocalized_time as ut


class DateTimeWidget(TypesWidget):
    _properties = TypesWidget._properties.copy()
    _properties.update({
        'show_time': False,
        'macro': "bika_widgets/datetimewidget",
        'helper_js': ("bika_widgets/datetimewidget.js", ),
        'helper_css': ("bika_widgets/datetimewidget.css", ),
    })

    security = ClassSecurityInfo()

    def ulocalized_time(self, time, context, request):
        val = ut(time,
                 long_format=self._properties['show_time'],
                 time_only=False,
                 context=context,
                 request=request)
        return val


registerWidget(
    DateTimeWidget,
    title='DateTimeWidget',
    description=('Simple text field, with a jquery date widget attached.'))

registerPropertyType('show_time', 'boolean')