Jump to content

ICT:FinalConfig-Chapter: Difference between revisions

From Costa Sano MediaWiki
No edit summary
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
= Final Configuration for the Chapter Entity =
= Final Configuration for the Chapter Entity =


Document revison: {{#time:Y-m-d|{{REVISIONTIMESTAMP}}}}
Document revision: {{#time:Y-m-d|{{REVISIONTIMESTAMP}}}} by {{REVISIONUSER}}


The aim is to create an interface without MediaWiki clutter and well protected to avoid confusing users with unnecessary elements on the page.
The Cargo template follows what has been decided in the DBML and is fully aligned with the reference entities Place and Organisation.


The aim is to create an interface without MediaWiki clutter and well protected to avoid confusing users with unnessessary elements on the page.
The Chapter entity is structurally simple:
The Cargo template follows what has been decided in the DBML. It is the first implementation of an entity in order to finetune a final dashboard layout.
- it is recursive (parent chapter)
- it has no foreign keys to other entities
 
This entity serves as the reference for the simplest recursive pattern in the system.
 
This configuration deliberately favors explicit behavior and robustness over visual polish or implicit framework behavior, in order to ensure long-term maintainability.


= Cargo Table: =
= Cargo Table: =
Line 12: Line 19:
<noinclude>
<noinclude>
Chapter data template
Chapter data template
</noinclude>


{{#cargo_declare:
{{#cargo_declare:
  _table=Chapters
  |_table=Chapters
  |title=String
  |Code=Page
  |code=String
  |Label=String
  |parent=Page
  |Parent=Page
  |sequence_number=Integer
  |Sequence=Integer
  |description=Text
  |Description=Text
  |start_date=Date
  |StartDate=Date
  |end_date=Date
  |EndDate=Date
  |notes=Text
  |Notes=Text
}}
}}


{{#forminput:form=Chapter}}
{{#cargo_store:
</noinclude>
|Code={{FULLPAGENAME}}
|Label={{{Label|}}}
|Parent={{{Parent|}}}
|Sequence={{{Sequence|}}}
|Description={{{Description|}}}
|StartDate={{{StartDate|}}}
|EndDate={{{EndDate|}}}
|Notes={{{Notes|}}}
}}


{{#cargo_store:
== {{{Label|}}} ==
title={{{title|}}}
{{DISPLAYTITLE:{{{Label}}}}}
|code={{PAGENAME}}
|sequence_number={{{sequence_number|}}}
|description={{{description|}}}
|start_date={{{start_date|}}}
|end_date={{{end_date|}}}
|notes={{{notes|}}}
|parent={{{parent|}}}


{{#if:{{{Parent|}}}|
'''Parent chapter:''' [[{{{Parent}}}]]
}}
}}


== {{{title|}}} ==
'''Notes:'''
{{{Notes|}}}
</pre>
 
Once the template is created, the Cargo table must be created manually.
If modifications are made to the table structure, the table must be recreated and the temporary table swapped via the Cargo administration interface.
 
The field Code stores the full page name (including namespace) to ensure unambiguous identification.


</pre>
Important conventions:
- Field names start with a capital letter
- Code is the page name and acts as the technical identifier
- Label is the human-readable name and is mandatory for all entities
- Parent is stored as a Page field
- The field name Label must not be renamed, as it is relied upon by shared JavaScript validation logic


Once the template is created don't forget to manually force the creation of the Cargo table.
Special lines at the bottom of the template:
If modifications are done to the table. On needs to manually update the table and then go to the Cargo interface to swap the temporary table to become the official one. Take care what is inside and outside
<pre>
<pre>
<noinclude>
== {{{Label|}}} ==
{{DISPLAYTITLE:{{{Label}}}}}
 
{{#if:{{{Parent|}}}|
'''Parent chapter:''' [[{{{Parent}}}]]
}}
 
'''Notes:'''
{{{Notes|}}}
</pre>
</pre>
These lines ensure that the human-readable name (Label) is consistently used as the visible page title, while the actual page name remains the stable technical identifier (Code).
This decoupling allows renaming the label without breaking Cargo relations or dashboards.


= Page Form: =
= Page Form: =
Line 64: Line 98:
|no footer
|no footer
}}}
}}}
''Fields marked with (*) are required.''


