2 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 /*********************************************************************************
4 * SugarCRM Community Edition is a customer relationship management program developed by
5 * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
7 * This program is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU Affero General Public License version 3 as published by the
9 * Free Software Foundation with the addition of the following permission added
10 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
11 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
12 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
19 * You should have received a copy of the GNU Affero General Public License along with
20 * this program; if not, see http://www.gnu.org/licenses or write to the Free
21 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
25 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
27 * The interactive user interfaces in modified source and object code versions
28 * of this program must display Appropriate Legal Notices, as required under
29 * Section 5 of the GNU Affero General Public License version 3.
31 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
32 * these Appropriate Legal Notices must retain the display of the "Powered by
33 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
34 * technical reasons, the Appropriate Legal Notices must display the words
35 * "Powered by SugarCRM".
36 ********************************************************************************/
39 require_once('include/EditView/SugarVCR.php');
41 var $additionalDetails = true;
42 var $listviewName = null;
43 var $additionalDetailsAllow = null;
44 var $additionalDetailsAjax = true; // leave this true when using filter fields
45 var $additionalDetailsFieldToAdd = 'NAME'; // where the span will be attached to
48 * If you want overwrite the query for the count of the listview set this to your query
49 * otherwise leave it empty and it will use SugarBean::create_list_count_query
51 var $count_query = '';
54 * Constructor sets the limitName to look up the limit in $sugar_config
56 * @return ListViewData
58 function ListViewData() {
59 $this->limitName = 'list_max_entries_per_page';
60 $this->db = &DBManagerFactory::getInstance('listviews');
64 * checks the request for the order by and if that is not set then it checks the session for it
66 * @return array containing the keys orderBy => field being ordered off of and sortOrder => the sort order of that field
68 function getOrderBy($orderBy = '', $direction = '') {
69 if (!empty($orderBy) || !empty($_REQUEST[$this->var_order_by])) {
70 if(!empty($_REQUEST[$this->var_order_by])) {
72 $orderBy = $_REQUEST[$this->var_order_by];
73 if(!empty($_REQUEST['lvso']) && (empty($_SESSION['lvd']['last_ob']) || strcmp($orderBy, $_SESSION['lvd']['last_ob']) == 0) ){
74 $direction = $_REQUEST['lvso'];
76 $trackerManager = TrackerManager::getInstance();
77 if($monitor = $trackerManager->getMonitor('tracker')){
78 $monitor->setValue('module_name', $GLOBALS['module']);
79 $monitor->setValue('item_summary', "lvso=".$direction."&".$this->var_order_by."=".$_REQUEST[$this->var_order_by]);
80 $monitor->setValue('action', 'listview');
81 $monitor->setValue('user_id', $GLOBALS['current_user']->id);
82 $monitor->setValue('date_modified', TimeDate::getInstance()->nowDb());
87 $_SESSION[$this->var_order_by] = array('orderBy'=>$orderBy, 'direction'=> $direction);
88 $_SESSION['lvd']['last_ob'] = $orderBy;
91 if(!empty($_SESSION[$this->var_order_by])) {
92 $orderBy = $_SESSION[$this->var_order_by]['orderBy'];
93 $direction = $_SESSION[$this->var_order_by]['direction'];
96 $orderBy = 'date_entered';
100 return array('orderBy' => $orderBy, 'sortOrder' => $direction);
104 * gets the reverse of the sort order for use on links to reverse a sort order from what is currently used
106 * @param STRING (ASC or DESC) $current_order
107 * @return STRING (ASC or DESC)
109 function getReverseSortOrder($current_order){
110 return (strcmp(strtolower($current_order), 'asc') == 0)?'DESC':'ASC';
113 * gets the limit of how many rows to show per page
115 * @return INT (the limit)
117 function getLimit() {
118 return $GLOBALS['sugar_config'][$this->limitName];
122 * returns the current offset
124 * @return INT (current offset)
126 function getOffset() {
127 return (!empty($_REQUEST[$this->var_offset])) ? $_REQUEST[$this->var_offset] : 0;
131 * generates the base url without
132 * any files in the block variables will not be part of the url
135 * @return STRING (the base url)
137 function getBaseURL() {
139 if(empty($this->base_url)) {
140 $blockVariables = array('mass', 'uid', 'massupdate', 'delete', 'merge', 'selectCount',$this->var_order_by, $this->var_offset, 'lvso', 'sortOrder', 'orderBy', 'request_data', 'current_query_by_page');
141 $base_url = 'index.php?';
142 foreach($beanList as $bean) {
143 $blockVariables[] = 'Home2_'.strtoupper($bean).'_ORDER_BY';
145 $blockVariables[] = 'Home2_CASE_ORDER_BY';
146 // Added mostly for the unit test runners, which may not have these superglobals defined
148 if ( isset($_POST) && is_array($_POST) ) {
149 $params = array_merge($params,$_POST);
151 if ( isset($_GET) && is_array($_GET) ) {
152 $params = array_merge($params,$_GET);
154 foreach($params as $name=>$value) {
155 if(!in_array($name, $blockVariables)){
156 if(is_array($value)) {
157 foreach($value as $v) {
158 $base_url .= $name.urlencode('[]').'='.urlencode($v) . '&';
162 $base_url .= $name.'='.urlencode($value) . '&';
166 $this->base_url = $base_url;
168 return $this->base_url;
171 * based off of a base name it sets base, offset, and order by variable names to retrieve them from requests and sessions
173 * @param unknown_type $baseName
175 function setVariableName($baseName, $where, $listviewName = null){
177 $module = (!empty($listviewName)) ? $listviewName: $_REQUEST['module'];
178 $this->var_name = $module .'2_'. strtoupper($baseName);
180 $this->var_order_by = $this->var_name .'_ORDER_BY';
181 $this->var_offset = $this->var_name . '_offset';
182 $timestamp = sugar_microtime();
183 $this->stamp = $timestamp;
185 $_SESSION[$module .'2_QUERY_QUERY'] = $where;
187 $_SESSION[strtoupper($baseName) . "_FROM_LIST_VIEW"] = $timestamp;
188 $_SESSION[strtoupper($baseName) . "_DETAIL_NAV_HISTORY"] = false;
191 function getTotalCount($main_query){
192 if(!empty($this->count_query)){
193 $count_query = $this->count_query;
195 $count_query = SugarBean::create_list_count_query($main_query);
197 $result = $this->db->query($count_query);
198 if($row = $this->db->fetchByAssoc($result)){
205 * takes in a seed and creates the list view query based off of that seed
206 * if the $limit value is set to -1 then it will use the default limit and offset values
208 * it will return an array with two key values
209 * 1. 'data'=> this is an array of row data
210 * 2. 'pageData'=> this is an array containg three values
211 * a.'ordering'=> array('orderBy'=> the field being ordered by , 'sortOrder'=> 'ASC' or 'DESC')
212 * b.'urls'=>array('baseURL'=>url used to generate other urls ,
213 * 'orderBy'=> the base url for order by
214 * //the following may not be set (so check empty to see if they are set)
215 * 'nextPage'=> the url for the next group of results,
216 * 'prevPage'=> the url for the prev group of results,
217 * 'startPage'=> the url for the start of the group,
218 * 'endPage'=> the url for the last set of results in the group
219 * c.'offsets'=>array(
220 * 'current'=>current offset
221 * 'next'=> next group offset
222 * 'prev'=> prev group offset
223 * 'end'=> the offset of the last group
224 * 'total'=> the total count (only accurate if totalCounted = true otherwise it is either the total count if less than the limit or the total count + 1 )
225 * 'totalCounted'=> if a count query was used to get the total count
227 * @param SugarBean $seed
228 * @param string $where
229 * @param int:0 $offset
230 * @param int:-1 $limit
231 * @param string[]:array() $filter_fields
232 * @param array:array() $params
233 * Potential $params are
234 $params['distinct'] = use distinct key word
235 $params['include_custom_fields'] = (on by default)
236 $params['custom_XXXX'] = append custom statements to query
237 * @param string:'id' $id_field
238 * @return array('data'=> row data 'pageData' => page data information
240 function getListViewData($seed, $where, $offset=-1, $limit = -1, $filter_fields=array(),$params=array(),$id_field = 'id') {
241 global $current_user;
242 SugarVCR::erase($seed->module_dir);
243 $this->seed =& $seed;
244 $totalCounted = empty($GLOBALS['sugar_config']['disable_count_query']);
245 $_SESSION['MAILMERGE_MODULE_FROM_LISTVIEW'] = $seed->module_dir;
246 if(empty($_REQUEST['action']) || $_REQUEST['action'] != 'Popup'){
247 $_SESSION['MAILMERGE_MODULE'] = $seed->module_dir;
250 $this->setVariableName($seed->object_name, $where, $this->listviewName);
252 $this->seed->id = '[SELECT_ID_LIST]';
254 // if $params tell us to override all ordering
255 if(!empty($params['overrideOrder']) && !empty($params['orderBy'])) {
256 $order = $this->getOrderBy(strtolower($params['orderBy']), (empty($params['sortOrder']) ? '' : $params['sortOrder'])); // retreive from $_REQUEST
259 $order = $this->getOrderBy(); // retreive from $_REQUEST
262 // else use stored preference
263 $userPreferenceOrder = $current_user->getPreference('listviewOrder', $this->var_name);
265 if(empty($order['orderBy']) && !empty($userPreferenceOrder)) {
266 $order = $userPreferenceOrder;
268 // still empty? try to use settings passed in $param
269 if(empty($order['orderBy']) && !empty($params['orderBy'])) {
270 $order['orderBy'] = $params['orderBy'];
271 $order['sortOrder'] = (empty($params['sortOrder']) ? '' : $params['sortOrder']);
274 //rrs - bug: 21788. Do not use Order by stmts with fields that are not in the query.
275 // Bug 22740 - Tweak this check to strip off the table name off the order by parameter.
276 // Samir Gandhi : Do not remove the report_cache.date_modified condition as the report list view is broken
277 $orderby = $order['orderBy'];
278 if (strpos($order['orderBy'],'.') && ($order['orderBy'] != "report_cache.date_modified")) {
279 $orderby = substr($order['orderBy'],strpos($order['orderBy'],'.')+1);
281 if ($orderby != 'date_entered' && !in_array($orderby, array_keys($filter_fields))) {
282 $order['orderBy'] = '';
283 $order['sortOrder'] = '';
286 if (empty($order['orderBy'])) {
289 $orderBy = $order['orderBy'] . ' ' . $order['sortOrder'];
290 //wdong, Bug 25476, fix the sorting problem of Oracle.
291 if (isset($params['custom_order_by_override']['ori_code']) && $order['orderBy'] == $params['custom_order_by_override']['ori_code'])
292 $orderBy = $params['custom_order_by_override']['custom_code'] . ' ' . $order['sortOrder'];
295 if (empty($params['skipOrderSave'])) { // don't save preferences if told so
296 $current_user->setPreference('listviewOrder', $order, 0, $this->var_name); // save preference
299 // If $params tells us to override for the special last_name, first_name sorting
300 if (!empty($params['overrideLastNameOrder']) && $order['orderBy'] == 'last_name') {
301 $orderBy = 'last_name '.$order['sortOrder'].', first_name '.$order['sortOrder'];
304 $ret_array = $seed->create_new_list_query($orderBy, $where, $filter_fields, $params, 0, '', true, $seed, true);
305 $ret_array['inner_join'] = '';
306 if (!empty($this->seed->listview_inner_join)) {
307 $ret_array['inner_join'] = ' ' . implode(' ', $this->seed->listview_inner_join) . ' ';
310 if(!is_array($params)) $params = array();
311 if(!isset($params['custom_select'])) $params['custom_select'] = '';
312 if(!isset($params['custom_from'])) $params['custom_from'] = '';
313 if(!isset($params['custom_where'])) $params['custom_where'] = '';
314 if(!isset($params['custom_order_by'])) $params['custom_order_by'] = '';
315 $main_query = $ret_array['select'] . $params['custom_select'] . $ret_array['from'] . $params['custom_from'] . $ret_array['inner_join']. $ret_array['where'] . $params['custom_where'] . $ret_array['order_by'] . $params['custom_order_by'];
316 //C.L. - Fix for 23461
317 if(empty($_REQUEST['action']) || $_REQUEST['action'] != 'Popup') {
318 $_SESSION['export_where'] = $ret_array['where'];
321 $result = $this->db->query($main_query);
325 $limit = $this->getLimit();
327 $dyn_offset = $this->getOffset();
328 if($dyn_offset > 0 || !is_int($dyn_offset))$offset = $dyn_offset;
330 if(strcmp($offset, 'end') == 0){
331 $totalCount = $this->getTotalCount($main_query);
332 $offset = (floor(($totalCount -1) / $limit)) * $limit;
334 if($this->seed->ACLAccess('ListView')) {
335 $result = $this->db->limitQuery($main_query, $offset, $limit + 1);
351 while($row = $this->db->fetchByAssoc($result)) {
352 if($count < $limit) {
353 if(!empty($id_list)) {
358 $id_list .= '\''.$row[$id_field].'\'';
359 //handles date formating and such
360 $idIndex[$row[$id_field]][] = count($rows);
365 if (!empty($id_list)) $id_list .= ')';
367 SugarVCR::store($this->seed->module_dir, $main_query);
369 //NOW HANDLE SECONDARY QUERIES
370 if(!empty($ret_array['secondary_select'])) {
371 $secondary_query = $ret_array['secondary_select'] . $ret_array['secondary_from'] . ' WHERE '.$this->seed->table_name.'.id IN ' .$id_list;
372 $secondary_result = $this->db->query($secondary_query);
373 while($row = $this->db->fetchByAssoc($secondary_result)) {
374 foreach($row as $name=>$value) {
375 //add it to every row with the given id
376 foreach($idIndex[$row['ref_id']] as $index){
377 $rows[$index][$name]=$value;
384 // retrieve parent names
385 if(!empty($filter_fields['parent_name']) && !empty($filter_fields['parent_id']) && !empty($filter_fields['parent_type'])) {
386 foreach($idIndex as $id => $rowIndex) {
387 if(!isset($post_retrieve[$rows[$rowIndex[0]]['parent_type']])) {
388 $post_retrieve[$rows[$rowIndex[0]]['parent_type']] = array();
390 if(!empty($rows[$rowIndex[0]]['parent_id'])) $post_retrieve[$rows[$rowIndex[0]]['parent_type']][] = array('child_id' => $id , 'parent_id'=> $rows[$rowIndex[0]]['parent_id'], 'parent_type' => $rows[$rowIndex[0]]['parent_type'], 'type' => 'parent');
392 if(isset($post_retrieve)) {
393 $parent_fields = $seed->retrieve_parent_fields($post_retrieve);
394 foreach($parent_fields as $child_id => $parent_data) {
395 //add it to every row with the given id
396 foreach($idIndex[$child_id] as $index){
397 $rows[$index]['parent_name']= $parent_data['parent_name'];
406 while($row = current($rows)){
408 $dataIndex = count($data);
410 $temp->setupCustomFields($temp->module_dir);
411 $temp->loadFromRow($row);
412 if($idIndex[$row[$id_field]][0] == $dataIndex){
413 $pageData['tag'][$dataIndex] = $temp->listviewACLHelper();
415 $pageData['tag'][$dataIndex] = $pageData['tag'][$idIndex[$row[$id_field]][0]];
417 $data[$dataIndex] = $temp->get_list_view_data($filter_fields);
418 $pageData['rowAccess'][$dataIndex] = array('view' => $temp->ACLAccess('DetailView'), 'edit' => $temp->ACLAccess('EditView'));
419 $additionalDetailsAllow = $this->additionalDetails && $temp->ACLAccess('DetailView') && (file_exists('modules/' . $temp->module_dir . '/metadata/additionalDetails.php') || file_exists('custom/modules/' . $temp->module_dir . '/metadata/additionalDetails.php'));
420 //if($additionalDetailsAllow) $pageData['additionalDetails'] = array();
421 $additionalDetailsEdit = $temp->ACLAccess('EditView');
422 if($additionalDetailsAllow) {
423 if($this->additionalDetailsAjax) {
424 $ar = $this->getAdditionalDetailsAjax($data[$dataIndex]['ID']);
427 $additionalDetailsFile = 'modules/' . $this->seed->module_dir . '/metadata/additionalDetails.php';
428 if(file_exists('custom/modules/' . $this->seed->module_dir . '/metadata/additionalDetails.php')){
429 $additionalDetailsFile = 'custom/modules/' . $this->seed->module_dir . '/metadata/additionalDetails.php';
431 require_once($additionalDetailsFile);
432 $ar = $this->getAdditionalDetails($data[$dataIndex],
433 (empty($this->additionalDetailsFunction) ? 'additionalDetails' : $this->additionalDetailsFunction) . $this->seed->object_name,
434 $additionalDetailsEdit);
436 $pageData['additionalDetails'][$dataIndex] = $ar['string'];
437 $pageData['additionalDetails']['fieldToAddTo'] = $ar['fieldToAddTo'];
445 if($count > $limit) {
446 $nextOffset = $offset + $limit;
450 $prevOffset = $offset - $limit;
451 if($prevOffset < 0)$prevOffset = 0;
453 $totalCount = $count + $offset;
455 if( $count >= $limit && $totalCounted){
456 $totalCount = $this->getTotalCount($main_query);
458 SugarVCR::recordIDs($this->seed->module_dir, array_keys($idIndex), $offset, $totalCount);
459 $endOffset = (floor(($totalCount - 1) / $limit)) * $limit;
460 $pageData['ordering'] = $order;
461 $pageData['ordering']['sortOrder'] = $this->getReverseSortOrder($pageData['ordering']['sortOrder']);
462 $pageData['urls'] = $this->generateURLS($pageData['ordering']['sortOrder'], $offset, $prevOffset, $nextOffset, $endOffset, $totalCounted);
463 $pageData['offsets'] = array( 'current'=>$offset, 'next'=>$nextOffset, 'prev'=>$prevOffset, 'end'=>$endOffset, 'total'=>$totalCount, 'totalCounted'=>$totalCounted);
464 $pageData['bean'] = array('objectName' => $seed->object_name, 'moduleDir' => $seed->module_dir);
465 $pageData['stamp'] = $this->stamp;
466 $pageData['access'] = array('view' => $this->seed->ACLAccess('DetailView'), 'edit' => $this->seed->ACLAccess('EditView'));
467 $pageData['idIndex'] = $idIndex;
468 if(!$this->seed->ACLAccess('ListView')) {
469 $pageData['error'] = 'ACL restricted access';
472 return array('data'=>$data , 'pageData'=>$pageData);
477 * generates urls for use by the display layer
479 * @param int $sortOrder
481 * @param int $prevOffset
482 * @param int $nextOffset
483 * @param int $endOffset
484 * @param int $totalCounted
485 * @return array of urls orderBy and baseURL are always returned the others are only returned according to values passed in.
487 function generateURLS($sortOrder, $offset, $prevOffset, $nextOffset, $endOffset, $totalCounted) {
489 $urls['baseURL'] = $this->getBaseURL(). 'lvso=' . $sortOrder. '&';
490 $urls['orderBy'] = $urls['baseURL'] .$this->var_order_by.'=';
493 if($nextOffset > -1) {
494 $urls['nextPage'] = $urls['baseURL'] . $this->var_offset . '=' . $nextOffset . $dynamicUrl;
497 $urls['startPage'] = $urls['baseURL'] . $this->var_offset . '=0' . $dynamicUrl;
499 if($prevOffset > -1) {
500 $urls['prevPage'] = $urls['baseURL'] . $this->var_offset . '=' . $prevOffset . $dynamicUrl;
503 $urls['endPage'] = $urls['baseURL'] . $this->var_offset . '=' . $endOffset . $dynamicUrl;
505 $urls['endPage'] = $urls['baseURL'] . $this->var_offset . '=end' . $dynamicUrl;
512 * generates the additional details span to be retrieved via ajax
514 * @param GUID id id of the record
515 * @return array string to attach to field
517 function getAdditionalDetailsAjax($id)
521 $jscalendarImage = SugarThemeRegistry::current()->getImageURL('info_inline.gif');
523 $extra = "<span id='adspan_" . $id . "' onmouseout=\"return SUGAR.util.clearAdditionalDetailsCall()\" "
524 . "onmouseover=\"lvg_dtails('$id')\" "
525 . "onmouseout=\"return nd(1000);\" style='position: relative;'><!--not_in_theme!--><img vertical-align='middle' class='info' border='0' alt='".$app_strings['LBL_ADDITIONAL_DETAILS']."' src='$jscalendarImage'></span>";
527 return array('fieldToAddTo' => $this->additionalDetailsFieldToAdd, 'string' => $extra);
531 * generates the additional details values
533 * @param unknown_type $fields
534 * @param unknown_type $adFunction
535 * @param unknown_type $editAccess
536 * @return array string to attach to field
538 function getAdditionalDetails($fields, $adFunction, $editAccess)
543 $results = $adFunction($fields);
544 $results['string'] = str_replace(array("'", "'"), '\'', $results['string']); // no xss!
546 if(trim($results['string']) == '') $results['string'] = $app_strings['LBL_NONE'];
547 $extra = "<span onmouseover=\"return overlib('" .
548 str_replace(array("\rn", "\r", "\n"), array('','','<br />'), $results['string'])
549 . "', CAPTION, '<div style=\'float:left\'>{$app_strings['LBL_ADDITIONAL_DETAILS']}</div><div style=\'float: right\'>";
550 if($editAccess) $extra .= (!empty($results['editLink']) ? "<a title=\'{$app_strings['LBL_EDIT_BUTTON']}\' href={$results['editLink']}>".SugarThemeRegistry::current()->getImage('edit_inline', 'border=0', null, null, ".gif", $app_strings['LBL_EDITINLINE'])."</a>" : '');
551 $extra .= (!empty($results['viewLink']) ? "<a title=\'{$app_strings['LBL_VIEW_BUTTON']}\' href={$results['viewLink']}>".SugarThemeRegistry::current()->getImage('view_inline', 'style=\'margin-left: 2px;\' border=0 ', null, null, ".gif", $app_strings['LBL_VIEWINLINE'])."</a>" : '')
552 . "', DELAY, 200, STICKY, MOUSEOFF, 1000, WIDTH, "
553 . (empty($results['width']) ? '300' : $results['width'])
554 . ", CLOSETEXT, " . SugarThemeRegistry::current()->getImage('close', 'border=0 style=\'margin-left:2px; margin-right: 2px;\' ', null, null, ".gif", $app_strings['LBL_CLOSEINLINE'])."'</div>', "
555 . "CLOSETITLE, '{$app_strings['LBL_ADDITIONAL_DETAILS_CLOSE_TITLE']}', CLOSECLICK, FGCLASS, 'olFgClass', "
556 . "CGCLASS, 'olCgClass', BGCLASS, 'olBgClass', TEXTFONTCLASS, 'olFontClass', CAPTIONFONTCLASS, 'olCapFontClass', CLOSEFONTCLASS, 'olCloseFontClass');\" "
557 . "onmouseout=\"return nd(1000);\">".SugarThemeRegistry::current()->getImage('info_inline', "style='padding: 0px 5px 0px 2px' border='0'", null, null, '.png', $app_strings['LBL_INFOINLINE'])."</span>";
559 $results = $adFunction($fields);
560 $results['string'] = str_replace(array("'", "'"), '\'', $results['string']); // no xss!
562 if(trim($results['string']) == '') $results['string'] = $app_strings['LBL_NONE'];
563 $extra = "<span onmouseover=\"return overlib('" .
564 str_replace(array("\rn", "\r", "\n"), array('','','<br />'), $results['string'])
565 . "', CAPTION, '<div style=\'float:left\'>{$app_strings['LBL_ADDITIONAL_DETAILS']}</div><div style=\'float: right\'>";
566 if($editAccess) $extra .= (!empty($results['editLink']) ? "<a title=\'{$app_strings['LBL_EDIT_BUTTON']}\' href={$results['editLink']}>".SugarThemeRegistry::current()->getImage('edit_inline', 'border=0', null, null, ".gif", $app_strings['LBL_EDITINLINE'])."</a>" : '');
567 $extra .= (!empty($results['viewLink']) ? "<a title=\'{$app_strings['LBL_VIEW_BUTTON']}\' href={$results['viewLink']}>".SugarThemeRegistry::current()->getImage('view_inline', 'style=\'margin-left: 2px;\' border=0 ', null, null, ".gif", $app_strings['LBL_VIEWINLINE'])."</a>" : '')
568 . "', DELAY, 200, STICKY, MOUSEOFF, 1000, WIDTH, "
569 . (empty($results['width']) ? '300' : $results['width'])
570 . ", CLOSETEXT, " . SugarThemeRegistry::current()->getImage('close', 'border=0 style=\'margin-left:2px; margin-right: 2px;\'', null, null, ".gif", $app_strings['LBL_CLOSEINLINE'])."'</div>', "
571 . "CLOSETITLE, '{$app_strings['LBL_ADDITIONAL_DETAILS_CLOSE_TITLE']}', CLOSECLICK, FGCLASS, 'olFgClass', "
572 . "CGCLASS, 'olCgClass', BGCLASS, 'olBgClass', TEXTFONTCLASS, 'olFontClass', CAPTIONFONTCLASS, 'olCapFontClass', CLOSEFONTCLASS, 'olCloseFontClass');\" "
573 . "onmouseout=\"return nd(1000);\">".SugarThemeRegistry::current()->getImage('info_inline', "style='padding: 0px 5px 0px 2px' border='0'", null, null, '.png', $app_strings['LBL_INFOINLINE'])."</span>";
575 return array('fieldToAddTo' => $results['fieldToAddTo'], 'string' => $extra);