Пример #1
0
class TroubleInfoDoc(BaseDocument):
    def __init__(self, app):
        BaseDocument.__init__(self, app)
        self.manager = TroubleManager(self. app)

    def set_clause(self, clause):
        self.clear_body()
        rows = self.db.select(fields=['title'], table='tickets')

    def setID(self, troubleid):
        #row = self.manager.get_ticket(troubleid, data=True)
        info = self.manager.getTroubleInfo(troubleid)
        self.current = troubleid
        self.clear_body()
        #make header
        self.body.appendChild(TitleTable(info['problem']))
        self.header = TroubleHeader(troubleid, info)
        self.body.appendChild(self.header)
        hr = BaseElement('hr')
        self.body.appendChild(hr)
        #append ticket data
        tdata = TroubleData(info['worktodo'])
        self.body.appendChild(tdata)
        hr = BaseElement('hr')
        self.body.appendChild(hr)
        #append ticket footer
        self.tfooter = TroubleFooter(troubleid)
        self.body.appendChild(self.tfooter)
        #actions, rows, trows, crows = self.manager.get_actions(troubleid, True)
        #athreads = ActionThreads(self.body, actions, trows, crows)
        #self.body.appendChild(athreads)
        #self.threads = athreads
        actionrows = info['actions']
        print actionrows
        self.body.appendChild(ActionTable(actionrows))
                                                                   
    def showActionData(self, actionid):
        data = self.manager.get_actiondata(self.current, actionid)
        self.threads.show_data(actionid, data)

    def hideActionData(self, actionid):
        self.threads.hide_data(actionid)