Esempio n. 1
0
 def __init__(self):
     XferContainerCustom.__init__(self)
     self.fieldnames = None
     self.fields_desc = FieldDescList()
     self.criteria_list = []
     self.filter = None
     self.size_by_page = None
Esempio n. 2
0
 def __init__(self, **kwargs):
     XferContainerCustom.__init__(self, **kwargs)
     self.filter = None
     self.lastfilter = None
     hfield = format_with_devise(5).split(';')
     self.format_str = ";".join(hfield[1:])
     self.hfield = hfield[0]
Esempio n. 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-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)
Esempio n. 4
0
 def __init__(self, **kwargs):
     XferContainerCustom.__init__(self, **kwargs)
     self.fieldnames = None
     self.action_list = [('listing', ugettext_lazy("Listing"), "images/print.png"),
                         ('label', ugettext_lazy("Label"), "images/print.png")]
     self.action_grid = deepcopy(DEFAULT_ACTION_LIST)
     self.filter = None
Esempio n. 5
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)
Esempio n. 6
0
 def __init__(self, **kwargs):
     XferContainerCustom.__init__(self, **kwargs)
     self.model = None
     self.quotechar = ""
     self.delimiter = ""
     self.encoding = ""
     self.dateformat = ""
     self.spamreader = None
     self.items_imported = {}
Esempio n. 7
0
 def __init__(self):
     XferContainerCustom.__init__(self)
     self.action_grid = None
     self.fieldnames = None
     self.fields_desc = FieldDescList()
     self.criteria_list = []
     self.filter = None
     self.action_list = [('listing', _("Listing"), "images/print.png"),
                         ('label', _("Label"), "images/print.png")]
Esempio n. 8
0
 def setUp(self):
     self.xfer_class.url_text = "customer/details"
     self.xfer_class.is_view_right = ''
     LucteriosTest.setUp(self)
     self.value = False
     self.xfer = XferContainerCustom()
     Params.clear()
Esempio n. 9
0
 def __init__(self, **kwargs):
     XferContainerCustom.__init__(self, **kwargs)
     self.fieldnames = None
     self.filter = None
     self.size_by_page = None
Esempio n. 10
0
 def _initialize(self, request, *_, **kwargs):
     XferContainerCustom._initialize(self, request, *_, **kwargs)
     if isinstance(self.redirect_to_show, six.text_type):
         self.with_auditlog_btn = (ActionsManage.get_action_url(
             self.model.get_long_name(), self.redirect_to_show, self) is
                                   None)
Esempio n. 11
0
 def _get_zipextract(self):
     filename = self._get_reports_archive()
     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
     lbl = XferCompLabelForm('title')
     lbl.set_value_as_title(self.caption)
     lbl.set_location(1, 0, 6)
     gui.add_component(lbl)
     zipdown = XferCompDownLoad('filename')
     zipdown.compress = False
     zipdown.http_file = True
     zipdown.maxsize = 0
     zipdown.set_value(filename)
     zipdown.set_download(filename)
     zipdown.set_location(1, 15, 2)
     gui.add_component(zipdown)
     gui.add_action(WrapAction(_("Close"), "images/close.png"))
     return gui
Esempio n. 12
0
 def __init__(self, **kwargs):
     XferContainerCustom.__init__(self, **kwargs)
Esempio n. 13
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
     lbl = XferCompLabelForm('lblPrintMode')
     lbl.set_value_as_name(_('Kind of report'))
     lbl.set_location(0, 0)
     gui.add_component(lbl)
     print_mode = XferCompSelect('PRINT_MODE')
     print_mode.set_select(self.print_selector)
     print_mode.set_value(PRINT_PDF_FILE)
     print_mode.set_location(1, 0)
     gui.add_component(print_mode)
     if self.selector is not None:
         row_idx = 1
         for name_selector, title_selector, option_selector in self.selector:
             lbl = XferCompLabelForm('lbl' + name_selector)
             lbl.set_value_as_name(title_selector)
             lbl.set_location(0, row_idx)
             gui.add_component(lbl)
             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])
             comp.set_location(1, row_idx)
             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
Esempio n. 14
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
Esempio n. 15
0
 def __init__(self, **kwargs):
     XferContainerCustom.__init__(self, **kwargs)
     self.action_list = [('modify', _("Modify"), "images/edit.png", CLOSE_YES),
                         ('print', _("Print"), "images/print.png", CLOSE_NO)]
Esempio n. 16
0
 def __init__(self, **kwargs):
     XferContainerCustom.__init__(self, **kwargs)
     self.filter = None
     self.lastfilter = None
     self.budgetfilter_left = None
     self.budgetfilter_right = None
Esempio n. 17
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
Esempio n. 18
0
 def __init__(self, **kwargs):
     XferContainerCustom.__init__(self, **kwargs)
     self.filter = None
     self.lastfilter = None
Esempio n. 19
0
 def __init__(self, **kwargs):
     XferContainerCustom.__init__(self, **kwargs)
     self.fieldnames = None
     self.filter = None
     self.size_by_page = None
Esempio n. 20
0
 def __init__(self, **kwargs):
     XferContainerCustom.__init__(self, **kwargs)
Esempio n. 21
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.request = self.request
     gui.is_view_right = self.is_view_right
     gui.caption = self.caption
     gui.extension = self.extension
     gui.action = self.action
     lbl = XferCompLabelForm('lblPrintMode')
     lbl.set_value_as_name(_('Kind of report'))
     lbl.set_location(0, 0)
     gui.add_component(lbl)
     print_mode = XferCompSelect('PRINT_MODE')
     print_mode.set_select(self.print_selector)
     print_mode.set_value(PRINT_PDF_FILE)
     print_mode.set_location(1, 0)
     gui.add_component(print_mode)
     if self.selector is not None:
         row_idx = 1
         for name_selector, title_selector, option_selector in self.selector:
             lbl = XferCompLabelForm('lbl' + name_selector)
             lbl.set_value_as_name(title_selector)
             lbl.set_location(0, row_idx)
             gui.add_component(lbl)
             if isinstance(option_selector, list):
                 comp = XferCompSelect(name_selector)
                 comp.set_select(option_selector)
                 comp.set_value(None)
             elif isinstance(option_selector, tuple):
                 comp = XferCompFloat(
                     name_selector, option_selector[0], option_selector[1], option_selector[2])
                 comp.set_value(option_selector[0])
             comp.set_location(1, row_idx)
             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