Ignore:
Timestamp:
25 Mar 2022, 12:12:29 (3 years ago)
Author:
Henrik Bettermann
Message:

Allow students to view transcripts but with different watermark.

Location:
main/waeup.uniben/trunk/src/waeup/uniben/browser
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.uniben/trunk/src/waeup/uniben/browser/pdf.py

    r15425 r16906  
    2828    """
    2929
    30     header_logo_path = os.path.join(
    31         os.path.dirname(__file__), 'static', 'pdf_logo.jpg')
    32     watermark_path = os.path.join(
    33         os.path.dirname(__file__), 'static', 'pdf_watermark.jpg')
    34 
    3530    watermark_pos = [-25, 100]
    3631    logo_pos = [507, 720, 40]
    3732
     33    header_logo_path = os.path.join(
     34        os.path.dirname(__file__), 'static', 'pdf_logo.jpg')
     35
     36    @property
     37    def watermark_path(self):
     38        if self.view and self.view.__name__ == 'transcript.pdf':
     39            usertype = getattr(self.view.request.principal, 'user_type', None)
     40            if usertype and usertype == 'student':
     41                self.watermark_pos = [95, 190]
     42                return os.path.join(
     43                    os.path.dirname(__file__), 'static', 'pdf_stud_only.jpg')
     44        return os.path.join(
     45            os.path.dirname(__file__), 'static', 'pdf_watermark.jpg')
    3846
    3947class CustomLandscapePDFCreator(LandscapePDFCreator):
Note: See TracChangeset for help on using the changeset viewer.