示例#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)
示例#2
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'))
示例#3
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)
示例#4
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)
示例#5
0
 def fillresponse_header(self):
     all_cost = self.getparam('all_cost', False)
     sel = XferCompCheck("all_cost")
     sel.set_value(all_cost)
     sel.set_location(1, 3)
     sel.set_action(self.request, self.get_action(), modal=FORMTYPE_REFRESH, close=CLOSE_NO)
     self.add_component(sel)
     lbl = XferCompLabelForm("all_costLbl")
     lbl.set_location(2, 3)
     lbl.set_value_as_name(_("Show all cost accounting"))
     self.add_component(lbl)
     if not all_cost:
         self.filter = Q(status=0)
示例#6
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
示例#7
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)
示例#8
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)
示例#9
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)
示例#10
0
文件: views.py 项目: Diacamma2/asso
 def fillresponse(self, send_email=True):
     cmd_manager = CommandManager(self.getparam('CMD_FILE', ''), self.items)
     if self.getparam('SAVE') is None:
         dlg = self.create_custom(self.model)
         img = XferCompImage('img')
         img.set_value(self.icon_path())
         img.set_location(0, 0, 1, 4)
         dlg.add_component(img)
         lab = XferCompLabelForm('lbl_title')
         lab.set_value_as_title(self.caption)
         lab.set_location(1, 0, 2)
         dlg.add_component(lab)
         grid = XferCompGrid('AdhCmd')
         for fname, ftitle in cmd_manager.get_fields():
             grid.add_header(fname, ftitle)
         for cmd_id, cmd_item in cmd_manager.get_content_txt():
             for head_name, value in cmd_item.items():
                 grid.set_value(cmd_id, head_name, value)
         grid.set_location(1, 2, 2)
         grid.add_action(self.request, AdherentCommandModify.get_action(TITLE_MODIFY, "images/edit.png"), close=CLOSE_NO, unique=SELECT_SINGLE)
         grid.add_action(self.request, AdherentCommandDelete.get_action(TITLE_DELETE, "images/delete.png"), close=CLOSE_NO, unique=SELECT_SINGLE)
         dlg.params['CMD_FILE'] = cmd_manager.file_name
         dlg.add_component(grid)
         if len(grid.records) > 0:
             lab = XferCompLabelForm('lbl_send_email')
             lab.set_value_as_name(_('Send quotition by email for each adherent.'))
             lab.set_location(1, 3)
             dlg.add_component(lab)
             chk = XferCompCheck('send_email')
             chk.set_value(send_email)
             chk.set_location(2, 3)
             dlg.add_component(chk)
             dlg.add_action(AdherentCommand.get_action(TITLE_OK, "images/ok.png"), close=CLOSE_YES, params={'SAVE': 'YES'})
         dlg.add_action(WrapAction(TITLE_CLOSE, 'images/close.png'))
     else:
         dateref = convert_date(self.getparam("dateref", ""), Season.current_season().date_ref)
         if send_email:
             param_email = self.request.META.get('HTTP_REFERER', self.request.build_absolute_uri()), self.language
         else:
             param_email = None
         nb_sub, nb_bill = cmd_manager.create_subscription(dateref, param_email)
         if send_email:
             msg = _('%(nbsub)d new subscription and %(nbbill)d quotation have been sent.') % {'nbsub': nb_sub, 'nbbill': nb_bill}
         else:
             msg = _('%d new subscription have been prepared.') % nb_sub
         self.message(msg)
