Пример #1
0
 def get_report_rows(self):
     request = self.factory.get('/')
     request.couch_user = self.couch_user
     request.datespan = DateSpan(
         startdate=datetime.utcnow() - timedelta(days=30),
         enddate=datetime.utcnow(),
     )
     report = MessageLogReport(request, domain=self.domain)
     headers = [h.html for h in report.headers.header]
     for row in report.export_rows:
         yield dict(zip(headers, row))
Пример #2
0
    def sidebar_items(self):
        from corehq.apps.reports.standard.sms import MessageLogReport
        def reminder_subtitle(form=None, **context):
            return form['nickname'].value

        def keyword_subtitle(keyword=None, **context):
            return keyword.keyword

        reminders_urls = []
        if self.can_access_reminders:
            if toggles.REMINDERS_UI_PREVIEW.enabled(self.couch_user.username):
                from corehq.apps.reminders.views import (
                    EditScheduledReminderView,
                    CreateScheduledReminderView,
                    RemindersListView,
                )
                reminders_list_url = reverse(RemindersListView.urlname, args=[self.domain])
                edit_reminder_urlname = EditScheduledReminderView.urlname
                new_reminder_urlname = CreateScheduledReminderView.urlname
            else:
                reminders_list_url = reverse('list_reminders', args=[self.domain])
                edit_reminder_urlname = 'edit_complex'
                new_reminder_urlname = 'add_complex_reminder_schedule'
            reminders_urls.extend([
                {
                    'title': _("Reminders"),
                    'url': reminders_list_url,
                    'subpages': [
                        {
                            'title': reminder_subtitle,
                            'urlname': edit_reminder_urlname
                        },
                        {
                            'title': _("Schedule Reminder"),
                            'urlname': new_reminder_urlname,
                        },
                        {
                            'title': _("Schedule Multi Event Reminder"),
                            'urlname': 'create_complex_reminder_schedule',
                        },
                    ],
                },
                {
                    'title': _("Reminder Calendar"),
                    'url': reverse('scheduled_reminders', args=[self.domain])
                },
            ])

        can_use_survey = can_use_survey_reminders(self._request)
        if can_use_survey:
            from corehq.apps.reminders.views import (
                KeywordsListView, AddNormalKeywordView,
                AddStructuredKeywordView, EditNormalKeywordView,
                EditStructuredKeywordView,
            )
            if toggles.REMINDERS_UI_PREVIEW.enabled(self.couch_user.username):
                keyword_list_url = reverse(KeywordsListView.urlname, args=[self.domain])
            else:
                keyword_list_url = reverse('manage_keywords', args=[self.domain])
            reminders_urls.append({
                'title': _("Keywords"),
                'url': keyword_list_url,
                'subpages': [
                    {
                        'title': keyword_subtitle,
                        'urlname': 'edit_keyword'
                    },
                    {
                        'title': _("New Keyword"),
                        'urlname': 'add_keyword',
                    },
                    {
                        'title': AddNormalKeywordView.page_title,
                        'urlname': AddNormalKeywordView.urlname,
                    },
                    {
                        'title': AddStructuredKeywordView.page_title,
                        'urlname': AddStructuredKeywordView.urlname,
                    },
                    {
                        'title': EditNormalKeywordView.page_title,
                        'urlname': EditNormalKeywordView.urlname,
                    },
                    {
                        'title': EditStructuredKeywordView.page_title,
                        'urlname': EditStructuredKeywordView.urlname,
                    },
                ],
            })

        if self.can_access_reminders:
            reminders_urls.append({
                'title': _("Reminders in Error"),
                'url': reverse('reminders_in_error', args=[self.domain])
            })
        items = []
        messages_urls = []
        if self.can_access_sms:
            messages_urls.extend([
                {
                    'title': _('Compose SMS Message'),
                    'url': reverse('sms_compose_message', args=[self.domain])
                },
            ])
        if self.can_access_reminders:
            messages_urls.extend([
                {
                    'title': _("Broadcast Messages"),
                    'url': reverse('one_time_reminders', args=[self.domain]),
                    'subpages': [
                        {
                            'title': _("Edit Broadcast"),
                            'urlname': 'edit_one_time_reminder'
                        },
                        {
                            'title': _("New Broadcast"),
                            'urlname': 'add_one_time_reminder'
                        },
                        {
                            'title': _("New Broadcast"),
                            'urlname': 'copy_one_time_reminder'
                        },
                    ]
                },
            ])
        if self.can_access_sms:
            messages_urls.extend([
                {
                    'title': _('Message Log'),
                    'url': MessageLogReport.get_url(domain=self.domain)
                },
            ])
        if messages_urls:
            items.append((_("Messages"), messages_urls))
        if reminders_urls:
            items.append((_("Data Collection and Reminders"), reminders_urls))

        if self.project.commtrack_enabled:
            from corehq.apps.sms.views import SubscribeSMSView
            items.append(
                (_("CommTrack"), [
                    {'title': ugettext_lazy("Subscribe to SMS Reports"),
                    'url': reverse(SubscribeSMSView.urlname, args=[self.domain])},])
            )

        if self.couch_user.is_previewer():
            items[0][1].append(
                {'title': _('Chat'),
                 'url': reverse('chat_contacts', args=[self.domain])}
            )

        if self.project.survey_management_enabled and can_use_survey:
            def sample_title(form=None, **context):
                return form['name'].value

            def survey_title(form=None, **context):
                return form['name'].value

            items.append(
                (_("Survey Management"), [
                    {'title': _("Samples"),
                     'url': reverse('sample_list', args=[self.domain]),
                     'subpages': [
                         {'title': sample_title,
                          'urlname': 'edit_sample'},
                         {'title': _("New Sample"),
                          'urlname': 'add_sample'},
                     ]},
                    {'title': _("Surveys"),
                     'url': reverse('survey_list', args=[self.domain]),
                     'subpages': [
                         {'title': survey_title,
                          'urlname': 'edit_survey'},
                         {'title': _("New Survey"),
                          'urlname': 'add_survey'},
                     ]},
                ])
            )

        settings_pages = []
        if self.can_access_sms:
            from corehq.apps.sms.views import (
                DomainSmsGatewayListView, AddDomainGatewayView,
                EditDomainGatewayView,
            )
            if toggles.REMINDERS_UI_PREVIEW.enabled(self.couch_user.username):
                sms_connectivity_url = reverse(
                    DomainSmsGatewayListView.urlname, args=[self.domain]
                )
            else:
                sms_connectivity_url = reverse(
                    'list_domain_backends', args=[self.domain]
                )
            settings_pages.append({
                'title': _('SMS Connectivity'),
                'url': sms_connectivity_url,
                'subpages': [
                    {
                        'title': _('Add Connection'),
                        'urlname': 'add_domain_backend'
                    },
                    {
                        'title': _("Add Connection"),
                        'urlname': AddDomainGatewayView.urlname,
                    },
                    {
                        'title': _('Edit Connection'),
                        'urlname': 'edit_domain_backend'
                    },
                    {
                        'title': _("Edit Connection"),
                        'urlname': EditDomainGatewayView.urlname,
                    },
                ],
            })
        if self.couch_user.is_superuser or self.couch_user.is_domain_admin(self.domain):
            settings_pages.extend([
                {'title': ugettext_lazy("General Settings"),
                 'url': reverse('sms_settings', args=[self.domain])},
                {'title': ugettext_lazy("Languages"),
                 'url': reverse('sms_languages', args=[self.domain])},
            ])
        if settings_pages:
            items.append((_("Settings"), settings_pages))

        return items
