Example #1
0
    def test_parameters_float(self):
        param = Parameter.objects.create(
            name='param_float', typeparam=2)
        param.args = "{'Min':20, 'Max':30, 'Prec':2}"
        param.value = '22.25'
        param.save()
        Params.fill(self.xfer, ['param_float'], 1, 1, True)
        Params.fill(self.xfer, ['param_float'], 1, 2, False)
        self.callparam()
        self.assert_count_equal('COMPONENTS/*', 4)
        self.assert_count_equal(
            'COMPONENTS/LABELFORM[@name="lbl_param_float"]', 2)
        self.assert_xml_equal(
            'COMPONENTS/LABELFORM[@name="param_float"]', '22.25')
        self.assert_xml_equal('COMPONENTS/FLOAT[@name="param_float"]', '22.25')
        self.assert_attrib_equal(
            'COMPONENTS/FLOAT[@name="param_float"]', 'min', '20.0')
        self.assert_attrib_equal(
            'COMPONENTS/FLOAT[@name="param_float"]', 'max', '30.0')
        self.assert_attrib_equal(
            'COMPONENTS/FLOAT[@name="param_float"]', 'prec', '2')

        self.factory.xfer = ParamSave()
        self.call(
            '/CORE/paramSave', {'params': 'param_float', 'param_float': '26.87'}, False)
        self.assert_observer('core.acknowledge', 'CORE', 'paramSave')
        self.assertEqual(Params.getvalue('param_float'), 26.87)
Example #2
0
    def fillresponse(self):
        XferContainerCustom.fillresponse(self)
        self.new_tab(_('EMail configuration'))
        img = XferCompImage('img_conf')
        img.set_value(self.icon_path())
        img.set_location(0, 0, 1, 6)
        self.add_component(img)

        conf_params = ['mailing-smtpserver', 'mailing-smtpport',
                       'mailing-smtpsecurity', 'mailing-smtpuser', 'mailing-smtppass',
                       'mailing-delay-batch', 'mailing-nb-by-batch']
        Params.fill(self, conf_params, 1, 1)
        btn = XferCompButton('editparam')
        btn.set_location(3, 1, 1, 5)
        btn.set_action(self.request, ParamEdit.get_action(_('Modify'), 'images/edit.png'), close=CLOSE_NO, params={'params': conf_params})
        self.add_component(btn)
        if will_mail_send():
            btn = XferCompButton('tryemail')
            btn.set_location(1, 10, 2)
            btn.set_action(self.request, SendEmailTry.get_action(_('Send'), ''), close=CLOSE_NO)
            self.add_component(btn)

        self.new_tab(_('Default message'))
        img = XferCompImage('img_msg')
        img.set_value(self.icon_path())
        img.set_location(0, 0, 1, 6)
        self.add_component(img)

        msg_params = ['mailing-msg-connection']
        Params.fill(self, msg_params, 1, 1)
        btn = XferCompButton('editmsg')
        btn.set_location(1, 10, 2)
        btn.set_action(self.request, ParamEdit.get_action(_('Modify'), 'images/edit.png'), close=CLOSE_NO, params={'params': msg_params})
        self.add_component(btn)
Example #3
0
    def fillresponse(self):
        XferContainerCustom.fillresponse(self)
        self.new_tab(_('EMail configuration'))
        img = XferCompImage('img_conf')
        img.set_value(self.icon_path())
        img.set_location(0, 0, 1, 6)
        self.add_component(img)

        conf_params = ['mailing-smtpserver', 'mailing-smtpport',
                       'mailing-smtpsecurity', 'mailing-smtpuser', 'mailing-smtppass',
                       'mailing-dkim-private-path', 'mailing-dkim-selector',
                       'mailing-delay-batch', 'mailing-nb-by-batch']
        Params.fill(self, conf_params, 1, 1)
        btn = XferCompButton('editparam')
        btn.set_location(3, 1, 1, 5)
        btn.set_action(self.request, ParamEdit.get_action(_('Modify'), 'images/edit.png'), close=CLOSE_NO, params={'params': conf_params})
        self.add_component(btn)
        if will_mail_send():
            btn = XferCompButton('tryemail')
            btn.set_location(1, 10, 2)
            btn.set_action(self.request, SendEmailTry.get_action(_('Send'), ''), close=CLOSE_NO)
            self.add_component(btn)

        self.new_tab(_('Default message'))
        img = XferCompImage('img_msg')
        img.set_value(self.icon_path())
        img.set_location(0, 0, 1, 6)
        self.add_component(img)

        msg_params = ['mailing-msg-connection']
        Params.fill(self, msg_params, 1, 1)
        btn = XferCompButton('editmsg')
        btn.set_location(1, 10, 2)
        btn.set_action(self.request, ParamEdit.get_action(_('Modify'), 'images/edit.png'), close=CLOSE_NO, params={'params': msg_params})
        self.add_component(btn)