示例#11
0
 def fill_dlg_payoff(self, withpayoff):
     dlg = self.create_custom(Payoff)
     dlg.caption = _("Valid bill")
     icon = XferCompImage('img')
     icon.set_location(0, 0, 1, 6)
     icon.set_value(self.icon_path())
     dlg.add_component(icon)
     lbl = XferCompLabelForm('lb_title')
     lbl.set_value_as_infocenter(_("Do you want validate '%s'?") % self.item)
     lbl.set_location(1, 1, 4)
     dlg.add_component(lbl)
     check_payoff = XferCompCheck('withpayoff')
     check_payoff.set_value(withpayoff)
     check_payoff.set_location(1, 2)
     check_payoff.java_script = """
 var type=current.getValue();
 parent.get('date_payoff').setEnabled(type);
 parent.get('amount').setEnabled(type);
 parent.get('payer').setEnabled(type);
 parent.get('mode').setEnabled(type);
 parent.get('reference').setEnabled(type);
 if (parent.get('bank_account')) {
     parent.get('bank_account').setEnabled(type);
 }
 """
     dlg.add_component(check_payoff)
     lbl = XferCompLabelForm('lb_withpayoff')
     lbl.set_value_as_name(_("Payment of deposit or cash"))
     lbl.set_location(2, 2)
     dlg.add_component(lbl)
     dlg.item.supporting = self.item
     dlg.fill_from_model(2, 3, False)
     if dlg.get_components("bank_fee") is not None:
         check_payoff.java_script += "parent.get('bank_fee').setEnabled(type);\n"
     dlg.get_components("date").name = "date_payoff"
     dlg.get_components("mode").set_action(self.request, self.get_action(), close=CLOSE_NO, modal=FORMTYPE_REFRESH)
     dlg.add_action(self.get_action(TITLE_OK, 'images/ok.png'), params={"CONFIRME": "YES"})
     dlg.add_action(WrapAction(TITLE_CANCEL, 'images/cancel.png'))
示例#12
0
文件: editors.py 项目: Diacamma2/asso
    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 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():
                lbl = XferCompLabelForm("lbl_doc_%d" % doc.id)
                lbl.set_value(six.text_type(doc.document))
                lbl.set_location(2, row)
                xfer.add_component(lbl)
                ckc = XferCompCheck("doc_%d" % doc.id)
                ckc.set_value(doc.value)
                ckc.set_location(3, row)
                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)