Пример #3
0
    def sidebar_items(self):
        from corehq.apps.reports.standard.sms import MessageLogReport
        def reminder_subtitle(form=None, **context):
            return form['nickname'].value

        def keyword_subtitle(keyword=None, **context):
            return keyword.keyword

        items = [
            (_("Messages"), [
                {'title': _('Compose SMS Message'),
                 'url': reverse('sms_compose_message', args=[self.domain])},
                {'title': _('Message Log'),
                 'url': MessageLogReport.get_url(domain=self.domain)},
            ]),
            (_("Data Collection and Reminders"), [
                {'title': _("Reminders"),
                 'url': reverse('list_reminders', args=[self.domain]),
                 'subpages': [
                     {'title': reminder_subtitle,
                      'urlname': 'edit_complex'},
                     {'title': _("New Reminder Definition"),
                      'urlname': 'add_complex_reminder_schedule'},
                 ]},

                {'title': _("Reminder Calendar"),
                 'url': reverse('scheduled_reminders', args=[self.domain])},

                {'title': _("Keywords"),
                 'url': reverse('manage_keywords', args=[self.domain]),
                 'subpages': [
                     {'title': keyword_subtitle,
                      'urlname': 'edit_keyword'},
                     {'title': _("New Keyword"),
                      'urlname': 'add_keyword'},
                 ]},
                #{'title': _("User Registration"),
                 #'url': ...},
                {'title': _("Reminders in Error"),
                 'url': reverse('reminders_in_error', args=[self.domain])},
            ])
        ]

        if self.project.survey_management_enabled:
            def sample_title(form=None, **context):
                return form['name'].value

            def survey_title(form=None, **context):
                return form['name'].value

            items.append(
                (_("Survey Management"), [
                    {'title': _("Samples"),
                     'url': reverse('sample_list', args=[self.domain]),
                     'subpages': [
                         {'title': sample_title,
                          'urlname': 'edit_sample'},
                         {'title': _("New Sample"),
                          'urlname': 'add_sample'},
                     ]},
                    {'title': _("Surveys"),
                     'url': reverse('survey_list', args=[self.domain]),
                     'subpages': [
                         {'title': survey_title,
                          'urlname': 'edit_survey'},
                         {'title': _("New Survey"),
                          'urlname': 'add_survey'},
                     ]},
                ])
            )

        return items
