示例#1
0
class AmendmentWorkMode(WorkMode):

    work_mode_process_id = 'amendmentworkmodeprocess'
    participants_mini = 3
    title = _('Change with amendments')
    work_id = 'amendment'
    order = 2
示例#2
0
def init_proposal_ballots(proposal):
    wg = proposal.working_group
    electors = []
    subjects = [proposal]
    ballot = Ballot('Referendum', electors, subjects, VP_DEFAULT_DURATION,
                    true_val=_("Submit the proposal as is"),
                    false_val=_("Continue to improve the proposal"))
    wg.addtoproperty('ballots', ballot)
    ballot.report.description = FIRST_VOTE_PUBLISHING_MESSAGE
    ballot.title = _("Submit the proposal or not")
    wg.vp_ballot = ballot #vp for voting for publishing
    durations = list(AMENDMENTS_CYCLE_DEFAULT_DURATION.keys())
    group = sorted(durations,
                   key=lambda e: AMENDMENTS_CYCLE_DEFAULT_DURATION[e])
    ballot = Ballot('FPTP', electors, group, VP_DEFAULT_DURATION,
                    group_title=_('Duration of the amendment cycle'),
                    group_default='One week')
    wg.addtoproperty('ballots', ballot)
    ballot.title = _('Duration of the amendment cycle')
    ballot.report.description = FIRST_VOTE_DURATION_MESSAGE
    wg.duration_configuration_ballot = ballot
示例#3
0
文件: util.py 项目: jean/nova-ideo
def send_alert_new_content(content):
    keywords = content.keywords
    request = get_current_request()
    users = get_users_by_keywords([k.lower() for k in keywords])
    url = request.resource_url(content, "@@index")
    subject = NEWCONTENT_SUBJECT.format(subject_title=content.title)
    localizer = request.localizer
    for member in users:
        message = NEWCONTENT_MESSAGE.format(
            recipient_title=localizer.translate(_(getattr(member, 
                                                        'user_title',''))),
            recipient_first_name=getattr(member, 'first_name', member.name),
            recipient_last_name=getattr(member, 'last_name',''),
            subject_title=content.title,
            subject_url=url,
            subject_type=localizer.translate(
                           _("The " + content.__class__.__name__.lower())),
            novaideo_title=request.root.title
             )
        mailer_send(subject=subject, 
            recipients=[member.email], 
            body=message)
示例#4
0
文件: panels.py 项目: jean/nova-ideo
def group_actions(actions):
    groups = {}
    for action in actions:
        group_id = _('More')
        if action[1].node_definition.groups:
            group_id = action[1].node_definition.groups[0]

        group = groups.get(group_id, None)
        if group:
            group.append(action)
        else:
            groups[group_id] = [action]
 
    for group_id, group in groups.items():
        groups[group_id] = sorted(group, 
                           key=lambda e: getattr(e[1], 'style_order', 0))
    groups = sorted(list(groups.items()), 
                    key=lambda g: getattr(g[1][0][1], 'style_order', 0))
    return groups
示例#5
0
文件: panels.py 项目: jean/nova-ideo
    def _get_step3_informations(self, context, request):
        time_delta = None
        process = context.creator
        wg = context.working_group
        is_closed = 'closed' in wg.state
        user = get_current()
        working_group_states = [_(get_states_mapping(user, wg, s)) \
                                for s in wg.state]
        if any(s in context.state for s in ['proofreading','amendable']):
            date_iteration = process['timer'].eventKind.time_date
            today = datetime.datetime.today()
            if date_iteration is not None and date_iteration > today:
                time_delta = date_iteration - today
                time_delta = days_hours_minutes(time_delta)

            return renderers.render(self.step3_1_template,
                                    {'context':context,
                                     'working_group_states': working_group_states,
                                     'is_closed': is_closed,
                                     'duration':time_delta,
                                     'process': process},
                                    request)
        elif 'votes for publishing'  in context.state:
            ballot = process.vp_ballot
            today = datetime.datetime.today()
            if ballot.finished_at is not None and ballot.finished_at > today:
                time_delta = ballot.finished_at - today
                time_delta = days_hours_minutes(time_delta)

            return renderers.render(self.step3_3_template,
                                    {'context': context, 
                                     'working_group_states': working_group_states,
                                     'is_closed': is_closed,
                                     'duration': time_delta,
                                     'process': process,
                                     'ballot_report': ballot.report},
                                    request)
        elif 'votes for amendments'  in context.state:
            voters = []
            [voters.extend(b.report.voters) \
            for b in process.amendments_ballots]
            voters = list(set(voters))
            ballot = process.amendments_ballots[-1]
            today = datetime.datetime.today()
            if ballot.finished_at is not None and ballot.finished_at > today:
                time_delta = ballot.finished_at - today
                time_delta = days_hours_minutes(time_delta)

            return renderers.render(self.step3_2_template,
                                    {'context':context,
                                     'working_group_states': working_group_states,
                                     'is_closed': is_closed,
                                     'duration':time_delta,
                                     'process': process,
                                     'ballot_report': ballot.report,
                                     'voters': voters},
                                    request)
        elif 'open to a working group'  in context.state:
            return renderers.render(self.step3_0_template,
                                   {'context':context, 
                                    'process': process,
                                    'min_members': getSite().participants_mini},
                                   request)

        return _('No more Information.')
