Dialplan Edit: Truncate initially displayed Data values with ellipsis (pre edit).

This commit is contained in:
Nate Jones
2014-08-04 19:33:26 +00:00
parent 9b68245d67
commit 5b43200233
2 changed files with 19 additions and 1 deletions

View File

@@ -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";

View File

@@ -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)." ...";
}
}
}
?>