Пример #4
0
    def sidebar_items(self):
        from corehq.apps.reports.standard.sms import MessageLogReport
        def reminder_subtitle(form=None, **context):
            return form['nickname'].value

        def keyword_subtitle(keyword=None, **context):
            return keyword.keyword

        if self.couch_user.username in [
            '*****@*****.**',
            '*****@*****.**',
            '*****@*****.**',
            '*****@*****.**',
        ]:
            from corehq.apps.sms.views import DomainSmsGatewayListView
            from corehq.apps.reminders.views import (
                EditScheduledReminderView,
                CreateScheduledReminderView,
                RemindersListView,
                KeywordsListView,
            )
            sms_connectivity_url = reverse(DomainSmsGatewayListView.urlname, args=[self.domain])
            reminders_list_url = reverse(RemindersListView.urlname, args=[self.domain])
            edit_reminder_urlname = EditScheduledReminderView.urlname
            new_reminder_urlname = CreateScheduledReminderView.urlname
            keyword_list_url = reverse(KeywordsListView.urlname, args=[self.domain])
        else:
            sms_connectivity_url = reverse('list_domain_backends', args=[self.domain])
            reminders_list_url = reverse('list_reminders', args=[self.domain])
            edit_reminder_urlname = 'edit_complex'
            new_reminder_urlname = 'add_complex_reminder_schedule'
            keyword_list_url = reverse('manage_keywords', args=[self.domain])

        from corehq.apps.sms.views import SubscribeSMSView

        items = [
            (_("Messages"), [
                {'title': _('Compose SMS Message'),
                 'url': reverse('sms_compose_message', args=[self.domain])},
                {'title': _("Broadcast Messages"),
                 'url': reverse('one_time_reminders', args=[self.domain]),
                 'subpages': [
                     {'title': _("Edit Broadcast"),
                      'urlname': 'edit_one_time_reminder'},
                     {'title': _("New Broadcast"),
                      'urlname': 'add_one_time_reminder'},
                     {'title': _("New Broadcast"),
                      'urlname': 'copy_one_time_reminder'},
                 ]},
                {'title': _('Message Log'),
                 'url': MessageLogReport.get_url(domain=self.domain)},
                {'title': _('SMS Connectivity'),
                 'url': sms_connectivity_url,
                 'subpages': [
                     {'title': _('Add Connection'),
                      'urlname': 'add_domain_backend'},
                     {'title': _('Edit Connection'),
                      'urlname': 'edit_domain_backend'},
                 ]},
            ]),
            (_("Data Collection and Reminders"), [
                {'title': _("Reminders"),
                 'url': reminders_list_url,
                 'subpages': [
                     {'title': reminder_subtitle,
                      'urlname': edit_reminder_urlname},
                     {'title': _("Schedule Reminder"),
                      'urlname': new_reminder_urlname},
                     {'title': _("Schedule Multi Event Reminder"),
                      'urlname': 'create_complex_reminder_schedule'},
                 ]},
                {'title': _("Reminder Calendar"),
                 'url': reverse('scheduled_reminders', args=[self.domain])},

                {'title': _("Keywords"),
                 'url': keyword_list_url,
                 'subpages': [
                     {'title': keyword_subtitle,
                      'urlname': 'edit_keyword'},
                     {'title': _("New Keyword"),
                      'urlname': 'add_keyword'},
                 ]},
                #{'title': _("User Registration"),
                 #'url': ...},
                {'title': _("Reminders in Error"),
                 'url': reverse('reminders_in_error', args=[self.domain])},
            ]),
        ]
        if self.project.commtrack_enabled:
            items.append(
                (_("CommTrack"), [
                    {'title': _("Subscribe to SMS Reports"),
                    'url': reverse(SubscribeSMSView.urlname, args=[self.domain])},])
            )

        if self.couch_user.is_previewer():
            items[0][1].append(
                {'title': _('Chat'),
                 'url': reverse('chat_contacts', args=[self.domain])}
            )

        if self.project.survey_management_enabled:
            def sample_title(form=None, **context):
                return form['name'].value

            def survey_title(form=None, **context):
                return form['name'].value

            items.append(
                (_("Survey Management"), [
                    {'title': _("Samples"),
                     'url': reverse('sample_list', args=[self.domain]),
                     'subpages': [
                         {'title': sample_title,
                          'urlname': 'edit_sample'},
                         {'title': _("New Sample"),
                          'urlname': 'add_sample'},
                     ]},
                    {'title': _("Surveys"),
                     'url': reverse('survey_list', args=[self.domain]),
                     'subpages': [
                         {'title': survey_title,
                          'urlname': 'edit_survey'},
                         {'title': _("New Survey"),
                          'urlname': 'add_survey'},
                     ]},
                ])
            )

        if self.couch_user.is_superuser or self.couch_user.is_domain_admin(self.domain):
            items.append(
                (_("Settings"), [
                    {'title': _("General Settings"),
                     'url': reverse('sms_settings', args=[self.domain])},
                ])
            )

        return items