Example #4
0
    def test_parameters_int(self):
        param = Parameter.objects.create(name='param_int', typeparam=1)
        param.args = "{'Min':5, 'Max':25}"
        param.value = '5'
        param.save()

        Params.fill(self.xfer, ['param_int'], 1, 1, True)
        self.callparam()
        self.assert_count_equal('', 1)
        self.assert_json_equal('LABELFORM', "param_int", '5')

        Params.fill(self.xfer, ['param_int'], 1, 1, False)
        self.callparam()
        self.assert_count_equal('', 1)
        self.assert_json_equal('FLOAT', "param_int", '5')
        self.assert_attrib_equal("param_int", 'min', '5.0')
        self.assert_attrib_equal("param_int", 'max', '25.0')
        self.assert_attrib_equal("param_int", 'prec', '0')

        self.factory.xfer = ParamSave()
        self.calljson('/CORE/paramSave', {
            'params': 'param_int',
            'param_int': '13'
        }, False)
        self.assert_observer('core.acknowledge', 'CORE', 'paramSave')
        self.assertEqual(Params.getvalue('param_int'), 13)
Example #5
0
def fill_params(xfer, param_lists=None, smallbtn=False):
    if param_lists is None:
        param_lists = [
            "member-team-enable", "member-team-text", "member-activite-enable",
            "member-activite-text", "member-age-enable",
            "member-licence-enabled", "member-filter-genre", "member-numero",
            "member-birth", "member-fields", "member-subscription-message"
        ]
    if len(param_lists) >= 3:
        nb_col = 2
    else:
        nb_col = 1
    Params.fill(xfer, param_lists, 1, xfer.get_max_row() + 1, nb_col=nb_col)

    comp_fields = xfer.get_components("member-fields")
    if comp_fields is not None:
        comp_fields.value = "{[br/]}".join([
            six.text_type(fields_title[1])
            for fields_title in Adherent.get_default_fields_title()
        ])

    btn = XferCompButton('editparam')
    btn.set_is_mini(smallbtn)
    btn.set_location(3, xfer.get_max_row() + 1)
    btn.set_action(xfer.request,
                   CategoryParamEdit.get_action(TITLE_MODIFY,
                                                'images/edit.png'),
                   close=CLOSE_NO,
                   params={
                       'params': param_lists,
                       'nb_col': nb_col
                   })
    xfer.add_component(btn)
Example #6
0
    def test_parameters_float(self):
        param = Parameter.objects.create(name='param_float', typeparam=2)
        param.args = "{'Min':20, 'Max':30, 'Prec':2}"
        param.value = '22.25'
        param.save()

        Params.fill(self.xfer, ['param_float'], 1, 1, True)
        self.callparam()
        self.assert_count_equal('', 1)
        self.assert_json_equal('LABELFORM', "param_float", '22.25')

        Params.fill(self.xfer, ['param_float'], 1, 1, False)
        self.callparam()
        self.assert_count_equal('', 1)
        self.assert_json_equal('FLOAT', "param_float", '22.25')
        self.assert_attrib_equal("param_float", 'min', '20.0')
        self.assert_attrib_equal("param_float", 'max', '30.0')
        self.assert_attrib_equal("param_float", 'prec', '2')

        self.factory.xfer = ParamSave()
        self.calljson('/CORE/paramSave', {
            'params': 'param_float',
            'param_float': '26.87'
        }, False)
        self.assert_observer('core.acknowledge', 'CORE', 'paramSave')
        self.assertEqual(Params.getvalue('param_float'), 26.87)
