from quixote import get_publisher

from wcs.qommon import _
from wcs.qommon.publisher import get_publisher_class, get_request
from wcs.qommon.misc import get_cfg

from modules import admin
from modules import backoffice
from modules import links_ui
from modules import announces_ui
from modules import categories_admin
from modules import events_ui
from modules import payments_ui
from modules import strongbox_ui
from modules import formpage
from modules import template
from modules import root
from modules import payments
from modules import connectors
from modules import abelium_domino_ui
from modules import abelium_domino_vars
from modules import abelium_domino_synchro

get_publisher_class().register_translation_domain('auquotidien')
get_publisher_class().default_configuration_path = 'au-quotidien-wcs-settings.xml'

rdb = get_publisher_class().backoffice_directory_class

rdb.items = []

rdb.register_directory('announces', announces_ui.AnnouncesDirectory())
rdb.register_menu_item('announces/', _('Announces'))

rdb.register_directory('links', links_ui.LinksDirectory())
rdb.register_menu_item('links/', _('Links'))

rdb.register_directory('events', events_ui.EventsDirectory())
rdb.register_menu_item('events/', _('Events'))

rdb.register_directory('payments', payments_ui.PaymentsDirectory())
rdb.register_menu_item('payments/', _('Payments'))

rdb.register_directory('strongbox', strongbox_ui.StrongboxDirectory())
rdb.register_menu_item('strongbox/', _('Strongbox'))

rdb.register_directory('settings', admin.SettingsDirectory())

import wcs.admin.forms
wcs.admin.forms.FormsDirectory.categories = categories_admin.CategoriesDirectory()

import wcs.admin.settings
wcs.admin.settings.SettingsDirectory.domino = abelium_domino_ui.AbeliumDominoDirectory()
wcs.admin.settings.SettingsDirectory._q_exports.append('domino')

import wcs.categories
wcs.categories.Category.XML_NODES = [('name', 'str'), ('url_name', 'str'),
        ('description', 'str'), ('position', 'int'),
        ('homepage_position', 'str'), ('redirect_url', 'str'), ('limit', 'int')]
