Merge branch 'master' into bbmaster

This commit is contained in:
Helmut Merz 2012-04-07 12:27:05 +02:00
commit 7b1f04e7ab
18 changed files with 130 additions and 66 deletions

View file

@ -230,7 +230,7 @@
<tal:version tal:condition="view/useVersioning"> <tal:version tal:condition="view/useVersioning">
<td class="center" <td class="center"
tal:define="versionId related/versionId"> tal:define="versionId related/versionId">
<a href="#" <a tal:condition="not:related/versionable/notVersioned|nothing"
tal:content="versionId" tal:content="versionId"
tal:omit-tag="python: versionId=='1.1'" tal:omit-tag="python: versionId=='1.1'"
tal:define="url python: view.getUrlForTarget(related)" tal:define="url python: view.getUrlForTarget(related)"

View file

@ -642,8 +642,11 @@ class EditObject(FormController, I18NView):
def checkCreateVersion(self, obj): def checkCreateVersion(self, obj):
form = self.request.form form = self.request.form
if form.get('version.create'):
versionable = IVersionable(obj) versionable = IVersionable(obj)
notVersioned = bool(form.get('version.not_versioned'))
if notVersioned != versionable.notVersioned:
versionable.notVersioned = notVersioned
if not notVersioned and form.get('version.create'):
level = int(form.get('version.level', 0)) level = int(form.get('version.level', 0))
version = versionable.createVersion(level) version = versionable.createVersion(level)
notify(ObjectCreatedEvent(version)) notify(ObjectCreatedEvent(version))

View file

@ -1,6 +1,5 @@
<html i18n:domain="loops"> <html i18n:domain="loops">
<!-- macros for rendering edit/create forms <!-- macros for rendering edit/create forms -->
$Id$ -->
<form metal:define-macro="edit" i18n:domain="loops" <form metal:define-macro="edit" i18n:domain="loops"
@ -81,7 +80,9 @@
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;
typeToken view/typeToken; typeToken view/typeToken;
fixedType view/fixedType"> fixedType view/fixedType;
langInfo view/languageInfo;
language langInfo/language">
<div dojoType="dijit.layout.ContentPane" region="center" <div dojoType="dijit.layout.ContentPane" region="center"
tal:omit-tag="not:view/isInnerHtml"> tal:omit-tag="not:view/isInnerHtml">
<input type="hidden" name="form.action" value="create" <input type="hidden" name="form.action" value="create"
@ -229,12 +230,25 @@
<metal:versioning define-macro="versioning" <metal:versioning define-macro="versioning"
tal:define="versionInfo view/versionInfo" tal:define="versionInfo view/versionInfo;
notVersioned view/versionable/notVersioned|nothing"
tal:condition="versionInfo"> tal:condition="versionInfo">
<tr> <tr>
<td colspan="5" i18n:translate="" class="headline">Versioning</td> <td colspan="1" i18n:translate="" class="headline">Versioning</td>
<td colspan="4">
<span i18n:attributes="title"
title="Check this field if you want to suppress versioning for this resource.">
<input type="checkbox"
name="version.not_versioned" id="version.not_versioned"
value="not_versioned"
tal:attributes="checked notVersioned" />
<label style="display: inline"
for="version.not_versioned"><span i18n:translate="">
Suppress Versioning</span></label>
</span>
</td>
</tr> </tr>
<tr> <tr tal:condition="not:notVersioned">
<td colspan="2"> <td colspan="2">
<span i18n:translate="">Version</span>: <span i18n:translate="">Version</span>:
<span tal:content="versionInfo">1.1 (current, released)</span> <span tal:content="versionInfo">1.1 (current, released)</span>

View file

@ -39,6 +39,14 @@
factory="loops.browser.lobo.standard.List1" factory="loops.browser.lobo.standard.List1"
permission="zope.View" /> permission="zope.View" />
<zope:adapter
name="lobo_l3"
for="loops.interfaces.IConcept
loops.browser.skin.Lobo"
provides="zope.interface.Interface"
factory="loops.browser.lobo.standard.List3"
permission="zope.View" />
<zope:adapter <zope:adapter
name="lobo_l2" name="lobo_l2"
for="loops.interfaces.IConcept for="loops.interfaces.IConcept

View file

