mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
Dialplan Edit: Truncate initially displayed Data values with ellipsis (pre edit).
This commit is contained in:
@@ -682,7 +682,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
unset ($prep_statement, $sql);
|
||||
}
|
||||
$dialplan_detail_data_mod = ($gateway_name != '') ? str_replace($gateway_uuid, $gateway_name, $dialplan_detail_data) : $dialplan_detail_data;
|
||||
echo " <label id=\"label_dialplan_detail_data_".$x."\">".$dialplan_detail_data_mod."</label>\n";
|
||||
echo " <label id=\"label_dialplan_detail_data_".$x."\">".ellipsis($dialplan_detail_data_mod, 75, false)."</label>\n";
|
||||
}
|
||||
echo " <input id='dialplan_detail_data_".$x."' name='dialplan_details[".$x."][dialplan_detail_data]' class='formfld' type='text' style='width: 100%; ".$element['visibility']."' placeholder='' value=\"".htmlspecialchars($dialplan_detail_data)."\">\n";
|
||||
echo "</td>\n";
|
||||
|
||||
@@ -999,4 +999,22 @@ if(!function_exists('validate_email')) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ellipsisnicely truncate long text
|
||||
if(!function_exists('ellipsis')) {
|
||||
function ellipsis($string, $max_characters, $preserve_word = true) {
|
||||
if ($max_characters+$x >= strlen($string)) { return $string; }
|
||||
if ($preserve_word) {
|
||||
for ($x = 0; $x < strlen($string); $x++) {
|
||||
if ($string{$max_characters+$x} == " ") {
|
||||
return substr($string,0,$max_characters+$x)." ...";
|
||||
}
|
||||
else { continue; }
|
||||
}
|
||||
}
|
||||
else {
|
||||
return substr($string,0,$max_characters)." ...";
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user