return array(
'PseudoConstant' => array(
'locationType' => CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'),
+ 'websiteType' => CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id'),
'phoneType' => CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id'),
),
'initialProfileList' => civicrm_api('UFGroup', 'get', array(
if (in_array($fieldName, $locationFields)) {
$result['schema'][$fieldName]['civiIsLocation'] = TRUE;
}
+ if ($fieldName == 'url') {
+ $result['schema'][$fieldName]['civiIsWebsite']= TRUE;
+ }
if (in_array($fieldName, array('phone', 'phone_and_ext'))) {
// FIXME what about phone_ext?
$result['schema'][$fieldName]['civiIsPhone'] = TRUE;
$field_type = CRM_Utils_Array::value('field_type', $params);
$field_name = CRM_Utils_Array::value('field_name', $params);
- $location_type_id = CRM_Utils_Array::value('location_type_id', $params);
+ $location_type_id = CRM_Utils_Array::value('location_type_id', $params, CRM_Utils_Array::value('website_type_id', $params));
$phone_type = CRM_Utils_Array::value('phone_type_id', $params, CRM_Utils_Array::value('phone_type', $params));
if (!CRM_Core_BAO_UFField::isValidFieldName($field_name)) {
var PHONE_TYPES = _.map(CRM.PseudoConstant.phoneType, function(value, key) {
return {val: key, label: value};
});
+
+ var WEBSITE_TYPES = _.map(CRM.PseudoConstant.websiteType, function(value, key) {
+ return {val: key, label: value};
+ });
var DEFAULT_PHONE_TYPE_ID = PHONE_TYPES[0].val;
+ var DEFAULT_WEBSITE_TYPE_ID = WEBSITE_TYPES[0].val;
/**
* Add a help link to a form label
type: 'Select',
options: LOCATION_TYPES
},
+ 'website_type_id': {
+ title: ts('Website Type'),
+ type: 'Select',
+ options: WEBSITE_TYPES
+ },
'phone_type_id': {
title: ts('Phone Type'),
type: 'Select',
if (fieldSchema && fieldSchema.civiIsLocation && !this.get('location_type_id')) {
this.set('location_type_id', DEFAULT_LOCATION_TYPE_ID);
}
+ if (fieldSchema && fieldSchema.civiIsWebsite && !this.get('website_type_id')) {
+ this.set('website_type_id', DEFAULT_WEBSITE_TYPE_ID);
+ }
if (fieldSchema && fieldSchema.civiIsPhone && !this.get('phone_type_id')) {
this.set('phone_type_id', DEFAULT_PHONE_TYPE_ID);
}
getSignature: function() {
return this.get("entity_name") +
'::' + this.get("field_name") +
- '::' + (this.get("location_type_id") ? this.get("location_type_id") : '') +
+ '::' + (this.get("location_type_id") ? this.get("location_type_id") : this.get("website_type_id") ? this.get("website_type_id") : '') +
'::' + (this.get("phone_type_id") ? this.get("phone_type_id") : '');
},
if (fieldSchema.civiIsLocation) {
limit *= LOCATION_TYPES.length;
}
+ if (fieldSchema.civiIsWebsite) {
+ limit *= WEBSITE_TYPES.length;
+ }
if (fieldSchema.civiIsPhone) {
limit *= PHONE_TYPES.length;
}
},
watchDuplicates: function(model, collection, options) {
model.on('change:location_type_id', this.markDuplicates, this);
+ model.on('change:website_type_id', this.markDuplicates, this);
model.on('change:phone_type_id', this.markDuplicates, this);
this.markDuplicates();
},
unwatchDuplicates: function(model, collection, options) {
model.off('change:location_type_id', this.markDuplicates, this);
+ model.off('change:website_type_id', this.markDuplicates, this);
model.off('change:phone_type_id', this.markDuplicates, this);
this.markDuplicates();
},
if (this.options.fieldSchema.civiIsPhone) {
result = result + '-' + CRM.PseudoConstant.phoneType[this.model.get('phone_type_id')];
}
+ if (this.options.fieldSchema.civiIsWebsite) {
+ result = result + '-' + CRM.PseudoConstant.websiteType[this.model.get('website_type_id')];
+ }
if (this.options.fieldSchema.civiIsLocation) {
var locType = this.model.get('location_type_id') ? CRM.PseudoConstant.locationType[this.model.get('location_type_id')] : ts('Primary');
result = result + ' (' + locType + ')';
CRM.Designer.UFFieldDetailView = Backbone.View.extend({
initialize: function() {
// FIXME: hide/display 'in_selector' if 'visibility' is one of the public options
- var fields = ['location_type_id', 'phone_type_id', 'label', 'is_multi_summary', 'is_required', 'is_view', 'visibility', 'in_selector', 'is_searchable', 'help_pre', 'help_post', 'is_active'];
+ var fields = ['location_type_id', 'website_type_id', 'phone_type_id', 'label', 'is_multi_summary', 'is_required', 'is_view', 'visibility', 'in_selector', 'is_searchable', 'help_pre', 'help_post', 'is_active'];
if (! this.options.fieldSchema.civiIsLocation) {
fields = _.without(fields, 'location_type_id');
}
+ if (! this.options.fieldSchema.civiIsWebsite) {
+ fields = _.without(fields, 'website_type_id');
+ }
if (! this.options.fieldSchema.civiIsPhone) {
fields = _.without(fields, 'phone_type_id');
}