Skip to content

Commit

Permalink
Merge pull request civicrm#9830 from eileenmcnaughton/cust_date_nfc
Browse files Browse the repository at this point in the history
[nfc] refactoring towards CRM-19490
  • Loading branch information
eileenmcnaughton authored Feb 13, 2017
2 parents 553a87c + 9389689 commit 452fb60
Show file tree
Hide file tree
Showing 5 changed files with 146 additions and 244 deletions.
1 change: 1 addition & 0 deletions CRM/Event/BAO/Participant.php
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,7 @@ public static function &importableFields($contactType = 'Individual', $status =
'title' => ts('Participant Note'),
'name' => 'participant_note',
'headerPattern' => '/(participant.)?note$/i',
'type' => 'text',
),
);

Expand Down
143 changes: 1 addition & 142 deletions templates/CRM/UF/Form/Block.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -29,148 +29,7 @@
{if $help_pre && $action neq 4}<div class="messages help">{$help_pre}</div>{/if}
{assign var=zeroField value="Initial Non Existent Fieldset"}
{assign var=fieldset value=$zeroField}
{foreach from=$fields item=field key=fieldName}
{if $field.skipDisplay}
{continue}
{/if}
{if $field.groupTitle != $fieldset}
{if $fieldset != $zeroField}
{if $groupHelpPost && $action neq 4}
<div class="messages help">{$groupHelpPost}</div>
{/if}
{if $mode ne 8}
</fieldset>
{/if}
{/if}

{if $mode ne 8 && $action ne 1028 && $action ne 4 && !$hideFieldset}
<fieldset class="crm-profile crm-profile-id-{$field.group_id} crm-profile-name-{$field.groupName}"><legend>{$field.groupTitle}</legend>
{/if}

{if ($form.formName eq 'Confirm' OR $form.formName eq 'ThankYou') AND $prefix neq 'honor'}
<div class="header-dark">{$field.groupTitle} </div>
{/if}
{assign var=fieldset value=`$field.groupTitle`}
{assign var=groupHelpPost value=`$field.groupHelpPost`}
{if $field.groupHelpPre && $action neq 4 && $action neq 1028}
<div class="messages help">{$field.groupHelpPre}</div>
{/if}
{/if}

{assign var=n value=$field.name}

{if $field.field_type eq "Formatting"}
{if $action neq 4 && $action neq 1028}
{$field.help_pre}
{/if}
{elseif $n}
{* Show explanatory text for field if not in 'view' or 'preview' modes *}
{if $field.help_pre && $action neq 4 && $action neq 1028}
<div class="crm-section helprow-{$n}-section helprow-pre" id="helprow-{$n}">
<div class="content description">{$field.help_pre}</div>
</div>
{/if}
{if $field.options_per_line != 0}
<div class="crm-section editrow_{$n}-section form-item" id="editrow-{$n}">
<div class="label option-label">{if $prefix}{$form.$prefix.$n.label}{else}{$form.$n.label}{/if}</div>
<div class="content 3">
{assign var="count" value="1"}
{strip}
<table class="form-layout-compressed">
<tr>
{* sort by fails for option per line. Added a variable to iterate through the element array*}
{assign var="index" value="1"}
{if $prefix}
{assign var="formElement" value=$form.$prefix.$n}
{else}
{assign var="formElement" value=$form.$n}
{/if}
{foreach name=outer key=key item=item from=$formElement}
{if $index < 10}
{assign var="index" value=`$index+1`}
{else}
<td class="labels font-light">{$formElement.$key.html}</td>
{if $count == $field.options_per_line}
</tr>
<tr>
{assign var="count" value="1"}
{else}
{assign var="count" value=`$count+1`}
{/if}
{/if}
{/foreach}
</tr>
</table>
{/strip}
</div>
<div class="clear"></div>
</div>
{else}
<div class="crm-section editrow_{$n}-section form-item" id="editrow-{$n}">
<div class="label">
{if $prefix}{$form.$prefix.$n.label}{else}{$form.$n.label}{/if}
</div>
<div class="content">
{if $n|substr:0:3 eq 'im-'}
{assign var="provider" value=$n|cat:"-provider_id"}
{$form.$provider.html}&nbsp;
{/if}

