コード例 #1
0
    def processForm(self):
        form = self.request.form
        messages = IStatusMessage(self.request)
        if form:
            manager = IUsefulnessSettingsManager(self.context)
            if 'disable_rating' in form:
                manager.disableRating()
                messages.addStatusMessage(
                    _(u'Rating was disabled for this object'))
            elif 'disable_rating_children' in form:
                manager.disableRating(children=True)
                messages.addStatusMessage(
                    _(u'Rating was disabled for this object and its children'))
            elif 'enable_rating' in form:
                manager.enableRating()
                messages.addStatusMessage(
                    _(u'Rating was enabled for this object'))
            elif 'enable_rating_children' in form:
                manager.enableRating(children=True)
                messages.addStatusMessage(
                    _(u'Rating was enabled for this object and its children'))

            self.request.RESPONSE.redirect(self.request.URL)
        else:
            # no form submitted, do nothing
            pass
コード例 #2
0
    def processForm(self):
        form = self.request.form
        messages = IStatusMessage(self.request)
        if form:
            manager = IUsefulnessSettingsManager(self.context)
            if "disable_rating" in form:
                manager.disableRating()
                messages.addStatusMessage(_(u"Rating was disabled for this object"))
            elif "disable_rating_children" in form:
                manager.disableRating(children=True)
                messages.addStatusMessage(_(u"Rating was disabled for this object and its children"))
            elif "enable_rating" in form:
                manager.enableRating()
                messages.addStatusMessage(_(u"Rating was enabled for this object"))
            elif "enable_rating_children" in form:
                manager.enableRating(children=True)
                messages.addStatusMessage(_(u"Rating was enabled for this object and its children"))

            self.request.RESPONSE.redirect(self.request.URL)
        else:
            # no form submitted, do nothing
            pass
コード例 #3
0
 def _isEnabledType(self):
     manager = IUsefulnessSettingsManager(self.context)
     return manager.ratingEnabled()
コード例 #4
0
 def childrenEnabled(self):
     manager = IUsefulnessSettingsManager(self.context)
     return manager.childrenEnabled()
コード例 #5
0
 def childrenEnabled(self):
     manager = IUsefulnessSettingsManager(self.context)
     return manager.childrenEnabled()
コード例 #6
0
 def ratingEnabled(self):
     manager = IUsefulnessSettingsManager(self.context)
     return manager.ratingEnabled()