SQL Database Design For Developers at php[tek] 2024
Â
Building an artist community website with ArchGenXML / Poseidon
1. Building an artist
community website
with Poseidon / ArchGenXML / Plone
Nate Aune
Plone Conference
Vienna, Austria
Sept. 21, 2005
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
2. Who am I?
⢠Developer and owner, Jazkarta Consulting
(www.jazkarta.com)
⢠Musician - saxophonist and composer
(www.nateaune.com/music/)
⢠Founder of Plone4Artists project
(www.plone4artists.org)
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
3. Overview
⢠What is Archetypes?
⢠What is UML?
⢠What is ArchGenXML?
⢠Build a model using UML
⢠Transform the model into a Plone product
⢠Multimedia
⢠Questions?
jazkarta.com/presentations/artist-community.pdf
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
4. What is Archetypes?
⢠Framework for developing Plone products
⢠Automatically creates view and edit pages
⢠Maintains unique object IDs
⢠Creates references between objects
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
5. Archetypes framework
⢠Field validation
⢠Standard security setup
⢠Alternate storage options
⢠Data transformation capabilities
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
7. Example Archetype:
Artist
schema= Schema((
StringField('title'),
ImageField('photo'),
LinesField('instrument'),
))
class Artist(BaseContent)
schema = BaseSchema + schema
registerType(Artist,PROJECTNAME)
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
8. Widgets
schema= Schema((
StringField('title',
widget=StringWidget(
label=âArtist nameâ,
size=20),
),
ImageField('photo',
widget=ImageWidget(
label=âHeadshotâ),
),
LinesField('instrument',
widget=MultiSelectionWidget(
label=âInstrumentsâ),
multiValue=1,
),
))
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
9. What is UML?
⢠UML = Uniform Modeling Language
⢠Standard widely-adopted graphical language
⢠Describes the artifacts of software systems
⢠Focus on conceptual representations
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
10. Artist:
Described in UML
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
12. What is ArchGenXML?
⢠Command line utility
⢠Auto-generates code from a UML model
⢠No round-trip support yet
⢠Custom code is preserved upon
regeneration
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
13. Why use ArchGenXML?
(part 1)
⢠You want to save time
⢠You are a lazy programmer
⢠You donât like to reinvent the wheel
⢠You donât like copying and pasting code
⢠You make heavy use of references and
interfaces
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
14. Why use ArchGenXML?
(part 2)
⢠You have big projects with many different
content types
⢠You want or need a well-documented
interface to your product
⢠You like structured model- and pattern-
driven software development
⢠You want to maintain your project in the
future without getting a headache
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
15. UML to Archetypes
using ArchGenXML
schema= Schema((
StringField('title',
widget=StringWidget(
label=âArtist nameâ
size=20),
),
ImageField('photo',
widget=ImageWidget(
label=âHeadshotâ),
),
LinesField('instrument',
widget=MultiSelectionWidget(
label=âInstrumentsâ),
multiValue=1,
),
))
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
16. UML speak to AT speak
⢠package ⢠product
⢠class ⢠content type
⢠operation ⢠method
⢠attribute ⢠ďŹeld
⢠tagged value ⢠property
⢠stereotype ⢠subclass, view
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
17. In practice
⢠1) Save your model to the Products dir
⢠2) Run the ArchGenXML script
⢠3) Restart Zope
⢠4) Install the newly generated product
svn co svn://svn.plone4artists.org/trunk/ArtistSite
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
18. Running the script
$ cd /var/local/zope/instance1/Products
$ ArchGenXML/ArchGenXML.py -o ArtistSite ArtistSite.zuml
ArchGenXML 1.4 devel 4
(c) 2003 BlueDynamics GmbH, under GNU General Public License
2.0 or later
set outfilename [string] to ArtistSite
Parsing...
===============
opening zargo
XMI version: 1.2
using xmi 1.2+ parser
outfile: ArtistSite
Generating...
==============
method bodies will be preserved
Starting new Product: ArtistSite
Generating class: Artist
$
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
19. ArtistSite product dir
$ ls Products/ArtistSite
Artist.py __init__.py i18n skins
Extensions config.py refresh.txt version.txt
$
Restart Zope
Install product using QuickInstaller
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
20. Artist.py
⢠Inserts documentation
⢠Placeholders for custom code
⢠i18n message ids
⢠Using ArtistSite/model/generate_source.sh
⢠Inserts author information
⢠Creates i18n msg catalog .pot ďŹle
⢠strips HTML from doc strings
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
24. Static vocabulary
⢠DeďŹne a static vocabulary of instruments
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
25. Dynamic vocabulary
Use ATVocabularyManager to manage list of instruments
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
27. Containment
Use the solid rhomb to make a strict containment
âArtistâ instances can only be added to an âArtistsâ instance
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
29. Override base class
The artists folder will get large, so make it a BTreeFolder
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
30. Stereotype large
⢠Select the class
⢠Click on the
stereotypes
button (...)
⢠Select the âstubâ
stereotype
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
31. References
Create a
direct association
results in:
Reference ďŹeld
group to artist(s)
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
32. Group
edit form
Group is
associated
with artists
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
33. Reference Browser Widget
as default
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
34. ConďŹgure
browser widget
Select the end point
Make multivalued
Specify relationship
DeďŹne query
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
37. Back
references
Groups that
artist belongs to
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
38. Stereotype member
Add the âmemberâ stereotype to tell
ArchGenXML to subclass CMFMember
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
39. Registration
form
⢠SiteMember is installed
⢠Replaces default member
⢠Easy way to create new
member types
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
40. Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
41. Stereotype stub
⢠Add content types to your model without
having them get generated
⢠Makes it easy to integrate 3rd party
products into your custom product
⢠Adds allowed_content_types to your class
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
42. stub
⢠Select the class
⢠Click on the
stereotypes
button (...)
⢠Select the âstubâ
stereotype
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
43. Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
44. PloneMall
⢠Example of a sophisticated e-commerce
framework built using UML
⢠See the UML model here:
⢠http://www.plonemall.com/uml/UML-beta2.png/image_view_fullscreen
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
45. SiteEvent : a custom
event type
⢠Subclass ATEvent and add your own ďŹelds
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
46. Associate with venue
⢠Make a:
⢠Venues container
⢠Venue content type
⢠Direct association
from SiteEvent to
Venue
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
47. What I didnât cover
⢠Methods
⢠Additional Stereotypes
⢠actions, portal_tool, abstract, ordered
⢠Generalization (Interfaces)
⢠WorkďŹow
⢠Unit testing
⢠Documentation
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
48. Acknowledgements
⢠Philipp Auersperg (Blue Dynamics)
⢠Jens Klein (jensens)
⢠Martin Aspeli (optilude)
⢠Fabiano Weimar dos Santos (xiru)
⢠Bernie Snizek (DrZoltron)
⢠Blue Dynamics - conference organizers
⢠Plone community
Go to Jens and Philâs ArchGenXML talk!
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
49. Links
⢠How to subclass ATContentType in 7 minutes
â˘http://plone.org/documentation/how-to/subclass-atct-using-archgenxml
⢠ArchGenXML product page - http://plone.org/products/archgenxml
⢠ArchGenXML getting started tutorial by Jens Klein
⢠http://plone.org/documentation/tutorial/archgenxml-getting-started
⢠ArchGenXML manual (with screenshots)
⢠http://plone.org/documentation/archetypes/archgenxml-manual
⢠Intro to Archetypes by Sidnei da Silva, published on ZopeMag.com
⢠http://www.zopemag.com/Issue006/Section_Articles/article_IntroToArchteypes.html
⢠Archetypes: Customizing Plone in 60 seconds (PDF) by Andy McKay
⢠http://www.enfoldsystems.com/About/Talks/archetypes.pdf
⢠Archetypes Fields Quick Reference by Maik RÜder
⢠http://plone.org/documentation/archetypes/arch_ďŹeld_quickref_1_3_1
⢠Archetypes Widgets Quick Reference by Maik RÜder
⢠http://plone.org/documentation/archetypes/arch_widget_quickref_1_3_1
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
50. Multimedia in Plone
⢠Multimedia = audio, video, photo, etc.
⢠Currently limited built-in support for these
media ďŹle types
⢠No deďŹnitive multimedia package for Plone
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
51. Existing 3rd party products
⢠Audio
⢠ATAudio, Plodcasting, PloneRadio
⢠Video
⢠ATVideo, lilix.movie, Parwin
⢠Photo
⢠ATPhoto, CMFPhoto, ZPhotoSlides
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
52. PloneMultimedia
⢠PloneMultimedia
⢠ATAudio
⢠ATVideo
⢠ATPhoto
⢠Common âbaseâ products in which to build
custom multimedia products
⢠Add-on product for ATContentTypes
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
53. Subclass ATCT
⢠ATAudio - subclass ATFile
⢠inherit methods: cleanupFilename,
download, getIcon
⢠validators: checkFileSize
⢠ATPhoto - subclass ATImage
⢠getEXIF, ATFolder template-mixin (Display
menu)
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
54. Upload
audio ďŹle
⢠Type in a description
⢠Upload ďŹle
⢠Click âNextâ button
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
55. Metadata
⢠ATAudio extracts metadata
⢠Auto-populates form ďŹelds
⢠Extensible genres
⢠Upload album art
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
56. Audio view page
⢠Embedded player
⢠Play in popup window
⢠Stream to external
media player
⢠Download to FS
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
59. CD view page
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
60. Flash player
⢠Flash popup player
⢠Uses XSPF playlist
⢠Jump forward/
backward through
tracks
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
62. Thanks to...
⢠ATAudio team
⢠Volodymr Cherepanyak (chervol)
⢠Rocky Burt (RockyBurt)
⢠Salim Fadhley (_salimfadhley)
⢠jenner (for adding Flash player support)
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
63. Multimedia sprint
⢠This thursday and friday at the Hotel Academia!
⢠http://plone.org/events/sprints/multimedia
⢠Ask Nate for a map to the hotel
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
64. Multimedia Resources
⢠http://plone.org/products/ataudio
⢠http://plone.org/products/plonemultimedia
⢠http://plone4artists.org
⢠Mailing list: ataudio@plone4artists.org with
subject âsubscribeâ
⢠Mailing list: plone4artists@plone4artists.org
with subject âsubscribeâ
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918