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');
42 var $additionalDetails = true;
43 var $listviewName = null;
44 var $additionalDetailsAllow = null;
45 var $additionalDetailsAjax = true; // leave this true when using filter fields
46 var $additionalDetailsFieldToAdd = 'NAME'; // where the span will be attached to
49 * If you want overwrite the query for the count of the listview set this to your query
50 * otherwise leave it empty and it will use SugarBean::create_list_count_query
52 var $count_query = '';
55 * Constructor sets the limitName to look up the limit in $sugar_config
57 * @return ListViewData
59 function ListViewData() {
60 $this->limitName = 'list_max_entries_per_page';
61 $this->db = &DBManagerFactory::getInstance('listviews');
65 * checks the request for the order by and if that is not set then it checks the session for it
67 * @return array containing the keys orderBy => field being ordered off of and sortOrder => the sort order of that field
69 function getOrderBy($orderBy = '', $direction = '') {
70 if (!empty($orderBy) || !empty($_REQUEST[$this->var_order_by])) {
71 if(!empty($_REQUEST[$this->var_order_by])) {
73 $orderBy = $_REQUEST[$this->var_order_by];
74 if(!empty($_REQUEST['lvso']) && (empty($_SESSION['lvd']['last_ob']) || strcmp($orderBy, $_SESSION['lvd']['last_ob']) == 0) ){
75 $direction = $_REQUEST['lvso'];
77 $trackerManager = TrackerManager::getInstance();
78 if($monitor = $trackerManager->getMonitor('tracker')){
79 $monitor->setValue('module_name', $GLOBALS['module']);
80 $monitor->setValue('item_summary', "lvso=".$direction."&".$this->var_order_by."=".$_REQUEST[$this->var_order_by]);
81 $monitor->setValue('action', 'listview');
82 $monitor->setValue('user_id', $GLOBALS['current_user']->id);
83 $monitor->setValue('date_modified', TimeDate::getInstance()->nowDb());
88 $_SESSION[$this->var_order_by] = array('orderBy'=>$orderBy, 'direction'=> $direction);
89 $_SESSION['lvd']['last_ob'] = $orderBy;
92 if(!empty($_SESSION[$this->var_order_by])) {
93 $orderBy = $_SESSION[$this->var_order_by]['orderBy'];
94 $direction = $_SESSION[$this->var_order_by]['direction'];
97 $orderBy = 'date_entered';
101 return array('orderBy' => $orderBy, 'sortOrder' => $direction);
105 * gets the reverse of the sort order for use on links to reverse a sort order from what is currently used
107 * @param STRING (ASC or DESC) $current_order
108 * @return STRING (ASC or DESC)
110 function getReverseSortOrder($current_order){
111 return (strcmp(strtolower($current_order), 'asc') == 0)?'DESC':'ASC';
114 * gets the limit of how many rows to show per page
116 * @return INT (the limit)
118 function getLimit() {
119 return $GLOBALS['sugar_config'][$this->limitName];
123 * returns the current offset
125 * @return INT (current offset)
127 function getOffset() {
128 return (!empty($_REQUEST[$this->var_offset])) ? $_REQUEST[$this->var_offset] : 0;
132 * generates the base url without
133 * any files in the block variables will not be part of the url
136 * @return STRING (the base url)
138 function getBaseURL() {
140 if(empty($this->base_url)) {
141 $blockVariables = array('mass', 'uid', 'massupdate', 'delete', 'merge', 'selectCount',$this->var_order_by, $this->var_offset, 'lvso', 'sortOrder', 'orderBy', 'request_data', 'current_query_by_page');
142 $base_url = 'index.php?';
143 foreach($beanList as $bean) {
144 $blockVariables[] = 'Home2_'.strtoupper($bean).'_ORDER_BY';
146 $blockVariables[] = 'Home2_CASE_ORDER_BY';
147 // Added mostly for the unit test runners, which may not have these superglobals defined
149 if ( isset($_POST) && is_array($_POST) ) {
150 $params = array_merge($params,$_POST);
152 if ( isset($_GET) && is_array($_GET) ) {
153 $params = array_merge($params,$_GET);
155 foreach($params as $name=>$value) {
156 if(!in_array($name, $blockVariables)){
157 if(is_array($value)) {
158 foreach($value as $v) {
159 $base_url .= $name.urlencode('[]').'='.urlencode($v) . '&';
163 $base_url .= $name.'='.urlencode($value) . '&';
167 $this->base_url = $base_url;
169 return $this->base_url;
172 * based off of a base name it sets base, offset, and order by variable names to retrieve them from requests and sessions
174 * @param unknown_type $baseName
176 function setVariableName($baseName, $where, $listviewName = null){
178 $module = (!empty($listviewName)) ? $listviewName: $_REQUEST['module'];
179 $this->var_name = $module .'2_'. strtoupper($baseName);
181 $this->var_order_by = $this->var_name .'_ORDER_BY';
182 $this->var_offset = $this->var_name . '_offset';
183 $timestamp = sugar_microtime();
184 $this->stamp = $timestamp;
186 $_SESSION[$module .'2_QUERY_QUERY'] = $where;
188 $_SESSION[strtoupper($baseName) . "_FROM_LIST_VIEW"] = $timestamp;
189 $_SESSION[strtoupper($baseName) . "_DETAIL_NAV_HISTORY"] = false;
192 function getTotalCount($main_query){
193 if(!empty($this->count_query)){
194 $count_query = $this->count_query;
196 $count_query = SugarBean::create_list_count_query($main_query);
198 $result = $this->db->query($count_query);
199 if($row = $this->db->fetchByAssoc($result)){
206 * takes in a seed and creates the list view query based off of that seed
207 * if the $limit value is set to -1 then it will use the default limit and offset values
209 * it will return an array with two key values
210 * 1. 'data'=> this is an array of row data
211 * 2. 'pageData'=> this is an array containg three values
212 * a.'ordering'=> array('orderBy'=> the field being ordered by , 'sortOrder'=> 'ASC' or 'DESC')
213 * b.'urls'=>array('baseURL'=>url used to generate other urls ,
214 * 'orderBy'=> the base url for order by
215 * //the following may not be set (so check empty to see if they are set)
216 * 'nextPage'=> the url for the next group of results,
217 * 'prevPage'=> the url for the prev group of results,
218 * 'startPage'=> the url for the start of the group,
219 * 'endPage'=> the url for the last set of results in the group
220 * c.'offsets'=>array(
221 * 'current'=>current offset
222 * 'next'=> next group offset
223 * 'prev'=> prev group offset
224 * 'end'=> the offset of the last group
225 * '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 )
226 * 'totalCounted'=> if a count query was used to get the total count
228 * @param SugarBean $seed
229 * @param string $where
230 * @param int:0 $offset
231 * @param int:-1 $limit
232 * @param string[]:array() $filter_fields
233 * @param array:array() $params
234 * Potential $params are
235 $params['distinct'] = use distinct key word
236 $params['include_custom_fields'] = (on by default)
237 $params['custom_XXXX'] = append custom statements to query
238 * @param string:'id' $id_field
239 * @return array('data'=> row data 'pageData' => page data information
241 function getListViewData($seed, $where, $offset=-1, $limit = -1, $filter_fields=array(),$params=array(),$id_field = 'id') {
242 global $current_user;
243 SugarVCR::erase($seed->module_dir);
244 $this->seed =& $seed;
245 $totalCounted = empty($GLOBALS['sugar_config']['disable_count_query']);
246 $_SESSION['MAILMERGE_MODULE_FROM_LISTVIEW'] = $seed->module_dir;
247 if(empty($_REQUEST['action']) || $_REQUEST['action'] != 'Popup'){
248 $_SESSION['MAILMERGE_MODULE'] = $seed->module_dir;
251 $this->setVariableName($seed->object_name, $where, $this->listviewName);
253 $this->seed->id = '[SELECT_ID_LIST]';
255 // if $params tell us to override all ordering
256 if(!empty($params['overrideOrder']) && !empty($params['orderBy'])) {
257 $order = $this->getOrderBy(strtolower($params['orderBy']), (empty($params['sortOrder']) ? '' : $params['sortOrder'])); // retreive from $_REQUEST
260 $order = $this->getOrderBy(); // retreive from $_REQUEST
263 // else use stored preference
264 $userPreferenceOrder = $current_user->getPreference('listviewOrder', $this->var_name);
266 if(empty($order['orderBy']) && !empty($userPreferenceOrder)) {
267 $order = $userPreferenceOrder;
269 // still empty? try to use settings passed in $param
270 if(empty($order['orderBy']) && !empty($params['orderBy'])) {
271 $order['orderBy'] = $params['orderBy'];
272 $order['sortOrder'] = (empty($params['sortOrder']) ? '' : $params['sortOrder']);
275 //rrs - bug: 21788. Do not use Order by stmts with fields that are not in the query.
276 // Bug 22740 - Tweak this check to strip off the table name off the order by parameter.
277 // Samir Gandhi : Do not remove the report_cache.date_modified condition as the report list view is broken
278 $orderby = $order['orderBy'];
279 if (strpos($order['orderBy'],'.') && ($order['orderBy'] != "report_cache.date_modified")) {
280 $orderby = substr($order['orderBy'],strpos($order['orderBy'],'.')+1);
282 if ($orderby != 'date_entered' && !in_array($orderby, array_keys($filter_fields))) {
283 $order['orderBy'] = '';
284 $order['sortOrder'] = '';
287 if (empty($order['orderBy'])) {
290 $orderBy = $order['orderBy'] . ' ' . $order['sortOrder'];
291 //wdong, Bug 25476, fix the sorting problem of Oracle.
292 if (isset($params['custom_order_by_override']['ori_code']) && $order['orderBy'] == $params['custom_order_by_override']['ori_code'])
293 $orderBy = $params['custom_order_by_override']['custom_code'] . ' ' . $order['sortOrder'];
296 if (empty($params['skipOrderSave'])) { // don't save preferences if told so
297 $current_user->setPreference('listviewOrder', $order, 0, $this->var_name); // save preference
300 // If $params tells us to override for the special last_name, first_name sorting
301 if (!empty($params['overrideLastNameOrder']) && $order['orderBy'] == 'last_name') {
302 $orderBy = 'last_name '.$order['sortOrder'].', first_name '.$order['sortOrder'];
305 $ret_array = $seed->create_new_list_query($orderBy, $where, $filter_fields, $params, 0, '', true, $seed, true);
306 $ret_array['inner_join'] = '';
307 if (!empty($this->seed->listview_inner_join)) {
308 $ret_array['inner_join'] = ' ' . implode(' ', $this->seed->listview_inner_join) . ' ';
311 if(!is_array($params)) $params = array();
312 if(!isset($params['custom_select'])) $params['custom_select'] = '';
313 if(!isset($params['custom_from'])) $params['custom_from'] = '';
314 if(!isset($params['custom_where'])) $params['custom_where'] = '';
315 if(!isset($params['custom_order_by'])) $params['custom_order_by'] = '';
316 $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'];
317 //C.L. - Fix for 23461
318 if(empty($_REQUEST['action']) || $_REQUEST['action'] != 'Popup') {
319 $_SESSION['export_where'] = $ret_array['where'];
322 $result = $this->db->query($main_query);
326 $limit = $this->getLimit();
328 $dyn_offset = $this->getOffset();
329 if($dyn_offset > 0 || !is_int($dyn_offset))$offset = $dyn_offset;
331 if(strcmp($offset, 'end') == 0){
332 $totalCount = $this->getTotalCount($main_query);
333 $offset = (floor(($totalCount -1) / $limit)) * $limit;
335 if($this->seed->ACLAccess('ListView')) {
336 $result = $this->db->limitQuery($main_query, $offset, $limit + 1);
352 while($row = $this->db->fetchByAssoc($result)) {
353 if($count < $limit) {
354 if(!empty($id_list)) {
359 $id_list .= '\''.$row[$id_field].'\'';
360 //handles date formating and such
361 $idIndex[$row[$id_field]][] = count($rows);
366 if (!empty($id_list)) $id_list .= ')';
368 SugarVCR::store($this->seed->module_dir, $main_query);
370 //NOW HANDLE SECONDARY QUERIES
371 if(!empty($ret_array['secondary_select'])) {
372 $secondary_query = $ret_array['secondary_select'] . $ret_array['secondary_from'] . ' WHERE '.$this->seed->table_name.'.id IN ' .$id_list;
373 $secondary_result = $this->db->query($secondary_query);
374 while($row = $this->db->fetchByAssoc($secondary_result)) {
375 foreach($row as $name=>$value) {
376 //add it to every row with the given id
377 foreach($idIndex[$row['ref_id']] as $index){
378 $rows[$index][$name]=$value;
385 // retrieve parent names
386 if(!empty($filter_fields['parent_name']) && !empty($filter_fields['parent_id']) && !empty($filter_fields['parent_type'])) {
387 foreach($idIndex as $id => $rowIndex) {
388 if(!isset($post_retrieve[$rows[$rowIndex[0]]['parent_type']])) {
389 $post_retrieve[$rows[$rowIndex[0]]['parent_type']] = array();
391 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');
393 if(isset($post_retrieve)) {
394 $parent_fields = $seed->retrieve_parent_fields($post_retrieve);
395 foreach($parent_fields as $child_id => $parent_data) {
396 //add it to every row with the given id
397 foreach($idIndex[$child_id] as $index){
398 $rows[$index]['parent_name']= $parent_data['parent_name'];
407 while($row = current($rows)){
409 $dataIndex = count($data);
411 $temp->setupCustomFields($temp->module_dir);
412 $temp->loadFromRow($row);
413 if($idIndex[$row[$id_field]][0] == $dataIndex){
414 $pageData['tag'][$dataIndex] = $temp->listviewACLHelper();
416 $pageData['tag'][$dataIndex] = $pageData['tag'][$idIndex[$row[$id_field]][0]];
418 $data[$dataIndex] = $temp->get_list_view_data($filter_fields);
419 $pageData['rowAccess'][$dataIndex] = array('view' => $temp->ACLAccess('DetailView'), 'edit' => $temp->ACLAccess('EditView'));
420 $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'));
421 //if($additionalDetailsAllow) $pageData['additionalDetails'] = array();
422 $additionalDetailsEdit = $temp->ACLAccess('EditView');
423 if($additionalDetailsAllow) {
424 if($this->additionalDetailsAjax) {
425 $ar = $this->getAdditionalDetailsAjax($data[$dataIndex]['ID']);
428 $additionalDetailsFile = 'modules/' . $this->seed->module_dir . '/metadata/additionalDetails.php';
429 if(file_exists('custom/modules/' . $this->seed->module_dir . '/metadata/additionalDetails.php')){
430 $additionalDetailsFile = 'custom/modules/' . $this->seed->module_dir . '/metadata/additionalDetails.php';
432 require_once($additionalDetailsFile);
433 $ar = $this->getAdditionalDetails($data[$dataIndex],
434 (empty($this->additionalDetailsFunction) ? 'additionalDetails' : $this->additionalDetailsFunction) . $this->seed->object_name,
435 $additionalDetailsEdit);
437 $pageData['additionalDetails'][$dataIndex] = $ar['string'];
438 $pageData['additionalDetails']['fieldToAddTo'] = $ar['fieldToAddTo'];
446 if($count > $limit) {
447 $nextOffset = $offset + $limit;
451 $prevOffset = $offset - $limit;
452 if($prevOffset < 0)$prevOffset = 0;
454 $totalCount = $count + $offset;
456 if( $count >= $limit && $totalCounted){
457 $totalCount = $this->getTotalCount($main_query);
459 SugarVCR::recordIDs($this->seed->module_dir, array_keys($idIndex), $offset, $totalCount);
460 $endOffset = (floor(($totalCount - 1) / $limit)) * $limit;
461 $pageData['ordering'] = $order;
462 $pageData['ordering']['sortOrder'] = $this->getReverseSortOrder($pageData['ordering']['sortOrder']);
463 $pageData['urls'] = $this->generateURLS($pageData['ordering']['sortOrder'], $offset, $prevOffset, $nextOffset, $endOffset, $totalCounted);
464 $pageData['offsets'] = array( 'current'=>$offset, 'next'=>$nextOffset, 'prev'=>$prevOffset, 'end'=>$endOffset, 'total'=>$totalCount, 'totalCounted'=>$totalCounted);
465 $pageData['bean'] = array('objectName' => $seed->object_name, 'moduleDir' => $seed->module_dir);
466 $pageData['stamp'] = $this->stamp;
467 $pageData['access'] = array('view' => $this->seed->ACLAccess('DetailView'), 'edit' => $this->seed->ACLAccess('EditView'));
468 $pageData['idIndex'] = $idIndex;
469 if(!$this->seed->ACLAccess('ListView')) {
470 $pageData['error'] = 'ACL restricted access';
473 return array('data'=>$data , 'pageData'=>$pageData);
478 * generates urls for use by the display layer
480 * @param int $sortOrder
482 * @param int $prevOffset
483 * @param int $nextOffset
484 * @param int $endOffset
485 * @param int $totalCounted
486 * @return array of urls orderBy and baseURL are always returned the others are only returned according to values passed in.
488 function generateURLS($sortOrder, $offset, $prevOffset, $nextOffset, $endOffset, $totalCounted) {
490 $urls['baseURL'] = $this->getBaseURL(). 'lvso=' . $sortOrder. '&';
491 $urls['orderBy'] = $urls['baseURL'] .$this->var_order_by.'=';
494 if($nextOffset > -1) {
495 $urls['nextPage'] = $urls['baseURL'] . $this->var_offset . '=' . $nextOffset . $dynamicUrl;
498 $urls['startPage'] = $urls['baseURL'] . $this->var_offset . '=0' . $dynamicUrl;
500 if($prevOffset > -1) {
501 $urls['prevPage'] = $urls['baseURL'] . $this->var_offset . '=' . $prevOffset . $dynamicUrl;
504 $urls['endPage'] = $urls['baseURL'] . $this->var_offset . '=' . $endOffset . $dynamicUrl;
506 $urls['endPage'] = $urls['baseURL'] . $this->var_offset . '=end' . $dynamicUrl;
513 * generates the additional details span to be retrieved via ajax
515 * @param GUID id id of the record
516 * @return array string to attach to field
518 function getAdditionalDetailsAjax($id)
522 $jscalendarImage = SugarThemeRegistry::current()->getImageURL('info_inline.gif');
524 $extra = "<span id='adspan_" . $id . "' onmouseout=\"return SUGAR.util.clearAdditionalDetailsCall()\" "
525 . "onmouseover=\"lvg_dtails('$id')\" "
526 . "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>";
528 return array('fieldToAddTo' => $this->additionalDetailsFieldToAdd, 'string' => $extra);
532 * generates the additional details values
534 * @param unknown_type $fields
535 * @param unknown_type $adFunction
536 * @param unknown_type $editAccess
537 * @return array string to attach to field
539 function getAdditionalDetails($fields, $adFunction, $editAccess)
544 $results = $adFunction($fields);
546 $results['string'] = str_replace(array("'", "'"), '\'', $results['string']); // no xss!
548 if(trim($results['string']) == '')
550 $results['string'] = $app_strings['LBL_NONE'];
553 $extra = "<span onmouseover=\"return overlib('" .
554 str_replace(array("\rn", "\r", "\n"), array('','','<br />'), $results['string'])
555 . "', CAPTION, '<div style=\'float:left\'>{$app_strings['LBL_ADDITIONAL_DETAILS']}</div><div style=\'float: right\'>";
557 if($editAccess && !empty($results['editLink']))
559 $extra .= "<a title=\'{$app_strings['LBL_EDIT_BUTTON']}\' href={$results['editLink']}><img style=\'margin-left: 2px;\' border=\'0\' src=\'".SugarThemeRegistry::current()->getImageURL('edit_inline.gif')."\'></a>";
562 $extra .= (!empty($results['viewLink']) ? "<a title=\'{$app_strings['LBL_VIEW_BUTTON']}\' href={$results['viewLink']}><img style=\'margin-left: 2px;\' border=\'0\' src=".SugarThemeRegistry::current()->getImageURL('view_inline.gif')."></a>" : '')
563 . "', DELAY, 200, STICKY, MOUSEOFF, 1000, WIDTH, "
564 . (empty($results['width']) ? '300' : $results['width'])
565 . ", CLOSETEXT, '<img alt=\'{$app_strings['LBL_CLOSEINLINE']}\' style=\'margin-left:2px; margin-right: 2px; border=0;\' src=".SugarThemeRegistry::current()->getImageURL('close.gif')."></div>', "
566 . "CLOSETITLE, '{$app_strings['LBL_ADDITIONAL_DETAILS_CLOSE_TITLE']}', CLOSECLICK, FGCLASS, 'olFgClass', "
567 . "CGCLASS, 'olCgClass', BGCLASS, 'olBgClass', TEXTFONTCLASS, 'olFontClass', CAPTIONFONTCLASS, 'olCapFontClass', CLOSEFONTCLASS, 'olCloseFontClass');\" "
568 . "onmouseout=\"return nd(1000);\"><img alt=\'{$app_strings['LBL_INFOINLINE']}\' style=\'padding: 0px 5px 0px 2px\' border=\'0\' src='".SugarThemeRegistry::current()->getImageURL('info_inline.png')."' ></span>";
571 $results = $adFunction($fields);
573 $results['string'] = str_replace(array("'", "'"), '\'', $results['string']); // no xss!
575 if(trim($results['string']) == '')
577 $results['string'] = $app_strings['LBL_NONE'];
580 $extra = "<span onmouseover=\"return overlib('" .
581 str_replace(array("\rn", "\r", "\n"), array('','','<br />'), $results['string'])
582 . "', CAPTION, '<div style=\'float:left\'>{$app_strings['LBL_ADDITIONAL_DETAILS']}</div><div style=\'float: right\'>";
584 if($editAccess && !empty($results['editLink']))
586 $extra .= "<a title=\'{$app_strings['LBL_EDIT_BUTTON']}\' href={$results['editLink']}><img style=\'margin-left: 2px;\' border=\'0\' src=\'".SugarThemeRegistry::current()->getImageURL('edit_inline.gif')."\'></a>";
589 $extra .= (!empty($results['viewLink']) ? "<a title=\'{$app_strings['LBL_VIEW_BUTTON']}\' href={$results['viewLink']}><img style=\'margin-left: 2px;\' border=\'0\' src=".SugarThemeRegistry::current()->getImageURL('view_inline.gif')."></a>" : '')
590 . "', DELAY, 200, STICKY, MOUSEOFF, 1000, WIDTH, "
591 . (empty($results['width']) ? '300' : $results['width'])
592 . ", CLOSETEXT, '<img alt=\'{$app_strings['LBL_CLOSEINLINE']}\' style=\'margin-left:2px; margin-right: 2px; border=0;\' src=".SugarThemeRegistry::current()->getImageURL('close.gif')."></div>', "
593 . "CLOSETITLE, '{$app_strings['LBL_ADDITIONAL_DETAILS_CLOSE_TITLE']}', CLOSECLICK, FGCLASS, 'olFgClass', "
594 . "CGCLASS, 'olCgClass', BGCLASS, 'olBgClass', TEXTFONTCLASS, 'olFontClass', CAPTIONFONTCLASS, 'olCapFontClass', CLOSEFONTCLASS, 'olCloseFontClass');\" "
595 . "onmouseout=\"return nd(1000);\"><img alt='{$app_strings['LBL_INFOINLINE']}' style='padding: 0px 5px 0px 2px' border='0' src='".SugarThemeRegistry::current()->getImageURL('info_inline.png')."' ></span>";
597 return array('fieldToAddTo' => $results['fieldToAddTo'], 'string' => $extra);