Kaivo Document Library customisation?
I've been able to customise a fair amount of the standard Kaivo Document Library product to meet our own needs, but have now hit the limit of my current knowledge and understanding. The author of the product (Casey Duncan) has kindly dropped a few suggestions to me in the past, but I still don't understand how to achieve what he has suggested. What I'm trying to do is automate an email to be sent to the author of a submitted document 6 months afterwards to say "Please re-visit your document". I added 'email' to the DL document properties and the 'document_submit' form, and the 'created_date' is already defined in the DL product. I created a simple 'sendmail' dtml document (using a Mail host object) which automatically sends an email to the librarian (me at the moment!) from the author's email address. This tells me whenever a document has been submitted to the library, so I can go and approve or decline it. Casey's suggestion was to create a dtml method within the Document Library that queries the library for old documents and then sends the author an email. You then use the OS command line utility 'wget' in a script to execute the dtml method periodically via a cron job on the server. We could get the email sent from outside of Zope, but it is probably neater for everything to be done inside and just use 'wget' to run the method automatically. The bare minimum info we need from the document library Document Store object (which is called 'Documents') is 'email', 'review_date', 'filename' and 'title' for each and every document file (word, excel or pdf file) inside it. Trouble is, I don't understand enough about how the DL product works. I know that the 'Documents' Document store object isn't a normal folder but I have no idea where to start on examining it and getting the info out! Richard Hewison
On Monday 09 September 2002 10:21 am, Richard Hewison wrote:
I've been able to customise a fair amount of the standard Kaivo Document Library product to meet our own needs, but have now hit the limit of my current knowledge and understanding. The author of the product (Casey Duncan) has kindly dropped a few suggestions to me in the past, but I still don't understand how to achieve what he has suggested.
What I'm trying to do is automate an email to be sent to the author of a submitted document 6 months afterwards to say "Please re-visit your document". [snip]
Casey's suggestion was to create a dtml method within the Document Library that queries the library for old documents and then sends the author an email. You then use the OS command line utility 'wget' in a script to execute the dtml method periodically via a cron job on the server.
We could get the email sent from outside of Zope, but it is probably neater for everything to be done inside and just use 'wget' to run the method automatically.
This is what I had in mind with my suggestion.
The bare minimum info we need from the document library Document Store object (which is called 'Documents') is 'email', 'review_date', 'filename' and 'title' for each and every document file (word, excel or pdf file) inside it. Trouble is, I don't understand enough about how the DL product works. I know that the 'Documents' Document store object isn't a normal folder but I have no idea where to start on examining it and getting the info out!
DocumentStore is like a combo of BTreeFolder and ZCatalog. It stores the documents and also indexes them. You probably do not need to change it though. What you probably want to do, is send emails to every author whose document has not been updated for the last 6 months. To do this, create a python script in the DL like: # Create a dictionary mapping email addrs to documents needing update emails = {} for record in container.Documents.query( bobobase_modification_time=container.ZopeTime()-180, bobobase_modification_time_usage='range:max'): doc = record.getObject() if doc is None: continue if not emails.has_key(doc.creator_email): emails[doc.creator_email] = [doc] else: emails[doc.creator_email].append(doc) # Send the emails for email, docs in emails.items(): container.send_update_email(None, context.REQUEST, email=email, docs=docs) return 'sent messages to:\n' + '\n'.join(emails.keys()) This script calls a dtml method named "send_update_email" which expects an email address "email" and a list of documents "docs". It should create and email that links to these documents and includes and relevant info that you like. The python scripts finds all of the documents that have not been updated for 6 months. Then it sorts them by email address (stored in the contrived "creator_email" attribute, substitute your name) so that only one email is sent to each author. That way if one author has 50 documents, he gets one email with 50 links in it rather than 50 emails with one link. This python script can be called from wget. Or just run manually using the test tab. It returns a list of all the email addresses that were mailed. hth, Casey
participants (2)
-
Casey Duncan -
Richard Hewison