Merge branch 'master' into bbmaster
This commit is contained in:
		
						commit
						7b1f04e7ab
					
				
					 18 changed files with 130 additions and 66 deletions
				
			
		|  | @ -230,7 +230,7 @@ | |||
|                 <tal:version tal:condition="view/useVersioning"> | ||||
|                   <td class="center" | ||||
|                       tal:define="versionId related/versionId"> | ||||
|                     <a href="#" | ||||
|                     <a tal:condition="not:related/versionable/notVersioned|nothing" | ||||
|                        tal:content="versionId" | ||||
|                        tal:omit-tag="python: versionId=='1.1'" | ||||
|                        tal:define="url python: view.getUrlForTarget(related)" | ||||
|  |  | |||
|  | @ -642,8 +642,11 @@ class EditObject(FormController, I18NView): | |||
| 
 | ||||
|     def checkCreateVersion(self, obj): | ||||
|         form = self.request.form | ||||
|         if form.get('version.create'): | ||||
|         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)) | ||||
|             version = versionable.createVersion(level) | ||||
|             notify(ObjectCreatedEvent(version)) | ||||
|  |  | |||
|  | @ -1,6 +1,5 @@ | |||
| <html i18n:domain="loops"> | ||||
| <!-- macros for rendering edit/create forms | ||||
|      $Id$ --> | ||||
| <!-- macros for rendering edit/create forms --> | ||||
| 
 | ||||
| 
 | ||||
| <form metal:define-macro="edit" i18n:domain="loops" | ||||
|  | @ -81,7 +80,9 @@ | |||
|         tal:define="qualifier request/qualifier|view/qualifier|string:resource; | ||||
|                     innerForm request/inner_form|view/inner_form|string:inner_form.html; | ||||
|                     typeToken view/typeToken; | ||||
|                     fixedType view/fixedType"> | ||||
|                     fixedType view/fixedType; | ||||
|                     langInfo view/languageInfo; | ||||
|                     language langInfo/language"> | ||||
|     <div dojoType="dijit.layout.ContentPane" region="center" | ||||
|          tal:omit-tag="not:view/isInnerHtml"> | ||||
|       <input type="hidden" name="form.action" value="create" | ||||
|  | @ -229,12 +230,25 @@ | |||
| 
 | ||||
| 
 | ||||
| <metal:versioning define-macro="versioning" | ||||
|                   tal:define="versionInfo view/versionInfo" | ||||
|                   tal:define="versionInfo view/versionInfo; | ||||
|                               notVersioned view/versionable/notVersioned|nothing" | ||||
|                   tal:condition="versionInfo"> | ||||
|       <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 tal:condition="not:notVersioned"> | ||||
|         <td colspan="2"> | ||||
|           <span i18n:translate="">Version</span>: | ||||
|           <span tal:content="versionInfo">1.1 (current, released)</span> | ||||
|  |  | |||
|  | @ -39,6 +39,14 @@ | |||
|         factory="loops.browser.lobo.standard.List1" | ||||
|         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 | ||||
|         name="lobo_l2" | ||||
|         for="loops.interfaces.IConcept | ||||
|  |  | |||
|  | @ -17,7 +17,7 @@ | |||
|                          title cell/description"> | ||||
|         <div class="legend"> | ||||
|           <b tal:content="cell/title" /><br /> | ||||
|           <i tal:content="structure cell/textRepresentation" /> | ||||
|           <span tal:content="structure cell/textRepresentation" /> | ||||
|         </div> | ||||
|       </a> | ||||
|     </div> | ||||
|  | @ -43,6 +43,16 @@ | |||
| </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"> | ||||
|   <div tal:define="cell part/getView"> | ||||
|     <metal:headline use-macro="item/macros/headline" /> | ||||
|  | @ -83,7 +93,8 @@ | |||
|                          style cell/style"> | ||||
|         <metal:image use-macro="item/macros/image" /> | ||||
|         <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"> | ||||
|             <a tal:define="url string:${cell/img/url}/meta_info.html" | ||||
|                tal:attributes="href url; | ||||
|  | @ -93,7 +104,7 @@ | |||
|                     string:${controller/resourceBase}/cybertools.icons/info.png" /> | ||||
|             </a></span> | ||||
|           <br /> | ||||
|           <i tal:content="cell/description" /> | ||||
|           <!--<i tal:content="cell/description" />--> | ||||
|         </div> | ||||
|     </div> | ||||
|   </tal:cell> | ||||
|  | @ -104,11 +115,10 @@ | |||
| 
 | ||||
