summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorLester Caine <lester@lsces.co.uk>2026-06-06 09:40:55 +0100
committerLester Caine <lester@lsces.co.uk>2026-06-06 09:40:55 +0100
commite979cd1ddcfc3f86f55b6385ac65372ec84796a5 (patch)
treec48457a2c8d010c71fbb1c4b6210671bb4da71bd /templates
parentaed33e90f6628b281cd1c8ae09f9bed38960a333 (diff)
downloadliberty-e979cd1ddcfc3f86f55b6385ac65372ec84796a5.tar.gz
liberty-e979cd1ddcfc3f86f55b6385ac65372ec84796a5.tar.bz2
liberty-e979cd1ddcfc3f86f55b6385ac65372ec84796a5.zip
xref group templates: drop Link column; tighten text item edit gating
- list_xref.tpl: remove dead Link <th>; add 30/30/40% column widths; fix colspan to conditional 6/3; support both LibertyXrefGroup and legacy $source paths - view_xref_text_item.tpl: remove &nbsp; Link cell; wrap date/updated/ edit cells under single {if $xrefAllowEdit|default:false} - LibertyXrefGroup: new class — loads xref rows for one x_group, separates expired rows into history Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'templates')
-rw-r--r--templates/list_xref.tpl66
-rw-r--r--templates/view_xref_text_item.tpl31
2 files changed, 66 insertions, 31 deletions
diff --git a/templates/list_xref.tpl b/templates/list_xref.tpl
index 6ffa8c4..21b2608 100644
--- a/templates/list_xref.tpl
+++ b/templates/list_xref.tpl
@@ -1,21 +1,60 @@
+{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>
+ <thead>
+ <tr>
+ <th style="width:30%">{tr}Type{/tr}</th>
+ <th style="width:30%">{tr}Key{/tr}</th>
+ <th style="width:40%">{tr}Value{/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>
+ {/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}
- {assign var=xrefAllowEdit value=$allow_edit|default:true}
{jstab title="$source_title ($xrefcnt)"}
{legend legend=$source_title}
<div class="form-group table-responsive">
<table>
<thead>
<tr>
- <th>{tr}Type{/tr}</th>
- <th>{tr}Link{/tr}</th>
- <th>{tr}Key{/tr}</th>
- <th>{tr}Value{/tr}</th>
+ <th style="width:30%">{tr}Type{/tr}</th>
+ <th style="width:30%">{tr}Key{/tr}</th>
+ <th style="width:40%">{tr}Value{/tr}</th>
{if $xrefAllowEdit}
- {if $source ne 'history'}
- <th>{tr}Started{/tr}</th>
- {else}
- <th>{tr}Ended{/tr}</th>
- {/if}
+ {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}
@@ -23,13 +62,13 @@
</thead>
<tbody>
{section name=xref loop=$gContent->mInfo.$source}
- {assign var=_rowTpl value=$gContent->mInfo.$source[xref].template}
+ {assign var=xrefInfo value=$gContent->mInfo.$source[xref]}
<tr class="{cycle values="even,odd"}">
- {include file=$gContent->getXrefRecordTemplate($_rowTpl)}
+ {include file=$gContent->getXrefRecordTemplate($xrefInfo.template)}
</tr>
{sectionelse}
<tr class="norecords">
- <td colspan="7">{tr}No {$source_title} records found{/tr}</td>
+ <td colspan="{if $xrefAllowEdit}6{else}3{/if}">{tr}No {$source_title} records found{/tr}</td>
</tr>
{/section}
</tbody>
@@ -42,3 +81,4 @@
{/if}
{/legend}
{/jstab}
+{/if}
diff --git a/templates/view_xref_text_item.tpl b/templates/view_xref_text_item.tpl
index dbd534a..0c9523a 100644
--- a/templates/view_xref_text_item.tpl
+++ b/templates/view_xref_text_item.tpl
@@ -1,34 +1,29 @@
{strip}
-<td>{$gContent->mInfo.$source[xref].source_title|escape}</td>
-<td>
- {if isset($gContent->mInfo.$source[xref].xref) && $gContent->mInfo.$source[xref].xref > 100}
- {$gContent->mInfo.$source[xref].xref|escape}
- {else}
- &nbsp;
- {/if}
-</td>
-<td>{$gContent->mInfo.$source[xref].xkey|escape} {$gContent->mInfo.$source[xref].xkey_ext|escape}</td>
-<td>{$gContent->mInfo.$source[xref].data|escape}</td>
+<td>{$xrefInfo.xref_title|escape}</td>
+<td>{$xrefInfo.xkey|escape} {$xrefInfo.xkey_ext|escape}</td>
+<td>{$xrefInfo.data|escape}</td>
+{if $xrefAllowEdit|default:false}
<td>
{if $source ne 'history'}
- {$gContent->mInfo.$source[xref].start_date|bit_short_date}
+ {$xrefInfo.start_date|bit_short_date}
{else}
- {$gContent->mInfo.$source[xref].end_date|bit_short_date}
+ {$xrefInfo.end_date|bit_short_date}
{/if}
</td>
-<td>{$gContent->mInfo.$source[xref].last_update_date|bit_short_date}</td>
+<td>{$xrefInfo.last_update_date|bit_short_date}</td>
<td>
<span class="actionicon">
- {if $xrefAllowEdit|default:true && $gContent->hasUpdatePermission() && $source ne 'history'}
- {smartlink ititle="Edit" ipackage="liberty" ifile="edit_xref.php" biticon="edit" content_id=$gContent->mInfo.content_id xref_id=$gContent->mInfo.$source[xref].xref_id}
+ {if $gContent->hasUpdatePermission() && $source ne 'history'}
+ {smartlink ititle="Edit" ipackage="liberty" ifile="edit_xref.php" biticon="edit" content_id=$gContent->mInfo.content_id xref_id=$xrefInfo.xref_id}
{/if}
- {if $xrefAllowEdit|default:true && $gContent->hasExpungePermission()}
+ {if $gContent->hasExpungePermission()}
{if $source eq 'history'}
- {smartlink ititle="Restore" ipackage="liberty" ifile="edit_xref.php" biticon="edit" content_id=$gContent->mInfo.content_id xref_id=$gContent->mInfo.$source[xref].xref_id expunge=-1}
+ {smartlink ititle="Restore" ipackage="liberty" ifile="edit_xref.php" biticon="edit" content_id=$gContent->mInfo.content_id xref_id=$xrefInfo.xref_id expunge=-1}
{else}
- {smartlink ititle="Delete" ipackage="liberty" ifile="edit_xref.php" biticon="user-trash" content_id=$gContent->mInfo.content_id xref_id=$gContent->mInfo.$source[xref].xref_id expunge=1}
+ {smartlink ititle="Delete" ipackage="liberty" ifile="edit_xref.php" biticon="user-trash" content_id=$gContent->mInfo.content_id xref_id=$xrefInfo.xref_id expunge=1}
{/if}
{/if}
</span>
</td>
+{/if}
{/strip}