BYTE.com
RSS feed

Newsletter
Free E-mail Newsletter from BYTE.com
Email Address
First Name
Last Name




 
    
             
BYTE.com > Tangled in the Threads > 2001 > June

Examples Of Acquisition

By Jon Udell

June 14, 2001

(Nature vs. Nurture :  Page 2 of 3 )



In this Article
Nature vs. Nurture
Examples Of Acquisition
A Glimpse Of The Deep Magic
Some simple examples of acquisition can been seen in an application I wrote to help a team of editors collaborate on the production of a magazine. The application uses ZODB (Zope's object database) to store a tree of contents that looks like this:

2001-08
	article_1
		draft_1
		draft_2
		image_A
		image_B
	article_2
2001-07
	article_1
	article_2

The bolded items are Folders. There's a Folder for each month's issue and, within that, a Folder for each article in the issue, containing one or more Files or Images. The user interface of the application is based on Zope's tree tag. Here's a simplified view of the DTML logic that expresses the containment hierarchy in HTML:

<dtml-tree branches_expr="objectValues(['Folder', 
'File','Image'])" reverse sort=id>

<dtml-if "meta_type=='Folder'">

<dtml-if "isIssueFolder(_['title_or_id'])==0"> [<a href="<dtml-var tree-item-url> /addFile">add file</a>] [<a href="<dtml-var tree-item-url> /addImage">add image</a>] </dtml-if>

</dtml-if>

</dtml-tree>

The isIssueFolder() method is called once for each Folder in the containment hierarchy, and passed an argument that picks out the title_or_id property of the current object. The convention here is that when that property doesn't match the regular expression 20\d\d\-\d\d (which is the test implemented by isIssueFolder), the Folder represents an article. In these cases, the DTML logic decorates the emitted HTML node with links used to add files, or images, to that folder, like so:

2001-08
	article_1 [add file] [add image]
		draft_1
		draft_2
		image_A
		image_B
	article_2 [add file] [add image]
2001-07
	article_1 [add file] [add image]
	article_2 [add file] [add image]

The addresses of these links are formed by means of the expression <dtml-var tree-item-url>, which yields URLs like these:

2001-08/article_1/addFile

2001-07/article_2/addImage

addFile and addImage are DTML Documents that present HTML forms used to upload files or images.

Previous page Page 2 of 3 Next page


BYTE.com > Tangled in the Threads > 2001 > June
Dr. Dobb's Media Center
BYTE.com Store

BYTE CD-ROM
NOW, on one CD-ROM, you can instantly access more than 8 years of BYTE.
 
The Best of BYTE: Volume 2 - Heuristic Algorithms
The Best of BYTE: Volume 2 - Heuristic Algorithms
In this volume of Best of BYTE, we explore the emergence of some heuristic algorithms. Although we have only scratched the surface of this intriguing subject, we hope we've suggested the potential of the synthesis of heuristics and algorithms.

© 2008 Think Services, Privacy Policy, Terms of Service, United Business Media Limited
Site comments: webmaster@byte.com
Web Sites: BYTE.com, dotnetjunkies.com, Dr. Dobb's Journal, SD Expo, Sys Admin, sqljunkies.com, Unixreview



MarketPlace
Fast online exception analysis. Capture customer crash data online.
Develop 10 times faster ! ALM, IDE, .Net, RAD, 5GL, Database, 5GL, 64-bit, etc. Free Express version
Easily create an automated, repeatable process for building and deploying software.
AdminiTrack offers an effective web-based bug tracking system designed for professional software development teams.
Develop distributed systems conforming to open standards like CORBA and Web Services faster with SANKHYA Varadhi - The Digital Bridge.
Wanna see your ad here?
 

web2