Example #1
0
    def verify(self, container, context):
        flash = IStatusMessage(self.request).addStatusMessage

        if (hasattr(aq_base(container), "published")
                and container.published == context.id):
            flash(
                _(
                    "message_no_delete_published_survey",
                    default="You cannot delete an OiRA Tool version that is "
                    "published. Please unpublish it first.",
                ),
                "error",
            )
            self.request.response.redirect(context.absolute_url())
            return False

        count = 0
        for survey in container.values():
            if ISurvey.providedBy(survey):
                count += 1

        if count > 1:
            return True
        else:
            flash(
                _(
                    "message_delete_no_last_survey",
                    default="This is the only version of the OiRA Tool and can "
                    "therefore not be deleted. Did you perhaps want to "
                    "remove the OiRA Tool itself?",
                ),
                "error",
            )
            self.request.response.redirect(context.absolute_url())
            return False
Example #2
0
    def handleUpload(self, action):
        (data, errors) = self.extractData()
        input = data["file"].data
        importer = self.importer_factory(self.context)
        try:
            survey = importer(
                input,
                data["surveygroup_title"],
                data["survey_title"],
                data["is_etranslate_compatible"],
            )
        except lxml.etree.XMLSyntaxError:
            raise WidgetActionExecutionError(
                "file",
                Invalid(
                    _("error_invalid_xml",
                      default="Please upload a valid XML file")),
            )

        IStatusMessage(self.request).addStatusMessage(
            _("upload_success", default="Succesfully imported the OiRA Tool"),
            type="success",
        )
        state = getMultiAdapter((survey, self.request),
                                name="plone_context_state")
        self.request.response.redirect(state.view_url())
Example #3
0
 def get_section_headings(self):
     headings = [
         self.t(
             _(
                 "header_present_risks",
                 default="Risks that have been identified, "
                 "evaluated and have an Action Plan",
             )),
         self.t(
             _(
                 "header_unevaluated_risks",
                 default="Risks that have been identified but "
                 "do NOT have an Action Plan",
             )),
         self.t(
             _(
                 "header_unanswered_risks",
                 default='Hazards/problems that have been "parked" '
                 "and are still to be dealt with",
             )),
         self.t(
             _(
                 "header_risks_not_present",
                 default="Hazards/problems that have been managed "
                 "or are not present in your organisation",
             )),
     ]
     return headings
Example #4
0
 def update(self):
     super(OiRASiteRootTabsTile, self).update()
     is_country = self.get_current_country() == self.context
     is_sector = self.get_current_sector() == self.context
     for r in self.tabs:
         if r.get("id") == "help":
             self.tabs.remove(r)
         elif r.get("id") == "usermgmt":
             r["title"] = _("nav_sectormanagement",
                            default="Sector management")
     if self.is_country_manager() and (is_sector or is_country):
         if is_sector:
             title = _("nav_ldapmanagement_sector",
                       default="Manage sector access")
         else:
             title = _("nav_ldapmanagement_country",
                       default="Manage country access")
         custom_tab = {
             "id":
             "ldapmgmt",
             "title":
             title,
             "url":
             "%s/@@manage-ldap-users" % self.context.absolute_url(),
             "class":
             "current" if self.get_current_url() == "ldapmgmt" else
             None,  # noqa: E501
         }
         self.tabs.insert(2, custom_tab)
Example #5
0
    def organise(self):
        menu = super(Sitemenu, self).organise()
        if menu is not None:
            children = menu["children"]
        else:
            menu = {"title": nu_("menu_organise", default="Organise")}
            children = menu["children"] = []

        context_url = aq_inner(self.context).absolute_url()
        if ISurvey.providedBy(self.context) and checkPermission(
                self.context, "View"):
            children.append({
                "title": _("menu_export", default="XML export"),
                "url": "%s/@@export" % context_url,
            })
        if ISector.providedBy(self.context) and checkPermission(
                self.context, "Euphorie: Add new RIE Content"):
            children.append({
                "title":
                _("menu_import", default="Import OiRA Tool"),
                "url":
                "%s/@@upload" % context_url,
            })
        if children:
            return menu
        else:
            return None