Пример #5
0
    def sidebar_items(self):
        from corehq.apps.reports.standard.sms import MessageLogReport
        def reminder_subtitle(form=None, **context):
            return form['nickname'].value

        def keyword_subtitle(keyword=None, **context):
            return keyword.keyword

        reminders_urls = []
        if self.can_access_reminders:
            if toggles.REMINDERS_UI_PREVIEW.enabled(self.couch_user.username):
                from corehq.apps.reminders.views import (
                    EditScheduledReminderView,
                    CreateScheduledReminderView,
                    RemindersListView,
                )
                reminders_list_url = reverse(RemindersListView.urlname, args=[self.domain])
                edit_reminder_urlname = EditScheduledReminderView.urlname
                new_reminder_urlname = CreateScheduledReminderView.urlname
            else:
                reminders_list_url = reverse('list_reminders', args=[self.domain])
                edit_reminder_urlname = 'edit_complex'
                new_reminder_urlname = 'add_complex_reminder_schedule'
            reminders_urls.extend([
                {
                    'title': _("Reminders"),
                    'url': reminders_list_url,
                    'subpages': [
                        {
                            'title': reminder_subtitle,
                            'urlname': edit_reminder_urlname
                        },
                        {
                            'title': _("Schedule Reminder"),
                            'urlname': new_reminder_urlname,
                        },
                        {
                            'title': _("Schedule Multi Event Reminder"),
                            'urlname': 'create_complex_reminder_schedule',
                        },
                    ],
                },
                {
                    'title': _("Reminder Calendar"),
                    'url': reverse('scheduled_reminders', args=[self.domain])
                },
            ])

        can_use_survey = can_use_survey_reminders(self._request)
        if can_use_survey:
            from corehq.apps.reminders.views import KeywordsListView
            if toggles.REMINDERS_UI_PREVIEW.enabled(self.couch_user.username):
                keyword_list_url = reverse(KeywordsListView.urlname, args=[self.domain])
            else:
                keyword_list_url = reverse('manage_keywords', args=[self.domain])
            reminders_urls.append({
                'title': _("Keywords"),
                'url': keyword_list_url,
                'subpages': [
                {
                    'title': keyword_subtitle,
                    'urlname': 'edit_keyword'
                },
                {
                    'title': _("New Keyword"),
                    'urlname': 'add_keyword',
                },
                ],
            })

        if self.can_access_reminders:
            reminders_urls.append({
                'title': _("Reminders in Error"),
                'url': reverse('reminders_in_error', args=[self.domain])
            })
        items = []
        messages_urls = []
        if self.can_access_sms:
            messages_urls.extend([
                {
                    'title': _('Compose SMS Message'),
                    'url': reverse('sms_compose_message', args=[self.domain])
                },
            ])
        if self.can_access_reminders:
            messages_urls.extend([
                {
                    'title': _("Broadcast Messages"),
                    'url': reverse('one_time_reminders', args=[self.domain]),
                    'subpages': [
                        {
                            'title': _("Edit Broadcast"),
                            'urlname': 'edit_one_time_reminder'
                        },
                        {
                            'title': _("New Broadcast"),
                            'urlname': 'add_one_time_reminder'
                        },
                        {
                            'title': _("New Broadcast"),
                            'urlname': 'copy_one_time_reminder'
                        },
                    ]
                },
            ])
        if self.can_access_sms:
            messages_urls.extend([
                {
                    'title': _('Message Log'),
                    'url': MessageLogReport.get_url(domain=self.domain)
                },
            ])
        if messages_urls:
            items.append((_("Messages"), messages_urls))
        if reminders_urls:
            items.append((_("Data Collection and Reminders"), reminders_urls))

        if self.project.commtrack_enabled:
            from corehq.apps.sms.views import SubscribeSMSView
            items.append(
                (_("CommTrack"), [
                    {'title': ugettext_lazy("Subscribe to SMS Reports"),
                    'url': reverse(SubscribeSMSView.urlname, args=[self.domain])},])
            )

        if self.couch_user.is_previewer():
            items[0][1].append(
                {'title': _('Chat'),
                 'url': reverse('chat_contacts', args=[self.domain])}
            )

        if self.project.survey_management_enabled and can_use_survey:
            def sample_title(form=None, **context):
                return form['name'].value

            def survey_title(form=None, **context):
                return form['name'].value

            items.append(
                (_("Survey Management"), [
                    {'title': _("Samples"),
                     'url': reverse('sample_list', args=[self.domain]),
                     'subpages': [
                         {'title': sample_title,
                          'urlname': 'edit_sample'},
                         {'title': _("New Sample"),
                          'urlname': 'add_sample'},
                     ]},
                    {'title': _("Surveys"),
                     'url': reverse('survey_list', args=[self.domain]),
                     'subpages': [
                         {'title': survey_title,
                          'urlname': 'edit_survey'},
                         {'title': _("New Survey"),
                          'urlname': 'add_survey'},
                     ]},
                ])
            )

        settings_pages = []
        if self.can_access_sms:
            from corehq.apps.sms.views import (
                DomainSmsGatewayListView, AddDomainGatewayView,
                EditDomainGatewayView,
            )
            if toggles.REMINDERS_UI_PREVIEW.enabled(self.couch_user.username):
                sms_connectivity_url = reverse(
                    DomainSmsGatewayListView.urlname, args=[self.domain]
                )
            else:
                sms_connectivity_url = reverse(
                    'list_domain_backends', args=[self.domain]
                )
            settings_pages.append({
                'title': _('SMS Connectivity'),
                'url': sms_connectivity_url,
                'subpages': [
                    {
                        'title': _('Add Connection'),
                        'urlname': 'add_domain_backend'
                    },
                    {
                        'title': _("Add Connection"),
                        'urlname': AddDomainGatewayView.urlname,
                    },
                    {
                        'title': _('Edit Connection'),
                        'urlname': 'edit_domain_backend'
                    },
                    {
                        'title': _("Edit Connection"),
                        'urlname': EditDomainGatewayView.urlname,
                    },
                ],
            })
        if self.couch_user.is_superuser or self.couch_user.is_domain_admin(self.domain):
            settings_pages.extend([
                {'title': ugettext_lazy("General Settings"),
                 'url': reverse('sms_settings', args=[self.domain])},
                {'title': ugettext_lazy("Languages"),
                 'url': reverse('sms_languages', args=[self.domain])},
            ])
        if settings_pages:
            items.append((_("Settings"), settings_pages))

        return items
