@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | } |
81 | 81 | break; |
82 | 82 | case "mssql": |
83 | - if ( function_exists('sqlsrv_connect') |
|
83 | + if ( function_exists('sqlsrv_connect') |
|
84 | 84 | && (empty($config['db_mssql_force_driver']) || $config['db_mssql_force_driver'] == 'sqlsrv' )) { |
85 | 85 | $my_db_manager = 'SqlsrvManager'; |
86 | 86 | } elseif (self::isFreeTDS() |
@@ -122,20 +122,20 @@ discard block |
||
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
125 | - * Returns a reference to the DB object for instance $instanceName, or the default |
|
125 | + * Returns a reference to the DB object for instance $instanceName, or the default |
|
126 | 126 | * instance if one is not specified |
127 | 127 | * |
128 | 128 | * @param string $instanceName optional, name of the instance |
129 | 129 | * @return object DBManager instance |
130 | 130 | */ |
131 | - public static function getInstance($instanceName = '') |
|
131 | + public static function getInstance($instanceName = '') |
|
132 | 132 | { |
133 | 133 | global $sugar_config; |
134 | 134 | static $count = 0, $old_count = 0; |
135 | 135 | |
136 | 136 | //fall back to the default instance name |
137 | 137 | if(empty($sugar_config['db'][$instanceName])){ |
138 | - $instanceName = ''; |
|
138 | + $instanceName = ''; |
|
139 | 139 | } |
140 | 140 | if(!isset(self::$instances[$instanceName])){ |
141 | 141 | $config = $sugar_config['dbconfig']; |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | /** |
249 | 249 | * Check if we have freeTDS driver installed |
250 | 250 | * Invoked when connected to mssql. checks if we have freetds version of mssql library. |
251 | - * the response is put into a global variable. |
|
251 | + * the response is put into a global variable. |
|
252 | 252 | * @return bool |
253 | 253 | */ |
254 | 254 | public static function isFreeTDS() |
@@ -256,14 +256,14 @@ discard block |
||
256 | 256 | static $is_freetds = null; |
257 | 257 | |
258 | 258 | if($is_freetds === null) { |
259 | - ob_start(); |
|
260 | - phpinfo(INFO_MODULES); |
|
261 | - $info=ob_get_contents(); |
|
262 | - ob_end_clean(); |
|
259 | + ob_start(); |
|
260 | + phpinfo(INFO_MODULES); |
|
261 | + $info=ob_get_contents(); |
|
262 | + ob_end_clean(); |
|
263 | 263 | |
264 | - $is_freetds = (strpos($info,'FreeTDS') !== false); |
|
264 | + $is_freetds = (strpos($info,'FreeTDS') !== false); |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | return $is_freetds; |
268 | - } |
|
268 | + } |
|
269 | 269 | } |
270 | 270 | \ No newline at end of file |
@@ -236,8 +236,8 @@ discard block |
||
236 | 236 | * @param unknown $html_varName |
237 | 237 | * @desc INTERNAL FUNCTION handles the rows |
238 | 238 | */ |
239 | - function process_dynamic_listview_rows($data,$parent_data, $xtemplateSection, $html_varName, $subpanel_def) |
|
240 | - { |
|
239 | + function process_dynamic_listview_rows($data,$parent_data, $xtemplateSection, $html_varName, $subpanel_def) |
|
240 | + { |
|
241 | 241 | global $subpanel_item_count; |
242 | 242 | global $odd_bg; |
243 | 243 | global $even_bg; |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | $BG_COLOR = $even_bg; |
347 | 347 | } |
348 | 348 | $oddRow = !$oddRow; |
349 | - $button_contents = array(); |
|
349 | + $button_contents = array(); |
|
350 | 350 | $this->xTemplate->assign("ROW_COLOR", $ROW_COLOR); |
351 | 351 | $this->xTemplate->assign("BG_COLOR", $BG_COLOR); |
352 | 352 | $layout_manager = $this->getLayoutManager(); |
@@ -366,43 +366,43 @@ discard block |
||
366 | 366 | $thepanel=$subpanel_def; |
367 | 367 | } |
368 | 368 | |
369 | - /* BEGIN - SECURITY GROUPS */ |
|
369 | + /* BEGIN - SECURITY GROUPS */ |
|
370 | 370 | |
371 | - //This check is costly doing it field by field in the below foreach |
|
372 | - //instead pull up here and do once per record.... |
|
373 | - $aclaccess_is_owner = false; |
|
374 | - $aclaccess_in_group = false; |
|
371 | + //This check is costly doing it field by field in the below foreach |
|
372 | + //instead pull up here and do once per record.... |
|
373 | + $aclaccess_is_owner = false; |
|
374 | + $aclaccess_in_group = false; |
|
375 | 375 | |
376 | - global $current_user; |
|
377 | - if(is_admin($current_user)) { |
|
378 | - $aclaccess_is_owner = true; |
|
379 | - } else { |
|
380 | - $aclaccess_is_owner = $aItem->isOwner($current_user->id); |
|
381 | - } |
|
376 | + global $current_user; |
|
377 | + if(is_admin($current_user)) { |
|
378 | + $aclaccess_is_owner = true; |
|
379 | + } else { |
|
380 | + $aclaccess_is_owner = $aItem->isOwner($current_user->id); |
|
381 | + } |
|
382 | 382 | |
383 | - require_once("modules/SecurityGroups/SecurityGroup.php"); |
|
384 | - $aclaccess_in_group = SecurityGroup::groupHasAccess($aItem->module_dir,$aItem->id); |
|
383 | + require_once("modules/SecurityGroups/SecurityGroup.php"); |
|
384 | + $aclaccess_in_group = SecurityGroup::groupHasAccess($aItem->module_dir,$aItem->id); |
|
385 | 385 | |
386 | - /* END - SECURITY GROUPS */ |
|
386 | + /* END - SECURITY GROUPS */ |
|
387 | 387 | |
388 | 388 | //get data source name |
389 | 389 | $linked_field=$thepanel->get_data_source_name(); |
390 | 390 | $linked_field_set=$thepanel->get_data_source_name(true); |
391 | 391 | static $count; |
392 | 392 | if(!isset($count))$count = 0; |
393 | - /* BEGIN - SECURITY GROUPS */ |
|
394 | - /** |
|
393 | + /* BEGIN - SECURITY GROUPS */ |
|
394 | + /** |
|
395 | 395 | $field_acl['DetailView'] = $aItem->ACLAccess('DetailView'); |
396 | 396 | $field_acl['ListView'] = $aItem->ACLAccess('ListView'); |
397 | 397 | $field_acl['EditView'] = $aItem->ACLAccess('EditView'); |
398 | 398 | $field_acl['Delete'] = $aItem->ACLAccess('Delete'); |
399 | - */ |
|
400 | - //pass is_owner, in_group...vars defined above |
|
399 | + */ |
|
400 | + //pass is_owner, in_group...vars defined above |
|
401 | 401 | $field_acl['DetailView'] = $aItem->ACLAccess('DetailView',$aclaccess_is_owner,$aclaccess_in_group); |
402 | 402 | $field_acl['ListView'] = $aItem->ACLAccess('ListView',$aclaccess_is_owner,$aclaccess_in_group); |
403 | 403 | $field_acl['EditView'] = $aItem->ACLAccess('EditView',$aclaccess_is_owner,$aclaccess_in_group); |
404 | 404 | $field_acl['Delete'] = $aItem->ACLAccess('Delete',$aclaccess_is_owner,$aclaccess_in_group); |
405 | - /* END - SECURITY GROUPS */ |
|
405 | + /* END - SECURITY GROUPS */ |
|
406 | 406 | foreach($thepanel->get_list_fields() as $field_name=>$list_field) |
407 | 407 | { |
408 | 408 | //add linked field attribute to the array. |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | // So we'll populate the field data with the pre-rendered display for the field |
470 | 470 | $list_field['fields'][$field_name] = $widget_contents; |
471 | 471 | if('full_name' == $field_name){//bug #32465 |
472 | - $list_field['fields'][strtoupper($field_name)] = $widget_contents; |
|
472 | + $list_field['fields'][strtoupper($field_name)] = $widget_contents; |
|
473 | 473 | } |
474 | 474 | |
475 | 475 | //vardef source is non db, assign the field name to varname for processing of column. |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | $widget_contents = $layout_manager->widgetDisplay($list_field); |
483 | 483 | } |
484 | 484 | |
485 | - $count++; |
|
485 | + $count++; |
|
486 | 486 | $this->xTemplate->assign('CELL_COUNT', $count); |
487 | 487 | $this->xTemplate->assign('CLASS', ""); |
488 | 488 | if ( empty($widget_contents) ) $widget_contents = ' '; |
@@ -490,15 +490,15 @@ discard block |
||
490 | 490 | $this->xTemplate->parse($xtemplateSection.".row.cell"); |
491 | 491 | } else { |
492 | 492 | // This handles the edit and remove buttons and icon widget |
493 | - if( isset($list_field['widget_class']) && $list_field['widget_class'] == "SubPanelIcon") { |
|
494 | - $count++; |
|
495 | - $widget_contents = $layout_manager->widgetDisplay($list_field); |
|
496 | - $this->xTemplate->assign('CELL_COUNT', $count); |
|
497 | - $this->xTemplate->assign('CLASS', ""); |
|
498 | - if ( empty($widget_contents) ) $widget_contents = ' '; |
|
499 | - $this->xTemplate->assign('CELL', $widget_contents); |
|
500 | - $this->xTemplate->parse($xtemplateSection.".row.cell"); |
|
501 | - } elseif (preg_match("/button/i", $list_field['name'])) { |
|
493 | + if( isset($list_field['widget_class']) && $list_field['widget_class'] == "SubPanelIcon") { |
|
494 | + $count++; |
|
495 | + $widget_contents = $layout_manager->widgetDisplay($list_field); |
|
496 | + $this->xTemplate->assign('CELL_COUNT', $count); |
|
497 | + $this->xTemplate->assign('CLASS', ""); |
|
498 | + if ( empty($widget_contents) ) $widget_contents = ' '; |
|
499 | + $this->xTemplate->assign('CELL', $widget_contents); |
|
500 | + $this->xTemplate->parse($xtemplateSection.".row.cell"); |
|
501 | + } elseif (preg_match("/button/i", $list_field['name'])) { |
|
502 | 502 | if ((($list_field['name'] === 'edit_button' && $field_acl['EditView']) || ($list_field['name'] === 'close_button' && $field_acl['EditView']) || ($list_field['name'] === 'remove_button' && $field_acl['Delete'])) && '' != ($_content = $layout_manager->widgetDisplay($list_field)) ) |
503 | 503 | { |
504 | 504 | $button_contents[] = $_content; |
@@ -508,15 +508,15 @@ discard block |
||
508 | 508 | { |
509 | 509 | $button_contents[] = ''; |
510 | 510 | } |
511 | - } else { |
|
512 | - $count++; |
|
513 | - $this->xTemplate->assign('CLASS', ""); |
|
514 | - $widget_contents = $layout_manager->widgetDisplay($list_field); |
|
515 | - $this->xTemplate->assign('CELL_COUNT', $count); |
|
516 | - if ( empty($widget_contents) ) $widget_contents = ' '; |
|
517 | - $this->xTemplate->assign('CELL', $widget_contents); |
|
518 | - $this->xTemplate->parse($xtemplateSection.".row.cell"); |
|
519 | - } |
|
511 | + } else { |
|
512 | + $count++; |
|
513 | + $this->xTemplate->assign('CLASS', ""); |
|
514 | + $widget_contents = $layout_manager->widgetDisplay($list_field); |
|
515 | + $this->xTemplate->assign('CELL_COUNT', $count); |
|
516 | + if ( empty($widget_contents) ) $widget_contents = ' '; |
|
517 | + $this->xTemplate->assign('CELL', $widget_contents); |
|
518 | + $this->xTemplate->parse($xtemplateSection.".row.cell"); |
|
519 | + } |
|
520 | 520 | } |
521 | 521 | |
522 | 522 | } |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | * All Rights Reserved. |
580 | 580 | * Contributor(s): ______________________________________. |
581 | 581 | */ |
582 | - function ListView() { |
|
582 | + function ListView() { |
|
583 | 583 | |
584 | 584 | |
585 | 585 | if(!$this->initialized) { |
@@ -598,11 +598,11 @@ discard block |
||
598 | 598 | * All Rights Reserved. |
599 | 599 | * Contributor(s): ______________________________________. |
600 | 600 | */ |
601 | - function setRecordsPerPage($count) { |
|
601 | + function setRecordsPerPage($count) { |
|
602 | 602 | $this->records_per_page = $count; |
603 | 603 | } |
604 | 604 | /**sets the header title */ |
605 | - function setHeaderTitle($value) { |
|
605 | + function setHeaderTitle($value) { |
|
606 | 606 | $this->header_title = $value; |
607 | 607 | } |
608 | 608 | /**sets the header text this is text that's appended to the header table and is usually used for the creation of buttons |
@@ -610,7 +610,7 @@ discard block |
||
610 | 610 | * All Rights Reserved. |
611 | 611 | * Contributor(s): ______________________________________. |
612 | 612 | */ |
613 | - function setHeaderText($value) { |
|
613 | + function setHeaderText($value) { |
|
614 | 614 | $this->header_text = $value; |
615 | 615 | } |
616 | 616 | /**sets the path for the XTemplate HTML file to be used this is only needed to be set if you are allowing ListView to create the XTemplate |
@@ -618,7 +618,7 @@ discard block |
||
618 | 618 | * All Rights Reserved. |
619 | 619 | * Contributor(s): ______________________________________. |
620 | 620 | */ |
621 | - function setXTemplatePath($value) { |
|
621 | + function setXTemplatePath($value) { |
|
622 | 622 | $this->xTemplatePath= $value; |
623 | 623 | } |
624 | 624 | |
@@ -627,7 +627,7 @@ discard block |
||
627 | 627 | * All Rights Reserved. |
628 | 628 | * Contributor(s): ______________________________________. |
629 | 629 | */ |
630 | - function initNewXTemplate($XTemplatePath, $modString, $imagePath = null) { |
|
630 | + function initNewXTemplate($XTemplatePath, $modString, $imagePath = null) { |
|
631 | 631 | $this->setXTemplatePath($XTemplatePath); |
632 | 632 | if(isset($modString)) |
633 | 633 | $this->setModStrings($modString); |
@@ -728,7 +728,7 @@ discard block |
||
728 | 728 | * All Rights Reserved. |
729 | 729 | * Contributor(s): ______________________________________. |
730 | 730 | */ |
731 | - function setQuery($where, $limit, $orderBy, $varName, $allowOrderByOveride=true) { |
|
731 | + function setQuery($where, $limit, $orderBy, $varName, $allowOrderByOveride=true) { |
|
732 | 732 | $this->query_where = $where; |
733 | 733 | if($this->getSessionVariable("query", "where") != $where) { |
734 | 734 | $this->query_where_has_changed = true; |
@@ -757,7 +757,7 @@ discard block |
||
757 | 757 | * All Rights Reserved. |
758 | 758 | * Contributor(s): ______________________________________. |
759 | 759 | */ |
760 | - function setTheme($theme) { |
|
760 | + function setTheme($theme) { |
|
761 | 761 | $this->local_theme = $theme; |
762 | 762 | if(isset($this->xTemplate))$this->xTemplate->assign("THEME", $this->local_theme); |
763 | 763 | } |
@@ -767,7 +767,7 @@ discard block |
||
767 | 767 | * All Rights Reserved. |
768 | 768 | * Contributor(s): ______________________________________. |
769 | 769 | */ |
770 | - function setAppStrings($app_strings) { |
|
770 | + function setAppStrings($app_strings) { |
|
771 | 771 | unset($this->local_app_strings); |
772 | 772 | $this->local_app_strings = $app_strings; |
773 | 773 | if(isset($this->xTemplate))$this->xTemplate->assign("APP", $this->local_app_strings); |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | * All Rights Reserved. |
779 | 779 | * Contributor(s): ______________________________________. |
780 | 780 | */ |
781 | - function setModStrings($mod_strings) { |
|
781 | + function setModStrings($mod_strings) { |
|
782 | 782 | unset($this->local_module_strings); |
783 | 783 | $this->local_mod_strings = $mod_strings; |
784 | 784 | if(isset($this->xTemplate))$this->xTemplate->assign("MOD", $this->local_mod_strings); |
@@ -789,7 +789,7 @@ discard block |
||
789 | 789 | * All Rights Reserved. |
790 | 790 | * Contributor(s): ______________________________________. |
791 | 791 | */ |
792 | - function setImagePath($image_path) { |
|
792 | + function setImagePath($image_path) { |
|
793 | 793 | $this->local_image_path = $image_path; |
794 | 794 | if(empty($this->local_image_path)) { |
795 | 795 | $this->local_image_path = SugarThemeRegistry::get($this->local_theme)->getImagePath(); |
@@ -802,7 +802,7 @@ discard block |
||
802 | 802 | * All Rights Reserved. |
803 | 803 | * Contributor(s): ______________________________________. |
804 | 804 | */ |
805 | - function setCurrentModule($currentModule) { |
|
805 | + function setCurrentModule($currentModule) { |
|
806 | 806 | unset($this->local_current_module); |
807 | 807 | $this->local_current_module = $currentModule; |
808 | 808 | if(isset($this->xTemplate))$this->xTemplate->assign("MODULE_NAME", $this->local_current_module); |
@@ -813,7 +813,7 @@ discard block |
||
813 | 813 | * All Rights Reserved. |
814 | 814 | * Contributor(s): ______________________________________. |
815 | 815 | */ |
816 | - function createXTemplate() { |
|
816 | + function createXTemplate() { |
|
817 | 817 | if(!isset($this->xTemplate)) { |
818 | 818 | if(isset($this->xTemplatePath)) { |
819 | 819 | |
@@ -834,7 +834,7 @@ discard block |
||
834 | 834 | * All Rights Reserved. |
835 | 835 | * Contributor(s): ______________________________________. |
836 | 836 | */ |
837 | - function setXTemplate($newXTemplate) { |
|
837 | + function setXTemplate($newXTemplate) { |
|
838 | 838 | $this->xTemplate = $newXTemplate; |
839 | 839 | } |
840 | 840 | |
@@ -843,7 +843,7 @@ discard block |
||
843 | 843 | * All Rights Reserved. |
844 | 844 | * Contributor(s): ______________________________________. |
845 | 845 | */ |
846 | - function getXTemplate() { |
|
846 | + function getXTemplate() { |
|
847 | 847 | return $this->xTemplate; |
848 | 848 | } |
849 | 849 | |
@@ -852,7 +852,7 @@ discard block |
||
852 | 852 | * All Rights Reserved. |
853 | 853 | * Contributor(s): ______________________________________. |
854 | 854 | */ |
855 | - function xTemplateAssign($name, $value) { |
|
855 | + function xTemplateAssign($name, $value) { |
|
856 | 856 | |
857 | 857 | if(!isset($this->xTemplate)) { |
858 | 858 | $this->createXTemplate(); |
@@ -866,15 +866,15 @@ discard block |
||
866 | 866 | * All Rights Reserved. |
867 | 867 | * Contributor(s): ______________________________________. |
868 | 868 | */ |
869 | - function getOffset($localVarName) { |
|
870 | - if($this->query_where_has_changed || isset($GLOBALS['record_has_changed'])) { |
|
871 | - $this->setSessionVariable($localVarName,"offset", 0); |
|
872 | - } |
|
873 | - $offset = $this->getSessionVariable($localVarName,"offset"); |
|
874 | - if(isset($offset)) { |
|
875 | - return $offset; |
|
876 | - } |
|
877 | - return 0; |
|
869 | + function getOffset($localVarName) { |
|
870 | + if($this->query_where_has_changed || isset($GLOBALS['record_has_changed'])) { |
|
871 | + $this->setSessionVariable($localVarName,"offset", 0); |
|
872 | + } |
|
873 | + $offset = $this->getSessionVariable($localVarName,"offset"); |
|
874 | + if(isset($offset)) { |
|
875 | + return $offset; |
|
876 | + } |
|
877 | + return 0; |
|
878 | 878 | } |
879 | 879 | |
880 | 880 | /**INTERNAL FUNCTION sets the offset in the session |
@@ -882,7 +882,7 @@ discard block |
||
882 | 882 | * All Rights Reserved. |
883 | 883 | * Contributor(s): ______________________________________. |
884 | 884 | */ |
885 | - function setOffset($localVarName, $value) { |
|
885 | + function setOffset($localVarName, $value) { |
|
886 | 886 | $this->setSessionVariable($localVarName, "offset", $value); |
887 | 887 | } |
888 | 888 | |
@@ -891,7 +891,7 @@ discard block |
||
891 | 891 | * All Rights Reserved. |
892 | 892 | * Contributor(s): ______________________________________. |
893 | 893 | */ |
894 | - function setSessionVariable($localVarName,$varName, $value) { |
|
894 | + function setSessionVariable($localVarName,$varName, $value) { |
|
895 | 895 | $_SESSION[$this->local_current_module."_".$localVarName."_".$varName] = $value; |
896 | 896 | } |
897 | 897 | |
@@ -906,7 +906,7 @@ discard block |
||
906 | 906 | * All Rights Reserved. |
907 | 907 | * Contributor(s): ______________________________________. |
908 | 908 | */ |
909 | - function getSessionVariable($localVarName,$varName) { |
|
909 | + function getSessionVariable($localVarName,$varName) { |
|
910 | 910 | //Set any variables pass in through request first |
911 | 911 | if(isset($_REQUEST[$this->getSessionVariableName($localVarName, $varName)])) { |
912 | 912 | $this->setSessionVariable($localVarName,$varName,$_REQUEST[$this->getSessionVariableName($localVarName, $varName)]); |
@@ -941,10 +941,10 @@ discard block |
||
941 | 941 | function calculateSortOrder($sortOrderList) |
942 | 942 | { |
943 | 943 | $priority_map = array( |
944 | - 'request', |
|
945 | - 'session', |
|
946 | - 'subpaneldefs', |
|
947 | - 'default', |
|
944 | + 'request', |
|
945 | + 'session', |
|
946 | + 'subpaneldefs', |
|
947 | + 'default', |
|
948 | 948 | ); |
949 | 949 | |
950 | 950 | foreach($priority_map as $p) { |
@@ -960,33 +960,31 @@ discard block |
||
960 | 960 | |
961 | 961 | |
962 | 962 | /** |
963 | - |
|
964 | - * @return void |
|
965 | - * @param unknown $localVarName |
|
966 | - * @param unknown $varName |
|
967 | - * @desc INTERNAL FUNCTION returns the session/query variable name |
|
968 | - * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. |
|
969 | - * All Rights Reserved. |
|
970 | - * Contributor(s): ______________________________________.. |
|
971 | - */ |
|
963 | + * @return void |
|
964 | + * @param unknown $localVarName |
|
965 | + * @param unknown $varName |
|
966 | + * @desc INTERNAL FUNCTION returns the session/query variable name |
|
967 | + * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. |
|
968 | + * All Rights Reserved. |
|
969 | + * Contributor(s): ______________________________________.. |
|
970 | + */ |
|
972 | 971 | function getSessionVariableName($localVarName,$varName) { |
973 | 972 | return $this->local_current_module."_".$localVarName."_".$varName; |
974 | 973 | } |
975 | 974 | |
976 | 975 | /** |
977 | - |
|
978 | - * @return void |
|
979 | - * @param unknown $seed |
|
980 | - * @param unknown $xTemplateSection |
|
981 | - * @param unknown $html_varName |
|
982 | - * @desc INTERNAL FUNCTION Handles List Views using seeds that extend SugarBean |
|
976 | + * @return void |
|
977 | + * @param unknown $seed |
|
978 | + * @param unknown $xTemplateSection |
|
979 | + * @param unknown $html_varName |
|
980 | + * @desc INTERNAL FUNCTION Handles List Views using seeds that extend SugarBean |
|
983 | 981 | $XTemplateSection is the section in the XTemplate file that should be parsed usually main |
984 | 982 | $html_VarName is the variable name used in the XTemplateFile e.g. TASK |
985 | 983 | $seed is a seed that extends SugarBean |
986 | - * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.. |
|
987 | - * All Rights Reserved.. |
|
988 | - * Contributor(s): ______________________________________.. |
|
989 | - */ |
|
984 | + * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.. |
|
985 | + * All Rights Reserved.. |
|
986 | + * Contributor(s): ______________________________________.. |
|
987 | + */ |
|
990 | 988 | function processSugarBean($xtemplateSection, $html_varName, $seed) { |
991 | 989 | global $list_view_row_count; |
992 | 990 | |
@@ -1035,15 +1033,15 @@ discard block |
||
1035 | 1033 | |
1036 | 1034 | function processUnionBeans($sugarbean, $subpanel_def, $html_var = 'CELL') { |
1037 | 1035 | |
1038 | - $last_detailview_record = $this->getSessionVariable("detailview", "record"); |
|
1039 | - if(!empty($last_detailview_record) && $last_detailview_record != $sugarbean->id){ |
|
1040 | - $GLOBALS['record_has_changed'] = true; |
|
1041 | - } |
|
1042 | - $this->setSessionVariable("detailview", "record", $sugarbean->id); |
|
1036 | + $last_detailview_record = $this->getSessionVariable("detailview", "record"); |
|
1037 | + if(!empty($last_detailview_record) && $last_detailview_record != $sugarbean->id){ |
|
1038 | + $GLOBALS['record_has_changed'] = true; |
|
1039 | + } |
|
1040 | + $this->setSessionVariable("detailview", "record", $sugarbean->id); |
|
1043 | 1041 | |
1044 | - $current_offset = $this->getOffset($html_var); |
|
1045 | - $module = isset($_REQUEST['module']) ? $_REQUEST['module'] : ''; |
|
1046 | - $response = array(); |
|
1042 | + $current_offset = $this->getOffset($html_var); |
|
1043 | + $module = isset($_REQUEST['module']) ? $_REQUEST['module'] : ''; |
|
1044 | + $response = array(); |
|
1047 | 1045 | |
1048 | 1046 | // choose sort order |
1049 | 1047 | $sort_order = array(); |
@@ -1088,11 +1086,11 @@ discard block |
||
1088 | 1086 | $_SESSION['last_sub' .$this->subpanel_module. '_order'] = $this->sort_order; |
1089 | 1087 | $_SESSION['last_sub' .$this->subpanel_module. '_url'] = $this->getBaseURL($html_var); |
1090 | 1088 | |
1091 | - // Bug 8139 - Correct Subpanel sorting on 'name', when subpanel sorting default is 'last_name, first_name' |
|
1092 | - if (($this->sortby == 'name' || $this->sortby == 'last_name') && |
|
1093 | - str_replace(' ', '', trim($subpanel_def->_instance_properties['sort_by'])) == 'last_name,first_name') { |
|
1094 | - $this->sortby = 'last_name '.$this->sort_order.', first_name '; |
|
1095 | - } |
|
1089 | + // Bug 8139 - Correct Subpanel sorting on 'name', when subpanel sorting default is 'last_name, first_name' |
|
1090 | + if (($this->sortby == 'name' || $this->sortby == 'last_name') && |
|
1091 | + str_replace(' ', '', trim($subpanel_def->_instance_properties['sort_by'])) == 'last_name,first_name') { |
|
1092 | + $this->sortby = 'last_name '.$this->sort_order.', first_name '; |
|
1093 | + } |
|
1096 | 1094 | |
1097 | 1095 | if(!empty($this->response)){ |
1098 | 1096 | $response =& $this->response; |
@@ -1168,15 +1166,15 @@ discard block |
||
1168 | 1166 | return $baseurl; |
1169 | 1167 | } |
1170 | 1168 | /** |
1171 | - * @return void |
|
1172 | - * @param unknown $data |
|
1173 | - * @param unknown $xTemplateSection |
|
1174 | - * @param unknown $html_varName |
|
1175 | - * @desc INTERNAL FUNCTION process the List Navigation |
|
1176 | - * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. |
|
1177 | - * All Rights Reserved. |
|
1178 | - * Contributor(s): ______________________________________.. |
|
1179 | - */ |
|
1169 | + * @return void |
|
1170 | + * @param unknown $data |
|
1171 | + * @param unknown $xTemplateSection |
|
1172 | + * @param unknown $html_varName |
|
1173 | + * @desc INTERNAL FUNCTION process the List Navigation |
|
1174 | + * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. |
|
1175 | + * All Rights Reserved. |
|
1176 | + * Contributor(s): ______________________________________.. |
|
1177 | + */ |
|
1180 | 1178 | function processListNavigation($xtemplateSection, $html_varName, $current_offset, $next_offset, $previous_offset, $row_count, $sugarbean=null, $subpanel_def=null, $col_count = 20) { |
1181 | 1179 | |
1182 | 1180 | global $export_module; |
@@ -1316,8 +1314,8 @@ discard block |
||
1316 | 1314 | $end_record = $end_record-1; |
1317 | 1315 | |
1318 | 1316 | $script_href = "<a style=\'width: 150px\' name=\"thispage\" class=\'menuItem\' onmouseover=\'hiliteItem(this,\"yes\");\' onmouseout=\'unhiliteItem(this);\' onclick=\'if (document.MassUpdate.select_entire_list.value==1){document.MassUpdate.select_entire_list.value=0;sListView.check_all(document.MassUpdate, \"mass[]\", true, $this->records_per_page)}else {sListView.check_all(document.MassUpdate, \"mass[]\", true)};\' href=\'#\'>{$this->local_app_strings['LBL_LISTVIEW_OPTION_CURRENT']} ({$this->records_per_page})‎</a>" |
1319 | - . "<a style=\'width: 150px\' name=\"selectall\" class=\'menuItem\' onmouseover=\'hiliteItem(this,\"yes\");\' onmouseout=\'unhiliteItem(this);\' onclick=\'sListView.check_entire_list(document.MassUpdate, \"mass[]\",true,{$row_count});\' href=\'#\'>{$this->local_app_strings['LBL_LISTVIEW_OPTION_ENTIRE']} ({$row_count})‎</a>" |
|
1320 | - . "<a style=\'width: 150px\' name=\"deselect\" class=\'menuItem\' onmouseover=\'hiliteItem(this,\"yes\");\' onmouseout=\'unhiliteItem(this);\' onclick=\'sListView.clear_all(document.MassUpdate, \"mass[]\", false);\' href=\'#\'>{$this->local_app_strings['LBL_LISTVIEW_NONE']}</a>"; |
|
1317 | + . "<a style=\'width: 150px\' name=\"selectall\" class=\'menuItem\' onmouseover=\'hiliteItem(this,\"yes\");\' onmouseout=\'unhiliteItem(this);\' onclick=\'sListView.check_entire_list(document.MassUpdate, \"mass[]\",true,{$row_count});\' href=\'#\'>{$this->local_app_strings['LBL_LISTVIEW_OPTION_ENTIRE']} ({$row_count})‎</a>" |
|
1318 | + . "<a style=\'width: 150px\' name=\"deselect\" class=\'menuItem\' onmouseover=\'hiliteItem(this,\"yes\");\' onmouseout=\'unhiliteItem(this);\' onclick=\'sListView.clear_all(document.MassUpdate, \"mass[]\", false);\' href=\'#\'>{$this->local_app_strings['LBL_LISTVIEW_NONE']}</a>"; |
|
1321 | 1319 | |
1322 | 1320 | $close_inline_img = SugarThemeRegistry::current()->getImage('close_inline', 'border=0', null, null, ".gif", $app_strings['LBL_CLOSEINLINE']); |
1323 | 1321 | |
@@ -1548,15 +1546,15 @@ discard block |
||
1548 | 1546 | |
1549 | 1547 | |
1550 | 1548 | /** |
1551 | - * @return void |
|
1552 | - * @param unknown $data |
|
1553 | - * @param unknown $xTemplateSection |
|
1554 | - * @param unknown $html_varName |
|
1555 | - * @desc INTERNAL FUNCTION handles the rows |
|
1556 | - * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. |
|
1557 | - * All Rights Reserved. |
|
1558 | - * Contributor(s): ______________________________________.. |
|
1559 | - */ |
|
1549 | + * @return void |
|
1550 | + * @param unknown $data |
|
1551 | + * @param unknown $xTemplateSection |
|
1552 | + * @param unknown $html_varName |
|
1553 | + * @desc INTERNAL FUNCTION handles the rows |
|
1554 | + * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. |
|
1555 | + * All Rights Reserved. |
|
1556 | + * Contributor(s): ______________________________________.. |
|
1557 | + */ |
|
1560 | 1558 | function processListRows($data, $xtemplateSection, $html_varName) |
1561 | 1559 | { |
1562 | 1560 | global $odd_bg; |
@@ -1753,7 +1751,7 @@ discard block |
||
1753 | 1751 | { |
1754 | 1752 | $orderBy= 'amount'; |
1755 | 1753 | } |
1756 | - $buttons = false; |
|
1754 | + $buttons = false; |
|
1757 | 1755 | $col_count = 0; |
1758 | 1756 | foreach($subpanel_def->get_list_fields() as $column_name=>$widget_args) |
1759 | 1757 | { |
@@ -1771,17 +1769,17 @@ discard block |
||
1771 | 1769 | } |
1772 | 1770 | |
1773 | 1771 | if (!preg_match("/_button/i", $column_name)) { |
1774 | - $widget_args['name']=$column_name; |
|
1775 | - $widget_args['sort'] = $imgArrow; |
|
1776 | - $widget_args['start_link_wrapper'] = $this->start_link_wrapper; |
|
1777 | - $widget_args['end_link_wrapper'] = $this->end_link_wrapper; |
|
1778 | - $widget_args['subpanel_module'] = $this->subpanel_module; |
|
1779 | - |
|
1780 | - $widget_contents = $layout_manager->widgetDisplay($widget_args); |
|
1781 | - $cell_width = empty($widget_args['width']) ? '' : $widget_args['width']; |
|
1782 | - $this->xTemplate->assign('HEADER_CELL', $widget_contents); |
|
1783 | - static $count; |
|
1784 | - if(!isset($count))$count = 0; else $count++; |
|
1772 | + $widget_args['name']=$column_name; |
|
1773 | + $widget_args['sort'] = $imgArrow; |
|
1774 | + $widget_args['start_link_wrapper'] = $this->start_link_wrapper; |
|
1775 | + $widget_args['end_link_wrapper'] = $this->end_link_wrapper; |
|
1776 | + $widget_args['subpanel_module'] = $this->subpanel_module; |
|
1777 | + |
|
1778 | + $widget_contents = $layout_manager->widgetDisplay($widget_args); |
|
1779 | + $cell_width = empty($widget_args['width']) ? '' : $widget_args['width']; |
|
1780 | + $this->xTemplate->assign('HEADER_CELL', $widget_contents); |
|
1781 | + static $count; |
|
1782 | + if(!isset($count))$count = 0; else $count++; |
|
1785 | 1783 | if($col_count == 0 || $column_name == 'name') $footable = 'data-toggle="true"'; |
1786 | 1784 | else { |
1787 | 1785 | $footable = 'data-hide="phone"'; |
@@ -1789,11 +1787,11 @@ discard block |
||
1789 | 1787 | if ($col_count > 4) $footable = 'data-hide="phone,phonelandscape,tablet"'; |
1790 | 1788 | } |
1791 | 1789 | $this->xTemplate->assign('FOOTABLE', $footable); |
1792 | - $this->xTemplate->assign('CELL_COUNT', $count); |
|
1793 | - $this->xTemplate->assign('CELL_WIDTH', $cell_width); |
|
1794 | - $this->xTemplate->parse('dyn_list_view.header_cell'); |
|
1790 | + $this->xTemplate->assign('CELL_COUNT', $count); |
|
1791 | + $this->xTemplate->assign('CELL_WIDTH', $cell_width); |
|
1792 | + $this->xTemplate->parse('dyn_list_view.header_cell'); |
|
1795 | 1793 | } else { |
1796 | - $buttons = true; |
|
1794 | + $buttons = true; |
|
1797 | 1795 | } |
1798 | 1796 | } |
1799 | 1797 | ++$col_count; |
@@ -1801,29 +1799,29 @@ discard block |
||
1801 | 1799 | |
1802 | 1800 | if($buttons) { |
1803 | 1801 | $this->xTemplate->assign('FOOTABLE', ''); |
1804 | - $this->xTemplate->assign('HEADER_CELL', " "); |
|
1805 | - $this->xTemplate->assign('CELL_COUNT', $count); |
|
1806 | - $this->xTemplate->assign('CELL_WIDTH', $cell_width); |
|
1807 | - $this->xTemplate->parse('dyn_list_view.header_cell'); |
|
1802 | + $this->xTemplate->assign('HEADER_CELL', " "); |
|
1803 | + $this->xTemplate->assign('CELL_COUNT', $count); |
|
1804 | + $this->xTemplate->assign('CELL_WIDTH', $cell_width); |
|
1805 | + $this->xTemplate->parse('dyn_list_view.header_cell'); |
|
1808 | 1806 | } |
1809 | 1807 | |
1810 | 1808 | } |
1811 | 1809 | |
1812 | 1810 | |
1813 | 1811 | /** |
1814 | - * @return void |
|
1815 | - * @param unknown $seed |
|
1816 | - * @param unknown $xTemplateSection |
|
1817 | - * @param unknown $html_varName |
|
1818 | - * @desc PUBLIC FUNCTION Handles List Views using seeds that extend SugarBean |
|
1812 | + * @return void |
|
1813 | + * @param unknown $seed |
|
1814 | + * @param unknown $xTemplateSection |
|
1815 | + * @param unknown $html_varName |
|
1816 | + * @desc PUBLIC FUNCTION Handles List Views using seeds that extend SugarBean |
|
1819 | 1817 | $XTemplateSection is the section in the XTemplate file that should be parsed usually main |
1820 | 1818 | $html_VarName is the variable name used in the XTemplateFile e.g. TASK |
1821 | 1819 | $seed is a seed there are two types of seeds one is a subclass of SugarBean, the other is a list usually created from a sugar bean using get_list |
1822 | 1820 | if no XTemplate is set it will create a new XTemplate |
1823 | - * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.. |
|
1824 | - * All Rights Reserved.. |
|
1825 | - * Contributor(s): ______________________________________.. |
|
1826 | - */ |
|
1821 | + * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.. |
|
1822 | + * All Rights Reserved.. |
|
1823 | + * Contributor(s): ______________________________________.. |
|
1824 | + */ |
|
1827 | 1825 | |
1828 | 1826 | function processListViewTwo($seed, $xTemplateSection, $html_varName) { |
1829 | 1827 | global $current_user; |
@@ -1898,12 +1896,12 @@ discard block |
||
1898 | 1896 | return " <img border='0' src='".SugarThemeRegistry::current()->getImageURL("arrow{$upDown}.{$ext}")."' "; |
1899 | 1897 | } |
1900 | 1898 | |
1901 | - function getArrowEnd() { |
|
1902 | - $imgFileParts = pathinfo(SugarThemeRegistry::current()->getImageURL("arrow.gif")); |
|
1899 | + function getArrowEnd() { |
|
1900 | + $imgFileParts = pathinfo(SugarThemeRegistry::current()->getImageURL("arrow.gif")); |
|
1903 | 1901 | |
1904 | 1902 | list($width,$height) = ListView::getArrowImageSize(); |
1905 | 1903 | |
1906 | - return '.'.$imgFileParts['extension']."' width='$width' height='$height' align='absmiddle' alt=".translate('LBL_SORT').">"; |
|
1904 | + return '.'.$imgFileParts['extension']."' width='$width' height='$height' align='absmiddle' alt=".translate('LBL_SORT').">"; |
|
1907 | 1905 | } |
1908 | 1906 | |
1909 | 1907 | function getArrowUpDownEnd($upDown) { |
@@ -1924,9 +1922,9 @@ discard block |
||
1924 | 1922 | return " width='$width' height='$height' align='absmiddle' alt='$sortStr'>"; |
1925 | 1923 | } |
1926 | 1924 | |
1927 | - function getArrowImageSize() { |
|
1928 | - // jbasicChartDashletsExpColust get the non-sort image's size.. the up and down have be the same. |
|
1929 | - $image = SugarThemeRegistry::current()->getImageURL("arrow.gif",false); |
|
1925 | + function getArrowImageSize() { |
|
1926 | + // jbasicChartDashletsExpColust get the non-sort image's size.. the up and down have be the same. |
|
1927 | + $image = SugarThemeRegistry::current()->getImageURL("arrow.gif",false); |
|
1930 | 1928 | |
1931 | 1929 | $cache_key = 'arrow_size.'.$image; |
1932 | 1930 | |
@@ -1958,13 +1956,13 @@ discard block |
||
1958 | 1956 | return $result; |
1959 | 1957 | } |
1960 | 1958 | |
1961 | - function getOrderByInfo($html_varName) |
|
1962 | - { |
|
1963 | - $orderBy = $this->getSessionVariable($html_varName, "OBL"); |
|
1964 | - $desc = $this->getSessionVariable($html_varName, $orderBy.'S'); |
|
1965 | - $orderBy = str_replace('.', '_', $orderBy); |
|
1966 | - return array($orderBy,$desc); |
|
1967 | - } |
|
1959 | + function getOrderByInfo($html_varName) |
|
1960 | + { |
|
1961 | + $orderBy = $this->getSessionVariable($html_varName, "OBL"); |
|
1962 | + $desc = $this->getSessionVariable($html_varName, $orderBy.'S'); |
|
1963 | + $orderBy = str_replace('.', '_', $orderBy); |
|
1964 | + return array($orderBy,$desc); |
|
1965 | + } |
|
1968 | 1966 | |
1969 | 1967 | function processSortArrows($html_varName) |
1970 | 1968 | { |
@@ -1973,25 +1971,25 @@ discard block |
||
1973 | 1971 | |
1974 | 1972 | list($orderBy,$desc) = $this->getOrderByInfo($html_varName); |
1975 | 1973 | |
1976 | - $imgArrow = "_up"; |
|
1977 | - if($desc) { |
|
1978 | - $imgArrow = "_down"; |
|
1979 | - } |
|
1980 | - /** |
|
1981 | - * @deprecated only used by legacy opportunites listview, nothing current. Leaving for BC |
|
1982 | - */ |
|
1983 | - if($orderBy == 'amount') |
|
1984 | - { |
|
1985 | - $this->xTemplateAssign('amount_arrow', $imgArrow); |
|
1986 | - } |
|
1987 | - else if($orderBy == 'amount_usdollar') |
|
1988 | - { |
|
1989 | - $this->xTemplateAssign('amount_usdollar_arrow', $imgArrow); |
|
1990 | - } |
|
1991 | - else |
|
1992 | - { |
|
1993 | - $this->xTemplateAssign($orderBy.'_arrow', $imgArrow); |
|
1994 | - } |
|
1974 | + $imgArrow = "_up"; |
|
1975 | + if($desc) { |
|
1976 | + $imgArrow = "_down"; |
|
1977 | + } |
|
1978 | + /** |
|
1979 | + * @deprecated only used by legacy opportunites listview, nothing current. Leaving for BC |
|
1980 | + */ |
|
1981 | + if($orderBy == 'amount') |
|
1982 | + { |
|
1983 | + $this->xTemplateAssign('amount_arrow', $imgArrow); |
|
1984 | + } |
|
1985 | + else if($orderBy == 'amount_usdollar') |
|
1986 | + { |
|
1987 | + $this->xTemplateAssign('amount_usdollar_arrow', $imgArrow); |
|
1988 | + } |
|
1989 | + else |
|
1990 | + { |
|
1991 | + $this->xTemplateAssign($orderBy.'_arrow', $imgArrow); |
|
1992 | + } |
|
1995 | 1993 | |
1996 | 1994 | $this->xTemplateAssign('arrow_end', $this->getArrowEnd()); |
1997 | 1995 | } |
@@ -2030,37 +2028,37 @@ discard block |
||
2030 | 2028 | return sugar_microtime(); |
2031 | 2029 | } |
2032 | 2030 | |
2033 | - /**INTERNAL FUNCTION sets a session variable keeping it local to the listview |
|
2031 | + /**INTERNAL FUNCTION sets a session variable keeping it local to the listview |
|
2034 | 2032 | not the current_module |
2035 | 2033 | * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. |
2036 | 2034 | * All Rights Reserved. |
2037 | 2035 | * Contributor(s): ______________________________________. |
2038 | 2036 | */ |
2039 | - function setLocalSessionVariable($localVarName,$varName, $value) { |
|
2037 | + function setLocalSessionVariable($localVarName,$varName, $value) { |
|
2040 | 2038 | $_SESSION[$localVarName."_".$varName] = $value; |
2041 | - } |
|
2039 | + } |
|
2042 | 2040 | |
2043 | - /**INTERNAL FUNCTION returns a session variable that is local to the listview, |
|
2041 | + /**INTERNAL FUNCTION returns a session variable that is local to the listview, |
|
2044 | 2042 | not the current_module |
2045 | 2043 | * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. |
2046 | 2044 | * All Rights Reserved. |
2047 | 2045 | * Contributor(s): ______________________________________. |
2048 | 2046 | */ |
2049 | - function getLocalSessionVariable($localVarName,$varName) { |
|
2047 | + function getLocalSessionVariable($localVarName,$varName) { |
|
2050 | 2048 | if(isset($_SESSION[$localVarName."_".$varName])) { |
2051 | 2049 | return $_SESSION[$localVarName."_".$varName]; |
2052 | 2050 | } |
2053 | 2051 | else{ |
2054 | 2052 | return ""; |
2055 | 2053 | } |
2056 | - } |
|
2054 | + } |
|
2057 | 2055 | |
2058 | - /* Set to true if you want Additional Details to appear in the listview |
|
2056 | + /* Set to true if you want Additional Details to appear in the listview |
|
2059 | 2057 | */ |
2060 | - function setAdditionalDetails($value = true, $function = '') { |
|
2058 | + function setAdditionalDetails($value = true, $function = '') { |
|
2061 | 2059 | if(!empty($function)) $this->additionalDetailsFunction = $function; |
2062 | 2060 | $this->_additionalDetails = $value; |
2063 | - } |
|
2061 | + } |
|
2064 | 2062 | |
2065 | 2063 | } |
2066 | 2064 | ?> |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | */ |
47 | 47 | class ListViewData { |
48 | 48 | |
49 | - var $additionalDetails = true; |
|
49 | + var $additionalDetails = true; |
|
50 | 50 | var $listviewName = null; |
51 | - var $additionalDetailsAllow = null; |
|
51 | + var $additionalDetailsAllow = null; |
|
52 | 52 | var $additionalDetailsAjax = true; // leave this true when using filter fields |
53 | 53 | var $additionalDetailsFieldToAdd = 'NAME'; // where the span will be attached to |
54 | 54 | var $base_url = null; |
@@ -58,82 +58,82 @@ discard block |
||
58 | 58 | */ |
59 | 59 | var $count_query = ''; |
60 | 60 | |
61 | - /** |
|
62 | - * Constructor sets the limitName to look up the limit in $sugar_config |
|
63 | - * |
|
64 | - * @return ListViewData |
|
65 | - */ |
|
66 | - function ListViewData() { |
|
67 | - $this->limitName = 'list_max_entries_per_page'; |
|
68 | - $this->db = DBManagerFactory::getInstance('listviews'); |
|
69 | - } |
|
70 | - |
|
71 | - /** |
|
72 | - * checks the request for the order by and if that is not set then it checks the session for it |
|
73 | - * |
|
74 | - * @return array containing the keys orderBy => field being ordered off of and sortOrder => the sort order of that field |
|
75 | - */ |
|
76 | - function getOrderBy($orderBy = '', $direction = '') { |
|
77 | - if (!empty($orderBy) || !empty($_REQUEST[$this->var_order_by])) { |
|
61 | + /** |
|
62 | + * Constructor sets the limitName to look up the limit in $sugar_config |
|
63 | + * |
|
64 | + * @return ListViewData |
|
65 | + */ |
|
66 | + function ListViewData() { |
|
67 | + $this->limitName = 'list_max_entries_per_page'; |
|
68 | + $this->db = DBManagerFactory::getInstance('listviews'); |
|
69 | + } |
|
70 | + |
|
71 | + /** |
|
72 | + * checks the request for the order by and if that is not set then it checks the session for it |
|
73 | + * |
|
74 | + * @return array containing the keys orderBy => field being ordered off of and sortOrder => the sort order of that field |
|
75 | + */ |
|
76 | + function getOrderBy($orderBy = '', $direction = '') { |
|
77 | + if (!empty($orderBy) || !empty($_REQUEST[$this->var_order_by])) { |
|
78 | 78 | if(!empty($_REQUEST[$this->var_order_by])) { |
79 | - $direction = 'ASC'; |
|
80 | - $orderBy = $_REQUEST[$this->var_order_by]; |
|
81 | - if(!empty($_REQUEST['lvso']) && (empty($_SESSION['lvd']['last_ob']) || strcmp($orderBy, $_SESSION['lvd']['last_ob']) == 0) ){ |
|
82 | - $direction = $_REQUEST['lvso']; |
|
83 | - } |
|
79 | + $direction = 'ASC'; |
|
80 | + $orderBy = $_REQUEST[$this->var_order_by]; |
|
81 | + if(!empty($_REQUEST['lvso']) && (empty($_SESSION['lvd']['last_ob']) || strcmp($orderBy, $_SESSION['lvd']['last_ob']) == 0) ){ |
|
82 | + $direction = $_REQUEST['lvso']; |
|
83 | + } |
|
84 | 84 | } |
85 | 85 | $_SESSION[$this->var_order_by] = array('orderBy'=>$orderBy, 'direction'=> $direction); |
86 | 86 | $_SESSION['lvd']['last_ob'] = $orderBy; |
87 | 87 | } |
88 | - else { |
|
88 | + else { |
|
89 | 89 | $userPreferenceOrder = $GLOBALS['current_user']->getPreference('listviewOrder', $this->var_name); |
90 | - if(!empty($_SESSION[$this->var_order_by])) { |
|
91 | - $orderBy = $_SESSION[$this->var_order_by]['orderBy']; |
|
92 | - $direction = $_SESSION[$this->var_order_by]['direction']; |
|
90 | + if(!empty($_SESSION[$this->var_order_by])) { |
|
91 | + $orderBy = $_SESSION[$this->var_order_by]['orderBy']; |
|
92 | + $direction = $_SESSION[$this->var_order_by]['direction']; |
|
93 | 93 | } elseif (!empty($userPreferenceOrder)) { |
94 | 94 | $orderBy = $userPreferenceOrder['orderBy']; |
95 | 95 | $direction = $userPreferenceOrder['sortOrder']; |
96 | 96 | } else { |
97 | - $orderBy = 'date_entered'; |
|
98 | - $direction = 'DESC'; |
|
99 | - } |
|
100 | - } |
|
101 | - if(!empty($direction)) { |
|
102 | - if(strtolower($direction) == "desc") { |
|
103 | - $direction = 'DESC'; |
|
104 | - } else { |
|
105 | - $direction = 'ASC'; |
|
106 | - } |
|
107 | - } |
|
108 | - return array('orderBy' => $orderBy, 'sortOrder' => $direction); |
|
109 | - } |
|
110 | - |
|
111 | - /** |
|
112 | - * gets the reverse of the sort order for use on links to reverse a sort order from what is currently used |
|
113 | - * |
|
114 | - * @param STRING (ASC or DESC) $current_order |
|
115 | - * @return STRING (ASC or DESC) |
|
116 | - */ |
|
117 | - function getReverseSortOrder($current_order){ |
|
118 | - return (strcmp(strtolower($current_order), 'asc') == 0)?'DESC':'ASC'; |
|
119 | - } |
|
120 | - /** |
|
121 | - * gets the limit of how many rows to show per page |
|
122 | - * |
|
123 | - * @return INT (the limit) |
|
124 | - */ |
|
125 | - function getLimit() { |
|
126 | - return $GLOBALS['sugar_config'][$this->limitName]; |
|
127 | - } |
|
128 | - |
|
129 | - /** |
|
130 | - * returns the current offset |
|
131 | - * |
|
132 | - * @return INT (current offset) |
|
133 | - */ |
|
134 | - function getOffset() { |
|
135 | - return (!empty($_REQUEST[$this->var_offset])) ? $_REQUEST[$this->var_offset] : 0; |
|
136 | - } |
|
97 | + $orderBy = 'date_entered'; |
|
98 | + $direction = 'DESC'; |
|
99 | + } |
|
100 | + } |
|
101 | + if(!empty($direction)) { |
|
102 | + if(strtolower($direction) == "desc") { |
|
103 | + $direction = 'DESC'; |
|
104 | + } else { |
|
105 | + $direction = 'ASC'; |
|
106 | + } |
|
107 | + } |
|
108 | + return array('orderBy' => $orderBy, 'sortOrder' => $direction); |
|
109 | + } |
|
110 | + |
|
111 | + /** |
|
112 | + * gets the reverse of the sort order for use on links to reverse a sort order from what is currently used |
|
113 | + * |
|
114 | + * @param STRING (ASC or DESC) $current_order |
|
115 | + * @return STRING (ASC or DESC) |
|
116 | + */ |
|
117 | + function getReverseSortOrder($current_order){ |
|
118 | + return (strcmp(strtolower($current_order), 'asc') == 0)?'DESC':'ASC'; |
|
119 | + } |
|
120 | + /** |
|
121 | + * gets the limit of how many rows to show per page |
|
122 | + * |
|
123 | + * @return INT (the limit) |
|
124 | + */ |
|
125 | + function getLimit() { |
|
126 | + return $GLOBALS['sugar_config'][$this->limitName]; |
|
127 | + } |
|
128 | + |
|
129 | + /** |
|
130 | + * returns the current offset |
|
131 | + * |
|
132 | + * @return INT (current offset) |
|
133 | + */ |
|
134 | + function getOffset() { |
|
135 | + return (!empty($_REQUEST[$this->var_offset])) ? $_REQUEST[$this->var_offset] : 0; |
|
136 | + } |
|
137 | 137 | |
138 | 138 | /** |
139 | 139 | * generates the base url without |
@@ -159,18 +159,18 @@ discard block |
||
159 | 159 | return $params; |
160 | 160 | } |
161 | 161 | |
162 | - /** |
|
163 | - * based off of a base name it sets base, offset, and order by variable names to retrieve them from requests and sessions |
|
164 | - * |
|
165 | - * @param unknown_type $baseName |
|
166 | - */ |
|
167 | - function setVariableName($baseName, $where, $listviewName = null){ |
|
162 | + /** |
|
163 | + * based off of a base name it sets base, offset, and order by variable names to retrieve them from requests and sessions |
|
164 | + * |
|
165 | + * @param unknown_type $baseName |
|
166 | + */ |
|
167 | + function setVariableName($baseName, $where, $listviewName = null){ |
|
168 | 168 | global $timedate; |
169 | 169 | $module = (!empty($listviewName)) ? $listviewName: $_REQUEST['module']; |
170 | 170 | $this->var_name = $module .'2_'. strtoupper($baseName); |
171 | 171 | |
172 | - $this->var_order_by = $this->var_name .'_ORDER_BY'; |
|
173 | - $this->var_offset = $this->var_name . '_offset'; |
|
172 | + $this->var_order_by = $this->var_name .'_ORDER_BY'; |
|
173 | + $this->var_offset = $this->var_name . '_offset'; |
|
174 | 174 | $timestamp = sugar_microtime(); |
175 | 175 | $this->stamp = $timestamp; |
176 | 176 | |
@@ -178,58 +178,58 @@ discard block |
||
178 | 178 | |
179 | 179 | $_SESSION[strtoupper($baseName) . "_FROM_LIST_VIEW"] = $timestamp; |
180 | 180 | $_SESSION[strtoupper($baseName) . "_DETAIL_NAV_HISTORY"] = false; |
181 | - } |
|
182 | - |
|
183 | - function getTotalCount($main_query){ |
|
184 | - if(!empty($this->count_query)){ |
|
185 | - $count_query = $this->count_query; |
|
186 | - }else{ |
|
187 | - $count_query = $this->seed->create_list_count_query($main_query); |
|
188 | - } |
|
189 | - $result = $this->db->query($count_query); |
|
190 | - if($row = $this->db->fetchByAssoc($result)){ |
|
191 | - return $row['c']; |
|
192 | - } |
|
193 | - return 0; |
|
194 | - } |
|
195 | - |
|
196 | - /** |
|
197 | - * takes in a seed and creates the list view query based off of that seed |
|
198 | - * if the $limit value is set to -1 then it will use the default limit and offset values |
|
199 | - * |
|
200 | - * it will return an array with two key values |
|
201 | - * 1. 'data'=> this is an array of row data |
|
202 | - * 2. 'pageData'=> this is an array containg three values |
|
203 | - * a.'ordering'=> array('orderBy'=> the field being ordered by , 'sortOrder'=> 'ASC' or 'DESC') |
|
204 | - * b.'urls'=>array('baseURL'=>url used to generate other urls , |
|
205 | - * 'orderBy'=> the base url for order by |
|
206 | - * //the following may not be set (so check empty to see if they are set) |
|
207 | - * 'nextPage'=> the url for the next group of results, |
|
208 | - * 'prevPage'=> the url for the prev group of results, |
|
209 | - * 'startPage'=> the url for the start of the group, |
|
210 | - * 'endPage'=> the url for the last set of results in the group |
|
211 | - * c.'offsets'=>array( |
|
212 | - * 'current'=>current offset |
|
213 | - * 'next'=> next group offset |
|
214 | - * 'prev'=> prev group offset |
|
215 | - * 'end'=> the offset of the last group |
|
216 | - * '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 ) |
|
217 | - * 'totalCounted'=> if a count query was used to get the total count |
|
218 | - * |
|
219 | - * @param SugarBean $seed |
|
220 | - * @param string $where |
|
221 | - * @param int:0 $offset |
|
222 | - * @param int:-1 $limit |
|
223 | - * @param string[]:array() $filter_fields |
|
224 | - * @param array:array() $params |
|
225 | - * Potential $params are |
|
181 | + } |
|
182 | + |
|
183 | + function getTotalCount($main_query){ |
|
184 | + if(!empty($this->count_query)){ |
|
185 | + $count_query = $this->count_query; |
|
186 | + }else{ |
|
187 | + $count_query = $this->seed->create_list_count_query($main_query); |
|
188 | + } |
|
189 | + $result = $this->db->query($count_query); |
|
190 | + if($row = $this->db->fetchByAssoc($result)){ |
|
191 | + return $row['c']; |
|
192 | + } |
|
193 | + return 0; |
|
194 | + } |
|
195 | + |
|
196 | + /** |
|
197 | + * takes in a seed and creates the list view query based off of that seed |
|
198 | + * if the $limit value is set to -1 then it will use the default limit and offset values |
|
199 | + * |
|
200 | + * it will return an array with two key values |
|
201 | + * 1. 'data'=> this is an array of row data |
|
202 | + * 2. 'pageData'=> this is an array containg three values |
|
203 | + * a.'ordering'=> array('orderBy'=> the field being ordered by , 'sortOrder'=> 'ASC' or 'DESC') |
|
204 | + * b.'urls'=>array('baseURL'=>url used to generate other urls , |
|
205 | + * 'orderBy'=> the base url for order by |
|
206 | + * //the following may not be set (so check empty to see if they are set) |
|
207 | + * 'nextPage'=> the url for the next group of results, |
|
208 | + * 'prevPage'=> the url for the prev group of results, |
|
209 | + * 'startPage'=> the url for the start of the group, |
|
210 | + * 'endPage'=> the url for the last set of results in the group |
|
211 | + * c.'offsets'=>array( |
|
212 | + * 'current'=>current offset |
|
213 | + * 'next'=> next group offset |
|
214 | + * 'prev'=> prev group offset |
|
215 | + * 'end'=> the offset of the last group |
|
216 | + * '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 ) |
|
217 | + * 'totalCounted'=> if a count query was used to get the total count |
|
218 | + * |
|
219 | + * @param SugarBean $seed |
|
220 | + * @param string $where |
|
221 | + * @param int:0 $offset |
|
222 | + * @param int:-1 $limit |
|
223 | + * @param string[]:array() $filter_fields |
|
224 | + * @param array:array() $params |
|
225 | + * Potential $params are |
|
226 | 226 | $params['distinct'] = use distinct key word |
227 | 227 | $params['include_custom_fields'] = (on by default) |
228 | 228 | $params['custom_XXXX'] = append custom statements to query |
229 | - * @param string:'id' $id_field |
|
230 | - * @return array('data'=> row data, 'pageData' => page data information, 'query' => original query string) |
|
231 | - */ |
|
232 | - function getListViewData($seed, $where, $offset=-1, $limit = -1, $filter_fields=array(),$params=array(),$id_field = 'id',$singleSelect=true) { |
|
229 | + * @param string:'id' $id_field |
|
230 | + * @return array('data'=> row data, 'pageData' => page data information, 'query' => original query string) |
|
231 | + */ |
|
232 | + function getListViewData($seed, $where, $offset=-1, $limit = -1, $filter_fields=array(),$params=array(),$id_field = 'id',$singleSelect=true) { |
|
233 | 233 | global $current_user; |
234 | 234 | SugarVCR::erase($seed->module_dir); |
235 | 235 | $this->seed =& $seed; |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | |
242 | 242 | $this->setVariableName($seed->object_name, $where, $this->listviewName); |
243 | 243 | |
244 | - $this->seed->id = '[SELECT_ID_LIST]'; |
|
244 | + $this->seed->id = '[SELECT_ID_LIST]'; |
|
245 | 245 | |
246 | 246 | // if $params tell us to override all ordering |
247 | 247 | if(!empty($params['overrideOrder']) && !empty($params['orderBy'])) { |
@@ -265,11 +265,11 @@ discard block |
||
265 | 265 | $orderby = substr($order['orderBy'],strpos($order['orderBy'],'.')+1); |
266 | 266 | } |
267 | 267 | if ($orderby != 'date_entered' && !in_array($orderby, array_keys($filter_fields))) { |
268 | - $order['orderBy'] = ''; |
|
269 | - $order['sortOrder'] = ''; |
|
268 | + $order['orderBy'] = ''; |
|
269 | + $order['sortOrder'] = ''; |
|
270 | 270 | } |
271 | 271 | |
272 | - if (empty($order['orderBy'])) { |
|
272 | + if (empty($order['orderBy'])) { |
|
273 | 273 | $orderBy = ''; |
274 | 274 | } else { |
275 | 275 | $orderBy = $order['orderBy'] . ' ' . $order['sortOrder']; |
@@ -282,40 +282,40 @@ discard block |
||
282 | 282 | $current_user->setPreference('listviewOrder', $order, 0, $this->var_name); // save preference |
283 | 283 | } |
284 | 284 | |
285 | - // If $params tells us to override for the special last_name, first_name sorting |
|
286 | - if (!empty($params['overrideLastNameOrder']) && $order['orderBy'] == 'last_name') { |
|
287 | - $orderBy = 'last_name '.$order['sortOrder'].', first_name '.$order['sortOrder']; |
|
288 | - } |
|
285 | + // If $params tells us to override for the special last_name, first_name sorting |
|
286 | + if (!empty($params['overrideLastNameOrder']) && $order['orderBy'] == 'last_name') { |
|
287 | + $orderBy = 'last_name '.$order['sortOrder'].', first_name '.$order['sortOrder']; |
|
288 | + } |
|
289 | 289 | |
290 | - $ret_array = $seed->create_new_list_query($orderBy, $where, $filter_fields, $params, 0, '', true, $seed, $singleSelect); |
|
290 | + $ret_array = $seed->create_new_list_query($orderBy, $where, $filter_fields, $params, 0, '', true, $seed, $singleSelect); |
|
291 | 291 | $ret_array['inner_join'] = ''; |
292 | 292 | if (!empty($this->seed->listview_inner_join)) { |
293 | 293 | $ret_array['inner_join'] = ' ' . implode(' ', $this->seed->listview_inner_join) . ' '; |
294 | 294 | } |
295 | 295 | |
296 | - if(!is_array($params)) $params = array(); |
|
296 | + if(!is_array($params)) $params = array(); |
|
297 | 297 | if(!isset($params['custom_select'])) $params['custom_select'] = ''; |
298 | 298 | if(!isset($params['custom_from'])) $params['custom_from'] = ''; |
299 | 299 | if(!isset($params['custom_where'])) $params['custom_where'] = ''; |
300 | 300 | if(!isset($params['custom_order_by'])) $params['custom_order_by'] = ''; |
301 | - $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']; |
|
302 | - //C.L. - Fix for 23461 |
|
303 | - if(empty($_REQUEST['action']) || $_REQUEST['action'] != 'Popup') { |
|
304 | - $_SESSION['export_where'] = $ret_array['where']; |
|
305 | - } |
|
306 | - if($limit < -1) { |
|
307 | - $result = $this->db->query($main_query); |
|
308 | - } |
|
309 | - else { |
|
310 | - if($limit == -1) { |
|
311 | - $limit = $this->getLimit(); |
|
301 | + $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']; |
|
302 | + //C.L. - Fix for 23461 |
|
303 | + if(empty($_REQUEST['action']) || $_REQUEST['action'] != 'Popup') { |
|
304 | + $_SESSION['export_where'] = $ret_array['where']; |
|
305 | + } |
|
306 | + if($limit < -1) { |
|
307 | + $result = $this->db->query($main_query); |
|
308 | + } |
|
309 | + else { |
|
310 | + if($limit == -1) { |
|
311 | + $limit = $this->getLimit(); |
|
312 | 312 | } |
313 | - $dyn_offset = $this->getOffset(); |
|
314 | - if($dyn_offset > 0 || !is_int($dyn_offset))$offset = $dyn_offset; |
|
313 | + $dyn_offset = $this->getOffset(); |
|
314 | + if($dyn_offset > 0 || !is_int($dyn_offset))$offset = $dyn_offset; |
|
315 | 315 | |
316 | 316 | if(strcmp($offset, 'end') == 0){ |
317 | - $totalCount = $this->getTotalCount($main_query); |
|
318 | - $offset = (floor(($totalCount -1) / $limit)) * $limit; |
|
317 | + $totalCount = $this->getTotalCount($main_query); |
|
318 | + $offset = (floor(($totalCount -1) / $limit)) * $limit; |
|
319 | 319 | } |
320 | 320 | if($this->seed->ACLAccess('ListView')) { |
321 | 321 | $result = $this->db->limitQuery($main_query, $offset, $limit + 1); |
@@ -324,27 +324,27 @@ discard block |
||
324 | 324 | $result = array(); |
325 | 325 | } |
326 | 326 | |
327 | - } |
|
327 | + } |
|
328 | 328 | |
329 | - $data = array(); |
|
329 | + $data = array(); |
|
330 | 330 | |
331 | - $temp = clone $seed; |
|
331 | + $temp = clone $seed; |
|
332 | 332 | |
333 | - $rows = array(); |
|
334 | - $count = 0; |
|
333 | + $rows = array(); |
|
334 | + $count = 0; |
|
335 | 335 | $idIndex = array(); |
336 | 336 | $id_list = ''; |
337 | 337 | |
338 | - while(($row = $this->db->fetchByAssoc($result)) != null) |
|
338 | + while(($row = $this->db->fetchByAssoc($result)) != null) |
|
339 | 339 | { |
340 | - if($count < $limit) |
|
340 | + if($count < $limit) |
|
341 | 341 | { |
342 | - $id_list .= ',\''.$row[$id_field].'\''; |
|
343 | - $idIndex[$row[$id_field]][] = count($rows); |
|
344 | - $rows[] = $seed->convertRow($row); |
|
345 | - } |
|
346 | - $count++; |
|
347 | - } |
|
342 | + $id_list .= ',\''.$row[$id_field].'\''; |
|
343 | + $idIndex[$row[$id_field]][] = count($rows); |
|
344 | + $rows[] = $seed->convertRow($row); |
|
345 | + } |
|
346 | + $count++; |
|
347 | + } |
|
348 | 348 | |
349 | 349 | if (!empty($id_list)) |
350 | 350 | { |
@@ -352,10 +352,10 @@ discard block |
||
352 | 352 | } |
353 | 353 | |
354 | 354 | SugarVCR::store($this->seed->module_dir, $main_query); |
355 | - if($count != 0) { |
|
356 | - //NOW HANDLE SECONDARY QUERIES |
|
357 | - if(!empty($ret_array['secondary_select'])) { |
|
358 | - $secondary_query = $ret_array['secondary_select'] . $ret_array['secondary_from'] . ' WHERE '.$this->seed->table_name.'.id IN ' .$id_list; |
|
355 | + if($count != 0) { |
|
356 | + //NOW HANDLE SECONDARY QUERIES |
|
357 | + if(!empty($ret_array['secondary_select'])) { |
|
358 | + $secondary_query = $ret_array['secondary_select'] . $ret_array['secondary_from'] . ' WHERE '.$this->seed->table_name.'.id IN ' .$id_list; |
|
359 | 359 | if(isset($ret_array['order_by'])) |
360 | 360 | { |
361 | 361 | $secondary_query .= ' ' . $ret_array['order_by']; |
@@ -364,23 +364,23 @@ discard block |
||
364 | 364 | $secondary_result = $this->db->query($secondary_query); |
365 | 365 | |
366 | 366 | $ref_id_count = array(); |
367 | - while($row = $this->db->fetchByAssoc($secondary_result)) { |
|
367 | + while($row = $this->db->fetchByAssoc($secondary_result)) { |
|
368 | 368 | |
369 | 369 | $ref_id_count[$row['ref_id']][] = true; |
370 | - foreach($row as $name=>$value) { |
|
371 | - //add it to every row with the given id |
|
372 | - foreach($idIndex[$row['ref_id']] as $index){ |
|
373 | - $rows[$index][$name]=$value; |
|
374 | - } |
|
375 | - } |
|
376 | - } |
|
370 | + foreach($row as $name=>$value) { |
|
371 | + //add it to every row with the given id |
|
372 | + foreach($idIndex[$row['ref_id']] as $index){ |
|
373 | + $rows[$index][$name]=$value; |
|
374 | + } |
|
375 | + } |
|
376 | + } |
|
377 | 377 | |
378 | 378 | $rows_keys = array_keys($rows); |
379 | 379 | foreach($rows_keys as $key) |
380 | 380 | { |
381 | 381 | $rows[$key]['secondary_select_count'] = count($ref_id_count[$rows[$key]['ref_id']]); |
382 | 382 | } |
383 | - } |
|
383 | + } |
|
384 | 384 | |
385 | 385 | // retrieve parent names |
386 | 386 | if(!empty($filter_fields['parent_name']) && !empty($filter_fields['parent_id']) && !empty($filter_fields['parent_type'])) { |
@@ -394,47 +394,47 @@ discard block |
||
394 | 394 | $parent_fields = $seed->retrieve_parent_fields($post_retrieve); |
395 | 395 | foreach($parent_fields as $child_id => $parent_data) { |
396 | 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']; |
|
399 | - } |
|
397 | + foreach($idIndex[$child_id] as $index){ |
|
398 | + $rows[$index]['parent_name']= $parent_data['parent_name']; |
|
399 | + } |
|
400 | 400 | } |
401 | 401 | } |
402 | 402 | } |
403 | 403 | |
404 | - $pageData = array(); |
|
404 | + $pageData = array(); |
|
405 | 405 | |
406 | - reset($rows); |
|
407 | - while($row = current($rows)){ |
|
406 | + reset($rows); |
|
407 | + while($row = current($rows)){ |
|
408 | 408 | |
409 | 409 | $temp = clone $seed; |
410 | - $dataIndex = count($data); |
|
411 | - |
|
412 | - $temp->setupCustomFields($temp->module_dir); |
|
413 | - $temp->loadFromRow($row); |
|
414 | - if (empty($this->seed->assigned_user_id) && !empty($temp->assigned_user_id)) { |
|
415 | - $this->seed->assigned_user_id = $temp->assigned_user_id; |
|
416 | - } |
|
417 | - if($idIndex[$row[$id_field]][0] == $dataIndex){ |
|
418 | - $pageData['tag'][$dataIndex] = $temp->listviewACLHelper(); |
|
419 | - }else{ |
|
420 | - $pageData['tag'][$dataIndex] = $pageData['tag'][$idIndex[$row[$id_field]][0]]; |
|
421 | - } |
|
422 | - $data[$dataIndex] = $temp->get_list_view_data($filter_fields); |
|
410 | + $dataIndex = count($data); |
|
411 | + |
|
412 | + $temp->setupCustomFields($temp->module_dir); |
|
413 | + $temp->loadFromRow($row); |
|
414 | + if (empty($this->seed->assigned_user_id) && !empty($temp->assigned_user_id)) { |
|
415 | + $this->seed->assigned_user_id = $temp->assigned_user_id; |
|
416 | + } |
|
417 | + if($idIndex[$row[$id_field]][0] == $dataIndex){ |
|
418 | + $pageData['tag'][$dataIndex] = $temp->listviewACLHelper(); |
|
419 | + }else{ |
|
420 | + $pageData['tag'][$dataIndex] = $pageData['tag'][$idIndex[$row[$id_field]][0]]; |
|
421 | + } |
|
422 | + $data[$dataIndex] = $temp->get_list_view_data($filter_fields); |
|
423 | 423 | $detailViewAccess = $temp->ACLAccess('DetailView'); |
424 | 424 | $editViewAccess = $temp->ACLAccess('EditView'); |
425 | 425 | $pageData['rowAccess'][$dataIndex] = array('view' => $detailViewAccess, 'edit' => $editViewAccess); |
426 | 426 | $additionalDetailsAllow = $this->additionalDetails && $detailViewAccess && (file_exists( |
427 | - 'modules/' . $temp->module_dir . '/metadata/additionalDetails.php' |
|
428 | - ) || file_exists('custom/modules/' . $temp->module_dir . '/metadata/additionalDetails.php')); |
|
427 | + 'modules/' . $temp->module_dir . '/metadata/additionalDetails.php' |
|
428 | + ) || file_exists('custom/modules/' . $temp->module_dir . '/metadata/additionalDetails.php')); |
|
429 | 429 | $additionalDetailsEdit = $editViewAccess; |
430 | 430 | if($additionalDetailsAllow) { |
431 | 431 | if($this->additionalDetailsAjax) { |
432 | - $ar = $this->getAdditionalDetailsAjax($data[$dataIndex]['ID']); |
|
432 | + $ar = $this->getAdditionalDetailsAjax($data[$dataIndex]['ID']); |
|
433 | 433 | } |
434 | 434 | else { |
435 | 435 | $additionalDetailsFile = 'modules/' . $this->seed->module_dir . '/metadata/additionalDetails.php'; |
436 | 436 | if(file_exists('custom/modules/' . $this->seed->module_dir . '/metadata/additionalDetails.php')){ |
437 | - $additionalDetailsFile = 'custom/modules/' . $this->seed->module_dir . '/metadata/additionalDetails.php'; |
|
437 | + $additionalDetailsFile = 'custom/modules/' . $this->seed->module_dir . '/metadata/additionalDetails.php'; |
|
438 | 438 | } |
439 | 439 | require_once($additionalDetailsFile); |
440 | 440 | $ar = $this->getAdditionalDetails($data[$dataIndex], |
@@ -443,42 +443,42 @@ discard block |
||
443 | 443 | } |
444 | 444 | $pageData['additionalDetails'][$dataIndex] = $ar['string']; |
445 | 445 | $pageData['additionalDetails']['fieldToAddTo'] = $ar['fieldToAddTo']; |
446 | - } |
|
447 | - next($rows); |
|
448 | - } |
|
449 | - } |
|
450 | - $nextOffset = -1; |
|
451 | - $prevOffset = -1; |
|
452 | - $endOffset = -1; |
|
453 | - if($count > $limit) { |
|
454 | - $nextOffset = $offset + $limit; |
|
455 | - } |
|
456 | - |
|
457 | - if($offset > 0) { |
|
458 | - $prevOffset = $offset - $limit; |
|
459 | - if($prevOffset < 0)$prevOffset = 0; |
|
460 | - } |
|
461 | - $totalCount = $count + $offset; |
|
462 | - |
|
463 | - if( $count >= $limit && $totalCounted){ |
|
464 | - $totalCount = $this->getTotalCount($main_query); |
|
465 | - } |
|
466 | - SugarVCR::recordIDs($this->seed->module_dir, array_keys($idIndex), $offset, $totalCount); |
|
446 | + } |
|
447 | + next($rows); |
|
448 | + } |
|
449 | + } |
|
450 | + $nextOffset = -1; |
|
451 | + $prevOffset = -1; |
|
452 | + $endOffset = -1; |
|
453 | + if($count > $limit) { |
|
454 | + $nextOffset = $offset + $limit; |
|
455 | + } |
|
456 | + |
|
457 | + if($offset > 0) { |
|
458 | + $prevOffset = $offset - $limit; |
|
459 | + if($prevOffset < 0)$prevOffset = 0; |
|
460 | + } |
|
461 | + $totalCount = $count + $offset; |
|
462 | + |
|
463 | + if( $count >= $limit && $totalCounted){ |
|
464 | + $totalCount = $this->getTotalCount($main_query); |
|
465 | + } |
|
466 | + SugarVCR::recordIDs($this->seed->module_dir, array_keys($idIndex), $offset, $totalCount); |
|
467 | 467 | $module_names = array( |
468 | 468 | 'Prospects' => 'Targets' |
469 | 469 | ); |
470 | - $endOffset = (floor(($totalCount - 1) / $limit)) * $limit; |
|
471 | - $pageData['ordering'] = $order; |
|
472 | - $pageData['ordering']['sortOrder'] = $this->getReverseSortOrder($pageData['ordering']['sortOrder']); |
|
470 | + $endOffset = (floor(($totalCount - 1) / $limit)) * $limit; |
|
471 | + $pageData['ordering'] = $order; |
|
472 | + $pageData['ordering']['sortOrder'] = $this->getReverseSortOrder($pageData['ordering']['sortOrder']); |
|
473 | 473 | //get url parameters as an array |
474 | 474 | $pageData['queries'] = $this->generateQueries($pageData['ordering']['sortOrder'], $offset, $prevOffset, $nextOffset, $endOffset, $totalCounted); |
475 | 475 | //join url parameters from array to a string |
476 | 476 | $pageData['urls'] = $this->generateURLS($pageData['queries']); |
477 | - $pageData['offsets'] = array( 'current'=>$offset, 'next'=>$nextOffset, 'prev'=>$prevOffset, 'end'=>$endOffset, 'total'=>$totalCount, 'totalCounted'=>$totalCounted); |
|
478 | - $pageData['bean'] = array('objectName' => $seed->object_name, 'moduleDir' => $seed->module_dir, 'moduleName' => strtr($seed->module_dir, $module_names)); |
|
477 | + $pageData['offsets'] = array( 'current'=>$offset, 'next'=>$nextOffset, 'prev'=>$prevOffset, 'end'=>$endOffset, 'total'=>$totalCount, 'totalCounted'=>$totalCounted); |
|
478 | + $pageData['bean'] = array('objectName' => $seed->object_name, 'moduleDir' => $seed->module_dir, 'moduleName' => strtr($seed->module_dir, $module_names)); |
|
479 | 479 | $pageData['stamp'] = $this->stamp; |
480 | 480 | $pageData['access'] = array('view' => $this->seed->ACLAccess('DetailView'), 'edit' => $this->seed->ACLAccess('EditView')); |
481 | - $pageData['idIndex'] = $idIndex; |
|
481 | + $pageData['idIndex'] = $idIndex; |
|
482 | 482 | if(!$this->seed->ACLAccess('ListView')) { |
483 | 483 | $pageData['error'] = 'ACL restricted access'; |
484 | 484 | } |
@@ -486,8 +486,8 @@ discard block |
||
486 | 486 | $queryString = ''; |
487 | 487 | |
488 | 488 | if( isset($_REQUEST["searchFormTab"]) && $_REQUEST["searchFormTab"] == "advanced_search" || |
489 | - isset($_REQUEST["type_basic"]) && (count($_REQUEST["type_basic"] > 1) || $_REQUEST["type_basic"][0] != "") || |
|
490 | - isset($_REQUEST["module"]) && $_REQUEST["module"] == "MergeRecords") |
|
489 | + isset($_REQUEST["type_basic"]) && (count($_REQUEST["type_basic"] > 1) || $_REQUEST["type_basic"][0] != "") || |
|
490 | + isset($_REQUEST["module"]) && $_REQUEST["module"] == "MergeRecords") |
|
491 | 491 | { |
492 | 492 | $queryString = "-advanced_search"; |
493 | 493 | } |
@@ -514,8 +514,8 @@ discard block |
||
514 | 514 | } |
515 | 515 | } |
516 | 516 | |
517 | - return array('data'=>$data , 'pageData'=>$pageData, 'query' => $queryString); |
|
518 | - } |
|
517 | + return array('data'=>$data , 'pageData'=>$pageData, 'query' => $queryString); |
|
518 | + } |
|
519 | 519 | |
520 | 520 | |
521 | 521 | /** |
@@ -582,13 +582,13 @@ discard block |
||
582 | 582 | return $queries; |
583 | 583 | } |
584 | 584 | |
585 | - /** |
|
586 | - * generates the additional details span to be retrieved via ajax |
|
587 | - * |
|
588 | - * @param GUID id id of the record |
|
589 | - * @return array string to attach to field |
|
590 | - */ |
|
591 | - function getAdditionalDetailsAjax($id) |
|
585 | + /** |
|
586 | + * generates the additional details span to be retrieved via ajax |
|
587 | + * |
|
588 | + * @param GUID id id of the record |
|
589 | + * @return array string to attach to field |
|
590 | + */ |
|
591 | + function getAdditionalDetailsAjax($id) |
|
592 | 592 | { |
593 | 593 | global $app_strings; |
594 | 594 | |
@@ -596,10 +596,10 @@ discard block |
||
596 | 596 | |
597 | 597 | $extra = "<span id='adspan_" . $id . "' " |
598 | 598 | . "onclick=\"lvg_dtails('$id')\" " |
599 | - . " style='position: relative;'><!--not_in_theme!--><img vertical-align='middle' class='info' border='0' alt='".$app_strings['LBL_ADDITIONAL_DETAILS']."' src='$jscalendarImage'></span>"; |
|
599 | + . " style='position: relative;'><!--not_in_theme!--><img vertical-align='middle' class='info' border='0' alt='".$app_strings['LBL_ADDITIONAL_DETAILS']."' src='$jscalendarImage'></span>"; |
|
600 | 600 | |
601 | 601 | return array('fieldToAddTo' => $this->additionalDetailsFieldToAdd, 'string' => $extra); |
602 | - } |
|
602 | + } |
|
603 | 603 | |
604 | 604 | /** |
605 | 605 | * generates the additional details values |
@@ -622,25 +622,25 @@ discard block |
||
622 | 622 | { |
623 | 623 | $results['string'] = $app_strings['LBL_NONE']; |
624 | 624 | } |
625 | - $close = false; |
|
625 | + $close = false; |
|
626 | 626 | $extra = "<img alt='{$app_strings['LBL_INFOINLINE']}' style='padding: 0px 5px 0px 2px' border='0' onclick=\"SUGAR.util.getStaticAdditionalDetails(this,'"; |
627 | 627 | |
628 | 628 | $extra .= str_replace(array("\rn", "\r", "\n"), array('','','<br />'), $results['string']) ; |
629 | 629 | $extra .= "','<div style=\'float:left\'>{$app_strings['LBL_ADDITIONAL_DETAILS']}</div><div style=\'float: right\'>"; |
630 | 630 | |
631 | - if($editAccess && !empty($results['editLink'])) |
|
632 | - { |
|
633 | - $extra .= "<a title=\'{$app_strings['LBL_EDIT_BUTTON']}\' href={$results['editLink']}><img style=\'margin-left: 2px;\' border=\'0\' src=\'".SugarThemeRegistry::current()->getImageURL('edit_inline.png')."\'></a>"; |
|
634 | - $close = true; |
|
635 | - } |
|
636 | - $close = (!empty($results['viewLink'])) ? true : $close; |
|
637 | - $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.png')."></a>" : ''); |
|
631 | + if($editAccess && !empty($results['editLink'])) |
|
632 | + { |
|
633 | + $extra .= "<a title=\'{$app_strings['LBL_EDIT_BUTTON']}\' href={$results['editLink']}><img style=\'margin-left: 2px;\' border=\'0\' src=\'".SugarThemeRegistry::current()->getImageURL('edit_inline.png')."\'></a>"; |
|
634 | + $close = true; |
|
635 | + } |
|
636 | + $close = (!empty($results['viewLink'])) ? true : $close; |
|
637 | + $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.png')."></a>" : ''); |
|
638 | 638 | |
639 | 639 | if($close == true) { |
640 | - $closeVal = "true"; |
|
641 | - $extra .= "<a title=\'{$app_strings['LBL_ADDITIONAL_DETAILS_CLOSE_TITLE']}\' href=\'javascript: SUGAR.util.closeStaticAdditionalDetails();\'><img style=\'margin-left: 2px;\' border=\'0\' src=\'".SugarThemeRegistry::current()->getImageURL('close.png')."\'></a>"; |
|
640 | + $closeVal = "true"; |
|
641 | + $extra .= "<a title=\'{$app_strings['LBL_ADDITIONAL_DETAILS_CLOSE_TITLE']}\' href=\'javascript: SUGAR.util.closeStaticAdditionalDetails();\'><img style=\'margin-left: 2px;\' border=\'0\' src=\'".SugarThemeRegistry::current()->getImageURL('close.png')."\'></a>"; |
|
642 | 642 | } else { |
643 | - $closeVal = "false"; |
|
643 | + $closeVal = "false"; |
|
644 | 644 | } |
645 | 645 | $extra .= "',".$closeVal.")\" src='".SugarThemeRegistry::current()->getImageURL('info_inline.png')."' class='info'>"; |
646 | 646 |
@@ -54,44 +54,44 @@ discard block |
||
54 | 54 | * @return boolean - Returns true on success false on failure |
55 | 55 | */ |
56 | 56 | function sugar_mkdir($pathname, $mode=null, $recursive=false, $context='') { |
57 | - $mode = get_mode('dir_mode', $mode); |
|
58 | - |
|
59 | - if ( sugar_is_dir($pathname,$mode) ) |
|
60 | - return true; |
|
61 | - |
|
62 | - $result = false; |
|
63 | - if(empty($mode)) |
|
64 | - $mode = 0777; |
|
65 | - if(empty($context)) { |
|
66 | - $result = @mkdir($pathname, $mode, $recursive); |
|
67 | - } else { |
|
68 | - $result = @mkdir($pathname, $mode, $recursive, $context); |
|
69 | - } |
|
70 | - |
|
71 | - if($result){ |
|
72 | - if(!sugar_chmod($pathname, $mode)){ |
|
73 | - return false; |
|
74 | - } |
|
75 | - if(!empty($GLOBALS['sugar_config']['default_permissions']['user'])){ |
|
76 | - if(!sugar_chown($pathname)){ |
|
77 | - return false; |
|
78 | - } |
|
79 | - } |
|
80 | - if(!empty($GLOBALS['sugar_config']['default_permissions']['group'])){ |
|
81 | - if(!sugar_chgrp($pathname)) { |
|
82 | - return false; |
|
83 | - } |
|
84 | - } |
|
85 | - } |
|
86 | - else { |
|
87 | - $errorMessage = "Cannot create directory $pathname cannot be touched"; |
|
88 | - if(is_null($GLOBALS['log'])) { |
|
89 | - throw new Exception("Error occurred but the system doesn't have logger. Error message: \"$errorMessage\""); |
|
90 | - } |
|
91 | - $GLOBALS['log']->error($errorMessage); |
|
92 | - } |
|
93 | - |
|
94 | - return $result; |
|
57 | + $mode = get_mode('dir_mode', $mode); |
|
58 | + |
|
59 | + if ( sugar_is_dir($pathname,$mode) ) |
|
60 | + return true; |
|
61 | + |
|
62 | + $result = false; |
|
63 | + if(empty($mode)) |
|
64 | + $mode = 0777; |
|
65 | + if(empty($context)) { |
|
66 | + $result = @mkdir($pathname, $mode, $recursive); |
|
67 | + } else { |
|
68 | + $result = @mkdir($pathname, $mode, $recursive, $context); |
|
69 | + } |
|
70 | + |
|
71 | + if($result){ |
|
72 | + if(!sugar_chmod($pathname, $mode)){ |
|
73 | + return false; |
|
74 | + } |
|
75 | + if(!empty($GLOBALS['sugar_config']['default_permissions']['user'])){ |
|
76 | + if(!sugar_chown($pathname)){ |
|
77 | + return false; |
|
78 | + } |
|
79 | + } |
|
80 | + if(!empty($GLOBALS['sugar_config']['default_permissions']['group'])){ |
|
81 | + if(!sugar_chgrp($pathname)) { |
|
82 | + return false; |
|
83 | + } |
|
84 | + } |
|
85 | + } |
|
86 | + else { |
|
87 | + $errorMessage = "Cannot create directory $pathname cannot be touched"; |
|
88 | + if(is_null($GLOBALS['log'])) { |
|
89 | + throw new Exception("Error occurred but the system doesn't have logger. Error message: \"$errorMessage\""); |
|
90 | + } |
|
91 | + $GLOBALS['log']->error($errorMessage); |
|
92 | + } |
|
93 | + |
|
94 | + return $result; |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -109,17 +109,17 @@ discard block |
||
109 | 109 | * @return boolean - Returns a file pointer on success, false otherwise |
110 | 110 | */ |
111 | 111 | function sugar_fopen($filename, $mode, $use_include_path=false, $context=null){ |
112 | - //check to see if the file exists, if not then use touch to create it. |
|
113 | - if(!file_exists($filename)){ |
|
114 | - sugar_touch($filename); |
|
115 | - } |
|
112 | + //check to see if the file exists, if not then use touch to create it. |
|
113 | + if(!file_exists($filename)){ |
|
114 | + sugar_touch($filename); |
|
115 | + } |
|
116 | 116 | |
117 | - if(empty($context)) { |
|
117 | + if(empty($context)) { |
|
118 | 118 | |
119 | - return fopen($filename, $mode, $use_include_path); |
|
120 | - } else { |
|
121 | - return fopen($filename, $mode, $use_include_path, $context); |
|
122 | - } |
|
119 | + return fopen($filename, $mode, $use_include_path); |
|
120 | + } else { |
|
121 | + return fopen($filename, $mode, $use_include_path, $context); |
|
122 | + } |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -137,23 +137,23 @@ discard block |
||
137 | 137 | * @return int - Returns the number of bytes written to the file, false otherwise. |
138 | 138 | */ |
139 | 139 | function sugar_file_put_contents($filename, $data, $flags=null, $context=null){ |
140 | - //check to see if the file exists, if not then use touch to create it. |
|
141 | - if(!file_exists($filename)){ |
|
142 | - sugar_touch($filename); |
|
143 | - } |
|
144 | - |
|
145 | - if ( !is_writable($filename) ) { |
|
146 | - $GLOBALS['log']->error("File $filename cannot be written to"); |
|
147 | - return false; |
|
148 | - } |
|
149 | - |
|
150 | - if(empty($flags)) { |
|
151 | - return file_put_contents($filename, $data); |
|
152 | - } elseif(empty($context)) { |
|
153 | - return file_put_contents($filename, $data, $flags); |
|
154 | - } else{ |
|
155 | - return file_put_contents($filename, $data, $flags, $context); |
|
156 | - } |
|
140 | + //check to see if the file exists, if not then use touch to create it. |
|
141 | + if(!file_exists($filename)){ |
|
142 | + sugar_touch($filename); |
|
143 | + } |
|
144 | + |
|
145 | + if ( !is_writable($filename) ) { |
|
146 | + $GLOBALS['log']->error("File $filename cannot be written to"); |
|
147 | + return false; |
|
148 | + } |
|
149 | + |
|
150 | + if(empty($flags)) { |
|
151 | + return file_put_contents($filename, $data); |
|
152 | + } elseif(empty($context)) { |
|
153 | + return file_put_contents($filename, $data, $flags); |
|
154 | + } else{ |
|
155 | + return file_put_contents($filename, $data, $flags, $context); |
|
156 | + } |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | |
199 | 199 | if(file_exists($filename)) |
200 | 200 | { |
201 | - return sugar_chmod($filename, 0755); |
|
201 | + return sugar_chmod($filename, 0755); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | return false; |
@@ -215,21 +215,21 @@ discard block |
||
215 | 215 | * @return string|boolean - Returns a file data on success, false otherwise |
216 | 216 | */ |
217 | 217 | function sugar_file_get_contents($filename, $use_include_path=false, $context=null){ |
218 | - //check to see if the file exists, if not then use touch to create it. |
|
219 | - if(!file_exists($filename)){ |
|
220 | - sugar_touch($filename); |
|
221 | - } |
|
222 | - |
|
223 | - if ( !is_readable($filename) ) { |
|
224 | - $GLOBALS['log']->error("File $filename cannot be read"); |
|
225 | - return false; |
|
226 | - } |
|
227 | - |
|
228 | - if(empty($context)) { |
|
229 | - return file_get_contents($filename, $use_include_path); |
|
230 | - } else { |
|
231 | - return file_get_contents($filename, $use_include_path, $context); |
|
232 | - } |
|
218 | + //check to see if the file exists, if not then use touch to create it. |
|
219 | + if(!file_exists($filename)){ |
|
220 | + sugar_touch($filename); |
|
221 | + } |
|
222 | + |
|
223 | + if ( !is_readable($filename) ) { |
|
224 | + $GLOBALS['log']->error("File $filename cannot be read"); |
|
225 | + return false; |
|
226 | + } |
|
227 | + |
|
228 | + if(empty($context)) { |
|
229 | + return file_get_contents($filename, $use_include_path); |
|
230 | + } else { |
|
231 | + return file_get_contents($filename, $use_include_path, $context); |
|
232 | + } |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | /** |
@@ -248,31 +248,31 @@ discard block |
||
248 | 248 | */ |
249 | 249 | function sugar_touch($filename, $time=null, $atime=null) { |
250 | 250 | |
251 | - $result = false; |
|
252 | - |
|
253 | - if(!empty($atime) && !empty($time)) { |
|
254 | - $result = @touch($filename, $time, $atime); |
|
255 | - } else if(!empty($time)) { |
|
256 | - $result = @touch($filename, $time); |
|
257 | - } else { |
|
258 | - $result = @touch($filename); |
|
259 | - } |
|
260 | - |
|
261 | - if(!$result) { |
|
262 | - $GLOBALS['log']->error("File $filename cannot be touched"); |
|
263 | - return $result; |
|
264 | - } |
|
265 | - if(!empty($GLOBALS['sugar_config']['default_permissions']['file_mode'])){ |
|
266 | - sugar_chmod($filename, $GLOBALS['sugar_config']['default_permissions']['file_mode']); |
|
267 | - } |
|
268 | - if(!empty($GLOBALS['sugar_config']['default_permissions']['user'])){ |
|
269 | - sugar_chown($filename); |
|
270 | - } |
|
271 | - if(!empty($GLOBALS['sugar_config']['default_permissions']['group'])){ |
|
272 | - sugar_chgrp($filename); |
|
273 | - } |
|
274 | - |
|
275 | - return true; |
|
251 | + $result = false; |
|
252 | + |
|
253 | + if(!empty($atime) && !empty($time)) { |
|
254 | + $result = @touch($filename, $time, $atime); |
|
255 | + } else if(!empty($time)) { |
|
256 | + $result = @touch($filename, $time); |
|
257 | + } else { |
|
258 | + $result = @touch($filename); |
|
259 | + } |
|
260 | + |
|
261 | + if(!$result) { |
|
262 | + $GLOBALS['log']->error("File $filename cannot be touched"); |
|
263 | + return $result; |
|
264 | + } |
|
265 | + if(!empty($GLOBALS['sugar_config']['default_permissions']['file_mode'])){ |
|
266 | + sugar_chmod($filename, $GLOBALS['sugar_config']['default_permissions']['file_mode']); |
|
267 | + } |
|
268 | + if(!empty($GLOBALS['sugar_config']['default_permissions']['user'])){ |
|
269 | + sugar_chown($filename); |
|
270 | + } |
|
271 | + if(!empty($GLOBALS['sugar_config']['default_permissions']['group'])){ |
|
272 | + sugar_chgrp($filename); |
|
273 | + } |
|
274 | + |
|
275 | + return true; |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | /** |
@@ -287,17 +287,17 @@ discard block |
||
287 | 287 | function sugar_chmod($filename, $mode=null) { |
288 | 288 | if ( !is_int($mode) ) |
289 | 289 | $mode = (int) $mode; |
290 | - if(!is_windows()){ |
|
291 | - if(!isset($mode)){ |
|
292 | - $mode = get_mode('file_mode', $mode); |
|
293 | - } |
|
290 | + if(!is_windows()){ |
|
291 | + if(!isset($mode)){ |
|
292 | + $mode = get_mode('file_mode', $mode); |
|
293 | + } |
|
294 | 294 | if(isset($mode) && $mode > 0){ |
295 | - return @chmod($filename, $mode); |
|
296 | - }else{ |
|
297 | - return false; |
|
298 | - } |
|
299 | - } |
|
300 | - return true; |
|
295 | + return @chmod($filename, $mode); |
|
296 | + }else{ |
|
297 | + return false; |
|
298 | + } |
|
299 | + } |
|
300 | + return true; |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | /** |
@@ -310,19 +310,19 @@ discard block |
||
310 | 310 | * @return boolean - Returns TRUE on success or FALSE on failure. |
311 | 311 | */ |
312 | 312 | function sugar_chown($filename, $user='') { |
313 | - if(!is_windows()){ |
|
314 | - if(strlen($user)){ |
|
315 | - return chown($filename, $user); |
|
316 | - }else{ |
|
317 | - if(strlen($GLOBALS['sugar_config']['default_permissions']['user'])){ |
|
318 | - $user = $GLOBALS['sugar_config']['default_permissions']['user']; |
|
319 | - return chown($filename, $user); |
|
320 | - }else{ |
|
321 | - return false; |
|
322 | - } |
|
323 | - } |
|
324 | - } |
|
325 | - return true; |
|
313 | + if(!is_windows()){ |
|
314 | + if(strlen($user)){ |
|
315 | + return chown($filename, $user); |
|
316 | + }else{ |
|
317 | + if(strlen($GLOBALS['sugar_config']['default_permissions']['user'])){ |
|
318 | + $user = $GLOBALS['sugar_config']['default_permissions']['user']; |
|
319 | + return chown($filename, $user); |
|
320 | + }else{ |
|
321 | + return false; |
|
322 | + } |
|
323 | + } |
|
324 | + } |
|
325 | + return true; |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | /** |
@@ -335,19 +335,19 @@ discard block |
||
335 | 335 | * @return boolean - Returns TRUE on success or FALSE on failure. |
336 | 336 | */ |
337 | 337 | function sugar_chgrp($filename, $group='') { |
338 | - if(!is_windows()){ |
|
339 | - if(!empty($group)){ |
|
340 | - return chgrp($filename, $group); |
|
341 | - }else{ |
|
342 | - if(!empty($GLOBALS['sugar_config']['default_permissions']['group'])){ |
|
343 | - $group = $GLOBALS['sugar_config']['default_permissions']['group']; |
|
344 | - return chgrp($filename, $group); |
|
345 | - }else{ |
|
346 | - return false; |
|
347 | - } |
|
348 | - } |
|
349 | - } |
|
350 | - return true; |
|
338 | + if(!is_windows()){ |
|
339 | + if(!empty($group)){ |
|
340 | + return chgrp($filename, $group); |
|
341 | + }else{ |
|
342 | + if(!empty($GLOBALS['sugar_config']['default_permissions']['group'])){ |
|
343 | + $group = $GLOBALS['sugar_config']['default_permissions']['group']; |
|
344 | + return chgrp($filename, $group); |
|
345 | + }else{ |
|
346 | + return false; |
|
347 | + } |
|
348 | + } |
|
349 | + } |
|
350 | + return true; |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | /** |
@@ -361,26 +361,26 @@ discard block |
||
361 | 361 | * @return int - the mode either found in the config file or passed in via the input parameter |
362 | 362 | */ |
363 | 363 | function get_mode($key = 'dir_mode', $mode=null) { |
364 | - if ( !is_int($mode) ) |
|
364 | + if ( !is_int($mode) ) |
|
365 | 365 | $mode = (int) $mode; |
366 | 366 | if(!class_exists('SugarConfig', true)) { |
367 | - require 'include/SugarObjects/SugarConfig.php'; |
|
368 | - } |
|
369 | - if(!is_windows()){ |
|
370 | - $conf_inst=SugarConfig::getInstance(); |
|
371 | - $mode = $conf_inst->get('default_permissions.'.$key, $mode); |
|
372 | - } |
|
373 | - return $mode; |
|
367 | + require 'include/SugarObjects/SugarConfig.php'; |
|
368 | + } |
|
369 | + if(!is_windows()){ |
|
370 | + $conf_inst=SugarConfig::getInstance(); |
|
371 | + $mode = $conf_inst->get('default_permissions.'.$key, $mode); |
|
372 | + } |
|
373 | + return $mode; |
|
374 | 374 | } |
375 | 375 | |
376 | 376 | function sugar_is_dir($path, $mode='r'){ |
377 | - if(defined('TEMPLATE_URL'))return is_dir($path, $mode); |
|
378 | - return is_dir($path); |
|
377 | + if(defined('TEMPLATE_URL'))return is_dir($path, $mode); |
|
378 | + return is_dir($path); |
|
379 | 379 | } |
380 | 380 | |
381 | 381 | function sugar_is_file($path, $mode='r'){ |
382 | - if(defined('TEMPLATE_URL'))return is_file($path, $mode); |
|
383 | - return is_file($path); |
|
382 | + if(defined('TEMPLATE_URL'))return is_file($path, $mode); |
|
383 | + return is_file($path); |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | /** |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | ); |
238 | 238 | $adminOnlyList = array( |
239 | 239 | //module => list of actions (all says all actions are admin only) |
240 | - //'Administration'=>array('all'=>1, 'SupportPortal'=>'allow'), |
|
240 | + //'Administration'=>array('all'=>1, 'SupportPortal'=>'allow'), |
|
241 | 241 | 'Dropdown'=>array('all'=>1), |
242 | 242 | 'Dynamic'=>array('all'=>1), |
243 | 243 | 'DynamicFields'=>array('all'=>1), |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | 'DocumentRevisions' => 'Documents', |
295 | 295 | 'EmailTemplates' => 'Emails', |
296 | 296 | 'EmailMarketing' => 'Campaigns', |
297 | - ); |
|
297 | + ); |
|
298 | 298 | $beanList['EAPM'] = 'EAPM'; |
299 | 299 | $beanFiles['EAPM'] = 'modules/EAPM/EAPM.php'; |
300 | 300 | $modules_exempt_from_availability_check['EAPM'] = 'EAPM'; |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | var $templateDir = 'modules/'; |
51 | 51 | var $ss; |
52 | 52 | function TemplateHandler() { |
53 | - $this->cacheDir = sugar_cached(''); |
|
53 | + $this->cacheDir = sugar_cached(''); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | function loadSmarty(){ |
@@ -66,10 +66,10 @@ discard block |
||
66 | 66 | * |
67 | 67 | */ |
68 | 68 | static function clearAll() { |
69 | - global $beanList; |
|
70 | - foreach($beanList as $module_dir =>$object_name){ |
|
69 | + global $beanList; |
|
70 | + foreach($beanList as $module_dir =>$object_name){ |
|
71 | 71 | TemplateHandler::clearCache($module_dir); |
72 | - } |
|
72 | + } |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | foreach($panel as $row) { |
133 | 133 | foreach($row as $entry) { |
134 | 134 | if(empty($entry)) { |
135 | - continue; |
|
135 | + continue; |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | if(is_array($entry) && |
@@ -140,35 +140,35 @@ discard block |
||
140 | 140 | isset($entry['displayParams']) && |
141 | 141 | isset($entry['displayParams']['required']) && |
142 | 142 | $entry['displayParams']['required']) { |
143 | - $panelFields[$entry['name']] = $entry; |
|
143 | + $panelFields[$entry['name']] = $entry; |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | if(is_array($entry)) { |
147 | - $defs2[$entry['name']] = $entry; |
|
147 | + $defs2[$entry['name']] = $entry; |
|
148 | 148 | } else { |
149 | - $defs2[$entry] = array('name' => $entry); |
|
149 | + $defs2[$entry] = array('name' => $entry); |
|
150 | 150 | } |
151 | 151 | } //foreach |
152 | 152 | } //foreach |
153 | 153 | } //foreach |
154 | 154 | |
155 | 155 | foreach($panelFields as $field=>$value) { |
156 | - $nameList = array(); |
|
157 | - if(!is_array($value['displayParams']['required'])) { |
|
158 | - $nameList[] = $field; |
|
159 | - } else { |
|
160 | - foreach($value['displayParams']['required'] as $groupedField) { |
|
161 | - $nameList[] = $groupedField; |
|
162 | - } |
|
163 | - } |
|
164 | - |
|
165 | - foreach($nameList as $x) { |
|
166 | - if(isset($defs[$x]) && |
|
156 | + $nameList = array(); |
|
157 | + if(!is_array($value['displayParams']['required'])) { |
|
158 | + $nameList[] = $field; |
|
159 | + } else { |
|
160 | + foreach($value['displayParams']['required'] as $groupedField) { |
|
161 | + $nameList[] = $groupedField; |
|
162 | + } |
|
163 | + } |
|
164 | + |
|
165 | + foreach($nameList as $x) { |
|
166 | + if(isset($defs[$x]) && |
|
167 | 167 | isset($defs[$x]['type']) && |
168 | 168 | !isset($defs[$x]['required'])) { |
169 | 169 | $defs[$x]['required'] = true; |
170 | - } |
|
171 | - } |
|
170 | + } |
|
171 | + } |
|
172 | 172 | } //foreach |
173 | 173 | |
174 | 174 | //Create a base class with field_name_map property |
@@ -195,23 +195,23 @@ discard block |
||
195 | 195 | //5) not already been added to Array |
196 | 196 | foreach($sugarbean->field_name_map as $name=>$def) { |
197 | 197 | |
198 | - if($def['type']=='relate' && |
|
198 | + if($def['type']=='relate' && |
|
199 | 199 | isset($defs2[$name]) && |
200 | 200 | (!isset($defs2[$name]['validateDependency']) || $defs2[$name]['validateDependency'] === true) && |
201 | 201 | isset($def['id_name']) && |
202 | 202 | !in_array($name, $validatedFields)) { |
203 | 203 | |
204 | - if(isset($mod_strings[$def['vname']]) |
|
204 | + if(isset($mod_strings[$def['vname']]) |
|
205 | 205 | || isset($app_strings[$def['vname']]) |
206 | 206 | || translate($def['vname'],$sugarbean->module_dir) != $def['vname']) { |
207 | - $vname = $def['vname']; |
|
208 | - } |
|
209 | - else{ |
|
210 | - $vname = "undefined"; |
|
211 | - } |
|
212 | - $javascript->addToValidateBinaryDependency($name, 'alpha', $javascript->buildStringToTranslateInSmarty('ERR_SQS_NO_MATCH_FIELD').': '.$javascript->buildStringToTranslateInSmarty($vname), (!empty($def['required']) ? 'true' : 'false'), '', $def['id_name']); |
|
213 | - $validatedFields[] = $name; |
|
214 | - } |
|
207 | + $vname = $def['vname']; |
|
208 | + } |
|
209 | + else{ |
|
210 | + $vname = "undefined"; |
|
211 | + } |
|
212 | + $javascript->addToValidateBinaryDependency($name, 'alpha', $javascript->buildStringToTranslateInSmarty('ERR_SQS_NO_MATCH_FIELD').': '.$javascript->buildStringToTranslateInSmarty($vname), (!empty($def['required']) ? 'true' : 'false'), '', $def['id_name']); |
|
213 | + $validatedFields[] = $name; |
|
214 | + } |
|
215 | 215 | } //foreach |
216 | 216 | |
217 | 217 | $contents .= "{literal}\n"; |
@@ -275,11 +275,11 @@ discard block |
||
275 | 275 | } |
276 | 276 | $file = $this->cacheDir . $this->templateDir . $module . '/' . $view . '.tpl'; |
277 | 277 | if(file_exists($file)) { |
278 | - return $this->ss->fetch($file); |
|
278 | + return $this->ss->fetch($file); |
|
279 | 279 | } else { |
280 | - global $app_strings; |
|
281 | - $GLOBALS['log']->fatal($app_strings['ERR_NO_SUCH_FILE'] .": $file"); |
|
282 | - return $app_strings['ERR_NO_SUCH_FILE'] .": $file"; |
|
280 | + global $app_strings; |
|
281 | + $GLOBALS['log']->fatal($app_strings['ERR_NO_SUCH_FILE'] .": $file"); |
|
282 | + return $app_strings['ERR_NO_SUCH_FILE'] .": $file"; |
|
283 | 283 | } |
284 | 284 | } |
285 | 285 | |
@@ -329,13 +329,13 @@ discard block |
||
329 | 329 | } |
330 | 330 | $qsd->setFormName($view); |
331 | 331 | if(preg_match('/^SearchForm_.+/', $view)){ |
332 | - if(strpos($view, 'popup_query_form')){ |
|
333 | - $qsd->setFormName('popup_query_form'); |
|
334 | - $parsedView = 'advanced'; |
|
335 | - }else{ |
|
336 | - $qsd->setFormName('search_form'); |
|
337 | - $parsedView = preg_replace("/^SearchForm_/", "", $view); |
|
338 | - } |
|
332 | + if(strpos($view, 'popup_query_form')){ |
|
333 | + $qsd->setFormName('popup_query_form'); |
|
334 | + $parsedView = 'advanced'; |
|
335 | + }else{ |
|
336 | + $qsd->setFormName('search_form'); |
|
337 | + $parsedView = preg_replace("/^SearchForm_/", "", $view); |
|
338 | + } |
|
339 | 339 | //Loop through the Meta-Data fields to see which ones need quick search support |
340 | 340 | foreach($defs as $f) { |
341 | 341 | $field = $f; |
@@ -373,14 +373,14 @@ discard block |
||
373 | 373 | $sqs_objects[$name.'_'.$parsedView] = $qsd->getQSContact($field['name'], $field['id_name']); |
374 | 374 | } |
375 | 375 | } else { |
376 | - $sqs_objects[$name.'_'.$parsedView] = $qsd->getQSParent($field['module']); |
|
377 | - if(!isset($field['field_list']) && !isset($field['populate_list'])) { |
|
378 | - $sqs_objects[$name.'_'.$parsedView]['populate_list'] = array($field['name'], $field['id_name']); |
|
379 | - $sqs_objects[$name.'_'.$parsedView]['field_list'] = array('name', 'id'); |
|
380 | - } else { |
|
381 | - $sqs_objects[$name.'_'.$parsedView]['populate_list'] = $field['field_list']; |
|
382 | - $sqs_objects[$name.'_'.$parsedView]['field_list'] = $field['populate_list']; |
|
383 | - } |
|
376 | + $sqs_objects[$name.'_'.$parsedView] = $qsd->getQSParent($field['module']); |
|
377 | + if(!isset($field['field_list']) && !isset($field['populate_list'])) { |
|
378 | + $sqs_objects[$name.'_'.$parsedView]['populate_list'] = array($field['name'], $field['id_name']); |
|
379 | + $sqs_objects[$name.'_'.$parsedView]['field_list'] = array('name', 'id'); |
|
380 | + } else { |
|
381 | + $sqs_objects[$name.'_'.$parsedView]['populate_list'] = $field['field_list']; |
|
382 | + $sqs_objects[$name.'_'.$parsedView]['field_list'] = $field['populate_list']; |
|
383 | + } |
|
384 | 384 | } |
385 | 385 | } else if($field['type'] == 'parent') { |
386 | 386 | $sqs_objects[$name.'_'.$parsedView] = $qsd->getQSParent(); |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | } //foreach |
389 | 389 | |
390 | 390 | foreach ( $sqs_objects as $name => $field ) |
391 | - foreach ( $field['populate_list'] as $key => $fieldname ) |
|
391 | + foreach ( $field['populate_list'] as $key => $fieldname ) |
|
392 | 392 | $sqs_objects[$name]['populate_list'][$key] = $sqs_objects[$name]['populate_list'][$key] . '_'.$parsedView; |
393 | 393 | }else{ |
394 | 394 | //Loop through the Meta-Data fields to see which ones need quick search support |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | $field['id_name'] = $module.$field['id_name']; |
414 | 414 | } |
415 | 415 | } |
416 | - $name = $qsd->form_name . '_' . $field['name']; |
|
416 | + $name = $qsd->form_name . '_' . $field['name']; |
|
417 | 417 | |
418 | 418 | |
419 | 419 | if($field['type'] == 'relate' && isset($field['module']) && (preg_match('/_name$|_c$/si',$name) || !empty($field['quicksearch']))) { |
@@ -427,15 +427,15 @@ discard block |
||
427 | 427 | } else if($matches[0] == 'Users'){ |
428 | 428 | if($field['name'] == 'reports_to_name'){ |
429 | 429 | $sqs_objects[$name] = $qsd->getQSUser('reports_to_name','reports_to_id'); |
430 | - // Bug #52994 : QuickSearch for a 1-M User relationship changes assigned to user |
|
430 | + // Bug #52994 : QuickSearch for a 1-M User relationship changes assigned to user |
|
431 | 431 | }elseif($field['name'] == 'assigned_user_name'){ |
432 | - $sqs_objects[$name] = $qsd->getQSUser('assigned_user_name','assigned_user_id'); |
|
433 | - } |
|
434 | - else |
|
435 | - { |
|
436 | - $sqs_objects[$name] = $qsd->getQSUser($field['name'], $field['id_name']); |
|
432 | + $sqs_objects[$name] = $qsd->getQSUser('assigned_user_name','assigned_user_id'); |
|
433 | + } |
|
434 | + else |
|
435 | + { |
|
436 | + $sqs_objects[$name] = $qsd->getQSUser($field['name'], $field['id_name']); |
|
437 | 437 | |
438 | - } |
|
438 | + } |
|
439 | 439 | } else if($matches[0] == 'Campaigns') { |
440 | 440 | $sqs_objects[$name] = $qsd->loadQSObject('Campaigns', 'Campaign', $field['name'], $field['id_name'], $field['id_name']); |
441 | 441 | } else if($matches[0] == 'Accounts') { |
@@ -486,39 +486,39 @@ discard block |
||
486 | 486 | //merge populate_list && field_list with vardef |
487 | 487 | if (!empty($field['field_list']) && !empty($field['populate_list'])) { |
488 | 488 | for ($j=0; $j<count($field['field_list']); $j++) { |
489 | - //search for the same couple (field_list_item,populate_field_item) |
|
490 | - $field_list_item = $field['field_list'][$j]; |
|
491 | - $field_list_item_alternate = $qsd->form_name . '_' . $field['field_list'][$j]; |
|
492 | - $populate_list_item = $field['populate_list'][$j]; |
|
493 | - $found = false; |
|
494 | - for ($k=0; $k<count($sqs_objects[$name]['field_list']); $k++) { |
|
495 | - if (($field_list_item == $sqs_objects[$name]['populate_list'][$k] || $field_list_item_alternate == $sqs_objects[$name]['populate_list'][$k]) && //il faut inverser field_list et populate_list (cf lignes 465,466 ci-dessus) |
|
496 | - $populate_list_item == $sqs_objects[$name]['field_list'][$k]) { |
|
497 | - $found = true; |
|
498 | - break; |
|
499 | - } |
|
500 | - } |
|
501 | - if (!$found) { |
|
502 | - $sqs_objects[$name]['field_list'][] = $field['populate_list'][$j]; // as in lines 462 and 463 |
|
503 | - $sqs_objects[$name]['populate_list'][] = $field['field_list'][$j]; |
|
504 | - } |
|
505 | - } |
|
489 | + //search for the same couple (field_list_item,populate_field_item) |
|
490 | + $field_list_item = $field['field_list'][$j]; |
|
491 | + $field_list_item_alternate = $qsd->form_name . '_' . $field['field_list'][$j]; |
|
492 | + $populate_list_item = $field['populate_list'][$j]; |
|
493 | + $found = false; |
|
494 | + for ($k=0; $k<count($sqs_objects[$name]['field_list']); $k++) { |
|
495 | + if (($field_list_item == $sqs_objects[$name]['populate_list'][$k] || $field_list_item_alternate == $sqs_objects[$name]['populate_list'][$k]) && //il faut inverser field_list et populate_list (cf lignes 465,466 ci-dessus) |
|
496 | + $populate_list_item == $sqs_objects[$name]['field_list'][$k]) { |
|
497 | + $found = true; |
|
498 | + break; |
|
499 | + } |
|
500 | + } |
|
501 | + if (!$found) { |
|
502 | + $sqs_objects[$name]['field_list'][] = $field['populate_list'][$j]; // as in lines 462 and 463 |
|
503 | + $sqs_objects[$name]['populate_list'][] = $field['field_list'][$j]; |
|
504 | + } |
|
505 | + } |
|
506 | 506 | } |
507 | 507 | |
508 | 508 | } //foreach |
509 | 509 | } |
510 | 510 | |
511 | - //Implement QuickSearch for the field |
|
512 | - if(!empty($sqs_objects) && count($sqs_objects) > 0) { |
|
513 | - $quicksearch_js = '<script language="javascript">'; |
|
514 | - $quicksearch_js.= 'if(typeof sqs_objects == \'undefined\'){var sqs_objects = new Array;}'; |
|
515 | - $json = getJSONobj(); |
|
516 | - foreach($sqs_objects as $sqsfield=>$sqsfieldArray){ |
|
517 | - $quicksearch_js .= "sqs_objects['$sqsfield']={$json->encode($sqsfieldArray)};"; |
|
518 | - } |
|
519 | - return $quicksearch_js . '</script>'; |
|
520 | - } |
|
521 | - return ''; |
|
511 | + //Implement QuickSearch for the field |
|
512 | + if(!empty($sqs_objects) && count($sqs_objects) > 0) { |
|
513 | + $quicksearch_js = '<script language="javascript">'; |
|
514 | + $quicksearch_js.= 'if(typeof sqs_objects == \'undefined\'){var sqs_objects = new Array;}'; |
|
515 | + $json = getJSONobj(); |
|
516 | + foreach($sqs_objects as $sqsfield=>$sqsfieldArray){ |
|
517 | + $quicksearch_js .= "sqs_objects['$sqsfield']={$json->encode($sqsfieldArray)};"; |
|
518 | + } |
|
519 | + return $quicksearch_js . '</script>'; |
|
520 | + } |
|
521 | + return ''; |
|
522 | 522 | } |
523 | 523 | |
524 | 524 |
@@ -44,45 +44,45 @@ |
||
44 | 44 | */ |
45 | 45 | class ConnectorFactory{ |
46 | 46 | |
47 | - static $source_map = array(); |
|
47 | + static $source_map = array(); |
|
48 | 48 | |
49 | - public static function getInstance($source_name){ |
|
50 | - if(empty(self::$source_map[$source_name])) { |
|
51 | - require_once('include/connectors/sources/SourceFactory.php'); |
|
52 | - require_once('include/connectors/component.php'); |
|
53 | - $source = SourceFactory::getSource($source_name); |
|
54 | - $component = new component(); |
|
55 | - $component->setSource($source); |
|
56 | - $component->init(); |
|
57 | - self::$source_map[$source_name] = $component; |
|
58 | - } |
|
59 | - return self::$source_map[$source_name]; |
|
60 | - } |
|
49 | + public static function getInstance($source_name){ |
|
50 | + if(empty(self::$source_map[$source_name])) { |
|
51 | + require_once('include/connectors/sources/SourceFactory.php'); |
|
52 | + require_once('include/connectors/component.php'); |
|
53 | + $source = SourceFactory::getSource($source_name); |
|
54 | + $component = new component(); |
|
55 | + $component->setSource($source); |
|
56 | + $component->init(); |
|
57 | + self::$source_map[$source_name] = $component; |
|
58 | + } |
|
59 | + return self::$source_map[$source_name]; |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * Split the class name by _ and go through the class name |
|
64 | - * which represents the inheritance structure to load up all required parents. |
|
65 | - * @param string $class the root class we want to load. |
|
66 | - */ |
|
67 | - public static function load($class, $type){ |
|
68 | - self::loadClass($class, $type); |
|
69 | - } |
|
62 | + /** |
|
63 | + * Split the class name by _ and go through the class name |
|
64 | + * which represents the inheritance structure to load up all required parents. |
|
65 | + * @param string $class the root class we want to load. |
|
66 | + */ |
|
67 | + public static function load($class, $type){ |
|
68 | + self::loadClass($class, $type); |
|
69 | + } |
|
70 | 70 | |
71 | - /** |
|
72 | - * include a source class file. |
|
73 | - * @param string $class a class file to include. |
|
74 | - */ |
|
75 | - public static function loadClass($class, $type){ |
|
76 | - $dir = str_replace('_','/',$class); |
|
77 | - $parts = explode("/", $dir); |
|
78 | - $file = $parts[count($parts)-1] . '.php'; |
|
79 | - if(file_exists("custom/modules/Connectors/connectors/{$type}/{$dir}/$file")){ |
|
80 | - require_once("custom/modules/Connectors/connectors/{$type}/{$dir}/$file"); |
|
81 | - } else if(file_exists("modules/Connectors/connectors/{$type}/{$dir}/$file")) { |
|
82 | - require_once("modules/Connectors/connectors/{$type}/{$dir}/$file"); |
|
83 | - } else if(file_exists("connectors/{$type}/{$dir}/$file")) { |
|
84 | - require_once("connectors/{$type}/{$dir}/$file"); |
|
85 | - } |
|
86 | - } |
|
71 | + /** |
|
72 | + * include a source class file. |
|
73 | + * @param string $class a class file to include. |
|
74 | + */ |
|
75 | + public static function loadClass($class, $type){ |
|
76 | + $dir = str_replace('_','/',$class); |
|
77 | + $parts = explode("/", $dir); |
|
78 | + $file = $parts[count($parts)-1] . '.php'; |
|
79 | + if(file_exists("custom/modules/Connectors/connectors/{$type}/{$dir}/$file")){ |
|
80 | + require_once("custom/modules/Connectors/connectors/{$type}/{$dir}/$file"); |
|
81 | + } else if(file_exists("modules/Connectors/connectors/{$type}/{$dir}/$file")) { |
|
82 | + require_once("modules/Connectors/connectors/{$type}/{$dir}/$file"); |
|
83 | + } else if(file_exists("connectors/{$type}/{$dir}/$file")) { |
|
84 | + require_once("connectors/{$type}/{$dir}/$file"); |
|
85 | + } |
|
86 | + } |
|
87 | 87 | } |
88 | 88 | ?> |
89 | 89 | \ No newline at end of file |
@@ -125,11 +125,11 @@ discard block |
||
125 | 125 | |
126 | 126 | //For the ajaxUI, we need to use output buffering to return the page in an ajax friendly format |
127 | 127 | if ($this->_getOption('json_output')){ |
128 | - ob_start(); |
|
129 | - if(!empty($_REQUEST['ajax_load']) && !empty($_REQUEST['loadLanguageJS'])) { |
|
130 | - echo $this->_getModLanguageJS(); |
|
131 | - } |
|
132 | - } |
|
128 | + ob_start(); |
|
129 | + if(!empty($_REQUEST['ajax_load']) && !empty($_REQUEST['loadLanguageJS'])) { |
|
130 | + echo $this->_getModLanguageJS(); |
|
131 | + } |
|
132 | + } |
|
133 | 133 | |
134 | 134 | if ($this->_getOption('show_header')) { |
135 | 135 | $this->displayHeader(); |
@@ -175,11 +175,11 @@ discard block |
||
175 | 175 | $module = $this->module; |
176 | 176 | $ajax_ret = array( |
177 | 177 | 'content' => mb_detect_encoding($content) == "UTF-8" ? $content : utf8_encode($content), |
178 | - 'menu' => array( |
|
179 | - 'module' => $module, |
|
180 | - 'label' => translate($module), |
|
181 | - $this->getMenu($module), |
|
182 | - ), |
|
178 | + 'menu' => array( |
|
179 | + 'module' => $module, |
|
180 | + 'label' => translate($module), |
|
181 | + $this->getMenu($module), |
|
182 | + ), |
|
183 | 183 | 'title' => $this->getBrowserTitle(), |
184 | 184 | 'action' => isset($_REQUEST['action']) ? $_REQUEST['action'] : "", |
185 | 185 | 'record' => isset($_REQUEST['record']) ? $_REQUEST['record'] : "", |
@@ -422,10 +422,10 @@ discard block |
||
422 | 422 | "URL" => current($attributevalue), |
423 | 423 | "SUBMENU" => array(), |
424 | 424 | ); |
425 | - if(substr($gcls[$key]["URL"], 0, 11) == "javascript:") { |
|
426 | - $gcls[$key]["ONCLICK"] = substr($gcls[$key]["URL"],11); |
|
427 | - $gcls[$key]["URL"] = "javascript:void(0)"; |
|
428 | - } |
|
425 | + if(substr($gcls[$key]["URL"], 0, 11) == "javascript:") { |
|
426 | + $gcls[$key]["ONCLICK"] = substr($gcls[$key]["URL"],11); |
|
427 | + $gcls[$key]["URL"] = "javascript:void(0)"; |
|
428 | + } |
|
429 | 429 | } |
430 | 430 | // and now the sublinks |
431 | 431 | if ( $linkattribute == 'submenu' && is_array($attributevalue) ) { |
@@ -434,10 +434,10 @@ discard block |
||
434 | 434 | "LABEL" => key($submenulinkinfo), |
435 | 435 | "URL" => current($submenulinkinfo), |
436 | 436 | ); |
437 | - if(substr($gcls[$key]['SUBMENU'][$submenulinkkey]["URL"], 0, 11) == "javascript:") { |
|
438 | - $gcls[$key]['SUBMENU'][$submenulinkkey]["ONCLICK"] = substr($gcls[$key]['SUBMENU'][$submenulinkkey]["URL"],11); |
|
439 | - $gcls[$key]['SUBMENU'][$submenulinkkey]["URL"] = "javascript:void(0)"; |
|
440 | - } |
|
437 | + if(substr($gcls[$key]['SUBMENU'][$submenulinkkey]["URL"], 0, 11) == "javascript:") { |
|
438 | + $gcls[$key]['SUBMENU'][$submenulinkkey]["ONCLICK"] = substr($gcls[$key]['SUBMENU'][$submenulinkkey]["URL"],11); |
|
439 | + $gcls[$key]['SUBMENU'][$submenulinkkey]["URL"] = "javascript:void(0)"; |
|
440 | + } |
|
441 | 441 | } |
442 | 442 | } |
443 | 443 | } |
@@ -665,14 +665,14 @@ discard block |
||
665 | 665 | $ss->assign("shortcutExtraMenu",$shortcutExtraMenu); |
666 | 666 | } |
667 | 667 | |
668 | - if(!empty($current_user)){ |
|
669 | - $ss->assign("max_tabs", $current_user->getPreference("max_tabs")); |
|
670 | - } |
|
668 | + if(!empty($current_user)){ |
|
669 | + $ss->assign("max_tabs", $current_user->getPreference("max_tabs")); |
|
670 | + } |
|
671 | 671 | |
672 | 672 | |
673 | 673 | $imageURL = SugarThemeRegistry::current()->getImageURL("dashboard.png"); |
674 | 674 | $homeImage = "<img src='$imageURL'>"; |
675 | - $ss->assign("homeImage",$homeImage); |
|
675 | + $ss->assign("homeImage",$homeImage); |
|
676 | 676 | global $mod_strings; |
677 | 677 | $mod_strings = $bakModStrings; |
678 | 678 | $headerTpl = $themeObject->getTemplate('header.tpl'); |
@@ -777,12 +777,12 @@ discard block |
||
777 | 777 | list ($num_grp_sep, $dec_sep) = get_number_seperators(); |
778 | 778 | |
779 | 779 | $the_script = "<script type=\"text/javascript\">\n" . "\tvar time_reg_format = '" . |
780 | - $timereg['format'] . "';\n" . "\tvar date_reg_format = '" . |
|
781 | - $datereg['format'] . "';\n" . "\tvar date_reg_positions = { $date_pos };\n" . |
|
782 | - "\tvar time_separator = '$time_separator';\n" . |
|
783 | - "\tvar cal_date_format = '$cal_date_format';\n" . |
|
784 | - "\tvar time_offset = $hour_offset;\n" . "\tvar num_grp_sep = '$num_grp_sep';\n" . |
|
785 | - "\tvar dec_sep = '$dec_sep';\n" . "</script>"; |
|
780 | + $timereg['format'] . "';\n" . "\tvar date_reg_format = '" . |
|
781 | + $datereg['format'] . "';\n" . "\tvar date_reg_positions = { $date_pos };\n" . |
|
782 | + "\tvar time_separator = '$time_separator';\n" . |
|
783 | + "\tvar cal_date_format = '$cal_date_format';\n" . |
|
784 | + "\tvar time_offset = $hour_offset;\n" . "\tvar num_grp_sep = '$num_grp_sep';\n" . |
|
785 | + "\tvar dec_sep = '$dec_sep';\n" . "</script>"; |
|
786 | 786 | |
787 | 787 | return $the_script; |
788 | 788 | } |
@@ -847,7 +847,7 @@ discard block |
||
847 | 847 | } |
848 | 848 | echo getVersionedScript('cache/jsLanguage/'. $GLOBALS['current_language'] . '.js', $GLOBALS['sugar_config']['js_lang_version']); |
849 | 849 | |
850 | - echo $this->_getModLanguageJS(); |
|
850 | + echo $this->_getModLanguageJS(); |
|
851 | 851 | |
852 | 852 | if(isset( $sugar_config['disc_client']) && $sugar_config['disc_client']) |
853 | 853 | echo getVersionedScript('modules/Sync/headersync.js'); |
@@ -863,13 +863,13 @@ discard block |
||
863 | 863 | } |
864 | 864 | } |
865 | 865 | |
866 | - protected function _getModLanguageJS(){ |
|
867 | - if (!is_file(sugar_cached('jsLanguage/') . $this->module . '/' . $GLOBALS['current_language'] . '.js')) { |
|
868 | - require_once ('include/language/jsLanguage.php'); |
|
869 | - jsLanguage::createModuleStringsCache($this->module, $GLOBALS['current_language']); |
|
870 | - } |
|
871 | - return getVersionedScript("cache/jsLanguage/{$this->module}/". $GLOBALS['current_language'] . '.js', $GLOBALS['sugar_config']['js_lang_version']); |
|
872 | - } |
|
866 | + protected function _getModLanguageJS(){ |
|
867 | + if (!is_file(sugar_cached('jsLanguage/') . $this->module . '/' . $GLOBALS['current_language'] . '.js')) { |
|
868 | + require_once ('include/language/jsLanguage.php'); |
|
869 | + jsLanguage::createModuleStringsCache($this->module, $GLOBALS['current_language']); |
|
870 | + } |
|
871 | + return getVersionedScript("cache/jsLanguage/{$this->module}/". $GLOBALS['current_language'] . '.js', $GLOBALS['sugar_config']['js_lang_version']); |
|
872 | + } |
|
873 | 873 | |
874 | 874 | /** |
875 | 875 | * Called from process(). This method will display the footer on the page. |
@@ -882,7 +882,7 @@ discard block |
||
882 | 882 | global $sugar_config; |
883 | 883 | global $app_strings; |
884 | 884 | global $mod_strings; |
885 | - $themeObject = SugarThemeRegistry::current(); |
|
885 | + $themeObject = SugarThemeRegistry::current(); |
|
886 | 886 | //decide whether or not to show themepicker, default is to show |
887 | 887 | $showThemePicker = true; |
888 | 888 | if (isset($sugar_config['showThemePicker'])) { |
@@ -893,30 +893,30 @@ discard block |
||
893 | 893 | $ss->assign("AUTHENTICATED",isset($_SESSION["authenticated_user_id"])); |
894 | 894 | $ss->assign('MOD',return_module_language($GLOBALS['current_language'], 'Users')); |
895 | 895 | |
896 | - $bottomLinkList = array(); |
|
897 | - if (isset($this->action) && $this->action != "EditView") { |
|
898 | - $bottomLinkList['print'] = array($app_strings['LNK_PRINT'] => getPrintLink()); |
|
899 | - } |
|
900 | - $bottomLinkList['backtotop'] = array($app_strings['LNK_BACKTOTOP'] => 'javascript:SUGAR.util.top();'); |
|
901 | - |
|
902 | - $bottomLinksStr = ""; |
|
903 | - foreach($bottomLinkList as $key => $value) { |
|
904 | - foreach($value as $text => $link) { |
|
905 | - $href = $link; |
|
906 | - if(substr($link, 0, 11) == "javascript:") { |
|
907 | - $onclick = " onclick=\"".substr($link,11)."\""; |
|
908 | - $href = "javascript:void(0)"; |
|
909 | - } else { |
|
910 | - $onclick = ""; |
|
911 | - } |
|
896 | + $bottomLinkList = array(); |
|
897 | + if (isset($this->action) && $this->action != "EditView") { |
|
898 | + $bottomLinkList['print'] = array($app_strings['LNK_PRINT'] => getPrintLink()); |
|
899 | + } |
|
900 | + $bottomLinkList['backtotop'] = array($app_strings['LNK_BACKTOTOP'] => 'javascript:SUGAR.util.top();'); |
|
901 | + |
|
902 | + $bottomLinksStr = ""; |
|
903 | + foreach($bottomLinkList as $key => $value) { |
|
904 | + foreach($value as $text => $link) { |
|
905 | + $href = $link; |
|
906 | + if(substr($link, 0, 11) == "javascript:") { |
|
907 | + $onclick = " onclick=\"".substr($link,11)."\""; |
|
908 | + $href = "javascript:void(0)"; |
|
909 | + } else { |
|
910 | + $onclick = ""; |
|
911 | + } |
|
912 | 912 | $imageURL = SugarThemeRegistry::current()->getImageURL($key.'.gif'); |
913 | - $bottomLinksStr .= "<a href=\"{$href}\""; |
|
914 | - $bottomLinksStr .= (isset($onclick)) ? $onclick : ""; |
|
915 | - $bottomLinksStr .= "><img src='{$imageURL}' alt=''>"; //keeping alt blank on purpose for 508 (text will be read instead) |
|
916 | - $bottomLinksStr .= " ".$text."</a>"; |
|
917 | - } |
|
918 | - } |
|
919 | - $ss->assign("BOTTOMLINKS",$bottomLinksStr); |
|
913 | + $bottomLinksStr .= "<a href=\"{$href}\""; |
|
914 | + $bottomLinksStr .= (isset($onclick)) ? $onclick : ""; |
|
915 | + $bottomLinksStr .= "><img src='{$imageURL}' alt=''>"; //keeping alt blank on purpose for 508 (text will be read instead) |
|
916 | + $bottomLinksStr .= " ".$text."</a>"; |
|
917 | + } |
|
918 | + } |
|
919 | + $ss->assign("BOTTOMLINKS",$bottomLinksStr); |
|
920 | 920 | if (SugarConfig::getInstance()->get('calculate_response_time', false)) |
921 | 921 | $ss->assign('STATISTICS',$this->_getStatistics()); |
922 | 922 | |
@@ -946,7 +946,7 @@ discard block |
||
946 | 946 | $attribLinkImg = "<img style='margin-top: 2px' border='0' width='120' height='34' src='include/images/poweredby_sugarcrm_65.png' alt='Powered By SugarCRM'>\n"; |
947 | 947 | |
948 | 948 | |
949 | - // handle resizing of the company logo correctly on the fly |
|
949 | + // handle resizing of the company logo correctly on the fly |
|
950 | 950 | $companyLogoURL = $themeObject->getImageURL('company_logo.png'); |
951 | 951 | $companyLogoURL_arr = explode('?', $companyLogoURL); |
952 | 952 | $companyLogoURL = $companyLogoURL_arr[0]; |
@@ -1069,7 +1069,7 @@ discard block |
||
1069 | 1069 | |
1070 | 1070 | |
1071 | 1071 | $trackerManager = TrackerManager::getInstance(); |
1072 | - $trackerManager->save(); |
|
1072 | + $trackerManager->save(); |
|
1073 | 1073 | |
1074 | 1074 | } |
1075 | 1075 | |
@@ -1109,7 +1109,7 @@ discard block |
||
1109 | 1109 | $deltaTime = $endTime - $GLOBALS['startTime']; |
1110 | 1110 | $response_time_string = $GLOBALS['app_strings']['LBL_SERVER_RESPONSE_TIME'] . ' ' . number_format(round($deltaTime, 2), 2) . ' ' . $GLOBALS['app_strings']['LBL_SERVER_RESPONSE_TIME_SECONDS']; |
1111 | 1111 | $return = $response_time_string; |
1112 | - // $return .= '<br />'; |
|
1112 | + // $return .= '<br />'; |
|
1113 | 1113 | if (!empty($GLOBALS['sugar_config']['show_page_resources'])) { |
1114 | 1114 | // Print out the resources used in constructing the page. |
1115 | 1115 | $included_files = get_included_files(); |
@@ -1170,8 +1170,8 @@ discard block |
||
1170 | 1170 | { |
1171 | 1171 | $data = array |
1172 | 1172 | ( |
1173 | - !empty($this->module) ? $this->module : $GLOBALS['app_strings']['LBL_LINK_NONE'], |
|
1174 | - !empty($this->action) ? $this->action : $GLOBALS['app_strings']['LBL_LINK_NONE'], |
|
1173 | + !empty($this->module) ? $this->module : $GLOBALS['app_strings']['LBL_LINK_NONE'], |
|
1174 | + !empty($this->action) ? $this->action : $GLOBALS['app_strings']['LBL_LINK_NONE'], |
|
1175 | 1175 | ); |
1176 | 1176 | |
1177 | 1177 | $output = string_format($GLOBALS['app_strings']['LBL_SERVER_MEMORY_LOG_MESSAGE'], $data) . $newline; |
@@ -1240,15 +1240,15 @@ discard block |
||
1240 | 1240 | } |
1241 | 1241 | |
1242 | 1242 | /** |
1243 | - * Returns the module name which should be highlighted in the module menu |
|
1243 | + * Returns the module name which should be highlighted in the module menu |
|
1244 | 1244 | */ |
1245 | 1245 | protected function _getModuleTab() |
1246 | 1246 | { |
1247 | 1247 | global $app_list_strings, $moduleTabMap, $current_user; |
1248 | 1248 | |
1249 | - $userTabs = query_module_access_list($current_user); |
|
1250 | - //If the home tab is in the user array use it as the default tab, otherwise use the first element in the tab array |
|
1251 | - $defaultTab = (in_array("Home",$userTabs)) ? "Home" : key($userTabs); |
|
1249 | + $userTabs = query_module_access_list($current_user); |
|
1250 | + //If the home tab is in the user array use it as the default tab, otherwise use the first element in the tab array |
|
1251 | + $defaultTab = (in_array("Home",$userTabs)) ? "Home" : key($userTabs); |
|
1252 | 1252 | |
1253 | 1253 | // Need to figure out what tab this module belongs to, most modules have their own tabs, but there are exceptions. |
1254 | 1254 | if ( !empty($_REQUEST['module_tab']) ) |
@@ -1264,17 +1264,17 @@ discard block |
||
1264 | 1264 | elseif ( !isset($app_list_strings['moduleList'][$this->module]) ) |
1265 | 1265 | return $defaultTab; |
1266 | 1266 | elseif ( isset($_REQUEST['action']) && $_REQUEST['action'] == "ajaxui" ) |
1267 | - return $defaultTab; |
|
1267 | + return $defaultTab; |
|
1268 | 1268 | else |
1269 | 1269 | return $this->module; |
1270 | 1270 | } |
1271 | 1271 | |
1272 | - /** |
|
1273 | - * Return the "breadcrumbs" to display at the top of the page |
|
1274 | - * |
|
1275 | - * @param bool $show_help optional, true if we show the help links |
|
1276 | - * @return HTML string containing breadcrumb title |
|
1277 | - */ |
|
1272 | + /** |
|
1273 | + * Return the "breadcrumbs" to display at the top of the page |
|
1274 | + * |
|
1275 | + * @param bool $show_help optional, true if we show the help links |
|
1276 | + * @return HTML string containing breadcrumb title |
|
1277 | + */ |
|
1278 | 1278 | public function getModuleTitle( |
1279 | 1279 | $show_help = true |
1280 | 1280 | ) |
@@ -1288,13 +1288,13 @@ discard block |
||
1288 | 1288 | $params = $this->_getModuleTitleParams(); |
1289 | 1289 | $index = 0; |
1290 | 1290 | |
1291 | - if(SugarThemeRegistry::current()->directionality == "rtl") { |
|
1292 | - $params = array_reverse($params); |
|
1293 | - } |
|
1294 | - if(count($params) > 1) { |
|
1295 | - array_shift($params); |
|
1296 | - } |
|
1297 | - $count = count($params); |
|
1291 | + if(SugarThemeRegistry::current()->directionality == "rtl") { |
|
1292 | + $params = array_reverse($params); |
|
1293 | + } |
|
1294 | + if(count($params) > 1) { |
|
1295 | + array_shift($params); |
|
1296 | + } |
|
1297 | + $count = count($params); |
|
1298 | 1298 | $paramString = ''; |
1299 | 1299 | foreach($params as $parm){ |
1300 | 1300 | $index++; |
@@ -1305,13 +1305,13 @@ discard block |
||
1305 | 1305 | } |
1306 | 1306 | |
1307 | 1307 | if(!empty($paramString)){ |
1308 | - $theTitle .= "<h2> $paramString </h2>"; |
|
1308 | + $theTitle .= "<h2> $paramString </h2>"; |
|
1309 | 1309 | |
1310 | 1310 | if($this->type == "detail"){ |
1311 | 1311 | $theTitle .= "<div class='favorite' record_id='" . $this->bean->id . "' module='" . $this->bean->module_dir . "'><div class='favorite_icon_outline'>" . SugarThemeRegistry::current()->getImage('favorite-star-outline','title="' . translate('LBL_DASHLET_EDIT', 'Home') . '" border="0" align="absmiddle"', null,null,'.gif',translate('LBL_DASHLET_EDIT', 'Home')) . "</div> |
1312 | 1312 | <div class='favorite_icon_fill'>" . SugarThemeRegistry::current()->getImage('favorite-star','title="' . translate('LBL_DASHLET_EDIT', 'Home') . '" border="0" align="absmiddle"', null,null,'.gif',translate('LBL_DASHLET_EDIT', 'Home')) . "</div></div>"; |
1313 | 1313 | } |
1314 | - } |
|
1314 | + } |
|
1315 | 1315 | |
1316 | 1316 | // bug 56131 - restore conditional so that link doesn't appear where it shouldn't |
1317 | 1317 | if($show_help || $this->type == 'list') { |
@@ -1384,7 +1384,7 @@ discard block |
||
1384 | 1384 | protected function _getModuleTitleParams($browserTitle = false) |
1385 | 1385 | { |
1386 | 1386 | $params = array($this->_getModuleTitleListParam($browserTitle)); |
1387 | - //$params = array(); |
|
1387 | + //$params = array(); |
|
1388 | 1388 | if (isset($this->action)){ |
1389 | 1389 | switch ($this->action) { |
1390 | 1390 | case 'EditView': |
@@ -1414,48 +1414,48 @@ discard block |
||
1414 | 1414 | */ |
1415 | 1415 | protected function _getModuleTitleListParam( $browserTitle = false ) |
1416 | 1416 | { |
1417 | - global $current_user; |
|
1418 | - global $app_strings; |
|
1419 | - |
|
1420 | - if(!empty($GLOBALS['app_list_strings']['moduleList'][$this->module])) |
|
1421 | - $firstParam = $GLOBALS['app_list_strings']['moduleList'][$this->module]; |
|
1422 | - else |
|
1423 | - $firstParam = $this->module; |
|
1424 | - |
|
1425 | - $iconPath = $this->getModuleTitleIconPath($this->module); |
|
1426 | - if($this->action == "ListView" || $this->action == "index") { |
|
1427 | - if (!empty($iconPath) && !$browserTitle) { |
|
1428 | - if (SugarThemeRegistry::current()->directionality == "ltr") { |
|
1429 | - return $app_strings['LBL_SEARCH']." " |
|
1430 | - . "$firstParam"; |
|
1431 | - |
|
1432 | - } else { |
|
1433 | - return "$firstParam" |
|
1434 | - . " ".$app_strings['LBL_SEARCH']; |
|
1435 | - } |
|
1436 | - } else { |
|
1437 | - return $firstParam; |
|
1438 | - } |
|
1439 | - } |
|
1440 | - else { |
|
1441 | - if (!empty($iconPath) && !$browserTitle) { |
|
1442 | - //return "<a href='index.php?module={$this->module}&action=index'>$this->module</a>"; |
|
1443 | - } else { |
|
1444 | - return $firstParam; |
|
1445 | - } |
|
1446 | - } |
|
1417 | + global $current_user; |
|
1418 | + global $app_strings; |
|
1419 | + |
|
1420 | + if(!empty($GLOBALS['app_list_strings']['moduleList'][$this->module])) |
|
1421 | + $firstParam = $GLOBALS['app_list_strings']['moduleList'][$this->module]; |
|
1422 | + else |
|
1423 | + $firstParam = $this->module; |
|
1424 | + |
|
1425 | + $iconPath = $this->getModuleTitleIconPath($this->module); |
|
1426 | + if($this->action == "ListView" || $this->action == "index") { |
|
1427 | + if (!empty($iconPath) && !$browserTitle) { |
|
1428 | + if (SugarThemeRegistry::current()->directionality == "ltr") { |
|
1429 | + return $app_strings['LBL_SEARCH']." " |
|
1430 | + . "$firstParam"; |
|
1431 | + |
|
1432 | + } else { |
|
1433 | + return "$firstParam" |
|
1434 | + . " ".$app_strings['LBL_SEARCH']; |
|
1435 | + } |
|
1436 | + } else { |
|
1437 | + return $firstParam; |
|
1438 | + } |
|
1439 | + } |
|
1440 | + else { |
|
1441 | + if (!empty($iconPath) && !$browserTitle) { |
|
1442 | + //return "<a href='index.php?module={$this->module}&action=index'>$this->module</a>"; |
|
1443 | + } else { |
|
1444 | + return $firstParam; |
|
1445 | + } |
|
1446 | + } |
|
1447 | 1447 | } |
1448 | 1448 | |
1449 | 1449 | protected function getModuleTitleIconPath($module) |
1450 | 1450 | { |
1451 | - $iconPath = ""; |
|
1452 | - if(is_file(SugarThemeRegistry::current()->getImageURL('icon_'.$module.'_32.png',false))) { |
|
1453 | - $iconPath = SugarThemeRegistry::current()->getImageURL('icon_'.$module.'_32.png'); |
|
1454 | - } |
|
1455 | - else if (is_file(SugarThemeRegistry::current()->getImageURL('icon_'.ucfirst($module).'_32.png',false))) { |
|
1456 | - $iconPath = SugarThemeRegistry::current()->getImageURL('icon_'.ucfirst($module).'_32.png'); |
|
1457 | - } |
|
1458 | - return $iconPath; |
|
1451 | + $iconPath = ""; |
|
1452 | + if(is_file(SugarThemeRegistry::current()->getImageURL('icon_'.$module.'_32.png',false))) { |
|
1453 | + $iconPath = SugarThemeRegistry::current()->getImageURL('icon_'.$module.'_32.png'); |
|
1454 | + } |
|
1455 | + else if (is_file(SugarThemeRegistry::current()->getImageURL('icon_'.ucfirst($module).'_32.png',false))) { |
|
1456 | + $iconPath = SugarThemeRegistry::current()->getImageURL('icon_'.ucfirst($module).'_32.png'); |
|
1457 | + } |
|
1458 | + return $iconPath; |
|
1459 | 1459 | } |
1460 | 1460 | |
1461 | 1461 | /** |
@@ -1485,11 +1485,11 @@ discard block |
||
1485 | 1485 | */ |
1486 | 1486 | public function getBreadCrumbSymbol() |
1487 | 1487 | { |
1488 | - if(SugarThemeRegistry::current()->directionality == "ltr") { |
|
1489 | - return "<span class='pointer'>»</span>"; |
|
1488 | + if(SugarThemeRegistry::current()->directionality == "ltr") { |
|
1489 | + return "<span class='pointer'>»</span>"; |
|
1490 | 1490 | } |
1491 | 1491 | else { |
1492 | - return "<span class='pointer'>«</span>"; |
|
1492 | + return "<span class='pointer'>«</span>"; |
|
1493 | 1493 | } |
1494 | 1494 | } |
1495 | 1495 | |
@@ -1658,20 +1658,20 @@ discard block |
||
1658 | 1658 | } |
1659 | 1659 | |
1660 | 1660 | /** |
1661 | - * Determines whether the state of the post global array indicates there was an error uploading a |
|
1661 | + * Determines whether the state of the post global array indicates there was an error uploading a |
|
1662 | 1662 | * file that exceeds the post_max_size setting. Such an error can be detected if: |
1663 | 1663 | * 1. The Server['REQUEST_METHOD'] will still point to POST |
1664 | 1664 | * 2. POST and FILES global arrays will be returned empty despite the request method |
1665 | 1665 | * This also results in a redirect to the home page (due to lack of module and action in POST) |
1666 | 1666 | * |
1667 | - * @return boolean indicating true or false |
|
1668 | - */ |
|
1667 | + * @return boolean indicating true or false |
|
1668 | + */ |
|
1669 | 1669 | public function checkPostMaxSizeError(){ |
1670 | - //if the referrer is post, and the post array is empty, then an error has occurred, most likely |
|
1671 | - //while uploading a file that exceeds the post_max_size. |
|
1672 | - if(empty($_FILES) && empty($_POST) && isset($_SERVER['REQUEST_METHOD']) && strtolower($_SERVER['REQUEST_METHOD']) == 'post'){ |
|
1673 | - $GLOBALS['log']->fatal($GLOBALS['app_strings']['UPLOAD_ERROR_HOME_TEXT']); |
|
1674 | - return true; |
|
1670 | + //if the referrer is post, and the post array is empty, then an error has occurred, most likely |
|
1671 | + //while uploading a file that exceeds the post_max_size. |
|
1672 | + if(empty($_FILES) && empty($_POST) && isset($_SERVER['REQUEST_METHOD']) && strtolower($_SERVER['REQUEST_METHOD']) == 'post'){ |
|
1673 | + $GLOBALS['log']->fatal($GLOBALS['app_strings']['UPLOAD_ERROR_HOME_TEXT']); |
|
1674 | + return true; |
|
1675 | 1675 | } |
1676 | 1676 | return false; |
1677 | 1677 | } |
@@ -44,43 +44,43 @@ |
||
44 | 44 | */ |
45 | 45 | class ControllerFactory |
46 | 46 | { |
47 | - /** |
|
48 | - * Obtain an instance of the correct controller. |
|
49 | - * |
|
50 | - * @return an instance of SugarController |
|
51 | - */ |
|
52 | - static function getController($module){ |
|
53 | - $class = ucfirst($module).'Controller'; |
|
54 | - $customClass = 'Custom' . $class; |
|
55 | - if(file_exists('custom/modules/'.$module.'/controller.php')){ |
|
56 | - $customClass = 'Custom' . $class; |
|
57 | - require_once('custom/modules/'.$module.'/controller.php'); |
|
58 | - if(class_exists($customClass)){ |
|
59 | - $controller = new $customClass(); |
|
60 | - }else if(class_exists($class)){ |
|
61 | - $controller = new $class(); |
|
62 | - } |
|
63 | - }elseif(file_exists('modules/'.$module.'/controller.php')){ |
|
64 | - require_once('modules/'.$module.'/controller.php'); |
|
65 | - if(class_exists($customClass)){ |
|
66 | - $controller = new $customClass(); |
|
67 | - }else if(class_exists($class)){ |
|
68 | - $controller = new $class(); |
|
69 | - } |
|
70 | - }else{ |
|
71 | - if(file_exists('custom/include/MVC/Controller/SugarController.php')){ |
|
72 | - require_once('custom/include/MVC/Controller/SugarController.php'); |
|
73 | - } |
|
74 | - if(class_exists('CustomSugarController')){ |
|
75 | - $controller = new CustomSugarController(); |
|
76 | - }else{ |
|
77 | - $controller = new SugarController(); |
|
78 | - } |
|
79 | - } |
|
80 | - //setup the controller |
|
81 | - $controller->setup($module); |
|
82 | - return $controller; |
|
83 | - } |
|
47 | + /** |
|
48 | + * Obtain an instance of the correct controller. |
|
49 | + * |
|
50 | + * @return an instance of SugarController |
|
51 | + */ |
|
52 | + static function getController($module){ |
|
53 | + $class = ucfirst($module).'Controller'; |
|
54 | + $customClass = 'Custom' . $class; |
|
55 | + if(file_exists('custom/modules/'.$module.'/controller.php')){ |
|
56 | + $customClass = 'Custom' . $class; |
|
57 | + require_once('custom/modules/'.$module.'/controller.php'); |
|
58 | + if(class_exists($customClass)){ |
|
59 | + $controller = new $customClass(); |
|
60 | + }else if(class_exists($class)){ |
|
61 | + $controller = new $class(); |
|
62 | + } |
|
63 | + }elseif(file_exists('modules/'.$module.'/controller.php')){ |
|
64 | + require_once('modules/'.$module.'/controller.php'); |
|
65 | + if(class_exists($customClass)){ |
|
66 | + $controller = new $customClass(); |
|
67 | + }else if(class_exists($class)){ |
|
68 | + $controller = new $class(); |
|
69 | + } |
|
70 | + }else{ |
|
71 | + if(file_exists('custom/include/MVC/Controller/SugarController.php')){ |
|
72 | + require_once('custom/include/MVC/Controller/SugarController.php'); |
|
73 | + } |
|
74 | + if(class_exists('CustomSugarController')){ |
|
75 | + $controller = new CustomSugarController(); |
|
76 | + }else{ |
|
77 | + $controller = new SugarController(); |
|
78 | + } |
|
79 | + } |
|
80 | + //setup the controller |
|
81 | + $controller->setup($module); |
|
82 | + return $controller; |
|
83 | + } |
|
84 | 84 | |
85 | 85 | } |
86 | 86 | ?> |
87 | 87 | \ No newline at end of file |