Merge branch 'master' into bbmaster

This commit is contained in:
Helmut Merz 2012-07-16 10:05:38 +02:00
commit e21adfa364
6 changed files with 50 additions and 25 deletions

View file

@ -392,6 +392,40 @@ class BaseView(GenericView, I18NView):
def uniqueId(self): def uniqueId(self):
return util.getUidForObject(self.context) return util.getUidForObject(self.context)
@Lazy
def breadcrumbsTitle(self):
return self.title
@Lazy
def listingTitle(self):
return self.title
def getViewForObject(self, obj):
if obj is not None:
obj = baseObject(obj)
basicView = component.getMultiAdapter((obj, self.request))
if hasattr(basicView, 'view'):
return basicView.view
def viewIterator(self, objs):
request = self.request
for obj in objs:
view = self.getViewForObject(obj)
if view is None:
view = BaseView(obj, request)
yield view
def xx_viewIterator(self,obj):
view = component.queryMultiAdapter(
(o, request), name='index.html')
#if view is None:
# view = component.queryMultiAdapter((o, request), IBrowserView)
if view is None:
view = BaseView(o, request)
if hasattr(view, 'view'): # use view setting for type
view = view.view
yield view
# type stuff # type stuff
@Lazy @Lazy
@ -434,16 +468,6 @@ class BaseView(GenericView, I18NView):
return absoluteURL(provider, self.request) return absoluteURL(provider, self.request)
return None return None
def viewIterator(self, objs):
request = self.request
for o in objs:
view = component.queryMultiAdapter((o, request), name='index.html')
#if view is None:
# view = component.queryMultiAdapter((o, request), IBrowserView)
if view is None:
view = BaseView(o, request)
yield view
def renderText(self, text, contentType): def renderText(self, text, contentType):
text = util.toUnicode(text) text = util.toUnicode(text)
typeKey = util.renderingFactories.get(contentType, None) typeKey = util.renderingFactories.get(contentType, None)

View file

@ -397,6 +397,8 @@ class CreateConceptForm(CreateObjectForm):
parentType.getChildren([subtypePred])) parentType.getChildren([subtypePred]))
types = [dict(token=ConceptTypeInfo(t).token, title=t.title) types = [dict(token=ConceptTypeInfo(t).token, title=t.title)
for t in tconcepts] for t in tconcepts]
if self.defaultTypeToken is None and types:
self.defaultTypeToken = types[0]['token']
if include or include is None: if include or include is None:
return util.KeywordVocabulary(types + self.listTypes(include, ('hidden',))) return util.KeywordVocabulary(types + self.listTypes(include, ('hidden',)))
return util.KeywordVocabulary(types) return util.KeywordVocabulary(types)

View file

@ -78,7 +78,10 @@
id="dialog_form" class="dialog" id="dialog_form" class="dialog"
dojoType="dijit.form.Form" dojoType="dijit.form.Form"
tal:define="qualifier request/qualifier|view/qualifier|string:resource; tal:define="qualifier request/qualifier|view/qualifier|string:resource;
innerForm request/inner_form|view/inner_form|string:inner_form.html; innerForm
request/inner_form|view/inner_form|string:inner_form.html;
typesVocabulary python:
view.getTypesVocabulary((qualifier,));
typeToken view/typeToken; typeToken view/typeToken;
fixedType view/fixedType; fixedType view/fixedType;
langInfo view/languageInfo; langInfo view/languageInfo;
@ -104,8 +107,7 @@
'${view/virtualTargetUrl}/$innerForm')"> '${view/virtualTargetUrl}/$innerForm')">
<option value=".loops/concepts/note" <option value=".loops/concepts/note"
i18n:translate="" i18n:translate=""
tal:repeat="type python: tal:repeat="type typesVocabulary"
view.getTypesVocabulary((qualifier,))"
tal:content="type/title" tal:content="type/title"
tal:attributes="value type/token; tal:attributes="value type/token;
selected python:type.token == typeToken"> selected python:type.token == typeToken">
@ -115,12 +117,6 @@
<input type="hidden" name="form.type" <input type="hidden" name="form.type"
tal:condition="fixedType" tal:condition="fixedType"
tal:attributes="value typeToken" /> tal:attributes="value typeToken" />
<script type="text/javascript"
tal:condition="not:fixedType"
tal:content="string:replaceFieldsNode(
'form.fields', 'form.type',
'${view/virtualTargetUrl}/$innerForm')">
</script>
</th></tr></tbody> </th></tr></tbody>
<tbody><tr><td colspan="5"> <tbody><tr><td colspan="5">
@ -313,7 +309,7 @@
<input value="Save" type="submit" <input value="Save" type="submit"
i18n:attributes="value" i18n:attributes="value"
tal:attributes="onClick python: view.closeAction(True) or tal:attributes="onClick python: view.closeAction(True) or
'submit()'"> 'return true'">
<input type="button" value="Cancel" onClick="dlg.hide();" <input type="button" value="Cancel" onClick="dlg.hide();"
i18n:attributes="value" i18n:attributes="value"
tal:condition="view/isInnerHtml" tal:condition="view/isInnerHtml"

View file

@ -122,7 +122,7 @@
<img tal:define="icon row/icon" <img tal:define="icon row/icon"
tal:condition="icon" tal:condition="icon"
tal:attributes="src icon/src" /> tal:attributes="src icon/src" />
<div tal:content="row/title" /></a> <div tal:content="row/listingTitle" /></a>
</td> </td>
<td i18n:translate="" class="center" <td i18n:translate="" class="center"
tal:content="row/longTypeTitle|row/typeTitle">Type</td> tal:content="row/longTypeTitle|row/typeTitle">Type</td>

View file

@ -37,7 +37,7 @@ from loops import util
class Field(BaseField): class Field(BaseField):
def getSelectValue(self, row): def getSelectValue(self, row):
return self.getRawValue(row) return self.getValue(row)
class TextField(Field): class TextField(Field):

View file

@ -18,8 +18,6 @@
""" """
Adapter and view class(es) for statistics reporting. Adapter and view class(es) for statistics reporting.
$Id$
""" """
from datetime import date, datetime from datetime import date, datetime
@ -268,9 +266,14 @@ class TrackDetails(BaseView):
obj = self.object obj = self.object
node = self.view.nodeView node = self.view.nodeView
url = node is not None and node.getUrlForTarget(obj) or '' url = node is not None and node.getUrlForTarget(obj) or ''
view = self.view.getViewForObject(obj)
if view is None:
title = obj.title
else:
title = view.listingTitle
versionable = IVersionable(self.object, None) versionable = IVersionable(self.object, None)
version = versionable is not None and versionable.versionId or '' version = versionable is not None and versionable.versionId or ''
return dict(object=obj, title=obj.title, return dict(object=obj, title=title,
type=self.longTypeTitle, url=url, version=version, type=self.longTypeTitle, url=url, version=version,
canAccess=canAccessObject(obj)) canAccess=canAccessObject(obj))