{{{for template|Chapter}}}
{{{for template|Chapter}}}
Line 69: Line 104:
{| class="formtable"
{| class="formtable"


| Parent Chapter
! Code
| {{{field|parent
| {{PAGENAME}}
  |label=Parent chapter
|-
  |input type=combobox
 
  |values from namespace=Chapter
! Name (*)
  |existing values only
| {{{field|Label}}}
  |placeholder=Top level (no parent)
}}}
|-
|-


! Title
! Parent chapter
| {{{field|title|mandatory}}}
| {{{field|Parent
|input type=combobox
|values from namespace=Chapter
|placeholder=Top level (no parent)
}}}
|-
|-


! Code
! Sequence
| {{PAGENAME}}
| {{{field|Sequence}}}
|-
|-


! Description
! Description
| {{{field|description|input type=textarea}}}
| {{{field|Description|input type=textarea}}}
|-
|-


! Start date
! Start date
| {{{field|start_date|input type=datepicker|year range=1800:2100|show year dropdown|show month dropdown}}}
| {{{field|StartDate|input type=datepicker|year range=1800:2100|show year dropdown|show month dropdown}}}
|-
|-


! End date
! End date
| {{{field|end_date|input type=datepicker|year range=1800:2100|show year dropdown|show month dropdown}}}
| {{{field|EndDate|input type=datepicker|year range=1800:2100|show year dropdown|show month dropdown}}}
|-
|-


! Notes
! Notes
| {{{field|notes|input type=textarea}}}
| {{{field|Notes|input type=textarea}}}


|}
|}


{{{standard input|save}}}
{{{standard input|save}}}


{{{end template}}}
{{{end template}}}
</pre>
</pre>


The first section is important to avoid  clutter.
The first section avoids MediaWiki edit clutter.
<pre>
<pre>
{{{info
{{{info
Line 121: Line 156:
}}}
}}}
</pre>
</pre>
The field Label (displayed to the user as “Name”) is mandatory for all entities.
This requirement is not implemented using the Page Forms |mandatory option, as this produces unusable white error boxes in the dark Vector-2022 environment.
Instead:
- the requirement is communicated via text and (*)
- enforcement is handled via JavaScript at save time


= Dashboard page =
= Dashboard page =
Line 126: Line 168:
<pre>
<pre>
= 📘 Costa Sano Research CHAPTER Dashboard =
= 📘 Costa Sano Research CHAPTER Dashboard =


📖 [[Dashboard:Chapter/Help|Need Help?]]
📖 [[Dashboard:Chapter/Help|Need Help?]]