@ -17,7 +17,7 @@
title cell/description"> title cell/description">
<div class="legend"> <div class="legend">
<b tal:content="cell/title" /><br /> <b tal:content="cell/title" /><br />
<i tal:content="structure cell/textRepresentation" /> <span tal:content="structure cell/textRepresentation" />
</div> </div>
</a> </a>
</div> </div>
@ -43,6 +43,16 @@
</metal:block> </metal:block>
<metal:block define-macro="list3">
<tal:cell repeat="cell part/getChildren">
<div tal:condition="cell/img"
tal:attributes="class python:cell.cssClass[0]">
<metal:image use-macro="item/macros/image" />
</div>
</tal:cell>
</metal:block>
<metal:block define-macro="header"> <metal:block define-macro="header">
<div tal:define="cell part/getView"> <div tal:define="cell part/getView">
<metal:headline use-macro="item/macros/headline" /> <metal:headline use-macro="item/macros/headline" />
@ -83,7 +93,8 @@
style cell/style"> style cell/style">
<metal:image use-macro="item/macros/image" /> <metal:image use-macro="item/macros/image" />
<div class="legend"> <div class="legend">
<a tal:attributes="href cell/targetUrl"><b tal:content="cell/title" /></a> <a tal:attributes="href cell/targetUrl">
<b tal:content="python: cell.description or cell.title" /></a>
<span tal:condition="cell/img/showInfo|nothing"> <span tal:condition="cell/img/showInfo|nothing">
<a tal:define="url string:${cell/img/url}/meta_info.html" <a tal:define="url string:${cell/img/url}/meta_info.html"
tal:attributes="href url; tal:attributes="href url;
@ -93,7 +104,7 @@
string:${controller/resourceBase}/cybertools.icons/info.png" /> string:${controller/resourceBase}/cybertools.icons/info.png" />
</a></span> </a></span>
<br /> <br />
<i tal:content="cell/description" /> <!--<i tal:content="cell/description" />-->
</div> </div>
</div> </div>
</tal:cell> </tal:cell>
@ -104,11 +115,10 @@
<metal:image define-macro="image"> <metal:image define-macro="image">
<tal:img condition="cell/img"> <tal:img condition="cell/img">
<a title="Information about this object." <a dojoType="dojox.image.Lightbox" group="mediasset"
dojoType="dojox.image.Lightbox" group="mediasset"
i18n:attributes="title" i18n:attributes="title"
tal:attributes="href cell/img/fullImageUrl; tal:attributes="href cell/img/fullImageUrl;
title cell/img/title"> title python: cell.img['description'] or cell.img['title']">
<img tal:condition="showImageLink|python:False" <img tal:condition="showImageLink|python:False"
tal:attributes="src cell/img/src; tal:attributes="src cell/img/src;
class cell/img/cssClass; class cell/img/cssClass;
@ -142,8 +152,9 @@
<img tal:attributes="src string:$resourceBase/cybertools.icons/table.png" /> <img tal:attributes="src string:$resourceBase/cybertools.icons/table.png" />
</a> </a>
</h1> </h1>
<div tal:condition="cell/description"> <div class="head-description"
<i tal:content="structure cell/renderedDescription" /> tal:condition="cell/description">
<span tal:content="structure cell/renderedDescription" />
&nbsp;</div> &nbsp;</div>
</metal:block> </metal:block>

View file

@ -144,6 +144,7 @@ class ConceptView(BaseConceptView):
adImg = adapted(r) adImg = adapted(r)
showInfo = adImg.showInfo and adImg.metaInfo showInfo = adImg.showInfo and adImg.metaInfo
return dict(src=src, fullImageUrl=fullSrc, title=r.title, return dict(src=src, fullImageUrl=fullSrc, title=r.title,
description=r.description,
url=url, cssClass=self.parentView.imageCssClass, url=url, cssClass=self.parentView.imageCssClass,
showInfo=showInfo) showInfo=showInfo)
@ -245,6 +246,13 @@ class List2(BasePart):
gridPattern = [['span-4 clear', 'span-2 last']] gridPattern = [['span-4 clear', 'span-2 last']]
class List3(BasePart):
macroName = 'list3'
imageSize = 'large'
gridPattern = [['span-6 clear']]
class Header0(BasePart): class Header0(BasePart):
macroName = 'header' macroName = 'header'
@ -313,6 +321,7 @@ class ConceptRelationView(BaseConceptRelationView, ConceptView):
adImg = adapted(r) adImg = adapted(r)
showInfo = adImg.showInfo and adImg.metaInfo showInfo = adImg.showInfo and adImg.metaInfo
return dict(src=src, fullImageUrl=fullSrc, title=r.title, return dict(src=src, fullImageUrl=fullSrc, title=r.title,
description=r.description,
url=url, cssClass=self.parentView.imageCssClass, url=url, cssClass=self.parentView.imageCssClass,
showInfo=showInfo) showInfo=showInfo)
@ -347,6 +356,7 @@ class ResourceView(BaseResourceView):
adImg = adapted(self.context) adImg = adapted(self.context)
showInfo = adImg.showInfo and adImg.metaInfo showInfo = adImg.showInfo and adImg.metaInfo
return dict(src=src, fullImageUrl=fullSrc, title=self.context.title, return dict(src=src, fullImageUrl=fullSrc, title=self.context.title,
description=self.context.description,
url=url, cssClass=self.parentView.imageCssClass, url=url, cssClass=self.parentView.imageCssClass,
showInfo=showInfo) showInfo=showInfo)