示例#13
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'))
示例#14
0
文件: views.py 项目: Lucterios2/core
    def fillresponse(self, edt1='aaa', flt1=3.1399999, mm1='xyz', dt1='2007-04-23', tm1='12:34:00',
                     ck1=False, slct1='1', flt2=5, cl1=['1', '2'], cl2=['b', 'd', 'f'], stm1='2008-07-12 23:47:31'):
        act_modif = self.get_action('Modify', '')

        lbl = XferCompLabelForm('Lbl2')
        lbl.set_value('editor=' + six.text_type(edt1))
        lbl.set_location(0, 1)
        self.add_component(lbl)
        edt = XferCompEdit('edt1')
        edt.set_value(edt1)

        edt.set_action(self.request, act_modif, modal=FORMTYPE_REFRESH, close=CLOSE_NO)
        edt.set_location(1, 1)

        self.add_component(edt)

        lbl = XferCompLabelForm('Lbl3')
        lbl.set_value('Real=' + six.text_type(flt1))
        lbl.set_location(0, 2)
        self.add_component(lbl)
        flt = XferCompFloat('flt1')
        flt.set_value(flt1)
        flt.set_action(self.request, act_modif, modal=FORMTYPE_REFRESH, close=CLOSE_NO)
        flt.set_location(1, 2)
        self.add_component(flt)

        lbl = XferCompLabelForm('Lbl4')
        lbl.set_value('Memo=' + six.text_type(mm1))
        lbl.set_location(0, 3)
        self.add_component(lbl)
        cmm = XferCompMemo('mm1')
        cmm.set_value(mm1)
        cmm.set_action(self.request, act_modif, modal=FORMTYPE_REFRESH, close=CLOSE_NO)
        cmm.add_sub_menu('Première valeur', 'VALUE_1')
        cmm.add_sub_menu('Deuxième valeur', 'VALUE_2')
        cmm.add_sub_menu('Troisième valeur', 'VALUE_3')
        cmm.set_location(1, 3)
        self.add_component(cmm)

        lbl = XferCompLabelForm('Lbl5')
        lbl.set_value('Date=' + six.text_type(dt1))
        lbl.set_location(0, 4)
        self.add_component(lbl)
        date = XferCompDate('dt1')
        date.set_value(dt1)
        date.set_action(self.request, act_modif, modal=FORMTYPE_REFRESH, close=CLOSE_NO)
        date.set_location(1, 4)
        self.add_component(date)

        lbl = XferCompLabelForm('Lbl6')
        lbl.set_value('Hour=' + six.text_type(tm1))
        lbl.set_location(0, 5)
        self.add_component(lbl)
        time = XferCompTime('tm1')
        time.set_value(tm1)
        time.set_action(self.request, act_modif, modal=FORMTYPE_REFRESH, close=CLOSE_NO)
        time.set_location(1, 5)
        self.add_component(time)

        lbl = XferCompLabelForm('Lbl7')
        lbl.set_value('Date Hour=' + six.text_type(stm1))
        lbl.set_location(0, 6)
        self.add_component(lbl)
        datetime = XferCompDateTime('stm1')
        datetime.set_value(stm1)
        datetime.set_action(self.request, act_modif, modal=FORMTYPE_REFRESH, close=CLOSE_NO)
        datetime.set_location(1, 6)
        self.add_component(datetime)

        lbl = XferCompLabelForm('Lbl8')
        lbl.set_value('Coche=' + six.text_type(ck1))
        lbl.set_location(0, 7)
        self.add_component(lbl)
        check = XferCompCheck('ck1')
        check.set_value(ck1)
        check.set_action(self.request, act_modif, modal=FORMTYPE_REFRESH, close=CLOSE_NO)
        check.set_location(1, 7)
        self.add_component(check)

        lbl = XferCompLabelForm('Lbl9')
        lbl.set_value('Select=' + six.text_type(slct1))
        lbl.set_location(0, 8)
        self.add_component(lbl)
        slct = XferCompSelect('slct1')
        if (flt2 is not None) and (flt2 < 2):
            slct.set_select({'1': 'abc', '2': 'def'})
        elif (flt2 is not None) and (flt2 < 10):
            slct.set_select({'1': 'abc', '2': 'def', '3': 'ghij'})
        else:
            slct.set_select({'1': 'abc', '2': 'def', '3': 'ghij', '4': 'klmn'})
        slct.set_value(slct1)
        slct.set_action(self.request, act_modif, modal=FORMTYPE_REFRESH, close=CLOSE_NO)
        slct.set_location(1, 8)
        self.add_component(slct)

        lbl = XferCompLabelForm('Lbl10')
        lbl.set_value('Integer=' + six.text_type(flt2))
        lbl.set_location(0, 9)
        self.add_component(lbl)
        flt = XferCompFloat('flt2', 0, 100, 0)
        flt.set_value(flt2)
        flt.set_action(self.request, act_modif, modal=FORMTYPE_REFRESH, close=CLOSE_NO)
        flt.set_location(1, 9)
        self.add_component(flt)

        lbl = XferCompLabelForm('Lbl11')
        lbl.set_value('CheckList=' + six.text_type(cl1))
        lbl.set_location(0, 10)
        self.add_component(lbl)
        checklist = XferCompCheckList('cl1')
        checklist.set_select(
            {'1': 'abc', '2': 'def', '3': 'ghij', '4': 'klmn'})
        checklist.set_value(cl1)
        checklist.set_action(self.request, act_modif, modal=FORMTYPE_REFRESH, close=CLOSE_NO)
        checklist.set_location(1, 10)
        self.add_component(checklist)

        lbl = XferCompLabelForm('Lbl12')
        lbl.set_value('CheckList 2=' + six.text_type(cl2))
        lbl.set_location(0, 11)
        self.add_component(lbl)
        checklist = XferCompCheckList('cl2')
        checklist.simple = 2
        checklist.set_select(
            {'a': '123', 'b': '456', 'c': '789', 'd': '147', 'e': '258', 'f': '369'})
        checklist.set_value(cl2)
        checklist.set_action(self.request, act_modif, modal=FORMTYPE_REFRESH, close=CLOSE_NO)
        checklist.set_location(1, 11)
        self.add_component(checklist)

        lbl = XferCompLabelForm('Lbl13')
        lbl.set_value('Bouton')
        lbl.set_location(0, 20)
        self.add_component(lbl)
        btn = XferCompButton('btn1')
        btn.set_action(self.request, act_modif, modal=FORMTYPE_REFRESH, close=CLOSE_NO)
        btn.set_location(1, 20)
        self.add_component(btn)

        self.add_action(WrapAction('Fin', 'images/close.png'), modal=FORMTYPE_MODAL, close=CLOSE_YES)