Example #7
0
    def test_parameters_select(self):
        param = Parameter.objects.create(name='param_select', typeparam=4)
        param.args = "{'Enum':4}"
        param.value = '2'
        param.save()

        Params.fill(self.xfer, ['param_select'], 1, 1, True)
        self.callparam()
        self.assert_count_equal('', 1)
        self.assert_json_equal('LABELFORM', "param_select", 'param_select.2')

        Params.fill(self.xfer, ['param_select'], 1, 1, False)
        self.callparam()
        self.assert_count_equal('', 1)
        self.assert_json_equal('SELECT', "param_select", '2')
        self.assert_select_equal(
            "param_select", {
                0: 'param_select.0',
                1: 'param_select.1',
                2: 'param_select.2',
                3: 'param_select.3'
            })

        self.factory.xfer = ParamSave()
        self.calljson('/CORE/paramSave', {
            'params': 'param_select',
            'param_select': '1'
        }, False)
        self.assert_observer('core.acknowledge', 'CORE', 'paramSave')
        self.assertEqual(Params.getvalue('param_select'), 1)
Example #8
0
def conf_wizard_contacts(wizard_ident, xfer):
    if isinstance(wizard_ident, list) and (xfer is None):
        wizard_ident.append(("contacts_current", 5))
        wizard_ident.append(("contacts_params", 40))
        wizard_ident.append(("contacts_responsable", 41))
    elif (xfer is not None) and (wizard_ident == "contacts_current"):
        xfer.add_title(_("Lucterios contacts"), _("Our details"), _('configure our details'))
        xfer.model = LegalEntity
        xfer.item = LegalEntity.objects.get(id=1)
        xfer.fill_from_model(1, xfer.get_max_row() + 1, True, desc_fields=LegalEntity.get_show_fields()[_('001@Identity')])
        xfer.remove_component('structure_type')
        btn = XferCompButton("btnconf")
        btn.set_location(2, xfer.get_max_row() + 1)
        btn.set_is_mini(True)
        btn.set_action(xfer.request, CurrentStructureAddModify.get_action('', "images/edit.png"), close=CLOSE_NO)
        xfer.add_component(btn)
    elif (xfer is not None) and (wizard_ident == "contacts_params"):
        xfer.add_title(_("Lucterios contacts"), _("Contacts configuration"), _('configure your contacts'))
        param_lists = ['contacts-mailtoconfig', 'contacts-createaccount']
        Params.fill(xfer, param_lists, 1, xfer.get_max_row() + 1)
        btn = XferCompButton('editparam')
        btn.set_location(4, xfer.get_max_row())
        btn.set_is_mini(True)
        btn.set_action(xfer.request, ParamEdit.get_action(TITLE_MODIFY, 'images/edit.png'), close=CLOSE_NO,
                       params={'params': param_lists})
        xfer.add_component(btn)
        lbl = XferCompLabelForm("nb_function")
        lbl.set_location(1, xfer.get_max_row() + 1)
        lbl.set_value(TEXT_TOTAL_NUMBER % {'name': Function._meta.verbose_name_plural, 'count': len(Function.objects.all())})
        xfer.add_component(lbl)
        lbl = XferCompLabelForm("nb_structuretype")
        lbl.set_location(1, xfer.get_max_row() + 1)
        lbl.set_value(TEXT_TOTAL_NUMBER % {'name': StructureType._meta.verbose_name_plural, 'count': len(StructureType.objects.all())})
        xfer.add_component(lbl)
        lbl = XferCompLabelForm("nb_customfield")
        lbl.set_location(1, xfer.get_max_row() + 1)
        lbl.set_value(TEXT_TOTAL_NUMBER % {'name': CustomField._meta.verbose_name_plural, 'count': len(CustomField.objects.all())})
        xfer.add_component(lbl)
        btn = XferCompButton("btnconf")
        btn.set_location(4, xfer.get_max_row() - 2, 1, 3)
        btn.set_action(xfer.request, Configuration.get_action(TITLE_MODIFY, "images/edit.png"), close=CLOSE_NO)
        xfer.add_component(btn)

        lbl = XferCompLabelForm("nb_legalentity")
        lbl.set_location(1, xfer.get_max_row() + 1)
        lbl.set_value(TEXT_TOTAL_NUMBER % {'name': LegalEntity._meta.verbose_name_plural, 'count': len(LegalEntity.objects.all())})
        xfer.add_component(lbl)
        lbl = XferCompLabelForm("nb_individual")
        lbl.set_location(1, xfer.get_max_row() + 1)
        lbl.set_value(TEXT_TOTAL_NUMBER % {'name': Individual._meta.verbose_name_plural, 'count': len(Individual.objects.all())})
        xfer.add_component(lbl)
        btn = XferCompButton("btnimport")
        btn.set_location(4, xfer.get_max_row() - 1, 1, 2)
        btn.set_action(xfer.request, ContactImport.get_action(_("Contact import"), "images/add.png"), close=CLOSE_NO, params={'step': 0})
        xfer.add_component(btn)
    elif (xfer is not None) and (wizard_ident == "contacts_responsable"):
        xfer.add_title(_("Lucterios contacts"), _('associates'), _('configure your association'))
        xfer.params['legal_entity'] = 1
        xfer.fill_grid(5, Responsability, "responsability", Responsability.objects.filter(legal_entity_id=1))
