Changeset 3010 for trunk


Ignore:
Timestamp:
04/05/10 02:08:42 (10 years ago)
Author:
jukka
Message:

PILOTs can now be embedded. Unified to use same portlet macro as embedding collections.

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Collection.py

    r2970 r3010  
    262262        else: 
    263263            return 'refsToResources' 
     264 
     265 
     266    def getEmbedCode(self): 
     267        """ Builds a nice embed code """ 
     268        return '<iframe src="%s/collection_clean_view" width="100%" height="550px" scrolling="auto" frameborder="1"></iframe>' % self.absolute_url() 
     269 
    264270         
    265271    security.declareProtected(MODIFY_CONTENT, 'add') 
  • trunk/CommonMixIn.py

    r2998 r3010  
    112112 
    113113    def isBranchable(self): 
     114        return False 
     115     
     116    def isEmbeddable(self): 
    114117        return False 
    115118 
     
    532535            'hasViews':False, 
    533536            'studentViewLink':'', 
    534             'slideShowLink':''} 
     537            'slideShowLink':'', 
     538            'embedCode':''} 
    535539         
    536540        ################ Mandatory flags     
     
    633637             
    634638        v['showTranslations'] = showTranslations = (isMaterial or self.portal_type in ACTIVITY_TYPES+TOOLS_TYPES) and self.portal_type!='PresentationMaterial' # This is getting ugly 
     639        if self.isEmbeddable(): 
     640            v['embedCode']=self.getEmbedCode()             
    635641        if not showTranslations: 
    636642            return v # rest of the variables are useful only for translatable types, others can leave now 
  • trunk/PILOTMaterial.py

    r3002 r3010  
    102102    def manage_afterAdd(self, item, container): 
    103103        Material.manage_afterAdd(self, item, container) 
     104     
     105    def isEmbeddable(self): 
     106        """ PILOTs are embeddable """ 
     107        return True 
    104108 
    105109    def getOnlyText(self): 
     
    137141        else: 
    138142            return ['']*7 
     143 
     144 
     145    def getEmbedCode(self): 
     146        """ Builds a nice embed code """ 
     147        portal_url=getToolByName(self, 'portal_url') 
     148        return """<embed src="%s/player.swf" loop="false" quality="high" bgcolor="#000000" width="500" height="400" name="player" align="middle" allowScriptAccess="sameDomain" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="xml=%s/buildXML" />""" % (portal_url(), self.absolute_url()) 
    139149 
    140150    def buildXML(self, only_validate=False): 
     
    232242                    has_title=0                    
    233243                for x in tkw: 
    234                     if len(x)>maxlength: 
    235                         x=kw_cutter(x,maxlength) 
    236244                    newlist.append((x, i*cliplen+1, (i+1)*cliplen-2)) 
    237245                    i=i+1 
     
    256264            print msg 
    257265            lt = getToolByName(self, 'lemill_tool') 
    258             lt.addPortalMessage('Building flash file for PILOT failed. ') 
     266            lt.addPortalMessage(_('Building flash file for PILOT failed. ')) 
    259267            return '' 
    260268 
  • trunk/skins/lemill/portlet_collection_actions.pt

    r2854 r3010  
    3838</div> 
    3939 
    40 <div class="tb-portlet"> 
    41     <ul style="list-style:none"> 
    42         <li> 
    43             <div i18n:translate="embed_to_your_blog">Embed to your blog</div> 
    44             <input id="embed_code" type="text" tal:attributes="value string:&lt;iframe src=&quot;${here_url}/collection_clean_view&quot; width=&quot;100%&quot; height=&quot;550px&quot; scrolling=&quot;auto&quot; frameborder=&quot;1&quot;&gt;&lt;/iframe&gt;" onclick="javascript:document.getElementById('embed_code').focus();document.getElementById('embed_code').select();"/> 
    45         </li> 
    46     </ul> 
    47 </div> 
     40<tal:embed tal:define="d python:{'embedCode':here.getEmbedCode()}"> 
     41    <div metal:use-macro="here/portlet_macros/macros/embedDiv" /> 
     42</tal:embed> 
    4843 
    4944</div> 
  • trunk/skins/lemill/portlet_macros.pt

    r2999 r3010  
    170170</tal:views_div> 
    171171 
     172Used by: PILOTs 
     173Uses: embedCode 
     174 
     175<tal:embed_div metal:define-macro="embedDiv"> 
     176<div class="tb-portlet" tal:condition="d/embedCode"> 
     177    <ul style="list-style:none"> 
     178        <li> 
     179            <div i18n:translate="embed_to_your_blog">Embed to your blog</div> 
     180            <input id="embed_code" type="text" tal:attributes="value d/embedCode" onclick="javascript:document.getElementById('embed_code').focus();document.getElementById('embed_code').select();"/> 
     181        </li> 
     182    </ul> 
     183</div> 
     184</tal:embed_div> 
     185 
    172186Materials: 
    173187hasViews, studentViewLink, slideShowLink 
     
    178192showCollections, lenCollections 
    179193mainView, editLink, hasAbout, discussionLink, lenDiscussion, canConvert, aboutView, versionView 
    180 subView, canChangeCoverImage, canRetract, canPublish, canUndelete, canManage 
     194subView, canChangeCoverImage, canRetract, canPublish, canUndelete, canManage, embedCode 
    181195 
    182196 
  • trunk/skins/lemill/portlet_material_actions.pt

    r2566 r3010  
    1919<tal:block metal:use-macro="here/portlet_macros/macros/viewsDiv"/> 
    2020 
     21<tal:block metal:use-macro="here/portlet_macros/macros/embedDiv"/> 
    2122 
    2223</div> 
Note: See TracChangeset for help on using the changeset viewer.