Ejemplo n.º 1
0
 def section_general(self):
     fields = [
         hqcrispy.B3MultiField(
             _("Default SMS Response"),
             crispy.Div(InlineField(
                 "use_default_sms_response",
                 data_bind="value: use_default_sms_response",
             ),
                        css_class='col-sm-4'),
             crispy.Div(InlineField(
                 "default_sms_response",
                 css_class="input-xxlarge",
                 placeholder=_("Enter Default Response"),
                 data_bind="visible: showDefaultSMSResponse",
             ),
                        css_class='col-sm-8'),
             help_bubble_text=_(
                 "Enable this option to provide a "
                 "default response when a user's incoming SMS does not "
                 "answer an open survey or match a known keyword."),
             css_id="default-sms-response-group",
             field_class='col-sm-6 col-md-9 col-lg-9'),
         hqcrispy.FieldWithHelpBubble(
             "use_restricted_sms_times",
             data_bind="value: use_restricted_sms_times",
             help_bubble_text=_(
                 "Use this option to limit the times "
                 "that SMS messages can be sent to users. Messages that "
                 "are sent outside these windows will remained queued "
                 "and will go out as soon as another window opens up."),
         ),
         hqcrispy.B3MultiField(
             "",
             hqcrispy.HiddenFieldWithErrors(
                 "restricted_sms_times_json",
                 data_bind="value: restricted_sms_times_json"),
             crispy.Div(data_bind="template: {"
                        " name: 'ko-template-restricted-sms-times', "
                        " data: $data"
                        "}", ),
             data_bind="visible: showRestrictedSMSTimes",
             field_class='col-md-10 col-lg-10'),
         hqcrispy.FieldWithHelpBubble(
             "send_to_duplicated_case_numbers",
             help_bubble_text=_(
                 "Enabling this option will send "
                 "outgoing-only messages to phone numbers registered "
                 "with more than one mobile worker or case. SMS surveys "
                 "and keywords will still only work for unique phone "
                 "numbers in your project."),
         ),
         hqcrispy.FieldWithHelpBubble(
             'sms_survey_date_format',
             help_bubble_text=_("Choose the format in which date questions "
                                "should be answered in SMS surveys."),
         ),
     ]
     return crispy.Fieldset(_("General Settings"), *fields)
Ejemplo n.º 2
0
 def section_registration(self):
     fields = [
         hqcrispy.FieldWithHelpBubble(
             "sms_case_registration_enabled",
             help_bubble_text=_(
                 "When this option is enabled, a person "
                 "can send an SMS into the system saying 'join "
                 "[project]', where [project] is your project "
                 "space name, and the system will automatically "
                 "create a case tied to that person's phone number."),
             data_bind="value: sms_case_registration_enabled",
         ),
         crispy.Div(
             hqcrispy.FieldWithHelpBubble(
                 "sms_case_registration_type",
                 placeholder=_("Enter a Case Type"),
                 help_bubble_text=_("Cases that self-register over SMS "
                                    "will be given this case type."),
             ),
             hqcrispy.FieldWithHelpBubble(
                 "sms_case_registration_owner_id",
                 help_bubble_text=_(
                     "Cases that self-register over SMS "
                     "will be owned by this user or user group."),
             ),
             hqcrispy.FieldWithHelpBubble(
                 "sms_case_registration_user_id",
                 help_bubble_text=_(
                     "The form submission for a "
                     "self-registration will belong to this user."),
             ),
             data_bind="visible: showRegistrationOptions",
         ),
         hqcrispy.FieldWithHelpBubble(
             "sms_mobile_worker_registration_enabled",
             help_bubble_text=_(
                 "When this option is enabled, a person "
                 "can send an SMS into the system saying 'join "
                 "[project] worker [username]' (where [project] is your "
                 " project space and [username] is an optional username)"
                 ", and the system will add them as a mobile worker."),
         ),
         hqcrispy.FieldWithHelpBubble(
             'registration_welcome_message',
             help_bubble_text=_(
                 "Choose whether to send an automatic "
                 "welcome message to cases, mobile workers, or both, "
                 "after they self-register. The welcome message can be "
                 "configured in the SMS languages and translations page "
                 "(Messaging -> Languages -> Messaging Translations)."),
         ),
     ]
     return crispy.Fieldset(_("Registration Settings"), *fields)