示例#15
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
示例#16
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)
示例#17
0
    def fillresponse(self,
                     edt1='aaa',
                     flt1=3.1399999,
                     mm1='xyz',
                     dt1='2007-04-23',
                     tm1='12:34:00',
                     ck1=False,
                     slct1='1',
                     flt2=5,
                     cl1=['1', '2'],
                     cl2=['b', 'd', 'f'],
                     stm1='2008-07-12 23:47:31'):
        act_modif = self.return_action('Modify', '')

        lbl = XferCompLabelForm('Lbl2')
        lbl.set_value('editor=' + six.text_type(edt1))
        lbl.set_location(0, 1)
        self.add_component(lbl)
        edt = XferCompEdit('edt1')
        edt.set_value(edt1)

        edt.set_action(self.request,
                       act_modif,
                       modal=FORMTYPE_REFRESH,
                       close=CLOSE_NO)
        edt.set_location(1, 1)

        self.add_component(edt)

        lbl = XferCompLabelForm('Lbl3')
        lbl.set_value('Real=' + six.text_type(flt1))
        lbl.set_location(0, 2)
        self.add_component(lbl)
        flt = XferCompFloat('flt1')
        flt.set_value(flt1)
        flt.set_action(self.request,
                       act_modif,
                       modal=FORMTYPE_REFRESH,
                       close=CLOSE_NO)
        flt.set_location(1, 2)
        self.add_component(flt)

        lbl = XferCompLabelForm('Lbl4')
        lbl.set_value('Memo=' + six.text_type(mm1))
        lbl.set_location(0, 3)
        self.add_component(lbl)
        cmm = XferCompMemo('mm1')
        cmm.set_value(mm1)
        cmm.set_action(self.request,
                       act_modif,
                       modal=FORMTYPE_REFRESH,
                       close=CLOSE_NO)
        cmm.add_sub_menu('Première valeur', 'VALUE_1')
        cmm.add_sub_menu('Deuxième valeur', 'VALUE_2')
        cmm.add_sub_menu('Troisième valeur', 'VALUE_3')
        cmm.set_location(1, 3)
        self.add_component(cmm)

        lbl = XferCompLabelForm('Lbl5')
        lbl.set_value('Date=' + six.text_type(dt1))
        lbl.set_location(0, 4)
        self.add_component(lbl)
        date = XferCompDate('dt1')
        date.set_value(dt1)
        date.set_action(self.request,
                        act_modif,
                        modal=FORMTYPE_REFRESH,
                        close=CLOSE_NO)
        date.set_location(1, 4)
        self.add_component(date)

        lbl = XferCompLabelForm('Lbl6')
        lbl.set_value('Hour=' + six.text_type(tm1))
        lbl.set_location(0, 5)
        self.add_component(lbl)
        time = XferCompTime('tm1')
        time.set_value(tm1)
        time.set_action(self.request,
                        act_modif,
                        modal=FORMTYPE_REFRESH,
                        close=CLOSE_NO)
        time.set_location(1, 5)
        self.add_component(time)

        lbl = XferCompLabelForm('Lbl7')
        lbl.set_value('Date Hour=' + six.text_type(stm1))
        lbl.set_location(0, 6)
        self.add_component(lbl)
        datetime = XferCompDateTime('stm1')
        datetime.set_value(stm1)
        datetime.set_action(self.request,
                            act_modif,
                            modal=FORMTYPE_REFRESH,
                            close=CLOSE_NO)
        datetime.set_location(1, 6)
        self.add_component(datetime)

        lbl = XferCompLabelForm('Lbl8')
        lbl.set_value('Coche=' + six.text_type(ck1))
        lbl.set_location(0, 7)
        self.add_component(lbl)
        check = XferCompCheck('ck1')
        check.set_value(ck1)
        check.set_action(self.request,
                         act_modif,
                         modal=FORMTYPE_REFRESH,
                         close=CLOSE_NO)
        check.set_location(1, 7)
        self.add_component(check)

        lbl = XferCompLabelForm('Lbl9')
        lbl.set_value('Select=' + six.text_type(slct1))
        lbl.set_location(0, 8)
        self.add_component(lbl)
        slct = XferCompSelect('slct1')
        if (flt2 is not None) and (flt2 < 2):
            slct.set_select({'1': 'abc', '2': 'def'})
        elif (flt2 is not None) and (flt2 < 10):
            slct.set_select({'1': 'abc', '2': 'def', '3': 'ghij'})
        else:
            slct.set_select({'1': 'abc', '2': 'def', '3': 'ghij', '4': 'klmn'})
        slct.set_value(slct1)
        slct.set_action(self.request,
                        act_modif,
                        modal=FORMTYPE_REFRESH,
                        close=CLOSE_NO)
        slct.set_location(1, 8)
        self.add_component(slct)

        lbl = XferCompLabelForm('Lbl10')
        lbl.set_value('Integer=' + six.text_type(flt2))
        lbl.set_location(0, 9)
        self.add_component(lbl)
        flt = XferCompFloat('flt2', 0, 100, 0)
        flt.set_value(flt2)
        flt.set_action(self.request,
                       act_modif,
                       modal=FORMTYPE_REFRESH,
                       close=CLOSE_NO)
        flt.set_location(1, 9)
        self.add_component(flt)

        lbl = XferCompLabelForm('Lbl11')
        lbl.set_value('CheckList=' + six.text_type(cl1))
        lbl.set_location(0, 10)
        self.add_component(lbl)
        checklist = XferCompCheckList('cl1')
        checklist.set_select({
            '1': 'abc',
            '2': 'def',
            '3': 'ghij',
            '4': 'klmn'
        })
        checklist.set_value(cl1)
        checklist.set_action(self.request,
                             act_modif,
                             modal=FORMTYPE_REFRESH,
                             close=CLOSE_NO)
        checklist.set_location(1, 10)
        self.add_component(checklist)

        lbl = XferCompLabelForm('Lbl12')
        lbl.set_value('CheckList 2=' + six.text_type(cl2))
        lbl.set_location(0, 11)
        self.add_component(lbl)
        checklist = XferCompCheckList('cl2')
        checklist.simple = 2
        checklist.set_select({
            'a': '123',
            'b': '456',
            'c': '789',
            'd': '147',
            'e': '258',
            'f': '369'
        })
        checklist.set_value(cl2)
        checklist.set_action(self.request,
                             act_modif,
                             modal=FORMTYPE_REFRESH,
                             close=CLOSE_NO)
        checklist.set_location(1, 11)
        self.add_component(checklist)

        lbl = XferCompLabelForm('Lbl13')
        lbl.set_value('Bouton')
        lbl.set_location(0, 20)
        self.add_component(lbl)
        btn = XferCompButton('btn1')
        btn.set_action(self.request,
                       act_modif,
                       modal=FORMTYPE_REFRESH,
                       close=CLOSE_NO)
        btn.set_location(1, 20)
        self.add_component(btn)

        self.add_action(WrapAction('Fin', 'images/close.png'),
                        modal=FORMTYPE_MODAL,
                        close=CLOSE_YES)