{if $n eq 'email_greeting' or $n eq 'postal_greeting' or $n eq 'addressee'}
{include file="CRM/Profile/Form/GreetingType.tpl"}
{elseif ($n eq 'group' && $form.group) || ($n eq 'tag' && $form.tag)}
{include file="CRM/Contact/Form/Edit/TagsAndGroups.tpl" type=$n title=null context="profile"}
{elseif ( $n|substr:-5:5 eq '_date' ) AND
( $form.formName neq 'Confirm' ) AND
( $form.formName neq 'ThankYou' ) }
{include file="CRM/common/jcalendar.tpl" elementName=$n}
{elseif ( $n|substr:-5:5 eq '_date' ) }
{assign var="date_value" value=$form.$n.value}
<span class="crm-frozen-field">
{$date_value|date_format:"%Y-%m-%d"|crmDate:$config->dateformatshortdate}
<input type="hidden" name="{$form.$n.name}" value="{$form.$n.value}" id="{$form.$n.name}">
</span>
{elseif $n|substr:0:5 eq 'phone'}
{assign var="phone_ext_field" value=$n|replace:'phone':'phone_ext'}
{if $prefix}{$form.$prefix.$n.html}{else}{$form.$n.html}{/if}
{if $form.$phone_ext_field.html}
&nbsp;{$form.$phone_ext_field.html}
{/if}
{else}
{if $prefix}
{if $n eq 'organization_name' && !empty($form.onbehalfof_id)}
{$form.onbehalfof_id.html}
{/if}
{if $field.html_type eq 'File' && $viewOnlyPrefixFileValues}
{$viewOnlyPrefixFileValues.$prefix.$n}
{else}
{$form.$prefix.$n.html}
{/if}
{elseif $field.html_type eq 'File' && $viewOnlyFileValues}
{$viewOnlyFileValues.$n}
{else}
{$form.$n.html}
{/if}
{/if}

{*CRM-4564*}
{if $field.html_type eq 'Autocomplete-Select'}
{if $field.data_type eq 'ContactReference'}
{include file="CRM/Custom/Form/ContactReference.tpl" element_name = $n}
{/if}
{/if}
</div>
<div class="clear"></div>
</div>
{/if}
{* Show explanatory text for field if not in 'view' or 'preview' modes *}
{if $field.help_post && $action neq 4 && $action neq 1028}
<div class="crm-section helprow-{$n}-section helprow-post" id="helprow-{$n}">
<div class="content description">{$field.help_post}</div>
</div>
{/if}
{/if}
{/foreach}
{include file="CRM/UF/Form/Fields.tpl"}

{if $field.groupHelpPost && $action neq 4 && $action neq 1028}
<div class="messages help">{$field.groupHelpPost}</div>
Expand Down
142 changes: 142 additions & 0 deletions templates/CRM/UF/Form/Fields.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
{foreach from=$fields item=field key=fieldName}
{if $field.skipDisplay}
{continue}
{/if}
{if $field.groupTitle != $fieldset}
{if $fieldset != $zeroField}
{if $groupHelpPost && $action neq 4}
<div class="messages help">{$groupHelpPost}</div>
{/if}
{if $mode ne 8}
</fieldset>
{/if}
{/if}

{if $mode ne 8 && $action ne 1028 && $action ne 4 && !$hideFieldset}
<fieldset class="crm-profile crm-profile-id-{$field.group_id} crm-profile-name-{$field.groupName}"><legend>{$field.groupTitle}</legend>
{/if}

{if ($form.formName eq 'Confirm' OR $form.formName eq 'ThankYou') AND $prefix neq 'honor'}
<div class="header-dark">{$field.groupTitle} </div>
{/if}
{assign var=fieldset value=`$field.groupTitle`}
{assign var=groupHelpPost value=`$field.groupHelpPost`}
{if $field.groupHelpPre && $action neq 4 && $action neq 1028}
<div class="messages help">{$field.groupHelpPre}</div>
{/if}
{/if}

{assign var=profileFieldName value=$field.name}

{if $field.field_type eq "Formatting"}
{if $action neq 4 && $action neq 1028}
{$field.help_pre}
{/if}
{elseif $profileFieldName}
{* Show explanatory text for field if not in 'view' or 'preview' modes *}
{if $field.help_pre && $action neq 4 && $action neq 1028}
<div class="crm-section helprow-{$profileFieldName}-section helprow-pre" id="helprow-{$profileFieldName}">
<div class="content description">{$field.help_pre}</div>
</div>
{/if}
{if $field.options_per_line != 0}
<div class="crm-section editrow_{$profileFieldName}-section form-item" id="editrow-{$profileFieldName}">
<div class="label option-label">{if $prefix}{$form.$prefix.$profileFieldName.label}{else}{$form.$profileFieldName.label}{/if}</div>
<div class="content 3">
{assign var="count" value="1"}
{strip}
<table class="form-layout-compressed">
<tr>
{* sort by fails for option per line. Added a variable to iterate through the element array*}
{assign var="index" value="1"}
{if $prefix}
{assign var="formElement" value=$form.$prefix.$profileFieldName}
{else}
{assign var="formElement" value=$form.$profileFieldName}
{/if}
{foreach name=outer key=key item=item from=$formElement}
{if $index < 10}
{assign var="index" value=`$index+1`}
{else}
<td class="labels font-light">{$formElement.$key.html}</td>
{if $count == $field.options_per_line}
</tr>
<tr>
{assign var="count" value="1"}
{else}
{assign var="count" value=`$count+1`}
{/if}
{/if}
{/foreach}
</tr>
</table>
{/strip}
</div>
<div class="clear"></div>
</div>
{else}
<div class="crm-section editrow_{$profileFieldName}-section form-item" id="editrow-{$profileFieldName}">
<div class="label">
{if $prefix}{$form.$prefix.$profileFieldName.label}{else}{$form.$profileFieldName.label}{/if}
</div>
<div class="content">
{if $profileFieldName|substr:0:3 eq 'im-'}
{assign var="provider" value=profileFieldNamen|cat:"-provider_id"}
{$form.$provider.html}&nbsp;
{/if}

{if $profileFieldName eq 'email_greeting' or $profileFieldName eq 'postal_greeting' or $profileFieldName eq 'addressee'}
{include file="CRM/Profile/Form/GreetingType.tpl"}
{elseif ($profileFieldName eq 'group' && $form.group) || ($profileFieldName eq 'tag' && $form.tag)}
{include file="CRM/Contact/Form/Edit/TagsAndGroups.tpl" type=$profileFieldName title=null context="profile"}
{elseif ( $profileFieldName|substr:-5:5 eq '_date' ) AND
( $form.formName neq 'Confirm' ) AND
( $form.formName neq 'ThankYou' ) }
{include file="CRM/common/jcalendar.tpl" elementName=$profileFieldName}
{elseif ( $profileFieldName|substr:-5:5 eq '_date' ) }
{assign var="date_value" value=$form.$profileFieldName.value}
<span class="crm-frozen-field">
{$date_value|date_format:"%Y-%m-%d"|crmDate:$config->dateformatshortdate}
<input type="hidden" name="{$form.$profileFieldName.name}" value="{$form.$profileFieldName.value}" id="{$form.$profileFieldName.name}">
</span>
{elseif $profileFieldName|substr:0:5 eq 'phone'}
{assign var="phone_ext_field" value=$profileFieldName|replace:'phone':'phone_ext'}
{if $prefix}{$form.$prefix.$profileFieldName.html}{else}{$form.$profileFieldName.html}{/if}
{if $form.$phone_ext_field.html}
&nbsp;{$form.$phone_ext_field.html}
{/if}
{else}
{if $prefix}
{if $profileFieldName eq 'organization_name' && !empty($form.onbehalfof_id)}
{$form.onbehalfof_id.html}
{/if}
{if $field.html_type eq 'File' && $viewOnlyPrefixFileValues}
{$viewOnlyPrefixFileValues.$prefix.$profileFieldName}
{else}
{$form.$prefix.$profileFieldName.html}
{/if}
{elseif $field.html_type eq 'File' && $viewOnlyFileValues}
{$viewOnlyFileValues.$profileFieldName}
{else}
{$form.$profileFieldName.html}
{/if}
{/if}

{*CRM-4564*}
{if $field.html_type eq 'Autocomplete-Select'}
{if $field.data_type eq 'ContactReference'}
{include file="CRM/Custom/Form/ContactReference.tpl" element_name = $profileFieldName}
{/if}
{/if}
</div>
<div class="clear"></div>
</div>
{/if}
{* Show explanatory text for field if not in 'view' or 'preview' modes *}
{if $field.help_post && $action neq 4 && $action neq 1028}
<div class="crm-section helprow-{$profileFieldName}-section helprow-post" id="helprow-{$profileFieldName}">
<div class="content description">{$field.help_post}</div>
</div>
{/if}
{/if}
{/foreach}
Loading

0 comments on commit 452fb60

Please sign in to comment.