diff --git a/src/DocumentLibrary/CVS/Entries b/src/DocumentLibrary/CVS/Entries index 3c2c98e..6d2f917 100644 --- a/src/DocumentLibrary/CVS/Entries +++ b/src/DocumentLibrary/CVS/Entries @@ -2,13 +2,9 @@ /DLGlobals.py/1.1.1.1/Fri Jan 18 04:38:39 2002// /Document.py/1.4/Sun Jun 23 13:08:54 2002// /DocumentLibrary.py/1.2/Sun Jun 23 11:51:05 2002// -/DocumentStore.py/1.1.1.1/Fri Jan 18 04:38:37 2002// -/INSTALL.txt/1.1.1.1/Fri Jan 18 04:38:32 2002// /IconImage.py/1.1.1.1/Fri Jan 18 04:38:39 2002// /LICENSE.txt/1.1.1.1/Fri Jan 18 04:38:36 2002// -/README.txt/1.2/Sun Jun 23 12:00:33 2002// /TODO.txt/1.1.1.1/Fri Jan 18 04:38:39 2002// -/TopicIndex.py/1.2/Sun Jun 23 13:01:12 2002// /__init__.py/1.1.1.1/Fri Jan 18 04:38:40 2002// /refresh.txt/1.1.1.1/Fri Jan 18 04:38:37 2002// /text.c.patch/1.1.1.1/Fri Jan 18 04:38:33 2002// @@ -19,3 +15,7 @@ D/instance//// D/www//// /HISTORY.txt/1.6/Sun Jun 23 09:41:07 2002// +/DocumentStore.py/1.2/Result of merge// +/INSTALL.txt/1.2/Wed Dec 17 14:20:34 2003// +/README.txt/1.3/Wed Dec 17 14:20:34 2003// +/TopicIndex.py/1.4/Wed Dec 17 14:20:34 2003// diff --git a/src/DocumentLibrary/DocumentStore.py b/src/DocumentLibrary/DocumentStore.py index 5882397..bb6eae4 100644 --- a/src/DocumentLibrary/DocumentStore.py +++ b/src/DocumentLibrary/DocumentStore.py @@ -377,13 +377,28 @@ return doc + def afterDelete(self, topics): + """ """ + for topic in topics: + tobjs=[] + + #get the topic objects from the indexes + self.Index.hideAfterDelete(id=topic) + def deleteDocumentFile(self, REQUEST=None, RESPONSE=None): """Deletes a document from the document store""" - self.manage_delObjects(REQUEST.id) + document=self.query(id=REQUEST.id)[0] + topics=document.topics + + self.manage_delObjects(REQUEST.id) + self.afterDelete(topics) + + if REQUEST and RESPONSE and REQUEST.has_key('last_url'): RESPONSE.redirect(REQUEST.last_url + '?' + REQUEST.get('last_query','')) + # # Catalog query support methods # diff --git a/src/DocumentLibrary/FileConverters/CVS/Entries b/src/DocumentLibrary/FileConverters/CVS/Entries index 9e39766..4671a1f 100644 --- a/src/DocumentLibrary/FileConverters/CVS/Entries +++ b/src/DocumentLibrary/FileConverters/CVS/Entries @@ -6,4 +6,5 @@ /ps.py/1.1.1.1/Fri Jan 18 04:38:43 2002// /wvText.xml/1.1.1.1/Fri Jan 18 04:38:43 2002// /xls.py/1.1.1.1/Fri Jan 18 04:38:43 2002// +/wpd.py/1.2/Fri Aug 9 20:48:00 2002// D diff --git a/src/DocumentLibrary/INSTALL.txt b/src/DocumentLibrary/INSTALL.txt index 6dfbdc0..b473348 100644 --- a/src/DocumentLibrary/INSTALL.txt +++ b/src/DocumentLibrary/INSTALL.txt @@ -37,6 +37,10 @@ The Postscript converter requires the open source Prescript program available at: http://www.nzdl.org/html/prescript.html + The WordPerfect converter requires the compilation of a small c + program included with this distribution. Directions can be found + in DocumentLibrar/FileConverters/wpConverter. + In order for any of the above converters to work properly, the zope process must have write access to the system temporary directory (i.e. /tmp) diff --git a/src/DocumentLibrary/README.txt b/src/DocumentLibrary/README.txt index dc50377..5fae13e 100644 --- a/src/DocumentLibrary/README.txt +++ b/src/DocumentLibrary/README.txt @@ -65,6 +65,8 @@ - Microsoft Powerpoint + - Wordperfect + A plug-in architecture for full-text converters has been implemented to make adding support for new file formats as simple as possible. diff --git a/src/DocumentLibrary/TopicIndex.py b/src/DocumentLibrary/TopicIndex.py index 3771842..82df4d3 100644 --- a/src/DocumentLibrary/TopicIndex.py +++ b/src/DocumentLibrary/TopicIndex.py @@ -39,6 +39,7 @@ from os import path from string import join, find, strip import Globals +import DLGlobals from Globals import DTMLFile from App.ImageFile import ImageFile from OFS.Folder import Folder @@ -57,9 +58,8 @@ __ac_permissions__ = Folder.__ac_permissions__ + ( ('Add Library Topic Indexes', ('manage_addTopicIndexForm', 'manage_addTopicIndex')), - ('View', ('topicParents', 'topicPath', 'getTopicId')), + ('View', ('topicParents', 'topicPath', 'getTopicId', 'hideAfterDelete')), ) - isLibraryTopicIndex = 1 def __init__(self, id, title=''): @@ -68,7 +68,6 @@ self.documents = [] manage_addTopicIndexForm = DTMLFile('dtml/AddIndexForm', globals()) - def manage_addTopicIndex(self, id, title='', REQUEST=None): """Construct a Topic Index object""" @@ -77,6 +76,8 @@ if REQUEST is not None: return self.manage_main(self, REQUEST, update_menu=1) + + def topicParents(self): """Return a list of topic indexes from the topic index root down to this topic""" @@ -107,9 +108,10 @@ def icon(self): root = self.topicParents()[0] return join(root.getPhysicalPath()[1:],'/') + '/TopicIndexBase_icon' + -class TopicIndex(CatalogAware, TopicIndexBase): +class TopicIndex( CatalogAware, TopicIndexBase): """Document Library Index Topic""" meta_type = 'Topic Index' @@ -118,12 +120,16 @@ { 'id': 'visible', 'type': 'boolean', 'mode': 'w' }, ) - manage_options = TopicIndexBase.manage_options + ( - { 'label': 'Icon', 'action': 'manage_changeIconForm' }, - ) - visible = 0 + def topicChildren(self): + """Return a list of topic indexes from the this topic on down""" + + r = [self] + for topic in self.aq_explicit.objectValues('Topic Index'): + r = r + topic.topicChildren() + return r + # Icon management stuff manage_changeIconForm = DTMLFile('dtml/IndexIconForm', globals()) @@ -213,13 +219,13 @@ ob = self while ob.meta_type == self.meta_type: - ob.visible = 1 + setattr(ob,'visible',1) ob.reindex_object() ob = ob.aq_parent def hideTopic(self): """Make this topic invisible""" - self.visible = 0 + setattr(self,'visible',0) self.reindex_object() @@ -244,7 +250,7 @@ manage_options = TopicIndexBase.manage_options + ( { 'label': 'Import Topic Index', 'action': 'manage_importIndexForm' }, - { 'label': 'Default Topic Icon', 'action': 'manage_changeIconForm' } + { 'label': 'Default Topic Icon', 'action': 'manage_changeIconForm' }, ) __ac_permissions__ = TopicIndexBase.__ac_permissions__ + ( @@ -262,6 +268,8 @@ if REQUEST is not None and RESPONSE is not None: return self.manage_changeIconForm(REQUEST, RESPONSE) + + TopicIndexRoot_icon = ImageFile('www/TopicIndexRoot_icon.gif', globals()) def icon(self): @@ -279,6 +287,7 @@ self.Catalog.addIndex('title', TextIndex('title', lexicon=lexicon)) self.Catalog.addIndex('visible', FieldIndex('visible')) + def __init__(self, id, title='', vocab_id=None, container=None): if vocab_id is not None and container is None: raise AttributeError, ("You cannot specify a vocab_id without " @@ -362,6 +371,87 @@ """ return self.Catalog.paths[rid] + def childTopicsVisible(self,id): + """ + Check to see if any of the child topics of id are visisble. + return true if they are visible. + """ + #get the current topic + tobj=self.query(id=id) + if tobj and len(tobj)>0: + #I don't know why I have to do this. The first object was coming + #back 'None' + for obj in tobj: + tobj=obj.getObject() + if tobj: + break + if not tobj: + return 1 + else: + #for some reason, we didn't find the topic + return 1 + + #Check child topics. If any of them are visible, this topic + #remains visible + for topic in tobj.aq_explicit.objectValues('Topic Index'): + if getattr(topic,'visible',None): + # if the child topic is visible, then this topic must + # remain visible, so just return true + return 1 + + return 0 + + def hideAfterDelete(self,id): + """ + This is called whenever a document is deleted. + Check to see if we need to make this topic not visible, + and it's parents topics not visible. + """ + + #if any of the child topics are visible, don't do anything + if self.childTopicsVisible(id): + return + + + #get the current topic + tobj=self.query(id=id) + if tobj and len(tobj)>0: + #I don't know why I have to do this. The first object was coming + #back 'None' + for obj in tobj: + tobj=obj.getObject() + if tobj: + break + if not tobj: + return + else: + #for some reason, we didn't find the topic + return + #child topics are not visible, so we must check this topic + #and any parents to see if we need to make them invisible. + parents=tobj.topicParents() + parents.reverse() + + #check the parents indexes to see if we need to hide them + #as well. The first 'parent' is the current topic. + for topic in parents: + + #if any child topics of this topic are visible, + #then this topic and it's parents remain visible + if self.childTopicsVisible(topic.id): + break + + result=self.Documents.query(topics=topic.id) + if result and len(result)>0 : + # found a document, so upline topics remain in current visible + # state + break + else: + #can't hide Root + if topic.meta_type == 'Topic Index': + topic.hideTopic() + + def getTopicIds(self, title): """Return a list of topic ids that match the title query string""" topics = self.query(title=title) diff --git a/src/DocumentLibrary/document_icons/CVS/Entries b/src/DocumentLibrary/document_icons/CVS/Entries index 3de68ee..2d94c77 100644 --- a/src/DocumentLibrary/document_icons/CVS/Entries +++ b/src/DocumentLibrary/document_icons/CVS/Entries @@ -10,4 +10,6 @@ /pdf_small.gif/1.1.1.1/Fri Jan 18 04:38:40 2002// /powerpoint_large.gif/1.1.1.1/Fri Jan 18 04:38:40 2002// /powerpoint_small.gif/1.1.1.1/Fri Jan 18 04:38:40 2002// +/wordperfect_large.gif/1.1/Fri Aug 9 20:48:00 2002// +/wordperfect_small.gif/1.1/Fri Aug 9 20:48:00 2002// D