Changeset 2410


Ignore:
Timestamp:
06/09/08 14:48:45 (11 years ago)
Author:
anonymous
Message:

Portlets are much more efficient and simpler now and work independent of Plone's portlet system. The logic is in Resources/getPortletDetails, portlets itself just either show or not show their parts.

Location:
trunk
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • trunk/Activity.py

    r2409 r2410  
    5656    meta_type = "Activity" 
    5757    archetype_name = "Activity" 
    58  
     58    portlet = 'here/portlet_activity_actions/macros/portlet' 
     59     
    5960    def getRelatedStories(self): 
    6061        """ Returns good collections with stories """ 
  • trunk/BlogPost.py

    r2409 r2410  
    8282    security.declareObjectPublic() 
    8383    schema = schema 
     84    portlet = 'here/portlet_groupblog_actions/macros/portlet' 
    8485 
    8586    security.declarePrivate('manage_afterAdd') 
     
    8788        """1) Replaces the left side portlets with the content type's own action portlet. 2) add obj id to list of recent entries in parent GroupBlog. """ 
    8889        BaseContent.manage_afterAdd(self, item, container) 
    89         if not hasattr(item.aq_base, 'left_slots'): 
    90             if container.id=='unassigned_discussions': 
    91                 self._setProperty('left_slots', [], 'lines')             
    92             else: 
    93                 self._setProperty('left_slots', ['here/portlet_groupblog_actions/macros/portlet',], 'lines') 
    9490        if hasattr(container, 'recent_posts'): 
    9591            container.addRecent_post(self.getId())             
  • trunk/ConfigurationMethods.py

    r2409 r2410  
    257257#            jsreg.moveResourceToBottom(script)     
    258258 
    259  
    260 def setupPortlets(self,portal): 
    261     """Sets up the basic portlet layout.""" 
    262  
    263     # Use safeEditProperty always to edit properties of the portal or any tools 
    264     safeEditProperty(portal,'left_slots',('here/portlet_empty/macros/portlet',)) 
    265     safeEditProperty(portal,'right_slots',('',)) 
    266259 
    267260def setupSiteSyndication(self, portal): 
  • trunk/ExerciseMaterial.py

    r2401 r2410  
    7575    def manage_afterAdd(self, item, container): 
    7676        Material.manage_afterAdd(self, item, container) 
    77  
    78         if not hasattr(item.aq_base, 'left_slots'): 
    79             self._setProperty('left_slots', ['here/portlet_material_actions/macros/portlet',], 'lines') 
    80         else: 
    81             self._updateProperty('left_slots', ['here/portlet_material_actions/macros/portlet',]) 
    8277 
    8378    def getOnlyText(self): 
  • trunk/Extensions/Install.py

    r2409 r2410  
    552552#        print >>out, "Migration from 2.3 complete" 
    553553 
    554  
    555     if doWeMigrate(old,'2.2.9'): 
    556         print >>out, "Starting migration from 2.2.9" 
     554    # Note to self: If the version of current code (=old) is smaller than given number, doWeMigrate = True 
     555 
     556    if doWeMigrate(old,'2.2.10.1'): 
     557        def setWState(obj, t, wtool): 
     558            """ Recursively set obj.state to match workflow state """ 
     559            wstate=wtool.getInfoFor(obj,'review_state',None) 
     560            if wstate and hasattr(obj, 'state'): 
     561                obj.setState(wstate) 
     562                print >>out, '%s set to %s' % (obj.id, wstate) 
     563                t=t+1 
     564                if t>500: 
     565                    print >>out, '*** committing subtransaction, 500 objects ***' 
     566                    transaction.savepoint(optimistic=True) 
     567                    t=0 
     568            for sub_obj in obj.objectValues(): 
     569                t=setWState(sub_obj, t, wtool) 
     570            return t             
     571 
     572        print >>out, "Starting migration from 2.2.10.1" 
    557573        print >>out, "Set workflow state to object's property." 
     574        wtool = getToolByName(self, 'portal_workflow') 
    558575        sections=['content','methods','tools','community','trash'] 
    559         wtool = getToolByName(self, 'portal_workflow') 
    560576        t=0 
    561577        for section in sections: 
    562578            section=getattr(self, section) 
    563             for obj in section.objectValues(): 
    564                 wstate=wtool.getInfoFor(obj,'review_state',None) 
    565                 if wstate and hasattr(obj, 'state'): 
    566                     obj.setState(wstate) 
    567                     print >>out, '%s set to %s' % (obj.id, wstate) 
    568                     t=t+1 
    569                     if t>500: 
    570                         print >>out, '*** committing subtransaction ***' 
    571                         transaction.savepoint(optimistic=True) 
    572                         t=0 
    573  
     579            t=setWState(section, t, wtool)                                 
    574580        print >>out, '*** workflow states converted to object states ***' 
    575581        print >>out, "Migration from 2.2.9 complete" 
     
    587593                t=t+1 
    588594                if t>500: 
    589                     print >>out, '*** committing subtransaction ***' 
     595                    print >>out, '*** committing subtransaction, 500 objects ***' 
    590596                    transaction.savepoint(optimistic=True) 
    591597                    t=0 
     
    593599        print >>out, "*** BlogPosts now store their parent's id in catalog ***" 
    594600        print >>out, "Migration from 2.3 complete" 
     601 
     602    if doWeMigrate(old,'2.3.1'): 
     603        def remove_slots(obj, t): 
     604            """ Remove slots recursively """ 
     605            if hasattr(obj, 'left_slots'): 
     606                try: 
     607                    delattr(obj, 'left_slots') 
     608                    print obj.id 
     609                except: 
     610                    print 'problem w. %s' % obj.id 
     611                t=t+1 
     612                if t>500: 
     613                    print >>out, '*** committing subtransaction, 500 objects ***' 
     614                    transaction.savepoint(optimistic=True) 
     615                    t=0 
     616            if hasattr(obj, 'right_slots'): 
     617                try: 
     618                    delattr(obj, 'right_slots') 
     619                except: 
     620                    pass 
     621            for sub_obj in obj.objectValues(): 
     622                t= remove_slots(sub_obj, t)  
     623            return t 
     624         
     625        print >>out, "Starting migration from 2.3.1" 
     626        print >>out, "Remove portlet info from objects -- from now on it is stored in object class." 
     627        #sections=['content','methods','tools','community','trash'] 
     628        sections=['community'] 
     629        wtool = getToolByName(self, 'portal_workflow') 
     630        t=0 
     631        for section in sections: 
     632            section=getattr(self, section) 
     633            t=remove_slots(section, t) 
     634 
     635        print >>out, "*** left_slots and right_slots removed from every object ***" 
     636        print >>out, "Migration from 2.3.1 complete" 
    595637 
    596638             
  • trunk/GroupBlog.py

    r2409 r2410  
    107107    global_allow = 1 
    108108 
     109    portlet = 'here/portlet_groupblog_actions/macros/portlet' 
    109110    allowed_content_types = ('BlogPost') 
    110111    default_view = ('groupblog_view') 
     
    149150        if memberfolder!=None and type(memberfolder)=='MemberFolder': 
    150151            memberfolder.recalculateScore() 
    151         if not hasattr(item.aq_base, 'left_slots'): 
    152             self._setProperty('left_slots', ['here/portlet_%s_actions/macros/portlet' % item.meta_type.lower(),], 'lines') 
    153152        # Enable topic syndication by default 
    154153        syn_tool = getToolByName(self, 'portal_syndication', None) 
  • trunk/LargeSectionFolder.py

    r2409 r2410  
    5656    featured_types=MATERIAL_TYPES 
    5757    top3_categories={'top3_tags':'getTags', 'top3_languages':'Language'} 
    58  
     58    portlet='' 
    5959 
    6060    ######### HOSTING SCRIPTS ################ 
     
    6464    def reindex_section(self, start=0, end=0, obj=None): 
    6565        """ Do catalog update for every object in section """ 
     66 
    6667        f=0 
    6768        if obj: 
     
    370371 
    371372 
     373    def getPortletPath(self): 
     374        """ Return a path to portlet, defined in object's class """ 
     375        return self.__class__.portlet 
     376 
    372377 
    373378    ################# Object creation #################### 
     
    809814        """ Make sure that predefined calculations for most popular results really exist, if not, calculate them """  
    810815        categories=self.__class__.top3_categories 
    811         if hasattr(self, categories.keys()[0]) and (not force_refresh) and hasattr(self, 'topthrees_created') and time.time()-self.topthrees_created<3600: # They do exist, do nothing 
     816        if hasattr(self, categories.keys()[0]) and (not force_refresh) and hasattr(self, 'topthrees_created') and time.time()-self.topthrees_created<36000: # They do exist, do nothing 
     817            print '%s : TopThrees exists.' % self.id 
    812818            return True 
     819 
     820        t=time.time() 
     821        print '%s : Creating TopThrees.. ' % self.id,  
    813822        SCORE_THRESHOLD=0 # Resource needs to have score>N to get to front page 
    814823        results=self.getSearchObject(portal_type=self.__class__.featured_types, getState=('public','draft')) 
     
    816825            tops=self.getTopResults(results, index_type) 
    817826            setattr(self, name, tops) 
    818         setattr(self, 'topthrees_created', time.time()) 
    819         setattr(self, 'featured_items', [{'UID':x.UID,'Language':x.Language, 'getScore':x.getScore} for x in results if  x.getScore>SCORE_THRESHOLD and x.getHasCoverImage and x.Title]) 
     827        self.topthrees_created= time.time() 
     828        self.featured_items = [{'UID':x.UID,'Language':x.Language, 'getScore':x.getScore} for x in results if  x.getScore>SCORE_THRESHOLD and x.getHasCoverImage and x.Title] 
     829        print time.time()-t 
    820830             
    821831 
     
    10241034    allowed_content_types = CONTENT_TYPES +('Topic','Redirector') 
    10251035    default_view = ('lemill_content_view') 
     1036    portlet='here/portlet_add_content/macros/portlet' 
    10261037    filter_content_types = True 
    10271038    security = ClassSecurityInfo() 
     
    11151126    allowed_content_types = ('Activity','KB', 'Topic','Redirector') 
    11161127    default_view = ('lemill_activities_view') 
     1128    portlet='here/portlet_add_activity/macros/portlet' 
    11171129    filter_content_types = True 
    11181130    featured_types=['Activity'] 
     
    11551167    allowed_content_types = ('Tool', 'Topic','Redirector') 
    11561168    default_view = ('lemill_tools_view') 
     1169    portlet='here/portlet_add_tool/macros/portlet' 
    11571170    filter_content_types = True 
    11581171    featured_types=['Tool'] 
     
    11971210    allowed_content_types = ('Topic','Redirector','MemberFolder','GroupBlog','ATBTreeFolder','Large Plone Folder') 
    11981211    default_view = ('lemill_community_view') 
     1212    portlet='here/portlet_add_community/macros/portlet' 
     1213 
    11991214    filter_content_types = False 
    12001215    security = ClassSecurityInfo() 
     
    12221237        """ Make sure that predefined calculations for most popular results really exist, if not, calculate them """  
    12231238        categories=self.__class__.top3_categories 
    1224         if hasattr(self, categories.keys()[0]) and (not force_refresh) and hasattr(self, 'topthrees_created') and time.time()-self.topthrees_created<3600: # They do exist, do nothing 
     1239        if hasattr(self, categories.keys()[0]) and (not force_refresh) and hasattr(self, 'topthrees_created') and time.time()-self.topthrees_created<36000: # They do exist, do nothing 
     1240            print '%s : TopThrees exists.' % self.id 
    12251241            return True 
     1242        t=time.time() 
     1243        print '%s : Creating TopThrees.. ' % self.id,  
    12261244        SCORE_THRESHOLD=5 # Resource needs to have score>N to get to front page 
    12271245        results=self.getSearchObject(portal_type=self.__class__.featured_types, getState='public') 
     
    12371255        setattr(self, 'topthrees_created', time.time()) 
    12381256        setattr(self, 'featured_items', [{'UID':x.UID,'Language':x.Language, 'getScore':x.getScore} for x in results if  x.getScore>SCORE_THRESHOLD and x.getHasCoverImage and x.Title]) 
     1257        print time.time()-t 
    12391258 
    12401259 
  • trunk/LeMillReference.py

    r2401 r2410  
    157157    archetype_name = 'LeMillReference' 
    158158 
     159    portlet = 'here/portlet_lemillreference_actions/macros/portlet' 
    159160    security = ClassSecurityInfo() 
    160161    security.declareObjectPublic() 
  • trunk/Material.py

    r2401 r2410  
    4545    security = ClassSecurityInfo() 
    4646    security.declareObjectPublic() 
    47  
     47    portlet = 'here/portlet_material_actions/macros/portlet' 
    4848    aliases = { 
    4949        '(Default)' : 'fullscreen_view', 
  • trunk/MemberFolder.py

    r2409 r2410  
    270270    typeDescMsgId='description_memberfolder' 
    271271    global_allow = 1 
     272    portlet = 'here/portlet_member/macros/portlet' 
    272273 
    273274    allowed_content_types = ('CollectionsFolder', 'Topic') 
     
    301302    def manage_afterAdd(self, item, container): 
    302303        BaseFolder.manage_afterAdd(self, item, container) 
    303         if not hasattr(item.aq_base, 'left_slots'): 
    304             self._setProperty('left_slots', ['here/portlet_member/macros/portlet',], 'lines') 
    305         else: 
    306             self._updateProperty('left_slots', ['here/portlet_member/macros/portlet',]) 
    307304        # Handle case when logged in user is authenticated from an 
    308305        # external source for the first time 
  • trunk/MultimediaMaterial.py

    r2401 r2410  
    6363    meta_type = "MultimediaMaterial" 
    6464    archetype_name = "MultimediaMaterial" 
    65  
     65    portlet = 'here/portlet_material_actions/macros/portlet' 
    6666    security = ClassSecurityInfo() 
    6767    security.declareObjectPublic() 
     
    7070    def manage_afterAdd(self, item, container): 
    7171        Material.manage_afterAdd(self, item, container) 
    72  
    73         if not hasattr(item.aq_base, 'left_slots'): 
    74             self._setProperty('left_slots', ['here/portlet_material_actions/macros/portlet',], 'lines') 
    75         else: 
    76             self._updateProperty('left_slots', ['here/portlet_material_actions/macros/portlet',]) 
    7772 
    7873    def getOnlyText(self): 
  • trunk/PILOTMaterial.py

    r2401 r2410  
    9696    meta_type = 'PILOTMaterial' 
    9797    archetype_name = 'PILOTMaterial' 
    98  
     98     
    9999    security = ClassSecurityInfo() 
    100100    security.declareObjectPublic() 
     
    103103    def manage_afterAdd(self, item, container): 
    104104        Material.manage_afterAdd(self, item, container) 
    105         if not hasattr(item.aq_base, 'left_slots'): 
    106             self._setProperty('left_slots', ['here/portlet_material_actions/macros/portlet',], 'lines') 
    107         else: 
    108             self._updateProperty('left_slots', ['here/portlet_material_actions/macros/portlet',]) 
    109105 
    110106    def getOnlyText(self): 
  • trunk/Piece.py

    r2409 r2410  
    8383    }, 
    8484    ) 
    85  
    86  
     85     
     86    portlet = 'here/portlet_piece_actions/macros/portlet' 
    8787    meta_type = "Piece" 
    8888    archetype_name = "Piece" 
  • trunk/PresentationMaterial.py

    r2401 r2410  
    114114    def manage_afterAdd(self, item, container): 
    115115        Material.manage_afterAdd(self, item, container) 
    116         if not hasattr(item.aq_base, 'left_slots'): 
    117             self._setProperty('left_slots', ['here/portlet_material_actions/macros/portlet',], 'lines') 
    118         else: 
    119             self._updateProperty('left_slots', ['here/portlet_material_actions/macros/portlet',]) 
    120116 
    121117 
  • trunk/Resources.py

    r2409 r2410  
    2424from Products.CMFCore.utils import getToolByName 
    2525from AccessControl import ClassSecurityInfo, Unauthorized 
    26 from config import PROJECTNAME, MATERIAL_TYPES, LANGUAGE_INDEPENDENT_FIELDS, DEFAULT_ICONS, TYPE_ABBREVIATIONS 
     26from config import PROJECTNAME, MATERIAL_TYPES, LANGUAGE_INDEPENDENT_FIELDS, DEFAULT_ICONS, TYPE_ABBREVIATIONS, TOOLS_TYPES, ACTIVITY_TYPES 
    2727from persistent.list import PersistentList 
    2828from Products.LeMill import LeMillMessageFactory as _ 
     
    6464    ############## Getters and feature checks  ################################################## 
    6565    security = ClassSecurityInfo() 
     66    portlet = '' 
    6667 
    6768    def getDefaultIcon(self, meta_type='', obj=None): 
     
    185186 
    186187 
     188    ############ Portlets       ######################################### 
     189 
     190    def getPortletPath(self): 
     191        """ Return a path to portlet, defined in object's class """ 
     192        return self.__class__.portlet 
     193     
     194    def getPortletDetails(self, view_id, isAnon, member): 
     195        """ Return an object of booleans to determine what to show and what to hide in portlet view """ 
     196 
     197 
     198        v={'isDeleted':False, 
     199            'isPublic':False, 
     200            'isDraft':False, 
     201            'canEdit':False, 
     202            'canManage':False, 
     203            'canModerate':False, 
     204            'owner':False, 
     205            'subView':False, 
     206            'mainView':False, 
     207            'canUndelete':False, 
     208            'historyView':False, 
     209            'canChangeCoverImage':False, 
     210            'canPublish':False, 
     211            'canRetract':False, 
     212            'editLink':'', 
     213            'hasAbout':False, 
     214            'canConvert':False, 
     215            'aboutView':False, 
     216            'editMetadataLink':'', 
     217            'lenCollections':0, 
     218            'showCollections':False, 
     219            'showTranslations':False, 
     220            'translateLink':'', 
     221            'translations':[], 
     222            'hasViews':False, 
     223            'studentViewLink':'', 
     224            'slideShowLink':''} 
     225         
     226        ################ Mandatory flags     
     227        view_id=view_id.split('/')[-1] 
     228        url=self.absolute_url() 
     229 
     230 
     231        v['isDeleted'] = isDeleted = self.isDeleted() 
     232        v['isPublic'] = isPublic = self.isPublic() 
     233        v['isDraft'] = isDraft = self.isDraft() 
     234         
     235        v['isAnon'] = isAnon  
     236        if not isAnon: 
     237            roles = member.getRolesInContext(self) 
     238            v['canManage'] = canManage = 'Manager' in roles 
     239            v['owner'] = owner = 'Owner' in roles 
     240            v['canModerate'] = canModerate = canManage or owner or 'Reviewer' in roles 
     241            v['canEdit'] = canEdit = self.canIEdit() 
     242         
     243        v['subView'] = subView = view_id in ['about_view', 'history_view','collections_list','manage_translations','manage_convert'] and not isDeleted 
     244        v['mainView'] = mainView = not (subView or isDeleted) 
     245        v['canUndelete'] = canModerate and isDeleted  
     246        if isDeleted: # Don't bother calculating rest of the values, they're False or '' 
     247            return v 
     248        ################ Editing flags     
     249        isMaterial= self.portal_type in MATERIAL_TYPES 
     250 
     251        v['historyView'] = view_id == 'history_view' 
     252        v['canChangeCoverImage'] = canEdit and isPublic and mainView 
     253        v['canPublish'] = canModerate and isDraft 
     254        v['canRetract'] = canModerate and isPublic and isMaterial 
     255        if isAnon: 
     256            v['editLink'] = 'login_form' 
     257        elif canEdit: 
     258            v['editLink'] = '%s/edit' % url 
     259        else: 
     260            v['editLink'] = '%s/join_a_group' % url 
     261        v['hasAbout'] = isMaterial and not isDeleted 
     262        v['canConvert'] = canModerate and self.portal_type in ['ExerciseMaterial','MultimediaMaterial','LeMillReference','Tool','Activity'] 
     263        v['aboutView'] = aboutView =  view_id=='about_view' 
     264        if aboutView: 
     265            if isAnon: 
     266                v['editMetadataLink'] = 'login_form' 
     267            elif canEdit: 
     268                v['editMetadataLink'] = '%s/edit' % url 
     269            else: 
     270                v['editMetadataLink'] = '%s/join_a_group' % url         
     271        else: 
     272            v['editMetadataLink']='' 
     273        v['lenCollections'] = lenCollections = len(self.community.getCollections(obj_uid=self.UID())) 
     274        v['showCollections'] = lenCollections or not isAnon 
     275        v['showTranslations'] = showTranslations = isMaterial or self.portal_type in ACTIVITY_TYPES+TOOLS_TYPES 
     276        if not showTranslations: 
     277            return v # rest of the variables are useful only for translatable types, others can leave now 
     278        ################# Translation and student view related flags 
     279        if isAnon: 
     280            v['translateLink']= 'login_form' 
     281        else: 
     282            v['translateLink'] = '%s/translate_resource' % url 
     283        translations=[] 
     284        for md in self.getTranslationsOfOriginal(include_original=True): 
     285            resource={} 
     286            resource['isThis'] = self.id==md.id 
     287            resource['url'] = md.absolute_url() 
     288            resource['languageName'] = self.lemill_tool.getPrettyLanguage(md.Language()) 
     289            translations.append(resource) 
     290        v['translations']=translations 
     291        v['hasViews'] = isMaterial 
     292        if isMaterial: 
     293            if self.portal_type=='PresentationMaterial': 
     294                v['studentViewLink']='%s/fullscreen_view' % url 
     295                v['slideShowLink']=url 
     296            else: 
     297                v['studentViewLink']=url 
     298                v['slideShowLink']='' 
     299 
     300        return v 
    187301 
    188302InitializeClass(CommonMixIn) 
     
    332446        except TypeError: 
    333447            pass # ZEXP import problem 
    334         if not hasattr(item.aq_base, 'left_slots'): 
    335             self._setProperty('left_slots', ['here/portlet_%s_actions/macros/portlet' % item.meta_type.lower(),], 'lines') 
    336448 
    337449    security.declarePrivate('at_post_create_script') 
  • trunk/Tool.py

    r2409 r2410  
    6363    meta_type = "Tool" 
    6464    archetype_name = "Tool"   
     65    portlet = 'here/portlet_tool_actions/macros/portlet' 
    6566    security = ClassSecurityInfo() 
    6667    security.declareObjectPublic() 
  • trunk/skins/lemill/login_form.cpt

    r2409 r2410  
    3333<p i18n:translate="description_no_account" 
    3434   tal:condition="python: checkPermission('Add portal member', here)"> 
    35  
    36 string:${portal_url}/join_form 
    3735 
    3836If you do not have an account here, head over to the 
  • trunk/skins/lemill/portlet_activity_actions.pt

    r2409 r2410  
    44<body> 
    55<div metal:define-macro="portlet" id="portlet-material-actions"  
    6         tal:define="path_end python:here.REQUEST['URL'].split('/')[-1]; 
    7                     is_History python:path_end=='history_view' or here.REQUEST.get('version',0); 
    8                     is_Translation python:path_end.endswith('_translations'); 
    9                     is_Collection python:path_end=='collections_list' or path_end.startswith('manage_'); 
    10                     is_Discussion python:path_end=='discussion'; 
    11                     is_owner here/amIOwner; 
    12                     can_moderate here/canIModerate; 
    13                     is_About python:path_end=='about_view';"> 
     6        tal:define="d python:here.getPortletDetails(here.REQUEST['URL'], isAnon, member)"> 
    147 
    15 <tal:visible condition="not:here/isDeleted"> 
    16     <div class="tb-portlet" metal:define-macro="image_div"> 
    17         <p style="text-align: center;" tal:condition="python: is_History or is_Translation or is_Collection or is_Discussion"><a href=""  tal:attributes="href string: ${here_url}/view"><img src="images/default_learningresource.png" tal:attributes="src here/getCoverImageURL; alt python:here.meta_type" style="padding: 39px 0px 29px 0px;" /></a></p> 
    18         <p style="text-align: center;" tal:condition="python: not (is_History or is_Translation or is_Collection or is_Discussion)"><img src="images/default_learningresource.png" tal:attributes="src here/getCoverImageURL; alt python:here.meta_type" style="padding: 39px 0px 29px 0px;" /></p> 
    19         <tal:editable tal:condition="python: not (is_History or is_Collection)"> 
    20         <ul metal:define-slot="image_edit" tal:condition="is_editable"> 
    21             <li > 
    22                 <a  href="" tal:attributes="href string:${here_url}/change_coverimage"><tal:block i18n:translate="label_change_cover_image">Change cover image</tal:block>...</a> 
    23             </li> 
    24         </ul> 
    25         </tal:editable> 
    26     </div> 
    278 
    28     <tal:history condition="is_History"> 
    29     <div class="tb-portlet" metal:use-macro="here/portlet_material_actions/macros/history_div"/> 
    30     </tal:history> 
    31      
    32     <tal:hide condition="python: not (is_History or is_Collection)"> 
    33     <div class="tb-portlet" metal:use-macro="here/portlet_material_actions/macros/edit_div"/> 
    34     <div class="tb-portlet" metal:use-macro="here/portlet_material_actions/macros/collections_div"/> 
    35      
    36     <div class="tb-portlet" metal:use-macro="here/portlet_material_actions/macros/translate_actions"/> 
     9<tal:block metal:use-macro="here/portlet_macros/macros/coverImageDiv"/> 
    3710 
    38     </tal:hide> 
    39 </tal:visible> 
    40 <tal:deleted condition="here/isDeleted"> 
    41     <div class="tb-portlet" metal:use-macro="here/portlet_material_actions/macros/restore_div"/> 
    42 </tal:deleted> 
     11<tal:block metal:use-macro="here/portlet_macros/macros/editDiv"/> 
     12 
     13<tal:block metal:use-macro="here/portlet_macros/macros/collectionsDiv"/> 
     14 
     15<tal:block metal:use-macro="here/portlet_macros/macros/translationsDiv"/> 
     16 
    4317</div> 
    4418</body> 
  • trunk/skins/lemill/portlet_lemillreference_actions.pt

    r2409 r2410  
    55 
    66<div metal:define-macro="portlet" id="portlet-material-actions" 
    7         tal:define="path_end python:here.REQUEST['URL'].split('/')[-1]; 
    8                     is_History python:path_end=='history_view' or here.REQUEST.get('version',0); 
    9                     is_Collection python:path_end=='collections_list' or path_end.startswith('manage_'); 
    10                     is_Translation python:path_end.endswith('_translations'); 
    11                     is_Discussion python:path_end=='discussion'; 
    12                     is_owner here/amIOwner; 
    13                     can_moderate here/canIModerate; 
    14                     is_About python:path_end=='about_view';"> 
     7        tal:define="d python:here.getPortletDetails(here.REQUEST['URL'], isAnon, member)"> 
    158 
    16 <tal:visible condition="not:here/isDeleted"> 
    179 
    18 <div class="tb-portlet" metal:use-macro="here/portlet_activity_actions/macros/image_div" /> 
     10<tal:block metal:use-macro="here/portlet_macros/macros/coverImageDiv"/> 
    1911 
    20     <tal:history condition="is_History"> 
    21     <div class="tb-portlet" metal:use-macro="here/portlet_material_actions/macros/history_div"/> 
    22     </tal:history> 
     12<tal:block metal:use-macro="here/portlet_macros/macros/editDiv"/> 
    2313 
    24     <tal:hide condition="python: not (is_History or is_Collection)"> 
    25     <div class="tb-portlet" metal:use-macro="here/portlet_piece_actions/macros/edit_div"/> 
    26     <div class="tb-portlet" metal:use-macro="here/portlet_material_actions/macros/collections_div"/> 
     14<tal:block metal:use-macro="here/portlet_macros/macros/collectionsDiv"/> 
    2715 
    28     <div class="tb-portlet" metal:use-macro="here/portlet_material_actions/macros/view_div"/> 
    29     <div class="tb-portlet" metal:use-macro="here/portlet_material_actions/macros/owner_div"/> 
     16<tal:block metal:use-macro="here/portlet_macros/macros/translationsDiv"/> 
    3017 
    31     </tal:hide> 
    32 </tal:visible> 
    33 <tal:deleted condition="here/isDeleted"> 
    34     <div class="tb-portlet" metal:use-macro="here/portlet_material_actions/macros/restore_div"/> 
    35 </tal:deleted> 
    3618 
    3719</div> 
  • trunk/skins/lemill/portlet_material_actions.pt

    r2409 r2410  
    44<body> 
    55    <div metal:define-macro="portlet" id="portlet-material-actions"  
    6         tal:define="path_end python:here.REQUEST['URL'].split('/')[-1]; 
    7                     is_History python:path_end=='history_view' or here.REQUEST.get('version',0); 
    8                     is_Collection python:path_end=='collections_list' or path_end.startswith('manage_'); 
    9                     is_Translation python:path_end.endswith('_translations'); 
    10                     is_Discussion python:path_end=='discussion'; 
    11                     can_moderate here/canIModerate; 
    12                     is_owner here/amIOwner; 
    13                     is_About python:path_end=='about_view'; 
    14                     is_editable python:checkPermission('Modify portal content', here) and here.canIEdit();"> 
    15  
    16 <tal:visible condition="not:here/isDeleted"> 
    17  
    18 <div class="tb-portlet" metal:define-macro="image_div"> 
    19     <p style="text-align: center;" tal:condition="python: is_History or is_Translation or is_Collection or is_About or is_Discussion"><a href="" tal:attributes="href string: ${here_url}/view"><img src="images/default_learningresource.png" tal:attributes="src here/getCoverImageURL; alt python:here.meta_type" style="padding: 39px 0px 29px 0px;" /></a></p> 
    20     <p style="text-align: center;" tal:condition="python: not (is_History or is_Translation or is_Collection or is_About or is_Discussion)"><img src="images/default_learningresource.png" tal:attributes="src here/getCoverImageURL; alt python:here.meta_type" style="padding: 39px 0px 29px 0px;" /></p> 
    21     <tal:editable tal:condition="python: not (is_History or is_Collection or is_About)"> 
    22     <ul metal:define-slot="image_edit" tal:condition="python: here.isPublic() and (is_editable or can_moderate)"> 
    23         <li tal:condition="is_editable"> 
    24             <a  href="" tal:attributes="href string:${here_url}/change_coverimage"><tal:block i18n:translate="label_change_cover_image">Change cover image</tal:block>...</a> 
    25         </li> 
    26         <li tal:condition="python:is_owner or can_moderate"> 
    27             <a href="" tal:attributes="href string:$here_url/retract"><tal:block i18n:domain="lemill" i18n:translate="Change to draft">Change to draft</tal:block></a> 
    28         </li> 
    29     </ul> 
    30     <ul tal:condition="python:here.isDraft() and (is_owner or can_moderate)"> 
    31         <li> 
    32             <a href="" tal:attributes="href string:$here_url/lemill_ask_publish"><tal:block i18n:domain="plone" i18n:translate="Publish">Publish</tal:block>...</a> 
    33         </li> 
    34     </ul> 
    35     </tal:editable> 
    36 </div> 
    37  
    38 <tal:history condition="is_History"> 
    39 <div class="tb-portlet" metal:define-macro="history_div" tal:condition="python:path_end!='history_view'"> 
    40     <ul tal:condition="python:path_end!='history_view'"> 
    41         <li><a href="" i18n:translate="label_view_history" tal:attributes="href string:${here_url}/history_view">History</a></li> 
    42         <li tal:condition="is_editable"><a href="" i18n:translate="label_restore_this_version" tal:define="currentVersion here/REQUEST/version|nothing" tal:attributes="href python:here_url + '/restoreAVersion?timestamp=' + currentVersion">Restore this version</a></li> 
    43     </ul> 
    44 </div> 
    45 </tal:history> 
    46  
    47 <tal:about condition="is_About"> 
    48 <div class="tb-portlet" metal:define-macro="about_div"> 
    49     <ul> 
    50         <li> 
    51         <a href="" 
    52             tal:attributes="href python:test(is_editable, here_url+'/base_metadata', 
    53                 test(isAnon, 'login_form', here_url+'/join_a_group'))"><tal:block i18n:translate="label_edit_about">Edit about</tal:block>...</a> 
    54         </li> 
    55     </ul> 
    56 </div> 
    57 </tal:about> 
    58  
    59 <tal:not_history condition="python: not (is_History or is_Collection or is_About)"> 
    60 <div class="tb-portlet" metal:define-macro="edit_div"> 
    61     <ul> 
    62         <li> 
    63             <a href="" i18n:domain="plone" 
    64                 tal:attributes="href python:test(is_editable, here_url+'/edit',  
    65                     test(isAnon, 'login_form', here_url+'/join_a_group'))"><tal:block i18n:translate="label_edit">Edit</tal:block>...</a> 
    66         </li> 
    67         <li tal:condition="python:context.meta_type in context.getMaterialTypes()"> 
    68             <a href="" i18n:translate="label_view_about" tal:attributes="href string:${here_url}/about_view">About</a> 
    69         </li> 
    70         <li><a href="" i18n:translate="label_view_history" tal:attributes="href string:${here_url}/history_view">History</a></li> 
    71         <li tal:define="discussion_url here/getDiscussionURL; postCount here/getPostCount"><a href="" i18n:translate="label_discussion" tal:attributes="href discussion_url">Discussion</a><span tal:condition="postCount"> (<span tal:content="postCount" />)</span></li> 
    72         <!--li tal:condition="python:(context.amIOwner() or here.canIModerate()) and here.amIMaterial() and not no_edit_links"><a href="TODO"><tal:block i18n:translate="label_transfer_authorship">Transfer authorship</tal:block>...</a></li--> 
    73         <li metal:define-macro="delete_action" tal:condition="python:is_owner or can_moderate"> 
    74            <a href="" i18n:domain="plone" tal:attributes="href string:${here_url}/delete" class="deleteLinkColor"><tal:block i18n:translate="Delete">Delete</tal:block>...</a> 
    75         </li> 
    76         <li tal:condition="python:can_moderate and context.portal_type in ['ExerciseMaterial','MultimediaMaterial','LeMillReference','Tool','Activity']"> 
    77            <a href="" tal:attributes="href string:${here_url}/manage_convert" class="deleteLinkColor"><tal:block>Convert resource</tal:block>...</a> 
    78         </li> 
    79  
    80     </ul> 
    81 </div> 
    82  
    83 <div class="tb-portlet" metal:define-macro="collections_div" tal:condition="python:colls or not isAnon" tal:define="colls python:context.community.getCollections(obj_uid=context.UID())"> 
    84     <ul> 
    85     <tal:macro metal:define-macro="collection_actions"> 
    86         <li tal:condition="not:isAnon"><a href="" tal:attributes="href string:${here_url}/collection_add"><tal:block i18n:translate="label_add_to_collection">Add to collection</tal:block>...</a></li> 
    87         <li tal:condition="colls"> 
    88             <a href=""  i18n:translate="label_view_collections" 
    89                 tal:attributes="href string:${here_url}/collections_list"> 
    90                 View collections</a>  
    91             <span tal:replace="python:'('+str(len(colls))+')'">(1)</span> 
    92         </li> 
    93     </tal:macro> 
    94         <tal:comment replace="nothing"><li><a i18n:translate="label_read_tips" href="TODO">Read Tips for Use</a></li></tal:comment>         
    95     </ul> 
    96 </div> 
    97  
    98 <tal:macro metal:define-macro="translate_actions" condition="not:here/isDeleted"> 
    99 <tal:translations tal:condition="python: context.meta_type not in ['Piece', 'LeMillReference']"> 
    100 <div class="tb-portlet" tal:condition="python:here.isPublic() or translations" tal:define="translations python:here.getTranslationsOfOriginal(include_original=True)"> 
    101     <ul> 
    102         <li><a href="" tal:attributes="href python: test(isAnon, 'login_form', '%s/translate_resource' % here_url)"><tal:block i18n:translate="label_translate">Translate</tal:block>...</a></li> 
    103         <tal:notAnons condition="translations">  
    104             <tal:trans repeat="rr translations"> 
    105              <tal:defs tal:define="translation_id rr/getId; tlang rr/Language"> 
    106                 <li tal:condition="python:translation_id!=context.id"> 
    107                 <a href="" tal:content="python:here.script_getPrettyLanguage(tlang)" tal:define="translation_url string:${rr/absolute_url}/view" tal:attributes="href translation_url | nothing"></a> 
    108                 </li> 
    109                 <li tal:condition="python:translation_id==context.id" tal:content="python:here.script_getPrettyLanguage(tlang)" /> 
    110              </tal:defs>                   
    111             </tal:trans> 
    112         </tal:notAnons> 
    113         <li tal:condition="context/amIManager"><a href="" tal:attributes="href python:'%s/manage_translations' % here_url">Manage translations</a></li> 
    114  
    115     </ul> 
    116 </div> 
    117 </tal:translations> 
    118 </tal:macro> 
     6        tal:define="d python:here.getPortletDetails(here.REQUEST['URL'], isAnon, member)"> 
    1197 
    1208 
    121 <div class="tb-portlet" metal:define-macro="view_div" tal:condition="python: here.amIMaterial()"> 
    122     <ul> 
    123         <li tal:condition="python: here.meta_type!='PresentationMaterial'"><a i18n:translate="label_student_view" tal:attributes="href string:${here_url}">Student view</a></li> 
    124         <li tal:condition="python: here.meta_type=='PresentationMaterial'"><a i18n:translate="label_student_view" tal:attributes="href string:${here_url}/fullscreen_view">Student view</a></li> 
    125         <li tal:condition="python: here.meta_type=='PresentationMaterial'"> 
    126             <a i18n:translate="label_slideshow" href="" tal:attributes="href string:${here_url}">Slideshow</a> 
    127         </li> 
    128     </ul> 
    129 </div> 
     9<tal:block metal:use-macro="here/portlet_macros/macros/coverImageDiv"/> 
    13010 
     11<tal:block metal:use-macro="here/portlet_macros/macros/editDiv"/> 
    13112 
    132 <tal:comment replace="nothing"> 
    133 <div class="tb-portlet" metal:define-macro="owner_div" tal:condition="python:here.isPublic() and context.lemill_tool.portal_integration and context.meta_type in context.getMaterialTypes()"> 
    134     <ul>        
    135     <li> 
    136     <a href="TODO" i18n:translate="label_publish_in_portal">Publish in portal</a> 
    137     </li> 
    138     </ul> 
    139 </div> 
    140 </tal:comment> 
     13<tal:block metal:use-macro="here/portlet_macros/macros/collectionsDiv"/> 
    14114 
    142 </tal:not_history> 
    143 </tal:visible> 
    144 <tal:deleted condition="here/isDeleted"> 
    145     <div class="tb-portlet" tal:condition="python:context.amIOwner() or here.canIModerate() and not is_History" metal:define-macro="restore_div"> 
    146         <ul> 
    147             <li><a i18n:translate="label_restore_or_undelete" href="" tal:attributes="href string:${here_url}/rescue">Restore deleted</a></li> 
    148             <li tal:condition="context/amIManager"><a i18n:translate="label_move_to_trash" href="" tal:attributes="href string:${here_url}/permaDelete" class="deleteLinkColor">Move to trash</a></li> 
    149         </ul> 
    150     </div> 
    151 </tal:deleted> 
     15<tal:block metal:use-macro="here/portlet_macros/macros/translationsDiv"/> 
     16 
     17<tal:block metal:use-macro="here/portlet_macros/macros/viewsDiv"/> 
     18 
    15219 
    15320</div> 
  • trunk/skins/lemill/portlet_piece_actions.pt

    r2409 r2410  
    44<body> 
    55<div metal:define-macro="portlet" id="portlet-material-actions"  
    6         tal:define="path_end python:here.REQUEST['URL'].split('/')[-1]; 
    7                     is_History python:path_end=='history_view' or here.REQUEST.get('version',0); 
    8                     is_Collection python:path_end=='collections_list' or path_end.startswith('manage_'); 
    9                     is_Translation python:False; 
    10                     is_Discussion python:False; 
    11                     is_owner here/amIOwner; 
    12                     can_moderate here/canIModerate; 
    13                     is_About python:path_end=='about_view';"> 
    14 <tal:visible condition="not:here/isDeleted"> 
    15     <div class="tb-portlet" metal:use-macro="here/portlet_activity_actions/macros/image_div"> 
    16         <tal:block metal:fill-slot="image_edit"></tal:block> 
    17     </div> 
    18  
    19     <tal:history condition="is_History"> 
    20     <div class="tb-portlet" metal:use-macro="here/portlet_material_actions/macros/history_div"/> 
    21     </tal:history> 
    22  
    23     <tal:hide condition="python: not (is_History or is_Collection)"> 
    24  
    25     <div class="tb-portlet" metal:define-macro="edit_div"> 
    26         <ul> 
    27             <li> 
    28                 <a href="" i18n:domain="plone" 
    29                     tal:attributes="href python:test(isAnon, 'login_form',  here_url+'/edit')"><tal:block i18n:translate="label_edit">Edit</tal:block>...</a> 
    30             </li> 
    31             <li><a href="" i18n:translate="label_view_history" tal:attributes="href string:${here_url}/history_view">History</a></li> 
    32             <li tal:condition="python:can_moderate and context.portal_type=='LeMillReference'">    
    33                <a href="" tal:attributes="href string:${here_url}/manage_convert" class="deleteLinkColor"><tal:block>Convert resource</tal:block>...</a> 
    34             </li> 
     6        tal:define="d python:here.getPortletDetails(here.REQUEST['URL'], isAnon, member)"> 
    357 
    368 
    37             <li tal:condition="python:is_owner or can_moderate"> 
    38                <a href="" i18n:domain="plone" tal:attributes="href string:${here_url}/delete" class="deleteLinkColor"><tal:block i18n:translate="Delete">Delete</tal:block>...</a> 
    39             </li> 
    40      
    41         </ul> 
    42     </div> 
     9<tal:block metal:use-macro="here/portlet_macros/macros/coverImageDiv"/> 
    4310 
    44     <div class="tb-portlet" metal:use-macro="here/portlet_material_actions/macros/collections_div"/> 
     11<tal:block metal:use-macro="here/portlet_macros/macros/editDiv"/> 
    4512 
    46     </tal:hide> 
    47 </tal:visible> 
    48 <tal:deleted condition="here/isDeleted"> 
    49     <div class="tb-portlet" metal:use-macro="here/portlet_material_actions/macros/restore_div"/> 
    50 </tal:deleted> 
     13<tal:block metal:use-macro="here/portlet_macros/macros/collectionsDiv"/> 
     14 
    5115</div> 
    5216</body> 
  • trunk/skins/lemill/portlet_tool_actions.pt

    r2409 r2410  
    44<body> 
    55<div metal:define-macro="portlet" id="portlet-material-actions"  
    6         tal:define="path_end python:here.REQUEST['URL'].split('/')[-1]; 
    7                     is_History python:path_end=='history_view' or here.REQUEST.get('version',0); 
    8                     is_Collection python:path_end=='collections_list'; 
    9                     is_Translation python:path_end.endswith('_translations'); 
    10                     is_Discussion python:path_end=='discussion'; 
    11                     is_owner here/amIOwner; 
    12                     can_moderate here/canIModerate; 
    13                     is_About python:path_end=='about_view';"> 
    14 <tal:visible condition="not:here/isDeleted"> 
    15     <div class="tb-portlet" metal:use-macro="here/portlet_activity_actions/macros/image_div"/> 
     6        tal:define="d python:here.getPortletDetails(here.REQUEST['URL'], isAnon, member)"> 
    167 
    17     <tal:history condition="is_History"> 
    18     <div class="tb-portlet" metal:use-macro="here/portlet_material_actions/macros/history_div"/> 
    19     </tal:history> 
    208 
    21     <tal:hide condition="python: not (is_History or is_Collection)"> 
    22     <div class="tb-portlet" metal:use-macro="here/portlet_material_actions/macros/edit_div"/> 
    23     <div class="tb-portlet" metal:use-macro="here/portlet_material_actions/macros/collections_div"/> 
    24      
    25     <div class="tb-portlet" metal:use-macro="here/portlet_material_actions/macros/translate_actions"/> 
     9<tal:block metal:use-macro="here/portlet_macros/macros/coverImageDiv"/> 
    2610 
    27     </tal:hide> 
    28 </tal:visible> 
    29 <tal:deleted condition="here/isDeleted"> 
    30     <div class="tb-portlet" metal:use-macro="here/portlet_material_actions/macros/restore_div"/> 
    31 </tal:deleted> 
     11<tal:block metal:use-macro="here/portlet_macros/macros/editDiv"/> 
     12 
     13<tal:block metal:use-macro="here/portlet_macros/macros/collectionsDiv"/> 
     14 
     15<tal:block metal:use-macro="here/portlet_macros/macros/translationsDiv"/> 
    3216</div> 
    3317</body> 
  • trunk/skins/lemill_tables/main_template.pt

    r2409 r2410  
    111111    <tr> 
    112112        <tal:comment replace="nothing"> Start of the left column </tal:comment> 
    113         <td id="tb-portal-column-one" metal:define-slot="column_one_slot" width="210" valign="top"> 
    114                 <metal:portlets define-slot="portlets_one_slot"> 
    115                     <tal:leftcolumn define="left_slots here/left_slots | nothing"> 
    116                      <tal:block repeat="portlet left_slots">  
     113        <td id="tb-portal-column-one" tal:define="portlet here/getPortletPath | nothing" metal:define-slot="column_one_slot" width="210" valign="top"> 
     114                <metal:portlets tal:condition="portlet" define-slot="portlets_one_slot"> 
    117115                      <metal:portletmacro metal:use-macro="python:path(portlet)" /> 
    118                      </tal:block> 
    119                     </tal:leftcolumn> 
    120116                </metal:portlets> 
    121117                &nbsp; 
  • trunk/version.txt

    r2409 r2410  
    1 2.3 
     12.3.1 
     2 
Note: See TracChangeset for help on using the changeset viewer.