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):
self.registerDojo()
self.registerDojoEditor()
cm = self.controller.macros
jsCall = ('dojo.require("dijit.form.Form"); '
'dojo.require("dijit.form.DateTextBox"); '

View file

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

View file

@ -211,6 +211,22 @@ function closeDialog(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');
if (widget != undefined && save) {
value = widget.getValue();

View file

@ -59,6 +59,11 @@ class TextField(Field):
return text
class HtmlTextField(Field):
format = 'text/html'
class DecimalField(Field):
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
# 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.size.interfaces import ISized
from cybertools.composer.schema.interfaces import FieldType
from cybertools.relation.interfaces import IDyadicRelation
from cybertools.tracking.interfaces import ITrackingStorage
from cybertools.util.format import toStr, toUnicode
@ -37,6 +38,11 @@ from loops import util
from loops.util import _
class HtmlText(schema.Text):
__typeInfo__ = ('html',)
# common interfaces
class ILoopsObject(Interface):

Binary file not shown.

View file

@ -443,9 +443,15 @@ msgstr "Überschrift, sprechende Bezeichnung des Begriffs"
msgid "Description"
msgstr "Beschreibung"
msgid "label_description"
msgstr "Beschreibung"
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"
msgid "desc_description"
msgstr "Eine ausführlichere Beschreibung des Inhalts und Zwecks des Objekts"
msgid "Related Items"
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
# 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 ITask
from loops.interfaces import ILoopsAdapter, IConceptSchema, IRelationAdapter
from loops.interfaces import HtmlText
from loops.organize.util import getPrincipalFolder
from loops import util
from loops.util import _
@ -173,26 +174,35 @@ class IEvent(ITask):
class IAgendaItem(ILoopsAdapter):
description = HtmlText(
title=_(u'label_description'),
description=_(u'desc_description'),
default=u'',
missing_value=u'',
required=False)
responsible = schema.TextLine(
title=_(u'label_responsible'),
description=_(u'desc_responsible.'),
description=_(u'desc_responsible'),
default=u'',
required=False)
discussion = schema.Text(
discussion = HtmlText(
title=_(u'label_discussion'),
description=_(u'desc_discussion.'),
description=_(u'desc_discussion'),
default=u'',
missing_value=u'',
required=False)
consequences = schema.Text(
consequences = HtmlText(
title=_(u'label_consequences'),
description=_(u'desc_consequences.'),
description=_(u'desc_consequences'),
default=u'',
missing_value=u'',
required=False)
description.height = discussion.height = consequences.height = 5
# 'hasrole' predicate

View file

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