+ verb = _("edited profile")
+
+ def describe(self, viewer=None):
+ return _("%(user)s edited %(hes_or_your)s %(profile_link)s") % {
+ 'user': self.hyperlink(self.user.get_absolute_url(), self.friendly_username(viewer, self.user)),
+ 'hes_or_your': self.viewer_or_user_verb(viewer, self.user, _('your'), _('his')),
+ 'profile_link': self.hyperlink(self.user.get_absolute_url(), _('profile')),
+ }
+
+class BonusRepAction(ActionProxy):
+ verb = _("gave bonus")
+
+ def process_data(self, value, affected):
+ self._value = value
+ self._affected = affected
+
+
+ def repute_users(self):
+ self.repute(self._affected, self._value)
+
+ if self._value > 0:
+ self._affected.message_set.create(
+ message=_("Congratulations, you have been awarded an extra %s reputation points.") % self._value +
+ '<br />%s' % self.extra.get('message', _('Thank you')))
+ else:
+ messages.info(REQUEST_HOLDER.request, _("You have penalized %s in %s reputation points.") % (self._affected, self._value) +
+ '<br />%s' % self.extra.get('message', ''))
+
+ def describe(self, viewer=None):
+ value = self.extra.get('value', _('unknown'))
+ message = self.extra.get('message', '')
+
+ try:
+ if int(value) > 0:
+ return _("%(user)s awarded an extra %(value)s reputation points to %(users)s: %(message)s") % {
+ 'user': self.hyperlink(self.user.get_absolute_url(), self.friendly_username(viewer, self.user)),
+ 'value': value, 'users':self.affected_links(viewer), 'message': message
+ }
+ else:
+ return _("%(user)s penalised %(users)s in %(value)s reputation points: %(message)s") % {
+ 'user': self.hyperlink(self.user.get_absolute_url(), self.friendly_username(viewer, self.user)),
+ 'value': value, 'users':self.affected_links(viewer), 'message': message
+ }
+ except Exception, e:
+ return ''
+
+class AwardPointsAction(ActionProxy):
+ verb = _("gave reputation points")
+
+ def process_data(self, value, affected):
+ self._value = value
+ self._affected = affected
+
+
+ def repute_users(self):
+ self.repute(self._affected, self._value)
+ self.repute(self.user, -self._value)
+
+ self._affected.message_set.create(
+ message=_("Congratulations, you have been awarded an extra %(points)s reputation %(points_label)s on <a href=\"%(answer_url)s\">this</a> answer.") % {
+ 'points': self._value,
+ 'points_label': ungettext('point', 'points', self._value),
+ 'answer_url': self.node.get_absolute_url()
+ })
+
+ def describe(self, viewer=None):
+ value = self.extra.get('value', _('unknown'))
+
+ try:
+ if int(value) > 0:
+ return _("%(user)s awarded an extra %(value)s reputation points to %(users)s") % {
+ 'user': self.hyperlink(self.user.get_absolute_url(), self.friendly_username(viewer, self.user)),
+ 'value': value, 'users':self.affected_links(viewer),
+ }
+ else:
+ return _("%(user)s penalised %(users)s in %(value)s reputation points") % {
+ 'user': self.hyperlink(self.user.get_absolute_url(), self.friendly_username(viewer, self.user)),
+ 'value': value, 'users':self.affected_links(viewer),
+ }
+ except Exception, e:
+ return ''