Exemplo n.º 1
0
 def _edit_add_args(self, xfer, obj_kind):
     args = self.item.get_args()
     arg = XferCompCheck('args_multi')
     arg.set_value(args['multi'])
     arg.set_location(obj_kind.col, obj_kind.row + 1, obj_kind.colspan, 1)
     arg.description = _('multi-line')
     xfer.add_component(arg)
     arg = XferCompFloat('args_min', -10000, 10000, 0)
     arg.set_value(args['min'])
     arg.set_location(obj_kind.col, obj_kind.row + 2, obj_kind.colspan, 1)
     arg.description = _('min')
     xfer.add_component(arg)
     arg = XferCompFloat('args_max', -10000, 10000, 0)
     arg.set_value(args['max'])
     arg.set_location(obj_kind.col, obj_kind.row + 3, obj_kind.colspan, 1)
     arg.description = _('max')
     xfer.add_component(arg)
     arg = XferCompFloat('args_prec', 0, 10, 0)
     arg.set_value(args['prec'])
     arg.set_location(obj_kind.col, obj_kind.row + 4, obj_kind.colspan, 1)
     arg.description = _('precision')
     xfer.add_component(arg)
     arg = XferCompEdit('args_list')
     arg.set_value(','.join(args['list']))
     arg.set_location(obj_kind.col, obj_kind.row + 5, obj_kind.colspan, 1)
     arg.description = _('list')
     xfer.add_component(arg)
Exemplo n.º 2
0
 def _edit_add_args(self, xfer, obj_kind):
     args = self.item.get_args()
     arg = XferCompCheck('args_multi')
     arg.set_value(args['multi'])
     arg.set_location(obj_kind.col, obj_kind.row + 1, obj_kind.colspan, 1)
     arg.description = _('multi-line')
     xfer.add_component(arg)
     arg = XferCompFloat('args_min', -10000, 10000, 0)
     arg.set_value(args['min'])
     arg.set_location(obj_kind.col, obj_kind.row + 2, obj_kind.colspan, 1)
     arg.description = _('min')
     xfer.add_component(arg)
     arg = XferCompFloat('args_max', -10000, 10000, 0)
     arg.set_value(args['max'])
     arg.set_location(obj_kind.col, obj_kind.row + 3, obj_kind.colspan, 1)
     arg.description = _('max')
     xfer.add_component(arg)
     arg = XferCompFloat('args_prec', 0, 10, 0)
     arg.set_value(args['prec'])
     arg.set_location(obj_kind.col, obj_kind.row + 4, obj_kind.colspan, 1)
     arg.description = _('precision')
     xfer.add_component(arg)
     arg = XferCompEdit('args_list')
     arg.set_value(','.join(args['list']))
     arg.set_location(obj_kind.col, obj_kind.row + 5, obj_kind.colspan, 1)
     arg.description = _('list')
     xfer.add_component(arg)
Exemplo n.º 3
0
    def edit(self, xfer):
        if self.item.id is not None:
            xfer.change_to_readonly('username')
            obj_username = xfer.get_components('username')
            xfer.filltab_from_model(obj_username.col - 1, obj_username.row + 1,
                                    True, ['date_joined', 'last_login'])
        xfer.change_to_readonly('is_active')
        obj_email = xfer.get_components('email')
        xfer.tab = obj_email.tab
        new_row = obj_email.row
        ckk = XferCompCheck('password_change')
        ckk.set_location(0, new_row + 1, 1, 1)
        ckk.set_value(True)
        ckk.description = _("To change password?")
        ckk.java_script = """
var pwd_change=current.getValue();
parent.get('password1').setEnabled(pwd_change);
parent.get('password2').setEnabled(pwd_change);
"""
        xfer.add_component(ckk)

        pwd1 = XferCompPassword('password1')
        pwd1.set_location(0, new_row + 2, 1, 1)
        pwd1.empty = 1
        pwd1.description = _("password")
        xfer.add_component(pwd1)
        pwd2 = XferCompPassword('password2')
        pwd2.set_location(0, new_row + 3, 1, 1)
        pwd2.empty = 1
        pwd2.description = _("password (again)")
        xfer.add_component(pwd2)
        if Signal.call_signal("send_connection", None, None, None) > 0:
            ckkg = XferCompCheck('password_generate')
            ckkg.set_location(0, new_row + 4)
            ckkg.description = _("Generate new password?")
            ckkg.set_value(False)
            ckkg.java_script = """
    var pwd_change=current.getValue();
    parent.get('password_change').setEnabled(!pwd_change);
    parent.get('password1').setEnabled(!pwd_change);
    parent.get('password2').setEnabled(!pwd_change);
    """
            xfer.add_component(ckkg)
        if xfer.getparam("IDENT_READ") is not None:
            xfer.change_to_readonly('first_name')
            xfer.change_to_readonly('last_name')
            xfer.change_to_readonly('email')
        return LucteriosEditor.edit(self, xfer)
