function WRProcessLargeText($text, $field, $recid, $chars, $mode, $strLabel, $isProgectTable = false) { if (!$chars) { return $text; } if ($mode != MODE_LIST && $mode != MODE_PRINT || strlen($text) < $chars + 10) { return $text; } if ($isProgectTable) { $shortening = GetShorteningForLargeText($text, $cNumberOfChars); } else { $shortening = substr($text, 0, $chars); } if ($mode == MODE_PRINT) { return $shortening . "..."; } // List page $id = "textbox_" . GoodFieldName($field) . $recid; $textbox = "<span style=\"display:none\" id=\"" . $id . "\">" . $text . "</span>"; $link = "<a href=# onclick=\"\n\t\n\tvar offset = \$(this).offset();\n\toffset.left -= \$(window).scrollLeft();\n\toffset.top -= \$(window).scrollTop();\n\t\$('#" . $id . "').clone().dialog(\n\t{\ntitle: '" . jsreplace($strLabel) . "',\n\t\tdraggable: true,\n\t\tresizable: true,\n\t\tbgiframe: true,\n\t\tmodal: false,\n\t\tminheight:400,\n\t\tposition:[offset.left-50,offset.top-50]\n\t}\n\t);\n\treturn false;\n\t\"> " . "Más" . "...</a>"; return $shortening . $link . $textbox; }
/** * Get the More link following the truncated and highlighted field's content * @param String value The field's content * @param Number cNumberOfChars The number of chars from the 'value' string that will be visible after truncation * @param String keylink * @param Boolean isLookup An indicator showing if this is a lookup list page control * @return String */ protected function getShorteningTextAndMoreLink($value, $cNumberOfChars, $keylink, $isLookup) { $truncatedValue = GetShorteningForLargeText($value, $cNumberOfChars); if ($this->searchHighlight) { $truncatedValue = $this->highlightTruncatedBeforeMore($value, $truncatedValue, $cNumberOfChars, $cNumberOfChars); } $tName = $this->getContainer()->tName; $params = 'pagetype=' . $this->container->pSet->_viewPage . '&table=' . GetTableURL($tName) . '&field=' . rawurlencode($this->field) . $keylink; if ($isLookup) { $lookupParams = '&maintable=' . $this->pageObject->mainTable . '&mainfield=' . $this->pageObject->mainField; $params .= $lookupParams; } return $truncatedValue . ' <a href="javascript:void(0);" data-query="' . GetTableLink('fulltext', '', $params) . '">' . "Más" . ' ...</a>'; }
function ProcessLargeText($pSet, $strValue, $iquery = "", $table = "", $mode = MODE_LIST, $format = "", $isMobileLookup = false, $isReport = false) { $cNumberOfChars = $pSet->getNumberOfChars(); if (substr($strValue, 0, 8) == "<a href=" || substr($strValue, 0, 23) == "<img src=\"images/check_") { return $strValue; } $needShortening = $format != EDIT_FORMAT_LOOKUP_WIZARD && $cNumberOfChars > 0 && strlen($strValue) > $cNumberOfChars; if ($needShortening && ($mode == PAGE_LIST || $mode == PAGE_REPORT) && !$isMobileLookup) { global $strTableName; if (!$table) { $table = $strTableName; } $ret = GetShorteningForLargeText($strValue, $cNumberOfChars); $ret .= ' <a href="javascript:void(0);" query="fulltext.php?pagetype=' . $pSet->_viewPage . '&table=' . GetTableURL($table) . '&' . $iquery . '">' . "More" . ' ...</a>'; } else { if ($needShortening && ($mode == PAGE_EXPORT && $isReport || $mode == PAGE_PRINT || $mode == PAGE_RPRINT || $isMobileLookup)) { $ret = GetShorteningForLargeText($strValue, $cNumberOfChars) . " ..."; } else { $ret = htmlspecialchars($strValue); } } /*Left to future developments // highlight search results if ($mode==MODE_LIST && $_SESSION[$strTableName."_search"]==1) { $ind = 0; $searchopt=$_SESSION[$strTableName."_searchoption"]; $searchfor=$_SESSION[$strTableName."_searchfor"]; // highlight Contains search if($searchopt=="Contains") { while ( ($ind = my_stripos($ret, $searchfor, $ind)) !== false ) { $ret = substr($ret, 0, $ind) . "<span class=highlight>". substr($ret, $ind, strlen($searchfor)) ."</span>" . substr($ret, $ind + strlen($searchfor)); $ind+= strlen("<span class=highlight>") + strlen($searchfor) + strlen("</span>"); } } // highlight Starts with search elseif($searchopt=="Starts with ...") { if( !strncasecmp($ret, $searchfor,strlen($searchfor)) ) $ret = "<span class=highlight>". substr($ret, 0, strlen($searchfor)) ."</span>" . substr($ret, strlen($searchfor)); } elseif($searchopt=="Equals") { if( !strcasecmp($ret, $searchfor) ) $ret = "<span class=highlight>". $ret ."</span>"; } elseif($searchopt=="More than ...") { if( strtoupper($ret)>strtoupper($searchfor) ) $ret = "<span class=highlight>". $ret ."</span>"; } elseif($searchopt=="Less than ...") { if( strtoupper($ret)<strtoupper($searchfor) ) $ret = "<span class=highlight>". $ret ."</span>"; } elseif($searchopt=="Equal or more than ...") { if( strtoupper($ret)>=strtoupper($searchfor) ) $ret = "<span class=highlight>". $ret ."</span>"; } elseif($searchopt=="Equal or less than ...") { if( strtoupper($ret)<=strtoupper($searchfor) ) $ret = "<span class=highlight>". $ret ."</span>"; } } */ return nl2br($ret); }
function WRProcessLargeText($text,$field,$recid,$chars,$mode,$strLabel, $isProgectTable = false) { if(!$chars) return $text; if($mode!=MODE_LIST && $mode!=MODE_PRINT || strlen($text)<$chars+10) return $text; if($isProgectTable) $shortening = GetShorteningForLargeText($text, $cNumberOfChars); else $shortening = substr($text,0,$chars); if($mode==MODE_PRINT) { return $shortening."..."; } // List page $id="textbox_".GoodFieldName($field).$recid; $textbox="<span style=\"display:none\" id=\"".$id."\">".runner_htmlspecialchars($text)."</span>"; $link="<a href=# onclick=\" var offset = $(this).offset(); offset.left -= $(window).scrollLeft(); offset.top -= $(window).scrollTop(); $('#".$id."').clone().dialog( { title: '".jsreplace($strLabel)."', draggable: true, resizable: true, bgiframe: true, modal: false, minheight:400, position:[offset.left-50,offset.top-50] } ); return false; \"> "."More"."...</a>"; return $shortening.$link.$textbox; }