WhakerKit 2.0

https://sourceforge.net/projects/whakerkit/

Module whakerkit.nodes

Class WhakerKitSearchNode

Description

Find documents matching keywords.

Constructor

Create the search node.

Parameters
  • parent: (HTMLNode) The parent node
View Source
def __init__(self, parent):
    """Create the search node.

    :param parent: (HTMLNode) The parent node

    """
    super(WhakerKitSearchNode, self).__init__(parent, None, 'fieldset', attributes={'class': 'width-full'})
    table = HTMLNode(self.identifier, None, 'table', attributes={'role': 'presentation'})
    self.append_child(table)
    tbody_filename = HTMLNode(table.identifier, None, 'tbody')
    table.append_child(tbody_filename)
    tr = HTMLNode(tbody_filename.identifier, None, 'tr')
    tbody_filename.append_child(tr)
    td = HTMLNode(tr.identifier, None, 'td', attributes={'class': 'width_30'})
    tr.append_child(td)
    bold = HTMLNode(td.identifier, None, 'b', value=MSG_TITLE_SEARCH)
    td.append_child(bold)
    td = HTMLNode(tr.identifier, None, 'td')
    tr.append_child(td)
    input_search = HTMLNode(td.identifier, None, 'input', attributes={'class': 'flex-item', 'id': 'site-search', 'type': 'text', 'name': 'search', 'placeholder': 'Mots à chercher', 'aria-label': 'Mots à chercher', 'disabled': 'disabled'})
    td.append_child(input_search)
    button_submit = HTMLNode(self.identifier, None, 'button', attributes={'class': 'center flex-panel', 'type': 'submit', 'id': 'site_search_button', 'disabled': 'disabled'}, value=MSG_DO_SEARCH)
    img_search = HTMLNode(button_submit.identifier, None, 'img', attributes={'class': 'small-logo', 'src': whakerkit.sg.path + 'statics/icons/search.png', 'alt': 'Recherche'})
    button_submit.append_child(img_search)
    self.append_child(button_submit)

Public functions

get_filetype

Get all file types.

Returns
  • (list) File types
View Source
def get_filetype(self):
    """Get all file types.

        :return: (list) File types

        """
    filetypes = []
    doc = DocumentsManager(whakerkit.sg.uploads)
    doc.collect_docs()
    for docs in self.__docs.get_docs_sorted_by_newest():
        filetypes.append(docs.filetype)
    return filetypes

get_all_authors

Get all authors.

Returns
  • (list) Authors
View Source
def get_all_authors(self):
    """Get all authors.

        :return: (list) Authors

        """
    authors = []
    for docs in self.__docs.get_docs_sorted_by_newest():
        authors.append(docs.author)
    return authors