| <metal:image define-macro="image"> | ||||
|   <tal:img condition="cell/img"> | ||||
|     <a title="Information about this object." | ||||
|        dojoType="dojox.image.Lightbox" group="mediasset" | ||||
|     <a dojoType="dojox.image.Lightbox" group="mediasset" | ||||
|        i18n:attributes="title" | ||||
|        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" | ||||
|            tal:attributes="src cell/img/src; | ||||
|                            class cell/img/cssClass; | ||||
|  | @ -142,8 +152,9 @@ | |||
|       <img tal:attributes="src string:$resourceBase/cybertools.icons/table.png" /> | ||||
|     </a> | ||||
|   </h1> | ||||
|   <div tal:condition="cell/description"> | ||||
|     <i tal:content="structure cell/renderedDescription" /> | ||||
|   <div class="head-description" | ||||
|        tal:condition="cell/description"> | ||||
|     <span tal:content="structure cell/renderedDescription" /> | ||||
|      </div> | ||||
| </metal:block> | ||||
| 
 | ||||
|  |  | |||
|  | @ -144,6 +144,7 @@ class ConceptView(BaseConceptView): | |||
|             adImg = adapted(r) | ||||
|             showInfo = adImg.showInfo and adImg.metaInfo | ||||
|             return dict(src=src, fullImageUrl=fullSrc, title=r.title, | ||||
|                         description=r.description, | ||||
|                         url=url, cssClass=self.parentView.imageCssClass, | ||||
|                         showInfo=showInfo) | ||||
| 
 | ||||
|  | @ -245,6 +246,13 @@ class List2(BasePart): | |||
|     gridPattern = [['span-4 clear', 'span-2 last']] | ||||
| 
 | ||||
| 
 | ||||
| class List3(BasePart): | ||||
| 
 | ||||
|     macroName = 'list3' | ||||
|     imageSize = 'large' | ||||
|     gridPattern = [['span-6 clear']] | ||||
| 
 | ||||
| 
 | ||||
| class Header0(BasePart): | ||||
| 
 | ||||
|     macroName = 'header' | ||||
|  | @ -313,6 +321,7 @@ class ConceptRelationView(BaseConceptRelationView, ConceptView): | |||
|             adImg = adapted(r) | ||||
|             showInfo = adImg.showInfo and adImg.metaInfo | ||||
|             return dict(src=src, fullImageUrl=fullSrc, title=r.title, | ||||
|                         description=r.description, | ||||
|                         url=url, cssClass=self.parentView.imageCssClass, | ||||
|                         showInfo=showInfo) | ||||
| 
 | ||||
|  | @ -347,6 +356,7 @@ class ResourceView(BaseResourceView): | |||
|         adImg = adapted(self.context) | ||||
|         showInfo = adImg.showInfo and adImg.metaInfo | ||||
|         return dict(src=src, fullImageUrl=fullSrc, title=self.context.title, | ||||
|                     description=self.context.description, | ||||
|                     url=url, cssClass=self.parentView.imageCssClass, | ||||
|                     showInfo=showInfo) | ||||
| 
 | ||||
