Changeset 392

Show
Ignore:
Timestamp:
07/12/06 09:18:17
Author:
crchemist
Message:

Added action icon for downloading qTopic and ATTopic search results.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • qTopic/branches/plone2.1/Extensions/Install.py

    r391 r392  
    88def install(self): 
    99    out = StringIO() 
    10                           
     10 
    1111    installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME) 
    1212    print >> out, 'Types Installed' 
     
    1414    install_subskin(self, out, GLOBALS) 
    1515    print >> out, 'Skins Installed' 
     16 
     17    pact = getToolByName(self, 'portal_actions') 
     18    pact.addAction( 'export_csv', 
     19                    'Export in CSV', 
     20                    'string:$object_url/export_csv?download=1', 
     21                    'python:(object.meta_type == "qTopic") or (object.meta_type == "ATTopic")', 
     22                    'View', 
     23                    'document_actions') 
     24    pact_icons = getToolByName(self, 'portal_actionicons') 
     25    pact_icons.addActionIcon('plone', 
     26                             'export_csv', 
     27                             'topic_icon.gif', 
     28                             'Export in CSV') 
    1629 
    1730    out.write('Installation %s successfully completed.\n' % PROJECTNAME) 
  • qTopic/branches/plone2.1/skins/qtopic/export_csv.py

    r391 r392  
    1010    context.REQUEST.RESPONSE.setHeader('Content-Type', 'plain/text') 
    1111    context.REQUEST.RESPONSE.setHeader('Content-Disposition', 'attachment; filename="%s.csv"'% context.getId()) 
     12 
    1213res = context.queryCatalog() 
    1314fields = fields or context.getCustomViewFields() 
    14 delimiter = context.getDelimiter() or ';' 
    15 if show_header and context.getShowHeader(): 
    16    print delimiter.join(fields) 
     15 
     16if hasattr(context, 'getDelimiter'): 
     17    delimiter = context.getDelimiter() or ';' 
     18else: 
     19    delimiter = ',' 
     20 
     21if hasattr(context, 'getShowHeader'): 
     22    if show_header and context.getShowHeader(): 
     23        print delimiter.join(fields) 
     24else: 
     25    if show_header: 
     26        print delimiter.join(fields) 
     27 
     28 
    1729for r in res: 
    1830   print delimiter.join([test(getattr(r, f, ''),getattr(r, f, ''),'') for f in fields])