Exemple #1
0
def render_idea_basket_dsig(self, h, comp, *args):
    labels = dict(default_states_labels())
    with h.div(class_="state_selector rounded"):
        sorted_ideas = self.get_sorted_ideas()

        if len(sorted_ideas) == 0:
            h << _(u'No idea in basket')
        else:
            with h.ul(class_="ideaBoard"):
                for state, nb in sorted_ideas:
                    label = labels.get(state, None)
                    if label:
                        with h.li(class_='ideas-list'):
                            if self.state_id == state:
                                h << h.a(
                                    '[-] ', label % nb, class_="selected_link"
                                ).action(lambda: event_management._emit_signal(self, "HIDE_IDEAS"))
                                with h.table:
                                    with h.tbody:
                                        with h.tr(class_='filter'):
                                            h << h.td
                                            h << h.td(_('Comments'))
                                            h << h.td(_('Votes'))
                                h << self.pager
                            else:
                                h << h.a(
                                    '[+] ', label % nb
                                ).action(lambda v=state: event_management._emit_signal(self, "VIEW_DSIG_IDEAS", state=v))

    return h.root
Exemple #2
0
 def delete(self):
     if not self.delete_reason.error:
         comment = self.comment
         idea = comment.idea
         idea.remove_comment(comment, reason=self.delete_reason.value)
         event_management._emit_signal(self, "DELETE_COMMENT")
         return True
 def delete(self):
     if not self.delete_reason.error:
         comment = self.comment
         idea = comment.idea
         idea.remove_comment(comment, reason=self.delete_reason.value)
         event_management._emit_signal(self, "DELETE_COMMENT")
         return True
Exemple #4
0
    def do_search(self):
        p = self.search_pattern().strip()

        if self.options().selected() == u'idea':
            event_management._emit_signal(self, "SEARCH_IDEAS", pattern=p)
        else:
            event_management._emit_signal(self, "SEARCH_USERS", pattern=p)
Exemple #5
0
    def commit(self):
        current_user = security.get_user()
        assert current_user

        if not super(SubmitSuggestion, self).is_validated(('domain', 'content')):
            return False

        current_user = current_user.entity
        suggestion = self._create_suggestion(current_user, self.domain(), self.content())
        self._send_email(suggestion)

        confirmation_message = _(u'Your suggestion has been sent to the IPS team')
        flashmessage.set_flash(confirmation_message)
        event_management._emit_signal(self, "VIEW_FRONTDESK")
        return True
def render_ideas_by_fi_list(self, h, comp, *args):
    ideas_count_by_fi = self.get_ideas_count_by_fi()
    with h.table(class_='phantom'):
        with h.thead:
            with h.tr:
                h << h.th(_(u'Facilitator'))
                h << h.th(_(u'Ideas count'))
                h << h.th(_(u'To process'))

        with h.tfoot:
            total_ideas = sum(map(operator.itemgetter(2), ideas_count_by_fi))
            total_ideas_to_review = sum(
                map(operator.itemgetter(3), ideas_count_by_fi))
            with h.tr(class_='totals'):
                h << h.th(_(u"Totals"), class_='label')
                h << h.td(str(total_ideas), class_='value')
                h << h.td(str(total_ideas_to_review), class_='value')

        with h.tbody:
            days = 15
            latecomer_fi = self.get_latecomer_fi(days)
            for uid, fullname, ideas, ideas_to_review in ideas_count_by_fi:
                with h.tr(class_='highlight' if uid in latecomer_fi else ''):
                    h << h.td(h.a(fullname).action(
                        lambda user_uid=uid: event_management._emit_signal(
                            self, "VIEW_FI_IDEA_SELECTOR", user_uid=user_uid)),
                              class_='label')
                    h << h.td(str(ideas), class_='value')
                    h << h.td(str(ideas_to_review), class_='value')

    h << h.p(_(u'In red, facilitators that have ideas '
               u'to process older than %d days.') % days,
             class_='legend')

    return h.root
Exemple #7
0
def render_idea_basket_dsig(self, h, comp, *args):
    labels = dict(default_states_labels())
    with h.div(class_="state_selector rounded"):
        sorted_ideas = self.get_sorted_ideas()

        if len(sorted_ideas) == 0:
            h << _(u'No idea in basket')
        else:
            with h.ul(class_="ideaBoard"):
                for state, nb in sorted_ideas:
                    label = labels.get(state, None)
                    if label:
                        with h.li(class_='ideas-list'):
                            if self.state_id == state:
                                h << h.a(
                                    '[-] ', label % nb, class_="selected_link"
                                ).action(lambda: event_management._emit_signal(
                                    self, "HIDE_IDEAS"))
                                with h.table:
                                    with h.tbody:
                                        with h.tr(class_='filter'):
                                            h << h.td
                                            h << h.td(_('Comments'))
                                            h << h.td(_('Votes'))
                                h << self.pager
                            else:
                                h << h.a('[+] ', label % nb).action(
                                    lambda v=state: event_management.
                                    _emit_signal(
                                        self, "VIEW_DSIG_IDEAS", state=v))

    return h.root
