@@ -43,12 +43,12 @@ |
||
43 | 43 | |
44 | 44 | class SugarWidgetFielduser_name extends SugarWidgetFieldname |
45 | 45 | { |
46 | - function displayInput(&$layout_def) |
|
47 | - { |
|
46 | + function displayInput(&$layout_def) |
|
47 | + { |
|
48 | 48 | $selected_users = empty($layout_def['input_name0']) ? '' : $layout_def['input_name0']; |
49 | - $str = '<select multiple="true" size="3" name="' . $layout_def['name'] . '[]">' . get_select_options_with_id(get_user_array(false), $selected_users) . '</select>'; |
|
50 | - return $str; |
|
51 | - } |
|
49 | + $str = '<select multiple="true" size="3" name="' . $layout_def['name'] . '[]">' . get_select_options_with_id(get_user_array(false), $selected_users) . '</select>'; |
|
50 | + return $str; |
|
51 | + } |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | ?> |
@@ -45,77 +45,77 @@ discard block |
||
45 | 45 | |
46 | 46 | class SugarWidgetSubPanelIcon extends SugarWidgetField |
47 | 47 | { |
48 | - function displayHeaderCell($layout_def) |
|
49 | - { |
|
50 | - return ' '; |
|
51 | - } |
|
52 | - |
|
53 | - function displayList($layout_def) |
|
54 | - { |
|
55 | - global $app_strings; |
|
56 | - global $app_list_strings; |
|
57 | - global $current_user; |
|
58 | - |
|
59 | - if(isset($layout_def['varname'])) |
|
60 | - { |
|
61 | - $key = strtoupper($layout_def['varname']); |
|
62 | - } |
|
63 | - else |
|
64 | - { |
|
65 | - $key = $this->_get_column_alias($layout_def); |
|
66 | - $key = strtoupper($key); |
|
67 | - } |
|
48 | + function displayHeaderCell($layout_def) |
|
49 | + { |
|
50 | + return ' '; |
|
51 | + } |
|
52 | + |
|
53 | + function displayList($layout_def) |
|
54 | + { |
|
55 | + global $app_strings; |
|
56 | + global $app_list_strings; |
|
57 | + global $current_user; |
|
58 | + |
|
59 | + if(isset($layout_def['varname'])) |
|
60 | + { |
|
61 | + $key = strtoupper($layout_def['varname']); |
|
62 | + } |
|
63 | + else |
|
64 | + { |
|
65 | + $key = $this->_get_column_alias($layout_def); |
|
66 | + $key = strtoupper($key); |
|
67 | + } |
|
68 | 68 | //add module image |
69 | - //add module image |
|
70 | - if(!empty($layout_def['target_module_key'])) { |
|
71 | - if (!empty($layout_def['fields'][strtoupper($layout_def['target_module_key'])])) { |
|
72 | - $module=$layout_def['fields'][strtoupper($layout_def['target_module_key'])]; |
|
73 | - } |
|
74 | - } |
|
69 | + //add module image |
|
70 | + if(!empty($layout_def['target_module_key'])) { |
|
71 | + if (!empty($layout_def['fields'][strtoupper($layout_def['target_module_key'])])) { |
|
72 | + $module=$layout_def['fields'][strtoupper($layout_def['target_module_key'])]; |
|
73 | + } |
|
74 | + } |
|
75 | 75 | |
76 | 76 | if (empty($module)) { |
77 | - if(empty($layout_def['target_module'])) |
|
78 | - { |
|
79 | - $module = $layout_def['module']; |
|
80 | - } |
|
81 | - else |
|
82 | - { |
|
83 | - $module = $layout_def['target_module']; |
|
84 | - } |
|
85 | - } |
|
86 | - $action = 'DetailView'; |
|
87 | - if(empty($layout_def['target_record_key'])) |
|
88 | - { |
|
89 | - $record = $layout_def['fields']['ID']; |
|
90 | - } |
|
91 | - else |
|
92 | - { |
|
93 | - $record_key = strtoupper($layout_def['target_record_key']); |
|
94 | - $record = $layout_def['fields'][$record_key]; |
|
95 | - } |
|
96 | - $action_access = false; |
|
97 | - if(!empty($record) && |
|
98 | - ($layout_def[$action] && !$layout_def['owner_module'] |
|
99 | - || $layout_def[$action] && !ACLController::moduleSupportsACL($layout_def['owner_module']) |
|
100 | - || ACLController::checkAccess($layout_def['owner_module'], 'view', $layout_def['owner_id'] == $current_user->id))) { |
|
101 | - $action_access = true; |
|
102 | - } |
|
103 | - $icon_img_html = SugarThemeRegistry::current()->getImage( $module . '', 'border="0"',null,null,'.gif',$app_list_strings['moduleList'][$module]); |
|
104 | - if (!empty($layout_def['attachment_image_only']) && $layout_def['attachment_image_only'] == true) { |
|
105 | - $ret=""; |
|
106 | - } else { |
|
107 | - if ($action_access) { |
|
108 | - $ret = '<a href="index.php?module=' . $module . '&action=' . $action . '&record=' . $record . '" >' . $icon_img_html . "</a>"; |
|
109 | - } else { |
|
110 | - $ret = $icon_img_html; |
|
111 | - } |
|
112 | - } |
|
113 | - |
|
114 | - if(!empty($layout_def['image2']) && !empty($layout_def['image2_ext_url_field'])){ |
|
115 | - |
|
116 | - if (!empty($layout_def['fields'][strtoupper($layout_def['image2_ext_url_field'])])) { |
|
117 | - $link_url = $layout_def['fields'][strtoupper($layout_def['image2_ext_url_field'])]; |
|
118 | - } |
|
77 | + if(empty($layout_def['target_module'])) |
|
78 | + { |
|
79 | + $module = $layout_def['module']; |
|
80 | + } |
|
81 | + else |
|
82 | + { |
|
83 | + $module = $layout_def['target_module']; |
|
84 | + } |
|
85 | + } |
|
86 | + $action = 'DetailView'; |
|
87 | + if(empty($layout_def['target_record_key'])) |
|
88 | + { |
|
89 | + $record = $layout_def['fields']['ID']; |
|
90 | + } |
|
91 | + else |
|
92 | + { |
|
93 | + $record_key = strtoupper($layout_def['target_record_key']); |
|
94 | + $record = $layout_def['fields'][$record_key]; |
|
95 | + } |
|
96 | + $action_access = false; |
|
97 | + if(!empty($record) && |
|
98 | + ($layout_def[$action] && !$layout_def['owner_module'] |
|
99 | + || $layout_def[$action] && !ACLController::moduleSupportsACL($layout_def['owner_module']) |
|
100 | + || ACLController::checkAccess($layout_def['owner_module'], 'view', $layout_def['owner_id'] == $current_user->id))) { |
|
101 | + $action_access = true; |
|
102 | + } |
|
103 | + $icon_img_html = SugarThemeRegistry::current()->getImage( $module . '', 'border="0"',null,null,'.gif',$app_list_strings['moduleList'][$module]); |
|
104 | + if (!empty($layout_def['attachment_image_only']) && $layout_def['attachment_image_only'] == true) { |
|
105 | + $ret=""; |
|
106 | + } else { |
|
107 | + if ($action_access) { |
|
108 | + $ret = '<a href="index.php?module=' . $module . '&action=' . $action . '&record=' . $record . '" >' . $icon_img_html . "</a>"; |
|
109 | + } else { |
|
110 | + $ret = $icon_img_html; |
|
111 | + } |
|
112 | + } |
|
113 | + |
|
114 | + if(!empty($layout_def['image2']) && !empty($layout_def['image2_ext_url_field'])){ |
|
115 | + |
|
116 | + if (!empty($layout_def['fields'][strtoupper($layout_def['image2_ext_url_field'])])) { |
|
117 | + $link_url = $layout_def['fields'][strtoupper($layout_def['image2_ext_url_field'])]; |
|
118 | + } |
|
119 | 119 | |
120 | 120 | $imagePath = ''; |
121 | 121 | if ( $layout_def['image2'] == '__VARIABLE' ) { |
@@ -132,34 +132,34 @@ discard block |
||
132 | 132 | } |
133 | 133 | } |
134 | 134 | //if requested, add attachment icon. |
135 | - if(!empty($layout_def['image2']) && !empty($layout_def['image2_url_field'])){ |
|
135 | + if(!empty($layout_def['image2']) && !empty($layout_def['image2_url_field'])){ |
|
136 | 136 | |
137 | - if (is_array($layout_def['image2_url_field'])) { |
|
138 | - //Generate file url. |
|
139 | - if (!empty($layout_def['fields'][strtoupper($layout_def['image2_url_field']['id_field'])]) |
|
140 | - and !empty($layout_def['fields'][strtoupper($layout_def['image2_url_field']['filename_field'])]) ) { |
|
137 | + if (is_array($layout_def['image2_url_field'])) { |
|
138 | + //Generate file url. |
|
139 | + if (!empty($layout_def['fields'][strtoupper($layout_def['image2_url_field']['id_field'])]) |
|
140 | + and !empty($layout_def['fields'][strtoupper($layout_def['image2_url_field']['filename_field'])]) ) { |
|
141 | 141 | |
142 | - $key=$layout_def['fields'][strtoupper($layout_def['image2_url_field']['id_field'])]; |
|
142 | + $key=$layout_def['fields'][strtoupper($layout_def['image2_url_field']['id_field'])]; |
|
143 | 143 | $file=$layout_def['fields'][strtoupper($layout_def['image2_url_field']['filename_field'])]; |
144 | 144 | $filepath="index.php?entryPoint=download&id=".$key."&type=".$layout_def['module']; |
145 | - } |
|
146 | - } else { |
|
147 | - if (!empty($layout_def['fields'][strtoupper($layout_def['image2_url_field'])])) { |
|
148 | - $filepath="index.php?entryPoint=download&id=".$layout_def['fields']['ID']."&type=".$layout_def['module']; |
|
149 | - } |
|
150 | - } |
|
151 | - $icon_img_html = SugarThemeRegistry::current()->getImage( $layout_def['image2'] . '', 'border="0"',null,null,'.gif',$layout_def['image2']); |
|
152 | - if ($action_access && !empty($filepath)) { |
|
153 | - $ret .= '<a href="' . $filepath. '" >' . "$icon_img_html</a>"; |
|
154 | - } elseif (!empty($filepath)) { |
|
155 | - $ret .= $icon_img_html; |
|
156 | - } |
|
157 | - } |
|
158 | - // now handle attachments for Emails |
|
159 | - else if(!empty($layout_def['module']) && $layout_def['module'] == 'Emails' && !empty($layout_def['fields']['ATTACHMENT_IMAGE'])) { |
|
160 | - $ret.= $layout_def['fields']['ATTACHMENT_IMAGE']; |
|
161 | - } |
|
162 | - return $ret; |
|
163 | - } |
|
145 | + } |
|
146 | + } else { |
|
147 | + if (!empty($layout_def['fields'][strtoupper($layout_def['image2_url_field'])])) { |
|
148 | + $filepath="index.php?entryPoint=download&id=".$layout_def['fields']['ID']."&type=".$layout_def['module']; |
|
149 | + } |
|
150 | + } |
|
151 | + $icon_img_html = SugarThemeRegistry::current()->getImage( $layout_def['image2'] . '', 'border="0"',null,null,'.gif',$layout_def['image2']); |
|
152 | + if ($action_access && !empty($filepath)) { |
|
153 | + $ret .= '<a href="' . $filepath. '" >' . "$icon_img_html</a>"; |
|
154 | + } elseif (!empty($filepath)) { |
|
155 | + $ret .= $icon_img_html; |
|
156 | + } |
|
157 | + } |
|
158 | + // now handle attachments for Emails |
|
159 | + else if(!empty($layout_def['module']) && $layout_def['module'] == 'Emails' && !empty($layout_def['fields']['ATTACHMENT_IMAGE'])) { |
|
160 | + $ret.= $layout_def['fields']['ATTACHMENT_IMAGE']; |
|
161 | + } |
|
162 | + return $ret; |
|
163 | + } |
|
164 | 164 | } |
165 | 165 | ?> |
@@ -45,21 +45,21 @@ |
||
45 | 45 | |
46 | 46 | class SugarWidgetSubPanelConcat extends SugarWidgetField |
47 | 47 | { |
48 | - function displayList(&$layout_def) |
|
49 | - { |
|
50 | - $value=''; |
|
51 | - if (isset($layout_def['source']) and is_array($layout_def['source']) and isset($layout_def['fields']) and is_array($layout_def['fields'])) { |
|
48 | + function displayList(&$layout_def) |
|
49 | + { |
|
50 | + $value=''; |
|
51 | + if (isset($layout_def['source']) and is_array($layout_def['source']) and isset($layout_def['fields']) and is_array($layout_def['fields'])) { |
|
52 | 52 | |
53 | - foreach ($layout_def['source'] as $field) { |
|
53 | + foreach ($layout_def['source'] as $field) { |
|
54 | 54 | |
55 | - if (isset($layout_def['fields'][strtoupper($field)])) { |
|
56 | - $value.=$layout_def['fields'][strtoupper($field)]; |
|
57 | - } else { |
|
58 | - $value.=$field; |
|
59 | - } |
|
60 | - } |
|
61 | - } |
|
62 | - return $value; |
|
63 | - } |
|
55 | + if (isset($layout_def['fields'][strtoupper($field)])) { |
|
56 | + $value.=$layout_def['fields'][strtoupper($field)]; |
|
57 | + } else { |
|
58 | + $value.=$field; |
|
59 | + } |
|
60 | + } |
|
61 | + } |
|
62 | + return $value; |
|
63 | + } |
|
64 | 64 | } |
65 | 65 | ?> |
66 | 66 | \ No newline at end of file |
@@ -45,81 +45,81 @@ |
||
45 | 45 | |
46 | 46 | class SugarWidgetSubPanelRemoveButton extends SugarWidgetField |
47 | 47 | { |
48 | - function displayHeaderCell($layout_def) |
|
49 | - { |
|
50 | - return ' '; |
|
51 | - } |
|
48 | + function displayHeaderCell($layout_def) |
|
49 | + { |
|
50 | + return ' '; |
|
51 | + } |
|
52 | 52 | |
53 | - function displayList($layout_def) |
|
54 | - { |
|
53 | + function displayList($layout_def) |
|
54 | + { |
|
55 | 55 | |
56 | - global $app_strings; |
|
56 | + global $app_strings; |
|
57 | 57 | global $subpanel_item_count; |
58 | 58 | |
59 | - $unique_id = $layout_def['subpanel_id']."_remove_".$subpanel_item_count; //bug 51512 |
|
59 | + $unique_id = $layout_def['subpanel_id']."_remove_".$subpanel_item_count; //bug 51512 |
|
60 | 60 | |
61 | - $parent_record_id = $_REQUEST['record']; |
|
62 | - $parent_module = $_REQUEST['module']; |
|
61 | + $parent_record_id = $_REQUEST['record']; |
|
62 | + $parent_module = $_REQUEST['module']; |
|
63 | 63 | |
64 | - $action = 'DeleteRelationship'; |
|
65 | - $record = $layout_def['fields']['ID']; |
|
66 | - $current_module=$layout_def['module']; |
|
67 | - //in document revisions subpanel ,users are now allowed to |
|
68 | - //delete the latest revsion of a document. this will be tested here |
|
69 | - //and if the condition is met delete button will be removed. |
|
70 | - $hideremove=false; |
|
71 | - if ($current_module=='DocumentRevisions') { |
|
72 | - if ($layout_def['fields']['ID']==$layout_def['fields']['LATEST_REVISION_ID']) { |
|
73 | - $hideremove=true; |
|
74 | - } |
|
75 | - } |
|
76 | - // Implicit Team-memberships are not "removeable" |
|
77 | - elseif ($_REQUEST['module'] == 'Teams' && $current_module == 'Users') { |
|
78 | - if($layout_def['fields']['UPLINE'] != translate('LBL_TEAM_UPLINE_EXPLICIT', 'Users')) { |
|
79 | - $hideremove = true; |
|
80 | - } |
|
64 | + $action = 'DeleteRelationship'; |
|
65 | + $record = $layout_def['fields']['ID']; |
|
66 | + $current_module=$layout_def['module']; |
|
67 | + //in document revisions subpanel ,users are now allowed to |
|
68 | + //delete the latest revsion of a document. this will be tested here |
|
69 | + //and if the condition is met delete button will be removed. |
|
70 | + $hideremove=false; |
|
71 | + if ($current_module=='DocumentRevisions') { |
|
72 | + if ($layout_def['fields']['ID']==$layout_def['fields']['LATEST_REVISION_ID']) { |
|
73 | + $hideremove=true; |
|
74 | + } |
|
75 | + } |
|
76 | + // Implicit Team-memberships are not "removeable" |
|
77 | + elseif ($_REQUEST['module'] == 'Teams' && $current_module == 'Users') { |
|
78 | + if($layout_def['fields']['UPLINE'] != translate('LBL_TEAM_UPLINE_EXPLICIT', 'Users')) { |
|
79 | + $hideremove = true; |
|
80 | + } |
|
81 | 81 | |
82 | - //We also cannot remove the user whose private team is set to the parent_record_id value |
|
83 | - $user = new User(); |
|
84 | - $user->retrieve($layout_def['fields']['ID']); |
|
85 | - if($parent_record_id == $user->getPrivateTeamID()) |
|
86 | - { |
|
87 | - $hideremove = true; |
|
88 | - } |
|
89 | - } |
|
82 | + //We also cannot remove the user whose private team is set to the parent_record_id value |
|
83 | + $user = new User(); |
|
84 | + $user->retrieve($layout_def['fields']['ID']); |
|
85 | + if($parent_record_id == $user->getPrivateTeamID()) |
|
86 | + { |
|
87 | + $hideremove = true; |
|
88 | + } |
|
89 | + } |
|
90 | 90 | |
91 | 91 | |
92 | - $return_module = $_REQUEST['module']; |
|
93 | - $return_action = 'SubPanelViewer'; |
|
94 | - $subpanel = $layout_def['subpanel_id']; |
|
95 | - $return_id = $_REQUEST['record']; |
|
96 | - if (isset($layout_def['linked_field_set']) && !empty($layout_def['linked_field_set'])) { |
|
97 | - $linked_field= $layout_def['linked_field_set'] ; |
|
98 | - } else { |
|
99 | - $linked_field = $layout_def['linked_field']; |
|
100 | - } |
|
101 | - $refresh_page = 0; |
|
102 | - if(!empty($layout_def['refresh_page'])){ |
|
103 | - $refresh_page = 1; |
|
104 | - } |
|
105 | - $return_url = "index.php?module=$return_module&action=$return_action&subpanel=$subpanel&record=$return_id&sugar_body_only=1&inline=1"; |
|
92 | + $return_module = $_REQUEST['module']; |
|
93 | + $return_action = 'SubPanelViewer'; |
|
94 | + $subpanel = $layout_def['subpanel_id']; |
|
95 | + $return_id = $_REQUEST['record']; |
|
96 | + if (isset($layout_def['linked_field_set']) && !empty($layout_def['linked_field_set'])) { |
|
97 | + $linked_field= $layout_def['linked_field_set'] ; |
|
98 | + } else { |
|
99 | + $linked_field = $layout_def['linked_field']; |
|
100 | + } |
|
101 | + $refresh_page = 0; |
|
102 | + if(!empty($layout_def['refresh_page'])){ |
|
103 | + $refresh_page = 1; |
|
104 | + } |
|
105 | + $return_url = "index.php?module=$return_module&action=$return_action&subpanel=$subpanel&record=$return_id&sugar_body_only=1&inline=1"; |
|
106 | 106 | |
107 | - $icon_remove_text = mb_strtolower($app_strings['LBL_ID_FF_REMOVE'], 'UTF-8'); |
|
107 | + $icon_remove_text = mb_strtolower($app_strings['LBL_ID_FF_REMOVE'], 'UTF-8'); |
|
108 | 108 | |
109 | - if($linked_field == 'get_emails_by_assign_or_link') |
|
109 | + if($linked_field == 'get_emails_by_assign_or_link') |
|
110 | 110 | $linked_field = 'emails'; |
111 | - //based on listview since that lets you select records |
|
112 | - if($layout_def['ListView'] && !$hideremove) { |
|
111 | + //based on listview since that lets you select records |
|
112 | + if($layout_def['ListView'] && !$hideremove) { |
|
113 | 113 | $retStr = "<a href=\"javascript:sub_p_rem('$subpanel', '$linked_field'" |
114 | 114 | .", '$record', $refresh_page);\"" |
115 | - . ' class="listViewTdToolsS1"' |
|
115 | + . ' class="listViewTdToolsS1"' |
|
116 | 116 | . "id=$unique_id" |
117 | - . " onclick=\"return sp_rem_conf();\"" |
|
118 | - . ">$icon_remove_text</a>"; |
|
117 | + . " onclick=\"return sp_rem_conf();\"" |
|
118 | + . ">$icon_remove_text</a>"; |
|
119 | 119 | return $retStr; |
120 | 120 | |
121 | - }else{ |
|
122 | - return ''; |
|
123 | - } |
|
124 | - } |
|
121 | + }else{ |
|
122 | + return ''; |
|
123 | + } |
|
124 | + } |
|
125 | 125 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | if (empty($global_currency_obj)) |
53 | 53 | { |
54 | 54 | $global_currency_obj = new Currency(); |
55 | - // $global_currency_symbol = '$'; |
|
55 | + // $global_currency_symbol = '$'; |
|
56 | 56 | |
57 | 57 | if($current_user->getPreference('currency') ) |
58 | 58 | { |
@@ -106,18 +106,18 @@ discard block |
||
106 | 106 | $record = $layout_def['fields'][strtoupper($layout_def['table_alias']."_id")]; |
107 | 107 | } |
108 | 108 | if (!empty($record)) { |
109 | - $field_name = $layout_def['name']; |
|
110 | - $field_type = $field_def['type']; |
|
111 | - $module = $field_def['module']; |
|
109 | + $field_name = $layout_def['name']; |
|
110 | + $field_type = $field_def['type']; |
|
111 | + $module = $field_def['module']; |
|
112 | 112 | |
113 | - $div_id = $module ."&$record&$field_name"; |
|
114 | - $str = "<div id='$div_id'>".$display; |
|
113 | + $div_id = $module ."&$record&$field_name"; |
|
114 | + $str = "<div id='$div_id'>".$display; |
|
115 | 115 | global $sugar_config; |
116 | 116 | if (isset ($sugar_config['enable_inline_reports_edit']) && $sugar_config['enable_inline_reports_edit']) { |
117 | 117 | $str .= " " .SugarThemeRegistry::current()->getImage("edit_inline","border='0' alt='Edit Layout' align='bottom' onClick='SUGAR.reportsInlineEdit.inlineEdit(\"$div_id\",\"$value\",\"$module\",\"$record\",\"$field_name\",\"$field_type\",\"$currency_id\",\"$symbol\");'"); |
118 | 118 | } |
119 | - $str .= "</div>"; |
|
120 | - return $str; |
|
119 | + $str .= "</div>"; |
|
120 | + return $str; |
|
121 | 121 | } |
122 | 122 | else |
123 | 123 | return $display; |
@@ -135,61 +135,61 @@ discard block |
||
135 | 135 | ); |
136 | 136 | return $value; |
137 | 137 | } |
138 | - function queryFilterEquals(&$layout_def) |
|
139 | - { |
|
140 | - return $this->_get_column_select($layout_def)."=".$GLOBALS['db']->quote(unformat_number($layout_def['input_name0']))."\n"; |
|
141 | - } |
|
138 | + function queryFilterEquals(&$layout_def) |
|
139 | + { |
|
140 | + return $this->_get_column_select($layout_def)."=".$GLOBALS['db']->quote(unformat_number($layout_def['input_name0']))."\n"; |
|
141 | + } |
|
142 | 142 | |
143 | - function queryFilterNot_Equals(&$layout_def) |
|
144 | - { |
|
145 | - return $this->_get_column_select($layout_def)."!=".$GLOBALS['db']->quote(unformat_number($layout_def['input_name0']))."\n"; |
|
146 | - } |
|
143 | + function queryFilterNot_Equals(&$layout_def) |
|
144 | + { |
|
145 | + return $this->_get_column_select($layout_def)."!=".$GLOBALS['db']->quote(unformat_number($layout_def['input_name0']))."\n"; |
|
146 | + } |
|
147 | 147 | |
148 | - function queryFilterGreater(&$layout_def) |
|
149 | - { |
|
150 | - return $this->_get_column_select($layout_def)." > ".$GLOBALS['db']->quote(unformat_number($layout_def['input_name0']))."\n"; |
|
151 | - } |
|
148 | + function queryFilterGreater(&$layout_def) |
|
149 | + { |
|
150 | + return $this->_get_column_select($layout_def)." > ".$GLOBALS['db']->quote(unformat_number($layout_def['input_name0']))."\n"; |
|
151 | + } |
|
152 | 152 | |
153 | - function queryFilterLess(&$layout_def) |
|
154 | - { |
|
155 | - return $this->_get_column_select($layout_def)." < ".$GLOBALS['db']->quote(unformat_number($layout_def['input_name0']))."\n"; |
|
156 | - } |
|
153 | + function queryFilterLess(&$layout_def) |
|
154 | + { |
|
155 | + return $this->_get_column_select($layout_def)." < ".$GLOBALS['db']->quote(unformat_number($layout_def['input_name0']))."\n"; |
|
156 | + } |
|
157 | 157 | |
158 | - function queryFilterBetween(&$layout_def){ |
|
159 | - return $this->_get_column_select($layout_def)." > ".$GLOBALS['db']->quote(unformat_number($layout_def['input_name0'])). " AND ". $this->_get_column_select($layout_def)." < ".$GLOBALS['db']->quote(unformat_number($layout_def['input_name1']))."\n"; |
|
160 | - } |
|
158 | + function queryFilterBetween(&$layout_def){ |
|
159 | + return $this->_get_column_select($layout_def)." > ".$GLOBALS['db']->quote(unformat_number($layout_def['input_name0'])). " AND ". $this->_get_column_select($layout_def)." < ".$GLOBALS['db']->quote(unformat_number($layout_def['input_name1']))."\n"; |
|
160 | + } |
|
161 | 161 | |
162 | - function isSystemCurrency(&$layout_def) |
|
163 | - { |
|
164 | - if (strpos($layout_def['name'],'_usdoll') === false) { |
|
165 | - return false; |
|
166 | - } else { |
|
167 | - return true; |
|
168 | - } |
|
169 | - } |
|
162 | + function isSystemCurrency(&$layout_def) |
|
163 | + { |
|
164 | + if (strpos($layout_def['name'],'_usdoll') === false) { |
|
165 | + return false; |
|
166 | + } else { |
|
167 | + return true; |
|
168 | + } |
|
169 | + } |
|
170 | 170 | |
171 | - function querySelect(&$layout_def) |
|
172 | - { |
|
171 | + function querySelect(&$layout_def) |
|
172 | + { |
|
173 | 173 | // add currency column to select |
174 | 174 | $table = $this->getCurrencyIdTable($layout_def); |
175 | 175 | if($table) { |
176 | 176 | return $this->_get_column_select($layout_def)." ".$this->_get_column_alias($layout_def)." , ".$table.".currency_id ". $this->getTruncatedColumnAlias($this->_get_column_alias($layout_def)."_currency") . "\n"; |
177 | 177 | } |
178 | 178 | return $this->_get_column_select($layout_def)." ".$this->_get_column_alias($layout_def)."\n"; |
179 | - } |
|
179 | + } |
|
180 | 180 | |
181 | - function queryGroupBy($layout_def) |
|
182 | - { |
|
181 | + function queryGroupBy($layout_def) |
|
182 | + { |
|
183 | 183 | // add currency column to group by |
184 | 184 | $table = $this->getCurrencyIdTable($layout_def); |
185 | 185 | if($table) { |
186 | 186 | return $this->_get_column_select($layout_def)." , ".$table.".currency_id \n"; |
187 | 187 | } |
188 | 188 | return $this->_get_column_select($layout_def)." \n"; |
189 | - } |
|
189 | + } |
|
190 | 190 | |
191 | - function getCurrencyIdTable($layout_def) |
|
192 | - { |
|
191 | + function getCurrencyIdTable($layout_def) |
|
192 | + { |
|
193 | 193 | // We need to fetch the currency id as well |
194 | 194 | if ( !$this->isSystemCurrency($layout_def) && empty($layout_def['group_function'])) { |
195 | 195 | |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | } |
220 | 220 | } |
221 | 221 | return false; |
222 | - } |
|
222 | + } |
|
223 | 223 | |
224 | 224 | /** |
225 | 225 | * Return currency for layout_def |
@@ -66,55 +66,55 @@ discard block |
||
66 | 66 | |
67 | 67 | require_once('include/formbase.php'); |
68 | 68 | |
69 | - global $beanFiles,$beanList; |
|
70 | - $bean_name = $beanList[$_REQUEST['module']]; |
|
71 | - require_once($beanFiles[$bean_name]); |
|
72 | - $focus = new $bean_name(); |
|
73 | - if ( empty($_REQUEST['linked_id']) || empty($_REQUEST['linked_field']) || empty($_REQUEST['record'])) |
|
74 | - { |
|
75 | - die("need linked_field, linked_id and record fields"); |
|
76 | - } |
|
77 | - $linked_field = $_REQUEST['linked_field']; |
|
78 | - $record = $_REQUEST['record']; |
|
79 | - $linked_id = $_REQUEST['linked_id']; |
|
80 | - if($bean_name == 'Team') |
|
81 | - { |
|
82 | - $focus->retrieve($record); |
|
83 | - $focus->remove_user_from_team($linked_id); |
|
84 | - } |
|
85 | - else |
|
86 | - { |
|
87 | - // cut it off: |
|
88 | - $focus->load_relationship($linked_field); |
|
89 | - if($focus->$linked_field->_relationship->relationship_name == 'quotes_contacts_shipto') |
|
90 | - unset($focus->$linked_field->_relationship->relationship_role_column); |
|
91 | - $focus->$linked_field->delete($record,$linked_id); |
|
92 | - } |
|
93 | - if ($bean_name == 'Campaign' and $linked_field=='prospectlists' ) { |
|
69 | + global $beanFiles,$beanList; |
|
70 | + $bean_name = $beanList[$_REQUEST['module']]; |
|
71 | + require_once($beanFiles[$bean_name]); |
|
72 | + $focus = new $bean_name(); |
|
73 | + if ( empty($_REQUEST['linked_id']) || empty($_REQUEST['linked_field']) || empty($_REQUEST['record'])) |
|
74 | + { |
|
75 | + die("need linked_field, linked_id and record fields"); |
|
76 | + } |
|
77 | + $linked_field = $_REQUEST['linked_field']; |
|
78 | + $record = $_REQUEST['record']; |
|
79 | + $linked_id = $_REQUEST['linked_id']; |
|
80 | + if($bean_name == 'Team') |
|
81 | + { |
|
82 | + $focus->retrieve($record); |
|
83 | + $focus->remove_user_from_team($linked_id); |
|
84 | + } |
|
85 | + else |
|
86 | + { |
|
87 | + // cut it off: |
|
88 | + $focus->load_relationship($linked_field); |
|
89 | + if($focus->$linked_field->_relationship->relationship_name == 'quotes_contacts_shipto') |
|
90 | + unset($focus->$linked_field->_relationship->relationship_role_column); |
|
91 | + $focus->$linked_field->delete($record,$linked_id); |
|
92 | + } |
|
93 | + if ($bean_name == 'Campaign' and $linked_field=='prospectlists' ) { |
|
94 | 94 | |
95 | - $query="SELECT email_marketing_prospect_lists.id from email_marketing_prospect_lists "; |
|
96 | - $query.=" left join email_marketing on email_marketing.id=email_marketing_prospect_lists.email_marketing_id"; |
|
97 | - $query.=" where email_marketing.campaign_id='$record'"; |
|
98 | - $query.=" and email_marketing_prospect_lists.prospect_list_id='$linked_id'"; |
|
95 | + $query="SELECT email_marketing_prospect_lists.id from email_marketing_prospect_lists "; |
|
96 | + $query.=" left join email_marketing on email_marketing.id=email_marketing_prospect_lists.email_marketing_id"; |
|
97 | + $query.=" where email_marketing.campaign_id='$record'"; |
|
98 | + $query.=" and email_marketing_prospect_lists.prospect_list_id='$linked_id'"; |
|
99 | 99 | |
100 | - $result=$focus->db->query($query); |
|
101 | - while (($row=$focus->db->fetchByAssoc($result)) != null) { |
|
102 | - $del_query =" update email_marketing_prospect_lists set email_marketing_prospect_lists.deleted=1, email_marketing_prospect_lists.date_modified=".$focus->db->convert("'".TimeDate::getInstance()->nowDb()."'",'datetime'); |
|
103 | - $del_query.=" WHERE email_marketing_prospect_lists.id='{$row['id']}'"; |
|
104 | - $focus->db->query($del_query); |
|
105 | - } |
|
106 | - $focus->db->query($query); |
|
107 | - } |
|
100 | + $result=$focus->db->query($query); |
|
101 | + while (($row=$focus->db->fetchByAssoc($result)) != null) { |
|
102 | + $del_query =" update email_marketing_prospect_lists set email_marketing_prospect_lists.deleted=1, email_marketing_prospect_lists.date_modified=".$focus->db->convert("'".TimeDate::getInstance()->nowDb()."'",'datetime'); |
|
103 | + $del_query.=" WHERE email_marketing_prospect_lists.id='{$row['id']}'"; |
|
104 | + $focus->db->query($del_query); |
|
105 | + } |
|
106 | + $focus->db->query($query); |
|
107 | + } |
|
108 | 108 | if ($bean_name == "Meeting") { |
109 | 109 | $focus->retrieve($record); |
110 | 110 | $user = new User(); |
111 | 111 | $user->retrieve($linked_id); |
112 | 112 | if (!empty($user->id)) { //make sure that record exists. we may have a contact on our hands. |
113 | 113 | |
114 | - if($focus->update_vcal) |
|
115 | - { |
|
116 | - vCal::cache_sugar_vcal($user); |
|
117 | - } |
|
114 | + if($focus->update_vcal) |
|
115 | + { |
|
116 | + vCal::cache_sugar_vcal($user); |
|
117 | + } |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | if ($bean_name == "User" && $linked_field == 'eapm') { |
@@ -123,11 +123,11 @@ discard block |
||
123 | 123 | } |
124 | 124 | |
125 | 125 | if(!empty($_REQUEST['return_url'])){ |
126 | - $_REQUEST['return_url'] =urldecode($_REQUEST['return_url']); |
|
126 | + $_REQUEST['return_url'] =urldecode($_REQUEST['return_url']); |
|
127 | 127 | } |
128 | 128 | $GLOBALS['log']->debug("deleted relationship: bean: $bean_name, linked_field: $linked_field, linked_id:$linked_id" ); |
129 | 129 | if(empty($_REQUEST['refresh_page'])){ |
130 | - handleRedirect(); |
|
130 | + handleRedirect(); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 |
@@ -246,12 +246,12 @@ discard block |
||
246 | 246 | */ |
247 | 247 | private $_templateCache = array(); |
248 | 248 | |
249 | - /** |
|
250 | - * Cache built of sprite meta data |
|
251 | - * |
|
252 | - * @var array |
|
253 | - */ |
|
254 | - private $_spriteCache = array(); |
|
249 | + /** |
|
250 | + * Cache built of sprite meta data |
|
251 | + * |
|
252 | + * @var array |
|
253 | + */ |
|
254 | + private $_spriteCache = array(); |
|
255 | 255 | |
256 | 256 | /** |
257 | 257 | * Size of the caches after the are initialized in the constructor |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | 'imageCache' => 0, |
264 | 264 | 'jsCache' => 0, |
265 | 265 | 'templateCache' => 0, |
266 | - 'spriteCache' => 0, |
|
266 | + 'spriteCache' => 0, |
|
267 | 267 | ); |
268 | 268 | |
269 | 269 | /** |
@@ -329,21 +329,21 @@ discard block |
||
329 | 329 | $this->_templateCache = $caches['templateCache']; |
330 | 330 | } |
331 | 331 | $cachedfile = sugar_cached($this->getFilePath().'/spriteCache.php'); |
332 | - if(!empty($GLOBALS['sugar_config']['use_sprites']) && sugar_is_file($cachedfile)) { |
|
333 | - $this->_spriteCache = unserialize(sugar_file_get_contents($cachedfile)); |
|
334 | - } |
|
332 | + if(!empty($GLOBALS['sugar_config']['use_sprites']) && sugar_is_file($cachedfile)) { |
|
333 | + $this->_spriteCache = unserialize(sugar_file_get_contents($cachedfile)); |
|
334 | + } |
|
335 | 335 | } |
336 | 336 | $this->_initialCacheSize = array( |
337 | 337 | 'jsCache' => count($this->_jsCache), |
338 | 338 | 'cssCache' => count($this->_cssCache), |
339 | 339 | 'imageCache' => count($this->_imageCache), |
340 | 340 | 'templateCache' => count($this->_templateCache), |
341 | - 'spriteCache' => count($this->_spriteCache), |
|
341 | + 'spriteCache' => count($this->_spriteCache), |
|
342 | 342 | ); |
343 | 343 | } |
344 | 344 | |
345 | 345 | /** |
346 | - * This is needed to prevent unserialize vulnerability |
|
346 | + * This is needed to prevent unserialize vulnerability |
|
347 | 347 | */ |
348 | 348 | public function __wakeup() |
349 | 349 | { |
@@ -380,8 +380,8 @@ discard block |
||
380 | 380 | |
381 | 381 | if (is_file("$cachedir/pathCache.php")) |
382 | 382 | unlink("$cachedir/pathCache.php"); |
383 | - if (is_file("$cachedir/spriteCache.php")) |
|
384 | - unlink("$cachedir/spriteCache.php"); |
|
383 | + if (is_file("$cachedir/spriteCache.php")) |
|
384 | + unlink("$cachedir/spriteCache.php"); |
|
385 | 385 | |
386 | 386 | } |
387 | 387 | elseif ( !inDeveloperMode() ) { |
@@ -404,12 +404,12 @@ discard block |
||
404 | 404 | ); |
405 | 405 | |
406 | 406 | } |
407 | - if ( count($this->_spriteCache) != $this->_initialCacheSize['spriteCache']) { |
|
408 | - sugar_file_put_contents( |
|
409 | - "$cachedir/spriteCache.php", |
|
410 | - serialize($this->_spriteCache) |
|
411 | - ); |
|
412 | - } |
|
407 | + if ( count($this->_spriteCache) != $this->_initialCacheSize['spriteCache']) { |
|
408 | + sugar_file_put_contents( |
|
409 | + "$cachedir/spriteCache.php", |
|
410 | + serialize($this->_spriteCache) |
|
411 | + ); |
|
412 | + } |
|
413 | 413 | } |
414 | 414 | } |
415 | 415 | |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | } |
439 | 439 | |
440 | 440 | public function __isset($key){ |
441 | - return isset($this->$key); |
|
441 | + return isset($this->$key); |
|
442 | 442 | |
443 | 443 | } |
444 | 444 | |
@@ -603,27 +603,27 @@ discard block |
||
603 | 603 | $html .= '<link rel="stylesheet" type="text/css" href="'.$this->getCSSURL('style.css').'" />'; |
604 | 604 | |
605 | 605 | |
606 | - // sprites |
|
607 | - if(!empty($GLOBALS['sugar_config']['use_sprites']) && $GLOBALS['sugar_config']['use_sprites']) { |
|
606 | + // sprites |
|
607 | + if(!empty($GLOBALS['sugar_config']['use_sprites']) && $GLOBALS['sugar_config']['use_sprites']) { |
|
608 | 608 | |
609 | - // system wide sprites |
|
610 | - if(file_exists("cache/sprites/default/sprites.css")) |
|
611 | - $html .= '<link rel="stylesheet" type="text/css" href="'.getJSPath('cache/sprites/default/sprites.css').'" />'; |
|
609 | + // system wide sprites |
|
610 | + if(file_exists("cache/sprites/default/sprites.css")) |
|
611 | + $html .= '<link rel="stylesheet" type="text/css" href="'.getJSPath('cache/sprites/default/sprites.css').'" />'; |
|
612 | 612 | |
613 | - // theme specific sprites |
|
614 | - if(file_exists("cache/sprites/{$this->dirName}/sprites.css")) |
|
615 | - $html .= '<link rel="stylesheet" type="text/css" href="'.getJSPath('cache/sprites/'.$this->dirName.'/sprites.css').'" />'; |
|
613 | + // theme specific sprites |
|
614 | + if(file_exists("cache/sprites/{$this->dirName}/sprites.css")) |
|
615 | + $html .= '<link rel="stylesheet" type="text/css" href="'.getJSPath('cache/sprites/'.$this->dirName.'/sprites.css').'" />'; |
|
616 | 616 | |
617 | - // parent sprites |
|
618 | - if($this->parentTheme && $parent = SugarThemeRegistry::get($this->parentTheme)) { |
|
619 | - if(file_exists("cache/sprites/{$parent->dirName}/sprites.css")) |
|
620 | - $html .= '<link rel="stylesheet" type="text/css" href="'.getJSPath('cache/sprites/'.$parent->dirName.'/sprites.css').'" />'; |
|
621 | - } |
|
617 | + // parent sprites |
|
618 | + if($this->parentTheme && $parent = SugarThemeRegistry::get($this->parentTheme)) { |
|
619 | + if(file_exists("cache/sprites/{$parent->dirName}/sprites.css")) |
|
620 | + $html .= '<link rel="stylesheet" type="text/css" href="'.getJSPath('cache/sprites/'.$parent->dirName.'/sprites.css').'" />'; |
|
621 | + } |
|
622 | 622 | |
623 | - // repeatable sprites |
|
624 | - if(file_exists("cache/sprites/Repeatable/sprites.css")) |
|
625 | - $html .= '<link rel="stylesheet" type="text/css" href="'.getJSPath('cache/sprites/Repeatable/sprites.css').'" />'; |
|
626 | - } |
|
623 | + // repeatable sprites |
|
624 | + if(file_exists("cache/sprites/Repeatable/sprites.css")) |
|
625 | + $html .= '<link rel="stylesheet" type="text/css" href="'.getJSPath('cache/sprites/Repeatable/sprites.css').'" />'; |
|
626 | + } |
|
627 | 627 | |
628 | 628 | // for BC during upgrade |
629 | 629 | if ( !empty($this->colors) ) { |
@@ -700,180 +700,180 @@ discard block |
||
700 | 700 | * |
701 | 701 | * @param string $image image name |
702 | 702 | * @param string $other_attributes optional, other attributes to add to the image tag, not cached |
703 | - * @param string $width optional, defaults to the actual image's width |
|
704 | - * @param string $height optional, defaults to the actual image's height |
|
705 | - * @param string $ext optional, image extension (TODO can we deprecate this one ?) |
|
703 | + * @param string $width optional, defaults to the actual image's width |
|
704 | + * @param string $height optional, defaults to the actual image's height |
|
705 | + * @param string $ext optional, image extension (TODO can we deprecate this one ?) |
|
706 | 706 | * @param string $alt optional, only used when image contains something useful, i.e. "Sally's profile pic" |
707 | 707 | * @return string HTML image tag or sprite |
708 | 708 | */ |
709 | 709 | public function getImage( |
710 | 710 | $imageName, |
711 | 711 | $other_attributes = '', |
712 | - $width = null, |
|
713 | - $height = null, |
|
714 | - $ext = null, |
|
712 | + $width = null, |
|
713 | + $height = null, |
|
714 | + $ext = null, |
|
715 | 715 | $alt = '' |
716 | 716 | ) |
717 | 717 | { |
718 | 718 | |
719 | 719 | static $cached_results = array(); |
720 | 720 | |
721 | - // trap deprecated use of image extension |
|
722 | - if(is_null($ext)) { |
|
723 | - $imageNameExp = explode('.',$imageName); |
|
724 | - if(count($imageNameExp) == 1) |
|
725 | - $imageName .= '.gif'; |
|
726 | - } else { |
|
727 | - $imageName .= $ext; |
|
728 | - } |
|
729 | - |
|
730 | - // trap alt attributes in other_attributes |
|
731 | - if(preg_match('/alt=["\']([^\'"]+)["\']/i', $other_attributes)) |
|
732 | - $GLOBALS['log']->debug("Sprites: alt attribute detected for $imageName"); |
|
733 | - // sprite handler, makes use of own caching mechanism |
|
734 | - if(!empty($GLOBALS['sugar_config']['use_sprites']) && $GLOBALS['sugar_config']['use_sprites']) { |
|
735 | - // get sprite metadata |
|
736 | - if($sp = $this->getSpriteMeta($imageName)) { |
|
737 | - // requested size should match |
|
738 | - if( (!is_null($width) && $sp['width'] == $width) || (is_null($width)) && |
|
739 | - (!is_null($height) && $sp['height'] == $height) || (is_null($height)) ) |
|
740 | - { |
|
721 | + // trap deprecated use of image extension |
|
722 | + if(is_null($ext)) { |
|
723 | + $imageNameExp = explode('.',$imageName); |
|
724 | + if(count($imageNameExp) == 1) |
|
725 | + $imageName .= '.gif'; |
|
726 | + } else { |
|
727 | + $imageName .= $ext; |
|
728 | + } |
|
729 | + |
|
730 | + // trap alt attributes in other_attributes |
|
731 | + if(preg_match('/alt=["\']([^\'"]+)["\']/i', $other_attributes)) |
|
732 | + $GLOBALS['log']->debug("Sprites: alt attribute detected for $imageName"); |
|
733 | + // sprite handler, makes use of own caching mechanism |
|
734 | + if(!empty($GLOBALS['sugar_config']['use_sprites']) && $GLOBALS['sugar_config']['use_sprites']) { |
|
735 | + // get sprite metadata |
|
736 | + if($sp = $this->getSpriteMeta($imageName)) { |
|
737 | + // requested size should match |
|
738 | + if( (!is_null($width) && $sp['width'] == $width) || (is_null($width)) && |
|
739 | + (!is_null($height) && $sp['height'] == $height) || (is_null($height)) ) |
|
740 | + { |
|
741 | 741 | $other_attributes .= ' data-orig="'.$imageName.'"'; |
742 | 742 | |
743 | - if($sprite = $this->getSprite($sp['class'], $other_attributes, $alt)) |
|
744 | - { |
|
745 | - return $sprite; |
|
746 | - } |
|
747 | - } |
|
748 | - } |
|
749 | - } |
|
750 | - |
|
751 | - // img caching |
|
752 | - if(empty($cached_results[$imageName])) { |
|
753 | - $imageURL = $this->getImageURL($imageName,false); |
|
754 | - if ( empty($imageURL) ) |
|
755 | - return false; |
|
743 | + if($sprite = $this->getSprite($sp['class'], $other_attributes, $alt)) |
|
744 | + { |
|
745 | + return $sprite; |
|
746 | + } |
|
747 | + } |
|
748 | + } |
|
749 | + } |
|
750 | + |
|
751 | + // img caching |
|
752 | + if(empty($cached_results[$imageName])) { |
|
753 | + $imageURL = $this->getImageURL($imageName,false); |
|
754 | + if ( empty($imageURL) ) |
|
755 | + return false; |
|
756 | 756 | if(strpos($imageURL, '.svg', strlen($imageURL)-4)){ |
757 | 757 | $cached_results[$imageName] = file_get_contents($imageURL); |
758 | 758 | } else { |
759 | 759 | $cached_results[$imageName] = '<img src="'.getJSPath($imageURL).'" '; |
760 | 760 | } |
761 | 761 | |
762 | - } |
|
762 | + } |
|
763 | 763 | |
764 | - $attr_width = (is_null($width)) ? "" : "width=\"$width\""; |
|
765 | - $attr_height = (is_null($height)) ? "" : "height=\"$height\""; |
|
764 | + $attr_width = (is_null($width)) ? "" : "width=\"$width\""; |
|
765 | + $attr_height = (is_null($height)) ? "" : "height=\"$height\""; |
|
766 | 766 | |
767 | 767 | if(strpos($cached_results[$imageName], 'svg') !== false){ |
768 | 768 | return $cached_results[$imageName]; |
769 | 769 | } |
770 | - return $cached_results[$imageName] . " $attr_width $attr_height $other_attributes alt=\"$alt\" />"; |
|
770 | + return $cached_results[$imageName] . " $attr_width $attr_height $other_attributes alt=\"$alt\" />"; |
|
771 | + } |
|
772 | + |
|
773 | + /** |
|
774 | + * Returns sprite meta data |
|
775 | + * |
|
776 | + * @param string $imageName Image filename including extension |
|
777 | + * @return array Sprite meta data |
|
778 | + */ |
|
779 | + public function getSpriteMeta($imageName) { |
|
780 | + |
|
781 | + // return from cache |
|
782 | + if(isset($this->_spriteCache[$imageName])) |
|
783 | + return $this->_spriteCache[$imageName]; |
|
784 | + |
|
785 | + // sprite keys are base on imageURL |
|
786 | + $imageURL = $this->getImageURL($imageName,false); |
|
787 | + if(empty($imageURL)) { |
|
788 | + $this->_spriteCache[$imageName] = false; |
|
789 | + return false; |
|
790 | + } |
|
791 | + |
|
792 | + // load meta data, includes default images |
|
793 | + require_once("include/SugarTheme/SugarSprites.php"); |
|
794 | + $meta = SugarSprites::getInstance(); |
|
795 | + // add current theme dir |
|
796 | + $meta->loadSpriteMeta($this->dirName); |
|
797 | + // add parent theme dir |
|
798 | + if($this->parentTheme && $parent = SugarThemeRegistry::get($this->parentTheme)) { |
|
799 | + $meta->loadSpriteMeta($parent->dirName); |
|
800 | + } |
|
801 | + |
|
802 | + // add to cache |
|
803 | + if(isset($meta->sprites[$imageURL])) { |
|
804 | + $this->_spriteCache[$imageName] = $meta->sprites[$imageURL]; |
|
805 | + // add imageURL to cache |
|
806 | + //$this->_spriteCache[$imageName]['imageURL'] = $imageURL; |
|
807 | + } else { |
|
808 | + $this->_spriteCache[$imageName] = false; |
|
809 | + $GLOBALS['log']->debug("Sprites: miss for $imageURL"); |
|
810 | + } |
|
811 | + return $this->_spriteCache[$imageName]; |
|
812 | + } |
|
813 | + |
|
814 | + /** |
|
815 | + * Returns sprite HTML span tag |
|
816 | + * |
|
817 | + * @param string class The md5 id used in the CSS sprites class |
|
818 | + * @param string attr optional, list of additional html attributes |
|
819 | + * @param string title optional, the title (equivalent to alt on img) |
|
820 | + * @return string HTML span tag |
|
821 | + */ |
|
822 | + public function getSprite($class, $attr, $title) { |
|
823 | + |
|
824 | + // handle multiple class tags |
|
825 | + $class_regex = '/class=["\']([^\'"]+)["\']/i'; |
|
826 | + preg_match($class_regex, $attr, $match); |
|
827 | + if(isset($match[1])) { |
|
828 | + $attr = preg_replace($class_regex, 'class="spr_'.$class.' ${1}"', $attr); |
|
829 | + |
|
830 | + // single class |
|
831 | + } else { |
|
832 | + $attr .= ' class="spr_'.$class.'"'; |
|
833 | + } |
|
834 | + |
|
835 | + if($title) |
|
836 | + $attr .= ' title="'.$title.'"'; |
|
837 | + |
|
838 | + // use </span> instead of /> to prevent weird UI results |
|
839 | + $GLOBALS['log']->debug("Sprites: generated sprite -> $attr"); |
|
840 | + return "<span {$attr}></span>"; |
|
771 | 841 | } |
772 | 842 | |
773 | - /** |
|
774 | - * Returns sprite meta data |
|
775 | - * |
|
776 | - * @param string $imageName Image filename including extension |
|
777 | - * @return array Sprite meta data |
|
778 | - */ |
|
779 | - public function getSpriteMeta($imageName) { |
|
780 | - |
|
781 | - // return from cache |
|
782 | - if(isset($this->_spriteCache[$imageName])) |
|
783 | - return $this->_spriteCache[$imageName]; |
|
784 | - |
|
785 | - // sprite keys are base on imageURL |
|
786 | - $imageURL = $this->getImageURL($imageName,false); |
|
787 | - if(empty($imageURL)) { |
|
788 | - $this->_spriteCache[$imageName] = false; |
|
789 | - return false; |
|
790 | - } |
|
791 | - |
|
792 | - // load meta data, includes default images |
|
793 | - require_once("include/SugarTheme/SugarSprites.php"); |
|
794 | - $meta = SugarSprites::getInstance(); |
|
795 | - // add current theme dir |
|
796 | - $meta->loadSpriteMeta($this->dirName); |
|
797 | - // add parent theme dir |
|
798 | - if($this->parentTheme && $parent = SugarThemeRegistry::get($this->parentTheme)) { |
|
799 | - $meta->loadSpriteMeta($parent->dirName); |
|
800 | - } |
|
801 | - |
|
802 | - // add to cache |
|
803 | - if(isset($meta->sprites[$imageURL])) { |
|
804 | - $this->_spriteCache[$imageName] = $meta->sprites[$imageURL]; |
|
805 | - // add imageURL to cache |
|
806 | - //$this->_spriteCache[$imageName]['imageURL'] = $imageURL; |
|
807 | - } else { |
|
808 | - $this->_spriteCache[$imageName] = false; |
|
809 | - $GLOBALS['log']->debug("Sprites: miss for $imageURL"); |
|
810 | - } |
|
811 | - return $this->_spriteCache[$imageName]; |
|
812 | - } |
|
813 | - |
|
814 | - /** |
|
815 | - * Returns sprite HTML span tag |
|
816 | - * |
|
817 | - * @param string class The md5 id used in the CSS sprites class |
|
818 | - * @param string attr optional, list of additional html attributes |
|
819 | - * @param string title optional, the title (equivalent to alt on img) |
|
820 | - * @return string HTML span tag |
|
821 | - */ |
|
822 | - public function getSprite($class, $attr, $title) { |
|
823 | - |
|
824 | - // handle multiple class tags |
|
825 | - $class_regex = '/class=["\']([^\'"]+)["\']/i'; |
|
826 | - preg_match($class_regex, $attr, $match); |
|
827 | - if(isset($match[1])) { |
|
828 | - $attr = preg_replace($class_regex, 'class="spr_'.$class.' ${1}"', $attr); |
|
829 | - |
|
830 | - // single class |
|
831 | - } else { |
|
832 | - $attr .= ' class="spr_'.$class.'"'; |
|
833 | - } |
|
834 | - |
|
835 | - if($title) |
|
836 | - $attr .= ' title="'.$title.'"'; |
|
837 | - |
|
838 | - // use </span> instead of /> to prevent weird UI results |
|
839 | - $GLOBALS['log']->debug("Sprites: generated sprite -> $attr"); |
|
840 | - return "<span {$attr}></span>"; |
|
841 | - } |
|
842 | - |
|
843 | - /** |
|
844 | - * Returns a link HTML tag with or without an embedded image |
|
845 | - */ |
|
843 | + /** |
|
844 | + * Returns a link HTML tag with or without an embedded image |
|
845 | + */ |
|
846 | 846 | public function getLink( |
847 | - $url, |
|
848 | - $title, |
|
849 | - $other_attributes = '', |
|
847 | + $url, |
|
848 | + $title, |
|
849 | + $other_attributes = '', |
|
850 | 850 | $img_name = '', |
851 | 851 | $img_other_attributes = '', |
852 | - $img_width = null, |
|
853 | - $img_height = null, |
|
854 | - $img_alt = '', |
|
855 | - $img_placement = 'imageonly' |
|
852 | + $img_width = null, |
|
853 | + $img_height = null, |
|
854 | + $img_alt = '', |
|
855 | + $img_placement = 'imageonly' |
|
856 | 856 | ) |
857 | 857 | { |
858 | 858 | |
859 | - if($img_name) { |
|
860 | - $img = $this->getImage($img_name, $img_other_attributes, $img_width, $img_height, null, $img_alt); |
|
861 | - if($img == false) { |
|
862 | - $GLOBALS['log']->debug('Sprites: unknown image getLink'); |
|
863 | - $img = 'unknown'; |
|
864 | - } |
|
865 | - switch($img_placement) { |
|
866 | - case 'left': $inner_html = $img."<span class='title'>".$title."</span>"; break; |
|
867 | - case 'right': $inner_html = "<span class='title'>".$title."</span>".$img; break; |
|
868 | - default: $inner_html = $img; break; |
|
869 | - } |
|
870 | - } else { |
|
871 | - $inner_html = $title; |
|
872 | - } |
|
859 | + if($img_name) { |
|
860 | + $img = $this->getImage($img_name, $img_other_attributes, $img_width, $img_height, null, $img_alt); |
|
861 | + if($img == false) { |
|
862 | + $GLOBALS['log']->debug('Sprites: unknown image getLink'); |
|
863 | + $img = 'unknown'; |
|
864 | + } |
|
865 | + switch($img_placement) { |
|
866 | + case 'left': $inner_html = $img."<span class='title'>".$title."</span>"; break; |
|
867 | + case 'right': $inner_html = "<span class='title'>".$title."</span>".$img; break; |
|
868 | + default: $inner_html = $img; break; |
|
869 | + } |
|
870 | + } else { |
|
871 | + $inner_html = $title; |
|
872 | + } |
|
873 | 873 | |
874 | - return '<a href="'.$url.'" title="'.$title.'" '.$other_attributes.'>'.$inner_html.'</a>'; |
|
874 | + return '<a href="'.$url.'" title="'.$title.'" '.$other_attributes.'>'.$inner_html.'</a>'; |
|
875 | 875 | |
876 | - } |
|
876 | + } |
|
877 | 877 | |
878 | 878 | /** |
879 | 879 | * Returns the URL for an image in the current theme. If not found in the current theme, will revert |
@@ -905,8 +905,8 @@ discard block |
||
905 | 905 | $imagePath = $filename; |
906 | 906 | elseif (($filename = $this->_getImageFileName($this->getDefaultImagePath().'/'.$imageName)) != '') |
907 | 907 | $imagePath = $filename; |
908 | - elseif (($filename = $this->_getImageFileName('include/images/'.$imageName)) != '') |
|
909 | - $imagePath = $filename; |
|
908 | + elseif (($filename = $this->_getImageFileName('include/images/'.$imageName)) != '') |
|
909 | + $imagePath = $filename; |
|
910 | 910 | else { |
911 | 911 | $GLOBALS['log']->warn("Image $imageName not found"); |
912 | 912 | return false; |
@@ -1040,8 +1040,8 @@ discard block |
||
1040 | 1040 | if (isset($this->parentTheme) |
1041 | 1041 | && SugarThemeRegistry::get($this->parentTheme) instanceOf SugarTheme |
1042 | 1042 | && ($filename = SugarThemeRegistry::get($this->parentTheme)->getJSURL($jsFileName,false)) != '' && !in_array($jsFileName,$this->ignoreParentFiles)) { |
1043 | - $jsFileContents .= file_get_contents($filename); |
|
1044 | - } else { |
|
1043 | + $jsFileContents .= file_get_contents($filename); |
|
1044 | + } else { |
|
1045 | 1045 | if (sugar_is_file($defaultFileName)) |
1046 | 1046 | $jsFileContents .= file_get_contents($defaultFileName); |
1047 | 1047 | if (sugar_is_file('custom/'.$defaultFileName)) |
@@ -44,226 +44,226 @@ discard block |
||
44 | 44 | class LanguageManager |
45 | 45 | { |
46 | 46 | |
47 | - /** |
|
48 | - * Called from VardefManager to allow for caching a lang file for a module |
|
49 | - * @param module - the name of the module we are working with |
|
50 | - * @param templates - an array of templates this module uses |
|
51 | - */ |
|
52 | - static function createLanguageFile($module , $templates=array('default'), $refresh = false){ |
|
53 | - global $mod_strings, $current_language; |
|
54 | - if(inDeveloperMode() || !empty($_SESSION['developerMode'])){ |
|
55 | - $refresh = true; |
|
56 | - } |
|
57 | - $temp_mod_strings = $mod_strings; |
|
58 | - $lang = $current_language; |
|
47 | + /** |
|
48 | + * Called from VardefManager to allow for caching a lang file for a module |
|
49 | + * @param module - the name of the module we are working with |
|
50 | + * @param templates - an array of templates this module uses |
|
51 | + */ |
|
52 | + static function createLanguageFile($module , $templates=array('default'), $refresh = false){ |
|
53 | + global $mod_strings, $current_language; |
|
54 | + if(inDeveloperMode() || !empty($_SESSION['developerMode'])){ |
|
55 | + $refresh = true; |
|
56 | + } |
|
57 | + $temp_mod_strings = $mod_strings; |
|
58 | + $lang = $current_language; |
|
59 | 59 | if(empty($lang)) |
60 | 60 | $lang = $GLOBALS['sugar_config']['default_language']; |
61 | - static $createdModules = array(); |
|
62 | - if(empty($createdModules[$module]) && ($refresh || !file_exists(sugar_cached('modules/').$module.'/language/'.$lang.'.lang.php'))){ |
|
63 | - $loaded_mod_strings = array(); |
|
64 | - $loaded_mod_strings = LanguageManager::loadTemplateLanguage($module , $templates, $lang , $loaded_mod_strings); |
|
65 | - $createdModules[$module] = true; |
|
66 | - LanguageManager::refreshLanguage($module,$lang, $loaded_mod_strings); |
|
67 | - } |
|
68 | - } |
|
61 | + static $createdModules = array(); |
|
62 | + if(empty($createdModules[$module]) && ($refresh || !file_exists(sugar_cached('modules/').$module.'/language/'.$lang.'.lang.php'))){ |
|
63 | + $loaded_mod_strings = array(); |
|
64 | + $loaded_mod_strings = LanguageManager::loadTemplateLanguage($module , $templates, $lang , $loaded_mod_strings); |
|
65 | + $createdModules[$module] = true; |
|
66 | + LanguageManager::refreshLanguage($module,$lang, $loaded_mod_strings); |
|
67 | + } |
|
68 | + } |
|
69 | 69 | |
70 | - /** |
|
71 | - * Load the module tempalte lauguage files |
|
72 | - * @param module - the name of the module we are working with |
|
73 | - * @param templates - an array of templates this module uses |
|
74 | - * @param lang - current language this module use |
|
75 | - * @param loaded_mod_strings - the string that we will add the module template language into |
|
76 | - */ |
|
77 | - static function loadTemplateLanguage($module , $templates , $lang, $loaded_mod_strings){ |
|
78 | - $templates = array_reverse($templates); |
|
79 | - foreach($templates as $template){ |
|
80 | - $temp = LanguageManager::addTemplate($module,$lang, $template); |
|
81 | - $loaded_mod_strings = sugarLangArrayMerge($loaded_mod_strings, $temp); |
|
82 | - } |
|
83 | - return $loaded_mod_strings; |
|
84 | - } |
|
70 | + /** |
|
71 | + * Load the module tempalte lauguage files |
|
72 | + * @param module - the name of the module we are working with |
|
73 | + * @param templates - an array of templates this module uses |
|
74 | + * @param lang - current language this module use |
|
75 | + * @param loaded_mod_strings - the string that we will add the module template language into |
|
76 | + */ |
|
77 | + static function loadTemplateLanguage($module , $templates , $lang, $loaded_mod_strings){ |
|
78 | + $templates = array_reverse($templates); |
|
79 | + foreach($templates as $template){ |
|
80 | + $temp = LanguageManager::addTemplate($module,$lang, $template); |
|
81 | + $loaded_mod_strings = sugarLangArrayMerge($loaded_mod_strings, $temp); |
|
82 | + } |
|
83 | + return $loaded_mod_strings; |
|
84 | + } |
|
85 | 85 | |
86 | - static function addTemplate($module, $lang, $template){ |
|
87 | - if($template == 'default')$template = 'basic'; |
|
88 | - $templates = array(); |
|
89 | - $fields = array(); |
|
90 | - if(empty($templates[$template])){ |
|
91 | - $path = 'include/SugarObjects/templates/' . $template . '/language/'.$lang.'.lang.php'; |
|
92 | - if(file_exists($path)){ |
|
93 | - require($path); |
|
94 | - $templates[$template] = $mod_strings; |
|
95 | - }else{ |
|
96 | - $path = 'include/SugarObjects/implements/' . $template . '/language/'.$lang.'.lang.php'; |
|
97 | - if(file_exists($path)){ |
|
98 | - require($path); |
|
99 | - $templates[$template] = $mod_strings; |
|
100 | - } |
|
101 | - } |
|
102 | - } |
|
103 | - if(!empty($templates[$template])){ |
|
104 | - return $templates[$template]; |
|
105 | - } |
|
106 | - } |
|
86 | + static function addTemplate($module, $lang, $template){ |
|
87 | + if($template == 'default')$template = 'basic'; |
|
88 | + $templates = array(); |
|
89 | + $fields = array(); |
|
90 | + if(empty($templates[$template])){ |
|
91 | + $path = 'include/SugarObjects/templates/' . $template . '/language/'.$lang.'.lang.php'; |
|
92 | + if(file_exists($path)){ |
|
93 | + require($path); |
|
94 | + $templates[$template] = $mod_strings; |
|
95 | + }else{ |
|
96 | + $path = 'include/SugarObjects/implements/' . $template . '/language/'.$lang.'.lang.php'; |
|
97 | + if(file_exists($path)){ |
|
98 | + require($path); |
|
99 | + $templates[$template] = $mod_strings; |
|
100 | + } |
|
101 | + } |
|
102 | + } |
|
103 | + if(!empty($templates[$template])){ |
|
104 | + return $templates[$template]; |
|
105 | + } |
|
106 | + } |
|
107 | 107 | |
108 | - static function saveCache($module,$lang, $loaded_mod_strings, $additonal_objects= array()){ |
|
109 | - if(empty($lang)) |
|
110 | - $lang = $GLOBALS['sugar_config']['default_language']; |
|
108 | + static function saveCache($module,$lang, $loaded_mod_strings, $additonal_objects= array()){ |
|
109 | + if(empty($lang)) |
|
110 | + $lang = $GLOBALS['sugar_config']['default_language']; |
|
111 | 111 | |
112 | - $file = create_cache_directory('modules/' . $module . '/language/'.$lang.'.lang.php'); |
|
113 | - write_array_to_file('mod_strings',$loaded_mod_strings, $file); |
|
114 | - include($file); |
|
112 | + $file = create_cache_directory('modules/' . $module . '/language/'.$lang.'.lang.php'); |
|
113 | + write_array_to_file('mod_strings',$loaded_mod_strings, $file); |
|
114 | + include($file); |
|
115 | 115 | |
116 | - // put the item in the sugar cache. |
|
117 | - $key = self::getLanguageCacheKey($module,$lang); |
|
118 | - sugar_cache_put($key,$loaded_mod_strings); |
|
119 | - } |
|
116 | + // put the item in the sugar cache. |
|
117 | + $key = self::getLanguageCacheKey($module,$lang); |
|
118 | + sugar_cache_put($key,$loaded_mod_strings); |
|
119 | + } |
|
120 | 120 | |
121 | - /** |
|
122 | - * clear out the language cache. |
|
123 | - * @param string module_dir the module_dir to clear, if not specified then clear |
|
124 | - * clear language cache for all modules. |
|
125 | - * @param string lang the name of the object we are clearing this is for sugar_cache |
|
126 | - */ |
|
127 | - static function clearLanguageCache($module_dir = '', $lang = ''){ |
|
128 | - if(empty($lang)) { |
|
129 | - $languages = array_keys($GLOBALS['sugar_config']['languages']); |
|
130 | - } else { |
|
131 | - $languages = array($lang); |
|
132 | - } |
|
133 | - //if we have a module name specified then just remove that language file |
|
134 | - //otherwise go through each module and clean up the language |
|
135 | - if(!empty($module_dir)) { |
|
136 | - foreach($languages as $clean_lang) { |
|
137 | - LanguageManager::_clearCache($module_dir, $clean_lang); |
|
138 | - } |
|
139 | - } else { |
|
140 | - $cache_dir = sugar_cached('modules/'); |
|
141 | - if(file_exists($cache_dir) && $dir = @opendir($cache_dir)) { |
|
142 | - while(($entry = readdir($dir)) !== false) { |
|
143 | - if ($entry == "." || $entry == "..") continue; |
|
144 | - foreach($languages as $clean_lang) { |
|
145 | - LanguageManager::_clearCache($entry, $clean_lang); |
|
146 | - } |
|
147 | - } |
|
148 | - closedir($dir); |
|
149 | - } |
|
150 | - } |
|
151 | - } |
|
121 | + /** |
|
122 | + * clear out the language cache. |
|
123 | + * @param string module_dir the module_dir to clear, if not specified then clear |
|
124 | + * clear language cache for all modules. |
|
125 | + * @param string lang the name of the object we are clearing this is for sugar_cache |
|
126 | + */ |
|
127 | + static function clearLanguageCache($module_dir = '', $lang = ''){ |
|
128 | + if(empty($lang)) { |
|
129 | + $languages = array_keys($GLOBALS['sugar_config']['languages']); |
|
130 | + } else { |
|
131 | + $languages = array($lang); |
|
132 | + } |
|
133 | + //if we have a module name specified then just remove that language file |
|
134 | + //otherwise go through each module and clean up the language |
|
135 | + if(!empty($module_dir)) { |
|
136 | + foreach($languages as $clean_lang) { |
|
137 | + LanguageManager::_clearCache($module_dir, $clean_lang); |
|
138 | + } |
|
139 | + } else { |
|
140 | + $cache_dir = sugar_cached('modules/'); |
|
141 | + if(file_exists($cache_dir) && $dir = @opendir($cache_dir)) { |
|
142 | + while(($entry = readdir($dir)) !== false) { |
|
143 | + if ($entry == "." || $entry == "..") continue; |
|
144 | + foreach($languages as $clean_lang) { |
|
145 | + LanguageManager::_clearCache($entry, $clean_lang); |
|
146 | + } |
|
147 | + } |
|
148 | + closedir($dir); |
|
149 | + } |
|
150 | + } |
|
151 | + } |
|
152 | 152 | |
153 | - /** |
|
154 | - * PRIVATE function used within clearLanguageCache so we do not repeat logic |
|
155 | - * @param string module_dir the module_dir to clear |
|
156 | - * @param string lang the name of the language file we are clearing this is for sugar_cache |
|
157 | - */ |
|
158 | - static function _clearCache($module_dir = '', $lang){ |
|
159 | - if(!empty($module_dir) && !empty($lang)){ |
|
160 | - $file = sugar_cached('modules/').$module_dir.'/language/'.$lang.'.lang.php'; |
|
161 | - if(file_exists($file)){ |
|
162 | - unlink($file); |
|
163 | - $key = self::getLanguageCacheKey($module_dir,$lang); |
|
164 | - sugar_cache_clear($key); |
|
165 | - } |
|
166 | - } |
|
167 | - } |
|
153 | + /** |
|
154 | + * PRIVATE function used within clearLanguageCache so we do not repeat logic |
|
155 | + * @param string module_dir the module_dir to clear |
|
156 | + * @param string lang the name of the language file we are clearing this is for sugar_cache |
|
157 | + */ |
|
158 | + static function _clearCache($module_dir = '', $lang){ |
|
159 | + if(!empty($module_dir) && !empty($lang)){ |
|
160 | + $file = sugar_cached('modules/').$module_dir.'/language/'.$lang.'.lang.php'; |
|
161 | + if(file_exists($file)){ |
|
162 | + unlink($file); |
|
163 | + $key = self::getLanguageCacheKey($module_dir,$lang); |
|
164 | + sugar_cache_clear($key); |
|
165 | + } |
|
166 | + } |
|
167 | + } |
|
168 | 168 | |
169 | - /** |
|
170 | - * Given a module, search all of the specified locations, and any others as specified |
|
171 | - * in order to refresh the cache file |
|
172 | - * |
|
173 | - * @param string $module the given module we want to load the vardefs for |
|
174 | - * @param string $lang the given language we wish to load |
|
175 | - * @param array $additional_search_paths an array which allows a consumer to pass in additional vardef locations to search |
|
176 | - */ |
|
177 | - static function refreshLanguage($module, $lang, $loaded_mod_strings = array(), $additional_search_paths = null){ |
|
178 | - // Some of the vardefs do not correctly define dictionary as global. Declare it first. |
|
179 | - $lang_paths = array( |
|
180 | - 'modules/'.$module.'/language/'.$lang.'.lang.php', |
|
181 | - 'modules/'.$module.'/language/'.$lang.'.lang.override.php', |
|
182 | - 'custom/modules/'.$module.'/language/'.$lang.'.lang.php', |
|
183 | - 'custom/modules/'.$module.'/Ext/Language/'.$lang.'.lang.ext.php', |
|
184 | - ); |
|
169 | + /** |
|
170 | + * Given a module, search all of the specified locations, and any others as specified |
|
171 | + * in order to refresh the cache file |
|
172 | + * |
|
173 | + * @param string $module the given module we want to load the vardefs for |
|
174 | + * @param string $lang the given language we wish to load |
|
175 | + * @param array $additional_search_paths an array which allows a consumer to pass in additional vardef locations to search |
|
176 | + */ |
|
177 | + static function refreshLanguage($module, $lang, $loaded_mod_strings = array(), $additional_search_paths = null){ |
|
178 | + // Some of the vardefs do not correctly define dictionary as global. Declare it first. |
|
179 | + $lang_paths = array( |
|
180 | + 'modules/'.$module.'/language/'.$lang.'.lang.php', |
|
181 | + 'modules/'.$module.'/language/'.$lang.'.lang.override.php', |
|
182 | + 'custom/modules/'.$module.'/language/'.$lang.'.lang.php', |
|
183 | + 'custom/modules/'.$module.'/Ext/Language/'.$lang.'.lang.ext.php', |
|
184 | + ); |
|
185 | 185 | |
186 | - #27023, if this module template language file was not attached , get the template from this module vardef cache file if exsits and load the template language files. |
|
187 | - static $createdModules; |
|
188 | - if(empty($createdModules[$module]) && isset($GLOBALS['beanList'][$module])){ |
|
189 | - $object = $GLOBALS['beanList'][$module]; |
|
186 | + #27023, if this module template language file was not attached , get the template from this module vardef cache file if exsits and load the template language files. |
|
187 | + static $createdModules; |
|
188 | + if(empty($createdModules[$module]) && isset($GLOBALS['beanList'][$module])){ |
|
189 | + $object = $GLOBALS['beanList'][$module]; |
|
190 | 190 | |
191 | - if ($object == 'aCase') |
|
192 | - $object = 'Case'; |
|
191 | + if ($object == 'aCase') |
|
192 | + $object = 'Case'; |
|
193 | 193 | |
194 | - if(!empty($GLOBALS["dictionary"]["$object"]["templates"])){ |
|
195 | - $templates = $GLOBALS["dictionary"]["$object"]["templates"]; |
|
196 | - $loaded_mod_strings = LanguageManager::loadTemplateLanguage($module , $templates, $lang , $loaded_mod_strings); |
|
197 | - $createdModules[$module] = true; |
|
198 | - } |
|
199 | - } |
|
200 | - //end of fix #27023 |
|
194 | + if(!empty($GLOBALS["dictionary"]["$object"]["templates"])){ |
|
195 | + $templates = $GLOBALS["dictionary"]["$object"]["templates"]; |
|
196 | + $loaded_mod_strings = LanguageManager::loadTemplateLanguage($module , $templates, $lang , $loaded_mod_strings); |
|
197 | + $createdModules[$module] = true; |
|
198 | + } |
|
199 | + } |
|
200 | + //end of fix #27023 |
|
201 | 201 | |
202 | - // Add in additional search paths if they were provided. |
|
203 | - if(!empty($additional_search_paths) && is_array($additional_search_paths)) |
|
204 | - { |
|
205 | - $lang_paths = array_merge($lang_paths, $additional_search_paths); |
|
206 | - } |
|
202 | + // Add in additional search paths if they were provided. |
|
203 | + if(!empty($additional_search_paths) && is_array($additional_search_paths)) |
|
204 | + { |
|
205 | + $lang_paths = array_merge($lang_paths, $additional_search_paths); |
|
206 | + } |
|
207 | 207 | |
208 | - //search a predefined set of locations for the vardef files |
|
209 | - foreach($lang_paths as $path){ |
|
210 | - if(file_exists($path)){ |
|
211 | - require($path); |
|
212 | - if(!empty($mod_strings)){ |
|
213 | - if (function_exists('sugarArrayMergeRecursive')){ |
|
214 | - $loaded_mod_strings = sugarArrayMergeRecursive($loaded_mod_strings, $mod_strings); |
|
215 | - } |
|
216 | - else{ |
|
217 | - $loaded_mod_strings = sugarLangArrayMerge($loaded_mod_strings, $mod_strings); |
|
218 | - } |
|
219 | - } |
|
220 | - } |
|
221 | - } |
|
208 | + //search a predefined set of locations for the vardef files |
|
209 | + foreach($lang_paths as $path){ |
|
210 | + if(file_exists($path)){ |
|
211 | + require($path); |
|
212 | + if(!empty($mod_strings)){ |
|
213 | + if (function_exists('sugarArrayMergeRecursive')){ |
|
214 | + $loaded_mod_strings = sugarArrayMergeRecursive($loaded_mod_strings, $mod_strings); |
|
215 | + } |
|
216 | + else{ |
|
217 | + $loaded_mod_strings = sugarLangArrayMerge($loaded_mod_strings, $mod_strings); |
|
218 | + } |
|
219 | + } |
|
220 | + } |
|
221 | + } |
|
222 | 222 | |
223 | - //great! now that we have loaded all of our vardefs. |
|
224 | - //let's go save them to the cache file. |
|
225 | - if(!empty($loaded_mod_strings)) |
|
226 | - LanguageManager::saveCache($module, $lang, $loaded_mod_strings); |
|
227 | - } |
|
223 | + //great! now that we have loaded all of our vardefs. |
|
224 | + //let's go save them to the cache file. |
|
225 | + if(!empty($loaded_mod_strings)) |
|
226 | + LanguageManager::saveCache($module, $lang, $loaded_mod_strings); |
|
227 | + } |
|
228 | 228 | |
229 | - static function loadModuleLanguage($module, $lang, $refresh=false){ |
|
230 | - //here check if the cache file exists, if it does then load it, if it doesn't |
|
231 | - //then call refreshVardef |
|
232 | - //if either our session or the system is set to developerMode then refresh is set to true |
|
229 | + static function loadModuleLanguage($module, $lang, $refresh=false){ |
|
230 | + //here check if the cache file exists, if it does then load it, if it doesn't |
|
231 | + //then call refreshVardef |
|
232 | + //if either our session or the system is set to developerMode then refresh is set to true |
|
233 | 233 | |
234 | - // Retrieve the vardefs from cache. |
|
235 | - $key = self::getLanguageCacheKey($module,$lang); |
|
234 | + // Retrieve the vardefs from cache. |
|
235 | + $key = self::getLanguageCacheKey($module,$lang); |
|
236 | 236 | |
237 | - if(!$refresh) |
|
238 | - { |
|
239 | - $return_result = sugar_cache_retrieve($key); |
|
240 | - if(!empty($return_result) && is_array($return_result)){ |
|
241 | - return $return_result; |
|
242 | - } |
|
243 | - } |
|
237 | + if(!$refresh) |
|
238 | + { |
|
239 | + $return_result = sugar_cache_retrieve($key); |
|
240 | + if(!empty($return_result) && is_array($return_result)){ |
|
241 | + return $return_result; |
|
242 | + } |
|
243 | + } |
|
244 | 244 | |
245 | - // Some of the vardefs do not correctly define dictionary as global. Declare it first. |
|
246 | - $cachedfile = sugar_cached('modules/').$module.'/language/'.$lang.'.lang.php'; |
|
247 | - if($refresh || !file_exists($cachedfile)){ |
|
248 | - LanguageManager::refreshLanguage($module, $lang); |
|
249 | - } |
|
245 | + // Some of the vardefs do not correctly define dictionary as global. Declare it first. |
|
246 | + $cachedfile = sugar_cached('modules/').$module.'/language/'.$lang.'.lang.php'; |
|
247 | + if($refresh || !file_exists($cachedfile)){ |
|
248 | + LanguageManager::refreshLanguage($module, $lang); |
|
249 | + } |
|
250 | 250 | |
251 | - //at this point we should have the cache/modules/... file |
|
252 | - //which was created from the refreshVardefs so let's try to load it. |
|
253 | - if(file_exists($cachedfile)){ |
|
254 | - global $mod_strings; |
|
251 | + //at this point we should have the cache/modules/... file |
|
252 | + //which was created from the refreshVardefs so let's try to load it. |
|
253 | + if(file_exists($cachedfile)){ |
|
254 | + global $mod_strings; |
|
255 | 255 | |
256 | - require $cachedfile; |
|
256 | + require $cachedfile; |
|
257 | 257 | |
258 | - // now that we hae loaded the data from disk, put it in the cache. |
|
259 | - if(!empty($mod_strings)) |
|
260 | - sugar_cache_put($key,$mod_strings); |
|
261 | - if(!empty($_SESSION['translation_mode'])){ |
|
262 | - $mod_strings = array_map('translated_prefix', $mod_strings); |
|
263 | - } |
|
264 | - return $mod_strings; |
|
265 | - } |
|
266 | - } |
|
258 | + // now that we hae loaded the data from disk, put it in the cache. |
|
259 | + if(!empty($mod_strings)) |
|
260 | + sugar_cache_put($key,$mod_strings); |
|
261 | + if(!empty($_SESSION['translation_mode'])){ |
|
262 | + $mod_strings = array_map('translated_prefix', $mod_strings); |
|
263 | + } |
|
264 | + return $mod_strings; |
|
265 | + } |
|
266 | + } |
|
267 | 267 | |
268 | 268 | /** |
269 | 269 | * Return the cache key for the module language definition |
@@ -274,9 +274,9 @@ discard block |
||
274 | 274 | * @return string |
275 | 275 | */ |
276 | 276 | public static function getLanguageCacheKey($module, $lang) |
277 | - { |
|
278 | - return "LanguageManager.$module.$lang"; |
|
279 | - } |
|
277 | + { |
|
278 | + return "LanguageManager.$module.$lang"; |
|
279 | + } |
|
280 | 280 | |
281 | 281 | /** |
282 | 282 | * Remove any cached js language strings. |
@@ -302,5 +302,5 @@ discard block |
||
302 | 302 | } |
303 | 303 | |
304 | 304 | function translated_prefix($key){ |
305 | - return '[translated]' . $key; |
|
305 | + return '[translated]' . $key; |
|
306 | 306 | } |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public static function setCustomAllowedForModule($module, $enable) { |
91 | 91 | if ($enable && isset($custom_disabled_modules[$module])) { |
92 | - unset($custom_disabled_modules[$module]); |
|
92 | + unset($custom_disabled_modules[$module]); |
|
93 | 93 | } else if (!$enable) { |
94 | - $custom_disabled_modules[$module] = true; |
|
94 | + $custom_disabled_modules[$module] = true; |
|
95 | 95 | } |
96 | 96 | } |
97 | 97 | |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | 'modules/'.$module.'/vardefs.php', |
237 | 237 | 'custom/modules/'.$module.'/Ext/Vardefs/vardefs.ext.php', |
238 | 238 | 'custom/Extension/modules/'.$module.'/Ext/Vardefs/vardefs.php' |
239 | - ); |
|
239 | + ); |
|
240 | 240 | |
241 | 241 | // Add in additional search paths if they were provided. |
242 | 242 | if(!empty($additional_search_paths) && is_array($additional_search_paths)) |
@@ -426,10 +426,10 @@ discard block |
||
426 | 426 | //if the consumer has demanded a refresh or the cache/modules... file |
427 | 427 | //does not exist, then we should do out and try to reload things |
428 | 428 | |
429 | - $cachedfile = sugar_cached('modules/'). $module . '/' . $object . 'vardefs.php'; |
|
430 | - if($refresh || !file_exists($cachedfile)){ |
|
431 | - VardefManager::refreshVardefs($module, $object, null, true, $params); |
|
432 | - } |
|
429 | + $cachedfile = sugar_cached('modules/'). $module . '/' . $object . 'vardefs.php'; |
|
430 | + if($refresh || !file_exists($cachedfile)){ |
|
431 | + VardefManager::refreshVardefs($module, $object, null, true, $params); |
|
432 | + } |
|
433 | 433 | |
434 | 434 | //at this point we should have the cache/modules/... file |
435 | 435 | //which was created from the refreshVardefs so let's try to load it. |