Changeset 4984


Ignore:
Timestamp:
16/02/09 17:16:00 (11 years ago)
Author:
cbyrom
Message:

Add new trackback controller and implement methods to allow
authenticated users to post comments on metadata docs. These comments
are then emailed to the metadata maintainer and added to the
corrections feed. Control then returns to the metadata document - in
non edit form - and, in the case of moles atom docs, a pop up informs
the user that the operation has completed successfully. Also add the
required genshi templates and template methods to enable this new
functionality.

Location:
MILK/trunk/milk_server/milk_server
Files:
4 added
6 edited

Legend:

Unmodified
Added
Removed
  • MILK/trunk/milk_server/milk_server/config/milkMiddleware.py

    r4964 r4984  
    7474                                               newLineChar="<br/>", 
    7575                                               isDebug = self.globals.debugAtomEditor, 
    76                                                loadAllCollections = True) 
     76                                               loadAllCollections = False) 
    7777 
    7878        # initialise collection to store re-usable connections to the eXist DB 
  • MILK/trunk/milk_server/milk_server/config/routing.py

    r4803 r4984  
    4343    map.connect('semantic',controller='browse/discovery', action='semantic') 
    4444    map.connect('view/:uri', controller = 'browse/retrieve', action='view') 
    45     map.connect('askCorrect/:uri', controller='browse/retrieve', action='askCorrect') 
    46     map.connect('correct/:uri', controller='browse/retrieve', action='correct') 
    4745    map.connect('retrive', 'retrieve/:uri', controller = 'browse/retrieve') 
    4846    map.connect('selectedItems',controller='visualise/selectedItems',action='index') 
     
    5553    map.connect('discovery',controller='browse/discovery') 
    5654 
     55    # routing for trackback 
     56    map.connect('trackback/:uri', controller='trackback/trackback') 
     57    map.connect('askCorrect/:uri', controller='trackback/trackback', action='askCorrect') 
     58    map.connect('correct/:uri', controller='trackback/trackback', action='correct') 
     59 
     60 
    5761    #do this last or else you'll get bizarre behaviour 
    5862    map.connect('',controller='browse/discovery',action='index') 
  • MILK/trunk/milk_server/milk_server/controllers/atom_editor/listatom.py

    r4959 r4984  
    1818    Provides the pylons controller for listing/searching NDG Atom documents. 
    1919    ''' 
    20  
    21      
    2220    def atomHome(self): 
    2321        '''  
  • MILK/trunk/milk_server/milk_server/controllers/browse/retrieve.py

    r4959 r4984  
    55from milk_server.lib.base import * 
    66from milk_server.lib import Utilities 
    7 from milk_server.lib import mailer 
    87from milk_server.lib.ndgInterface import ndgInterface  
    98from ndg.common.src.lib.ETxmlView import et2text, et2html 
     
    3938        if 'outputSchema' in self.inputs:  
    4039            self.outputSchema=self.inputs['outputSchema'] 
    41  
    42         # Add selected granules to context 
    43         #c.selectedGranules = [g_uri for g_uri, g_name in session.get('selection', [])] 
    4440                               
    4541        logging.info("RetrieveController set up") 
     
    272268            logging.error(c.xml) 
    273269            return render('error') 
    274      
    275     def askCorrect(self,uri): 
    276         ''' Provide a form (ajaxaciously) so that a user can correct a metadata record''' 
    277         status=self.__setup(uri) 
    278         c.uri=self.uri 
    279         if status: return response.write(status) 
    280         return render('correct',fragment=True) 
    281  
    282      
    283     def correct(self,uri): 
    284         ''' Receive a correction form to update a record and post it to the holder ''' 
    285         status=self.__setup(uri) 
    286         if 'ndgSec' not in session: 
    287             return response.write('Not Logged In') 
    288         body='Metadata Change Request for %s'%uri 
    289         payload='<Change><uri>%s</uri><from>%s</from><Contents>%s</Contents></Change>'%( 
    290             self.inputs['Identifier'],self.inputs['Submitter'],self.inputs['Comment']) 
    291         name='ChangeRequestFor_%s.xml'%uri 
    292         status,message=mailer.mailHandler([self.cf.get('DEFAULT','metadataMaintainer'),], 
    293                        body,body,xmlAttachments=[(payload,name),], 
    294                        server=self.cf.get('DEFAULT','mailserver')) 
    295         if status: 
    296             c.xml='<p>Success: Mail sent to metadata maintainer</p>' 
    297         else: 
    298             c.xml=message 
    299         return render('content') 
  • MILK/trunk/milk_server/milk_server/templates/atom_editor/atom_editor.html

    r4730 r4984  
    4545                        <script type="text/javascript" src="$g.server/js/queueDeployments.js"/> 
    4646                </span> 
     47            <script py:if="g.correctionPosted" type="text/javascript"> 
     48                        window.onload = alert('$g.correctionPosted'); 
     49                        <?python del g.correctionPosted ?> 
     50                </script> 
    4751    </head> 
    4852    <body> 
  • MILK/trunk/milk_server/milk_server/templates/ndgPage.html

    r4598 r4984  
    9595                <p py:if="'ndgSec' in session"> Please use this  
    9696                        <span> 
    97                         ${Markup(h.link_to_remote("link",dict(update="Corrections", 
    98                 url=h.url_for(action='askCorrect'))))}  
     97                        ${Markup(h.link_to_remote("link", dict(update="Corrections", 
     98                url=h.url_for(controller='trackback/trackback', action='askCorrect'))))}  
    9999            </span> 
    100100            to enter any errors in the metadata record above.  
Note: See TracChangeset for help on using the changeset viewer.