Exemplo n.º 4
0
    def fillresponse(self, show_only_failed=False):
        img = XferCompImage('img')
        img.set_value(self.icon_path())
        img.set_location(0, 0, 1, 6)
        self.add_component(img)
        begin = XferCompLabelForm('title')
        begin.set_location(1, 0, 2)
        begin.set_value_as_title(_('Transmission report'))
        self.add_component(begin)

        self.filltab_from_model(1, 1, True,
                                [((_('date begin of send'), 'date_begin'),
                                  (_('date end of send'), 'date_end')),
                                 ('emailsent_set', )])
        if not show_only_failed:
            grid = self.get_components('emailsent')
            grid.delete_header('error')

        check = XferCompCheck('show_only_failed')
        check.set_value(show_only_failed)
        check.description = _('Show only failed')
        check.set_location(1, 3, 2)
        check.set_action(self.request,
                         self.get_action(),
                         modal=FORMTYPE_REFRESH,
                         close=CLOSE_NO)
        self.add_component(check)

        show_only_failed
        self.add_action(WrapAction(_('Close'), 'images/close.png'))
Exemplo n.º 5
0
    def edit(self, xfer):
        if self.item.id is not None:
            xfer.change_to_readonly('username')
            obj_username = xfer.get_components('username')
            xfer.filltab_from_model(obj_username.col - 1, obj_username.row + 1, True, ['date_joined', 'last_login'])
        xfer.change_to_readonly('is_active')
        obj_email = xfer.get_components('email')
        xfer.tab = obj_email.tab
        new_row = obj_email.row
        ckk = XferCompCheck('password_change')
        ckk.set_location(0, new_row + 1, 1, 1)
        ckk.set_value(True)
        ckk.description = _("To change password?")
        ckk.java_script = """
var pwd_change=current.getValue();
parent.get('password1').setEnabled(pwd_change);
parent.get('password2').setEnabled(pwd_change);
"""
        xfer.add_component(ckk)

        pwd1 = XferCompPassword('password1')
        pwd1.set_location(0, new_row + 2, 1, 1)
        pwd1.empty = 1
        pwd1.description = _("password")
        xfer.add_component(pwd1)
        pwd2 = XferCompPassword('password2')
        pwd2.set_location(0, new_row + 3, 1, 1)
        pwd2.empty = 1
        pwd2.description = _("password (again)")
        xfer.add_component(pwd2)
        if Signal.call_signal("send_connection", None, None, None) > 0:
            ckkg = XferCompCheck('password_generate')
            ckkg.set_location(0, new_row + 4)
            ckkg.description = _("Generate new password?")
            ckkg.set_value(False)
            ckkg.java_script = """
    var pwd_change=current.getValue();
    parent.get('password_change').setEnabled(!pwd_change);
    parent.get('password1').setEnabled(!pwd_change);
    parent.get('password2').setEnabled(!pwd_change);
    """
            xfer.add_component(ckkg)
        if xfer.getparam("IDENT_READ") is not None:
            xfer.change_to_readonly('first_name')
            xfer.change_to_readonly('last_name')
            xfer.change_to_readonly('email')
        return LucteriosEditor.edit(self, xfer)