|  |  | |||
|  | @ -146,9 +146,9 @@ class ResourceView(BaseView): | |||
|                             subMacro=self.template.macros['related'], | ||||
|                             priority=20, info=self) | ||||
|             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', | ||||
|                             #title=' '. join((_('Version'), versionable.versionId)), | ||||
|                             title=_(u'Version ${versionId}', | ||||
|                                     mapping=dict(versionId=versionable.versionId)), | ||||
|                             subMacro=version_macros.macros['portlet_versions'], | ||||
|  |  | |||
|  | @ -66,17 +66,16 @@ | |||
|     <p><i tal:content="structure item/renderedDescription">Description</i> </p> | ||||
|     <p> | ||||
|       <span class="button"> | ||||
|         <a href="#" | ||||
|            i18n:translate="" | ||||
|         <a i18n:translate="" | ||||
|            tal:attributes="href | ||||
|                 string:${view/virtualTargetUrl}/download.html?version=this"> | ||||
|           Download | ||||
|         </a> | ||||
|       </span> | ||||
|       <span class="button" | ||||
|             tal:condition="item/viewable | nothing"> | ||||
|         <a href="#" | ||||
|            i18n:translate="" | ||||
|             tal:define="viewable item/viewable|nothing" | ||||
|             tal:condition="python: viewable and not view.typeOptions('no_view_button')"> | ||||
|         <a i18n:translate="" | ||||
|            tal:attributes="href | ||||
|                 string:${view/virtualTargetUrl}/view?version=this"> | ||||
|           View | ||||
|  | @ -84,7 +83,7 @@ | |||
|       </span> | ||||
|       <span class="button" | ||||
|             tal:condition="item/xeditable"> | ||||
|         <a href="#" title="Edit with External Editor" | ||||
|         <a title="Edit with External Editor" | ||||
|            i18n:translate="" | ||||
|            tal:define="url view/virtualTargetUrl" | ||||
|            tal:attributes="href string:$url/external_edit?version=this"> | ||||
|  |  | |||
|  | @ -16,7 +16,7 @@ | |||
|                tal:attributes="src string:${resourceBase}logo.png" /></a> | ||||
|         <hr /> | ||||
|       </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"> | ||||
|           <tal:action repeat="macro controller/macros/top_actions"> | ||||
|             <metal:action use-macro="macro" /> | ||||
|  |  | |||
|  | @ -6,10 +6,26 @@ | |||
| 
 | ||||
| /* 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 { | ||||
|     margin-top: 1em; | ||||
| } | ||||
| 
 | ||||
| .head-description, .legend { | ||||
|     font-style: italic; | ||||
| } | ||||
| 
 | ||||
| ul.view-modes { | ||||
|     padding: 0 0 0 2em; | ||||
|     margin: 0.7em 0 0 0; | ||||
|  | @ -244,12 +260,7 @@ fieldset.box td { | |||
| 
 | ||||
| .top-actions { | ||||
|     position: absolute; | ||||
|     top: 1em; | ||||
| } | ||||
| 
 | ||||
| .quicksearch { | ||||
|     position: absolute; | ||||
|     top: 0.5em; | ||||
|     top: 30px; | ||||
| } | ||||
| 
 | ||||
| .quicksearch input { | ||||
|  | @ -258,13 +269,13 @@ fieldset.box td { | |||
| 
 | ||||
| .language-switch { | ||||
|     position: absolute; | ||||
|     top: 2.5em; | ||||
|     top: 55px; | ||||
| } | ||||
| 
 | ||||
| .page-actions { | ||||
|     position: absolute; | ||||
|     top: 0.8em; | ||||
|     margin-left: 18.5em; | ||||
|     top: 55px; | ||||
|     margin-left: 210px; | ||||
| } | ||||
| 
 | ||||
| .top image { | ||||
|  |  | |||
|  | @ -13,6 +13,6 @@ body { | |||
| 
 | ||||
| #content { | ||||
| /*  width: 100%; */ | ||||
|     width: 70%; | ||||
|     width: 80%; | ||||
|     color: Black; | ||||
| } | ||||
|  |  | |||
|  | @ -129,7 +129,7 @@ | |||
|                   <tal:version condition="view/useVersioning"> | ||||
|                     <td class="center" | ||||
|                         tal:define="versionId row/versionId|string:"> | ||||
|                       <a href="#" | ||||
|                       <a tal:condition="not:row/versionable/notVersioned|nothing" | ||||
|                          tal:content="versionId" | ||||
|                          tal:omit-tag="python: versionId and versionId=='1.1'" | ||||
|                          tal:attributes="href | ||||
|  |  | |||
|  | @ -52,7 +52,7 @@ the default language using a LanguageInfo object that is similar to a view. | |||
|   >>> from loops.i18n.browser import LanguageInfo | ||||
|   >>> langInfo = LanguageInfo(topic01, TestRequest()) | ||||
|   >>> langInfo.availableLanguages | ||||
|   [] | ||||
|   <AutoElement 'languages'> | ||||
|   >>> langInfo.language is None | ||||
|   True | ||||
|   >>> langInfo.defaultLanguage is None | ||||
|  |  | |||
|  | @ -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 | ||||
| #  it under the terms of the GNU General Public License as published by | ||||
|  | @ -18,8 +18,6 @@ | |||
| 
 | ||||
