Changeset 2860

Show
Ignore:
Timestamp:
08/14/09 12:04:35 (2 years ago)
Author:
jukka
Message:

Fixed #1893. History has stored all of the necessary changes, but view widgets didn't look for them. Previous changes work now in textareas, common stringfields and links.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Resource.py

    r2858 r2860  
    127127 
    128128    def canDeleteOnCancel(self): 
    129         """ LearningResources have translations that should be deleted if just created """ 
    130         history=self.getHistory() 
    131         if not history: 
    132             return True 
    133         summary=history[0].get('_summary','') 
    134         if summary.startswith('Translation of '):  # this is a newly created translation 
    135             return True   
    136         return Resource.canDeleteOnCancel(self) 
     129        """ Resources haven't got any special conditions """ 
     130        return CommonMixIn.canDeleteOnCancel(self) 
    137131 
    138132 
     
    806800    def getFieldHistory(self, fieldname, timestamp): 
    807801        """ get field from an older version, used by Fields from FieldsWidgets.py """ 
     802        if not timestamp: # page templates call this even when they intend not to use result, in test(condition, act1, act2) -formulations  
     803            return None 
    808804        history = self.getHistory() 
    809805        timestamp = float(timestamp) 
  • trunk/skins/lemill/go_back.cpy

    r2858 r2860  
    2323    ##context.remove_creation_mark() 
    2424    redirect_to = context.getFolderWhenPortalFactory().absolute_url() 
    25     msg=_(u'Add New Item operation was cancelled.') 
     25    msg=_(u'Resource cancelled.') 
    2626elif context.canDeleteOnCancel(): 
    2727    if translation_of: 
  • trunk/skins/lemill/widget_copyright.pt

    r2636 r2860  
    1111    <metal:view_macro define-macro="view" 
    1212              tal:define="vocab python:field.Vocabulary(here); 
    13                           value python:accessor(); 
     13                          version python:request.get('version',None);                           
     14                          value python:test(version, here.getFieldHistory(field.getName(), version), accessor()); 
    1415                          display python:here.displayValue(vocab, value)"> 
    1516        <tal:copyright condition="python:value=='CreativeCommons'"> 
  • trunk/skins/lemill/widget_htmllink.pt

    r1756 r2860  
    99    <!-- Tags Widgets --> 
    1010 
    11     <metal:view_macro define-macro="view"> 
    12         <a tal:replace="structure python:widget.getShortLinkName(accessor())" /> 
    13     </metal:view_macro> 
     11    <metal:view_macro define-macro="view"  
     12        tal:define="version python:request.get('version',None); 
     13                    value python:test(version, here.getFieldHistory(field.getName(), version), accessor()); 
     14                    value python:widget.getShortLinkName(value);"  
     15        tal:replace="structure value" /> 
    1416 
    1517    <div metal:define-macro="edit"> 
  • trunk/skins/lemill/widget_string.pt

    r2573 r2860  
    88 
    99    <!-- String Widgets --> 
    10     <metal:view_macro define-macro="view" 
    11               tal:replace="structure accessor" /> 
     10    <metal:view_macro define-macro="view"  
     11        tal:define="version python:request.get('version',None); 
     12                value python:test(version, here.getFieldHistory(field.getName(), version), accessor());" 
     13        tal:replace="structure value" /> 
    1214 
    1315    <metal:define define-macro="edit"> 
  • trunk/skins/lemill/widget_tags.pt

    r2116 r2860  
    99    <!-- Tags Widgets --> 
    1010 
    11     <metal:view_macro define-macro="view" tal:repeat="tag accessor" tal:define="link_pref link_pref | string:"> 
     11    <metal:view_macro define-macro="view" tal:repeat="tag accessor" tal:define="link_pref link_pref | string:${field/getName}?tag="> 
    1212            <a href=""  
    13                 tal:attributes="href python:test(link_pref, link_pref+tag, field.getName()+'?tag='+tag)"  
     13                tal:attributes="href string:${link_pref}${tag}"  
    1414                tal:content="tag"></a><span tal:condition="not:repeat/tag/end" tal:omit-tag="">, </span> 
    1515    </metal:view_macro> 
  • trunk/skins/lemill/widget_textarea.pt

    r2143 r2860  
    1111    <!-- TextArea Widgets --> 
    1212 
    13     <metal:view_macro define-macro="view"> 
    14     <tal:defs tal:replace="structure python:context.lemill_tool.parse_text(accessor())" /> 
    15     </metal:view_macro> 
     13    <metal:view_macro define-macro="view" 
     14        tal:define="version python:request.get('version',None); 
     15                value python:test(version, here.getFieldHistory(field.getName(), version), accessor()); 
     16                value python:context.lemill_tool.parse_text(value)" 
     17        tal:replace="structure value" /> 
    1618 
    1719    <metal:define define-macro="area_edit">