Ferreteria/v0.5/dropin: Difference between revisions

From Woozle Writes Code
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
A '''dropin''' is a collection of code-files which can be included in a [[Ferreteria]] project by simply being "dropped in" to the appropriate folder (as designated by the local configuration). Each dropin must have an index file which tells Ferreteria what classes, actions, files, etc. are involved.
A '''dropin''' is a collection of code-files which can be included in a [[Ferreteria]] project by simply being "dropped in" to the appropriate folder (as designated by the local configuration). Each dropin must have an index file which tells Ferreteria what classes, actions, files, etc. are involved.
==Process==
==Process==
===loading/display===
* <code>(ctDropInManager)</code> looks through each subfolder within the dropins folder.
* <code>(ctDropInManager)</code> looks through each subfolder within the dropins folder.
* For each folder found, <code>(ctDropInManager)->CheckFolder()</code> checks for an index file.
* For each folder found, <code>(ctDropInManager)->CheckFolder()</code> checks for an index file.
* If the index file is found, it creates a <code>crcDropIndex</code> object and calls <code>(crcDropIndex)->ProcessIndex()</code>
* If the index file is found, it creates a <code>crcDropIndex</code> object and calls <code>(crcDropIndex)->ProcessIndex()</code>
* <code>->ProcessIndex()</code> loads the <code>$arDropin</code> data into a <code>crcDropIndex</code> object, which more or less encapsulates it.
* <code>->ProcessIndex()</code> loads the <code>$arDropin</code> data into a <code>crcDropIndex</code> object, which more or less encapsulates it.
===URL interpretation===
* in fcArrayLink:
** GetLinkURL() calls GetLinkArray()
** GetLinkArray() calls GetLinkArray_figured()
** GetLinkArray_figured() calls cDropinLink&rarr;GetLinkArray_self()
* in cDropinLink:
** OnEventAfter() calls PageEvent(); Render() calls AddPageRendering();
** PageEvent(), AddPageRendering(), and GetLinkArray_self() each call MakeActionObject() to get the table or record to act on.
** MakeActionObject() looks up a record or table object from the URL, and returns the result.
==Classes==
==Classes==
===loading/display===
These classes make heavy use of the {{l/same|ClassLoader}} system.
These classes make heavy use of the {{l/same|ClassLoader}} system.
* '''csDropinManager''': static class which runs the whole process; analogous (but not related) to '''csLoader'''
* '''csDropinManager''': static class which runs the whole process; analogous (but not related) to '''csLoader'''
* '''cDropIndex''': manages index to dropin library; descends from '''caLibrary'''
* '''cDropIndex''': manages index to dropin library; descends from '''caLibrary'''
* '''cDropinCode''': single executable PHP file, has zero or more autoloadable classes; descends from '''caModule'''
===URL interpretation===
* '''cDropinLink'''
** '''cDropinAction'''
==Index File==
==Index File==
By convention, the index file is named <code>index.dropin.php</code>; this name can be changed via the global settings object. The index file's primary task is to define the <code>$arDropin</code> array, with the following elements:
By convention, the index file is named <code>index.dropin.php</code>; this name can be changed via the global settings object. The index file's primary task is to define the <code>$arDropin</code> array, with the following elements:

Revision as of 12:31, 6 November 2021

A dropin is a collection of code-files which can be included in a Ferreteria project by simply being "dropped in" to the appropriate folder (as designated by the local configuration). Each dropin must have an index file which tells Ferreteria what classes, actions, files, etc. are involved.

Process

loading/display

  • (ctDropInManager) looks through each subfolder within the dropins folder.
  • For each folder found, (ctDropInManager)->CheckFolder() checks for an index file.
  • If the index file is found, it creates a crcDropIndex object and calls (crcDropIndex)->ProcessIndex()
  • ->ProcessIndex() loads the $arDropin data into a crcDropIndex object, which more or less encapsulates it.

URL interpretation

  • in fcArrayLink:
    • GetLinkURL() calls GetLinkArray()
    • GetLinkArray() calls GetLinkArray_figured()
    • GetLinkArray_figured() calls cDropinLink→GetLinkArray_self()
  • in cDropinLink:
    • OnEventAfter() calls PageEvent(); Render() calls AddPageRendering();
    • PageEvent(), AddPageRendering(), and GetLinkArray_self() each call MakeActionObject() to get the table or record to act on.
    • MakeActionObject() looks up a record or table object from the URL, and returns the result.

Classes

loading/display

These classes make heavy use of the ClassLoader system.

  • csDropinManager: static class which runs the whole process; analogous (but not related) to csLoader
  • cDropIndex: manages index to dropin library; descends from caLibrary

URL interpretation

  • cDropinLink
    • cDropinAction

Index File

By convention, the index file is named index.dropin.php; this name can be changed via the global settings object. The index file's primary task is to define the $arDropin array, with the following elements:

  • name: the name of the dropin
  • descr: one-line description
  • version: version number
  • date: release date, in YYYY-MM-DD format
  • URL: full URL to documentation
  • section: array which defines how the dropin will be listed in the dropins bar
    • title: what to display at the top of the section
    • popup: (optional) text to appear when mouse hovers over the dropin name
    • actions: array of items to appear within the section
      • array[<item key>]: indexed array of information for a single actionable item
        • class: name of action class to invoke
        • text: text to display in section listing
        • summary: one-line description of item (used for hover-over text but may appear in other places)
        • perms: permits required in order to invoke this item. If user lacks permission, item will not be displayed.
  • classes: array of files and the classes they contain
    • array[<relative filespec>]: collection array of classes available in the given code-file