Example #6
0
    def __call__(self):
        if self.request.method != "POST":
            raise Unauthorized
        authenticator = getMultiAdapter(
            (self.context, self.request), name="authenticator"
        )
        if not authenticator.verify():
            raise Unauthorized

        self.context.locked = locked = self.request.form.get("action", "lock") == "lock"
        if locked:
            api.portal.show_message(
                _(
                    "message_user_locked",
                    default='Account "${title}" has been locked.',
                    mapping=dict(title=self.context.title),
                ),
                self.request,
                "success",
            )
        else:
            api.portal.show_message(
                _(
                    "message_user_unlocked",
                    default='Account "${title}" has been unlocked.',
                    mapping=dict(title=self.context.title),
                ),
                self.request,
                "success",
            )

        country = aq_parent(aq_inner(self.context))
        self.request.response.redirect("%s/@@manage-users" % country.absolute_url())
Example #7
0
class ITrainingQuestion(model.Schema):
    """A simple schema that adds three answer fields to the content type"""

    title = schema.Text(title=_("Question"))
    right_answer = schema.Text(title=_("Right answer"))
    wrong_answer_1 = schema.Text(title=_("First wrong answer"))
    wrong_answer_2 = schema.Text(title=_("Second wrong answer"))
Example #8
0
 def label(self):
     if self.context.aq_parent.portal_type == 'euphorie.module':
         type_name = _('Submodule')
     else:
         portal_type = self.context.portal_type
         fti = getUtility(IDexterityFTI, name=portal_type)
         type_name = fti.Title()
     return _(u"Edit ${name}", mapping={'name': type_name})
Example #9
0
 def label(self):
     if self.context.portal_type == 'euphorie.module':
         type_name = _('Submodule')
     else:
         portal_type = self.portal_type
         fti = getUtility(IDexterityFTI, name=portal_type)
         type_name = fti.Title()
     return _(u"Add %s" % type_name)
Example #10
0
 def label(self):
     if self.context.aq_parent.portal_type == "euphorie.module":
         type_name = _("Submodule")
     else:
         portal_type = self.context.portal_type
         fti = getUtility(IDexterityFTI, name=portal_type)
         type_name = fti.Title()
     return _("Edit ${name}", mapping={"name": type_name})
Example #11
0
 def label(self):
     if self.context.portal_type == "euphorie.module":
         type_name = _("Submodule")
     else:
         portal_type = self.portal_type
         fti = getUtility(IDexterityFTI, name=portal_type)
         type_name = fti.Title()
     return _("Add %s" % type_name)
Example #12
0
class IRichDescription(form.Schema):
    """Simple behaviour for content types with a HTML description.
    Replaces the standard description field with a rich text version.
    """
    description = schema.Text(
        title=_(u"Summary"),
        description=_(u'A short summary of the content.'),
        required=False)
    form.widget(description=WysiwygFieldWidget)
    form.order_after(description="title")
Example #13
0
class INameFromUniqueId(Interface):
    """Marker interface for objects which should get a unique id.

    Objects with this interface automatically get a unique id when they are
    added to an container (as long as INameChooser is used). Ids are unique
    within the context of IIdGenerationRoot.
    """

    id = schema.TextLine(
        title=_("Identifier"),
        description=_("This is a unique identifier for this object."),
        required=True,
    )
Example #14
0
    def add_report_section(self, nodes, heading, **extra):
        doc = self.template
        doc.add_paragraph(heading, style="Heading 1")

        for node in nodes:
            title = "[{0}] {1}".format(
                translate(_(node.typus), target_language=self.lang),
                node.title)
            number = node.number

            doc.add_paragraph("%s %s" % (number, title),
                              style="Heading %d" % (node.depth + 1))

            if node.typus == "Risk":
                doc.add_paragraph(
                    "[%s] %s" % (
                        translate(
                            _(
                                "label_problem_description",
                                default="Negative statement",
                            ),
                            target_language=self.lang,
                        ),
                        node.problem_description,
                    ),
                    style="Measure Heading",
                )

            description = node.description

            doc = HtmlToWord(_sanitize_html(description or ""), doc)

            if node.typus != "Risk":
                continue

            if not extra.get("skip_legal_references", False):
                legal_reference = getattr(node, "legal_reference", None)
                if legal_reference and legal_reference.strip():
                    doc.add_paragraph()
                    legal_heading = translate(
                        _(
                            "header_legal_references",
                            default="Legal and policy references",
                        ),
                        target_language=self.lang,
                    )
                    doc.add_paragraph(legal_heading, style="Legal Heading")
                    doc = HtmlToWord(_sanitize_html(legal_reference), doc)