Пример #6
0
    def sidebar_items(self):
        from corehq.apps.reports.standard.sms import MessageLogReport

        def reminder_subtitle(form=None, **context):
            return form["nickname"].value

        def keyword_subtitle(keyword=None, **context):
            return keyword.keyword

        if self.couch_user.username in [
            "*****@*****.**",
            "*****@*****.**",
            "*****@*****.**",
            "*****@*****.**",
        ]:
            from corehq.apps.sms.views import DomainSmsGatewayListView
            from corehq.apps.reminders.views import (
                EditScheduledReminderView,
                CreateScheduledReminderView,
                RemindersListView,
                KeywordsListView,
            )

            sms_connectivity_url = reverse(DomainSmsGatewayListView.urlname, args=[self.domain])
            reminders_list_url = reverse(RemindersListView.urlname, args=[self.domain])
            edit_reminder_urlname = EditScheduledReminderView.urlname
            new_reminder_urlname = CreateScheduledReminderView.urlname
            keyword_list_url = reverse(KeywordsListView.urlname, args=[self.domain])
        else:
            sms_connectivity_url = reverse("list_domain_backends", args=[self.domain])
            reminders_list_url = reverse("list_reminders", args=[self.domain])
            edit_reminder_urlname = "edit_complex"
            new_reminder_urlname = "add_complex_reminder_schedule"
            keyword_list_url = reverse("manage_keywords", args=[self.domain])

        items = [
            (
                _("Messages"),
                [
                    {"title": _("Compose SMS Message"), "url": reverse("sms_compose_message", args=[self.domain])},
                    {
                        "title": _("Broadcast Messages"),
                        "url": reverse("one_time_reminders", args=[self.domain]),
                        "subpages": [
                            {"title": _("Edit Broadcast"), "urlname": "edit_one_time_reminder"},
                            {"title": _("New Broadcast"), "urlname": "add_one_time_reminder"},
                            {"title": _("New Broadcast"), "urlname": "copy_one_time_reminder"},
                        ],
                    },
                    {"title": _("Message Log"), "url": MessageLogReport.get_url(domain=self.domain)},
                    {
                        "title": _("SMS Connectivity"),
                        "url": sms_connectivity_url,
                        "subpages": [
                            {"title": _("Add Connection"), "urlname": "add_domain_backend"},
                            {"title": _("Edit Connection"), "urlname": "edit_domain_backend"},
                        ],
                    },
                ],
            ),
            (
                _("Data Collection and Reminders"),
                [
                    {
                        "title": _("Reminders"),
                        "url": reminders_list_url,
                        "subpages": [
                            {"title": reminder_subtitle, "urlname": edit_reminder_urlname},
                            {"title": _("Schedule Reminder"), "urlname": new_reminder_urlname},
                            {
                                "title": _("Schedule Multi Event Reminder"),
                                "urlname": "create_complex_reminder_schedule",
                            },
                        ],
                    },
                    {"title": _("Reminder Calendar"), "url": reverse("scheduled_reminders", args=[self.domain])},
                    {
                        "title": _("Keywords"),
                        "url": keyword_list_url,
                        "subpages": [
                            {"title": keyword_subtitle, "urlname": "edit_keyword"},
                            {"title": _("New Keyword"), "urlname": "add_keyword"},
                        ],
                    },
                    # {'title': _("User Registration"),
                    #'url': ...},
                    {"title": _("Reminders in Error"), "url": reverse("reminders_in_error", args=[self.domain])},
                ],
            ),
        ]
        if self.couch_user.is_previewer():
            items[0][1].append({"title": _("Chat"), "url": reverse("chat_contacts", args=[self.domain])})

        if self.project.survey_management_enabled:

            def sample_title(form=None, **context):
                return form["name"].value

            def survey_title(form=None, **context):
                return form["name"].value

            items.append(
                (
                    _("Survey Management"),
                    [
                        {
                            "title": _("Samples"),
                            "url": reverse("sample_list", args=[self.domain]),
                            "subpages": [
                                {"title": sample_title, "urlname": "edit_sample"},
                                {"title": _("New Sample"), "urlname": "add_sample"},
                            ],
                        },
                        {
                            "title": _("Surveys"),
                            "url": reverse("survey_list", args=[self.domain]),
                            "subpages": [
                                {"title": survey_title, "urlname": "edit_survey"},
                                {"title": _("New Survey"), "urlname": "add_survey"},
                            ],
                        },
                    ],
                )
            )

        if self.couch_user.is_superuser or self.couch_user.is_domain_admin(self.domain):
            items.append(
                (_("Settings"), [{"title": _("General Settings"), "url": reverse("sms_settings", args=[self.domain])}])
            )

        return items