View file

@ -146,9 +146,9 @@ class ResourceView(BaseView):
subMacro=self.template.macros['related'], subMacro=self.template.macros['related'],
priority=20, info=self) priority=20, info=self)
versionable = IVersionable(self.context, None) versionable = IVersionable(self.context, None)
if versionable is not None and len(versionable.versions) > 1: if (versionable is not None and
not versionable.notVersioned and len(versionable.versions) > 1):
cont.macros.register('portlet_right', 'versions', cont.macros.register('portlet_right', 'versions',
#title=' '. join((_('Version'), versionable.versionId)),
title=_(u'Version ${versionId}', title=_(u'Version ${versionId}',
mapping=dict(versionId=versionable.versionId)), mapping=dict(versionId=versionable.versionId)),
subMacro=version_macros.macros['portlet_versions'], subMacro=version_macros.macros['portlet_versions'],

View file

@ -66,17 +66,16 @@
<p><i tal:content="structure item/renderedDescription">Description</i>&nbsp;</p> <p><i tal:content="structure item/renderedDescription">Description</i>&nbsp;</p>
<p> <p>
<span class="button"> <span class="button">
<a href="#" <a i18n:translate=""
i18n:translate=""
tal:attributes="href tal:attributes="href
string:${view/virtualTargetUrl}/download.html?version=this"> string:${view/virtualTargetUrl}/download.html?version=this">
Download Download
</a> </a>
</span> </span>
<span class="button" <span class="button"
tal:condition="item/viewable | nothing"> tal:define="viewable item/viewable|nothing"
<a href="#" tal:condition="python: viewable and not view.typeOptions('no_view_button')">
i18n:translate="" <a i18n:translate=""
tal:attributes="href tal:attributes="href
string:${view/virtualTargetUrl}/view?version=this"> string:${view/virtualTargetUrl}/view?version=this">
View View
@ -84,7 +83,7 @@
</span> </span>
<span class="button" <span class="button"
tal:condition="item/xeditable"> tal:condition="item/xeditable">
<a href="#" title="Edit with External Editor" <a title="Edit with External Editor"
i18n:translate="" i18n:translate=""
tal:define="url view/virtualTargetUrl" tal:define="url view/virtualTargetUrl"
tal:attributes="href string:$url/external_edit?version=this"> tal:attributes="href string:$url/external_edit?version=this">

View file

@ -16,7 +16,7 @@
tal:attributes="src string:${resourceBase}logo.png" /></a> tal:attributes="src string:${resourceBase}logo.png" /></a>
<hr /> <hr />
</div> </div>
<div id="top-actions" class="prepend-4 span-4 last" <div id="top-actions" class="prepend-6 span-2 last"
metal:define-slot="top-actions"> metal:define-slot="top-actions">
<tal:action repeat="macro controller/macros/top_actions"> <tal:action repeat="macro controller/macros/top_actions">
<metal:action use-macro="macro" /> <metal:action use-macro="macro" />

View file

@ -6,10 +6,26 @@
/* page sections */ /* page sections */
body {
background-color: #f8f8f8;
}
.container {
padding: 15px 20px 20px 20px;
background-color: #ffffff;
margin-top: 20px;
margin-bottom: 20px;
border: 1px solid #d0d0d0;
}
#portlets { #portlets {
margin-top: 1em; margin-top: 1em;
} }
.head-description, .legend {
font-style: italic;
}
ul.view-modes { ul.view-modes {
padding: 0 0 0 2em; padding: 0 0 0 2em;
margin: 0.7em 0 0 0; margin: 0.7em 0 0 0;
@ -244,12 +260,7 @@ fieldset.box td {
.top-actions { .top-actions {
position: absolute; position: absolute;
top: 1em; top: 30px;
}
.quicksearch {
position: absolute;
top: 0.5em;
} }
.quicksearch input { .quicksearch input {
@ -258,13 +269,13 @@ fieldset.box td {
.language-switch { .language-switch {
position: absolute; position: absolute;
top: 2.5em; top: 55px;
} }
.page-actions { .page-actions {
position: absolute; position: absolute;
top: 0.8em; top: 55px;
margin-left: 18.5em; margin-left: 210px;
} }
.top image { .top image {

View file

@ -13,6 +13,6 @@ body {
#content { #content {
/* width: 100%; */ /* width: 100%; */
width: 70%; width: 80%;
color: Black; color: Black;
} }

View file

@ -129,7 +129,7 @@
<tal:version condition="view/useVersioning"> <tal:version condition="view/useVersioning">
<td class="center" <td class="center"
tal:define="versionId row/versionId|string:"> tal:define="versionId row/versionId|string:">
<a href="#" <a tal:condition="not:row/versionable/notVersioned|nothing"
tal:content="versionId" tal:content="versionId"
tal:omit-tag="python: versionId and versionId=='1.1'" tal:omit-tag="python: versionId and versionId=='1.1'"
tal:attributes="href tal:attributes="href

View file

@ -52,7 +52,7 @@ the default language using a LanguageInfo object that is similar to a view.
>>> from loops.i18n.browser import LanguageInfo >>> from loops.i18n.browser import LanguageInfo
>>> langInfo = LanguageInfo(topic01, TestRequest()) >>> langInfo = LanguageInfo(topic01, TestRequest())
>>> langInfo.availableLanguages >>> langInfo.availableLanguages
[] <AutoElement 'languages'>
>>> langInfo.language is None >>> langInfo.language is None
True True
>>> langInfo.defaultLanguage is None >>> langInfo.defaultLanguage is None

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 2008 Helmut Merz helmutm@cy55.de # Copyright (c) 2012 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
@ -18,8 +18,6 @@
""" """
View extension for support of i18n content. View extension for support of i18n content.
$Id$
""" """
from zope import interface, component from zope import interface, component
@ -29,6 +27,7 @@ from zope.cachedescriptors.property import Lazy
from zope.i18n.interfaces import IUserPreferredLanguages from zope.i18n.interfaces import IUserPreferredLanguages
from zope.i18n.negotiator import negotiator from zope.i18n.negotiator import negotiator
from cybertools.meta.interfaces import IOptions
from loops.common import adapted from loops.common import adapted
@ -50,12 +49,7 @@ class LanguageInfo(object):
@Lazy @Lazy
def availableLanguages(self): def availableLanguages(self):
for opt in self.loopsRoot.options: return IOptions(self.loopsRoot).languages
if opt.startswith('languages:'):
return opt[len('languages:'):].split(',')
return []
# new implementation:
# return IOptions(self.context).i18n.languages
@Lazy @Lazy
def defaultLanguage(self): def defaultLanguage(self):
@ -64,10 +58,12 @@ class LanguageInfo(object):
@Lazy @Lazy
def language(self): def language(self):
available = self.availableLanguages or ('en', 'de')
if len(available) == 1:
return available[0]
lang = self.request.get('loops.language') lang = self.request.get('loops.language')
if lang is not None and lang in self.availableLanguages: if lang is not None and lang in available:
return lang return lang
available = self.availableLanguages or ('en', 'de',)
return (negotiator.getLanguage(available, self.request) return (negotiator.getLanguage(available, self.request)
or self.defaultLanguage) or self.defaultLanguage)
@ -95,7 +91,7 @@ class I18NView(object):
def checkLanguage(self): def checkLanguage(self):
session = ISession(self.request)[packageId] session = ISession(self.request)[packageId]
lang = session.get('language') lang = session.get('language') or self.languageInfo.language
if lang: if lang:
self.setLanguage(lang) self.setLanguage(lang)

Binary file not shown.

View file

@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: $Id$\n" "Project-Id-Version: $Id$\n"
"POT-Creation-Date: 2007-05-22 12:00 CET\n" "POT-Creation-Date: 2007-05-22 12:00 CET\n"
"PO-Revision-Date: 2012-02-16 12:00 CET\n" "PO-Revision-Date: 2012-03-28 12:00 CET\n"
"Last-Translator: Helmut Merz <helmutm@cy55.de>\n" "Last-Translator: Helmut Merz <helmutm@cy55.de>\n"
"Language-Team: loops developers <helmutm@cy55.de>\n" "Language-Team: loops developers <helmutm@cy55.de>\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -437,6 +437,12 @@ msgstr "Suchbegriff"
msgid "Select if you want to create a new version" msgid "Select if you want to create a new version"
msgstr "Bitte markieren, wenn Sie eine neue Version anlegen möchten" msgstr "Bitte markieren, wenn Sie eine neue Version anlegen möchten"
msgid "Suppress Versioning"
msgstr "Keine Versionierung"
msgid "Check this field if you want to suppress versioning for this resource."
msgstr "Bitte markieren, wenn diese Ressource nicht versioniert werden soll."
msgid "Search text" msgid "Search text"
msgstr "Suchtext" msgstr "Suchtext"

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 2006 Helmut Merz helmutm@cy55.de # Copyright (c) 2012 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
@ -18,8 +18,6 @@
""" """
Versioning interfaces. Versioning interfaces.
$Id$
""" """
from zope.interface import Interface, Attribute from zope.interface import Interface, Attribute
@ -30,31 +28,34 @@ class IVersionable(Interface):
""" An object that may exist in different versions. """ An object that may exist in different versions.
""" """
versionNumbers = Attribute(u'A tuple of version numbers for the context ' versionNumbers = Attribute('A tuple of version numbers for the context '
'object, with a number for each level') 'object, with a number for each level')
variantIds = Attribute(u'A tuple of variant IDs (e.g. for language ' variantIds = Attribute('A tuple of variant IDs (e.g. for language '
'varuants) for the context object') 'varuants) for the context object')
versionId = Attribute(u'A string identifying this version, e.g. 1.1_de, ' versionId = Attribute('A string identifying this version, e.g. 1.1_de, '
'derived from versionNumbers and variantIds') 'derived from versionNumbers and variantIds')
master = Attribute(u'The object (master version) that should be used for access to ' master = Attribute('The object (master version) that should be used for access to '
'version-independent attributes and central ' 'version-independent attributes and central '
'versioning metadata') 'versioning metadata')
parent = Attribute(u'The version this one was created from') parent = Attribute('The version this one was created from')
comment = Attribute(u'Somme informative text provided when creating ' comment = Attribute('Somme informative text provided when creating '
'this version') 'this version')
# attributes taken from the master version: # attributes taken from the master version:
versions = Attribute(u'A dictionary of all versions of this object') versions = Attribute('A dictionary of all versions of this object')
currentVersion = Attribute(u'The default version to be used for editing') currentVersion = Attribute('The default version to be used for editing')
releasedVersion = Attribute(u'The default version to be used for viewing') releasedVersion = Attribute('The default version to be used for viewing')
notVersioned = Attribute('A boolean that is True if this object should '
'not be versioned')
def createVersion(level=1): def createVersion(level=1):
""" Create a copy of the context object as a new version and return it. """ Create a copy of the context object as a new version and return it.

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 2007 Helmut Merz helmutm@cy55.de # Copyright (c) 2012 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
@ -18,8 +18,6 @@
""" """
Utilities for managing version informations. Utilities for managing version informations.
$Id$
""" """
from BTrees.OOBTree import OOBTree from BTrees.OOBTree import OOBTree
@ -129,6 +127,13 @@ class VersionableResource(object):
m = self.versionableMaster m = self.versionableMaster
return self.versionableMaster.getVersioningAttribute('releasedVersion', None) return self.versionableMaster.getVersioningAttribute('releasedVersion', None)
def getNotVersioned(self):
m = self.versionableMaster
return self.versionableMaster.getVersioningAttribute('notVersioned', False)
def setNotVersioned(self, value):
self.versionableMaster.setVersioningAttribute('notVersioned', bool(value))
notVersioned = property(getNotVersioned, setNotVersioned)
def createVersionObject(self, versionNumbers, variantIds, comment=u''): def createVersionObject(self, versionNumbers, variantIds, comment=u''):
versionableMaster = self.versionableMaster versionableMaster = self.versionableMaster
versionableMaster.initVersions() versionableMaster.initVersions()