summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorLester Caine <lester@lsces.co.uk>2026-06-11 19:26:25 +0100
committerLester Caine <lester@lsces.co.uk>2026-06-11 19:26:25 +0100
commit64aae1e41d9288a6d9709781af29b06fe6adb5ca (patch)
treed5d5e74420cee938d7e8ff90b9e6792d5f44cc77 /templates
parent27c615a0a26edb985543e520587e3043d91489f6 (diff)
downloadcontact-64aae1e41d9288a6d9709781af29b06fe6adb5ca.tar.gz
contact-64aae1e41d9288a6d9709781af29b06fe6adb5ca.tar.bz2
contact-64aae1e41d9288a6d9709781af29b06fe6adb5ca.zip
Introduce ContactPerson and ContactBusiness subclasses
Splits the Contact class into ContactPerson (content_type_guid='contactperson') and ContactBusiness (content_type_guid='contactbusiness'), each using 'contact' as the shared package-level xref schema. Replaces the $isPerson/$00 xref hack with proper class identity via instanceof. - ContactPerson.php, ContactBusiness.php: new subclasses - Contact.php: loadXrefTypeList() reads type tags directly from liberty_xref; getAvailableTypeItems() for edit form (schema-driven with pre-upgrade fallback); getDisplayUrl() now points to display_contact.php - Type item codes: P01/P02 (person), B01-B04 (business, B01=Service new) - list_people.php, list_businesses.php: separate list pages per type - list_contacts.php: combined display-layer merge of both types - 5.0.3.php: upgrade script migrating existing data to new content types and codes - Templates: isPerson flag from instanceof; horizontal type checkboxes; list.tpl accepts $listTitle; menu adds People/Businesses entries Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'templates')
-rwxr-xr-xtemplates/display_contact.tpl2
-rwxr-xr-xtemplates/display_type_header.tpl4
-rwxr-xr-xtemplates/edit.tpl6
-rwxr-xr-xtemplates/edit_type_header.tpl19
-rwxr-xr-xtemplates/list.tpl2
-rwxr-xr-xtemplates/menu_contact.tpl6
6 files changed, 16 insertions, 23 deletions
diff --git a/templates/display_contact.tpl b/templates/display_contact.tpl
index 8512d33..2a3ba39 100755
--- a/templates/display_contact.tpl
+++ b/templates/display_contact.tpl
@@ -9,7 +9,7 @@
<div class="clear"></div>
</div>
{/if}
- {if $gContent->mInfo.contact_types.0.content_id}
+ {if $isPerson}
<div class="form-group">
{formlabel label="Name"}
{forminput}
diff --git a/templates/display_type_header.tpl b/templates/display_type_header.tpl
index 350ce1c..f8647a7 100755
--- a/templates/display_type_header.tpl
+++ b/templates/display_type_header.tpl
@@ -1,8 +1,8 @@
<div class="form-group">
- {formlabel label="{if $gContent->mInfo.contact_types.0.content_id}Personal Contact{else}Business Contact{/if}"}
+ {formlabel label="{if $isPerson}Personal Contact{else}Business Contact{/if}"}
{forminput}
{foreach from=$gContent->mInfo.contact_types key=type_id item=type}
- {if isset($type.content_id) && $type.item gt '$01'}{$type.cross_ref_title}<br/>{/if}
+ {if isset($type.content_id) && $type.item neq 'P01'}{$type.cross_ref_title}<br/>{/if}
{/foreach}
{/forminput}
<div class="clear"></div>
diff --git a/templates/edit.tpl b/templates/edit.tpl
index 9caf1d9..e164291 100755
--- a/templates/edit.tpl
+++ b/templates/edit.tpl
@@ -51,11 +51,9 @@
<div class="clear"></div>
</div>
- {if !$isPerson}
- {include file="bitpackage:contact/edit_type_header.tpl"}
- {/if}
+ {include file="bitpackage:contact/edit_type_header.tpl"}
- {if $gContent->mInfo.name || $gContent->mInfo.contact_types.0.content_id || !isset( $gContent->mInfo.contact_types ) }
+ {if $isPerson}
<div class="form-group">
{formlabel label="Title" for="prefix"}
{forminput}
diff --git a/templates/edit_type_header.tpl b/templates/edit_type_header.tpl
index 3d42abb..c4f6756 100755
--- a/templates/edit_type_header.tpl
+++ b/templates/edit_type_header.tpl
@@ -1,19 +1,12 @@
<div class="form-group">
- {formlabel label="Contact Types" for=content_types}
+ {formlabel label="Contact Types"}
{forminput}
- {if isset( $gContent->mInfo.contact_types ) }
- {foreach from=$gContent->mInfo.contact_types key=type_id item=type}
- {if $type.item gt '$01'}
- <input type="checkbox" name="contact_types[{$type_id}]" value="{$type.item}" {if isset($type.content_id) } checked="checked"{/if} /> {$type.cross_ref_title}<br/>
- {/if}
- {/foreach}
- {else}
- {foreach from=$gContent->mInfo.contact_type_list key=type_id item=type}
- <input type="checkbox" name="contact_types[$type_id]" value="{$type.item}" />{$type.name}<br/>
- {/foreach}
- {/if}
+ {foreach from=$gContent->mInfo.contact_type_list item=type}
+ <label class="checkbox-inline">
+ <input type="checkbox" name="contact_types[]" value="{$type.item|escape}"{if $type.checked} checked="checked"{/if} /> {$type.name|escape}
+ </label>
+ {/foreach}
{/forminput}
- {formhelp note=""}
<div class="clear"></div>
</div>
diff --git a/templates/list.tpl b/templates/list.tpl
index bba6f3c..b8cd94e 100755
--- a/templates/list.tpl
+++ b/templates/list.tpl
@@ -4,7 +4,7 @@
<div class="listing contacts">
<div class="header">
- <h1>{tr}Contacts{/tr}</h1>
+ <h1>{if $listTitle}{$listTitle|escape}{else}{tr}Contacts{/tr}{/if}</h1>
</div>
<div class="body">
diff --git a/templates/menu_contact.tpl b/templates/menu_contact.tpl
index 56913cf..c53c197 100755
--- a/templates/menu_contact.tpl
+++ b/templates/menu_contact.tpl
@@ -1,8 +1,10 @@
{strip}
{if $packageMenuTitle}<a class="dropdown-toggle" data-toggle="dropdown" href="#"> {tr}{$packageMenuTitle}{/tr} <b class="caret"></b></a>{/if}
<ul class="{$packageMenuClass}">
- <li><a class="item" href="{$smarty.const.CONTACT_PKG_URL}list_contacts.php">{biticon ipackage="icons" iname="view-list" iexplain="List contacts" ilocation=menu}</a></li>
- {if $gBitUser->isAdmin() || $gBitUser->hasPermission( 'p_contact_edit' ) }
+ <li><a class="item" href="{$smarty.const.CONTACT_PKG_URL}list_people.php">{biticon ipackage="icons" iname="view-list" iexplain="List People" ilocation=menu}</a></li>
+ <li><a class="item" href="{$smarty.const.CONTACT_PKG_URL}list_businesses.php">{biticon ipackage="icons" iname="view-list" iexplain="List Businesses" ilocation=menu}</a></li>
+ <li><a class="item" href="{$smarty.const.CONTACT_PKG_URL}list_contacts.php">{biticon ipackage="icons" iname="system-search" iexplain="All Contacts" ilocation=menu}</a></li>
+ {if $gBitUser->isAdmin() || $gBitUser->hasPermission( 'p_contact_update' ) }
<li><a class="item" href="{$smarty.const.CONTACT_PKG_URL}add_person.php">{biticon ipackage="icons" iname="contact-new-symbolic" iexplain="Add Person" ilocation=menu}</a></li>
<li><a class="item" href="{$smarty.const.CONTACT_PKG_URL}add_business.php">{biticon ipackage="icons" iname="address-book-new-symbolic" iexplain="Add Business" ilocation=menu}</a></li>
{/if}