Example #9
0
def fill_params(xfer, is_mini=False):
    param_lists = ['payoff-cash-account', 'payoff-bankcharges-account', 'payoff-email-message']
    Params.fill(xfer, param_lists, 1, xfer.get_max_row() + 1)
    btn = XferCompButton('editparam')
    btn.set_is_mini(is_mini)
    btn.set_location(1, xfer.get_max_row() + 1, 2, 1)
    btn.set_action(xfer.request, ParamEdit.get_action(TITLE_MODIFY, 'images/edit.png'), close=CLOSE_NO, params={'params': param_lists})
    xfer.add_component(btn)
Example #10
0
def fill_params(xfer, is_mini=False):
    xfer.params['params'] = ['accounting-devise', 'accounting-devise-iso', 'accounting-devise-prec', 'accounting-sizecode']
    Params.fill(xfer, xfer.params['params'], 1, xfer.get_max_row() + 1)
    btn = XferCompButton('editparam')
    btn.set_is_mini(is_mini)
    btn.set_location(1, xfer.get_max_row() + 1, 2, 1)
    btn.set_action(xfer.request, ParamEdit.get_action(TITLE_MODIFY, 'images/edit.png'), close=CLOSE_NO)
    xfer.add_component(btn)
Example #11
0
def conf_wizard_core(wizard_ident, xfer):
    if isinstance(wizard_ident, list) and (xfer is None):
        wizard_ident.append(("core_home", 0))
        wizard_ident.append(("core_users", 100))
    elif (xfer is not None) and (wizard_ident == "core_home"):
        initial_wizard = Params.getvalue("CORE-Wizard")
        param_wizard = xfer.getparam("CORE-Wizard", initial_wizard)
        if initial_wizard != param_wizard:
            Parameter.change_value("CORE-Wizard", param_wizard)
            Params.clear()
        lbl = XferCompLabelForm('title')
        lbl.set_centered()
        lbl.set_value_as_info(six.text_type(settings.APPLIS_NAME))
        lbl.set_location(0, 3, 6)
        xfer.add_component(lbl)
        lbl = XferCompImage('img')
        lbl.type = 'jpg'
        lbl.set_value(settings.APPLIS_LOGO)
        lbl.set_location(2, 4, 2)
        xfer.add_component(lbl)
        lbl = XferCompLabelForm('home')
        lbl.set_value(_('This wizard will help you to configure this software.'))
        lbl.set_location(0, 5, 6)
        xfer.add_component(lbl)
        Params.fill(xfer, ['CORE-Wizard'], 1, 6, False)
        check = xfer.get_components("CORE-Wizard")
        check.set_action(xfer.request, xfer.get_action(), modal=FORMTYPE_REFRESH, close=CLOSE_NO)
        lbl = XferCompLabelForm('lbl_wizard')
        lbl.set_value_as_name(check.description)
        lbl.set_location(2, 6)
        xfer.add_component(lbl)
        check.description = ""
    elif (xfer is not None) and (wizard_ident == "core_users"):
        xfer.add_title(six.text_type(settings.APPLIS_NAME), _("Groups and users"))
        param_lists = ['CORE-connectmode', 'CORE-Wizard']
        Params.fill(xfer, param_lists, 1, xfer.get_max_row() + 1)
        btn = XferCompButton('editparam')
        btn.set_location(4, xfer.get_max_row())
        btn.set_is_mini(True)
        btn.set_action(xfer.request, ParamEdit.get_action(TITLE_MODIFY, 'images/edit.png'), close=CLOSE_NO,
                       params={'params': param_lists})
        xfer.add_component(btn)
        lbl = XferCompLabelForm("nb_user")
        lbl.set_location(1, xfer.get_max_row() + 1)
        lbl.set_value(TEXT_TOTAL_NUMBER % {'name': LucteriosUser._meta.verbose_name_plural, 'count': len(LucteriosUser.objects.all())})
        xfer.add_component(lbl)
        btn = XferCompButton("btnusers")
        btn.set_location(4, xfer.get_max_row())
        btn.set_action(xfer.request, UsersList.get_action(TITLE_MODIFY, "images/edit.png"), close=CLOSE_NO)
        xfer.add_component(btn)
        lbl = XferCompLabelForm("nb_group")
        lbl.set_location(1, xfer.get_max_row() + 1)
        lbl.set_value(TEXT_TOTAL_NUMBER % {'name': LucteriosGroup._meta.verbose_name_plural, 'count': len(LucteriosGroup.objects.all())})
        xfer.add_component(lbl)
        btn = XferCompButton("btngroups")
        btn.set_location(4, xfer.get_max_row())
        btn.set_action(xfer.request, GroupsList.get_action(TITLE_MODIFY, "images/edit.png"), close=CLOSE_NO)
        xfer.add_component(btn)
