def handleSave(self, action):
     data, errors = self.extractData()
     if errors:
         self.status = self.formErrorsMessage
         return
     changes = self.applyChanges(data)
     IStatusMessage(self.request).addStatusMessage(_(u"Changes saved"),
                                                   "info")
     self.context.REQUEST.RESPONSE.redirect("@@sla-settings")
    def __call__(self, value, instance, *args, **kwargs):
        acl_users = getToolByName(instance, 'acl_users')
        
        invalid_groups = []
        for group in value:
            if not acl_users.getGroupById(group) and not acl_users.getGroupByName(group):
                invalid_groups.append(group)

        if invalid_groups:
            if len(invalid_groups) == 1:
                msg = _('invalid_group_error_msg',
                        default=u"The ${group} group doesn't exist",
                        mapping={'group': invalid_groups[0]})
            else:
                msg = _('invalid_groups_error_msg',
                        default=u"The following groups don't exist: ${groups}",
                        mapping={'groups': ', '.join(invalid_groups)})
            return recursiveTranslate(msg, **kwargs)
        else:
            return True
 def handleCancel(self, action):
     IStatusMessage(self.request).addStatusMessage(_(u"Edit cancelled"),
                                                   "info")
     self.request.response.redirect("%s/%s" % (self.context.absolute_url(),
                                               self.control_panel_view))
from Products.ATContentTypes.configuration import zconf
from Products.ATContentTypes.content import folder
from Products.ATContentTypes.content import schemata

from ospfe.percorso_sla.interfaces import ISLAPatient
from ospfe.percorso_sla.config import PROJECTNAME
from ospfe.percorso_sla.validator import ValidGroupsValidator
from ospfe.percorso_sla import percorso_slaMessageFactory as _


SLAPatientSchema = folder.ATFolderSchema.copy() + atapi.Schema((

    atapi.DateTimeField('birthday',
          required=False,
          widget=atapi.CalendarWidget(
                    description=_(u'help_birthday',
                                    default=u'Insert the birthday of this patient.'),
                    label=_(u'label_birthday', default=u'Patient birthday'),
                    starting_year=1930,
                    future_years=0,
                    show_hm=False)
    ),

    atapi.StringField('patientGender',
          required=True,
          vocabulary=[("M", "M"), ("F", "F")],
          widget=atapi.SelectionWidget(
                    label=_(u'label_patientgender', default=u'Patient gender'),
                    )
    ),

    atapi.DateTimeField('diseaseAppearance',