Example #15
0
    def verify(self, container, context):
        flash = IStatusMessage(self.request).addStatusMessage
        surveygroup = context
        sector = container
        country = aq_parent(sector)
        client = getPortal(container).client

        if country.id not in client:
            return True

        cl_country = client[country.id]
        if sector.id not in cl_country:
            return True

        cl_sector = cl_country[sector.id]
        if surveygroup.id not in cl_sector:
            return True

        surveys = [s for s in cl_sector[surveygroup.id].values() if s.id != 'preview']
        if surveys:
            flash(
                _("message_not_delete_published_surveygroup",
                default=u"You can not delete an OiRA tool that has been published."),
                "error"
                )
            self.request.response.redirect(context.absolute_url())
            return False
        return True
Example #16
0
 def portal_type(self):
     if self.context.aq_parent.portal_type == "euphorie.module":
         return _("Submodule")
     else:
         portal_type = self.context.portal_type
         fti = getUtility(IDexterityFTI, name=portal_type)
         return fti.Title()
Example #17
0
class PasswordReset(pwreminder.PasswordReset):
    grok.context(ISiteRoot)
    grok.name("reset-password")
    grok.require("zope2.Public")
    grok.layer(IOSHAContentSkinLayer)

    orig_description = pwreminder.PasswordReset.description
    extra_description = _(
        u"password_policy_conditions",
        default=u"Your password must contain at least 5 characters, "
        u"including at least one capital letter, one number and "
        u"one special character (e.g. $, # or @).")

    def __init__(self, context, request):
        self.context = context
        self.request = request
        self.language = getToolByName(
            context, 'portal_languages').getPreferredLanguage()

    @property
    def description(self):
        description = u" ".join([
            translate(self.orig_description, target_language=self.language),
            translate(self.extra_description, target_language=self.language)
        ])
        return description
Example #18
0
    def verify(self, container, context):
        if not checkPermission(container, "Delete objects"):
            raise zExceptions.Unauthorized

        flash = IStatusMessage(self.request).addStatusMessage
        sector = context
        country = container
        client = getPortal(container).client

        if country.id not in client:
            return True

        cl_country = client[country.id]
        if sector.id not in cl_country:
            return True

        # Look for any published surveys in the client sector, and prevent
        # deletion if any are found
        cl_sector = cl_country[sector.id]
        surveys = [s for s in cl_sector.values() if s.id != "preview"]
        if surveys:
            flash(
                _(
                    "message_not_delete_published_sector",
                    default=
                    "You can not delete a sector that contains published "
                    "OiRA Tools.",
                ),
                "error",
            )
            self.request.response.redirect(context.absolute_url())
            return False
        return True
Example #19
0
 def testPasswordPolicy(self):
     err_msg = _(u"password_policy_conditions")
     regtool = api.portal.get_tool('portal_registration')
     self.assertEqual(regtool.pasValidation('password', 'secret'), err_msg)
     self.assertEqual(regtool.pasValidation('password', 'Secret'), err_msg)
     self.assertEqual(regtool.pasValidation('password', 'Secret1'), err_msg)
     self.assertIsNone(regtool.pasValidation('password', 'Secret1!'))
Example #20
0
    def createAndAdd(self, data):
        obj = super(AddForm, self).createAndAdd(data)
        obj = aq_inner(self.context)[obj.id]

        form = self.request.form
        if form["source"] != "scratch":
            sector = aq_inner(self.context)
            if form["source"] == "other":
                country_id = form["country"]
                country = aq_parent(aq_parent(sector))[country_id]
                bits = form["sector.%s" % country_id].split(".", 1)
                sector = country[bits[0]]
                surveygroup = sector[bits[1]]
                survey_id = form["survey.%s.%s" % (country_id, surveygroup.id)]
                survey = surveygroup[survey_id]
            else:
                sg_local = form["surveygroup.local"]
                surveygroup = sector[sg_local]
                survey = surveygroup[form["survey.local.%s" % sg_local]]

            survey = self.copyTemplate(survey, obj)
            self.immediate_view = survey.absolute_url()
        else:
            title = api.portal.translate(_("survey_default_title", default="Standard"))

            obj = aq_inner(self.context)[obj.id]
            survey = createContentInContainer(obj, "euphorie.survey", title=title)

            self.immediate_view = survey.absolute_url()
        return obj
Example #21
0
class IOSHASector(form.Schema):
    """ """
    statistics_level = schema.Choice(
        title=_("label_statistics_level", default=u"Statistics Level"),
        description=_(
            "help_statistics_level",
            default=u"Level 1: Basic statistics about the use of the OiRA "
            u"tool. Level 2: More detailed statistics regarding "
            u"the risks"),
        required=True,
        vocabulary=SimpleVocabulary([
            SimpleTerm(1, title=u"1"),
            SimpleTerm(2, title=u"2"),
        ]),
        default=1,
    )
Example #22
0
    def __call__(self):
        if self.request.method != "POST":
            raise NotFound(self, "library-insert", self.request)
        path = self.request.form.get("path")
        if not path:
            raise NotFound(self, "library-insert",
                           self.request)  # XXX Wrong exception type
        target = aq_inner(self.context)
        app = target.getPhysicalRoot()
        source = app.restrictedTraverse(path)
        if not is_allowed(target, source):
            raise NotFound(self, "library-insert",
                           self.request)  # XXX Wrong exception type
        copy = source._getCopy(target)
        assign_ids(target, copy)
        notify(ObjectCopiedEvent(copy, source))
        target._setObject(copy.id, copy)
        copy = target[copy.id]
        copy._postCopy(target, op=0)
        notify(ObjectClonedEvent(copy))

        api.portal.show_message(
            _(
                'Added a copy of "${title}" to your OiRA tool.',
                mapping={"title": copy.title},
            ),
            request=self.request,
            type="success",
        )
        self.request.RESPONSE.redirect(copy.absolute_url())
Example #23
0
 def portal_type(self):
     if self.context.aq_parent.portal_type == 'euphorie.module':
         return _('Submodule')
     else:
         portal_type = self.context.portal_type
         fti = getUtility(IDexterityFTI, name=portal_type)
         return fti.Title()
Example #24
0
    def verify(self, container, context):
        surveygroup = context
        sector = container
        country = aq_parent(sector)
        client = api.portal.get().client

        if country.id not in client:
            return True

        cl_country = client[country.id]
        if sector.id not in cl_country:
            return True

        cl_sector = cl_country[sector.id]
        if surveygroup.id not in cl_sector:
            return True

        surveys = [s for s in cl_sector[surveygroup.id].values() if s.id != "preview"]
        if surveys:
            api.portal.show_message(
                _(
                    "message_not_delete_published_surveygroup",
                    default="You can not delete an OiRA tool that has been published.",
                ),
                self.request,
                "error",
            )
            self.request.response.redirect(context.absolute_url())
            return False
        return True
Example #25
0
 def testPasswordPolicy(self):
     err_msg = _(u"password_policy_conditions")
     regtool = api.portal.get_tool('portal_registration')
     self.assertEqual(regtool.pasValidation('password', 'secret'), err_msg)
     self.assertEqual(regtool.pasValidation('password', 'Secret'), err_msg)
     self.assertEqual(regtool.pasValidation('password', 'Secret1'), err_msg)
     self.assertIsNone(regtool.pasValidation('password', 'Secret1!'))
Example #26
0
class IToolCategory(model.Schema):

    tool_category = schema.List(
        title=_("title_tool_category", default="Tool category"),
        description=_(
            "description_tool_category",
            default="Select one or more categories to which this OiRA tool "
            "is relevant. The user will then find this tool under the chosen"
            " categories.",
        ),
        required=False,
        value_type=schema.Choice(
            source=RegistryValueVocabulary(
                "euphorie.content.vocabularies.toolcategories",
            ),
        ),
    )
Example #27
0
 def _filename(self):
     """Return the document filename"""
     filename = _(
         "filename_tool_contents",
         default="Contents of OIRA tool ${title}",
         mapping=dict(title=self.context.title),
     )
     return "{}.docx".format(translate(filename, context=self.request))