Exemplo n.º 6
0
 def fillresponse(self):
     XferListEditor.fillresponse(self)
     chk = XferCompCheck('show_inactive')
     chk.set_value(self.getparam('show_inactive', False))
     chk.description = _('Show all class load')
     chk.set_location(0, self.get_max_row() + 1)
     chk.set_action(self.request, self.get_action(), close=CLOSE_NO, modal=FORMTYPE_REFRESH)
     self.add_component(chk)
Exemplo n.º 7
0
    def _get_from_selector(self):
        if not isinstance(self.selector, list) and (self.selector is not None):
            raise LucteriosException(GRAVE, "Error of print selector!")
        gui = XferContainerCustom()
        gui.model = self.model
        gui._initialize(self.request)
        gui.is_view_right = self.is_view_right
        gui.caption = self.caption
        gui.extension = self.extension
        gui.action = self.action
        gui.params = self.params
        pdfreport = self.get_persistent_pdfreport()
        if (pdfreport is not None) and (not isinstance(pdfreport, list)
                                        or len(pdfreport) == len(self.items)):
            presitent_report = XferCompCheck('PRINT_PERSITENT')
            presitent_report.set_value(True)
            presitent_report.set_location(0, 0, 2)
            presitent_report.description = _('Get saved report')
            presitent_report.java_script = """
var is_persitent=current.getValue();
parent.get('PRINT_MODE').setEnabled(!is_persitent);
parent.get('print_sep').setEnabled(!is_persitent);
"""
            if self.selector is not None:
                for name_selector, _selector, _selector in self.selector:
                    presitent_report.java_script += "parent.get('%s').setEnabled(!is_persitent);\n" % name_selector
            gui.add_component(presitent_report)
            sep = XferCompLabelForm('print_sep')
            sep.set_value_center(self.PRINT_REGENERATE_MSG)
            sep.set_location(0, 1, 2)
            gui.add_component(sep)
        elif (pdfreport is not None):
            sep = XferCompLabelForm('print_sep')
            sep.set_value_center(self.PRINT_WARNING_SAVING_MSG)
            sep.set_location(0, 1, 2)
            gui.add_component(sep)

        print_mode = XferCompSelect('PRINT_MODE')
        print_mode.set_select(self.print_selector)
        print_mode.set_value(PRINT_PDF_FILE)
        print_mode.set_location(0, 2, 2)
        print_mode.description = _('Kind of report')
        gui.add_component(print_mode)
        if self.selector is not None:
            self._add_option_selectors(gui)
        gui.add_action(self.return_action(_("Print"), "images/print.png"),
                       modal=FORMTYPE_MODAL,
                       close=CLOSE_YES)
        gui.add_action(WrapAction(_("Close"), "images/close.png"))
        return gui
Exemplo n.º 8
0
 def fillresponse_body(self):
     if Params.getvalue("member-age-enable") == 1:
         self.new_tab(_('Age'))
         self.fill_grid(0, Age, "age", Age.objects.all())
     if Params.getvalue("member-team-enable") == 1:
         show_only_enabled_team = self.getparam('show_only_enabled_team',
                                                True)
         self.new_tab(Params.getvalue("member-team-text"))
         if show_only_enabled_team:
             team_list = Team.objects.filter(unactive=False)
         else:
             team_list = Team.objects.all()
         self.fill_grid(0, Team, "team", team_list)
         if show_only_enabled_team:
             grid = self.get_components('team')
             grid.delete_header('unactive')
         check = XferCompCheck('show_only_enabled_team')
         check.set_location(0, 2)
         check.set_value(show_only_enabled_team)
         check.description = _('show only enabled team')
         check.set_action(self.request,
                          self.get_action(),
                          modal=FORMTYPE_REFRESH,
                          close=CLOSE_NO)
         self.add_component(check)
     if Params.getvalue("member-activite-enable") == 1:
         self.new_tab(Params.getvalue("member-activite-text"))
         self.fill_grid(0, Activity, "activity", Activity.objects.all())
         grid = self.get_components("activity")
         if WrapAction.is_permission(self.request, 'CORE.add_parameter'):
             grid.add_action(self.request,
                             ObjectMerge.get_action(_("Merge"),
                                                    "images/clone.png"),
                             close=CLOSE_NO,
                             unique=SELECT_MULTI,
                             params={
                                 'modelname': 'member.Activity',
                                 'field_id': 'activity'
                             })
         if hasattr(settings, "DIACAMMA_MAXACTIVITY") and (getattr(
                 settings, "DIACAMMA_MAXACTIVITY") <= grid.nb_lines):
             lbl = XferCompLabelForm("limit_activity")
             lbl.set_color('red')
             lbl.set_value_as_headername(
                 _('You have the maximum of activities!'))
             lbl.set_location(grid.col, self.get_max_row() + 1)
             self.add_component(lbl)
             grid.delete_action("diacamma.member/activityAddModify", True)
