Changeset 1348


Ignore:
Timestamp:
02/07/07 01:37:15 (13 years ago)
Author:
jukka
Message:

Worked on #1139, spent 3h. Not ready yet. I'm spending wednesday at the university, so somebody should take this and continue with it. For some reason user names which are used to reach memberfolders for link and nicename won't get their memberfolders. Tarmo, would you look at Teemu's suggestion for displaying time and figure out if that can be i18n:zed.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Resources.py

    r1298 r1348  
    2828from Products.CMFPlone import PloneMessageFactory as PMF 
    2929from permissions import ModerateContent, MODIFY_CONTENT, DELETE_CONTENT 
     30import datetime 
     31from DateTime import DateTime 
    3032 
    3133import time, re 
     
    479481            return self.__history 
    480482 
     483    def getLastEditor(self): 
     484        """Returns id of last user who edited this object""" 
     485        hist=self.manage_change_history() 
     486        return hist[0]['user_name'] 
     487 
     488    def getTimeDifference(self,modtime): 
     489        """now-modtime (easier to reach datetime from here""" 
     490        now=time.time() 
     491        modtime=DateTime(modtime).timeTime() 
     492        diff=int((now-modtime)/60) 
     493        return {'days':diff/1440,'hours':(diff/60)%24,'minutes':diff%60} 
     494         
    481495    def getHistoryEntries(self): 
    482496        """Return list of history entries for viewing.""" 
  • trunk/skins/lemill/resource_list_macro.pt

    r1303 r1348  
    184184 </metal:inside_list> 
    185185 
     186 <metal:inside_list define-macro="recent_event" tal:define=" 
     187     name obj/Title | obj/getId; 
     188     real_obj obj/getObject|obj; 
     189     last_editor real_obj/getLastEditor | nothing; 
     190     modDate obj/ModificationDate; 
     191     editorhome python:mtool.getHomeFolder(last_editor); 
     192     editor_nicename editorhome/NiceName | editorhome; 
     193     editor_url editorhome/absolute_url |editorhome; 
     194     timedif python:real_obj.getTimeDifference(modDate);      
     195     "> 
     196     <p> 
     197    <span tal:condition="python:timedif['days']>1" i18n:translate="n_days"> 
     198     <span i18n:name="n" tal:replace="timedif/days" /> 
     199     days 
     200    </span> 
     201    <span tal:condition="python:timedif['days']==1" i18n:translate="oneday"> 
     202     <span i18n:name="n" tal:replace="timedif/days" /> 
     203     day 
     204    </span> 
     205    <span tal:condition="python:timedif['hours']>1" i18n:translate="n_hours"> 
     206     <span i18n:name="n" tal:replace="timedif/hours" /> 
     207     hours 
     208    </span> 
     209    <span tal:condition="python:timedif['hours']==1" i18n:translate="onehour"> 
     210     <span i18n:name="n" tal:replace="timedif/hours" /> 
     211     hour 
     212    </span> 
     213    <span tal:condition="python:timedif['minutes'] and timedif['hours']" i18n:translate="and"> 
     214    and 
     215    </span> 
     216    <span tal:condition="python:timedif['minutes']>1" i18n:translate="n_minutes"> 
     217     <span i18n:name="n" tal:replace="timedif/minutes" /> 
     218     minutes 
     219    </span> 
     220    <span tal:condition="python:timedif['minutes']==1" i18n:translate="oneminute"> 
     221     <span i18n:name="n" tal:replace="timedif/minutes" /> 
     222     minute 
     223    </span> 
     224    <span i18n:translate="ago">ago</span>  
     225 
     226    <a href=""  
     227        tal:attributes="href obj_url" tal:content="name"> 
     228    </a> 
     229    was changed by 
     230    <a href="#" tal:attributes="href editor_url" tal:content="editor_nicename"/> 
     231    </p> 
     232 </metal:inside_list> 
    186233 
    187234 
     
    214261        this_section context/getSectionFolder | nothing; 
    215262        this_section this_section/absolute_url | content_section; 
     263        recent_page python:context.getId()=='recent'; 
    216264        "> 
    217265    <li tal:repeat="obj object_list" class="resultobject"> 
     
    230278                <input type="checkbox" name="" id="" value="True" tal:attributes="name python:repeat['obj'].number(); id python:repeat['obj'].number()" /> 
    231279            </span> 
    232             <tal:inside condition="python: obj_type=='memberfolder'"> 
     280            <tal:inside condition="python: obj_type=='memberfolder' and not recent_page"> 
    233281                <metal:tds use-macro="here/resource_list_macro/macros/MemberFolder_info" /> 
    234282            </tal:inside> 
    235             <tal:inside condition="python: obj_type=='groupblog'">              
     283            <tal:inside condition="python: obj_type=='groupblog' and not recent_page">              
    236284                <metal:tds use-macro="here/resource_list_macro/macros/GroupBlog_info" /> 
    237285            </tal:inside> 
    238             <tal:inside condition="python: obj_type!='groupblog' and obj_type!='memberfolder'">              
     286            <tal:inside condition="python: obj_type!='groupblog' and obj_type!='memberfolder' and not recent_page">              
    239287                <metal:tds use-macro="here/resource_list_macro/macros/Resource_info" /> 
    240288            </tal:inside> 
     289            <tal:inside condition="recent_page">              
     290                <metal:tds use-macro="here/resource_list_macro/macros/recent_event" /> 
     291            </tal:inside> 
     292 
    241293 
    242294            <span tal:condition="inCollection" tal:omit-tag=""> 
Note: See TracChangeset for help on using the changeset viewer.