Example #28
0
 def get_heading(self, title):
     heading = self.t(
         _(
             "header_oira_report_download",
             default="OiRA Report: “${title}”",
             mapping=dict(title=title),
         ), )
     return heading
Example #29
0
 def _filename(self):
     """Return the document filename"""
     filename = _(
         "filename_report_identification",
         default="Identification report ${title}",
         mapping=dict(title=self.context.session.title),
     )
     filename = translate(filename, context=self.request)
     return safe_nativestring(filename) + ".docx"
Example #30
0
 def _filename(self):
     """Return the document filename"""
     filename = _(
         "filename_report_actionplan",
         default="Action plan ${title}",
         mapping={"title": self.context.session.title},
     )
     filename = translate(filename, context=self.request)
     return safe_nativestring(filename) + ".docx"
Example #31
0
    def update(self):
        current = self.get_current_url()
        self.tabs = [{
            "id": "sectors",
            "title": _("nav_surveys", default="OiRA Tools"),
            "url": self.portal.sectors.absolute_url(),
            "class": "current" if current == "sectors" else None,
        }]
        is_country_manager = self.is_country_manager()
        country = self.get_current_country()
        country_url = country and country.absolute_url() or ""
        if is_country_manager:
            self.tabs.append({
                "id":
                "usermgmt",
                "title":
                _("nav_usermanagement", default="User management"),
                "url":
                "%s/@@manage-users" % country_url,
                "class":
                "current" if current == "usermgmt" else None,
            })

        if api.user.has_permission("Manage portal"):
            self.tabs.append({
                "id":
                "documents",
                "title":
                _("nav_documents", default="Documents"),
                "url":
                self.portal.documents.absolute_url(),
                "class":
                "current" if current == "documents" else None,
            })

        if country:
            self.tabs.append({
                "id": "help",
                "title": _("nav_help", default="Help"),
                "url": "%s/help" % country_url,
                "class": "current" if current == "help" else None,
            })

        self.home_url = self.portal.absolute_url()
Example #32
0
 def testPasswordPolicy(self):
     err_msg = _(
         "password_policy_conditions",
         default="Your password must contain at least 5 characters, "
         "including at least one capital letter, one number and "
         "one special character (e.g. $, # or @).",
     )
     regtool = api.portal.get_tool("portal_registration")
     self.assertEqual(regtool.pasValidation("password", "secret"), err_msg)
     self.assertEqual(regtool.pasValidation("password", "Secret"), err_msg)
     self.assertEqual(regtool.pasValidation("password", "Secret1"), err_msg)
     self.assertIsNone(regtool.pasValidation("password", "Secret1!"))
Example #33
0
 def update(self):
     actions = getFactoriesInContext(self.context)
     if IModule.providedBy(self.context):
         for (i, action) in enumerate(actions):
             # To be able to determine what button label to display, we
             # explicitly set the action.id to the fake "euphorie.submodule"
             if action.id == "euphorie.module":
                 actions[i] = FactoryInfo("euphorie.submodule",
                         _(u"Submodule"), *action[2:])
                 break
     self.actions = sorted(actions, key=lambda x: x.title)
     self.can_edit = checkPermission(self.context, "Modify portal content")
Example #34
0
class IImportSurvey(Interface):
    """The fields used for importing a :obj:`euphorie.content.survey`."""

    surveygroup_title = schema.TextLine(
        title=_("label_surveygroup_title",
                default="Title of imported OiRA Tool"),
        description=_(
            "help_upload_surveygroup_title",
            default="If you do not specify a title it will be taken "
            "from the input.",
        ),
        required=False,
    )

    survey_title = schema.TextLine(
        title=_("label_upload_survey_title",
                default="Name for OiRA Tool version"),
        default=_("OiRA Tool import"),
        required=True,
    )

    file = filefield.NamedFile(title=_("label_upload_filename",
                                       default="XML file"),
                               required=True)

    is_etranslate_compatible = schema.Bool(
        title=_(
            "label_is_etranslate_compatible",
            default="Import XML translation from eTranslate",
        ),
        required=False,
        default=False,
    )