Exemplo n.º 9
0
    def fillresponse(self, show_only_failed=False):
        img = XferCompImage('img')
        img.set_value(self.icon_path())
        img.set_location(0, 0, 1, 6)
        self.add_component(img)
        begin = XferCompLabelForm('title')
        begin.set_location(1, 0, 2)
        begin.set_value_as_title(_('Transmission report'))
        self.add_component(begin)

        self.filltab_from_model(1, 1, True, [((_('date begin of send'), 'date_begin'), (_('date end of send'), 'date_end')), ('emailsent_set',)])
        if not show_only_failed:
            grid = self.get_components('emailsent')
            grid.delete_header('error')

        check = XferCompCheck('show_only_failed')
        check.set_value(show_only_failed)
        check.description = _('Show only failed')
        check.set_location(1, 3, 2)
        check.set_action(self.request, self.get_action(), modal=FORMTYPE_REFRESH, close=CLOSE_NO)
        self.add_component(check)

        show_only_failed
        self.add_action(WrapAction(_('Close'), 'images/close.png'))
Exemplo n.º 10
0
    def show(self, xfer):
        IndividualEditor.show(self, xfer)
        if xfer.getparam('adherent') is None:
            xfer.params['adherent'] = xfer.getparam('individual', 0)
        if xfer.getparam('individual') is None:
            xfer.params['individual'] = xfer.getparam('adherent', 0)
        img = xfer.get_components('img')
        img.set_value(get_icon_path("diacamma.member/images/adherent.png"))

        if Params.getobject("member-family-type") is not None:
            xfer.tab = 1
            row_init = xfer.get_max_row() + 1
            lbl = XferCompLabelForm("family")
            current_family = self.item.family
            if current_family is None:
                lbl.set_value(None)
            else:
                lbl.set_value(six.text_type(self.item.family))
            lbl.set_location(1, row_init, 2)
            lbl.description = _('family')
            xfer.add_component(lbl)
            btn = XferCompButton('famillybtn')
            btn.is_mini = True
            btn.set_location(3, row_init)
            if current_family is None:
                act = ActionsManage.get_action_url('member.Adherent',
                                                   'FamilyAdd', xfer)
                act.set_value("", "images/add.png")
                btn.set_action(xfer.request,
                               act,
                               modal=FORMTYPE_MODAL,
                               close=CLOSE_NO)
            else:
                act = ActionsManage.get_action_url('contacts.LegalEntity',
                                                   'Show', xfer)
                act.set_value("", "images/edit.png")
                btn.set_action(
                    xfer.request,
                    act,
                    modal=FORMTYPE_MODAL,
                    close=CLOSE_NO,
                    params={'legal_entity': six.text_type(current_family.id)})
            xfer.add_component(btn)

        if xfer.item.current_subscription is not None:
            xfer.tab = 1
            row_init = xfer.get_max_row() + 1
            row = row_init + 1
            for doc in xfer.item.current_subscription.docadherent_set.all():
                ckc = XferCompCheck("doc_%d" % doc.id)
                ckc.set_value(doc.value)
                ckc.set_location(2, row)
                ckc.description = six.text_type(doc.document)
                xfer.add_component(ckc)
                row += 1
            if row != row_init + 1:
                lbl = XferCompLabelForm("lbl_doc_sep")
                lbl.set_value("{[hr/]}")
                lbl.set_location(1, row_init, 4)
                xfer.add_component(lbl)
                lbl = XferCompLabelForm("lbl_doc")
                lbl.set_value_as_name(_('documents needs'))
                lbl.set_location(1, row_init + 1)
                xfer.add_component(lbl)
                btn = XferCompButton("btn_doc")
                btn.set_location(4, row_init + 1, 1, row - row_init)
                btn.set_action(xfer.request,
                               ActionsManage.get_action_url(
                                   "member.Adherent", "Doc", xfer),
                               close=CLOSE_NO)
                xfer.add_component(btn)
