class ProfResponsableField(ExtensionField, StringField): """ """ StringField( name='profResponsable', required=False, searchable=True, widget=StringWidget( description='', label=u'Professeur responsable', size=40))
class ECQGroup(ECQAbstractGroup): """Groups several questions into a unit.""" # See comments in 'ECQAbstractGroup' for an explanation # of the function of a schema, therein defined properties (fields) and # internationalization of the widgets schema = ECQAbstractGroup.schema + Schema((StringField( 'title', required=False, searchable=True, default='', widget=StringWidget(label_msgid='label_title', description_msgid='title', i18n_domain='plone'), ), ), ) typeDescription = "Using this form, you can create a question group." typeDescMsgId = 'description_edit_mcquestiongroup' security = ClassSecurityInfo() # The functions needed for ECQAbstractGroup, # 'getResults', 'setResults', 'isPublic' and # 'getEvaluationScripts' don't have to be implemented. They are # acquired from the group's parent security.declarePrivate('computeCandidatePoints') def computeCandidatePoints(self, result): """Return how many points the candidate got for the questions in this container. If a custom evaluation script has been uploaded it will be invoked. Otherwise a default method will be used. @param candidateId The user ID of the candidate whose points you want to know.""" customScript = self.getEvaluationScript(self.portal_type) questions = self.getQuestions(result) if not customScript: # default points = 0 for question in questions: if not shasattr(question, 'getCandidatePoints'): return None qPoints = question.getCandidatePoints(result) if not isNumeric(qPoints): return None points += qPoints return points else: # custom return evalFunString(customScript, \ CUSTOM_EVALUATION_FUNCTION_NAME, \ [self, result, questions])
def get(self, instance, aslist=False, **kwargs): """Return the value of the version as a list of integers. Example: [1,10] Except (and this is important!) if there is no value or our value is 'latest', then return an empty list: [] The OOBTree, probably through Python cmp(), sorts all tuples after all lists. So if we make the versions as lists and the "no version" as a tuple, we will get no-version entries as "high" values instead of low. Only tuples, apparently, order above tuples. This is not guaranteed to be stable, and we absolutely must have a test for at least this! TODO! """ val = StringField.get(self, instance, **kwargs) if not val or val == 'latest': # 'latest' and '' sort to end... return tuple() # ...tricksy. See docstring. else: try: return [int(x) for x in val.split('.')] except ValueError: # probably a mistake. TODO: should we just let this float? return val # not doing so, we could get bad comparisons...
from eea.facetednavigation.widgets import ViewPageTemplateFile from eea.facetednavigation.widgets.widget import CountableWidget from eea.facetednavigation.widgets.alphabetic.alphabets import ( unicode_character_map, ) from eea.facetednavigation.widgets.alphabetic.interfaces import ( IAlphabeticWidget, ) from eea.facetednavigation import EEAMessageFactory as _ logger = logging.getLogger('eea.facetednavigation.widgets.alphabetic') EditSchema = Schema(( StringField( 'index', schemata="default", required=True, vocabulary_factory='eea.faceted.vocabularies.AlphabeticCatalogIndexes', widget=SelectionWidget( format='select', label=_(u"Catalog index"), description=_(u"Catalog index to use for search"), )), StringField('default', schemata="default", widget=StringWidget( size=3, maxlength=1, label=_(u"Default value"), description=_(u"Default letter to be selected"), )), ))
""" import logging from Products.Archetypes.public import Schema from Products.Archetypes.public import StringField from Products.Archetypes.public import StringWidget from Products.Five.browser.pagetemplatefile import ZopeTwoPageTemplateFile from eea.facetednavigation.widgets.widget import Widget as AbstractWidget from eea.facetednavigation import EEAMessageFactory as _ logger = logging.getLogger('eea.facetednavigation.widgets.portlet') EditSchema = Schema( (StringField('macro', schemata="default", required=True, widget=StringWidget(label=_(u'Portlet macro'), description=_(u'Path to portlet macro'), i18n_domain="eea")), )) class Widget(AbstractWidget): """ Widget """ # Widget properties widget_type = 'portlet' widget_label = _('Plone portlet') view_js = '++resource++eea.facetednavigation.widgets.portlet.view.js' view_css = '++resource++eea.facetednavigation.widgets.portlet.view.css' edit_css = '++resource++eea.facetednavigation.widgets.portlet.edit.css' css_class = 'faceted-portlet-widget'
widget=IntegerWidget(label='Batch size', description='', label_msgid='label_batch_size', description_msgid='help_batch_size', i18n_domain='plone', ), schemata='cbsettings_display', ), #Entry StringField('entrydate_format', searchable=0, default = '%Y/%m/%d', widget=StringWidget(label='Entrydate format', description='', label_msgid='label_entrydate_format', description_msgid='help_entrydate_format', i18n_domain='plone', size=60, ), schemata='cbsettings_display', ), #PING/Trackback StringField('trackback_base', searchable=0, default='', widget=StringWidget(label='Trackback base URL', description='', label_msgid='label_trackback_base', description_msgid='help_trackback_base', i18n_domain='plone',
from eea.facetednavigation.widgets.interfaces import IWidget def compare(a, b): """ Compare lower values """ return cmp(a.lower(), b.lower()) logger = logging.getLogger('eea.facetednavigation.widgets.widget') CommonEditSchema = Schema(( StringField('title', schemata="default", required=True, widget=StringWidget( size=25, label=_(u"Friendly name"), description=_(u"Title for widget to display in view page"), )), StringField('position', schemata="layout", vocabulary_factory="eea.faceted.vocabularies.WidgetPositions", widget=SelectionWidget( format='select', label=_(u'Position'), description=_(u"Widget position in page"), )), StringField('section', schemata="layout", vocabulary_factory="eea.faceted.vocabularies.WidgetSections", widget=SelectionWidget(
from eea.facetednavigation.dexterity_support import normalize as atdx_normalize from eea.facetednavigation.widgets import ViewPageTemplateFile from eea.facetednavigation.widgets.widget import CountableWidget from eea.facetednavigation import EEAMessageFactory as _ TagsCloudTypes = DisplayList(( ("list", _("List")), ("sphere", _("Sphere")), ("cloud", _("Cloud")), )) EditSchema = Schema(( StringField('index', schemata="default", required=True, vocabulary_factory='eea.faceted.vocabularies.CatalogIndexes', widget=SelectionWidget( label=_(u'Catalog index'), description=_(u'Catalog index to use for search'), i18n_domain="eea")), StringField( 'vocabulary', schemata="default", vocabulary_factory='eea.faceted.vocabularies.PortalVocabularies', widget=SelectionWidget( label=_(u'Vocabulary'), description=_(u'Vocabulary to use to render widget items'), i18n_domain="eea")), StringField('catalog', schemata="default", vocabulary_factory='eea.faceted.vocabularies.UseCatalog', widget=SelectionWidget(
value = [] for r in results: key = r.getUserName is not None and r.getUserName.strip() \ or r.getUserId value.append((key.lower(), (r.UID, key))) value.sort() value = [r for throwaway, r in value] value.insert(0, ('', '<no reference>')) return DisplayList(value) registerType(TestGroup, PROJECTNAME) user = BaseSchema + Schema(( StringField( 'userName', languageIndependent=1, ), StringField( 'password', languageIndependent=1, ), StringField('title', languageIndependent=1, user_property='fullname', accessor='Title'), StringField( 'mobilePhone', languageIndependent=1, user_property=True, ), StringField(
# Package from eea.facetednavigation.widgets import TrustedEngine from eea.facetednavigation.widgets import TrustedZopeContext from eea.facetednavigation.widgets import ViewPageTemplateFile from eea.facetednavigation.widgets.widget import Widget as AbstractWidget from eea.facetednavigation import EEAMessageFactory as _ from eea.facetednavigation.widgets.resultsfilter.interfaces import ( IResultsFilterWidget, ) logger = logging.getLogger('eea.facetednavigation.widgets.resultsfilter') EditSchema = Schema( (StringField('default', schemata="default", default='python:hasattr(brain, "Title")', widget=StringWidget( label=_(u'Results Filter'), description=_(u'Default tal expression for query value'), i18n_domain="eea")), )) class Widget(AbstractWidget): """ Results Filter widget The following contexts can be used within tal expressions: context -- faceted navigable context referer -- request.HTTP_REFERER object. Use this if you load faceted from another place (like: portal_relations) request -- faceted navigable REQUEST object widget -- Results Filter Widget instance
required=True, default_output_type='text/x-html-safe', widget=RichWidget( label='Details', description='Details description for this story', rows=18, ), ), # iteration plan StringField( 'xppm_iteration', searchable=False, required=True, vocabulary='vocabulary_iterations', widget=SelectionWidget( label=u'Iteration Plan', description=u'Select the iteration plan for this story', format='select', ), ), # use cases for this story. LinesField( 'xppm_use_cases', searchable=False, required=False, vocabulary='vocabulary_useCases', widget=InAndOutWidget( label='Story Use Case(s)', descrpiton="Please select use cases for this story",
ReferenceField( "Instrument", schemata="Description", required=0, vocabulary_display_path_bound=sys.maxint, vocabulary="getInstruments", allowed_types=("Instrument", ), relationship="WorksheetTemplateInstrument", referenceClass=HoldingReference, widget=ReferenceWidget( checkbox_bound=0, label=_("Instrument"), description=_("Select the preferred instrument"), ), ), StringField("InstrumentTitle", widget=StringWidget(visible=False)), BooleanField( "EnableMultipleUseOfInstrument", default=True, schemata="Description", widget=BooleanWidget( label=_("Enable Multiple Use of Instrument in Worksheets."), description=_( "If unchecked, Lab Managers won't be able to assign the same " "Instrument more than one Analyses while creating a Worksheet." ))), )) schema["title"].schemata = "Description" schema["title"].widget.visible = True
relationship='LabContactDepartment', vocabulary='_departmentsVoc', referenceClass=HoldingReference, multiValued=1, widget=atapi.ReferenceWidget( checkbox_bound=0, label=_("Departments"), description=_("The laboratory departments"), ), ), StringField( 'DefaultDepartment', required=0, vocabulary_display_path_bound=sys.maxint, vocabulary='_defaultDepsVoc', widget=SelectionWidget( visible=True, format='select', label=_("Default Department"), description=_("Default Department"), ), ), )) schema['JobTitle'].schemata = 'default' # Don't make title required - it will be computed from the Person's Fullname schema['title'].required = 0 schema['title'].widget.visible = False class LabContact(Contact): """A Lab Contact, which can be linked to a System User
required = True, default_output_type = 'text/x-html-safe', widget = RichWidget( label = u'Body Text', rows = 22 ), ), # the status for this issue. StringField( 'xpproject_document_status', searchable = False, required = False, index = "FieldIndex:schema", default = '', vocabulary = 'vocabulary_documentStatus', widget = SelectionWidget( label = 'Document Status', descrpiton = 'Set status for this issue.', format = 'select', ), ), ), ) # Plone 3 will re-organize all fields' shemata by using this method. finalizeATCTSchema(XPointDocumentSchema) # xpproject document status is invisible by default. XPointDocumentSchema['xpproject_document_status'].widget.visible = False
StringField, Schema, BaseFolder from plone.app.blob.field import BlobField from Products.Archetypes.references import HoldingReference from bika.lims.config import PROJECTNAME from bika.lims.content.bikaschema import BikaSchema schema = BikaSchema.copy() + Schema(( ReferenceField( 'AnalysisRequest', allowed_types=('AnalysisRequest', ), relationship='ReportAnalysisRequest', referenceClass=HoldingReference, required=1, ), BlobField('Pdf', ), StringField('Html', ), StringField('SMS', ), RecordsField( 'Recipients', type='recipients', subfields=('UID', 'Username', 'Fullname', 'EmailAddress', 'PublicationModes'), ), )) schema['id'].required = False schema['title'].required = False class ARReport(BaseFolder): security = ClassSecurityInfo()
from Products.Archetypes.public import Schema from Products.Archetypes.public import BooleanField from Products.Archetypes.public import StringField from Products.Archetypes.public import SelectionWidget from Products.Archetypes.public import BooleanWidget from eea.facetednavigation.widgets import ViewPageTemplateFile from eea.facetednavigation.widgets.widget import CountableWidget from eea.facetednavigation import EEAMessageFactory as _ BooleanEditSchema = Schema(( StringField( 'index', schemata="default", required=True, vocabulary_factory='eea.faceted.vocabularies.SimpleFieldCatalogIndexes', widget=SelectionWidget( label=_(u'Catalog index'), description=_(u'Catalog index to use for search'), i18n_domain="eea")), BooleanField('default', schemata="default", widget=BooleanWidget( label=_(u'Default value'), description=_(u'Default items (one per line)'), i18n_domain="eea")), )) BooleanEditSchema = CountableWidget.edit_schema.copy() + BooleanEditSchema del BooleanEditSchema['sortcountable'] del BooleanEditSchema['hidezerocount']
from eea.facetednavigation.widgets.checkbox.widget import Widget as BaseCheckboxWidget from eea.facetednavigation.widgets import ViewPageTemplateFile from Products.Archetypes.public import Schema from Products.Archetypes.public import StringField EditSchema = Schema(( StringField( 'disable_criterion_label', schemata='default', required=True, ), StringField( 'enable_criterion_label', schemata='default', required=True, ), )) class SearchPageCheckbox(BaseCheckboxWidget): widget_type = 'searchpagecheckbox' index = ViewPageTemplateFile('searchpagecheckbox.pt') edit_schema = BaseCheckboxWidget.edit_schema.copy() + EditSchema # def __init__(self, context, request, data=None): # self.context = context # self.request = request # self.request.debug = False # self.data = data
from Products.ATContentTypes.content.base import ATCTContent from Products.ATContentTypes.content.schemata import finalizeATCTSchema from Products.ATContentTypes.configuration import zconf from Products.statusmessages.interfaces import IStatusMessage from Products.PloneShellConsole.config import PROJECTNAME PSCWorklogSchema = ATCTContent.schema.copy() + Schema( ( # user name who perform this work. StringField( 'psc_log_username', widget=StringWidget( label='User Name', description='The user, who performed this work', ), #mode = 'r', ), # time stamp for this work. StringField( 'psc_log_timestamp', widget=StringWidget( label='Time Stamp', description='Time stamp for this work', ), #mode = 'r', ), # log subject, a brief message which
class MapServer(BaseFolder): '''Map Server for CoGIS''' schema = BaseFolderSchema schema = BaseSchema + Schema([ StringField('description', required=False, searchable=1, widget=StringWidget( label='Description', description="Enter project description")), ReferenceField('relatedItems', relationship='relatesTo', multiValued=True, isMetadata=True, languageIndependent=False, index='KeywordIndex', write_permission=ModifyPortalContent, widget=ReferenceBrowserWidget( allow_search=True, allow_browse=True, show_indexes=False, force_close_on_insert=True, label=_(u'label_related_items', default=u'Related Items'), description='', visible={ 'edit': 'visible', 'view': 'invisible' })) ], ) actions = ( { 'id': 'publish', 'name': 'Publish', 'action': 'string:${object_url}/Map_Server_PublishAll', 'permissions': (permissions.ViewManagementScreens, ) }, { 'id': 'pingServer', 'name': 'Ping Server', 'action': 'string:${object_url}/Map_Server_PingServer', 'permissions': (permissions.ViewManagementScreens, ) }, { 'id': 'licenseAgreement', 'name': 'License Agreement', 'action': 'string:${object_url}/Map_Server_LicenseAgreement_Edit', 'permissions': (permissions.ViewManagementScreens, ) }, ) #schema = schema + extra_schema content_icon = "mapServer.gif" security = ClassSecurityInfo() archetype_name = 'MapServer' meta_type = 'MapServer' portal_type = 'MapServer' allowed_content_types = [] #['MapLayer'] filter_content_types = 1 global_allow = 0 allow_discussion = 0 content_icon = "mapServer.gif" def __init__(self, id, title=''): '''Initialize an instance of the class''' self.id = id if title == '': self.title = id else: self.title = title self.organization = "" self.wmsSource = "" self.wfsSource = "" self.enableLicenseAgreement = False # licenseAgreent is the text to display in the tbx self.licenseAgreement = "Put the license text here \nPlease read license before publishing" # its a list of usernames that have accepted the license agreement self.acceptedUserNames = [] def dummyTest(self): """ """ return dir(self) def updateLicenseAgreement(self, REQUEST=None): """ @summary: udpate the server license agreement and disables/enables the agreement """ try: self.acceptedUserNames = [] if REQUEST.has_key('enableIt'): enable = True else: enable = False licenseText = REQUEST.form['licenseText'] self.enableLicenseAgreement = enable self.licenseAgreement = licenseText self._p_changed = 1 transaction.savepoint(True) status_message = "License Agreement Updated" REQUEST.RESPONSE.redirect( "%s/Map_Server_LicenseAgreement_Edit?portal_status_message=%s" % (self.absolute_url(), status_message)) except: logger.exception('failed updateLicenseAgreement') security.declarePublic('userIsOwner') def userIsOwner(self): """ @summary: this is a zope specific method to get logged in user name @return: boolean, true if logged in user is the owner """ try: ownerName = self.owner_info()['id'] member = self.portal_membership.getAuthenticatedMember() userName = member.getUserName() if userName == ownerName: return True else: return False except: logger.exception('failed user is owner') def publishLayersForRoles(self, rolesToPublish): """ @summary : publishes layer for the given roles passed @param : a list of roles to publish layers for """ try: items = self.objectItems() for i in items: if i[1].meta_type == 'MapLayer': l = i[1] secStruct = l.setSecurity( self.getPublishedStructureForRoles(rolesToPublish)) return 1 except: logger.exception('failed publishLayersForRoles') def publishAllLayers(self): """ @summary: this will publish all the layers in the server @return: 1 """ try: items = self.objectItems() for i in items: if i[1].meta_type == 'MapLayer': l = i[1] secStruct = l.setSecurity( self.getPublishedSecurityStructure()) return 1 except: logger.exception('failed publishAllLayers') def retractAllLayers(self): """ @summary: this will retract all the layers in the server @return: 1 """ try: items = self.objectItems() for i in items: if i[1].meta_type == 'MapLayer': l = i[1] secStruct = l.setSecurity( self.getRetractedSecurityStructure()) return 1 except: logger.exception('failed retractAllLayers') def pingServer(self): """ """ try: startTime = time.time() wmsPingRes = self._getURLContent(self.wmsSource) endTime = time.time() wmsTime = endTime - startTime if wmsPingRes.find("Exception occured") != -1: wmsTime = "Server Unavailable" startTime = time.time() wfsPingRes = self._getURLContent(self.wfsSource) endTime = time.time() wfsTime = endTime - startTime if wfsPingRes.find("Exception occured") != -1: wfsTime = "Server Unavailable" return [str(wfsTime), str(wmsTime)] except: logger.exception('failed pingServer') def pingAllLayers(self): """ """ try: results = {} items = self.objectItems() for i in items: layer = i[1] pingResWMS = layer.pingWMSLayer() pingResWFS = layer.pingWFSLayer() results[layer.uniqueName] = [pingResWFS, pingResWMS] return results except: logger.exception('error') def getPublishedSecurityStructure(self): """ @summary: builds a security structure that will expose all layers @return: a dictionary with all the roles as keys and another dict as value """ try: roles = self.validRoles() tmpDict = {} for role in roles: tmpDict[role] = {'Render': 1, 'Extract': 1} return tmpDict except: logger.exception('failed getPublishedSercurityStructure') def getPublishedStructureForRoles(self, theRoles): """ """ try: roles = self.validRoles() tmpDict = {} for role in roles: if role in theRoles: tmpDict[role] = {'Render': 1, 'Extract': 1} else: tmpDict[role] = {'Render': 0, 'Extract': 0} return tmpDict except: logger.exception('Error') def getRetractedSecurityStructure(self): """ @summary: builds a security structure that will expose all layers @return: a dictionary with all the roles as keys and another dict as value """ try: roles = self.validRoles() tmpDict = {} for role in roles: tmpDict[role] = {'Render': 0, 'Extract': 0} return tmpDict except: logger.exception('Error') def _getURLContent(self, url, data={}): """ """ try: if data: if type(data) == unicode: data = str(urllib.unquote(data)) if type(data) == str: f = urllib.urlopen(url, data) else: params = urllib.urlencode(data) f = urllib.urlopen(url, params) else: f = urllib.urlopen(url) data = f.read() f.close() return data except: import traceback sio = StringIO.StringIO() traceback.print_exc(file=sio) sio.seek(0) trace = sio.read() logger.exception('Error') return MapServerTemplates.ogcServiceException % ( "Exception occured getURLContent request, check log for details %s" % trace)
), CoordinateField( 'Longitude', schemata='Location', widget=CoordinateWidget( label=_("Longitude"), description= _("Enter the Sample Point's longitude in degrees 0-180, minutes 0-59, seconds 0-59 and E/W indicator" ), ), ), StringField( 'Elevation', schemata='Location', widget=StringWidget( label=_("Elevation"), description=_( "The height or depth at which the sample has to be taken"), ), ), DurationField( 'SamplingFrequency', vocabulary_display_path_bound=sys.maxint, widget=DurationWidget( label=_("Sampling Frequency"), description= _("If a sample is taken periodically at this sample point, enter frequency here, e.g. weekly" ), ), ), ReferenceField(
from Products.Archetypes.public import StringField from Products.Archetypes.public import StringWidget from Products.Archetypes.public import SelectionWidget from Products.Archetypes.public import BooleanWidget from eea.facetednavigation.widgets import ViewPageTemplateFile from eea.facetednavigation.widgets.widget import CountableWidget from eea.facetednavigation import EEAMessageFactory as _ EditSchema = Schema(( StringField('index', schemata="default", required=True, vocabulary_factory='eea.faceted.vocabularies.CatalogIndexes', widget=SelectionWidget( label=_(u'Catalog index'), description=_(u'Catalog index to use for search'), i18n_domain="eea" ) ), StringField('vocabulary', schemata="default", vocabulary_factory='eea.faceted.vocabularies.PortalVocabularies', widget=SelectionWidget( label=_(u"Vocabulary"), description=_(u'Vocabulary to use to render widget items'), ) ), StringField('catalog', schemata="default", vocabulary_factory='eea.faceted.vocabularies.UseCatalog',
DEFAULT_ACCREDITATION_PAGE_HEADER = """${lab_name} has been accredited as ${accreditation_standard} conformant by ${accreditation_body_abbr}, ${accreditation_body_name}<br/><br/> ${accreditation_body_abbr} is the single national accreditation body assessing testing and calibration laboratories for compliance to the ISO/IEC 17025 standard.<br/></br/>\n The following analysis services have been included in the ${accreditation_body_abbr} schedule of Accreditation for this Laboratory: """ schema = Organisation.schema.copy() + Schema(( StringField( "LabURL", schemata="Address", write_permission=ManageBika, widget=StringWidget( size=60, label=_("Lab URL"), description=_("The Laboratory's web address"), ), ), UIDReferenceField("Supervisor", required=0, allowed_types=("LabContact", ), vocabulary="_getLabContacts", write_permission=ManageBika, accessor="getSupervisorUID", widget=SelectionWidget( format="select", label=_("Supervisor"), description=_("Supervisor of the Lab"))), IntegerField(
from bika.lims import _ from bika.lims import api from bika.lims.config import ARIMPORT_OPTIONS from bika.lims.config import DECIMAL_MARKS from bika.lims.config import PROJECTNAME from bika.lims.content.attachment import Attachment from bika.lims.content.organisation import Organisation from bika.lims.interfaces import IClient, IDeactivable from zope.interface import implements schema = Organisation.schema.copy() + Schema(( StringField( "ClientID", required=1, searchable=True, validators=("uniquefieldvalidator", "standard_id_validator"), widget=StringWidget( label=_("Client ID"), ), ), BooleanField( "BulkDiscount", default=False, widget=BooleanWidget( label=_("Bulk discount applies"), ), ), BooleanField( "MemberDiscountApplies",
from Products.CMFPlone.utils import safe_unicode from plone.app.folder.folder import ATFolder from zope.interface import implements from bika.lims import bikaMessageFactory as _ from bika.lims.browser.fields import AddressField from bika.lims.browser.widgets import AddressWidget from bika.lims.config import PROJECTNAME from bika.lims.content.bikaschema import BikaFolderSchema from bika.lims.content.bikaschema import BikaSchema from bika.lims.interfaces import IOrganisation schema = BikaFolderSchema.copy() + BikaSchema.copy() + ManagedSchema(( StringField( "Name", required=1, searchable=True, widget=StringWidget(label=_("Name"), ), ), StringField( "TaxNumber", widget=StringWidget(label=_("VAT number"), ), ), StringField( "Phone", widget=StringWidget(label=_("Phone"), ), ), StringField( "Fax", widget=StringWidget(label=_("Fax"), ), ), StringField("EmailAddress",
from bika.lims.interfaces.analysis import IRequestAnalysis from bika.lims.subscribers import skip from bika.lims.workflow import in_state from bika.lims.workflow.analysis import STATE_RETRACTED, STATE_REJECTED from bika.lims.workflow.duplicateanalysis import events from zope.interface import implements # A reference back to the original analysis from which this one was duplicated. Analysis = UIDReferenceField( 'Analysis', required=1, allowed_types=('Analysis', 'ReferenceAnalysis'), ) # TODO Analysis - Duplicates shouldn't have this attribute, only ReferenceAns ReferenceAnalysesGroupID = StringField('ReferenceAnalysesGroupID', ) schema = schema.copy() + Schema(( Analysis, ReferenceAnalysesGroupID, )) class DuplicateAnalysis(AbstractRoutineAnalysis): implements(IDuplicateAnalysis) security = ClassSecurityInfo() displayContentsTab = False schema = schema @security.public def getRequest(self):
from Products.Archetypes.public import LinesWidget from Products.Archetypes.public import SelectionWidget from Products.Archetypes.public import BooleanWidget from Products.Archetypes.utils import DisplayList from eea.facetednavigation.dexterity_support import normalize as atdx_normalize from eea.facetednavigation.widgets import ViewPageTemplateFile from eea.faceted.vocabularies.utils import compare from eea.facetednavigation.widgets.widget import CountableWidget from eea.facetednavigation import EEAMessageFactory as _ EditSchema = Schema(( StringField('index', schemata="default", required=True, vocabulary_factory='eea.faceted.vocabularies.CatalogIndexes', widget=SelectionWidget( label=_(u'Catalog index'), description=_(u'Catalog index to use for search'), i18n_domain="eea")), StringField('operator', schemata='default', required=True, vocabulary=DisplayList([('or', 'OR'), ('and', 'AND')]), default='or', widget=SelectionWidget( format='select', label=_(u'Default operator'), description=_(u'Search with AND/OR between elements'), i18n_domain="eea")), BooleanField('operator_visible', schemata='default',
schema = BikaSchema.copy() + Schema(( ReferenceField("Instrument", allowed_types=("Instrument", ), relationship="InstrumentScheduledTaskInstrument", widget=StringWidget(visible=False, )), ComputedField( "InstrumentUID", expression= "context.getInstrument() and context.getInstrument().UID() or None", widget=ComputedWidget(visible=False, ), ), StringField( "Type", vocabulary="getTaskTypes", widget=ReferenceWidget( checkbox_bound=0, label=_("Task type", "Type"), ), ), RecordsField( "ScheduleCriteria", required=1, type="schedulecriteria", widget=ScheduleInputWidget(label=_("Criteria"), ), ), TextField( "Considerations", default_content_type="text/plain", allowed_content_types=("text/plain", ), default_output_type="text/plain", widget=TextAreaWidget(
from Products.CMFCore import CMFCorePermissions from countries import LOCATIONS REFERRERS = DisplayList(( ('search', 'Search Engine'), ('person', 'Individual "word-of-mouth"'), ('article', 'Published Article'), ('conference', 'Conference Presentation'), ('other', 'Other'), )) schema = BaseSchema + Schema(( StringField('title', required=1, accessor='Title', widget=StringWidget( label="Name", description='The name of the person being featured', )), StringField('email', widget=StringWidget( label="Email", description="User's email address", )), StringField('location', vocabulary=LOCATIONS, widget=SelectionWidget( label="Location", description="Where is the user from?", )), StringField('occupation',
instance = instance or self items = getContainers(instance, allow_blank=True) return DisplayList(items) registerField(PartitionSetupField, title="", description="") # # XXX When you modify this schema, be sure to edit the list of fields ## to duplicate, in bika_analysisservices.py. schema = BikaSchema.copy() + Schema(( StringField('ShortTitle', schemata="Description", widget=StringWidget( label=_("Short title"), description=_( "If text is entered here, it is used instead of the " "title when the service is listed in column headings. " "HTML formatting is allowed.") ), ), StringField('Unit', schemata="Description", widget=StringWidget( label=_("Unit"), description=_( "The measurement units for this analysis service' results, " "e.g. mg/l, ppm, dB, mV, etc."), ), ), IntegerField('Precision', schemata="Analysis",
class ECQBaseAnswer(BaseContent): """ A basic answer. The actual text has to be supplied by the candidate. """ # This prevents the Questions from showing up as a portal content type global_allow = False schema = BaseSchema.copy() + Schema(( StringField( name='title', required=1, searchable=0, default='Answer', accessor='Title', widget=StringWidget( label_msgid='label_title', visible={ 'view': 'invisible', 'edit': 'invisible' }, i18n_domain='plone', ), ), StringField( name='answerkey', required=1, searchable=0, default='', accessor='Answerkey', mode='r', widget=StringWidget( label_msgid='label_title', visible={'view': 'visible'}, i18n_domain=config.I18N_DOMAIN, ), ), )) # Use a custom page template for viewing. actions = ({ 'id': 'view', 'action': 'string:${object_url}/ecq_baseanswer_view', }, ) meta_type = 'ECQBaseAnswer' # zope type name portal_type = meta_type # plone type name archetype_name = 'Base Answer' # friendly type name content_icon = 'ecq_answer.png' letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' security = ClassSecurityInfo() security.declarePrivate('manage_afterAdd') def manage_afterAdd(self, item, container): retVal = BaseContent.manage_afterAdd(self, item, container) self.syncResults('add') return retVal security.declarePrivate('manage_beforeDelete') def manage_beforeDelete(self, item, container): retVal = BaseContent.manage_beforeDelete(self, item, container) self.syncResults('delete') return retVal def Answerkey(self): return self.letters[self.contentValues(filter={ 'portal_type': self.portal_type }).index(self)] def Title(self): return self.archetype_name
def getRaw(self, instance, aslist=False, **kwargs): """Return the value of the version as a string. Example: '1.10' """ return StringField.get(self, instance, **kwargs)