Changeset 13144


Ignore:
Timestamp:
7 Jul 2015, 05:21:14 (9 years ago)
Author:
Henrik Bettermann
Message:

More docs and adjustments in Python code.

Location:
main/waeup.kofa/trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/docs/source/userdocs/applicants/workflow.rst

    r13099 r13144  
    6363===================
    6464
    65 All transitions are automatically logged in applicants.log and the
     65All transitions are automatically logged in ``applicants.log`` and the
    6666applicant's history. And also the import of workflow states is
    6767recorded in the logfile and the history, see :ref:`student_history`
  • main/waeup.kofa/trunk/docs/source/userdocs/datacenter/export.rst

    r13104 r13144  
    125125  .. autoattribute:: waeup.kofa.hostels.export.BedExporter.title
    126126
     127Document Exporter
     128-----------------
     129
     130.. autoclass:: waeup.kofa.documents.export.DocumentExporterBase()
     131
     132  .. automethod:: waeup.kofa.documents.export.DocumentExporterBase.mangle_value()
     133
    127134Application Data Exporters
    128135==========================
  • main/waeup.kofa/trunk/docs/source/userdocs/datacenter/import_processors.rst

    r13003 r13144  
    8888  :noindex:
    8989
     90Document Processor
     91------------------
     92
     93.. autoclass:: waeup.kofa.documents.batching.DocumentProcessorBase()
     94  :noindex:
     95
    9096Application Data Processors
    9197===========================
  • main/waeup.kofa/trunk/docs/source/userdocs/documents.rst

    r13136 r13144  
    44***********************************
    55
    6 The documents section of Kofa is a tiny built-in content management system (CMS), which has been developed mainly for publishing announcements, adverts, instructions or general information provided by the university to inform prospective students about application and registration procedures.
     6The documents section of Kofa is a tiny built-in content management
     7system (CMS), which has been developed mainly for publishing
     8announcements, adverts, instructions or general information provided
     9by the university to inform prospective students about application
     10and registration procedures.
    711
    8 Technically speaking, the documents section is a container of type `DocumentsContainer` with id ``documents``, which is located in the `IUniversity` instance and which contains documents. There are three types of public documents::
     12Technically speaking, the documents section is a container of type
     13`DocumentsContainer` with id ``documents``, which is located in the
     14`IUniversity` instance and which contains documents. There are three
     15types of public documents::
    916
    1017  Public Documents (DocumentsContainer)
     
    1623  +---> RESTDocument
    1724
    18 The first can be used to provide pdf files for download. The second and third can be used to create multilingual static html pages on the portal. HTML documents expect html coded text as input, REST documents expect reStructuredText which is transformed into html. Public documents have a publication workflow with two states: created and published. Only published documents can be seen by anonymous users.
     25The first can be used to provide pdf files for download. The second
     26and third can be used to create multilingual static html pages on
     27the portal. HTML documents expect html coded text as input, REST
     28documents expect reStructuredText which is transformed into html.
    1929
    2030Interfaces
    2131==========
    2232
    23 The base for all three document interfaces is `IPublicDocument` which inherits from `IDocument`. All attributes are read-only properties, i.e. attributes with a getter method only. These properties are computed dynamically and can't be set. Only the document id and the title can be entered on form pages or imported.
     33The base for all three document interfaces is `IPublicDocument`
     34which inherits from `IDocument`. All attributes are read-only
     35properties, i.e. attributes with a getter method only. These
     36properties are computed dynamically and can't be set. Only the
     37document id and the title can be entered on form pages or can be
     38imported.
    2439
    2540.. literalinclude:: ../../../src/waeup/kofa/documents/interfaces.py
     
    2944   :pyobject: IPublicDocument
    3045
    31 A PDF Document further specifies which pdf files are connected to the object. Usually, only one filename is in the `filenames` tuple.
     46A PDF Document further specifies which pdf files are connected to
     47the object. Usually, only one filename is in the `filenames` tuple.
    3248
    3349.. literalinclude:: ../../../src/waeup/kofa/documents/interfaces.py
    3450   :pyobject: IPDFDocument
    3551
    36 HTML and REST documents have schema field for multi-lingual content in HTML or in REST format respectively, see :ref:`note <multilingual>`. The hidden `html_dict` attributes contain the same information, but the sequence of language translations has been split up and copied into a dictionary for faster processing.
     52HTML and REST documents have a schema field for multi-lingual
     53content in HTML or in REST format respectively, see :ref:`note
     54<multilingual>`. The hidden `html_dict` attributes contain the same
     55information after saving the form, but the sequence of language
     56translations has been split up and copied into a dictionary for
     57faster processing.
    3758
    3859.. literalinclude:: ../../../src/waeup/kofa/documents/interfaces.py
     
    4364
    4465
    45 Workflow & History
    46 ==================
     66Workflow
     67========
    4768
    48 Browser Pages
    49 =============
     69Public documents have a publication workflow with two states:
     70created and published. Only the content or attached files of
     71published documents can be seen by anonymous users::
    5072
    51 Data Export
     73                 a
     74    created ----------- published
     75
     76    a: publish
     77   -a: retract
     78
     79History & Logging
     80=================
     81
     82All transitions are automatically logged in ``main.log`` and the
     83document's history. This is a sample history of public document::
     84
     85  2015-07-05 07:31:32 UTC - Document created by Admin
     86  2015-07-05 07:31:53 UTC - Document published by Admin
     87  2015-07-05 07:31:57 UTC - Document retracted by Admin
     88
     89The corresponding logfile excerpt is as follows::
     90
     91  2015-07-05 09:31:32,848 - INFO - admin - demodoc - Document created
     92  2015-07-05 09:31:32,850 - INFO - admin - documents.browser.DocumentAddFormPage - added: HTML Document demodoc
     93  2015-07-05 09:31:39,025 - INFO - admin - documents.browser.HTMLDocumentManageFormPage - demodoc - saved: html_multilingual
     94  2015-07-05 09:31:43,279 - INFO - admin - documents.browser.HTMLDocumentManageFormPage - added: benny|waeup.local.DocumentManager
     95  2015-07-05 09:31:53,152 - INFO - admin - demodoc - Document published
     96  2015-07-05 09:31:57,216 - INFO - admin - demodoc - Document retracted
     97  2015-07-05 09:32:46,679 - INFO - admin - documents.browser.DocumentsContainerManageFormPage - removed: demodoc
     98
     99
     100Quick Guide
    52101===========
    53102
    54 Data Import
    55 ===========
     103How to add and reference an HTML document
     104-----------------------------------------
    56105
    57 Logging
    58 =======
     1061. Click *Documents > Manage > Add document*.
     1072. Select *HTML Document*, fill fields and press *Add document*.
     1083. Enter multilingual content in HTML format and press *Save*.
     1094. Click *View > Transition*.
     1105. Select *Publish document* and press *Save*.
     111
     112The document is now published and available to anonymous users.
     113
     1146. Mark and copy the HTML Element provided on the page:
     115   ``<a href= ... /a>``.
     1167. Open another HTML document or a page with multilingual content
     117   and paste the element where needed.
    59118
    60119
     120How to add and reference a PDF document
     121---------------------------------------
    61122
     1231. Click *Documents > Manage > Add document*.
     1242. Select *PDF Document*, fill fields and press *Add document*.
     1253. Select *Files* and upload a pdf file from your computer.
     1264. Click *View > Transition*.
     1275. Select *Publish document* and press *Save*.
    62128
     129The document and the connected pdf file are now published and
     130available to anonymous users.
    63131
     1326. Open the HTML source with your browser, search for the ``a``
     133   element
     1347. Mark and copy the HTML element found:
     135   ``<a target="image" href= ... /a>``.
     1368. Open another HTML document or a page with multilingual content
     137   and paste the element where needed.
  • main/waeup.kofa/trunk/src/waeup/kofa/documents/batching.py

    r13138 r13144  
    4343
    4444class DocumentProcessorBase(BatchProcessor):
    45     """A base for batch processors for IDocument objects.
     45    """This is the base class for all kinds of document processors.
     46    The `checkConversion` method checks whether `class_name` in a row
     47    corresponds with the processor chosen. This is to avoid accidentally
     48    wrong imports.
    4649    """
    4750    grok.implements(IBatchProcessor)
  • main/waeup.kofa/trunk/src/waeup/kofa/documents/browser.py

    r13138 r13144  
    3636from waeup.kofa.interfaces import MessageFactory as _
    3737from waeup.kofa.interfaces import (
    38     IContactForm, IKofaObject, IKofaUtils)
     38    IContactForm, IKofaObject, IKofaUtils, DOCLINK)
    3939from waeup.kofa.browser.layout import (
    4040    KofaPage, KofaEditFormPage, KofaAddFormPage, KofaDisplayFormPage,
     
    8282    pnav = 2
    8383    label = _('Documents')
     84    doclink = DOCLINK + '/documents.html'
    8485
    8586
     
    164165    grok.template('documentpage')
    165166    pnav = 2
     167    doclink = DOCLINK + '/documents.html'
    166168
    167169    @property
  • main/waeup.kofa/trunk/src/waeup/kofa/documents/browser_templates/htmldocumentpage.pt

    r12437 r13144  
    3535      </td>
    3636      <td>
    37         &lt;a href=&quot;
    38         <span tal:replace="python: view.url(context, 'display')"></span>
    39         &quot;&gt;<span tal:replace="context/title">FILENAME</span>&lt;/a&gt;
     37        &lt;a href=&quot;<span tal:replace="python: view.url(context, 'display')"></span>&quot;&gt;<span tal:replace="context/title">
     38        FILENAME
     39        </span>&lt;/a&gt;
    4040      </td>
    4141    </tr>
  • main/waeup.kofa/trunk/src/waeup/kofa/documents/export.py

    r13134 r13144  
    2929
    3030class DocumentExporterBase(grok.GlobalUtility, ExporterBase):
    31     """Exporter for documents.
     31    """This is the exporter base class for all kinds of document exporters.
     32    Derived classes export all documents of type `class_name` inside the
     33    documents container.
     34
     35    All schema fields and the property attributes
     36    `history`, `state`, `class_name` and `users_with_local_roles`
     37    are being exported.
    3238    """
    3339    grok.implements(ICSVExporter)
     
    5157
    5258    def mangle_value(self, value, name, context=None):
    53         """Hook for mangling values in derived classes
     59        """The mangler prepares the history messages and computes the
     60        `users_with_local_roles` value which is a Python expression like:
     61
     62        ``[{'user_name': u'bob', 'local_role': u'bobsrole'},
     63        {'user_name': u'anna', 'local_role': u'annasrole'}]``
    5464        """
    5565        if name == 'users_with_local_roles':
  • main/waeup.kofa/trunk/src/waeup/kofa/documents/interfaces.py

    r13134 r13144  
    3838    history = Attribute('Object history, a list of messages')
    3939    state = Attribute('Workflow state of a document')
     40    class_name = Attribute('Name of the document class')
     41
     42    local_roles = Attribute('List of local role names')
     43    translated_class_name = Attribute('Translatable class name of a document')
    4044    translated_state = Attribute('Translatable workflow state of a document')
    41     class_name = Attribute('Name of the document class')
    42     translated_class_name = Attribute('Translatable class name of a document')
    4345    formatted_transition_date = Attribute(
    4446        'Last transition formatted date string')
    4547    form_fields_interface = Attribute(
    4648        'Interface which is used in forms for grok.AutoFields')
    47     local_roles = Attribute('List of local role names')
    4849
    4950    document_id = schema.TextLine(
  • main/waeup.kofa/trunk/src/waeup/kofa/students/export.py

    r12971 r13144  
    315315
    316316class CourseTicketExporter(grok.GlobalUtility, StudentExporterBase):
    317     """The Course Ticket  Exporter exports course tickets. Usually,
     317    """The Course Ticket Exporter exports course tickets. Usually,
    318318    the exporter first filters the set of students by searching the
    319319    students catalog. Then it collects and iterates over all ``studylevel``
  • main/waeup.kofa/trunk/src/waeup/kofa/university/export.py

    r12869 r13144  
    3737
    3838    def mangle_value(self, value, name, context=None):
    39         """The mangler computes the users_with_local_roles value which
     39        """The mangler computes the `users_with_local_roles` value which
    4040        is a Python expression like:
    4141
Note: See TracChangeset for help on using the changeset viewer.