示例#6
0
# Copyright (c) 2014 by Ecreall under licence AGPL terms 
# avalaible on http://www.gnu.org/licenses/agpl.html 

# licence: AGPL
# author: Amen Souissi

from dace.objectofcollaboration.principal.util import has_role

from novaideo.content.proposal import Proposal
from novaideo.content.amendment import Amendment
from novaideo.core import _


STATES_PARTICIPANT_MAPPING = {
         #Commun
	    'draft': {Amendment:_('In preparation'),
	              'default': _('Draft')},
	    #state by context. 'default' key is required!
	    'published': {Proposal:_('Submitted'),
	                  Amendment:_('Submitted'),
	                  'default': _('Published')},
	    'archived': _('Archived'),
        #Amendment
	    'explanation': _('Explanation'),
	    #Ideas
	    'to work': _('To work'),
	    #Proposal
	    'open to a working group': _('Open to a working group'),
	    'votes for publishing': _('Votes for publishing'),
	    'votes for amendments': _('Votes for amendments'),
	    'proofreading': _('Proofreading'),
示例#7
0
# Copyright (c) 2014 by Ecreall under licence AGPL terms 
# avalaible on http://www.gnu.org/licenses/agpl.html 

# licence: AGPL
# author: Amen Souissi

from novaideo.core import _


AMENDMENTS_CYCLE_DEFAULT_DURATION = [
              _("Three minutes"),
              _("Five minutes"),
              _("Ten minutes"),
              _("Twenty minutes"),
              _("One hour"),
              _("Four hours"),
              _("One day"),
              _("Three days"),
              _("One week"),
              _("Two weeks")]

示例#8
0
文件: util.py 项目: jean/nova-ideo

def get_users_by_keywords(keywords):
    novaideo_catalog = find_catalog('novaideo')
    dace_catalog = find_catalog('dace')
    keywords_index = novaideo_catalog['object_keywords']
    object_provides_index = dace_catalog['object_provides']
    states_index = dace_catalog['object_states']
    #query
    query = keywords_index.any(keywords) & \
            object_provides_index.any(IPerson.__identifier__) & \
            states_index.notany(('deactivated',))
    return query.execute().all()


_CONTENT_TRANSLATION = [_("The proposal"),
                        _("The idea")]


def send_alert_new_content(content):
    keywords = content.keywords
    request = get_current_request()
    users = get_users_by_keywords([k.lower() for k in keywords])
    url = request.resource_url(content, "@@index")
    subject = NEWCONTENT_SUBJECT.format(subject_title=content.title)
    localizer = request.localizer
    for member in users:
        message = NEWCONTENT_MESSAGE.format(
            recipient_title=localizer.translate(_(getattr(member, 
                                                        'user_title',''))),
            recipient_first_name=getattr(member, 'first_name', member.name),
示例#9
0
# licence: AGPL
# author: Amen Souissi

import venusian
import datetime

from dace.objectofcollaboration.entity import Entity
from dace.util import getSite

from novaideo.content.ballot import Ballot
from novaideo.core import _
from novaideo.utilities.alerts_utility import alert
from novaideo.content.alert import InternalAlertKind

AMENDMENTS_CYCLE_DEFAULT_DURATION_T = [
    _("Three minutes"),
    _("Five minutes"),
    _("Ten minutes"),
    _("Twenty minutes"),
    _("One hour"),
    _("Four hours"),
    _("One day"),
    _("Three days"),
    _("One week"),
    _("Two weeks")
]

WORK_MODES = {}

FIRST_VOTE_DURATION_MESSAGE = _(
    "You have decided to join the working group. Your first decision is to vote "
示例#10
0
# author: Amen Souissi

import venusian
import datetime

from dace.objectofcollaboration.entity import Entity
from dace.util import getSite

from novaideo.content.ballot import Ballot
from novaideo.core import _
from novaideo.utilities.alerts_utility import alert
from novaideo.content.alert import InternalAlertKind


AMENDMENTS_CYCLE_DEFAULT_DURATION_T = [
    _("Three minutes"),
    _("Five minutes"),
    _("Ten minutes"),
    _("Twenty minutes"),
    _("One hour"),
    _("Four hours"),
    _("One day"),
    _("Three days"),
    _("One week"),
    _("Two weeks")]


WORK_MODES = {}


FIRST_VOTE_DURATION_MESSAGE = _(