Example #12
0
def fill_params(xfer):
    param_lists = ["event-degree-text", "event-subdegree-enable",
                   "event-subdegree-text", "event-comment-text"]
    Params.fill(xfer, param_lists, 1, xfer.get_max_row() + 1, nb_col=1)
    btn = XferCompButton('editparam')
    btn.set_location(1, xfer.get_max_row() + 1, 2, 1)
    btn.set_action(xfer.request, ParamEdit.get_action(TITLE_MODIFY, 'images/edit.png'),
                   close=CLOSE_NO, params={'params': param_lists, 'nb_col': 1})
    xfer.add_component(btn)
Example #13
0
def fill_params(xfer, param_lists=None, is_mini=False):
    if param_lists is None:
        param_lists = ['invoice-vat-mode', 'invoice-default-sell-account',
                       'invoice-vatsell-account', 'invoice-reduce-account', 'invoice-account-third']
    Params.fill(xfer, param_lists, 1, xfer.get_max_row() + 1)
    btn = XferCompButton('editparam')
    btn.set_is_mini(is_mini)
    btn.set_location(1, xfer.get_max_row() + 1, 2, 1)
    btn.set_action(xfer.request, ParamEdit.get_action(TITLE_MODIFY, 'images/edit.png'), close=CLOSE_NO, params={'params': param_lists})
    xfer.add_component(btn)
Example #14
0
def fill_params(self, is_mini=False, new_params=False):
    system_condo = current_system_condo()
    param_lists = system_condo.get_config_params(new_params)
    Params.fill(self, param_lists, 1, self.get_max_row() + 1, nb_col=2)
    btn = XferCompButton('editparam')
    btn.set_location(1, self.get_max_row() + 1, 2, 1)
    btn.set_is_mini(is_mini)
    btn.set_action(self.request, ParamEdit.get_action(TITLE_MODIFY, 'images/edit.png'), close=CLOSE_NO,
                   params={'params': param_lists})
    self.add_component(btn)
Example #15
0
File: views.py Project: povtux/core
 def fillresponse(self, params=(), nb_col=1):
     img_title = XferCompImage('img')
     img_title.set_location(0, 0)
     img_title.set_value(self.icon_path())
     self.add_component(img_title)
     lab = XferCompLabelForm('title')
     lab.set_location(1, 0, 2 * nb_col)
     lab.set_value_as_title(_("Edition of parameters"))
     self.add_component(lab)
     Params.fill(self, params, 1, 1, False, nb_col)
     self.add_action(ParamSave.get_action(_('Ok'), 'images/ok.png'), {})
     self.add_action(WrapAction(_('Cancel'), 'images/cancel.png'), {})
Example #16
0
def fill_params(xfer, param_lists=None, smallbtn=False):
    if param_lists is None:
        param_lists = ["member-team-enable", "member-team-text", "member-activite-enable", "member-activite-text", "member-age-enable",
                       "member-licence-enabled", "member-filter-genre", "member-numero", "member-birth", "member-connection", "member-subscription-mode", "member-subscription-message"]
    if len(param_lists) >= 3:
        nb_col = 2
    else:
        nb_col = 1
    Params.fill(xfer, param_lists, 1, xfer.get_max_row() + 1, nb_col=nb_col)
    btn = XferCompButton('editparam')
    btn.set_is_mini(smallbtn)
    btn.set_location(3, xfer.get_max_row() + 1)
    btn.set_action(xfer.request, ParamEdit.get_action(TITLE_MODIFY, 'images/edit.png'),
                   close=CLOSE_NO, params={'params': param_lists, 'nb_col': nb_col})
    xfer.add_component(btn)
