Beispiel #1
0
    def __init__(self, book_id, activity):
        self.book_id = book_id
        self.activity = activity
        self.connection = getDictConnection()
        self.conn = getConnection()
        self.htmlUtils = HTMLutils()
        # bring in yaml metadata
        metadata = Metadata()
        self.columns = metadata.loadYaml("columns")
        self.pages = metadata.loadYaml("pages")

        if activity == "edit":
            self.report = Report("edit")
            self.header = "Edit Record"
            self.page = "edit"
            self.new_activity = "update"
            self.button_text = "Submit"
            self.show_blank = ""
            self.cancel_button_text = "Cancel"
            self.cancel_button_address = "detail.py?book_id=%s&activity=view" % book_id

        elif activity == "view":
            self.report = Report("record")
            self.header = "Book Record"
            self.page = "record"
            self.new_activity = "edit"
            self.button_text = "Edit"
            self.show_blank = "-"
            self.cancel_button_address = "main.py"
            self.cancel_button_text = "Back to Catalog"

        elif activity == "add":
            self.header = "Enter New Record"
            self.page = "edit"
            self.new_activity = "submit_new"
            self.button_text = "Save"
            self.show_blank = ""
            self.cancel_button_address = "main.py"
            self.cancel_button_text = "Cancel"

        else:
            raise Exception("Unrecognized activity: %s" % activity)

        # build the dictionary of autocomplete lists by
        self.autoCompleteList = self._getAutoCList()
Beispiel #2
0
    def __init__(self, book_id, activity):
        self.book_id = book_id
        self.activity = activity
        self.connection = getDictConnection()
        self.conn = getConnection()
        #bring in yaml metadata
        metadata = Metadata()
        self.columns = metadata.loadYaml('columns')
        self.pages = metadata.loadYaml('pages')
        self.list = []

        if activity == 'edit':
            self.header = 'Edit Record'
            self.page = 'edit'
            self.new_activity = 'update'
            self.button_text = 'Submit'
            self.show_blank = ''
            self.cancel_button_text = 'Cancel'
            self.cancel_button_address = 'detail.py?book_id=%s&activity=view'\
                %book_id

        if activity == 'view':
            self.header = 'Book Record' 
            self.page = 'record'
            self.new_activity = 'edit'
            self.button_text = 'Edit'
            self.show_blank = '-'
            self.cancel_button_address = 'main.py'
            self.cancel_button_text = 'Back to Catalog'

        if activity == 'add':
            self.header = 'Enter New Record' 
            self.page = 'edit'
            self.new_activity = 'submit_new'
            self.button_text = 'Save'
            self.show_blank = ''
            self.cancel_button_address = 'main.py'
            self.cancel_button_text = 'Cancel'
            
        # build the right query for the page and bring in the data 
        if activity != 'add':
            self.query = Query()
            where = 'book.book_id =' + str(self.book_id)
            self.recordData = self.query.getData(self.page, where)
Beispiel #3
0
 def __init__(self):
     self.connection = getDictConnection()
     metadata = Metadata()
     self.columns = metadata.loadYaml('columns')
     self.authorData = self.columns['author'][0]