Changeset 821
- Timestamp:
- 06/08/07 12:07:32 (2 years ago)
- Files:
-
- Bibliomane/trunk/bibliomane/browser/configure.zcml (modified) (1 diff)
- Bibliomane/trunk/bibliomane/browser/corp.pt (added)
- Bibliomane/trunk/bibliomane/browser/expression.pt (moved) (moved from Bibliomane/trunk/bibliomane/browser/expression_index.pt) (1 diff)
- Bibliomane/trunk/bibliomane/browser/item.pt (added)
- Bibliomane/trunk/bibliomane/browser/manifestation.pt (added)
- Bibliomane/trunk/bibliomane/browser/person.pt (added)
- Bibliomane/trunk/bibliomane/browser/principals.py (added)
- Bibliomane/trunk/bibliomane/browser/work.pt (moved) (moved from Bibliomane/trunk/bibliomane/browser/work_index.pt) (2 diffs)
- Bibliomane/trunk/bibliomane/browser/works.py (modified) (4 diffs)
- Bibliomane/trunk/bibliomane/configure.zcml (modified) (7 diffs)
- Bibliomane/trunk/bibliomane/interfaces.py (modified) (7 diffs)
- Bibliomane/trunk/bibliomane/principals.py (modified) (2 diffs)
- Bibliomane/trunk/bibliomane/relationship.py (added)
- Bibliomane/trunk/bibliomane/tests/works.txt (modified) (4 diffs)
- Bibliomane/trunk/bibliomane/works.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
Bibliomane/trunk/bibliomane/browser/configure.zcml
r820 r821 72 72 /> 73 73 74 <browser:containerViews 75 for="bibliomane.interfaces.IManifestationContainer" 76 contents="zope.ManageContent" 77 index="zope.View" 78 add="zope.ManageContent" 79 /> 80 81 <!-- Manifestation --> 82 83 <browser:page 84 for="bibliomane.interfaces.IManifestation" 85 name="index.html" 86 class=".works.ManifestationIndex" 87 permission="zope.View" 88 /> 89 90 <browser:page 91 for="bibliomane.interfaces.IManifestation" 92 name="edit.html" 93 class=".works.ManifestationEditForm" 94 permission="zope.ManageContent" 95 menu="zmi_views" 96 title="Edit" 97 /> 98 99 <browser:addMenuItem 100 title="Manifestation" 101 class="bibliomane.works.Manifestation" 102 permission="zope.ManageContent" 103 /> 104 105 <browser:page 106 for="zope.app.container.interfaces.IAdding" 107 name="bibliomane.works.Manifestation" 108 class=".works.ManifestationAddForm" 109 permission="zope.ManageContent" 110 /> 111 112 <browser:containerViews 113 for="bibliomane.interfaces.IItemContainer" 114 contents="zope.ManageContent" 115 index="zope.View" 116 add="zope.ManageContent" 117 /> 118 119 <!-- Item --> 120 121 <browser:page 122 for="bibliomane.interfaces.IItem" 123 name="index.html" 124 class=".works.ItemIndex" 125 permission="zope.View" 126 /> 127 128 <browser:page 129 for="bibliomane.interfaces.IItem" 130 name="edit.html" 131 class=".works.ItemEditForm" 132 permission="zope.ManageContent" 133 menu="zmi_views" 134 title="Edit" 135 /> 136 137 <browser:addMenuItem 138 title="Item" 139 class="bibliomane.works.Item" 140 permission="zope.ManageContent" 141 /> 142 143 <browser:page 144 for="zope.app.container.interfaces.IAdding" 145 name="bibliomane.works.Item" 146 class=".works.ItemAddForm" 147 permission="zope.ManageContent" 148 /> 149 150 <!-- Person --> 151 152 <browser:page 153 for="bibliomane.interfaces.IPerson" 154 name="index.html" 155 class=".principals.PersonIndex" 156 permission="zope.View" 157 /> 158 159 <browser:page 160 for="bibliomane.interfaces.IPerson" 161 name="edit.html" 162 class=".principals.PersonEditForm" 163 permission="zope.ManageContent" 164 menu="zmi_views" 165 title="Edit" 166 /> 167 168 <browser:addMenuItem 169 title="Person" 170 class="bibliomane.principals.Person" 171 permission="zope.ManageContent" 172 /> 173 174 <browser:page 175 for="zope.app.container.interfaces.IAdding" 176 name="bibliomane.principals.Person" 177 class=".principals.PersonAddForm" 178 permission="zope.ManageContent" 179 /> 180 181 <!-- CorporateBody --> 182 183 <browser:page 184 for="bibliomane.interfaces.ICorporateBody" 185 name="index.html" 186 class=".principals.CorporateBodyIndex" 187 permission="zope.View" 188 /> 189 190 <browser:page 191 for="bibliomane.interfaces.ICorporateBody" 192 name="edit.html" 193 class=".principals.CorporateBodyEditForm" 194 permission="zope.ManageContent" 195 menu="zmi_views" 196 title="Edit" 197 /> 198 199 <browser:addMenuItem 200 title="CorporateBody" 201 class="bibliomane.principals.CorporateBody" 202 permission="zope.ManageContent" 203 /> 204 205 <browser:page 206 for="zope.app.container.interfaces.IAdding" 207 name="bibliomane.principals.CorporateBody" 208 class=".principals.CorporateBodyAddForm" 209 permission="zope.ManageContent" 210 /> 211 212 <!-- Relationship Container --> 213 214 <browser:addMenuItem 215 title="FRBR Relationship Container" 216 class="bibliomane.relationship.FrbrRelationshipContainer" 217 permission="zope.ManageContent" 218 /> 219 220 <browser:containerViews 221 for="bibliomane.interfaces.IFrbrRelationshipContainer" 222 contents="zope.ManageContent" 223 index="zope.View" 224 add="zope.ManageContent" 225 /> 226 74 227 </configure> Bibliomane/trunk/bibliomane/browser/expression.pt
r820 r821 1 1 <html> 2 2 <head> 3 < link3 <!--link 4 4 rel="stylesheet" 5 5 type="text/css" 6 6 tal:attributes="href context/++resource++bz/style.css" 7 / >7 /--> 8 8 </head> 9 9 Bibliomane/trunk/bibliomane/browser/work.pt
r820 r821 1 1 <html> 2 2 <head> 3 < link3 <!--link 4 4 rel="stylesheet" 5 5 type="text/css" 6 6 tal:attributes="href context/++resource++bz/style.css" 7 / >7 /--> 8 8 </head> 9 9 … … 15 15 16 16 <!-- Responsibility relationship --> 17 18 <h3>Creators</h3> 17 19 20 <div class="widget" tal:repeat="principal context/principals"> 21 <a 22 tal:attributes="href principal/@@absolute_url" 23 tal:content="principal/name"> 24 NAME 25 </a> 26 </div> 27 18 28 <!-- FRBR Attributes --> 19 29 Bibliomane/trunk/bibliomane/browser/works.py
r820 r821 2 2 from zope.publisher.browser import BrowserPage 3 3 from zope.app.pagetemplate import ViewPageTemplateFile 4 from zope.app.form.browser import DateWidget 4 5 from zope.formlib.form import AddForm, DisplayForm, EditForm, Fields 5 6 6 from bibliomane.interfaces import IWork, IExpression 7 from bibliomane.works import Work, Expression 7 from bibliomane.interfaces import IWork, IExpression, IManifestation, IItem 8 from bibliomane.works import Work, Expression, Manifestation, Item 8 9 10 11 # Work 9 12 10 13 class WorkIndex(DisplayForm): … … 12 15 label = u'Work Index' 13 16 14 template = ViewPageTemplateFile('work _index.pt')17 template = ViewPageTemplateFile('work.pt') 15 18 16 19 @property … … 50 53 label = u'Expression Index' 51 54 52 template = ViewPageTemplateFile('expression _index.pt')55 template = ViewPageTemplateFile('expression.pt') 53 56 54 57 @property … … 62 65 63 66 67 # Manifestation 68 69 class ManifestationAddForm(AddForm): 70 form_fields = Fields(IManifestation).omit('works', 'principals') 71 label = u'Add Manifestation' 72 73 def create(self, data): 74 manifestation = Manifestation() 75 applyChanges(manifestation, self.form_fields, data) 76 return manifestation 64 77 65 78 79 class ManifestationIndex(DisplayForm): 80 form_fields = Fields(IManifestation).omit('works', 'principals') 81 label = u'Manifestation Index' 82 83 template = ViewPageTemplateFile('manifestation.pt') 84 85 @property 86 def frbr_widgets(self): 87 return [w for w in self.widgets] 88 89 90 class ManifestationEditForm(EditForm): 91 form_fields = Fields(IManifestation).omit('works', 'principals') 92 label = u'Edit Manifestation' 93 94 95 # Item 96 97 class ItemAddForm(AddForm): 98 form_fields = Fields(IItem).omit('works', 'principals') 99 label = u'Add Item' 100 101 def create(self, data): 102 item = Item() 103 applyChanges(item, self.form_fields, data) 104 return item 105 106 107 class ItemIndex(DisplayForm): 108 form_fields = Fields(IItem).omit('works', 'principals') 109 label = u'Item Index' 110 111 template = ViewPageTemplateFile('item.pt') 112 113 @property 114 def frbr_widgets(self): 115 return [w for w in self.widgets] 116 117 118 class ItemEditForm(EditForm): 119 form_fields = Fields(IItem).omit('works', 'principals') 120 label = u'Edit Item' 121 122 123 124 Bibliomane/trunk/bibliomane/configure.zcml
r820 r821 10 10 11 11 <class class=".works.Work"> 12 <implements 13 interface="zope.annotation.interfaces.IAttributeAnnotatable" 14 /> 12 15 <require 13 16 permission="zope.View" … … 34 37 35 38 <class class=".works.Expression"> 39 <implements 40 interface="zope.annotation.interfaces.IAttributeAnnotatable" 41 /> 36 42 <require 37 43 permission="zope.View" … … 58 64 59 65 <class class=".works.Manifestation"> 66 <implements 67 interface="zope.annotation.interfaces.IAttributeAnnotatable" 68 /> 60 69 <require 61 70 permission="zope.View" … … 82 91 83 92 <class class=".works.Item"> 93 <implements 94 interface="zope.annotation.interfaces.IAttributeAnnotatable" 95 /> 84 96 <require 85 97 permission="zope.View" … … 98 110 99 111 <class class=".principals.Person"> 112 <implements 113 interface="zope.annotation.interfaces.IAttributeAnnotatable" 114 /> 100 115 <require 101 116 permission="zope.View" … … 114 129 115 130 <class class=".principals.CorporateBody"> 131 <implements 132 interface="zope.annotation.interfaces.IAttributeAnnotatable" 133 /> 116 134 <require 117 135 permission="zope.View" … … 124 142 </class> 125 143 126 <utility 127 component=".relationships.frbrRelationships" 128 name="bibliomane.frbr_relationships" 129 provides=".interfaces.IFrbrRelationshipContainer" 144 <!-- Relationship Container --> 145 146 <interface 147 interface=".interfaces.IFrbrRelationshipContainer" 148 type="zope.app.content.interfaces.IContentType" 130 149 /> 131 150 151 <class class=".relationship.FrbrRelationshipContainer"> 152 <implements 153 interface="zope.annotation.interfaces.IAttributeAnnotatable" 154 /> 155 <require 156 permission="zope.View" 157 interface=".interfaces.IFrbrRelationshipContainer" 158 /> 159 <require 160 permission="zope.ManageContent" 161 set_schema=".interfaces.IFrbrRelationshipContainer" 162 /> 163 <require 164 permission="zope.View" 165 interface="zope.app.container.interfaces.IReadContainer" 166 /> 167 <require 168 permission="zope.ManageContent" 169 interface="zope.app.container.interfaces.IWriteContainer" 170 /> 171 </class> 172 132 173 </configure> Bibliomane/trunk/bibliomane/interfaces.py
r820 r821 2 2 from zope.app.container.interfaces import IContainer, IContained 3 3 from zope.app.container.constraints import contains, containers 4 from zope.schema import Date, Iterable, List, Text, TextLine, URI4 from zope.schema import BytesLine, Iterable, List, Text, TextLine, URI 5 5 6 6 # Schemas … … 82 82 ) 83 83 84 date = Date(84 date = BytesLine( 85 85 title=u"Date", 86 86 description=u"The date of creation", 87 required=False,88 )89 90 context = Text(91 title=u"Context",92 description=u"The context in which the work was created",93 87 required=False, 94 88 ) … … 137 131 ) 138 132 139 date = Date(133 date = BytesLine( 140 134 title=u"Date", 141 135 description=u"The date of creation", 142 required=False,143 )144 145 context = Text(146 title=u"Context",147 description=u"The context in which the work was created",148 136 required=False, 149 137 ) … … 171 159 """ 172 160 173 date = Date(161 date = BytesLine( 174 162 title=u"Date", 175 163 description=u"The date of publication", … … 230 218 231 219 name_language = TextLine( 232 title=u" Title Language",220 title=u"Name Language", 233 221 description=u"The language and/or script of the person's name", 234 222 required=False, … … 251 239 252 240 name_language = TextLine( 253 title=u" Title Language",241 title=u"Name Language", 254 242 description=u"The language and/or script of the name", 255 243 required=False, … … 263 251 264 252 265 # Marker interfaces 266 267 class IFrbrRelationshipContainer(Interface): 268 pass 253 class IFrbrRelationshipContainer(IContained): 254 pass 255 269 256 270 257 # Relationship markers Bibliomane/trunk/bibliomane/principals.py
r819 r821 4 4 from bibliomane.interfaces import IPerson, ICorporateBody 5 5 from bibliomane.interfaces import IOwnedBy, IProducedBy, IRealizedBy, ICreatedBy 6 from bibliomane.relationship simport find_sources, find_targets6 from bibliomane.relationship import find_sources, find_targets 7 7 8 8 … … 31 31 name = u"" 32 32 name_language = u"" 33 uri= u""33 link = u"" 34 34 35 35 def __init__(self, name=u""): Bibliomane/trunk/bibliomane/tests/works.txt
r819 r821 22 22 >>> from zope.app.folder import Folder 23 23 24 >>> root = app.getSiteManager() 24 >>> root = app 25 >>> root_sm = root.getSiteManager() 25 26 >>> works = Folder() 26 27 >>> root['works'] = works … … 84 85 Create a subject relationship container 85 86 86 >>> from zc.relationship import Container 87 >>> container = Container() 88 >>> works['frbr_relationships'] = container 89 >>> from zope.component import provideUtility 87 >>> from bibliomane.relationship import FrbrRelationshipContainer 88 >>> container = FrbrRelationshipContainer() 89 >>> root_sm['frbr_relationships'] = container 90 90 >>> from bibliomane.interfaces import IFrbrRelationshipContainer 91 >>> provideUtility(container, IFrbrRelationshipContainer)91 >>> root_sm.registerUtility(container, IFrbrRelationshipContainer) 92 92 93 93 Relate two works … … 97 97 >>> works[u'2'] = another_work 98 98 99 >>> from bibliomane.relationship simport relate99 >>> from bibliomane.relationship import relate 100 100 >>> from bibliomane.interfaces import IHasSubject 101 101 >>> relate(another_work, work, IHasSubject) … … 107 107 Remove relationship 108 108 109 >>> from bibliomane.relationship simport unrelate109 >>> from bibliomane.relationship import unrelate 110 110 >>> unrelate(another_work, work, IHasSubject) 111 111 >>> list(another_work.subjects) Bibliomane/trunk/bibliomane/works.py
r820 r821 16 16 from bibliomane.interfaces import IHasSubject 17 17 from bibliomane.interfaces import ICreatedBy, IRealizedBy, IProducedBy, IOwnedBy 18 from bibliomane.relationship simport find_sources, find_targets18 from bibliomane.relationship import find_sources, find_targets 19 19 20 20 … … 40 40 title_language = u"" 41 41 form = u"" 42 date = None 43 context = u"" 42 date = u"" 44 43 subject_tags = [] 45 44 responsibility_marker = ICreatedBy … … 62 61 title_language = u"" 63 62 form = u"" 64 date = None 65 context = u"" 63 date = u"" 66 64 language = u"" 67 65 responsibility_marker = IRealizedBy … … 77 75 __name__ = __parent__ = None 78 76 79 date = None77 date = u"" 80 78 edition = u"" 81 79 series = u""