def render_ideas_by_fi_list(self, h, comp, *args):
    ideas_count_by_fi = self.get_ideas_count_by_fi()
    with h.table(class_='phantom'):
        with h.thead:
            with h.tr:
                h << h.th(_(u'Facilitator'))
                h << h.th(_(u'Ideas count'))
                h << h.th(_(u'To process'))

        with h.tfoot:
            total_ideas = sum(map(operator.itemgetter(2), ideas_count_by_fi))
            total_ideas_to_review = sum(
                map(operator.itemgetter(3), ideas_count_by_fi))
            with h.tr(class_='totals'):
                h << h.th(_(u"Totals"), class_='label')
                h << h.td(str(total_ideas), class_='value')
                h << h.td(str(total_ideas_to_review), class_='value')

        with h.tbody:
            days = 15
            latecomer_fi = self.get_latecomer_fi(days)
            for uid, fullname, ideas, ideas_to_review in ideas_count_by_fi:
                with h.tr(class_='highlight' if uid in latecomer_fi else ''):
                    h << h.td(h.a(fullname).action(
                        lambda user_uid=uid: event_management._emit_signal(
                            self, "VIEW_FI_IDEA_SELECTOR",
                            user_uid=user_uid)), class_='label')
                    h << h.td(str(ideas), class_='value')
                    h << h.td(str(ideas_to_review), class_='value')

    h << h.p(_(u'In red, facilitators that have ideas '
               u'to process older than %d days.') % days,
             class_='legend')

    return h.root
    def commit(self):
        current_user = security.get_user()
        assert current_user

        if not super(SubmitSuggestion, self).is_validated(
            ('domain', 'content')):
            return False

        current_user = current_user.entity
        suggestion = self._create_suggestion(current_user, self.domain(),
                                             self.content())
        self._send_email(suggestion)

        confirmation_message = _(
            u'Your suggestion has been sent to the IPS team')
        flashmessage.set_flash(confirmation_message)
        event_management._emit_signal(self, "VIEW_FRONTDESK")
        return True
    def goto(self, idea_id, mode=u"view"):
        assert is_integer(idea_id)

        self.idea_i = None
        self.content.becomes(None)

        idea = IdeaRepository().get_by_id(idea_id)
        if not idea:
            raise HTTPNotFound()

        i = self._create_idea(idea)

        # Show the editor when the current user is the creator and the
        # idea state is DRAFT or AUTHOR_NORMALIZATION
        workflow = get_workflow()
        edit_state = i.i.wf_context.state.label in (
            workflow.WFStates.INITIAL_STATE, workflow.WFStates.DRAFT_STATE,
            workflow.WFStates.AUTHOR_NORMALIZE_STATE,
            workflow.WFStates.RETURNED_BY_DI_STATE)

        # FIXME: is this a good idea to force the mode like this?!
        current_user = get_current_user()
        if current_user and (current_user in i.i.authors) and edit_state:
            mode = u"edit"

        if mode == u"edit":
            self.content.becomes(IdeaUpdater(i), model='form')
        else:
            self.content.becomes(i, model='detail')

        if current_user:
            # FIXME: WTF! Remove this!
            # Note: we do not use the association proxy and even no
            #       entity to avoid the index crawling extension to be
            #       notified of a change: we do not want to update the
            #       document each time it is viewed!
            ReadIdeaData(user_uid=current_user.uid,
                         idea_id=i.id,
                         timestamp=datetime.now())
            idea.readers_updated()

        event_management._emit_signal(self, "VIEW_IDEA", mode=mode)
Exemple #11
0
    def commit(self):
        properties = ('subject', 'message')
        if not self.user:
            properties += ('sender_email',)

        if not self.is_validated(properties):
            return False  # failure

        subject = _(u'Eureka : Contact (%s)') % self.subject()
        message = self.message()

        sender = self.user.email if self.user else self.sender_email.value
        mailer = mail.get_mailer()
        recipient = mailer.support_sender
        mailer.send_mail(subject, sender, [recipient], message)

        confirmation = _(u'Your request has been sent to the IPS team that will answer it as soon as possible')
        flashmessage.set_flash(confirmation)
        event_management._emit_signal(self, "VIEW_FRONTDESK")
        return True  # success
