Changeset 3115 for trunk


Ignore:
Timestamp:
12/03/10 17:44:43 (9 years ago)
Author:
jukka
Message:

Working with pdf collections.

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Collection.py

    r3106 r3115  
    3232from permissions import ModerateContent, MODIFY_CONTENT, ACCESS_CONTENT, VIEW 
    3333from cStringIO import StringIO 
    34 import os, urllib, shutil, sys, zipfile, sre, random 
     34import os, urllib, shutil, sys, zipfile, sre, random, time 
    3535from types import ListType, TupleType 
    3636 
     
    445445        resources = [] 
    446446        for ref in self.getSortedList(reftype): 
     447            print 'ref:', ref 
    447448            target = ref.getTargetObject() 
    448449            if not target: 
     
    686687        result_stringio = StringIO() 
    687688        url= '/'.join((self.absolute_url(), 'collection_pdf')) 
     689        source_text=self.collection_pdf() 
     690        #print source_text 
    688691        pdf = pisa.CreatePDF( 
    689             src=self.collection_pdf(),  
    690             dest=result_stringio,  
     692            src=source_text,  
     693            dest=result_stringio, 
    691694            path=url,  
    692695            xhtml=True,  
     
    694697            link_callback=Callback(url).callback 
    695698            ) 
     699 
    696700        if not pdf.err: 
    697701            response = self.REQUEST.RESPONSE 
  • trunk/LearningResource.py

    r3065 r3115  
    3333visualNoPrint = re.compile('<div class="visualNoPrint">.*?</div>', re.DOTALL | re.IGNORECASE | re.MULTILINE) 
    3434visualClear = re.compile('<div class="visualClear">.*?</div>', re.DOTALL | re.IGNORECASE | re.MULTILINE) 
     35embedContent = re.compile('<div class="embed_content">.*?</div>',re.DOTALL | re.IGNORECASE | re.MULTILINE)  
    3536 
    3637t_license_pattern = re.compile('<p id="license_text_box">.*?</p>', re.MULTILINE | re.DOTALL | re.IGNORECASE) 
     
    395396        text=Resource.prepareForPDF(self) 
    396397        text = re.sub(visualClear, '', text) 
     398        text = re.sub(embedContent, '', text) 
    397399        text = re.sub(visualNoPrint, '', text) 
    398400        text = re.sub(t_license_pattern, '', text) 
  • trunk/Resource.py

    r3087 r3115  
    10421042        """  """         
    10431043        source=self.standalone_view() 
    1044         begin=source.find("material-content")-9 
    1045         end=source.find("material-content-ends")-5 
    1046         return source[begin:end] 
     1044        beginstr="material-content-starts"         
     1045        begin=source.find(beginstr)+len(beginstr) 
     1046        end=source.find("material-content-ends") 
     1047        source= source[begin:end] 
     1048        return source 
    10471049 
    10481050 
  • trunk/skins/lemill/collection_pdf.pt

    r3041 r3115  
    22 <head> 
    33    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> 
    4     <link href="master.css" tal:attributes="href string:${context/absolute_url}/master.css" rel="stylesheet" type="text/css" /> 
    5     <link href="collection_pdf_stylesheet.css" tal:attributes="href string:${context/absolute_url}/collection_pdf_stylesheet.css" rel="stylesheet" type="text/css" /> 
     4    <link href="lemill_grid.css" tal:attributes="href string:${context/portal_url}/lemill_grid.css" rel="stylesheet" type="text/css" /> 
     5    <link href="collection_pdf_stylesheet.css" tal:attributes="href string:${context/portal_url}/collection_pdf_stylesheet.css" rel="stylesheet" type="text/css" /> 
    66 </head> 
    77 <body> 
     
    2424 
    2525  <tal:resource_types repeat="resourceType python:['Content','Methods','Tools']"> 
    26     <tal:resources_list define="resources python:context.getResources(reftype='related%s' % resourceType, private_materials=False, pdf_types=True)"> 
    27     <tal:not_empty condition="resources">     
     26    <tal:resources_list define="resources python:context.getResources(reftype='related%s' % resourceType, private_materials=True, pdf_types=True)"> 
     27    <tal:not_empty condition="python:resources">     
    2828     <h1 style="text-align:center;padding-top:2cm;-pdf-outline-level:0;" i18n:translate="" tal:content="resourceType">resourceType</h1> 
    2929       <tal:show_resource repeat="resource resources"> 
  • trunk/skins/lemill/lemill_grid.css

    r3114 r3115  
    939939/*.defaultSkin a.mceButtonEnabled:hover {border:1px solid #0A246A; background-color:#B2BBD0} */ 
    940940.defaultSkin a.mceButtonActive {border:1px solid #0A246A; background-color:#C2CBE0} 
    941 .defaultSkin .mceButtonDisabled span {opacity:0.3; -ms-filter:alpha(opacity=30); filter:alpha(opacity=30)} 
     941.defaultSkin .mceButtonDisabled span {opacity:0.3; color:#cccccc} 
    942942 
    943943/* Separator */ 
  • trunk/skins/lemill/portlet_macros.pt

    r3071 r3115  
    102102 
    103103<tal:tags_div metal:define-macro="tagsDiv"> 
    104     <div class="portlet grid"> 
     104    <div class="portlet grid" tal:condition="not:d/subView"> 
    105105        <ul> 
    106106           <tal:loopy repeat="tag d/tags"><a href="" tal:attributes="href string:${portal_url}/search?index_type=tags&amp;q=$tag" tal:content="tag" /><span tal:condition="not:repeat/tag/end" tal:omit-tag="">, </span></tal:loopy> 
  • trunk/skins/lemill/standalone_view.pt

    r2873 r3115  
     1 
    12<html xmlns="http://www.w3.org/1999/xhtml" 
    23      xml:lang="en" 
     
    89      i18n:domain="lemill"> 
    910 
    10   <head><title></title> 
    11    <metal:css fill-slot="css_slot"> 
    12     <style type="text/css" media="all">@import url("standalone.css");</style> 
    13    </metal:css> 
    14   </head> 
     11  <head><title></title></head> 
    1512  <body> 
    16      <metal:fill fill-slot="topslot"></metal:fill> 
    17      <metal:fill fill-slot="columns"> 
    18         <div id="material-content"> 
     13     <metal:fill fill-slot="bodyslot"> 
     14        <style type="text/css" media="all">@import url("standalone.css");</style> 
     15        <div id="cover-image"> 
     16         <a href="" tal:attributes="href string:${here_url}/view"><img src="default.png" tal:attributes="src here/getCoverImageURL; alt python:here.meta_type" style="padding: 10px 20px"/></a> 
     17        </div> 
     18 
     19        <div class="main grid"> 
     20        material-content-starts     
    1921         <metal:bodytext metal:use-macro="here/base_view/macros/main" /> 
    20          <div metal:use-macro="here/document_byline/macros/copyright"/> 
    21         </div><!-- material-content-ends --> 
    22     </metal:fill>     
    23     <metal:fill fill-slot="footerslot"></metal:fill> 
     22        material-content-ends 
     23        </div> 
     24    </metal:fill> 
     25    <metal:fill fill-slot="footer"></metal:fill> 
    2426  </body> 
    2527</html> 
     28 
Note: See TracChangeset for help on using the changeset viewer.