Example #17
0
def fill_params(xfer):
    param_lists = [
        "event-degree-enable", "event-degree-text", "event-subdegree-enable",
        "event-subdegree-text", "event-comment-text"
    ]
    Params.fill(xfer, param_lists, 1, xfer.get_max_row() + 1, nb_col=1)
    btn = XferCompButton('editparam')
    btn.set_location(1, xfer.get_max_row() + 1, 2, 1)
    btn.set_action(xfer.request,
                   ParamEdit.get_action(TITLE_MODIFY, 'images/edit.png'),
                   close=CLOSE_NO,
                   params={
                       'params': param_lists,
                       'nb_col': 1
                   })
    xfer.add_component(btn)
Example #18
0
 def fillresponse(self, params=(), nb_col=1):
     img_title = XferCompImage('img')
     img_title.set_location(0, 0)
     img_title.set_value(self.icon_path())
     self.add_component(img_title)
     lab = XferCompLabelForm('title')
     lab.set_location(1, 0, 2 * nb_col)
     lab.set_value_as_title(_("Edition of parameters"))
     self.add_component(lab)
     Params.fill(self, params, 1, 1, False, nb_col)
     titles = {}
     signal_and_lock.Signal.call_signal('get_param_titles', params, titles)
     for paramname in titles.keys():
         param_item = self.get_components(paramname)
         if param_item is not None:
             param_item.description = titles[paramname]
     self.add_action(ParamSave.get_action(_('Ok'), 'images/ok.png'))
     self.add_action(WrapAction(_('Cancel'), 'images/cancel.png'))
Example #19
0
    def test_parameters_bool(self):
        param = Parameter.objects.create(
            name='param_bool', typeparam=3)
        param.args = "{}"
        param.value = 'False'
        param.save()
        Params.fill(self.xfer, ['param_bool'], 1, 1, True)
        Params.fill(self.xfer, ['param_bool'], 1, 2, False)
        self.callparam()
        self.assert_count_equal('COMPONENTS/*', 4)
        self.assert_count_equal(
            'COMPONENTS/LABELFORM[@name="lbl_param_bool"]', 2)
        self.assert_xml_equal(
            'COMPONENTS/LABELFORM[@name="param_bool"]', 'Non')
        self.assert_xml_equal('COMPONENTS/CHECK[@name="param_bool"]', '0')

        self.factory.xfer = ParamSave()
        self.call(
            '/CORE/paramSave', {'params': 'param_bool', 'param_bool': '1'}, False)
        self.assert_observer('core.acknowledge', 'CORE', 'paramSave')
        self.assertEqual(Params.getvalue('param_bool'), True)
Example #20
0
 def fillresponse(self):
     img_title = XferCompImage('img')
     img_title.set_location(0, 0, 1, 10)
     img_title.set_value(self.icon_path())
     self.add_component(img_title)
     lab = XferCompLabelForm('title')
     lab.set_location(1, 0, 3)
     lab.set_value('{[br/]}{[center]}{[b]}{[u]}%s{[/u]}{[/b]}{[/center]}' % _("Software configuration"))
     self.add_component(lab)
     setting_list = {}
     signal_and_lock.Signal.call_signal("config", setting_list)
     for tab_name in sorted(list(setting_list.keys())):
         self.new_tab(tab_name[tab_name.find('@') + 1:])
         Params.fill(self, setting_list[tab_name], 0, 0)
         btn = XferCompButton(tab_name + "_btn")
         btn.set_action(self.request, ParamEdit.get_action(_('Modify'), 'images/edit.png'), close=CLOSE_NO, params={'params': setting_list[tab_name]})
         btn.set_location(0, self.get_max_row() + 1)
         self.add_component(btn)
     steplist = get_wizard_step_list()
     if steplist != '':
         self.add_action(ConfigurationWizard.get_action(_("Wizard"), "images/config.png"), close=CLOSE_NO, params={'steplist': steplist})
     self.add_action(WrapAction(_('Close'), 'images/close.png'))