Example #35
0
    def handleChange(self, action):
        """Override the default behavior to call the requestPassword method
        passing the username and not the id
        """
        data, errors = self.extractData()
        if errors:
            self.status = self.formErrorsMessage
            return

        flash = IStatusMessage(self.request).addStatusMessage
        pas = getToolByName(self.context, "acl_users")
        ppr = getToolByName(self.context, "portal_password_reset")
        user = pas.getUser(data["login"])
        if user is None:
            flash(
                __(
                    "user_name_wrong",
                    "The login name you have provided does not match the username from the password-reset email. Please check your spelling.",  # noqa: E501
                ),
                "error",
            )
            return
        # osha Patch: we need to translate the reset request
        # because we use the username and not the id
        record = ppr._requests.get(self.randomstring, ())
        if record and record[0] == user.getUserId():
            ppr._requests[self.randomstring] = (
                user.getUserName(),
                record[1],
            )
        try:
            ppr.resetPassword(
                # The osha patch is taking the username instead of the id
                # original code was:
                # user.getId(), self.randomstring, data["password"]
                user.getUserName(),
                self.randomstring,
                data["password"],
            )
        except InvalidRequestError:
            flash(
                __(
                    "user_name_wrong",
                    "The login name you have provided does not match the username from the password-reset email. Please check your spelling.",  # noqa: E501
                ),
                "error",
            )
            return

        flash(_("password_reset", "Your password has been reset."), "success")
        portal_url = aq_inner(self.context).absolute_url()
        self.request.response.redirect("%s/@@login" % portal_url)
Example #36
0
    def organise(self):
        menu = super(EuphorieSitemenu, self).organise()
        if menu is not None:
            children = menu["children"]
        else:
            menu = {"title": nu_("menu_organise", default=u"Organise")}
            children = menu["children"] = []

        context_url = aq_inner(self.context).absolute_url()
        if ISurvey.providedBy(self.context) and \
                checkPermission(self.context, "View"):
            children.append({"title": _("menu_export", default=u"XML export"),
                             "url": "%s/@@export" % context_url})
        if ISector.providedBy(self.context) and \
                checkPermission(self.context, "Euphorie: Add new RIE Content"):
            children.append(
                    {"title": _("menu_import", default=u"Import OiRA Tool"),
                     "url": "%s/@@upload" % context_url})
        if children:
            return menu
        else:
            return None
Example #37
0
    def validateUserInfo(self, user, set_id, set_info ):
        """ See IValidationPlugin. Used to validate password property
        """
        if IClientSkinLayer.providedBy(globalrequest.getRequest()):
            # We don't enforce the custom password policy for client users
            return super(EuphoriePasswordPolicy, self).validateUserInfo(
                    user, set_id, set_info)

        if not set_info:
            return []
        password = set_info.get('password', None)
        if password is None:
            return []

        failed = False
        if len(password) < 5:
            failed = True
        elif len([l for l in password if l.isupper()]) == 0:
            # Must have capital letter(s)
            failed = True
        elif not re.search("[1-9]", password):
            # Must have numbers(s)
            failed = True
        elif not re.search("[^a-zA-Z1-9]", password):
            # Must have special chars (i.e. not alphanumerical)
            failed = True

        if failed:
            return [{'id': 'password', 'error': _(
                u"password_policy_conditions",
                default=u"Your password must contain at least 5 characters, "
                u"including at least one capital letter, one number and "
                u"one special character (e.g. $, # or @)."
            )}]
        else:
            return []
Example #38
0
# Dont import this file, it's just for our i18n toolchain

from euphorie.content import MessageFactory as _

# euphorie/client/templates/account-settings.pt
_("header_account_data", default=u"Account data")
_("Email address/account name")
_("Change email address")
_("Delete Account")
_("Please bear in mind that by changing the email address, your login name will also change.")
_("header_password", default=u"Password")


# Copied from euphorie/client/templates/risk_actionplan.pt
# Currently, those modal dialogs are not implemented in oiranew
_(u"Are you sure you want to delete this measure? This action can not be reverted.",
    default=u"Are you sure you want to delete this measure? This action can not be reverted.")
_(u"The current text in the fields 'Action plan', 'Prevention plan' and 'Requirements' of this measure will be overwritten. This action cannot be reverted. Are you sure you want to continue?",
    default=u"The current text in the fields 'Action plan', 'Prevention plan' and 'Requirements' of this measure will be overwritten. This action cannot be reverted. Are you sure you want to continue?")