Exemple #12
0
    def goto(self, idea_id, mode=u"view"):
        assert is_integer(idea_id)

        self.idea_i = None
        self.content.becomes(None)

        idea = IdeaRepository().get_by_id(idea_id)
        if not idea:
            raise HTTPNotFound()

        i = self._create_idea(idea)

        # Show the editor when the current user is the creator and the
        # idea state is DRAFT or AUTHOR_NORMALIZATION
        workflow = get_workflow()
        edit_state = i.i.wf_context.state.label in (workflow.WFStates.INITIAL_STATE,
                                                    workflow.WFStates.DRAFT_STATE,
                                                    workflow.WFStates.AUTHOR_NORMALIZE_STATE,
                                                    workflow.WFStates.RETURNED_BY_DI_STATE)

        # FIXME: is this a good idea to force the mode like this?!
        current_user = get_current_user()
        if current_user and (current_user in i.i.authors) and edit_state:
            mode = u"edit"

        if mode == u"edit":
            self.content.becomes(IdeaUpdater(i), model='form')
        else:
            self.content.becomes(i, model='detail')

        if current_user:
            # FIXME: WTF! Remove this!
            # Note: we do not use the association proxy and even no
            #       entity to avoid the index crawling extension to be
            #       notified of a change: we do not want to update the
            #       document each time it is viewed!
            ReadIdeaData(user_uid=current_user.uid, idea_id=i.id, timestamp=datetime.now())
            idea.readers_updated()

        event_management._emit_signal(self, "VIEW_IDEA", mode=mode)
    def commit(self):
        properties = ('subject', 'message')
        if not self.user:
            properties += ('sender_email', )

        if not self.is_validated(properties):
            return False  # failure

        subject = _(u'Eureka : Contact (%s)') % self.subject()
        message = self.message()

        sender = self.user.email if self.user else self.sender_email.value
        mailer = mail.get_mailer()
        recipient = mailer.support_sender
        mailer.send_mail(subject, sender, [recipient], message)

        confirmation = _(
            u'Your request has been sent to the IPS team that will answer it as soon as possible'
        )
        flashmessage.set_flash(confirmation)
        event_management._emit_signal(self, "VIEW_FRONTDESK")
        return True  # success
def render_ideas_by_di_list(self, h, comp, *args):
    ideas_count_by_di = self.get_ideas_count_by_di()
    with h.table(class_='phantom'):
        with h.thead:
            with h.tr:
                h << h.th(_(u'Developer'))
                h << h.th(_(u'To process'))

        with h.tfoot:
            total = sum(map(operator.itemgetter(1), ideas_count_by_di))
            with h.tr(class_='totals'):
                h << h.th(_(u"Totals"), class_='label')
                h << h.td("%d" % total, class_='value')

        with h.tbody:
            for user, count in ideas_count_by_di:
                formated_name = user.fullname
                with h.tr:
                    h << h.td(h.a(formated_name).action(lambda user_uid=user.uid: event_management._emit_signal(self, "VIEW_DI_IDEA_SELECTOR", user_uid=user_uid)), class_='label')
                    h << h.td(str(count), class_='value')

    return h.root
Exemple #15
0
 def submit_suggestion(self):
     event_management._emit_signal(self, "SUBMIT_SUGGESTION")
Exemple #16
0
 def call_ideas(self, state):
     event_management._emit_signal(self,
                                   "VIEW_IDEAS_WITH_STATE",
                                   state=state)
Exemple #17
0
 def call_ideas(self, state):
     event_management._emit_signal(self, "VIEW_IDEAS_WITH_STATE", state=state)
Exemple #18
0
 def submit_idea(self):
     event_management._emit_signal(self, "SUBMIT_IDEA",
                                   challenge_id=self.challenge_id)
Exemple #19
0
 def view_profile(self, uid=None):
     # FIXME: fix the mess with profile-related events
     event_management._emit_signal(self, "VIEW_USER_PROFILE", user_uid=(uid or self.uid))
Exemple #20
0
 def view_profile(self, uid):
     event_management._emit_signal(self, "VIEW_USER_PROFILE", user_uid=uid)
Exemple #21
0
 def view_details(self):
     event_management._emit_signal(self, "VIEW_SHOP")
Exemple #22
0
 def view_dsig_basket(self, uid=None):
     event_management._emit_signal(self, "VIEW_DSIG_BASKET", user_uid=(uid or self.uid))
