Added support for URL detection within the data of string fields.

A menu entry to visit the link which is contained in a string field
is automatically added now
This commit is contained in:
Andre Lorbach 2008-09-26 16:12:45 +02:00
parent 6aa0532f1a
commit c9e40ae86a
5 changed files with 29 additions and 4 deletions

View File

@ -450,7 +450,7 @@ if ( isset($content['Sources'][$currentSourceID]) )
if ( $mycolkey != SYSLOG_MESSAGE )
{
if ( $myStrCharLimit > 0 )
$content['syslogmessages'][$counter]['values'][$mycolkey]['fieldvalue'] = GetStringWithHTMLCodes(strlen($logArray[$mycolkey]) > $myStrCharLimit ? substr($logArray[$mycolkey], 0, $myStrCharLimit) . " ..." : $logArray[$mycolkey]);
$content['syslogmessages'][$counter]['values'][$mycolkey]['fieldvalue'] = GetStringWithHTMLCodes(strlen($logArray[$mycolkey]) > $myStrCharLimit ? substr($logArray[$mycolkey], 0, $myStrCharLimit) . "..." : $logArray[$mycolkey]);
}
// ---
@ -771,7 +771,7 @@ function PrepareStringForSearch($myString)
function AddOnClickMenu(&$fieldGridItem, $fieldType, $FieldID, $szFieldDisplayNameID, $searchOnline = false)
{
global $content, $fields;
global $content, $fields, $myStrCharLimit;
// Set OnClick Menu for SYSLOG_SYSLOGTAG
$fieldGridItem['hasbuttons'] = true;
@ -793,11 +793,15 @@ function AddOnClickMenu(&$fieldGridItem, $fieldType, $FieldID, $szFieldDisplayN
{
$fieldGridItem['buttons'][] = array(
'ButtonUrl' => '?filter=' . urlencode($content['searchstr']) . '+' . $szSearchFieldName . '%3A%3D' . $szEncodedFieldValue . '&search=Search' . $content['additional_url_sourceonly'],
'ButtonTarget' => '_top',
'ButtonAppendUrl' => true,
'DisplayName' => GetAndReplaceLangStr($content['LN_VIEW_ADDTOFILTER'], $fieldGridItem['fieldvalue']),
'IconSource' => $content['MENU_BULLET_GREEN']
);
$fieldGridItem['buttons'][] = array(
'ButtonUrl' => '?filter=' . urlencode($content['searchstr']) . '+' . $szSearchFieldName . '%3A-%3D' . $szEncodedFieldValue . '&search=Search' . $content['additional_url_sourceonly'],
'ButtonTarget' => '_top',
'ButtonAppendUrl' => true,
'DisplayName' => GetAndReplaceLangStr($content['LN_VIEW_EXCLUDEFILTER'], $fieldGridItem['fieldvalue']),
'IconSource' => $content['MENU_BULLET_GREEN']
);
@ -806,11 +810,15 @@ function AddOnClickMenu(&$fieldGridItem, $fieldType, $FieldID, $szFieldDisplayN
// More Menu entries
$fieldGridItem['buttons'][] = array(
'ButtonUrl' => '?filter=' . $szSearchFieldName . '%3A%3D' . $szEncodedFieldValue . '&search=Search' . $content['additional_url_sourceonly'],
'ButtonTarget' => '_top',
'ButtonAppendUrl' => true,
'DisplayName' => GetAndReplaceLangStr($content['LN_VIEW_FILTERFORONLY'], $fieldGridItem['fieldvalue']),
'IconSource' => $content['MENU_BULLET_BLUE']
);
$fieldGridItem['buttons'][] = array(
'ButtonUrl' => '?filter=' . $szSearchFieldName . '%3A-%3D' . $szEncodedFieldValue . '&search=Search' . $content['additional_url_sourceonly'],
'ButtonTarget' => '_top',
'ButtonAppendUrl' => true,
'DisplayName' => GetAndReplaceLangStr($content['LN_VIEW_SHOWALLBUT'], $fieldGridItem['fieldvalue']),
'IconSource' => $content['MENU_BULLET_BLUE']
);
@ -820,10 +828,25 @@ function AddOnClickMenu(&$fieldGridItem, $fieldType, $FieldID, $szFieldDisplayN
{
$fieldGridItem['buttons'][] = array(
'ButtonUrl' => 'http://kb.monitorware.com/kbsearch.php?sa=Search&origin=phplogcon&oid=' . $FieldID . '&q=' . $szEncodedFieldValue,
'ButtonTarget' => '_top',
'ButtonAppendUrl' => true,
'DisplayName' => $content['LN_VIEW_SEARCHFOR'] . " " . $content[$szFieldDisplayNameID] . " '" . $fieldGridItem['fieldvalue'] . "'",
'IconSource' => $content['MENU_NETWORK']
);
}
// Search for links within the fieldcontent!
if ( $fieldType == FILTER_TYPE_STRING && preg_match("#([\w]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", $fieldGridItem['rawfieldvalue'], $szLink) >= 1 )
{
$fieldGridItem['buttons'][] = array(
'ButtonUrl' => $szLink[0],
'ButtonTarget' => '_blank',
'ButtonAppendUrl' => false,
'DisplayName' => GetAndReplaceLangStr($content['LN_VIEW_VISITLINK'], strlen($szLink[0]) > $myStrCharLimit ? substr($szLink[0], 0, $myStrCharLimit) . "..." : $szLink[0] ),
'IconSource' => $content['MENU_NETWORK']
);
}
}
// ---

View File

@ -132,6 +132,7 @@ $content['LN_SEARCH_PERFORMADVANCED'] = "Erweiterte Suche starten";
$content['LN_VIEW_EXCLUDEFILTER'] = "Exclude '%1' from filterset";
$content['LN_VIEW_FILTERFORONLY'] = "Filter for '%1' only";
$content['LN_VIEW_SHOWALLBUT'] = "Show all except '%1'";
$content['LN_VIEW_VISITLINK'] = "Open Link '%1' in new window";
$content['LN_HIGHLIGHT'] = "Hightlight >>";
$content['LN_HIGHLIGHT_OFF'] = "Hightlight <<";

View File

@ -133,7 +133,7 @@ $content['LN_GEN_MESSAGEDETAILS'] = "Message Details";
$content['LN_VIEW_EXCLUDEFILTER'] = "Exclude '%1' from filterset";
$content['LN_VIEW_FILTERFORONLY'] = "Filter for '%1' only";
$content['LN_VIEW_SHOWALLBUT'] = "Show all except '%1'";
$content['LN_VIEW_VISITLINK'] = "Open Link '%1' in new window";
$content['LN_HIGHLIGHT'] = "Hightlight >>";
$content['LN_HIGHLIGHT_OFF'] = "Hightlight <<";

View File

@ -135,6 +135,7 @@ $content['LN_GEN_MESSAGEDETAILS'] = "Detalhes da Mensagem";
$content['LN_VIEW_EXCLUDEFILTER'] = "Exclude '%1' from filterset";
$content['LN_VIEW_FILTERFORONLY'] = "Filter for '%1' only";
$content['LN_VIEW_SHOWALLBUT'] = "Show all except '%1'";
$content['LN_VIEW_VISITLINK'] = "Open Link '%1' in new window";
$content['LN_HIGHLIGHT'] = "Destacar >>";
$content['LN_HIGHLIGHT_OFF'] = "Destacar <<";

View File

@ -263,7 +263,7 @@
<h2>{LN_GEN_AVAILABLESEARCHES}</h2>
<!-- BEGIN buttons -->
<li class="{cssclass}" OnMouseMove="ToggleDisplayEnhanceTimeOut('menu_{FieldColumn}_{uid}');">
<img align="left" src="{IconSource}" width="16" height="16" vspace="2"><a href="{ButtonUrl}{additional_url_sourceonly}" target="_top" OnClick="ToggleDisplayOffTypeById('menu_{FieldColumn}_{uid}');">{DisplayName}</a>
<img align="left" src="{IconSource}" width="16" height="16" vspace="2"><a href="{ButtonUrl}<!-- IF ButtonAppendUrl="true" -->{additional_url_sourceonly}<!-- ENDIF ButtonAppendUrl="true" -->" target="{ButtonTarget}" OnClick="ToggleDisplayOffTypeById('menu_{FieldColumn}_{uid}');">{DisplayName}</a>
</li>
<!-- END buttons -->
</ul>