use HTML fields for agenda item description, discussion, consequences; provide fixes and additions for editing and presentation of this

This commit is contained in:
Helmut Merz 2013-01-03 19:41:32 +01:00
parent 02d65acffb
commit 58fda446ff
9 changed files with 64 additions and 22 deletions

View file

@ -843,6 +843,7 @@ class BaseView(GenericView, I18NView):
def registerDojoFormAll(self): def registerDojoFormAll(self):
self.registerDojo() self.registerDojo()
self.registerDojoEditor()
cm = self.controller.macros cm = self.controller.macros
jsCall = ('dojo.require("dijit.form.Form"); ' jsCall = ('dojo.require("dijit.form.Form"); '
'dojo.require("dijit.form.DateTextBox"); ' 'dojo.require("dijit.form.DateTextBox"); '

View file

@ -323,17 +323,15 @@
<!-- overridden field renderers --> <!-- overridden field renderers -->
<metal:html define-macro="input_html"> <metal:html define-macro="input_html">
<p>HTML</p> <div dojoType="dijit.Editor"
<div name="field" rows="3" style="width: 600px" extraPlugins="['insertHorizontalRule', 'createLink', 'viewsource']"
dojoType="dijit.Editor" tal:define="width field/width|nothing;
extraPlugins="['insertHorizontalRule','createLink', 'viewsource']" height field/height|python:3"
tal:define="width field/width|nothing; tal:attributes="name name; id name;
height field/height|python:3" rows python:height or 3;
tal:attributes="name name; id name; style python:
rows python: height or 3; 'width: %s' % (width and str(width)+'px' or '600px');"
style python: tal:content="structure data/?name|string:">
'width: %s' % (width and str(width)+'px' or '600px');"
tal:content="structure data/?name|string:">
</div> </div>
</metal:html> </metal:html>

View file

@ -211,6 +211,22 @@ function closeDialog(save) {
} }
function closeDataWidget(save) { function closeDataWidget(save) {
form = dojo.byId('dialog_form');
dojo.query('.dijitEditor').forEach(function(item, index) {
console.log(item);
var name = item.id;
var widget = dijit.byId(name);
value = widget.getValue();
var ta = document.createElement('input');
ta.type = 'hidden';
ta.name = name;
ta.value = value;
form.appendChild(ta);
});
}
function xx_closeDataWidget(save) {
var widget = dijit.byId('data'); var widget = dijit.byId('data');
if (widget != undefined && save) { if (widget != undefined && save) {
value = widget.getValue(); value = widget.getValue();

View file

@ -59,6 +59,11 @@ class TextField(Field):
return text return text
class HtmlTextField(Field):
format = 'text/html'
class DecimalField(Field): class DecimalField(Field):
format = 'decimal' format = 'decimal'

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 2012 Helmut Merz helmutm@cy55.de # Copyright (c) 2013 Helmut Merz helmutm@cy55.de
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -30,6 +30,7 @@ from zope.app.file.interfaces import IImage as IBaseAsset
from zope.component.interfaces import IObjectEvent from zope.component.interfaces import IObjectEvent
from zope.size.interfaces import ISized from zope.size.interfaces import ISized
from cybertools.composer.schema.interfaces import FieldType
from cybertools.relation.interfaces import IDyadicRelation from cybertools.relation.interfaces import IDyadicRelation
from cybertools.tracking.interfaces import ITrackingStorage from cybertools.tracking.interfaces import ITrackingStorage
from cybertools.util.format import toStr, toUnicode from cybertools.util.format import toStr, toUnicode
@ -37,6 +38,11 @@ from loops import util
from loops.util import _ from loops.util import _
class HtmlText(schema.Text):
__typeInfo__ = ('html',)
# common interfaces # common interfaces
class ILoopsObject(Interface): class ILoopsObject(Interface):

Binary file not shown.

View file

@ -443,9 +443,15 @@ msgstr "Überschrift, sprechende Bezeichnung des Begriffs"
msgid "Description" msgid "Description"
msgstr "Beschreibung" msgstr "Beschreibung"
msgid "label_description"
msgstr "Beschreibung"
msgid "A medium-length description describing the content and the purpose of the object" msgid "A medium-length description describing the content and the purpose of the object"
msgstr "Eine ausführlichere Beschreibung des Inhalts und Zwecks des Objekts" msgstr "Eine ausführlichere Beschreibung des Inhalts und Zwecks des Objekts"
msgid "desc_description"
msgstr "Eine ausführlichere Beschreibung des Inhalts und Zwecks des Objekts"
msgid "Related Items" msgid "Related Items"
msgstr "Verwandte Begriffe" msgstr "Verwandte Begriffe"

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 2012 Helmut Merz helmutm@cy55.de # Copyright (c) 2013 Helmut Merz helmutm@cy55.de
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -31,6 +31,7 @@ from cybertools.organize.interfaces import IAddress as IBaseAddress
from cybertools.organize.interfaces import IPerson as IBasePerson from cybertools.organize.interfaces import IPerson as IBasePerson
from cybertools.organize.interfaces import ITask from cybertools.organize.interfaces import ITask
from loops.interfaces import ILoopsAdapter, IConceptSchema, IRelationAdapter from loops.interfaces import ILoopsAdapter, IConceptSchema, IRelationAdapter
from loops.interfaces import HtmlText
from loops.organize.util import getPrincipalFolder from loops.organize.util import getPrincipalFolder
from loops import util from loops import util
from loops.util import _ from loops.util import _
@ -173,26 +174,35 @@ class IEvent(ITask):
class IAgendaItem(ILoopsAdapter): class IAgendaItem(ILoopsAdapter):
description = HtmlText(
title=_(u'label_description'),
description=_(u'desc_description'),
default=u'',
missing_value=u'',
required=False)
responsible = schema.TextLine( responsible = schema.TextLine(
title=_(u'label_responsible'), title=_(u'label_responsible'),
description=_(u'desc_responsible.'), description=_(u'desc_responsible'),
default=u'', default=u'',
required=False) required=False)
discussion = schema.Text( discussion = HtmlText(
title=_(u'label_discussion'), title=_(u'label_discussion'),
description=_(u'desc_discussion.'), description=_(u'desc_discussion'),
default=u'', default=u'',
missing_value=u'', missing_value=u'',
required=False) required=False)
consequences = schema.Text( consequences = HtmlText(
title=_(u'label_consequences'), title=_(u'label_consequences'),
description=_(u'desc_consequences.'), description=_(u'desc_consequences'),
default=u'', default=u'',
missing_value=u'', missing_value=u'',
required=False) required=False)
description.height = discussion.height = consequences.height = 5
# 'hasrole' predicate # 'hasrole' predicate

View file

@ -35,7 +35,7 @@ from cybertools.util.jeep import Jeep
from loops.common import adapted, baseObject from loops.common import adapted, baseObject
from loops.expert.browser.report import ReportConceptView from loops.expert.browser.report import ReportConceptView
from loops.expert.field import Field, TargetField, DateField, StateField, \ from loops.expert.field import Field, TargetField, DateField, StateField, \
TextField, UrlField TextField, HtmlTextField, UrlField
from loops.expert.field import SubReport, SubReportField from loops.expert.field import SubReport, SubReportField
from loops.expert.report import ReportInstance from loops.expert.report import ReportInstance
from loops import util from loops import util
@ -329,7 +329,7 @@ taskTitle = UrlField('title', u'Task Title',
description=u'The short description of the task.', description=u'The short description of the task.',
cssClass='header-1', cssClass='header-1',
executionSteps=['output']) executionSteps=['output'])
taskDescription = TextField('description', u'Description', taskDescription = HtmlTextField('description', u'Description',
description=u'The long description of the task.', description=u'The long description of the task.',
cssClass='header-2', cssClass='header-2',
executionSteps=['output']) executionSteps=['output'])
@ -337,11 +337,11 @@ responsible = TextField('responsible', u'label_responsible',
description=u'Responsible.', description=u'Responsible.',
cssClass='header-2', cssClass='header-2',
executionSteps=['output']) executionSteps=['output'])
discussion = TextField('discussion', u'label_discussion', discussion = HtmlTextField('discussion', u'label_discussion',
description=u'Discussion.', description=u'Discussion.',
cssClass='header-2', cssClass='header-2',
executionSteps=['output']) executionSteps=['output'])
consequences = TextField('consequences', u'label_consequences', consequences = HtmlTextField('consequences', u'label_consequences',
description=u'Consequences.', description=u'Consequences.',
cssClass='header-2', cssClass='header-2',
executionSteps=['output']) executionSteps=['output'])