summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorLester Caine <lester@lsces.co.uk>2026-06-06 15:03:30 +0100
committerLester Caine <lester@lsces.co.uk>2026-06-06 15:03:30 +0100
commitbe5df3df206bd49417ef0d5a68033e22de747e8b (patch)
treee68d42acb150ca2267f187491ecc522a1b9dcb08 /templates
parent87ffc50fc40575ef2ade7aac80b274c2e2c542e0 (diff)
downloadliberty-be5df3df206bd49417ef0d5a68033e22de747e8b.tar.gz
liberty-be5df3df206bd49417ef0d5a68033e22de747e8b.tar.bz2
liberty-be5df3df206bd49417ef0d5a68033e22de747e8b.zip
xref: migrate query methods to LibertyXrefType; docblocks throughout
LibertyXrefType gains five runtime statics (getDisplayGroups, getTypeMarkers, getAvailableItems, getTemplateFormats, getContentTypeMarkers) — role-filtered, content-type-scoped. LibertyContent xref query methods become one-line delegates. LibertyXrefInfo added as new class (was missing from repo). Docblocks added to LibertyContent class, LibertyXref, LibertyXrefGroup, LibertyXrefInfo, LibertyXrefType. list_xref.tpl: remove dead legacy $source path; new path only. loadXrefList() removed from LibertyContent (stock fully migrated). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'templates')
-rw-r--r--templates/list_xref.tpl111
1 files changed, 34 insertions, 77 deletions
diff --git a/templates/list_xref.tpl b/templates/list_xref.tpl
index f617f04..c5251da 100644
--- a/templates/list_xref.tpl
+++ b/templates/list_xref.tpl
@@ -1,84 +1,41 @@
{assign var=xrefAllowEdit value=$allow_edit|default:true}
-{if isset($xrefGroup)}
- {* New path: called with a LibertyXrefGroup object *}
- {assign var=tabTitle value=$xrefGroup->mTitle}
- {assign var=isHistory value=($xrefGroup->mXGroup eq 'history')}
- {jstab title="`$tabTitle` ({$xrefGroup->mXrefs|@count})"}
- {legend legend=$tabTitle}
- <div class="form-group table-responsive">
- <table class="table">
- <thead>
- <tr>
- <th>{tr}Type{/tr}</th>
- <th>{tr}Value{/tr}</th>
- <th>{tr}Notes{/tr}</th>
- {if $xrefAllowEdit}
- {if $isHistory}<th>{tr}Ended{/tr}</th>{else}<th>{tr}Started{/tr}</th>{/if}
- <th>{tr}Updated{/tr}</th>
- <th>{tr}Edit{/tr}</th>
- {/if}
- </tr>
- </thead>
- <tbody>
- {if $xrefGroup->mXrefs}
- {foreach $xrefGroup->mXrefs as $xrefInfo}
- <tr class="{cycle values="even,odd"}">
- {include file=$gContent->getXrefRecordTemplate($xrefInfo.template)}
- </tr>
- {/foreach}
- {else}
- <tr class="norecords">
- <td colspan="{if $xrefAllowEdit}6{else}3{/if}">{tr}No {$tabTitle} records found{/tr}</td>
- </tr>
+{assign var=tabTitle value=$xrefGroup->mTitle}
+{assign var=isHistory value=($xrefGroup->mXGroup eq 'history')}
+{jstab title="`$tabTitle` ({$xrefGroup->mXrefs|@count})"}
+{legend legend=$tabTitle}
+<div class="form-group table-responsive">
+ <table class="table">
+ <thead>
+ <tr>
+ <th>{tr}Type{/tr}</th>
+ <th>{tr}Value{/tr}</th>
+ <th>{tr}Notes{/tr}</th>
+ {if $xrefAllowEdit}
+ {if $isHistory}<th>{tr}Ended{/tr}</th>{else}<th>{tr}Started{/tr}</th>{/if}
+ <th>{tr}Updated{/tr}</th>
+ <th>{tr}Edit{/tr}</th>
{/if}
- </tbody>
- </table>
- </div>
- {if $allow_add && $gContent->isValid() && $gContent->hasUpdatePermission() && !$isHistory}
- <div>
- {smartlink ititle="Add record" ipackage="liberty" ifile="add_xref.php" biticon="list-add" content_id=$gContent->mInfo.content_id group=$xrefGroup->mSortOrder}
- </div>
- {/if}
- {/legend}
- {/jstab}
-{else}
- {* Legacy path: called with $source and $source_title (stock, other packages) *}
- {assign var=xrefcnt value=$gContent->mInfo.$source|default:[]|@count}
- {jstab title="$source_title ($xrefcnt)"}
- {legend legend=$source_title}
- <div class="form-group table-responsive">
- <table class="table">
- <thead>
- <tr>
- <th>{tr}Type{/tr}</th>
- <th>{tr}Value{/tr}</th>
- <th>{tr}Notes{/tr}</th>
- {if $xrefAllowEdit}
- {if $source ne 'history'}<th>{tr}Started{/tr}</th>{else}<th>{tr}Ended{/tr}</th>{/if}
- <th>{tr}Updated{/tr}</th>
- <th>{tr}Edit{/tr}</th>
- {/if}
- </tr>
- </thead>
- <tbody>
- {section name=xref loop=$gContent->mInfo.$source}
- {assign var=xrefInfo value=$gContent->mInfo.$source[xref]}
+ </tr>
+ </thead>
+ <tbody>
+ {if $xrefGroup->mXrefs}
+ {foreach $xrefGroup->mXrefs as $xrefInfo}
<tr class="{cycle values="even,odd"}">
{include file=$gContent->getXrefRecordTemplate($xrefInfo.template)}
</tr>
- {sectionelse}
- <tr class="norecords">
- <td colspan="{if $xrefAllowEdit}6{else}3{/if}">{tr}No {$source_title} records found{/tr}</td>
- </tr>
- {/section}
- </tbody>
- </table>
+ {/foreach}
+ {else}
+ <tr class="norecords">
+ <td colspan="{if $xrefAllowEdit}6{else}3{/if}">{tr}No {$tabTitle} records found{/tr}</td>
+ </tr>
+ {/if}
+ </tbody>
+ </table>
+</div>
+{if $allow_add && $gContent->isValid() && $gContent->hasUpdatePermission() && !$isHistory}
+ <div>
+ {smartlink ititle="Add record" ipackage="liberty" ifile="add_xref.php" biticon="list-add" content_id=$gContent->mInfo.content_id group=$xrefGroup->mSortOrder}
</div>
- {if $allow_add && $gContent->isValid() && $gContent->hasUpdatePermission() && $source ne 'history'}
- <div>
- {smartlink ititle="Add record" ipackage="liberty" ifile="add_xref.php" biticon="list-add" content_id=$gContent->mInfo.content_id group=$group}
- </div>
- {/if}
- {/legend}
- {/jstab}
{/if}
+{/legend}
+{/jstab}