示例#1
0
    def index_ajax(self):
        """Display the OLD Application home page.  This page is generated from
        the entry with name='home' of the table page_table of the model.  This
        page can be edited by administrators.

        """

        response.headers['Content-Type'] = 'application/json'
        result = {}

        # Get the number of Forms in the db
        result['formCount'] = str(h.getFormCount())

        # Get the homepage from the model
        homepage_q = meta.Session.query(model.Page).filter(
            model.Page.name==u'home')
        homepage = homepage_q.first()

        try:
            result['headerText'] = homepage.heading
            result['bodyContent'] = homepage.content
        except AttributeError:
            result['heading'] = u'There is no heading'
            result['content'] = u'There is no content for this page'

        # Perform a series of transformations on the page body content:
        #  1. convert reStructuredText to HTML, 2. link to OLD entities,
        #  3. embed Files and 4. Forms (LAST 3 SHOULD BE DONE CLIENT-SIDE)
        # Convert OLD Markup references to links/representations
        result['bodyContent'] = embedForms(
                                embedFiles(
                                linkToOLDEntitites(
                                h.rst2html(result['bodyContent']))))

        return json.dumps(result)
示例#2
0
    def index(self):
        """Display the OLD Application home page.  This page is generated from
        the entry with name='home' of the table page_table of the model.  This
        page can be edited by administrators.
        
        """
        
        # Get the number of Forms in the db
        c.formCount = str(h.getFormCount())
        
        # Get the homepage from the model
        homepage_q = meta.Session.query(model.Page).filter(
            model.Page.name==u'home')
        homepage = homepage_q.first()

        try:
            c.heading = homepage.heading
            c.content = homepage.content
        except AttributeError:
            c.heading = u'There is no heading'
            c.content = u'There is no content for this page'

        # Convert reStructuredText to HTML
        c.content = h.rst2html(c.content)
        
        # Convert OLD Markup references to links/representations
        c.content = linkToOLDEntitites(c.content)
        c.content = embedFiles(c.content)
        c.content = embedForms(c.content)
        
        return render('/derived/home/index.html')
示例#3
0
 def view(self, id):
     """View an OLD Speaker.  Requires a Speaker ID as input."""
     
     if id is None:
         abort(404)
     speaker_q = meta.Session.query(model.Speaker)
     c.speaker = speaker_q.get(int(id))
     if c.speaker is None:
         abort(404)
     c.speakerPageContent = h.rst2html(c.speaker.speakerPageContent)
     
     # Convert OLD Markup references to links/representations
     c.speakerPageContent = linkToOLDEntitites(c.speakerPageContent)
     c.speakerPageContent = embedFiles(c.speakerPageContent)
     c.speakerPageContent = embedForms(c.speakerPageContent)
     
     return render('/derived/people/speaker/view.html')
示例#4
0
    def view(self, id):
        """View an OLD Researcher.  Requires a Researcher ID as input.
        
        """

        if id is None:
            abort(404)

        researcher_q = meta.Session.query(model.User)
        c.researcher = researcher_q.get(int(id))

        if c.researcher is None:
            abort(404)

        c.personalPageContent = h.rst2html(c.researcher.personalPageContent)

        # Convert OLD Markup references to links/representations
        if c.personalPageContent:
            c.personalPageContent = linkToOLDEntitites(c.personalPageContent)
            c.personalPageContent = embedFiles(c.personalPageContent)
            c.personalPageContent = embedForms(c.personalPageContent)

        return render("/derived/people/researcher/view.html")