Exemplo n.º 11
0
    def _get_from_selector(self):
        if not isinstance(self.selector, list) and (self.selector is not None):
            raise LucteriosException(GRAVE, "Error of print selector!")
        gui = XferContainerCustom()
        gui.model = self.model
        gui._initialize(self.request)
        gui.is_view_right = self.is_view_right
        gui.caption = self.caption
        gui.extension = self.extension
        gui.action = self.action
        gui.params = self.params
        pdfreport = self.get_persistent_pdfreport()
        if (pdfreport is not None) and (not isinstance(pdfreport, list)
                                        or len(pdfreport) == len(self.items)):
            presitent_report = XferCompCheck('PRINT_PERSITENT')
            presitent_report.set_value(True)
            presitent_report.set_location(0, 0, 2)
            presitent_report.description = _('Get saved report')
            presitent_report.java_script = """
var is_persitent=current.getValue();
parent.get('PRINT_MODE').setEnabled(!is_persitent);
parent.get('print_sep').setEnabled(!is_persitent);
"""
            if self.selector is not None:
                for name_selector, _selector, _selector in self.selector:
                    presitent_report.java_script += "parent.get('%s').setEnabled(!is_persitent);\n" % name_selector
            gui.add_component(presitent_report)
            sep = XferCompLabelForm('print_sep')
            sep.set_value_center(self.PRINT_REGENERATE_MSG)
            sep.set_location(0, 1, 2)
            gui.add_component(sep)
        elif (pdfreport is not None):
            sep = XferCompLabelForm('print_sep')
            sep.set_value_center(self.PRINT_WARNING_SAVING_MSG)
            sep.set_location(0, 1, 2)
            gui.add_component(sep)

        print_mode = XferCompSelect('PRINT_MODE')
        print_mode.set_select(self.print_selector)
        print_mode.set_value(PRINT_PDF_FILE)
        print_mode.set_location(0, 2, 2)
        print_mode.description = _('Kind of report')
        gui.add_component(print_mode)
        if self.selector is not None:
            row_idx = 3
            for name_selector, title_selector, option_selector in self.selector:
                if isinstance(option_selector, list):
                    comp = XferCompSelect(name_selector)
                    comp.set_select(option_selector)
                    comp.set_value(gui.getparam(name_selector, 0))
                elif isinstance(option_selector, tuple):
                    comp = XferCompFloat(name_selector, option_selector[0],
                                         option_selector[1],
                                         option_selector[2])
                    comp.set_value(option_selector[0])
                elif isinstance(option_selector, six.binary_type):
                    comp = XferCompEdit(name_selector)
                    comp.set_value(option_selector.decode())
                elif isinstance(option_selector, six.text_type):
                    comp = XferCompMemo(name_selector)
                    comp.with_hypertext = True
                    comp.set_value(option_selector)
                elif isinstance(option_selector, bool):
                    comp = XferCompCheck(name_selector)
                    comp.set_value(option_selector)
                else:
                    comp = None
                if comp is not None:
                    comp.set_location(0, row_idx, 2)
                    comp.description = title_selector
                    gui.add_component(comp)
                    row_idx += 1
        gui.add_action(self.get_action(_("Print"), "images/print.png"),
                       modal=FORMTYPE_MODAL,
                       close=CLOSE_YES)
        gui.add_action(WrapAction(_("Close"), "images/close.png"))
        return gui