<!-- $Id$ -->

<configure
   xmlns="http://namespaces.zope.org/zope"
   xmlns:i18n="http://namespaces.zope.org/i18n"
   i18n_domain="loops">

  <i18n:registerTranslations directory="locales" />

  <!-- security definitions -->

  <include file="security.zcml" />

  <!-- event subscribers -->

  <subscriber
        for=".interfaces.ITargetRelation
             cybertools.relation.interfaces.IRelationInvalidatedEvent"
        handler=".util.removeTargetRelation" />

  <!-- loops top-level container -->

  <interface interface=".interfaces.ILoops"
             type="zope.app.content.interfaces.IContentType" />

  <class class="loops.base.Loops">
    <implements interface="zope.annotation.interfaces.IAttributeAnnotatable" />
    <factory id="loops.Loops" description="loops top-level container" />
    <allow attributes="getSiteManager" />
    <require permission="zope.ManageServices"
             attributes="setSiteManager" />
    <require permission="zope.View"
             interface="zope.app.container.interfaces.IReadContainer" />
    <require permission="zope.ManageContent"
             interface="zope.app.container.interfaces.IWriteContainer" />
    <!--<require permission="zope.View"
             interface="loops.interfaces.ILoops" />-->
    <require permission="zope.View"
             attributes="getLoopsRoot getLoopsUri loopsTraverse getConceptManager
                         getResourceManager getViewManager getRecordManager
                         skinName options" />
    <require permission="zope.ManageContent"
             set_schema=".interfaces.ILoops" />
  </class>

  <!-- concept manager and concept -->

  <interface interface=".interfaces.IConceptManager"
             type="zope.app.content.interfaces.IContentType" />

  <class class=".concept.ConceptManager">
    <factory id="loops.ConceptManager" description="Concept manager" />
    <require
        permission="zope.View"
        interface="zope.app.container.interfaces.IReadContainer" />
    <require
        permission="zope.ManageContent"
        interface="zope.app.container.interfaces.IWriteContainer" />
    <require
        permission="zope.View"
        attributes="getTypePredicate getDefaultPredicate getTypeConcept
                    getPredicateType" />
  </class>

  <interface interface=".interfaces.IConcept"
             type="zope.app.content.interfaces.IContentType" />

  <class class=".concept.Concept">
    <implements interface="zope.annotation.interfaces.IAttributeAnnotatable" />
    <factory id="loops.Concept" description="Concept object" />
    <require permission="zope.View" interface=".interfaces.IConcept" />
    <require permission="zope.ManageContent" set_schema=".interfaces.IConcept" />
  </class>

  <class class="loops.concept.ConceptRelation">
    <require permission="zope.View" interface="loops.interfaces.IConceptRelation" />
    <require permission="zope.ManageContent"
             set_schema="loops.interfaces.IConceptRelation" />
  </class>

  <class class="loops.concept.ResourceRelation">
    <require permission="zope.View" interface="loops.interfaces.IConceptRelation" />
    <require permission="zope.ManageContent"
             set_schema="loops.interfaces.IConceptRelation" />
  </class>

  <!-- resource manager and resource -->

  <interface interface=".interfaces.IResourceManager"
             type="zope.app.content.interfaces.IContentType" />

  <class class=".resource.ResourceManager">
    <factory id="loops.ResourceManager" description="Resource manager" />
    <require
        permission="zope.View"
        interface="zope.app.container.interfaces.IReadContainer"
        attributes="getLoopsRoot" />
    <require
        permission="zope.ManageContent"
        interface="zope.app.container.interfaces.IWriteContainer" />
  </class>

  <interface interface=".interfaces.IResource"
             type="zope.app.content.interfaces.IContentType" />

  <class class=".resource.Resource">
    <implements interface="zope.annotation.interfaces.IAttributeAnnotatable" />
    <factory id="loops.Resource" description="Document" />
    <require
        permission="zope.View"
        interface=".interfaces.IBaseResource
                   zope.size.interfaces.ISized" />
    <require
        permission="zope.ManageContent"
        set_schema=".interfaces.IBaseResource" />
  </class>

  <interface interface=".interfaces.IDocument"
             type="zope.app.content.interfaces.IContentType" />

  <class class=".resource.Document">
    <implements interface="zope.annotation.interfaces.IAttributeAnnotatable" />
    <factory id="loops.Document" description="Document" />
    <require
        permission="zope.View"
        interface=".interfaces.IDocument
                   zope.size.interfaces.ISized" />
    <require
        permission="zope.ManageContent"
        set_schema=".interfaces.IDocument" />
  </class>

  <interface interface=".interfaces.IMediaAsset"
             type="zope.app.content.interfaces.IContentType" />

  <class class=".resource.MediaAsset">
    <implements interface="zope.annotation.interfaces.IAttributeAnnotatable" />
    <factory id="loops.MediaAsset" description="Media Asset" />
    <require
        permission="zope.View"
        interface=".interfaces.IBaseResource
                   zope.size.interfaces.ISized" />
    <require
        permission="zope.ManageContent"
        set_schema=".interfaces.IBaseResource" />
  </class>

  <!--<adapter
      factory="zope.app.file.image.ImageSized"
      provides="zope.size.interfaces.ISized"
      for=".interfaces.IMediaAsset"
      />-->

  <!-- view manager and view -->

  <interface interface=".interfaces.IViewManager"
             type="zope.app.content.interfaces.IContentType" />

  <class class=".view.ViewManager">
    <factory id="loops.ViewManager" description="View manager" />
    <require
        permission="zope.View"
        interface="zope.app.container.interfaces.IReadContainer" />
    <require
        permission="zope.ManageContent"
        interface="zope.app.container.interfaces.IWriteContainer"
        attributes="updateOrder" />
  </class>

  <interface interface=".interfaces.INode"
             type="zope.app.content.interfaces.IContentType" />

  <class class=".view.Node">
    <implements interface="zope.annotation.interfaces.IAttributeAnnotatable" />
    <factory id="loops.Node" description="Node" />
    <require
        permission="zope.View"
        interface=".interfaces.INode" />
    <require
        permission="zope.ManageContent"
        set_schema=".interfaces.INode" />
    <!--<require
        permission="zope.View"
        interface="zope.app.container.interfaces.IReadContainer" />-->
  </class>

  <!-- record manager -->

  <interface interface="loops.interfaces.IRecordManager"
             type="zope.app.content.interfaces.IContentType" />

  <class class="loops.record.RecordManager">
    <factory id="loops.RecordManager" description="Record manager" />
    <require
        permission="zope.View"
        interface="zope.app.container.interfaces.IReadContainer" />
    <require
        permission="zope.ManageContent"
        interface="zope.app.container.interfaces.IWriteContainer" />
  </class>

  <!-- adapters -->

  <adapter factory="loops.common.LoopsDCAdapter"
           for="loops.interfaces.INode"
           provides="zope.dublincore.interfaces.IZopeDublinCore"
           trusted="True" />

  <adapter factory="loops.common.LoopsDCAdapter"
           for="loops.interfaces.IConcept"
           provides="zope.dublincore.interfaces.IZopeDublinCore"
           trusted="True" />

  <adapter factory="loops.common.LoopsDCAdapter"
           for="loops.interfaces.IResource"
           provides="zope.dublincore.interfaces.IZopeDublinCore"
           trusted="True" />

  <class class="loops.common.LoopsDCAdapter">
    <require like_class="zope.dublincore.annotatableadapter.ZDCAnnotatableAdapter" />
  </class>

  <adapter factory="loops.concept.IndexAttributes" trusted="True" />
  <class class="loops.concept.IndexAttributes">
    <allow interface="loops.interfaces.IIndexAttributes" />
  </class>

  <adapter factory="loops.resource.IndexAttributes" trusted="True" />
  <class class="loops.resource.IndexAttributes">
    <allow interface="loops.interfaces.IIndexAttributes" />
  </class>

  <adapter factory="loops.resource.DocumentReadFileAdapter" />
  <adapter factory="loops.resource.DocumentWriteFileAdapter" />

  <adapter factory="loops.common.NameChooser" />

  <adapter factory="loops.type.LoopsType"
           for="loops.interfaces.IResource" />
  <adapter factory="loops.type.ConceptType" />
  <adapter factory="loops.type.ResourceType"
           for="loops.interfaces.IDocument" />
  <adapter factory="loops.type.LoopsTypeManager" />

  <adapter factory="loops.type.TypeConcept" trusted="True" />
  <class class="loops.type.TypeConcept">
    <require permission="zope.View"
             interface="loops.interfaces.ITypeConcept" />
    <require permission="zope.ManageContent"
             set_schema="loops.interfaces.ITypeConcept" />
  </class>

  <adapter factory="loops.query.QueryConcept" trusted="True" />
  <class class="loops.query.QueryConcept">
    <require permission="zope.View"
             interface="loops.query.IQueryConcept" />
    <require permission="zope.ManageContent"
             set_schema="loops.query.IQueryConcept" />
  </class>

  <adapter factory="loops.resource.FileAdapter"
           provides="loops.interfaces.IFile"
           trusted="True" />
  <class class="loops.resource.FileAdapter">
    <require permission="zope.View"
             interface="loops.interfaces.IFile" />
    <require permission="zope.ManageContent"
             set_schema="loops.interfaces.IFile" />
  </class>

  <adapter factory="loops.resource.ExternalFileAdapter" trusted="True"
           provides="loops.interfaces.IExternalFile" />
  <class class="loops.resource.ExternalFileAdapter">
    <require permission="zope.View"
             interface="loops.interfaces.IExternalFile" />
    <require permission="zope.ManageContent"
             set_schema="loops.interfaces.IExternalFile" />
  </class>

  <adapter factory="loops.resource.TextDocumentAdapter" trusted="True"
           provides="loops.interfaces.ITextDocument" />
  <class class="loops.resource.TextDocumentAdapter">
    <require permission="zope.View"
             interface="loops.interfaces.ITextDocument" />
    <require permission="zope.ManageContent"
             set_schema="loops.interfaces.ITextDocument" />
  </class>

  <adapter factory="loops.resource.NoteAdapter"
           provides="loops.interfaces.INote"
           trusted="True" />
  <class class="loops.resource.NoteAdapter">
    <require permission="zope.View"
             interface="loops.interfaces.INote" />
    <require permission="zope.ManageContent"
             set_schema="loops.interfaces.INote" />
  </class>

  <adapter factory="loops.resource.ExternalFileFactory" />
  <class class="loops.resource.ExternalFileFactory">
    <require permission="zope.ManageContent"
             interface="zope.filerepresentation.interfaces.IFileFactory" />
  </class>

  <adapter factory="cybertools.composer.schema.instance.Instance" />
  <adapter factory="cybertools.composer.schema.instance.Editor"
           name="editor" />
  <adapter factory="cybertools.composer.schema.field.FieldInstance" />
  <adapter factory="cybertools.composer.schema.field.NumberFieldInstance"
           name="number" />
  <adapter factory="cybertools.composer.schema.field.DateFieldInstance"
           name="date" />
  <adapter factory="cybertools.composer.schema.field.EmailFieldInstance"
           name="email" />
  <adapter factory="cybertools.composer.schema.field.BooleanFieldInstance"
           name="boolean" />
  <adapter factory="cybertools.composer.schema.field.FileUploadFieldInstance"
           name="fileupload" />

  <adapter factory="cybertools.composer.schema.factory.SchemaFactory" />
  <adapter factory="loops.schema.ResourceSchemaFactory" />
  <adapter factory="loops.schema.ResourceSchemaFactory"
           for="loops.interfaces.IResource" />
  <adapter factory="loops.schema.FileSchemaFactory" />
  <adapter factory="loops.schema.NoteSchemaFactory" />

  <adapter factory="loops.setup.SetupManager" />

  <!-- obsolete:
  <adapter factory="loops.external.NodesLoader" />
  <adapter factory="loops.external.NodesExporter" />
  <adapter factory="loops.external.NodesImporter" />-->

  <!-- obsolete - remove: -->
  <adapter factory="loops.target.DocumentProxy"
           permission="zope.ManageContent" />
  <adapter factory="loops.target.MediaAssetProxy"
           permission="zope.ManageContent" />
  <adapter factory="loops.target.ConceptProxy"
           permission="zope.ManageContent" />

  <!-- text conversions, e.g. for full-text indexing -->

  <adapter for="loops.interfaces.IFile"
           provides="cybertools.text.interfaces.ITextTransform"
           name="application/pdf"
           factory="cybertools.text.pdf.PdfTransform" />

  <adapter for="loops.interfaces.IFile"
           provides="cybertools.text.interfaces.ITextTransform"
           name="application/msword"
           factory="cybertools.text.doc.DocTransform" />

  <adapter for="loops.interfaces.IFile"
           provides="cybertools.text.interfaces.ITextTransform"
           name="text/rtf"
           factory="cybertools.text.rtf.RtfTransform" />

  <adapter for="loops.interfaces.IFile"
           provides="cybertools.text.interfaces.ITextTransform"
           name="application/vnd.ms-powerpoint"
           factory="cybertools.text.ppt.PptTransform" />

  <adapter for="loops.interfaces.IFile"
           provides="cybertools.text.interfaces.ITextTransform"
           name="application/vnd.ms-excel"
           factory="cybertools.text.xls.XlsTransform" />

  <!-- utilities -->

  <utility
      factory="cybertools.storage.filesystem.instanceVarSubdirectoryStorage"
      name="varsubdir" />

  <utility
      factory="cybertools.storage.filesystem.fullPathStorage"
      name="fullpath" />

  <utility
      provides="zope.schema.interfaces.IVocabularyFactory"
      component="loops.concept.ConceptTypeSourceList"
      name="loops.conceptTypeSource" />

  <utility
      provides="zope.schema.interfaces.IVocabularyFactory"
      component="loops.resource.ResourceTypeSourceList"
      name="loops.resourceTypeSource" />

  <utility
      provides="zope.schema.interfaces.IVocabularyFactory"
      component="loops.concept.PredicateSourceList"
      name="loops.predicateSource" />

  <utility
      provides="zope.schema.interfaces.IVocabularyFactory"
      component="loops.type.TypeInterfaceSourceList"
      name="loops.TypeInterfaceSource" />


  <include package=".browser" />
  <include package=".classifier" />
  <include package=".compound.blog" />
  <include package=".config" />
  <include package=".constraint" />
  <include package=".external" />
  <include package=".i18n" />
  <include package=".integrator" />
  <include package=".knowledge" />
  <include package=".organize" />
  <include package=".rest" />
  <include package=".search" />
  <include package=".security" />
  <include package=".versioning" />
  <include package=".xmlrpc" />

</configure>
