From 2fb898ce714e282f5dfca365fe52abc15437f7ef Mon Sep 17 00:00:00 2001 From: Lester Caine Date: Wed, 27 May 2026 20:20:11 +0100 Subject: Allow xref tabs to suppress edit/delete buttons via allow_edit=false list_xref.tpl: accept allow_edit param; assign $xrefAllowEdit for record templates; hide Edit column header when allow_edit is false. view_xref_*_record.tpl (8 files): gate hasUpdatePermission and hasExpungePermission checks on $xrefAllowEdit|default:true so callers can render xref data read-only without altering user permissions. Co-Authored-By: Claude Sonnet 4.6 --- templates/list_xref.tpl | 3 ++- templates/view_xref_address_record.tpl | 4 ++-- templates/view_xref_bank_record.tpl | 4 ++-- templates/view_xref_contact_record.tpl | 4 ++-- templates/view_xref_date_record.tpl | 4 ++-- templates/view_xref_locate_record.tpl | 4 ++-- templates/view_xref_phone_record.tpl | 4 ++-- templates/view_xref_sig_record.tpl | 4 ++-- templates/view_xref_text_record.tpl | 4 ++-- 9 files changed, 18 insertions(+), 17 deletions(-) diff --git a/templates/list_xref.tpl b/templates/list_xref.tpl index e1a6bbc..9ac5a3e 100644 --- a/templates/list_xref.tpl +++ b/templates/list_xref.tpl @@ -1,4 +1,5 @@ {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}
@@ -15,7 +16,7 @@ {tr}Ended{/tr} {/if} {tr}Updated{/tr} - {tr}Edit{/tr} + {if $xrefAllowEdit}{tr}Edit{/tr}{/if} diff --git a/templates/view_xref_address_record.tpl b/templates/view_xref_address_record.tpl index d7efba4..21af596 100644 --- a/templates/view_xref_address_record.tpl +++ b/templates/view_xref_address_record.tpl @@ -13,10 +13,10 @@ {$gContent->mInfo.$source[xref].last_update_date|bit_short_date} - {if $gContent->hasUpdatePermission() && $source ne 'history'} + {if $xrefAllowEdit|default:true && $gContent->hasUpdatePermission() && $source ne 'history'} {smartlink ititle="Edit" ipackage="liberty" ifile="edit_xref.php" booticon="icon-note-edit" content_id=$gContent->mInfo.content_id xref_id=$gContent->mInfo.$source[xref].xref_id} {/if} - {if $gContent->hasExpungePermission()} + {if $xrefAllowEdit|default:true && $gContent->hasExpungePermission()} {if $source eq 'history'} {smartlink ititle="Restore" ipackage="liberty" ifile="edit_xref.php" booticon="icon-note-edit" content_id=$gContent->mInfo.content_id xref_id=$gContent->mInfo.$source[xref].xref_id expunge=-1} {else} diff --git a/templates/view_xref_bank_record.tpl b/templates/view_xref_bank_record.tpl index edea55a..099ce6b 100644 --- a/templates/view_xref_bank_record.tpl +++ b/templates/view_xref_bank_record.tpl @@ -13,10 +13,10 @@ {$gContent->mInfo.$source[xref].last_update_date|bit_short_date} - {if $gContent->hasUpdatePermission() && $source ne 'history'} + {if $xrefAllowEdit|default:true && $gContent->hasUpdatePermission() && $source ne 'history'} {smartlink ititle="Edit" ipackage="liberty" ifile="edit_xref.php" booticon="icon-note-edit" content_id=$gContent->mInfo.content_id xref_id=$gContent->mInfo.$source[xref].xref_id} {/if} - {if $gContent->hasExpungePermission()} + {if $xrefAllowEdit|default:true && $gContent->hasExpungePermission()} {if $source eq 'history'} {smartlink ititle="Restore" ipackage="liberty" ifile="edit_xref.php" booticon="icon-note-edit" content_id=$gContent->mInfo.content_id xref_id=$gContent->mInfo.$source[xref].xref_id expunge=-1} {else} diff --git a/templates/view_xref_contact_record.tpl b/templates/view_xref_contact_record.tpl index ec14270..c89a8ae 100644 --- a/templates/view_xref_contact_record.tpl +++ b/templates/view_xref_contact_record.tpl @@ -19,10 +19,10 @@ {$gContent->mInfo.$source[xref].last_update_date|bit_short_date} - {if $gContent->hasUpdatePermission() && $source ne 'history'} + {if $xrefAllowEdit|default:true && $gContent->hasUpdatePermission() && $source ne 'history'} {smartlink ititle="Edit" ipackage="liberty" ifile="edit_xref.php" booticon="icon-note-edit" content_id=$gContent->mInfo.content_id xref_id=$gContent->mInfo.$source[xref].xref_id} {/if} - {if $gContent->hasExpungePermission()} + {if $xrefAllowEdit|default:true && $gContent->hasExpungePermission()} {if $source eq 'history'} {smartlink ititle="Restore" ipackage="liberty" ifile="edit_xref.php" booticon="icon-note-edit" content_id=$gContent->mInfo.content_id xref_id=$gContent->mInfo.$source[xref].xref_id expunge=-1} {else} diff --git a/templates/view_xref_date_record.tpl b/templates/view_xref_date_record.tpl index edea55a..099ce6b 100644 --- a/templates/view_xref_date_record.tpl +++ b/templates/view_xref_date_record.tpl @@ -13,10 +13,10 @@ {$gContent->mInfo.$source[xref].last_update_date|bit_short_date} - {if $gContent->hasUpdatePermission() && $source ne 'history'} + {if $xrefAllowEdit|default:true && $gContent->hasUpdatePermission() && $source ne 'history'} {smartlink ititle="Edit" ipackage="liberty" ifile="edit_xref.php" booticon="icon-note-edit" content_id=$gContent->mInfo.content_id xref_id=$gContent->mInfo.$source[xref].xref_id} {/if} - {if $gContent->hasExpungePermission()} + {if $xrefAllowEdit|default:true && $gContent->hasExpungePermission()} {if $source eq 'history'} {smartlink ititle="Restore" ipackage="liberty" ifile="edit_xref.php" booticon="icon-note-edit" content_id=$gContent->mInfo.content_id xref_id=$gContent->mInfo.$source[xref].xref_id expunge=-1} {else} diff --git a/templates/view_xref_locate_record.tpl b/templates/view_xref_locate_record.tpl index edea55a..099ce6b 100644 --- a/templates/view_xref_locate_record.tpl +++ b/templates/view_xref_locate_record.tpl @@ -13,10 +13,10 @@ {$gContent->mInfo.$source[xref].last_update_date|bit_short_date} - {if $gContent->hasUpdatePermission() && $source ne 'history'} + {if $xrefAllowEdit|default:true && $gContent->hasUpdatePermission() && $source ne 'history'} {smartlink ititle="Edit" ipackage="liberty" ifile="edit_xref.php" booticon="icon-note-edit" content_id=$gContent->mInfo.content_id xref_id=$gContent->mInfo.$source[xref].xref_id} {/if} - {if $gContent->hasExpungePermission()} + {if $xrefAllowEdit|default:true && $gContent->hasExpungePermission()} {if $source eq 'history'} {smartlink ititle="Restore" ipackage="liberty" ifile="edit_xref.php" booticon="icon-note-edit" content_id=$gContent->mInfo.content_id xref_id=$gContent->mInfo.$source[xref].xref_id expunge=-1} {else} diff --git a/templates/view_xref_phone_record.tpl b/templates/view_xref_phone_record.tpl index 8fe0d1a..5c95005 100644 --- a/templates/view_xref_phone_record.tpl +++ b/templates/view_xref_phone_record.tpl @@ -13,10 +13,10 @@ {$gContent->mInfo.$source[xref].last_update_date|bit_short_date} - {if $gContent->hasUpdatePermission() && $source ne 'history'} + {if $xrefAllowEdit|default:true && $gContent->hasUpdatePermission() && $source ne 'history'} {smartlink ititle="Edit" ipackage="liberty" ifile="edit_xref.php" booticon="icon-note-edit" content_id=$gContent->mInfo.content_id xref_id=$gContent->mInfo.$source[xref].xref_id} {/if} - {if $gContent->hasExpungePermission()} + {if $xrefAllowEdit|default:true && $gContent->hasExpungePermission()} {if $source eq 'history'} {smartlink ititle="Restore" ipackage="liberty" ifile="edit_xref.php" booticon="icon-note-edit" content_id=$gContent->mInfo.content_id xref_id=$gContent->mInfo.$source[xref].xref_id expunge=-1} {else} diff --git a/templates/view_xref_sig_record.tpl b/templates/view_xref_sig_record.tpl index edea55a..099ce6b 100644 --- a/templates/view_xref_sig_record.tpl +++ b/templates/view_xref_sig_record.tpl @@ -13,10 +13,10 @@ {$gContent->mInfo.$source[xref].last_update_date|bit_short_date} - {if $gContent->hasUpdatePermission() && $source ne 'history'} + {if $xrefAllowEdit|default:true && $gContent->hasUpdatePermission() && $source ne 'history'} {smartlink ititle="Edit" ipackage="liberty" ifile="edit_xref.php" booticon="icon-note-edit" content_id=$gContent->mInfo.content_id xref_id=$gContent->mInfo.$source[xref].xref_id} {/if} - {if $gContent->hasExpungePermission()} + {if $xrefAllowEdit|default:true && $gContent->hasExpungePermission()} {if $source eq 'history'} {smartlink ititle="Restore" ipackage="liberty" ifile="edit_xref.php" booticon="icon-note-edit" content_id=$gContent->mInfo.content_id xref_id=$gContent->mInfo.$source[xref].xref_id expunge=-1} {else} diff --git a/templates/view_xref_text_record.tpl b/templates/view_xref_text_record.tpl index ec14270..c89a8ae 100644 --- a/templates/view_xref_text_record.tpl +++ b/templates/view_xref_text_record.tpl @@ -19,10 +19,10 @@ {$gContent->mInfo.$source[xref].last_update_date|bit_short_date} - {if $gContent->hasUpdatePermission() && $source ne 'history'} + {if $xrefAllowEdit|default:true && $gContent->hasUpdatePermission() && $source ne 'history'} {smartlink ititle="Edit" ipackage="liberty" ifile="edit_xref.php" booticon="icon-note-edit" content_id=$gContent->mInfo.content_id xref_id=$gContent->mInfo.$source[xref].xref_id} {/if} - {if $gContent->hasExpungePermission()} + {if $xrefAllowEdit|default:true && $gContent->hasExpungePermission()} {if $source eq 'history'} {smartlink ititle="Restore" ipackage="liberty" ifile="edit_xref.php" booticon="icon-note-edit" content_id=$gContent->mInfo.content_id xref_id=$gContent->mInfo.$source[xref].xref_id expunge=-1} {else} -- cgit v1.3