Example #21
0
    def test_parameters_memo(self):
        param = Parameter.objects.create(
            name='param_memo', typeparam=0)
        param.args = "{'Multi':True}"
        param.value = 'other value'
        param.save()
        Params.fill(self.xfer, ['param_memo'], 1, 1, True)
        Params.fill(self.xfer, ['param_memo'], 1, 2, False)
        self.callparam()
        self.assert_count_equal('COMPONENTS/*', 4)
        self.assert_count_equal(
            'COMPONENTS/LABELFORM[@name="lbl_param_memo"]', 2)
        self.assert_xml_equal(
            'COMPONENTS/LABELFORM[@name="param_memo"]', 'other value')
        self.assert_xml_equal(
            'COMPONENTS/MEMO[@name="param_memo"]', 'other value')

        self.factory.xfer = ParamSave()
        self.call(
            '/CORE/paramSave', {'params': 'param_memo', 'param_memo': 'new special value'}, False)
        self.assert_observer('core.acknowledge', 'CORE', 'paramSave')
        self.assertEqual(Params.getvalue('param_memo'), 'new special value')
Example #22
0
    def test_parameters_bool(self):
        param = Parameter.objects.create(name='param_bool', typeparam=3)
        param.args = "{}"
        param.value = 'False'
        param.save()

        Params.fill(self.xfer, ['param_bool'], 1, 1, True)
        self.callparam()
        self.assert_count_equal('', 1)
        self.assert_json_equal('LABELFORM', "param_bool", 'Non')

        Params.fill(self.xfer, ['param_bool'], 1, 1, False)
        self.callparam()
        self.assert_count_equal('', 1)
        self.assert_json_equal('CHECK', "param_bool", '0')

        self.factory.xfer = ParamSave()
        self.calljson('/CORE/paramSave', {
            'params': 'param_bool',
            'param_bool': '1'
        }, False)
        self.assert_observer('core.acknowledge', 'CORE', 'paramSave')
        self.assertEqual(Params.getvalue('param_bool'), True)
Example #23
0
    def test_parameters_memo(self):
        param = Parameter.objects.create(name='param_memo', typeparam=0)
        param.args = "{'Multi':True}"
        param.value = 'other value'
        param.save()

        Params.fill(self.xfer, ['param_memo'], 1, 1, True)
        self.callparam()
        self.assert_count_equal('', 1)
        self.assert_json_equal('LABELFORM', "param_memo", 'other value')

        Params.fill(self.xfer, ['param_memo'], 1, 1, False)
        self.callparam()
        self.assert_count_equal('', 1)
        self.assert_json_equal('MEMO', "param_memo", 'other value')

        self.factory.xfer = ParamSave()
        self.calljson('/CORE/paramSave', {
            'params': 'param_memo',
            'param_memo': 'new special value'
        }, False)
        self.assert_observer('core.acknowledge', 'CORE', 'paramSave')
        self.assertEqual(Params.getvalue('param_memo'), 'new special value')
Example #24
0
    def test_parameters_select(self):
        param = Parameter.objects.create(
            name='param_select', typeparam=4)
        param.args = "{'Enum':4}"
        param.value = '2'
        param.save()
        Params.fill(self.xfer, ['param_select'], 1, 1, True)
        Params.fill(self.xfer, ['param_select'], 1, 2, False)
        self.callparam()
        self.assert_count_equal('COMPONENTS/*', 4)
        self.assert_count_equal(
            'COMPONENTS/LABELFORM[@name="lbl_param_select"]', 2)
        self.assert_xml_equal(
            'COMPONENTS/LABELFORM[@name="param_select"]', 'param_select.2')
        self.assert_xml_equal('COMPONENTS/SELECT[@name="param_select"]', '2')
        self.assert_count_equal(
            'COMPONENTS/SELECT[@name="param_select"]/CASE', 4)

        self.factory.xfer = ParamSave()
        self.call(
            '/CORE/paramSave', {'params': 'param_select', 'param_select': '1'}, False)
        self.assert_observer('core.acknowledge', 'CORE', 'paramSave')
        self.assertEqual(Params.getvalue('param_select'), 1)
Example #25
0
def config_contacts(xfer):
    new_params = ['contacts-mailtoconfig', 'contacts-createaccount']
    Params.fill(xfer, new_params, 1, 10)
    xfer.params['params'].extend(new_params)
    return True