Exemple #23
0
 def view_tracked_ideas(self, uid=None):
     event_management._emit_signal(self, "VIEW_USER_TRACKED_IDEAS", user_uid=(uid or self.uid))
Exemple #24
0
 def show_status_level_help(self):
     event_management._emit_signal(self, "VIEW_HELP", section='faq_1_7bis')
Exemple #25
0
 def delete_idea(self):
     self.idea.i.delete()
     flashmessage.set_flash(_(u'Idea deleted'))
     event_management._emit_signal(self, "VIEW_IDEAS")
Exemple #26
0
 def with_login(self, action, *args, **kwargs):
     event_management._emit_signal(self, "WITH_LOGIN", action, *args,
                                   **kwargs)
Exemple #27
0
 def form_edit(self, comp):
     event_management._emit_signal(self, "EDIT_IDEA")
Exemple #28
0
 def view_launched_ideas(self):
     event_management._emit_signal(self, "VIEW_LAUNCHED_IDEAS")
Exemple #29
0
 def view_administration(self, uid=None):
     event_management._emit_signal(self, "VIEW_ADMINISTRATION")
Exemple #30
0
 def goto(self):
     event_management._emit_signal(self, "VIEW_IDEA", idea_id=self.id)
Exemple #31
0
 def view_profile(self, uid):
     event_management._emit_signal(self, "VIEW_USER_PROFILE", user_uid=uid)
Exemple #32
0
 def edit_idea(self):
     event_management._emit_signal(self, "VIEW_IDEA", idea_id=self.i.id,
                                   mode=u"edit")
Exemple #33
0
 def with_login(self, action, *args, **kwargs):
     event_management._emit_signal(self, "WITH_LOGIN", action, *args,
                                   **kwargs)
Exemple #34
0
 def delete(self):
     # Need to use session.delete to trigger delete cascades
     session.delete(self.i)
     flashmessage.set_flash(_(u'Idea deleted'))
     event_management._emit_signal(self, "VIEW_IDEAS")
Exemple #35
0
 def form_edit(self, comp):
     event_management._emit_signal(self, "EDIT_IDEA")
Exemple #36
0
 def with_login(self, action):
     event_management._emit_signal(self, "WITH_LOGIN", action)
Exemple #37
0
 def submit_idea(self):
     event_management._emit_signal(self,
                                   "SUBMIT_IDEA",
                                   challenge_id=self.challenge_id)
Exemple #38
0
 def show_domain(self, id, label):
     event_management._emit_signal(self,
                                   'VIEW_DOMAIN_IDEAS',
                                   domain_id=id,
                                   domain_label=label)
Exemple #39
0
 def goto_user(self, user_uid):
     event_management._emit_signal(self, "VIEW_USER_PROFILE",
                                   user_uid=user_uid)
Exemple #40
0
 def goto(self):
     event_management._emit_signal(self, "VIEW_IDEA", idea_id=self.id)
Exemple #41
0
 def view_launched_ideas(self):
     event_management._emit_signal(self, "VIEW_LAUNCHED_IDEAS")
Exemple #42
0
 def edit_idea(self):
     event_management._emit_signal(self,
                                   "VIEW_IDEA",
                                   idea_id=self.i.id,
                                   mode=u"edit")
Exemple #43
0
 def show_domain(self, id, label):
     event_management._emit_signal(self, 'VIEW_DOMAIN_IDEAS', domain_id=id, domain_label=label)
Exemple #44
0
 def delete(self):
     # Need to use session.delete to trigger delete cascades
     session.delete(self.i)
     flashmessage.set_flash(_(u'Idea deleted'))
     event_management._emit_signal(self, "VIEW_IDEAS")
def _handle_signal_view_idea(self, sender, signal, *args, **kwds):
    event_management._emit_signal(self, "VIEW_IDEA", idea_id=sender.elem_id, **kwds)
Exemple #46
0
 def with_login(self, action):
     event_management._emit_signal(self, "WITH_LOGIN", action)
def _handle_signal_view_user_profile(self, sender, signal, *args, **kwds):
    event_management._emit_signal(self, "VIEW_USER_PROFILE", user_uid=kwds.get("user_uid"))
Exemple #48
0
 def view_idea(self, idea_id):
     event_management._emit_signal(self, "VIEW_IDEA", mode='view',
                                   idea_id=idea_id)
 def goto_user(self, user_uid):
     event_management._emit_signal(self,
                                   "VIEW_USER_PROFILE",
                                   user_uid=user_uid)