"""A file manager for Ciorecipe XML files."""
from __future__ import annotations
from os.path import join, dirname
from pyramid.config import Configurator
from ciowarehouse2.lib.ciotype import CioType
from ciowarehouse2.lib.manager import LAYOUT_VIEW_PT
from ciowarehouse2.lib.manager import CHRYSALIO_JS
from ...lib.i18n import _
from ..xml import MANAGER_CSS, MANAGER_XML_CSS, ManagerXml
CIORECIPE_CSS = ('/cioxml2/css/manager_ciorecipe.css', )
IMAGE_PATHS = ('Images/', './')
RELAXNG_CIORECIPE = { # yapf: disable
'root': 'ciorecipe',
'version': '1.1',
'file': join(
dirname(__file__), '..', '..', 'Processors', 'CiorecipeValidate',
'RelaxNG', 'ciorecipe.rng')}
# =============================================================================
[docs]
def includeme(configurator: Configurator):
"""Function to include a CioWarehouse2 manager.
:type configurator: pyramid.config.Configurator
:param configurator:
Object used to do configuration declaration within the application.
"""
ManagerXml.register(configurator, ManagerCiorecipe)
# =============================================================================
[docs]
class ManagerCiorecipe(ManagerXml):
"""Class to manage a Ciorecipe XML file."""
ciotype = CioType('xml', 'ciorecipe')
uid = 'ciorecipe'
label = _('Ciorecipe XML file manager')
viewings = ( # yapf: disable
{'name': 'preview',
'label': _('Ciorecipe Preview'),
'template': LAYOUT_VIEW_PT,
'css': MANAGER_CSS + CIORECIPE_CSS,
'js': CHRYSALIO_JS,
'xsl': join('Xsl', 'ciorecipe_preview.xsl'),
'image_paths': IMAGE_PATHS},
{'name': 'xml',
'label': _('XML'),
'template': LAYOUT_VIEW_PT,
'css': MANAGER_XML_CSS,
'js': CHRYSALIO_JS})
relaxng = RELAXNG_CIORECIPE
_home = dirname(__file__)