def build_categories_page():
    '''Build page showing available categories and some items in each one'''
    all_items = MunkiItems.getOptionalInstallItems()
    header = NSLocalizedString(u"Categories", u"Categories label")
    page_name = u'categories.html'
    category_list = []
    for item in all_items:
        if 'category' in item and item['category'] not in category_list:
            category_list.append(item['category'])

    item_html = build_category_items_html()
    
    all_categories_label = NSLocalizedString(u"All Categories", u"AllCategoriesLabel")
    categories_html = u'<option selected>%s</option>\n' % all_categories_label
    for item in sorted(category_list):
        categories_html += u'<option>%s</option>\n' % item

    page = {}
    page['list_items'] = item_html
    page['category_items'] = categories_html
    page['header_text'] = header
    
    footer = get_template('footer_template.html', raw=True)
    generate_page(page_name, 'list_template.html', page, showcase=u'', sidebar=u'', footer=footer)
dataset/ETHPy150Open munki/munki/code/apps/Managed Software Center/Managed Software Center/mschtml.py/build_categories_page/original