Exemple #1
0
    def editsettings(self, id):
        """Edit the logged in researcher's settings.
        
        """

        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)

        # Get the researcher's settings from the pickle file in
        #  files/researchers/username/username.pickle
        c.researcherSettings = h.unpickleResearcherSettings(c.researcher)

        values = {
            "inputOrthography": c.researcherSettings.get("inputOrthography"),
            "outputOrthography": c.researcherSettings.get("outputOrthography"),
            "defaultMetadataFromPreviousForm": c.researcherSettings.get("defaultMetadataFromPreviousForm"),
            "defaultFormView": c.researcherSettings.get("defaultFormView"),
            "guessMorphology": c.researcherSettings.get("guessMorphology"),
            "dateFormat": c.researcherSettings.get("dateFormat"),
        }

        html = render("/derived/people/researcher/editsettings.html")

        return htmlfill.render(html, defaults=values)
Exemple #2
0
    def editsettings(self, id):
        """Edit the logged in researcher's settings.
        
        """

        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)

        # Get the researcher's settings from the pickle file in
        #  files/researchers/username/username.pickle
        c.researcherSettings = h.unpickleResearcherSettings(c.researcher)

        values = {
            'inputOrthography':
            c.researcherSettings.get('inputOrthography'),
            'outputOrthography':
            c.researcherSettings.get('outputOrthography'),
            'defaultMetadataFromPreviousForm':
            c.researcherSettings.get('defaultMetadataFromPreviousForm'),
            'defaultFormView':
            c.researcherSettings.get('defaultFormView'),
            'guessMorphology':
            c.researcherSettings.get('guessMorphology'),
            'dateFormat':
            c.researcherSettings.get('dateFormat')
        }

        html = render('/derived/people/researcher/editsettings.html')

        return htmlfill.render(html, defaults=values)
Exemple #3
0
    def saveuserdisplaysetting(self):
        """Asynchronously saves the user's form add display settings, i.e.,
        whether the narrow or broad phonetic transcription fields will be
        displayed or not.  See the saveUserDisplaySetting JS function in
        functions.js.
        
        """

        value = {"true": True, "false": False}[request.params["value"]]
        setting = request.params["setting"]
        researcher = meta.Session.query(model.User).get(session["user_id"])
        researcherSettings = h.unpickleResearcherSettings(researcher)
        researcherSettings[setting] = value
        h.pickleResearcherSettings(researcherSettings, researcher)
        session["userSettings"] = researcherSettings
        session.save()
Exemple #4
0
    def saveuserdisplaysetting(self):
        """Asynchronously saves the user's form add display settings, i.e.,
        whether the narrow or broad phonetic transcription fields will be
        displayed or not.  See the saveUserDisplaySetting JS function in
        functions.js.
        
        """

        value = {'true': True, 'false': False}[request.params['value']]
        setting = request.params['setting']
        researcher = meta.Session.query(model.User).get(session['user_id'])
        researcherSettings = h.unpickleResearcherSettings(researcher)
        researcherSettings[setting] = value
        h.pickleResearcherSettings(researcherSettings, researcher)
        session['userSettings'] = researcherSettings
        session.save()
Exemple #5
0
    def settings(self, id):
        """View the logged in researcher's settings.
        
        """

        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)

        # Get the researcher's settings from the pickle file in
        #  files/researchers/username/username.pickle
        c.researcherSettings = h.unpickleResearcherSettings(c.researcher)

        return render("/derived/people/researcher/settings.html")
Exemple #6
0
    def settings(self, id):
        """View the logged in researcher's settings.
        
        """

        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)

        # Get the researcher's settings from the pickle file in
        #  files/researchers/username/username.pickle
        c.researcherSettings = h.unpickleResearcherSettings(c.researcher)

        return render('/derived/people/researcher/settings.html')