| """ | ||||
| View extension for support of i18n content. | ||||
| 
 | ||||
| $Id$ | ||||
| """ | ||||
| 
 | ||||
| from zope import interface, component | ||||
|  | @ -29,6 +27,7 @@ from zope.cachedescriptors.property import Lazy | |||
| from zope.i18n.interfaces import IUserPreferredLanguages | ||||
| from zope.i18n.negotiator import negotiator | ||||
| 
 | ||||
| from cybertools.meta.interfaces import IOptions | ||||
| from loops.common import adapted | ||||
| 
 | ||||
| 
 | ||||
|  | @ -50,12 +49,7 @@ class LanguageInfo(object): | |||
| 
 | ||||
|     @Lazy | ||||
|     def availableLanguages(self): | ||||
|         for opt in self.loopsRoot.options: | ||||
|             if opt.startswith('languages:'): | ||||
|                 return opt[len('languages:'):].split(',') | ||||
|         return [] | ||||
|         # new implementation: | ||||
|         # return IOptions(self.context).i18n.languages | ||||
|         return IOptions(self.loopsRoot).languages | ||||
| 
 | ||||
|     @Lazy | ||||
|     def defaultLanguage(self): | ||||
|  | @ -64,10 +58,12 @@ class LanguageInfo(object): | |||
| 
 | ||||
|     @Lazy | ||||
|     def language(self): | ||||
|         available = self.availableLanguages or ('en', 'de') | ||||
|         if len(available) == 1: | ||||
|             return available[0] | ||||
|         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 | ||||
|         available = self.availableLanguages or ('en', 'de',) | ||||
|         return (negotiator.getLanguage(available, self.request) | ||||
|                 or self.defaultLanguage) | ||||
| 
 | ||||
|  | @ -95,7 +91,7 @@ class I18NView(object): | |||
| 
 | ||||
|     def checkLanguage(self): | ||||
|         session = ISession(self.request)[packageId] | ||||
|         lang = session.get('language') | ||||
|         lang = session.get('language') or self.languageInfo.language | ||||
|         if lang: | ||||
|             self.setLanguage(lang) | ||||
| 
 | ||||
|  |  | |||
										
											Binary file not shown.
										
									
								
							|  | @ -3,7 +3,7 @@ msgstr "" | |||
| 
 | ||||
| "Project-Id-Version: $Id$\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" | ||||
| "Language-Team: loops developers <helmutm@cy55.de>\n" | ||||
| "MIME-Version: 1.0\n" | ||||
|  | @ -437,6 +437,12 @@ msgstr "Suchbegriff" | |||
| msgid "Select if you want to create a new version" | ||||
| 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" | ||||
| msgstr "Suchtext" | ||||
| 
 | ||||
|  |  | |||
|  | @ -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 | ||||
| #  it under the terms of the GNU General Public License as published by | ||||
|  | @ -18,8 +18,6 @@ | |||
| 
 | ||||
| """ | ||||
| Versioning interfaces. | ||||
| 
 | ||||
| $Id$ | ||||
| """ | ||||
| 
 | ||||
| from zope.interface import Interface, Attribute | ||||
|  | @ -30,31 +28,34 @@ class IVersionable(Interface): | |||
|     """ 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') | ||||
| 
 | ||||
|     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') | ||||
| 
 | ||||
|     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') | ||||
| 
 | ||||
|     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 ' | ||||
|                         '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') | ||||
| 
 | ||||
|     # 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): | ||||
|         """ Create a copy of the context object as a new version and return it. | ||||
|  |  | |||
|  | @ -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 | ||||
| #  it under the terms of the GNU General Public License as published by | ||||
|  | @ -18,8 +18,6 @@ | |||
| 
 | ||||
| """ | ||||
| Utilities for managing version informations. | ||||
| 
 | ||||
| $Id$ | ||||
| """ | ||||
| 
 | ||||
| from BTrees.OOBTree import OOBTree | ||||
|  | @ -129,6 +127,13 @@ class VersionableResource(object): | |||
|         m = self.versionableMaster | ||||
|         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''): | ||||
|         versionableMaster = self.versionableMaster | ||||
|         versionableMaster.initVersions() | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue