summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorLester Caine <lester@lsces.co.uk>2026-05-25 15:39:34 +0100
committerLester Caine <lester@lsces.co.uk>2026-05-25 15:39:34 +0100
commitfb30cd3317e01ebe8e748e4bcf1482e4c324b9b9 (patch)
tree2a263ad27d6a78b4fe5f78e30134b5edc5aa618b /templates
parent80d56ac6a0b704c1b480157422227626f63df67d (diff)
downloadliberty-fb30cd3317e01ebe8e748e4bcf1482e4c324b9b9.tar.gz
liberty-fb30cd3317e01ebe8e748e4bcf1482e4c324b9b9.tar.bz2
liberty-fb30cd3317e01ebe8e748e4bcf1482e4c324b9b9.zip
Add generic xref controllers and templates to liberty
Moves add/edit xref pages out of stock into liberty so any content type can use them. list_xref.tpl uses hasUpdatePermission() instead of a stock-specific permission check. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'templates')
-rw-r--r--templates/add_xref.tpl44
-rw-r--r--templates/edit_xref.tpl45
-rw-r--r--templates/list_xref.tpl56
3 files changed, 145 insertions, 0 deletions
diff --git a/templates/add_xref.tpl b/templates/add_xref.tpl
new file mode 100644
index 0000000..3be770f
--- /dev/null
+++ b/templates/add_xref.tpl
@@ -0,0 +1,44 @@
+{strip}
+<div class="edit liberty">
+ <div class="header">
+ <h1>{tr}Add Detail{/tr}: {$gContent->getTitle()|escape}</h1>
+ </div>
+
+ <div class="body">
+ {formfeedback error=$errors}
+
+ {form id="addXrefForm"}
+ <input type="hidden" name="content_id" value="{$gContent->mContentId}" />
+ <input type="hidden" name="xref_type" value="{$xref_type}" />
+
+ <div class="form-group">
+ {formlabel label="Type" for="source"}
+ {forminput}
+ {html_options name="source" id="source" options=$xrefTypeList.list}
+ {/forminput}
+ </div>
+
+ <div class="form-group">
+ {formlabel label="Value" for="edit"}
+ {forminput}
+ <input type="text" class="form-control" name="edit" id="edit" value="" />
+ {formhelp note="Enter the value for this detail record."}
+ {/forminput}
+ </div>
+
+ <div class="form-group">
+ {formlabel label="Linked Content ID" for="xref"}
+ {forminput}
+ <input type="text" class="form-control input-small" name="xref" id="xref" value="" />
+ {formhelp note="For supplier links: enter the contact content_id. Leave blank for all other types."}
+ {/forminput}
+ </div>
+
+ <div class="form-group submit">
+ <input type="submit" class="btn btn-default" name="fCancel" value="{tr}Cancel{/tr}" />
+ <input type="submit" class="btn btn-primary" name="fAddXref" value="{tr}Save{/tr}" />
+ </div>
+ {/form}
+ </div><!-- end .body -->
+</div><!-- end .liberty -->
+{/strip}
diff --git a/templates/edit_xref.tpl b/templates/edit_xref.tpl
new file mode 100644
index 0000000..9dbb0d8
--- /dev/null
+++ b/templates/edit_xref.tpl
@@ -0,0 +1,45 @@
+{strip}
+<div class="edit liberty">
+ <div class="header">
+ <h1>{tr}Edit Detail{/tr}: {$gContent->getTitle()|escape}</h1>
+ </div>
+
+ <div class="body">
+ {formfeedback error=$errors}
+
+ {form id="editXrefForm"}
+ <input type="hidden" name="content_id" value="{$xrefInfo.content_id}" />
+ <input type="hidden" name="xref_id" value="{$xrefInfo.xref_id}" />
+ <input type="hidden" name="source" value="{$xrefInfo.source|escape}" />
+
+ <div class="form-group">
+ {formlabel label="Type"}
+ {forminput}
+ <p class="form-control-static">{$xrefInfo.template_title|escape}</p>
+ {/forminput}
+ </div>
+
+ <div class="form-group">
+ {formlabel label="Value" for="edit"}
+ {forminput}
+ <input type="text" class="form-control" name="edit" id="edit" value="{$xrefInfo.data|escape}" />
+ {formhelp note="Enter the value for this detail record."}
+ {/forminput}
+ </div>
+
+ <div class="form-group">
+ {formlabel label="Linked Content ID" for="xref"}
+ {forminput}
+ <input type="text" class="form-control input-small" name="xref" id="xref" value="{$xrefInfo.xref|escape}" />
+ {formhelp note="For supplier links: enter the contact content_id. Leave blank for all other types."}
+ {/forminput}
+ </div>
+
+ <div class="form-group submit">
+ <input type="submit" class="btn btn-default" name="fCancel" value="{tr}Cancel{/tr}" />
+ <input type="submit" class="btn btn-primary" name="fSaveXref" value="{tr}Save{/tr}" />
+ </div>
+ {/form}
+ </div><!-- end .body -->
+</div><!-- end .liberty -->
+{/strip}
diff --git a/templates/list_xref.tpl b/templates/list_xref.tpl
new file mode 100644
index 0000000..b234e68
--- /dev/null
+++ b/templates/list_xref.tpl
@@ -0,0 +1,56 @@
+ {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>
+ <thead>
+ <tr>
+ <th>{tr}Source{/tr}</th>
+ <th>{tr}Data{/tr}</th>
+ {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>
+ </tr>
+ </thead>
+ <tbody>
+ {section name=xref loop=$gContent->mInfo.$source}
+ <tr class="{cycle values="even,odd"}">
+ <td>{$gContent->mInfo.$source[xref].source_title|escape}</td>
+ <td>
+ {if $gContent->mInfo.$source[xref].xref}
+ <a href="{$smarty.const.CONTACT_PKG_URL}?content_id={$gContent->mInfo.$source[xref].xref}">{$gContent->mInfo.$source[xref].data|escape}</a>
+ {else}
+ {$gContent->mInfo.$source[xref].data|escape}
+ {/if}
+ </td>
+ {if $source ne 'history'}
+ <td>{$gContent->mInfo.$source[xref].start_date|bit_short_date}</td>
+ {else}
+ <td>{$gContent->mInfo.$source[xref].end_date|bit_short_date}</td>
+ {/if}
+ <td>{$gContent->mInfo.$source[xref].last_update_date|bit_short_date}</td>
+ <td>
+ {if $gContent->hasUpdatePermission()}
+ {smartlink ititle="Edit" ipackage="liberty" ifile="edit_xref.php" booticon="fa-pen-to-square" content_id=$gContent->mInfo.content_id xref_id=$gContent->mInfo.$source[xref].xref_id}
+ {/if}
+ </td>
+ </tr>
+ {sectionelse}
+ <tr class="norecords">
+ <td colspan="5">{tr}No {$source_title} records found{/tr}</td>
+ </tr>
+ {/section}
+ </tbody>
+ </table>
+ </div>
+ {if $gContent->hasUpdatePermission() && $source ne 'history'}
+ <div>
+ {smartlink ititle="Add record" ipackage="liberty" ifile="add_xref.php" booticon="fa-plus" content_id=$gContent->mInfo.content_id xref_type=$xref_type}
+ </div>
+ {/if}
+ {/legend}
+ {/jstab}