]), title=u'Type', description=u'Single or multiple file(s)', default="MULTI", required=True) class AttachmentField(BaseField): """ """ implements(IAttachmentField) def processInput(self, strValue): """ """ # only called in during validation if not strValue: return None strValue = normalizeString(strValue) return {strValue: 'application/unknow'} for f in getFields(IAttachmentField).values(): setattr(AttachmentField, f.getName(), DictionaryProperty(f, 'parameters')) class SettingForm(BaseForm): """ """ form_fields = form.Fields(IAttachmentField)
from zope.schema import TextLine, Text, Choice from zope.schema.vocabulary import SimpleVocabulary # Plomino from base import IBaseField, BaseField, BaseForm from dictionaryproperty import DictionaryProperty class IRichtextField(IBaseField): """ Text field schema """ height = TextLine( title=u'Height', description=u'Height in pixels', required=False) class RichtextField(BaseField): """ """ implements(IRichtextField) for f in getFields(IRichtextField).values(): setattr(RichtextField, f.getName(), DictionaryProperty(f, 'parameters')) class SettingForm(BaseForm): """ """ form_fields = form.Fields(IRichtextField)
""" Text field schema """ widget = Choice( vocabulary=SimpleVocabulary.fromItems([ ("Text", "TEXT"), ("Long text", "TEXTAREA"), ("Hidden", "HIDDEN") ]), title=u'Widget', description=u'Field rendering', default="TEXT", required=True) size = TextLine( title=u'Size', description=u'Length or rows (depending on the widget)', required=False) class TextField(BaseField): """ """ implements(ITextField) for f in getFields(ITextField).values(): setattr(TextField, f.getName(), DictionaryProperty(f, 'parameters')) class SettingForm(BaseForm): """ """ form_fields = form.Fields(ITextField)
column_labels = [col.Title() for col in columns] else: column_labels = [""] column_dicts = [{"sTitle": col} for col in column_labels] column_dicts.insert( 0, {"bVisible": False, "bSearchable": False}) return json.dumps(column_dicts) def getColumnLabelIndex(self): """ Return the column index used to display the document label """ if self.sourceview: return [col.id for col in self.context.getParentDatabase().getView( self.sourceview).getColumns()].index( self.labelcolumn); else: return 0 for f in getFields(IDoclinkField).values(): setattr(DoclinkField, f.getName(), DictionaryProperty(f, 'parameters')) class SettingForm(BaseForm): """ """ form_fields = form.Fields(IDoclinkField)
def validate(self, submittedValue): """ """ errors=[] # no validation needed (we do not want to parse the GoogleChart param) return errors def processInput(self, submittedValue): """ """ lines = submittedValue.replace('\r', '').split('\n') params = {} for l in lines: if "=" in l: (key, value) = l.split('=') else: key = l value = '' params[key] = value return params for f in getFields(IGooglechartField).values(): setattr(GooglechartField, f.getName(), DictionaryProperty(f, 'parameters')) class SettingForm(BaseForm): """ """ form_fields = form.Fields(IGooglechartField)
return StringToDate(submittedValue, format) def getFieldValue(self, form, doc, editmode, creation, request): """ """ fieldValue = BaseField.getFieldValue(self, form, doc, editmode, creation, request) mode = self.context.getFieldMode() if mode == "EDITABLE" and request: if (doc is None and not (creation) ) or request.has_key('Plomino_datagrid_rowdata'): fieldname = self.context.id fieldValue = request.get(fieldname, fieldValue) if fieldValue: format = self.format if not format: format = form.getParentDatabase().getDateTimeFormat() fieldValue = StringToDate(fieldValue, format) return fieldValue for f in getFields(IDatetimeField).values(): setattr(DatetimeField, f.getName(), DictionaryProperty(f, 'parameters')) class SettingForm(BaseForm): """ """ form_fields = form.Fields(IDatetimeField)
("Single checkbox", "CHECKBOX"), ]), title=u'Widget', description=u'Field rendering', default="CHECKBOX", required=True) class BooleanField(BaseField): """ """ implements(IBooleanField) def processInput(self, strValue): """ """ if strValue == "1": return True else: return False for f in getFields(IBooleanField).values(): setattr(BooleanField, f.getName(), DictionaryProperty(f, 'parameters')) class SettingForm(BaseForm): """ """ form_fields = form.Fields(IBooleanField)
for e in asList(datatable[label]): if isinstance(e, basestring): valuelist.append("'%s'" % e) else: valuelist.append(str(e)) tmp.append(valuelist) datatable = tmp js = self.jssettings + "\n" js = js + "function " + self.chartid + "_getCells() {\n" js = js + self.chartid+".addRows(" + str(len(datatable)) + ");\n" i = 0 for row in datatable: j = 0 for cell in row: js = js + self.chartid+".setValue(" + str(i) + ", " + str(j) + ", " + cell + ");\n" j = j + 1 i = i + 1 js = js + "}" return js for f in getFields(IGooglevisualizationField).values(): setattr(GooglevisualizationField, f.getName(), DictionaryProperty(f, 'parameters')) class SettingForm(BaseForm): """ """ form_fields = form.Fields(IGooglevisualizationField)