Example #26
0
def conf_wizard_contacts(wizard_ident, xfer):
    if isinstance(wizard_ident, list) and (xfer is None):
        wizard_ident.append(("contacts_current", 5))
        wizard_ident.append(("contacts_params", 40))
        wizard_ident.append(("contacts_responsable", 41))
    elif (xfer is not None) and (wizard_ident == "contacts_current"):
        xfer.add_title(_("Lucterios contacts"), _("Our details"),
                       _('configure our details'))
        xfer.model = LegalEntity
        xfer.item = LegalEntity.objects.get(id=1)
        xfer.fill_from_model(
            1,
            xfer.get_max_row() + 1,
            True,
            desc_fields=LegalEntity.get_show_fields()[_('001@Identity')])
        xfer.remove_component('structure_type')
        btn = XferCompButton("btnconf")
        btn.set_location(2, xfer.get_max_row() + 1)
        btn.set_is_mini(True)
        btn.set_action(xfer.request,
                       CurrentStructureAddModify.get_action(
                           '', "images/edit.png"),
                       close=CLOSE_NO)
        xfer.add_component(btn)
    elif (xfer is not None) and (wizard_ident == "contacts_params"):
        xfer.add_title(_("Lucterios contacts"), _("Contacts configuration"),
                       _('configure your contacts'))
        param_lists = [
            'contacts-mailtoconfig', 'contacts-createaccount',
            'contacts-defaultgroup', 'contacts-size-page'
        ]
        Params.fill(xfer, param_lists, 1, xfer.get_max_row() + 1)
        btn = XferCompButton('editparam')
        btn.set_location(4, xfer.get_max_row())
        btn.set_is_mini(True)
        btn.set_action(xfer.request,
                       ParamEdit.get_action(TITLE_MODIFY, 'images/edit.png'),
                       close=CLOSE_NO,
                       params={'params': param_lists})
        xfer.add_component(btn)
        lbl = XferCompLabelForm("nb_function")
        lbl.set_location(1, xfer.get_max_row() + 1)
        lbl.set_value(
            TEXT_TOTAL_NUMBER % {
                'name': Function._meta.verbose_name_plural,
                'count': len(Function.objects.all())
            })
        xfer.add_component(lbl)
        lbl = XferCompLabelForm("nb_structuretype")
        lbl.set_location(1, xfer.get_max_row() + 1)
        lbl.set_value(
            TEXT_TOTAL_NUMBER % {
                'name': StructureType._meta.verbose_name_plural,
                'count': len(StructureType.objects.all())
            })
        xfer.add_component(lbl)
        lbl = XferCompLabelForm("nb_customfield")
        lbl.set_location(1, xfer.get_max_row() + 1)
        lbl.set_value(
            TEXT_TOTAL_NUMBER % {
                'name': CustomField._meta.verbose_name_plural,
                'count': len(CustomField.objects.all())
            })
        xfer.add_component(lbl)
        btn = XferCompButton("btnconf")
        btn.set_location(4, xfer.get_max_row() - 2, 1, 3)
        btn.set_action(xfer.request,
                       Configuration.get_action(TITLE_MODIFY,
                                                "images/edit.png"),
                       close=CLOSE_NO)
        xfer.add_component(btn)

        lbl = XferCompLabelForm("nb_legalentity")
        lbl.set_location(1, xfer.get_max_row() + 1)
        lbl.set_value(
            TEXT_TOTAL_NUMBER % {
                'name': LegalEntity._meta.verbose_name_plural,
                'count': len(LegalEntity.objects.all())
            })
        xfer.add_component(lbl)
        lbl = XferCompLabelForm("nb_individual")
        lbl.set_location(1, xfer.get_max_row() + 1)
        lbl.set_value(
            TEXT_TOTAL_NUMBER % {
                'name': Individual._meta.verbose_name_plural,
                'count': len(Individual.objects.all())
            })
        xfer.add_component(lbl)
        btn = XferCompButton("btnimport")
        btn.set_location(4, xfer.get_max_row() - 1, 1, 2)
        btn.set_action(xfer.request,
                       ContactImport.get_action(_("Contact import"),
                                                "images/add.png"),
                       close=CLOSE_NO,
                       params={'step': 0})
        xfer.add_component(btn)
    elif (xfer is not None) and (wizard_ident == "contacts_responsable"):
        xfer.add_title(_("Lucterios contacts"), _('associates'),
                       _('configure your association'))
        xfer.params['legal_entity'] = 1
        xfer.fill_grid(5, Responsability, "responsability",
                       Responsability.objects.filter(legal_entity_id=1))
Example #27
0
def config_contacts(xfer):
    new_params = ['contacts-mailtoconfig', 'contacts-createaccount']
    Params.fill(xfer, new_params, 1, 10)
    xfer.params['params'].extend(new_params)
    return True
Example #28
0
File: views.py Project: povtux/core
def config_core(xfer):
    Params.fill(xfer, ['CORE-connectmode'], 1, 1)
    xfer.params['params'].append('CORE-connectmode')