예제 #1
0
 def open_zipfile(self, filename):
     dlg = self.create_custom()
     dlg.item = self.item
     img = XferCompImage('img')
     img.set_value(self.icon_path())
     img.set_location(0, 0, 1, 3)
     dlg.add_component(img)
     lbl = XferCompLabelForm('title')
     lbl.set_value_as_title(self.caption)
     lbl.set_location(1, 0, 6)
     dlg.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)
     dlg.add_component(zipdown)
예제 #2
0
 def fillresponse(self):
     if self.getparam("year") is None:
         self.item = FiscalYear.get_current()
     destination_file = self.item.get_xml_export()
     img = XferCompImage('img')
     img.set_value(self.icon_path())
     img.set_location(0, 0, 1, 6)
     self.add_component(img)
     lbl = XferCompLabelForm('title')
     lbl.set_value_as_title(_('Export fiscal year'))
     lbl.set_location(1, 0)
     self.add_component(lbl)
     down = XferCompDownLoad('filename')
     down.compress = False
     down.set_value('export_year_%s_%s.xml' %
                    (self.item.begin.isoformat(), self.item.end.isoformat()))
     down.set_download(destination_file)
     down.set_location(1, 1)
     self.add_component(down)
예제 #3
0
 def show(self, xfer):
     destination_file = join("documents", "document_%s" % six.text_type(self.item.id))
     if not isfile(join(get_user_dir(), destination_file)):
         raise LucteriosException(IMPORTANT, _("File not found!"))
     obj_cmt = xfer.get_components('creator')
     down = XferCompDownLoad('filename')
     down.compress = True
     down.http_file = True
     down.maxsize = 0
     down.set_value(self.item.name)
     down.set_download(destination_file)
     down.set_action(xfer.request, ActionsManage.get_action_url('documents.Document', 'AddModify', xfer),
                     modal=FORMTYPE_MODAL, close=CLOSE_NO)
     down.set_location(obj_cmt.col, obj_cmt.row + 1, 4)
     xfer.add_component(down)
     link = self.item.shared_link
     if link is not None:
         shared_link = XferCompEdit('shared_link')
         shared_link.description = _('shared link')
         shared_link.set_value(link)
         shared_link.set_location(obj_cmt.col, obj_cmt.row + 2, 4)
         xfer.add_component(shared_link)
예제 #4
0
 def open_zipfile(self, filename):
     dlg = self.create_custom()
     dlg.item = self.item
     img = XferCompImage('img')
     img.set_value(self.icon_path())
     img.set_location(0, 0, 1, 3)
     dlg.add_component(img)
     lbl = XferCompLabelForm('title')
     lbl.set_value_as_title(self.caption)
     lbl.set_location(1, 0, 6)
     dlg.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)
     dlg.add_component(zipdown)
예제 #5
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
예제 #6
0
 def show(self, xfer):
     if not isfile(self.item.file_path):
         raise LucteriosException(IMPORTANT, _("File not found!"))
     obj_cmt = xfer.get_components('creator')
     down = XferCompDownLoad('filename')
     down.compress = True
     down.http_file = True
     down.maxsize = 0
     down.set_value(self.item.name)
     down.set_download(self.item.file_path)
     down.set_action(xfer.request,
                     ActionsManage.get_action_url(
                         'documents.DocumentContainer', 'AddModify', xfer),
                     modal=FORMTYPE_MODAL,
                     close=CLOSE_NO)
     down.set_location(obj_cmt.col, obj_cmt.row + 1, 4)
     xfer.add_component(down)
     link = self.item.shared_link
     if link is not None:
         shared_link = XferCompEdit('shared_link')
         shared_link.description = _('shared link')
         shared_link.set_value(link)
         shared_link.set_location(obj_cmt.col, obj_cmt.row + 2, 4)
         xfer.add_component(shared_link)
예제 #7
0
 def show(self, xfer):
     destination_file = join("documents",
                             "document_%s" % six.text_type(self.item.id))
     if not isfile(join(get_user_dir(), destination_file)):
         raise LucteriosException(IMPORTANT, _("File not found!"))
     obj_cmt = xfer.get_components('creator')
     down = XferCompDownLoad('filename')
     down.compress = True
     down.http_file = True
     down.maxsize = 0
     down.set_value(self.item.name)
     down.set_download(destination_file)
     down.set_action(xfer.request,
                     ActionsManage.get_action_url('documents.Document',
                                                  'AddModify', xfer),
                     modal=FORMTYPE_MODAL,
                     close=CLOSE_NO)
     down.set_location(obj_cmt.col, obj_cmt.row + 1, 4)
     xfer.add_component(down)
예제 #8
0
 def fillresponse(self):
     img = XferCompImage('img')
     img.set_value(self.icon_path())
     img.set_location(0, 0, 1, 3)
     self.add_component(img)
     lbl = XferCompLabelForm('title')
     lbl.set_value_as_title(self.caption)
     lbl.set_location(1, 0, 6)
     self.add_component(lbl)
     zipdown = XferCompDownLoad('filename')
     zipdown.compress = False
     zipdown.http_file = True
     zipdown.maxsize = 0
     zipdown.set_value("%s.mdl" % self.item.name)
     zipdown.set_download(self.item.extract_file())
     zipdown.set_location(1, 15, 2)
     self.add_component(zipdown)