_(u"Standard solutions")

# More copied translations from euphorie
_(u"help_evaluation_optional", default=u"This option allows users to skip the evaluation phase.")
_(u"label_evaluation_phase", default=u"Evaluation phase")
_(u"Description", default=u"Description")
_(u"evalmethod_fixed", default=u"Skip evaluation")
_(u"label_fixed_priority", default=u"priority")
# _(u"message_lock_warn", default=u"Please be aware that you have %s more login attempts before your account will be locked.")

# Validation error messages
_("error_validation_date", default=u"This value must be a valid date.")
Example #39
0
    def update(self):
        context = aq_inner(self.context)
        portal = getPortal(context)
        currentUrl = self.request.getURL()[len(portal.absolute_url()):]
        user = getSecurityManager().getUser()

        if IMembraneUser.providedBy(user):
            mt = getToolByName(self.context, "membrane_tool")
            user_object = mt.getUserObject(user_id=user.getUserId())
        else:
            user_object = None

        for (test, id) in self.current_map:
            if test.match(currentUrl):
                current = id
                break
        else:
            current = None

        results = [{"id": "sectors",
                    "title": _("nav_surveys", default=u"OiRA Tools"),
                    "url": portal.sectors.absolute_url(),
                    "class": "current" if current == "sectors" else None}]

        if checkPermission(portal, "Manage portal"):
            for country in aq_chain(context):
                if ICountry.providedBy(country):
                    url = "%s/@@manage-users" % country.absolute_url()
                    break
            else:
                countries = sorted(portal.sectors.keys())
                url = "%s/@@manage-users" % \
                        portal.sectors[countries[0]].absolute_url()
            results.append({"id": "usermgmt",
                            "title": _("nav_usermanagement",
                                        default=u"User management"),
                            "url": url,
                            "class": "current" if current == "usermgmt"
                                                else None})
            results.append({"id": "documents",
                            "title": _("nav_documents", default=u"Documents"),
                            "url": portal.documents.absolute_url(),
                            "class": "current" if current == "documents"
                                                else None})
        elif ICountryManager.providedBy(user_object):
            country = aq_parent(user_object)
            results.append({"id": "usermgmt",
                            "title": _("nav_usermanagement",
                                        default=u"User management"),
                            "url": "%s/@@manage-users" %
                                        country.absolute_url(),
                            "class": "current" if current == "usermgmt"
                                                else None})

        if user_object is not None:
            country = aq_parent(user_object)
            results.append({"id": "help",
                            "title": _("nav_help", default=u"Help"),
                            "url": "%s/help" % country.absolute_url(),
                            "class": "current" if current == "help"
                                                else None})

        self.tabs = results
        self.home_url = portal.absolute_url()
Example #40
0
# Dont import this file, it's just for our i18n toolchain

from euphorie.content import MessageFactory as _

_("help_measure_action_plan", default=u"Describe your general approach to "
    u"eliminate or (if the risk is not avoidable) reduce the risk.")
_("help_measure_prevention_plan", default=u"Describe the specific action(s) "
    u"required to implement this approach (to eliminate or to reduce the "
    u"risk).")
_("help_measure_requirements", default=u'Describe the level of expertise needed '
    u'to implement the measure, for instance "common sense (no OSH knowledge '
    u'required)", "no specific OSH expertise, but minimum OSH knowledge or '
    u'training and/or consultation of OSH guidance required", or "OSH '
    u'expert". You can also describe here any other additional requirement '
    u"(if any).")
_("Solution", default=u"Measure")
_("title_common_solution", default="Measure")
_("A solution.", default=u"A standard measure for a risk.")
_("header_solutions", default=u"Standard measures")

# euphorie/client/templates/account-settings.pt
_("header_account_data", default=u"Account data")
_("Email address/account name")
_("Change email address")
_("Delete Account")
_("Please bear in mind that by changing the email address, your login name will also change.")
_("header_password", default=u"Password")

_("risk_solution_header", default=u"Measure ${number}")
_("nav_surveys", default=u"OiRA Tools")
_("Survey", default=u"OiRA Tool")