Ejemplo n.º 3
0
 def section_chat(self):
     fields = [
         hqcrispy.B3MultiField(
             _("Case Name Display"),
             crispy.Div(InlineField(
                 "use_custom_case_username",
                 data_bind="value: use_custom_case_username",
             ),
                        css_class='col-sm-4'),
             crispy.Div(InlineField(
                 "custom_case_username",
                 css_class="input-large",
                 data_bind="visible: showCustomCaseUsername",
             ),
                        css_class='col-sm-8'),
             help_bubble_text=_(
                 "By default, when chatting with a case, "
                 "the chat window will use the case's \"name\" case "
                 "property when displaying the case's name. To use a "
                 "different case property, specify it here."),
             css_id="custom-case-username-group",
             field_class='col-sm-6 col-md-9 col-lg-9'),
         hqcrispy.B3MultiField(
             _("Message Counter"),
             crispy.Div(InlineField(
                 "use_custom_message_count_threshold",
                 data_bind="value: use_custom_message_count_threshold",
             ),
                        css_class='col-sm-4'),
             crispy.Div(InlineField(
                 "custom_message_count_threshold",
                 css_class="input-large",
                 data_bind="visible: showCustomMessageCountThreshold",
             ),
                        css_class='col-sm-8'),
             help_bubble_text=_(
                 "The chat window can use a counter to keep "
                 "track of how many messages are being sent and received "
                 "and highlight that number after a certain threshold is "
                 "reached. By default, the counter is disabled. To enable "
                 "it, enter the desired threshold here."),
             css_id="custom-message-count-threshold-group",
             field_class='col-sm-6 col-md-9 col-lg-9'),
         hqcrispy.FieldWithHelpBubble(
             "use_sms_conversation_times",
             help_bubble_text=_(
                 "When this option is enabled, the system "
                 "will not send automated SMS to chat recipients when "
                 "those recipients are in the middle of a conversation."),
         ),
         hqcrispy.B3MultiField(
             "",
             hqcrispy.HiddenFieldWithErrors(
                 "sms_conversation_times_json",
                 data_bind="value: sms_conversation_times_json"),
             crispy.Div(data_bind="template: {"
                        " name: 'ko-template-sms-conversation-times', "
                        " data: $data"
                        "}", ),
             data_bind="visible: showSMSConversationTimes",
             label_class='hide',
             field_class='col-md-12 col-lg-10'),
         crispy.Div(
             hqcrispy.FieldWithHelpBubble(
                 "sms_conversation_length",
                 help_bubble_text=_(
                     "The number of minutes to wait "
                     "after receiving an incoming SMS from a chat "
                     "recipient before resuming automated SMS to that "
                     "recipient."),
             ),
             data_bind="visible: showSMSConversationTimes",
         ),
         hqcrispy.FieldWithHelpBubble(
             "survey_traffic_option",
             help_bubble_text=_(
                 "This option allows you to hide a chat "
                 "recipient's survey questions and responses from chat "
                 "windows. There is also the option to show only invalid "
                 "responses to questions in the chat window, which could "
                 "be attempts to converse."),
         ),
         hqcrispy.FieldWithHelpBubble(
             "count_messages_as_read_by_anyone",
             help_bubble_text=_(
                 "The chat window will mark unread "
                 "messages to the user viewing them. Use this option to "
                 "control whether a message counts as being read if it "
                 "is read by anyone, or if it counts as being read only "
                 "to the user who reads it."),
         ),
     ]
     return crispy.Fieldset(_("Chat Settings"), *fields)
Ejemplo n.º 4
0
    def section_registration(self):
        fields = [
            hqcrispy.FieldWithHelpBubble(
                "sms_case_registration_enabled",
                help_bubble_text=_(
                    "When this option is enabled, a person "
                    "can send an SMS into the system saying 'join "
                    "[project]', where [project] is your project "
                    "space name, and the system will automatically "
                    "create a case tied to that person's phone number."),
                data_bind="value: sms_case_registration_enabled",
            ),
            crispy.Div(
                hqcrispy.FieldWithHelpBubble(
                    "sms_case_registration_type",
                    placeholder=_("Enter a Case Type"),
                    help_bubble_text=_("Cases that self-register over SMS "
                                       "will be given this case type."),
                ),
                hqcrispy.FieldWithHelpBubble(
                    "sms_case_registration_owner_id",
                    help_bubble_text=_(
                        "Cases that self-register over SMS "
                        "will be owned by this user or user group."),
                ),
                hqcrispy.FieldWithHelpBubble(
                    "sms_case_registration_user_id",
                    help_bubble_text=_(
                        "The form submission for a "
                        "self-registration will belong to this user."),
                ),
                data_bind="visible: showRegistrationOptions",
            ),
            hqcrispy.FieldWithHelpBubble(
                "sms_mobile_worker_registration_enabled",
                help_bubble_text=_(
                    "When this option is enabled, a person "
                    "can send an SMS into the system saying 'join "
                    "[project] worker [username]' (where [project] is your "
                    " project space and [username] is an optional username)"
                    ", and the system will add them as a mobile worker."),
            ),
            hqcrispy.FieldWithHelpBubble(
                'registration_welcome_message',
                help_bubble_text=_(
                    "Choose whether to send an automatic "
                    "welcome message to cases, mobile workers, or both, "
                    "after they self-register. The welcome message can be "
                    "configured in the SMS languages and translations page "
                    "(Messaging -> Languages -> Messaging Translations)."),
            ),
            hqcrispy.FieldWithHelpBubble(
                'language_fallback',
                help_bubble_text=_("""
                    Choose what should happen when a broadcast or alert should be sent to a recipient but no
                    translations exists in the user's preferred language. You may choose not to send a message in
                    that case, or to try one of several backups.<br><br>The first backup uses the broadcast or
                    alert's default language. If that translation is also unavailable, the second backup is text in
                    the project's default SMS language. If that translation is also unavailable, you may choose
                    to use untranslated text, if there is any.
                """),
            ),
        ]

        return crispy.Fieldset(_("Registration Settings"), *fields)
Ejemplo n.º 5
0
 def get_crispy_fields(self):
     help_texts = self.get_crispy_filed_help_texts()
     return [
         hqcrispy.FieldWithHelpBubble(name, help_bubble_text=help_text)
         for name, help_text in help_texts.items()
     ]