{| class="wikitable sortable"
{| class="wikitable sortable"
! Code !! Title !! Parent
! Code !! Name !! Parent
{{#cargo_query:
{{#cargo_query:
  tables=Chapters
  tables=Chapters
  |fields=_pageName,code,title,parent
  |fields=_pageName,_pageTitle,Label,Parent
  |where=_pageNamespace=3004
  |where=_pageNamespace=3004
  |order by=code
  |order by=_pageTitle
  |format=template
  |format=template
  |template=ChapterRow
  |template=ChapterRow
Line 144: Line 185:
|}
|}


Choose your chapter code corresponding to above table and respectiong the convention CHxx.y.z
Choose your chapter code corresponding to above table and respecting the naming conventions.


{{#forminput:
{{#forminput:
Line 156: Line 197:
Last updated: {{CURRENTDAY}} {{CURRENTMONTHNAME}} {{CURRENTYEAR}} – {{CURRENTTIME}} UTC
Last updated: {{CURRENTDAY}} {{CURRENTMONTHNAME}} {{CURRENTYEAR}} – {{CURRENTTIME}} UTC
</div>
</div>
</pre>
IMPORTANT:
Dashboard tables are positional.
The number and order of:
- table headers
- Cargo query fields
- row template cells
MUST match exactly.


</pre>
Only the first column (Code) is clickable and leads to the edit form.
Different measures are taken to deal with caching data in MediaWiki, Cargo and what happens in a browser.
All other columns are displayed as plain text to prevent navigation to record pages.
<pre>
|cache=no
</pre>
this needed on the Cargo side to avoid caching and the following puts a new datetime on the page making it different from the precious version with the result that the page is renewed and the cached version is dropped.
<pre>
<div style="text-align:right; font-size:90%;">
Last updated: {{CURRENTDAY}} {{CURRENTMONTHNAME}} {{CURRENTYEAR}} – {{CURRENTTIME}} UTC
</div>
</pre>
The layout of the dashboard makes use of a Template;ChapterRow as descirbed below.
It makes the first colomn of the table clickeble to go back to the Form and edit the record.


= Row transclusion Template =
= Row transclusion Template =
Line 176: Line 215:
<includeonly>
<includeonly>
|-
|-
| {{#formlink:form=Chapter|target={{{_pageName}}}|link text={{{code}}}|returnto=Dashboard:Chapter}}
| {{#formlink:
| {{{title}}}
  form=Chapter
| {{{parent}}}
  |target={{{_pageName}}}
  |link text={{{_pageTitle}}}
  |returnto=Dashboard:Chapter
}}
| {{{Label}}}
| {{#if:{{{Parent|}}}|{{#titleparts:{{{Parent}}}|1}}|—}}
</includeonly>
</includeonly>
</pre>


</pre>All this creates pages in the namespace Chapter with the name being the code. The page is a configuration to serve in Page Forms extension. Below is an example of such a page.
Parent values are displayed as plain text (not links) to prevent users from navigating directly to record pages. All record editing is performed via forms accessed from the dashboard.
 
= Javascript =
 
The Chapter entity reuses the same shared JavaScript infrastructure as Place and Organisation:
- dashboard auto-purge
- save-time mandatory field enforcement (Label)
- no Page Forms |mandatory usage
 
No Chapter-specific JavaScript is required.
 
All Chapter pages are stored in the Chapter namespace with the page name acting as the Code.
 
Example:
<pre>
<pre>
{{Chapter
{{Chapter
|title=In the beginning
|Label=In the beginning
|description=Chapter describing what happened before Berck-sur-Mer...
|Description=Chapter describing what happened before Berck-sur-Mer...
|start_date=1800-01
|StartDate=1800-01
|end_date=1849-12
|EndDate=1849-12
|notes=NIHIL
|Notes=NIHIL
}}
}}
</pre>
</pre>
As you can see the page as is cannot be used as such and should be read via the dashboard page.
 
Such pages are configuration pages and must be accessed via the dashboard, not directly.


== References: ==
== References: ==

Latest revision as of 11:21, 17 February 2026

Final Configuration for the Chapter Entity

Document revision: 2026-02-17 by Mngr

The aim is to create an interface without MediaWiki clutter and well protected to avoid confusing users with unnecessary elements on the page. The Cargo template follows what has been decided in the DBML and is fully aligned with the reference entities Place and Organisation.

The Chapter entity is structurally simple: - it is recursive (parent chapter) - it has no foreign keys to other entities

This entity serves as the reference for the simplest recursive pattern in the system.

This configuration deliberately favors explicit behavior and robustness over visual polish or implicit framework behavior, in order to ensure long-term maintainability.

Cargo Table:

Template:Chapter

<noinclude>
Chapter data template
</noinclude>

{{#cargo_declare:
 |_table=Chapters
 |Code=Page
 |Label=String
 |Parent=Page
 |Sequence=Integer
 |Description=Text
 |StartDate=Date
 |EndDate=Date
 |Notes=Text
}}

{{#cargo_store:
 |Code={{FULLPAGENAME}}
 |Label={{{Label|}}}
 |Parent={{{Parent|}}}
 |Sequence={{{Sequence|}}}
 |Description={{{Description|}}}
 |StartDate={{{StartDate|}}}
 |EndDate={{{EndDate|}}}
 |Notes={{{Notes|}}}
}}

== {{{Label|}}} ==
{{DISPLAYTITLE:{{{Label}}}}}

{{#if:{{{Parent|}}}|
'''Parent chapter:''' [[{{{Parent}}}]]
}}

'''Notes:'''
{{{Notes|}}}

Once the template is created, the Cargo table must be created manually. If modifications are made to the table structure, the table must be recreated and the temporary table swapped via the Cargo administration interface.

The field Code stores the full page name (including namespace) to ensure unambiguous identification.

Important conventions: - Field names start with a capital letter - Code is the page name and acts as the technical identifier - Label is the human-readable name and is mandatory for all entities - Parent is stored as a Page field - The field name Label must not be renamed, as it is relied upon by shared JavaScript validation logic

Special lines at the bottom of the template:

== {{{Label|}}} ==
{{DISPLAYTITLE:{{{Label}}}}}

{{#if:{{{Parent|}}}|
'''Parent chapter:''' [[{{{Parent}}}]]
}}

'''Notes:'''
{{{Notes|}}}

These lines ensure that the human-readable name (Label) is consistently used as the visible page title, while the actual page name remains the stable technical identifier (Code).

This decoupling allows renaming the label without breaking Cargo relations or dashboards.

Page Form:

Form:Chapter

<noinclude>
Form for creating and editing Chapter pages.
</noinclude>

{{{info
|no summary
|no preview
|no minor edit
|no watch
|no footer
}}}
''Fields marked with (*) are required.''

{{{for template|Chapter}}}

{| class="formtable"

! Code
| {{PAGENAME}}
|-

! Name (*)
| {{{field|Label}}}
|-

! Parent chapter
| {{{field|Parent
 |input type=combobox
 |values from namespace=Chapter
 |placeholder=Top level (no parent)
}}}
|-

! Sequence
| {{{field|Sequence}}}
|-

! Description
| {{{field|Description|input type=textarea}}}
|-

! Start date
| {{{field|StartDate|input type=datepicker|year range=1800:2100|show year dropdown|show month dropdown}}}
|-

! End date
| {{{field|EndDate|input type=datepicker|year range=1800:2100|show year dropdown|show month dropdown}}}
|-

! Notes
| {{{field|Notes|input type=textarea}}}

|}

{{{standard input|save}}}

{{{end template}}}

The first section avoids MediaWiki edit clutter.

{{{info
|no summary
|no preview
|no minor edit
|no watch
|no footer
}}}

The field Label (displayed to the user as “Name”) is mandatory for all entities. This requirement is not implemented using the Page Forms |mandatory option, as this produces unusable white error boxes in the dark Vector-2022 environment.

Instead: - the requirement is communicated via text and (*) - enforcement is handled via JavaScript at save time

Dashboard page

Dashboard:Chapter

= 📘 Costa Sano Research CHAPTER Dashboard =

📖 [[Dashboard:Chapter/Help|Need Help?]]

{| class="wikitable sortable"
! Code !! Name !! Parent
{{#cargo_query:
 tables=Chapters
 |fields=_pageName,_pageTitle,Label,Parent
 |where=_pageNamespace=3004
 |order by=_pageTitle
 |format=template
 |template=ChapterRow
 |named args=yes
 |cache=no
}}
|}

Choose your chapter code corresponding to above table and respecting the naming conventions.

{{#forminput:
 form=Chapter
 |namespace=Chapter
 |button text=➕ New chapter
 |returnto=Dashboard:Chapter
}}

<div style="text-align:right; font-size:90%;">
Last updated: {{CURRENTDAY}} {{CURRENTMONTHNAME}} {{CURRENTYEAR}} – {{CURRENTTIME}} UTC
</div>

IMPORTANT: Dashboard tables are positional. The number and order of: - table headers - Cargo query fields - row template cells MUST match exactly.

Only the first column (Code) is clickable and leads to the edit form. All other columns are displayed as plain text to prevent navigation to record pages.

Row transclusion Template

Template:ChapterRow

<includeonly>
|-
| {{#formlink:
   form=Chapter
   |target={{{_pageName}}}
   |link text={{{_pageTitle}}}
   |returnto=Dashboard:Chapter
 }}
| {{{Label}}}
| {{#if:{{{Parent|}}}|{{#titleparts:{{{Parent}}}|1}}|—}}
</includeonly>

Parent values are displayed as plain text (not links) to prevent users from navigating directly to record pages. All record editing is performed via forms accessed from the dashboard.

Javascript

The Chapter entity reuses the same shared JavaScript infrastructure as Place and Organisation: - dashboard auto-purge - save-time mandatory field enforcement (Label) - no Page Forms |mandatory usage

No Chapter-specific JavaScript is required.

All Chapter pages are stored in the Chapter namespace with the page name acting as the Code.

Example:

{{Chapter
|Label=In the beginning
|Description=Chapter describing what happened before Berck-sur-Mer...
|StartDate=1800-01
|EndDate=1849-12
|Notes=NIHIL
}}

Such pages are configuration pages and must be accessed via the dashboard, not directly.

References: