Skip to content

Commit

Permalink
added original file contributing request structure.
Browse files Browse the repository at this point in the history
added aleph record structure
updated handlers for new aleph responses
changed ++add++edeposit.content.epublication view back to standard
view
added add-at-once view

#9

fixed #12
  • Loading branch information
jstavel committed Jul 1, 2014
1 parent 4c128d0 commit b8b504b
Show file tree
Hide file tree
Showing 28 changed files with 983 additions and 61 deletions.
3 changes: 3 additions & 0 deletions edeposit.content.egg-info/SOURCES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ edeposit/content/__init__.py
edeposit/content/aleph_exception.py
edeposit/content/aleph_export_request.py
edeposit/content/aleph_export_result.py
edeposit/content/aleph_record.py
edeposit/content/aleph_search_sysnumber_request.py
edeposit/content/author.py
edeposit/content/book.py
Expand All @@ -35,6 +36,8 @@ edeposit/content/library.py
edeposit/content/libraryfolder.py
edeposit/content/messages_folder.py
edeposit/content/originalfile.py
edeposit/content/originalfile_contributing_request.py
edeposit/content/originalfile_contributing_requests_folder.py
edeposit/content/previewfile.py
edeposit/content/printingfile.py
edeposit/content/testing.py
Expand Down
39 changes: 39 additions & 0 deletions edeposit/content/AlephRecord.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
AlephRecord Tests
-----------------

This is a DocTest file, using the Python doctest format.


Create a AlephRecord object and put it in a folder

Create the object::

>>> from zope.component import createObject
>>> container = createObject('edeposit.content.alephrecord')

Verify it's type::

>>> container.portal_type
'edeposit.content.alephrecord'

Give it a title::

>>> container.setTitle('Test Title')
>>> container.Title()
'Test Title'

Put it in our base folder::

>>> from plone.dexterity.utils import addContentToContainer
>>> cobj = addContentToContainer(folder, container)

>>> cobj
<AlephRecord at /plone/Members/test_user_1_/test-title>

>>> folder['test-title'].Title()
'Test Title'

Now, let's demonstrate a failing test::

>>> 2 == 3 # Deliberately failing test; fix me!
True
39 changes: 39 additions & 0 deletions edeposit/content/OriginalFileContributingRequest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
OriginalFileContributingRequest Tests
-----------------

This is a DocTest file, using the Python doctest format.


Create a OriginalFileContributingRequest object and put it in a folder

Create the object::

>>> from zope.component import createObject
>>> container = createObject('edeposit.content.originalfilecontributingrequest')

Verify it's type::

>>> container.portal_type
'edeposit.content.originalfilecontributingrequest'

Give it a title::

>>> container.setTitle('Test Title')
>>> container.Title()
'Test Title'

Put it in our base folder::

>>> from plone.dexterity.utils import addContentToContainer
>>> cobj = addContentToContainer(folder, container)

>>> cobj
<OriginalFileContributingRequest at /plone/Members/test_user_1_/test-title>

>>> folder['test-title'].Title()
'Test Title'

Now, let's demonstrate a failing test::

>>> 2 == 3 # Deliberately failing test; fix me!
True
39 changes: 39 additions & 0 deletions edeposit/content/OriginalFileContributingRequestsFolder.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
OriginalFileContributingRequestsFolder Tests
-----------------

This is a DocTest file, using the Python doctest format.


Create a OriginalFileContributingRequestsFolder object and put it in a folder

Create the object::

>>> from zope.component import createObject
>>> container = createObject('edeposit.content.originalfilecontributingrequestsfolder')

Verify it's type::

>>> container.portal_type
'edeposit.content.originalfilecontributingrequestsfolder'

Give it a title::

>>> container.setTitle('Test Title')
>>> container.Title()
'Test Title'

Put it in our base folder::

>>> from plone.dexterity.utils import addContentToContainer
>>> cobj = addContentToContainer(folder, container)

>>> cobj
<OriginalFileContributingRequestsFolder at /plone/Members/test_user_1_/test-title>

>>> folder['test-title'].Title()
'Test Title'

Now, let's demonstrate a failing test::

>>> 2 == 3 # Deliberately failing test; fix me!
True
110 changes: 110 additions & 0 deletions edeposit/content/aleph_record.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# -*- coding: utf-8 -*-
from five import grok

from z3c.form import group, field
from zope import schema
from zope.interface import invariant, Invalid
from zope.schema.interfaces import IContextSourceBinder
from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm

from plone.dexterity.content import Item

from plone.directives import dexterity, form
from plone.app.textfield import RichText
from plone.namedfile.field import NamedImage, NamedFile
from plone.namedfile.field import NamedBlobImage, NamedBlobFile
from plone.namedfile.interfaces import IImageScaleTraversable


from edeposit.content import MessageFactory as _


# Interface class; used to define content-type schema.

class IAlephRecord(form.Schema, IImageScaleTraversable):
"""
E-Deposit Aleph Record
"""

# If you want a schema-defined interface, delete the model.load
# line below and delete the matching file in the models sub-directory.
# If you want a model-based interface, edit
# models/aleph_record.xml to define the content type.
isbn = schema.ASCIILine(
title=_("ISBN"),
description=_(u"Value of ISBN"),
required = True,
)


def getNazev(self):
return self.title

nazev = schema.TextLine (
title = u"Název",
required = False,
)

podnazev = schema.TextLine (
title = u"Podnázev",
required = False,
)

cast = schema.TextLine (
title = u"Část, díl",
required = False,
)

nazev_casti = schema.TextLine (
title = u"Název části, dílu",
required = False,
)

rok_vydani = schema.ASCIILine (
title = u"Rok vydání",
required = True,
)

aleph_sys_number = schema.ASCIILine (
title = _(u'Aleph SysNumber'),
description = _(u'Internal SysNumber that Aleph refers to metadata of this ePublication'),
required = True,
)

aleph_library = schema.ASCIILine (
title = _(u'Aleph Library'),
description = _(u'Library that Aleph refers to metadata of this ePublication'),
required = True,
)

# Custom content-type class; objects created for this content type will
# be instances of this class. Use this class to add content-type specific
# methods and properties. Put methods that are mainly useful for rendering
# in separate view classes.

class AlephRecord(Item):
grok.implements(IAlephRecord)

# Add your class methods and properties here
pass


# View class
# The view will automatically use a similarly named template in
# aleph_record_templates.
# Template filenames should be all lower case.
# The view will render when you request a content object with this
# interface with "/@@sampleview" appended.
# You may make this the default view for content objects
# of this type by uncommenting the grok.name line below or by
# changing the view class name and template filename to View / view.pt.

class SampleView(grok.View):
""" sample view class """

grok.context(IAlephRecord)
grok.require('zope2.View')

# grok.name('view')

# Add view methods here
31 changes: 31 additions & 0 deletions edeposit/content/aleph_record_templates/sampleview.pt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
lang="en"
metal:use-macro="context/main_template/macros/master"
i18n:domain="edeposit.content">
<body>

<tal:comment tal:condition="nothing">
This is a sample view template. It will not be used for rendering the
content unless activated by creation of a view class with a matching name.
</tal:comment>

<metal:main fill-slot="content-core">
<metal:content-core define-macro="content-core">

<h2>
Rendered from
aleph_record_templates/<span tal:replace="template/id" />
</h2>


<div tal:content="context/Title">Title inserted here</div>

</metal:content-core>
</metal:main>

</body>
</html>

5 changes: 0 additions & 5 deletions edeposit/content/aleph_search_sysnumber_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ class IAlephSearchSysNumberRequest(form.Schema, IImageScaleTraversable):
Aleph Search SysNumber Request
"""

# If you want a schema-defined interface, delete the model.load
# line below and delete the matching file in the models sub-directory.
# If you want a model-based interface, edit
# models/aleph_search_sysnumber_request.xml to define the content type.

isbn = schema.TextLine (
title = u"ISBN v souboru",
required = True,
Expand Down
44 changes: 23 additions & 21 deletions edeposit/content/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,6 @@
<include file="permissions.zcml" />
<include package="collective.zamqp" />

<browser:page
for="edeposit.content.epublication.IePublication"
name="view-at-once"
class="plone.dexterity.browser.view.DefaultView"
template="epublication_templates/viewatonce.pt"
permission="zope2.View"
/>

<browser:page
for="edeposit.content.epublication.IePublication"
name="edit-at-once"
class="plone.dexterity.browser.edit.DefaultEditView"
permission="cmf.ModifyPortalContent"
/>

<!-- Register components configured using Python directives -->
<grok:grok package="." />
Expand Down Expand Up @@ -102,13 +88,29 @@
<!-- permission="zope2.View" -->
<!-- /> -->

<adapter for="Products.CMFCore.interfaces.IFolderish
Products.CMFDefault.interfaces.ICMFDefaultSkin
plone.dexterity.interfaces.IDexterityFTI"
provides="zope.publisher.interfaces.browser.IBrowserPage"
factory=".epublication.EPublicationAddView"
name="edeposit.content.epublication"
/>
<!-- ePublication contributing -->
<browser:page
for="edeposit.content.epublication.IePublication"
name="view-at-once"
class="plone.dexterity.browser.view.DefaultView"
template="epublication_templates/viewatonce.pt"
permission="zope2.View"
/>

<browser:page
for="edeposit.content.epublicationfolder.IePublicationFolder"
name="add-at-once"
class="edeposit.content.epublication.EPublicationAddForm"
permission="cmf.ModifyPortalContent"
/>

<!-- <adapter for="Products.CMFCore.interfaces.IFolderish -->
<!-- Products.CMFDefault.interfaces.ICMFDefaultSkin -->
<!-- plone.dexterity.interfaces.IDexterityFTI" -->
<!-- provides="zope.publisher.interfaces.browser.IBrowserPage" -->
<!-- factory=".epublication.EPublicationAddView" -->
<!-- name="edeposit.content.epublication" -->
<!-- /> -->

<adapter factory=".epublication.AuthorFactory"
name="edeposit.content.author.IAuthor" />
Expand Down
6 changes: 5 additions & 1 deletion edeposit/content/epublication.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,14 @@ class IOriginalFiles(model.Schema):
)

from originalfile import OriginalFile
from epublicationfolder import IePublicationFolder

class EPublicationAddForm(DefaultAddForm):
# label = _(u"Registration of a producent")
# description = _(u"Please fill informations about user and producent.")
default_fieldset_label = u"ePublikace"
portal_type="edeposit.content.epublication"
grok.context(IePublicationFolder)

@property
def additionalSchemata(self):
Expand All @@ -283,7 +286,7 @@ def additionalSchemata(self):

def update(self):
print "update"
DefaultAddForm.update(self)
super(DefaultAddForm,self).update()
self.widgets['IBasic.title'].label=u"Název ePublikace"

def extractData(self):
Expand Down Expand Up @@ -389,6 +392,7 @@ def getAndRemoveKey(data, key, defaultValue):
class EPublicationAddView(DefaultAddView):
form = EPublicationAddForm
#index = ViewPageTemplateFile('epublication_templates/editatonce.pt')
pass

class AuthorFactory(object):
adapts(Interface, Interface, Interface, Interface)
Expand Down
Loading

0 comments on commit b8b504b

Please sign in to comment.