mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 18:48:51 +02:00
N°1405 Add support of AttributePhoneNumber which allows launch of phone application on click.
SVN:trunk[5698]
This commit is contained in:
@@ -3430,7 +3430,10 @@ class AttributeEmailAddress extends AttributeString
|
||||
public function GetAsHTML($sValue, $oHostObject = null, $bLocalize = true)
|
||||
{
|
||||
if (empty($sValue)) return '';
|
||||
return '<a class="mailto" href="mailto:'.$sValue.'">'.parent::GetAsHTML($sValue).'</a>';
|
||||
|
||||
$sUrlDecorationClass = utils::GetConfig()->Get('email_decoration_class');
|
||||
|
||||
return '<a class="mailto" href="mailto:'.$sValue.'"><span class="text_decoration '.$sUrlDecorationClass.'"></span>'.parent::GetAsHTML($sValue).'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3454,6 +3457,35 @@ class AttributeIPAddress extends AttributeString
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Specialization of a string: phone number
|
||||
*
|
||||
* @package iTopORM
|
||||
*/
|
||||
class AttributePhoneNumber extends AttributeString
|
||||
{
|
||||
public function GetValidationPattern()
|
||||
{
|
||||
return $this->GetOptional('validation_pattern', '^'.utils::GetConfig()->Get('phone_number_validation_pattern').'$');
|
||||
}
|
||||
|
||||
static public function GetFormFieldClass()
|
||||
{
|
||||
return '\\Combodo\\iTop\\Form\\Field\\PhoneField';
|
||||
}
|
||||
|
||||
public function GetAsHTML($sValue, $oHostObject = null, $bLocalize = true)
|
||||
{
|
||||
if (empty($sValue)) return '';
|
||||
|
||||
$sUrlDecorationClass = utils::GetConfig()->Get('phone_number_decoration_class');
|
||||
$sUrlPattern = utils::GetConfig()->Get('phone_number_url_pattern');
|
||||
$sUrl = sprintf($sUrlPattern, $sValue);
|
||||
|
||||
return '<a class="tel" href="'.$sUrl.'"><span class="text_decoration '.$sUrlDecorationClass.'"></span>'.parent::GetAsHTML($sValue).'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Specialization of a string: OQL expression
|
||||
*
|
||||
|
||||
@@ -764,14 +764,46 @@ class Config
|
||||
'source_of_value' => '',
|
||||
'show_in_conf_sample' => true,
|
||||
),
|
||||
'email_validation_pattern' => array(
|
||||
'type' => 'string',
|
||||
'description' => 'Regular expression to validate/detect the format of an eMail address',
|
||||
'default' => "[a-zA-Z0-9._&'-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9-]{2,}",
|
||||
'value' => '',
|
||||
'source_of_value' => '',
|
||||
'show_in_conf_sample' => true,
|
||||
),
|
||||
'email_validation_pattern' => array(
|
||||
'type' => 'string',
|
||||
'description' => 'Regular expression to validate/detect the format of an eMail address',
|
||||
'default' => "[a-zA-Z0-9._&'-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9-]{2,}",
|
||||
'value' => '',
|
||||
'source_of_value' => '',
|
||||
'show_in_conf_sample' => true,
|
||||
),
|
||||
'email_decoration_class' => array(
|
||||
'type' => 'string',
|
||||
'description' => 'CSS class(es) to use as decoration for the HTML rendering of the attribute. eg. "fa fa-envelope" will put a mail icon.',
|
||||
'default' => 'fa fa-envelope',
|
||||
'value' => '',
|
||||
'source_of_value' => '',
|
||||
'show_in_conf_sample' => false,
|
||||
),
|
||||
'phone_number_validation_pattern' => array(
|
||||
'type' => 'string',
|
||||
'description' => 'Regular expression to validate/detect the format of a phone number',
|
||||
'default' => "[0-9.\-\ \+\(\)]+",
|
||||
'value' => '',
|
||||
'source_of_value' => '',
|
||||
'show_in_conf_sample' => false,
|
||||
),
|
||||
'phone_number_url_pattern' => array(
|
||||
'type' => 'string',
|
||||
'description' => 'Format for phone number url, use %1$s as a placeholder for the value. eg. "tel:%1$s" for regular phone applications or "callto:%1$s" for Skype. Default is "tel:%1$s".',
|
||||
'default' => 'tel:%1$s',
|
||||
'value' => '',
|
||||
'source_of_value' => '',
|
||||
'show_in_conf_sample' => false,
|
||||
),
|
||||
'phone_number_decoration_class' => array(
|
||||
'type' => 'string',
|
||||
'description' => 'CSS class(es) to use as decoration for the HTML rendering of the attribute. eg. "fa fa-phone" will put a phone icon.',
|
||||
'default' => 'fa fa-phone',
|
||||
'value' => '',
|
||||
'source_of_value' => '',
|
||||
'show_in_conf_sample' => false,
|
||||
),
|
||||
'log_kpi_duration' => array(
|
||||
'type' => 'integer',
|
||||
'description' => 'Level of logging for troubleshooting performance issues (1 to enable, 2 +blame callers)',
|
||||
|
||||
Reference in New Issue
Block a user