Commit 6eee4d89 authored by Monish Deb's avatar Monish Deb

issue-5 Remove old code related to custom field/option buildForm changes

parent dca39be8
......@@ -472,31 +472,6 @@ function grantprograms_civicrm_buildForm($formName, &$form) {
);
}
if ($formName == 'CRM_Custom_Form_Field') {
for ($i = 1; $i <= $formName::NUM_OPTION; $i++) {
$form->add('text',
'option_description['. $i .']',
'Mark',
array('id' => 'marks')
);
}
$form->assign('edit_form', 1);
CRM_Core_Region::instance('page-body')->add(array(
'template' => 'CRM/Grant/Form/CustomFields.tpl',
));
}
if ($formName == 'CRM_Custom_Form_Option') {
$form->add('text',
'description',
'Mark',
array('id' => 'marks')
);
CRM_Core_Region::instance('page-body')->add(array(
'template' => 'CRM/Grant/Form/CustomFields.tpl',
));
}
if ($formName == 'CRM_Grant_Form_Search' && $form->get('context') == 'dashboard') {
//Version of grant program listings
$grantProgram = array();
......@@ -564,23 +539,6 @@ function grantprograms_civicrm_pageRun( &$page ) {
}
}
if ($page->getVar('_name') == "CRM_Custom_Page_Option") {
$params['id'] = $page->getVar('_fid');
$params['custom_group_id'] = $page->getVar('_gid');
CRM_Core_BAO_CustomField::retrieve($params, $defaults);
$optionValues = CRM_Core_BAO_OptionValue::getOptionValuesArray($defaults['option_group_id']);
$smarty = CRM_Core_Smarty::singleton();
foreach ($optionValues as $key => $value) {
if (!empty($value['description'])) {
$smarty->_tpl_vars['customOption'][$key]['description'] = $value['description'];
}
}
$page->assign('view_form', 1);
CRM_Core_Region::instance('page-body')->add(array(
'template' => 'CRM/Grant/Form/CustomFieldsView.tpl',
));
}
if ($page->getVar('_name') == "CRM_Grant_Page_DashBoard") {
$page->assign('grantSummary', CRM_Grant_BAO_GrantPayment::getGrantSummary(CRM_Core_Permission::check('administer CiviCRM')));
}
......@@ -898,22 +856,6 @@ function manageNavigationLinks($action) {
}
}
function getCustomFields($params, &$values) {
static $_customGroup = array();
if (empty($_customGroup)) {
$query = "SELECT ccf.id, ccg.id custom_group FROM civicrm_custom_group ccg
LEFT JOIN civicrm_custom_field ccf ON ccf.custom_group_id = ccg.id
WHERE ccg.name LIKE 'NEI_%' ORDER BY ccg.id";
$dao = CRM_Core_DAO::executeQuery($query);
while ($dao->fetch()) {
$_customGroup[$dao->custom_group][$dao->id] = $dao->id;
}
}
foreach ($_customGroup as $key => $val) {
$values[$key] = array_intersect_key($params, $val);
}
}
/**
* Hook implementation when an email is about to be sent by CiviCRM.
*
......
{if $form.description}
<div id="form_marks" class="crm-custom_option-form-block-value">
<tr class="crm-custom_option-form-block-description">
<td class="label">{$form.description.label}</td>
<td>{$form.description.html}</td>
</tr>
</div>
{/if}
{* Custom Field Edit *}
{if $edit_form}
<table id="optionField_new">
<tr>
<th>&nbsp;</th>
<th> {ts}Default{/ts}</th>
<th> {ts}Label{/ts}</th>
<th> {ts}Value{/ts}</th>
{if $form.option_description}
<th> {ts}Mark{/ts}</th>
{/if}
<th> {ts}Weight{/ts}</th>
<th> {ts}Active?{/ts}</th>
</tr>
{section name=rowLoop start=1 loop=12}
{assign var=index value=$smarty.section.rowLoop.index}
<tr id="optionField_{$index}" class="form-item {cycle values="odd-row,even-row"}">
<td>
{if $index GT 1}
<a onclick="showHideRow({$index}); return false;" name="optionField_{$index}" href="#" class="form-link"><img src="{$config->resourceBase}i/TreeMinus.gif" class="action-icon" alt="{ts}hide field or section{/ts}"/></a>
{/if}
</td>
<td>
<div id="radio{$index}" style="display:none">
{$form.default_option[$index].html}
</div>
<div id="checkbox{$index}" style="display:none">
{$form.default_checkbox_option.$index.html}
</div>
</td>
<td> {$form.option_label.$index.html}</td>
<td> {$form.option_value.$index.html}</td>
{if $form.option_description }
<td> {$form.option_description.$index.html}</td>
{/if}
<td> {$form.option_weight.$index.html}</td>
<td> {$form.option_status.$index.html}</td>
</tr>
{/section}
</table>
{/if}
{* Custom Field Edit *}
{literal}
<script type="text/javascript">
cj(document).ready( function(){
cj('div#field_page').replaceWith(cj('div#field_page_new'));
cj('div#form_marks').insertAfter(cj('tr.crm-custom_option-form-block-value'));
cj('div#form_marks').replaceWith('<tr class="crm-custom_option-form-block-description"><td class="label">{/literal}{$form.description.label}{literal}</td><td>{/literal}{$form.description.html}{literal}</td></tr>');
cj('table#optionField').replaceWith(cj('table#optionField_new'));
});
</script>
{/literal}
\ No newline at end of file
{if $view_form}
<div id="field_page_new">
<p></p>
<div class="form-item">
{strip}
{* handle enable/disable actions*}
{include file="CRM/common/enableDisable.tpl"}
<table class="selector">
<tr class="columnheader">
<th>{ts}Label{/ts}</th>
<th>{ts}Value{/ts}</th>
<th>{ts}Mark{/ts}</th>
<th>{ts}Default{/ts}</th>
<th>{ts}Order{/ts}</th>
<th>{ts}Enabled?{/ts}</th>
<th>&nbsp;</th>
</tr>
{foreach from=$customOption item=row key=id}
<tr id="OptionValue-{$id}"class="crm-entity {cycle values="odd-row,even-row"} {$row.class} crm-custom_option {if NOT $row.is_active} disabled{/if}">
<td><span class="crm-custom_option-label crm-editable crmf-label">{$row.label}</span></td>
<td><span class="crm-custom_option-value disabled-crm-editable" data-field="value" data-action="update">{$row.value}</span></td>
<td class="crm-custom_option-description disabled-crm-editable" data-field="description" data-action="update">{$row.description}</td>
<td class="crm-custom_option-default_value crmf-value">{$row.default_value}</td>
<td class="nowrap crm-custom_option-weight crmf-weight">{$row.weight}</td>
<td id="row_{$id}_status" class="crm-custom_option-is_active crmf-is_active">{if $row.is_active eq 1} {ts}Yes{/ts} {else} {ts}No{/ts} {/if}</td>
<td>{$row.action|replace:'xx':$id}</td>
</tr>
{/foreach}
</table>
{/strip}
<div class="action-link">
<a href="{crmURL q="reset=1&action=add&fid=$fid&gid=$gid"}" class="button"><span><div class="icon add-icon"></div> {ts 1=$fieldTitle}Add Option for '%1'{/ts}</span></a>
</div>
</div>
</div>
{/if}
{literal}
<script type="text/javascript">
cj(document).ready( function(){
cj('div#field_page').replaceWith(cj('div#field_page_new'));
});
</script>
{/literal}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment