@@ -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 |
@@ -44,247 +44,247 @@ discard block |
||
44 | 44 | * @api |
45 | 45 | */ |
46 | 46 | class SugarController{ |
47 | - /** |
|
48 | - * remap actions in here |
|
49 | - * e.g. make all detail views go to edit views |
|
50 | - * $action_remap = array('detailview'=>'editview'); |
|
51 | - */ |
|
52 | - protected $action_remap = array('index'=>'listview'); |
|
53 | - /** |
|
54 | - * The name of the current module. |
|
55 | - */ |
|
56 | - public $module = 'Home'; |
|
57 | - /** |
|
58 | - * The name of the target module. |
|
59 | - */ |
|
60 | - public $target_module = null; |
|
61 | - /** |
|
62 | - * The name of the current action. |
|
63 | - */ |
|
64 | - public $action = 'index'; |
|
65 | - /** |
|
66 | - * The id of the current record. |
|
67 | - */ |
|
68 | - public $record = ''; |
|
69 | - /** |
|
70 | - * The name of the return module. |
|
71 | - */ |
|
72 | - public $return_module = null; |
|
73 | - /** |
|
74 | - * The name of the return action. |
|
75 | - */ |
|
76 | - public $return_action = null; |
|
77 | - /** |
|
78 | - * The id of the return record. |
|
79 | - */ |
|
80 | - public $return_id = null; |
|
81 | - /** |
|
82 | - * If the action was remapped it will be set to do_action and then we will just |
|
83 | - * use do_action for the actual action to perform. |
|
84 | - */ |
|
85 | - protected $do_action = 'index'; |
|
86 | - /** |
|
87 | - * If a bean is present that set it. |
|
88 | - */ |
|
89 | - public $bean = null; |
|
90 | - /** |
|
91 | - * url to redirect to |
|
92 | - */ |
|
93 | - public $redirect_url = ''; |
|
94 | - /** |
|
95 | - * any subcontroller can modify this to change the view |
|
96 | - */ |
|
97 | - public $view = 'classic'; |
|
98 | - /** |
|
99 | - * this array will hold the mappings between a key and an object for use within the view. |
|
100 | - */ |
|
101 | - public $view_object_map = array(); |
|
47 | + /** |
|
48 | + * remap actions in here |
|
49 | + * e.g. make all detail views go to edit views |
|
50 | + * $action_remap = array('detailview'=>'editview'); |
|
51 | + */ |
|
52 | + protected $action_remap = array('index'=>'listview'); |
|
53 | + /** |
|
54 | + * The name of the current module. |
|
55 | + */ |
|
56 | + public $module = 'Home'; |
|
57 | + /** |
|
58 | + * The name of the target module. |
|
59 | + */ |
|
60 | + public $target_module = null; |
|
61 | + /** |
|
62 | + * The name of the current action. |
|
63 | + */ |
|
64 | + public $action = 'index'; |
|
65 | + /** |
|
66 | + * The id of the current record. |
|
67 | + */ |
|
68 | + public $record = ''; |
|
69 | + /** |
|
70 | + * The name of the return module. |
|
71 | + */ |
|
72 | + public $return_module = null; |
|
73 | + /** |
|
74 | + * The name of the return action. |
|
75 | + */ |
|
76 | + public $return_action = null; |
|
77 | + /** |
|
78 | + * The id of the return record. |
|
79 | + */ |
|
80 | + public $return_id = null; |
|
81 | + /** |
|
82 | + * If the action was remapped it will be set to do_action and then we will just |
|
83 | + * use do_action for the actual action to perform. |
|
84 | + */ |
|
85 | + protected $do_action = 'index'; |
|
86 | + /** |
|
87 | + * If a bean is present that set it. |
|
88 | + */ |
|
89 | + public $bean = null; |
|
90 | + /** |
|
91 | + * url to redirect to |
|
92 | + */ |
|
93 | + public $redirect_url = ''; |
|
94 | + /** |
|
95 | + * any subcontroller can modify this to change the view |
|
96 | + */ |
|
97 | + public $view = 'classic'; |
|
98 | + /** |
|
99 | + * this array will hold the mappings between a key and an object for use within the view. |
|
100 | + */ |
|
101 | + public $view_object_map = array(); |
|
102 | 102 | |
103 | - /** |
|
104 | - * This array holds the methods that handleAction() will invoke, in sequence. |
|
105 | - */ |
|
106 | - protected $tasks = array( |
|
107 | - 'pre_action', |
|
108 | - 'do_action', |
|
109 | - 'post_action' |
|
110 | - ); |
|
111 | - /** |
|
112 | - * List of options to run through within the process() method. |
|
113 | - * This list is meant to easily allow additions for new functionality as well as |
|
114 | - * the ability to add a controller's own handling. |
|
115 | - */ |
|
116 | - public $process_tasks = array( |
|
117 | - 'blockFileAccess', |
|
118 | - 'handleEntryPoint', |
|
119 | - 'callLegacyCode', |
|
120 | - 'remapAction', |
|
121 | - 'handle_action', |
|
122 | - 'handleActionMaps', |
|
123 | - ); |
|
124 | - /** |
|
125 | - * Whether or not the action has been handled by $process_tasks |
|
126 | - * |
|
127 | - * @var bool |
|
128 | - */ |
|
129 | - protected $_processed = false; |
|
130 | - /** |
|
131 | - * Map an action directly to a file |
|
132 | - */ |
|
133 | - /** |
|
134 | - * Map an action directly to a file. This will be loaded from action_file_map.php |
|
135 | - */ |
|
136 | - protected $action_file_map = array(); |
|
137 | - /** |
|
138 | - * Map an action directly to a view |
|
139 | - */ |
|
140 | - /** |
|
141 | - * Map an action directly to a view. This will be loaded from action_view_map.php |
|
142 | - */ |
|
143 | - protected $action_view_map = array(); |
|
103 | + /** |
|
104 | + * This array holds the methods that handleAction() will invoke, in sequence. |
|
105 | + */ |
|
106 | + protected $tasks = array( |
|
107 | + 'pre_action', |
|
108 | + 'do_action', |
|
109 | + 'post_action' |
|
110 | + ); |
|
111 | + /** |
|
112 | + * List of options to run through within the process() method. |
|
113 | + * This list is meant to easily allow additions for new functionality as well as |
|
114 | + * the ability to add a controller's own handling. |
|
115 | + */ |
|
116 | + public $process_tasks = array( |
|
117 | + 'blockFileAccess', |
|
118 | + 'handleEntryPoint', |
|
119 | + 'callLegacyCode', |
|
120 | + 'remapAction', |
|
121 | + 'handle_action', |
|
122 | + 'handleActionMaps', |
|
123 | + ); |
|
124 | + /** |
|
125 | + * Whether or not the action has been handled by $process_tasks |
|
126 | + * |
|
127 | + * @var bool |
|
128 | + */ |
|
129 | + protected $_processed = false; |
|
130 | + /** |
|
131 | + * Map an action directly to a file |
|
132 | + */ |
|
133 | + /** |
|
134 | + * Map an action directly to a file. This will be loaded from action_file_map.php |
|
135 | + */ |
|
136 | + protected $action_file_map = array(); |
|
137 | + /** |
|
138 | + * Map an action directly to a view |
|
139 | + */ |
|
140 | + /** |
|
141 | + * Map an action directly to a view. This will be loaded from action_view_map.php |
|
142 | + */ |
|
143 | + protected $action_view_map = array(); |
|
144 | 144 | |
145 | - /** |
|
146 | - * This can be set from the application to tell us whether we have authorization to |
|
147 | - * process the action. If this is set we will default to the noaccess view. |
|
148 | - */ |
|
149 | - public $hasAccess = true; |
|
145 | + /** |
|
146 | + * This can be set from the application to tell us whether we have authorization to |
|
147 | + * process the action. If this is set we will default to the noaccess view. |
|
148 | + */ |
|
149 | + public $hasAccess = true; |
|
150 | 150 | |
151 | - /** |
|
152 | - * Map case sensitive filenames to action. This is used for linux/unix systems |
|
153 | - * where filenames are case sensitive |
|
154 | - */ |
|
155 | - public static $action_case_file = array( |
|
156 | - 'editview'=>'EditView', |
|
157 | - 'detailview'=>'DetailView', |
|
158 | - 'listview'=>'ListView' |
|
159 | - ); |
|
160 | - |
|
161 | - /** |
|
162 | - * Constructor. This ie meant tot load up the module, action, record as well |
|
163 | - * as the mapping arrays. |
|
164 | - */ |
|
165 | - function SugarController(){ |
|
166 | - } |
|
151 | + /** |
|
152 | + * Map case sensitive filenames to action. This is used for linux/unix systems |
|
153 | + * where filenames are case sensitive |
|
154 | + */ |
|
155 | + public static $action_case_file = array( |
|
156 | + 'editview'=>'EditView', |
|
157 | + 'detailview'=>'DetailView', |
|
158 | + 'listview'=>'ListView' |
|
159 | + ); |
|
167 | 160 | |
168 | - /** |
|
169 | - * Called from SugarApplication and is meant to perform the setup operations |
|
170 | - * on the controller. |
|
171 | - * |
|
172 | - */ |
|
173 | - public function setup($module = ''){ |
|
174 | - if(empty($module) && !empty($_REQUEST['module'])) |
|
175 | - $module = $_REQUEST['module']; |
|
176 | - //set the module |
|
177 | - if(!empty($module)) |
|
178 | - $this->setModule($module); |
|
179 | - |
|
180 | - if(!empty($_REQUEST['target_module']) && $_REQUEST['target_module'] != 'undefined') { |
|
181 | - $this->target_module = $_REQUEST['target_module']; |
|
182 | - } |
|
183 | - //set properties on the controller from the $_REQUEST |
|
184 | - $this->loadPropertiesFromRequest(); |
|
185 | - //load the mapping files |
|
186 | - $this->loadMappings(); |
|
187 | - } |
|
188 | - /** |
|
189 | - * Set the module on the Controller |
|
190 | - * |
|
191 | - * @param object $module |
|
192 | - */ |
|
193 | - public function setModule($module){ |
|
194 | - $this->module = $module; |
|
195 | - } |
|
161 | + /** |
|
162 | + * Constructor. This ie meant tot load up the module, action, record as well |
|
163 | + * as the mapping arrays. |
|
164 | + */ |
|
165 | + function SugarController(){ |
|
166 | + } |
|
196 | 167 | |
197 | - /** |
|
198 | - * Set properties on the Controller from the $_REQUEST |
|
199 | - * |
|
200 | - */ |
|
201 | - private function loadPropertiesFromRequest(){ |
|
202 | - if(!empty($_REQUEST['action'])) |
|
203 | - $this->action = $_REQUEST['action']; |
|
204 | - if(!empty($_REQUEST['record'])) |
|
205 | - $this->record = $_REQUEST['record']; |
|
206 | - if(!empty($_REQUEST['view'])) |
|
207 | - $this->view = $_REQUEST['view']; |
|
208 | - if(!empty($_REQUEST['return_module'])) |
|
209 | - $this->return_module = $_REQUEST['return_module']; |
|
210 | - if(!empty($_REQUEST['return_action'])) |
|
211 | - $this->return_action = $_REQUEST['return_action']; |
|
212 | - if(!empty($_REQUEST['return_id'])) |
|
213 | - $this->return_id = $_REQUEST['return_id']; |
|
214 | - } |
|
168 | + /** |
|
169 | + * Called from SugarApplication and is meant to perform the setup operations |
|
170 | + * on the controller. |
|
171 | + * |
|
172 | + */ |
|
173 | + public function setup($module = ''){ |
|
174 | + if(empty($module) && !empty($_REQUEST['module'])) |
|
175 | + $module = $_REQUEST['module']; |
|
176 | + //set the module |
|
177 | + if(!empty($module)) |
|
178 | + $this->setModule($module); |
|
179 | + |
|
180 | + if(!empty($_REQUEST['target_module']) && $_REQUEST['target_module'] != 'undefined') { |
|
181 | + $this->target_module = $_REQUEST['target_module']; |
|
182 | + } |
|
183 | + //set properties on the controller from the $_REQUEST |
|
184 | + $this->loadPropertiesFromRequest(); |
|
185 | + //load the mapping files |
|
186 | + $this->loadMappings(); |
|
187 | + } |
|
188 | + /** |
|
189 | + * Set the module on the Controller |
|
190 | + * |
|
191 | + * @param object $module |
|
192 | + */ |
|
193 | + public function setModule($module){ |
|
194 | + $this->module = $module; |
|
195 | + } |
|
215 | 196 | |
216 | - /** |
|
217 | - * Load map files for use within the Controller |
|
218 | - * |
|
219 | - */ |
|
220 | - private function loadMappings(){ |
|
221 | - $this->loadMapping('action_view_map'); |
|
222 | - $this->loadMapping('action_file_map'); |
|
223 | - $this->loadMapping('action_remap', true); |
|
224 | - } |
|
197 | + /** |
|
198 | + * Set properties on the Controller from the $_REQUEST |
|
199 | + * |
|
200 | + */ |
|
201 | + private function loadPropertiesFromRequest(){ |
|
202 | + if(!empty($_REQUEST['action'])) |
|
203 | + $this->action = $_REQUEST['action']; |
|
204 | + if(!empty($_REQUEST['record'])) |
|
205 | + $this->record = $_REQUEST['record']; |
|
206 | + if(!empty($_REQUEST['view'])) |
|
207 | + $this->view = $_REQUEST['view']; |
|
208 | + if(!empty($_REQUEST['return_module'])) |
|
209 | + $this->return_module = $_REQUEST['return_module']; |
|
210 | + if(!empty($_REQUEST['return_action'])) |
|
211 | + $this->return_action = $_REQUEST['return_action']; |
|
212 | + if(!empty($_REQUEST['return_id'])) |
|
213 | + $this->return_id = $_REQUEST['return_id']; |
|
214 | + } |
|
225 | 215 | |
226 | - /** |
|
227 | - * Given a record id load the bean. This bean is accessible from any sub controllers. |
|
228 | - */ |
|
229 | - public function loadBean() |
|
230 | - { |
|
231 | - if(!empty($GLOBALS['beanList'][$this->module])){ |
|
232 | - $class = $GLOBALS['beanList'][$this->module]; |
|
233 | - if(!empty($GLOBALS['beanFiles'][$class])){ |
|
234 | - require_once($GLOBALS['beanFiles'][$class]); |
|
235 | - $this->bean = new $class(); |
|
236 | - if(!empty($this->record)){ |
|
237 | - $this->bean->retrieve($this->record); |
|
238 | - if($this->bean) |
|
239 | - $GLOBALS['FOCUS'] = $this->bean; |
|
240 | - } |
|
241 | - } |
|
242 | - } |
|
243 | - } |
|
216 | + /** |
|
217 | + * Load map files for use within the Controller |
|
218 | + * |
|
219 | + */ |
|
220 | + private function loadMappings(){ |
|
221 | + $this->loadMapping('action_view_map'); |
|
222 | + $this->loadMapping('action_file_map'); |
|
223 | + $this->loadMapping('action_remap', true); |
|
224 | + } |
|
244 | 225 | |
245 | - /** |
|
246 | - * Generic load method to load mapping arrays. |
|
247 | - */ |
|
248 | - private function loadMapping($var, $merge = false){ |
|
249 | - $$var = sugar_cache_retrieve("CONTROLLER_". $var . "_".$this->module); |
|
250 | - if(!$$var){ |
|
251 | - if($merge && !empty($this->$var)){ |
|
252 | - $$var = $this->$var; |
|
253 | - }else{ |
|
254 | - $$var = array(); |
|
255 | - } |
|
256 | - if(file_exists('include/MVC/Controller/'. $var . '.php')){ |
|
257 | - require('include/MVC/Controller/'. $var . '.php'); |
|
258 | - } |
|
259 | - if(file_exists('modules/'.$this->module.'/'. $var . '.php')){ |
|
260 | - require('modules/'.$this->module.'/'. $var . '.php'); |
|
261 | - } |
|
262 | - if(file_exists('custom/modules/'.$this->module.'/'. $var . '.php')){ |
|
263 | - require('custom/modules/'.$this->module.'/'. $var . '.php'); |
|
264 | - } |
|
265 | - if(file_exists('custom/include/MVC/Controller/'. $var . '.php')){ |
|
266 | - require('custom/include/MVC/Controller/'. $var . '.php'); |
|
267 | - } |
|
226 | + /** |
|
227 | + * Given a record id load the bean. This bean is accessible from any sub controllers. |
|
228 | + */ |
|
229 | + public function loadBean() |
|
230 | + { |
|
231 | + if(!empty($GLOBALS['beanList'][$this->module])){ |
|
232 | + $class = $GLOBALS['beanList'][$this->module]; |
|
233 | + if(!empty($GLOBALS['beanFiles'][$class])){ |
|
234 | + require_once($GLOBALS['beanFiles'][$class]); |
|
235 | + $this->bean = new $class(); |
|
236 | + if(!empty($this->record)){ |
|
237 | + $this->bean->retrieve($this->record); |
|
238 | + if($this->bean) |
|
239 | + $GLOBALS['FOCUS'] = $this->bean; |
|
240 | + } |
|
241 | + } |
|
242 | + } |
|
243 | + } |
|
244 | + |
|
245 | + /** |
|
246 | + * Generic load method to load mapping arrays. |
|
247 | + */ |
|
248 | + private function loadMapping($var, $merge = false){ |
|
249 | + $$var = sugar_cache_retrieve("CONTROLLER_". $var . "_".$this->module); |
|
250 | + if(!$$var){ |
|
251 | + if($merge && !empty($this->$var)){ |
|
252 | + $$var = $this->$var; |
|
253 | + }else{ |
|
254 | + $$var = array(); |
|
255 | + } |
|
256 | + if(file_exists('include/MVC/Controller/'. $var . '.php')){ |
|
257 | + require('include/MVC/Controller/'. $var . '.php'); |
|
258 | + } |
|
259 | + if(file_exists('modules/'.$this->module.'/'. $var . '.php')){ |
|
260 | + require('modules/'.$this->module.'/'. $var . '.php'); |
|
261 | + } |
|
262 | + if(file_exists('custom/modules/'.$this->module.'/'. $var . '.php')){ |
|
263 | + require('custom/modules/'.$this->module.'/'. $var . '.php'); |
|
264 | + } |
|
265 | + if(file_exists('custom/include/MVC/Controller/'. $var . '.php')){ |
|
266 | + require('custom/include/MVC/Controller/'. $var . '.php'); |
|
267 | + } |
|
268 | 268 | |
269 | 269 | // entry_point_registry -> EntryPointRegistry |
270 | 270 | |
271 | - $varname = str_replace(" ","",ucwords(str_replace("_"," ", $var))); |
|
271 | + $varname = str_replace(" ","",ucwords(str_replace("_"," ", $var))); |
|
272 | 272 | if(file_exists("custom/application/Ext/$varname/$var.ext.php")){ |
273 | - require("custom/application/Ext/$varname/$var.ext.php"); |
|
274 | - } |
|
275 | - if(file_exists("custom/modules/{$this->module}/Ext/$varname/$var.ext.php")){ |
|
276 | - require("custom/modules/{$this->module}/Ext/$varname/$var.ext.php"); |
|
277 | - } |
|
278 | - |
|
279 | - sugar_cache_put("CONTROLLER_". $var . "_".$this->module, $$var); |
|
280 | - } |
|
281 | - $this->$var = $$var; |
|
282 | - } |
|
273 | + require("custom/application/Ext/$varname/$var.ext.php"); |
|
274 | + } |
|
275 | + if(file_exists("custom/modules/{$this->module}/Ext/$varname/$var.ext.php")){ |
|
276 | + require("custom/modules/{$this->module}/Ext/$varname/$var.ext.php"); |
|
277 | + } |
|
283 | 278 | |
284 | - /** |
|
285 | - * This method is called from SugarApplication->execute and it will bootstrap the entire controller process |
|
286 | - */ |
|
287 | - final public function execute() |
|
279 | + sugar_cache_put("CONTROLLER_". $var . "_".$this->module, $$var); |
|
280 | + } |
|
281 | + $this->$var = $$var; |
|
282 | + } |
|
283 | + |
|
284 | + /** |
|
285 | + * This method is called from SugarApplication->execute and it will bootstrap the entire controller process |
|
286 | + */ |
|
287 | + final public function execute() |
|
288 | 288 | { |
289 | 289 | |
290 | 290 | try |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | } |
297 | 297 | elseif(!empty($this->redirect_url)) |
298 | 298 | { |
299 | - $this->redirect(); |
|
299 | + $this->redirect(); |
|
300 | 300 | } |
301 | 301 | } |
302 | 302 | catch (Exception $e) |
@@ -306,12 +306,12 @@ discard block |
||
306 | 306 | |
307 | 307 | |
308 | 308 | |
309 | - } |
|
309 | + } |
|
310 | 310 | |
311 | 311 | /** |
312 | - * Handle exception |
|
313 | - * @param Exception $e |
|
314 | - */ |
|
312 | + * Handle exception |
|
313 | + * @param Exception $e |
|
314 | + */ |
|
315 | 315 | protected function handleException(Exception $e) |
316 | 316 | { |
317 | 317 | $GLOBALS['log']->fatal('Exception in Controller: ' . $e->getMessage()); |
@@ -328,52 +328,52 @@ discard block |
||
328 | 328 | } |
329 | 329 | } |
330 | 330 | |
331 | - /** |
|
332 | - * Display the appropriate view. |
|
333 | - */ |
|
334 | - private function processView(){ |
|
335 | - if(!isset($this->view_object_map['remap_action']) && isset($this->action_view_map[strtolower($this->action)])) |
|
336 | - { |
|
337 | - $this->view_object_map['remap_action'] = $this->action_view_map[strtolower($this->action)]; |
|
338 | - } |
|
339 | - $view = ViewFactory::loadView($this->view, $this->module, $this->bean, $this->view_object_map, $this->target_module); |
|
340 | - $GLOBALS['current_view'] = $view; |
|
341 | - if(!empty($this->bean) && !$this->bean->ACLAccess($view->type) && $view->type != 'list'){ |
|
342 | - ACLController::displayNoAccess(true); |
|
343 | - sugar_cleanup(true); |
|
344 | - } |
|
345 | - if(isset($this->errors)){ |
|
346 | - $view->errors = $this->errors; |
|
347 | - } |
|
348 | - $view->process(); |
|
349 | - } |
|
331 | + /** |
|
332 | + * Display the appropriate view. |
|
333 | + */ |
|
334 | + private function processView(){ |
|
335 | + if(!isset($this->view_object_map['remap_action']) && isset($this->action_view_map[strtolower($this->action)])) |
|
336 | + { |
|
337 | + $this->view_object_map['remap_action'] = $this->action_view_map[strtolower($this->action)]; |
|
338 | + } |
|
339 | + $view = ViewFactory::loadView($this->view, $this->module, $this->bean, $this->view_object_map, $this->target_module); |
|
340 | + $GLOBALS['current_view'] = $view; |
|
341 | + if(!empty($this->bean) && !$this->bean->ACLAccess($view->type) && $view->type != 'list'){ |
|
342 | + ACLController::displayNoAccess(true); |
|
343 | + sugar_cleanup(true); |
|
344 | + } |
|
345 | + if(isset($this->errors)){ |
|
346 | + $view->errors = $this->errors; |
|
347 | + } |
|
348 | + $view->process(); |
|
349 | + } |
|
350 | 350 | |
351 | - /** |
|
352 | - * Meant to be overridden by a subclass and allows for specific functionality to be |
|
353 | - * injected prior to the process() method being called. |
|
354 | - */ |
|
355 | - public function preProcess() |
|
356 | - {} |
|
357 | - |
|
358 | - /** |
|
359 | - * if we have a function to support the action use it otherwise use the default action |
|
360 | - * |
|
361 | - * 1) check for file |
|
362 | - * 2) check for action |
|
363 | - */ |
|
364 | - public function process(){ |
|
365 | - $GLOBALS['action'] = $this->action; |
|
366 | - $GLOBALS['module'] = $this->module; |
|
351 | + /** |
|
352 | + * Meant to be overridden by a subclass and allows for specific functionality to be |
|
353 | + * injected prior to the process() method being called. |
|
354 | + */ |
|
355 | + public function preProcess() |
|
356 | + {} |
|
367 | 357 | |
368 | - //check to ensure we have access to the module. |
|
369 | - if($this->hasAccess){ |
|
370 | - $this->do_action = $this->action; |
|
358 | + /** |
|
359 | + * if we have a function to support the action use it otherwise use the default action |
|
360 | + * |
|
361 | + * 1) check for file |
|
362 | + * 2) check for action |
|
363 | + */ |
|
364 | + public function process(){ |
|
365 | + $GLOBALS['action'] = $this->action; |
|
366 | + $GLOBALS['module'] = $this->module; |
|
371 | 367 | |
372 | - $file = self::getActionFilename($this->do_action); |
|
368 | + //check to ensure we have access to the module. |
|
369 | + if($this->hasAccess){ |
|
370 | + $this->do_action = $this->action; |
|
373 | 371 | |
374 | - $this->loadBean(); |
|
372 | + $file = self::getActionFilename($this->do_action); |
|
375 | 373 | |
376 | - $processed = false; |
|
374 | + $this->loadBean(); |
|
375 | + |
|
376 | + $processed = false; |
|
377 | 377 | if (!$this->_processed) { |
378 | 378 | foreach ($this->process_tasks as $process) { |
379 | 379 | $this->$process(); |
@@ -383,173 +383,173 @@ discard block |
||
383 | 383 | } |
384 | 384 | } |
385 | 385 | |
386 | - $this->redirect(); |
|
387 | - }else{ |
|
388 | - $this->no_access(); |
|
389 | - } |
|
390 | - } |
|
386 | + $this->redirect(); |
|
387 | + }else{ |
|
388 | + $this->no_access(); |
|
389 | + } |
|
390 | + } |
|
391 | 391 | |
392 | - /** |
|
393 | - * This method is called from the process method. I could also be called within an action_* method. |
|
394 | - * It allows a developer to override any one of these methods contained within, |
|
395 | - * or if the developer so chooses they can override the entire action_* method. |
|
396 | - * |
|
397 | - * @return true if any one of the pre_, do_, or post_ methods have been defined, |
|
398 | - * false otherwise. This is important b/c if none of these methods exists, then we will run the |
|
399 | - * action_default() method. |
|
400 | - */ |
|
401 | - protected function handle_action(){ |
|
402 | - $processed = false; |
|
403 | - foreach($this->tasks as $task){ |
|
404 | - $processed = ($this->$task() || $processed); |
|
405 | - } |
|
406 | - $this->_processed = $processed; |
|
407 | - } |
|
392 | + /** |
|
393 | + * This method is called from the process method. I could also be called within an action_* method. |
|
394 | + * It allows a developer to override any one of these methods contained within, |
|
395 | + * or if the developer so chooses they can override the entire action_* method. |
|
396 | + * |
|
397 | + * @return true if any one of the pre_, do_, or post_ methods have been defined, |
|
398 | + * false otherwise. This is important b/c if none of these methods exists, then we will run the |
|
399 | + * action_default() method. |
|
400 | + */ |
|
401 | + protected function handle_action(){ |
|
402 | + $processed = false; |
|
403 | + foreach($this->tasks as $task){ |
|
404 | + $processed = ($this->$task() || $processed); |
|
405 | + } |
|
406 | + $this->_processed = $processed; |
|
407 | + } |
|
408 | 408 | |
409 | - /** |
|
410 | - * Perform an action prior to the specified action. |
|
411 | - * This can be overridde in a sub-class |
|
412 | - */ |
|
413 | - private function pre_action(){ |
|
414 | - $function = 'pre_' . $this->action; |
|
415 | - if($this->hasFunction($function)){ |
|
416 | - $GLOBALS['log']->debug('Performing pre_action'); |
|
417 | - $this->$function(); |
|
418 | - return true; |
|
419 | - } |
|
420 | - return false; |
|
421 | - } |
|
409 | + /** |
|
410 | + * Perform an action prior to the specified action. |
|
411 | + * This can be overridde in a sub-class |
|
412 | + */ |
|
413 | + private function pre_action(){ |
|
414 | + $function = 'pre_' . $this->action; |
|
415 | + if($this->hasFunction($function)){ |
|
416 | + $GLOBALS['log']->debug('Performing pre_action'); |
|
417 | + $this->$function(); |
|
418 | + return true; |
|
419 | + } |
|
420 | + return false; |
|
421 | + } |
|
422 | 422 | |
423 | - /** |
|
424 | - * Perform the specified action. |
|
425 | - * This can be overridde in a sub-class |
|
426 | - */ |
|
427 | - private function do_action(){ |
|
428 | - $function = 'action_'. strtolower($this->do_action); |
|
429 | - if($this->hasFunction($function)){ |
|
430 | - $GLOBALS['log']->debug('Performing action: '.$function.' MODULE: '.$this->module); |
|
431 | - $this->$function(); |
|
432 | - return true; |
|
433 | - } |
|
434 | - return false; |
|
435 | - } |
|
423 | + /** |
|
424 | + * Perform the specified action. |
|
425 | + * This can be overridde in a sub-class |
|
426 | + */ |
|
427 | + private function do_action(){ |
|
428 | + $function = 'action_'. strtolower($this->do_action); |
|
429 | + if($this->hasFunction($function)){ |
|
430 | + $GLOBALS['log']->debug('Performing action: '.$function.' MODULE: '.$this->module); |
|
431 | + $this->$function(); |
|
432 | + return true; |
|
433 | + } |
|
434 | + return false; |
|
435 | + } |
|
436 | 436 | |
437 | - /** |
|
438 | - * Perform an action after to the specified action has occurred. |
|
439 | - * This can be overridde in a sub-class |
|
440 | - */ |
|
441 | - private function post_action(){ |
|
442 | - $function = 'post_' . $this->action; |
|
443 | - if($this->hasFunction($function)){ |
|
444 | - $GLOBALS['log']->debug('Performing post_action'); |
|
445 | - $this->$function(); |
|
446 | - return true; |
|
447 | - } |
|
448 | - return false; |
|
449 | - } |
|
437 | + /** |
|
438 | + * Perform an action after to the specified action has occurred. |
|
439 | + * This can be overridde in a sub-class |
|
440 | + */ |
|
441 | + private function post_action(){ |
|
442 | + $function = 'post_' . $this->action; |
|
443 | + if($this->hasFunction($function)){ |
|
444 | + $GLOBALS['log']->debug('Performing post_action'); |
|
445 | + $this->$function(); |
|
446 | + return true; |
|
447 | + } |
|
448 | + return false; |
|
449 | + } |
|
450 | 450 | |
451 | - /** |
|
452 | - * If there is no action found then display an error to the user. |
|
453 | - */ |
|
454 | - protected function no_action(){ |
|
455 | - sugar_die($GLOBALS['app_strings']['LBL_NO_ACTION']); |
|
456 | - } |
|
451 | + /** |
|
452 | + * If there is no action found then display an error to the user. |
|
453 | + */ |
|
454 | + protected function no_action(){ |
|
455 | + sugar_die($GLOBALS['app_strings']['LBL_NO_ACTION']); |
|
456 | + } |
|
457 | 457 | |
458 | - /** |
|
459 | - * The default action handler for instances where we do not have access to process. |
|
460 | - */ |
|
461 | - protected function no_access(){ |
|
462 | - $this->view = 'noaccess'; |
|
463 | - } |
|
458 | + /** |
|
459 | + * The default action handler for instances where we do not have access to process. |
|
460 | + */ |
|
461 | + protected function no_access(){ |
|
462 | + $this->view = 'noaccess'; |
|
463 | + } |
|
464 | 464 | |
465 | - /////////////////////////////////////////////// |
|
466 | - /////// HELPER FUNCTIONS |
|
467 | - /////////////////////////////////////////////// |
|
465 | + /////////////////////////////////////////////// |
|
466 | + /////// HELPER FUNCTIONS |
|
467 | + /////////////////////////////////////////////// |
|
468 | 468 | |
469 | - /** |
|
470 | - * Determine if a given function exists on the objects |
|
471 | - * @param function - the function to check |
|
472 | - * @return true if the method exists on the object, false otherwise |
|
473 | - */ |
|
474 | - protected function hasFunction($function){ |
|
475 | - return method_exists($this, $function); |
|
476 | - } |
|
469 | + /** |
|
470 | + * Determine if a given function exists on the objects |
|
471 | + * @param function - the function to check |
|
472 | + * @return true if the method exists on the object, false otherwise |
|
473 | + */ |
|
474 | + protected function hasFunction($function){ |
|
475 | + return method_exists($this, $function); |
|
476 | + } |
|
477 | 477 | |
478 | 478 | |
479 | - /** |
|
480 | - * Set the url to which we will want to redirect |
|
481 | - * |
|
482 | - * @param string url - the url to which we will want to redirect |
|
483 | - */ |
|
484 | - protected function set_redirect($url){ |
|
485 | - $this->redirect_url = $url; |
|
486 | - } |
|
479 | + /** |
|
480 | + * Set the url to which we will want to redirect |
|
481 | + * |
|
482 | + * @param string url - the url to which we will want to redirect |
|
483 | + */ |
|
484 | + protected function set_redirect($url){ |
|
485 | + $this->redirect_url = $url; |
|
486 | + } |
|
487 | 487 | |
488 | - /** |
|
489 | - * Perform redirection based on the redirect_url |
|
490 | - * |
|
491 | - */ |
|
492 | - protected function redirect(){ |
|
488 | + /** |
|
489 | + * Perform redirection based on the redirect_url |
|
490 | + * |
|
491 | + */ |
|
492 | + protected function redirect(){ |
|
493 | 493 | |
494 | - if(!empty($this->redirect_url)) |
|
495 | - SugarApplication::redirect($this->redirect_url); |
|
496 | - } |
|
494 | + if(!empty($this->redirect_url)) |
|
495 | + SugarApplication::redirect($this->redirect_url); |
|
496 | + } |
|
497 | 497 | |
498 | - //////////////////////////////////////////////////////// |
|
499 | - ////// DEFAULT ACTIONS |
|
500 | - /////////////////////////////////////////////////////// |
|
498 | + //////////////////////////////////////////////////////// |
|
499 | + ////// DEFAULT ACTIONS |
|
500 | + /////////////////////////////////////////////////////// |
|
501 | 501 | |
502 | - /* |
|
502 | + /* |
|
503 | 503 | * Save a bean |
504 | 504 | */ |
505 | 505 | |
506 | - /** |
|
507 | - * Do some processing before saving the bean to the database. |
|
508 | - */ |
|
509 | - public function pre_save(){ |
|
510 | - if(!empty($_POST['assigned_user_id']) && $_POST['assigned_user_id'] != $this->bean->assigned_user_id && $_POST['assigned_user_id'] != $GLOBALS['current_user']->id && empty($GLOBALS['sugar_config']['exclude_notifications'][$this->bean->module_dir])){ |
|
511 | - $this->bean->notify_on_save = true; |
|
512 | - } |
|
513 | - $GLOBALS['log']->debug("SugarController:: performing pre_save."); |
|
506 | + /** |
|
507 | + * Do some processing before saving the bean to the database. |
|
508 | + */ |
|
509 | + public function pre_save(){ |
|
510 | + if(!empty($_POST['assigned_user_id']) && $_POST['assigned_user_id'] != $this->bean->assigned_user_id && $_POST['assigned_user_id'] != $GLOBALS['current_user']->id && empty($GLOBALS['sugar_config']['exclude_notifications'][$this->bean->module_dir])){ |
|
511 | + $this->bean->notify_on_save = true; |
|
512 | + } |
|
513 | + $GLOBALS['log']->debug("SugarController:: performing pre_save."); |
|
514 | 514 | require_once('include/SugarFields/SugarFieldHandler.php'); |
515 | 515 | $sfh = new SugarFieldHandler(); |
516 | - foreach($this->bean->field_defs as $field => $properties) { |
|
517 | - $type = !empty($properties['custom_type']) ? $properties['custom_type'] : $properties['type']; |
|
518 | - $sf = $sfh->getSugarField(ucfirst($type), true); |
|
519 | - if(isset($_POST[$field])) { |
|
520 | - if(is_array($_POST[$field]) && !empty($properties['isMultiSelect'])) { |
|
521 | - if(empty($_POST[$field][0])) { |
|
522 | - unset($_POST[$field][0]); |
|
523 | - } |
|
524 | - $_POST[$field] = encodeMultienumValue($_POST[$field]); |
|
525 | - } |
|
526 | - $this->bean->$field = $_POST[$field]; |
|
527 | - } else if(!empty($properties['isMultiSelect']) && !isset($_POST[$field]) && isset($_POST[$field . '_multiselect'])) { |
|
528 | - $this->bean->$field = ''; |
|
529 | - } |
|
516 | + foreach($this->bean->field_defs as $field => $properties) { |
|
517 | + $type = !empty($properties['custom_type']) ? $properties['custom_type'] : $properties['type']; |
|
518 | + $sf = $sfh->getSugarField(ucfirst($type), true); |
|
519 | + if(isset($_POST[$field])) { |
|
520 | + if(is_array($_POST[$field]) && !empty($properties['isMultiSelect'])) { |
|
521 | + if(empty($_POST[$field][0])) { |
|
522 | + unset($_POST[$field][0]); |
|
523 | + } |
|
524 | + $_POST[$field] = encodeMultienumValue($_POST[$field]); |
|
525 | + } |
|
526 | + $this->bean->$field = $_POST[$field]; |
|
527 | + } else if(!empty($properties['isMultiSelect']) && !isset($_POST[$field]) && isset($_POST[$field . '_multiselect'])) { |
|
528 | + $this->bean->$field = ''; |
|
529 | + } |
|
530 | 530 | if($sf != null){ |
531 | 531 | $sf->save($this->bean, $_POST, $field, $properties); |
532 | 532 | } |
533 | - } |
|
534 | - |
|
535 | - foreach($this->bean->relationship_fields as $field=>$link){ |
|
536 | - if(!empty($_POST[$field])){ |
|
537 | - $this->bean->$field = $_POST[$field]; |
|
538 | - } |
|
539 | - } |
|
540 | - if(!$this->bean->ACLAccess('save')){ |
|
541 | - ACLController::displayNoAccess(true); |
|
542 | - sugar_cleanup(true); |
|
543 | - } |
|
544 | - $this->bean->unformat_all_fields(); |
|
545 | - } |
|
533 | + } |
|
546 | 534 | |
547 | - /** |
|
548 | - * Perform the actual save |
|
549 | - */ |
|
550 | - public function action_save(){ |
|
551 | - $this->bean->save(!empty($this->bean->notify_on_save)); |
|
552 | - } |
|
535 | + foreach($this->bean->relationship_fields as $field=>$link){ |
|
536 | + if(!empty($_POST[$field])){ |
|
537 | + $this->bean->$field = $_POST[$field]; |
|
538 | + } |
|
539 | + } |
|
540 | + if(!$this->bean->ACLAccess('save')){ |
|
541 | + ACLController::displayNoAccess(true); |
|
542 | + sugar_cleanup(true); |
|
543 | + } |
|
544 | + $this->bean->unformat_all_fields(); |
|
545 | + } |
|
546 | + |
|
547 | + /** |
|
548 | + * Perform the actual save |
|
549 | + */ |
|
550 | + public function action_save(){ |
|
551 | + $this->bean->save(!empty($this->bean->notify_on_save)); |
|
552 | + } |
|
553 | 553 | |
554 | 554 | |
555 | 555 | public function action_spot() |
@@ -558,43 +558,43 @@ discard block |
||
558 | 558 | } |
559 | 559 | |
560 | 560 | |
561 | - /** |
|
562 | - * Specify what happens after the save has occurred. |
|
563 | - */ |
|
564 | - protected function post_save(){ |
|
565 | - $module = (!empty($this->return_module) ? $this->return_module : $this->module); |
|
566 | - $action = (!empty($this->return_action) ? $this->return_action : 'DetailView'); |
|
567 | - $id = (!empty($this->return_id) ? $this->return_id : $this->bean->id); |
|
561 | + /** |
|
562 | + * Specify what happens after the save has occurred. |
|
563 | + */ |
|
564 | + protected function post_save(){ |
|
565 | + $module = (!empty($this->return_module) ? $this->return_module : $this->module); |
|
566 | + $action = (!empty($this->return_action) ? $this->return_action : 'DetailView'); |
|
567 | + $id = (!empty($this->return_id) ? $this->return_id : $this->bean->id); |
|
568 | 568 | |
569 | - $url = "index.php?module=".$module."&action=".$action."&record=".$id; |
|
570 | - $this->set_redirect($url); |
|
571 | - } |
|
569 | + $url = "index.php?module=".$module."&action=".$action."&record=".$id; |
|
570 | + $this->set_redirect($url); |
|
571 | + } |
|
572 | 572 | |
573 | - /* |
|
573 | + /* |
|
574 | 574 | * Delete a bean |
575 | 575 | */ |
576 | 576 | |
577 | - /** |
|
578 | - * Perform the actual deletion. |
|
579 | - */ |
|
580 | - protected function action_delete(){ |
|
581 | - //do any pre delete processing |
|
582 | - //if there is some custom logic for deletion. |
|
583 | - if(!empty($_REQUEST['record'])){ |
|
584 | - if(!$this->bean->ACLAccess('Delete')){ |
|
585 | - ACLController::displayNoAccess(true); |
|
586 | - sugar_cleanup(true); |
|
587 | - } |
|
588 | - $this->bean->mark_deleted($_REQUEST['record']); |
|
589 | - }else{ |
|
590 | - sugar_die("A record number must be specified to delete"); |
|
591 | - } |
|
592 | - } |
|
577 | + /** |
|
578 | + * Perform the actual deletion. |
|
579 | + */ |
|
580 | + protected function action_delete(){ |
|
581 | + //do any pre delete processing |
|
582 | + //if there is some custom logic for deletion. |
|
583 | + if(!empty($_REQUEST['record'])){ |
|
584 | + if(!$this->bean->ACLAccess('Delete')){ |
|
585 | + ACLController::displayNoAccess(true); |
|
586 | + sugar_cleanup(true); |
|
587 | + } |
|
588 | + $this->bean->mark_deleted($_REQUEST['record']); |
|
589 | + }else{ |
|
590 | + sugar_die("A record number must be specified to delete"); |
|
591 | + } |
|
592 | + } |
|
593 | 593 | |
594 | - /** |
|
595 | - * Specify what happens after the deletion has occurred. |
|
596 | - */ |
|
597 | - protected function post_delete(){ |
|
594 | + /** |
|
595 | + * Specify what happens after the deletion has occurred. |
|
596 | + */ |
|
597 | + protected function post_delete(){ |
|
598 | 598 | if (empty($_REQUEST['return_url'])) { |
599 | 599 | $return_module = isset($_REQUEST['return_module']) ? |
600 | 600 | $_REQUEST['return_module'] : |
@@ -610,23 +610,23 @@ discard block |
||
610 | 610 | $url = $_REQUEST['return_url']; |
611 | 611 | } |
612 | 612 | |
613 | - //eggsurplus Bug 23816: maintain VCR after an edit/save. If it is a duplicate then don't worry about it. The offset is now worthless. |
|
614 | - if(isset($_REQUEST['offset']) && empty($_REQUEST['duplicateSave'])) { |
|
615 | - $url .= "&offset=".$_REQUEST['offset']; |
|
616 | - } |
|
613 | + //eggsurplus Bug 23816: maintain VCR after an edit/save. If it is a duplicate then don't worry about it. The offset is now worthless. |
|
614 | + if(isset($_REQUEST['offset']) && empty($_REQUEST['duplicateSave'])) { |
|
615 | + $url .= "&offset=".$_REQUEST['offset']; |
|
616 | + } |
|
617 | 617 | |
618 | - $this->set_redirect($url); |
|
619 | - } |
|
620 | - /** |
|
621 | - * Perform the actual massupdate. |
|
622 | - */ |
|
623 | - protected function action_massupdate(){ |
|
624 | - if(!empty($_REQUEST['massupdate']) && $_REQUEST['massupdate'] == 'true' && (!empty($_REQUEST['uid']) || !empty($_REQUEST['entire']))){ |
|
625 | - if(!empty($_REQUEST['Delete']) && $_REQUEST['Delete']=='true' && !$this->bean->ACLAccess('delete') |
|
618 | + $this->set_redirect($url); |
|
619 | + } |
|
620 | + /** |
|
621 | + * Perform the actual massupdate. |
|
622 | + */ |
|
623 | + protected function action_massupdate(){ |
|
624 | + if(!empty($_REQUEST['massupdate']) && $_REQUEST['massupdate'] == 'true' && (!empty($_REQUEST['uid']) || !empty($_REQUEST['entire']))){ |
|
625 | + if(!empty($_REQUEST['Delete']) && $_REQUEST['Delete']=='true' && !$this->bean->ACLAccess('delete') |
|
626 | 626 | || (empty($_REQUEST['Delete']) || $_REQUEST['Delete']!='true') && !$this->bean->ACLAccess('save')){ |
627 | - ACLController::displayNoAccess(true); |
|
628 | - sugar_cleanup(true); |
|
629 | - } |
|
627 | + ACLController::displayNoAccess(true); |
|
628 | + sugar_cleanup(true); |
|
629 | + } |
|
630 | 630 | |
631 | 631 | set_time_limit(0);//I'm wondering if we will set it never goes timeout here. |
632 | 632 | // until we have more efficient way of handling MU, we have to disable the limit |
@@ -652,35 +652,35 @@ discard block |
||
652 | 652 | unset($_REQUEST[$seed->module_dir.'2_'.strtoupper($seed->object_name).'_offset']);//after massupdate, the page should redirect to no offset page |
653 | 653 | $storeQuery->saveFromRequest($_REQUEST['module']); |
654 | 654 | $_REQUEST = array('return_module' => $temp_req['return_module'], 'return_action' => $temp_req['return_action']);//for post_massupdate, to go back to original page. |
655 | - }else{ |
|
656 | - sugar_die("You must massupdate at least one record"); |
|
657 | - } |
|
658 | - } |
|
659 | - /** |
|
660 | - * Specify what happens after the massupdate has occurred. |
|
661 | - */ |
|
662 | - protected function post_massupdate(){ |
|
663 | - $return_module = isset($_REQUEST['return_module']) ? |
|
664 | - $_REQUEST['return_module'] : |
|
665 | - $GLOBALS['sugar_config']['default_module']; |
|
666 | - $return_action = isset($_REQUEST['return_action']) ? |
|
667 | - $_REQUEST['return_action'] : |
|
668 | - $GLOBALS['sugar_config']['default_action']; |
|
669 | - $url = "index.php?module=".$return_module."&action=".$return_action; |
|
670 | - if($return_module == 'Emails'){//specificly for My Achieves |
|
671 | - if(!empty($this->req_for_email['type']) && !empty($this->req_for_email['ie_assigned_user_id'])) { |
|
672 | - $url = $url . "&type=".$this->req_for_email['type']."&assigned_user_id=".$this->req_for_email['ie_assigned_user_id']; |
|
673 | - } |
|
674 | - } |
|
675 | - $this->set_redirect($url); |
|
676 | - } |
|
677 | - /** |
|
678 | - * Perform the listview action |
|
679 | - */ |
|
680 | - protected function action_listview(){ |
|
681 | - $this->view_object_map['bean'] = $this->bean; |
|
682 | - $this->view = 'list'; |
|
683 | - } |
|
655 | + }else{ |
|
656 | + sugar_die("You must massupdate at least one record"); |
|
657 | + } |
|
658 | + } |
|
659 | + /** |
|
660 | + * Specify what happens after the massupdate has occurred. |
|
661 | + */ |
|
662 | + protected function post_massupdate(){ |
|
663 | + $return_module = isset($_REQUEST['return_module']) ? |
|
664 | + $_REQUEST['return_module'] : |
|
665 | + $GLOBALS['sugar_config']['default_module']; |
|
666 | + $return_action = isset($_REQUEST['return_action']) ? |
|
667 | + $_REQUEST['return_action'] : |
|
668 | + $GLOBALS['sugar_config']['default_action']; |
|
669 | + $url = "index.php?module=".$return_module."&action=".$return_action; |
|
670 | + if($return_module == 'Emails'){//specificly for My Achieves |
|
671 | + if(!empty($this->req_for_email['type']) && !empty($this->req_for_email['ie_assigned_user_id'])) { |
|
672 | + $url = $url . "&type=".$this->req_for_email['type']."&assigned_user_id=".$this->req_for_email['ie_assigned_user_id']; |
|
673 | + } |
|
674 | + } |
|
675 | + $this->set_redirect($url); |
|
676 | + } |
|
677 | + /** |
|
678 | + * Perform the listview action |
|
679 | + */ |
|
680 | + protected function action_listview(){ |
|
681 | + $this->view_object_map['bean'] = $this->bean; |
|
682 | + $this->view = 'list'; |
|
683 | + } |
|
684 | 684 | |
685 | 685 | /* |
686 | 686 | |
@@ -689,63 +689,63 @@ discard block |
||
689 | 689 | } |
690 | 690 | */ |
691 | 691 | |
692 | - /** |
|
693 | - * Action to handle when using a file as was done in previous versions of Sugar. |
|
694 | - */ |
|
695 | - protected function action_default(){ |
|
696 | - $this->view = 'classic'; |
|
697 | - } |
|
692 | + /** |
|
693 | + * Action to handle when using a file as was done in previous versions of Sugar. |
|
694 | + */ |
|
695 | + protected function action_default(){ |
|
696 | + $this->view = 'classic'; |
|
697 | + } |
|
698 | 698 | |
699 | - /** |
|
700 | - * this method id used within a Dashlet when performing an ajax call |
|
701 | - */ |
|
702 | - protected function action_callmethoddashlet(){ |
|
703 | - if(!empty($_REQUEST['id'])) { |
|
704 | - $id = $_REQUEST['id']; |
|
705 | - $requestedMethod = $_REQUEST['method']; |
|
706 | - $dashletDefs = $GLOBALS['current_user']->getPreference('dashlets', 'Home'); // load user's dashlets config |
|
707 | - if(!empty($dashletDefs[$id])) { |
|
708 | - require_once($dashletDefs[$id]['fileLocation']); |
|
709 | - |
|
710 | - $dashlet = new $dashletDefs[$id]['className']($id, (isset($dashletDefs[$id]['options']) ? $dashletDefs[$id]['options'] : array())); |
|
711 | - |
|
712 | - if(method_exists($dashlet, $requestedMethod) || method_exists($dashlet, '__call')) { |
|
713 | - echo $dashlet->$requestedMethod(); |
|
714 | - } |
|
715 | - else { |
|
716 | - echo 'no method'; |
|
717 | - } |
|
718 | - } |
|
719 | - } |
|
720 | - } |
|
699 | + /** |
|
700 | + * this method id used within a Dashlet when performing an ajax call |
|
701 | + */ |
|
702 | + protected function action_callmethoddashlet(){ |
|
703 | + if(!empty($_REQUEST['id'])) { |
|
704 | + $id = $_REQUEST['id']; |
|
705 | + $requestedMethod = $_REQUEST['method']; |
|
706 | + $dashletDefs = $GLOBALS['current_user']->getPreference('dashlets', 'Home'); // load user's dashlets config |
|
707 | + if(!empty($dashletDefs[$id])) { |
|
708 | + require_once($dashletDefs[$id]['fileLocation']); |
|
709 | + |
|
710 | + $dashlet = new $dashletDefs[$id]['className']($id, (isset($dashletDefs[$id]['options']) ? $dashletDefs[$id]['options'] : array())); |
|
711 | + |
|
712 | + if(method_exists($dashlet, $requestedMethod) || method_exists($dashlet, '__call')) { |
|
713 | + echo $dashlet->$requestedMethod(); |
|
714 | + } |
|
715 | + else { |
|
716 | + echo 'no method'; |
|
717 | + } |
|
718 | + } |
|
719 | + } |
|
720 | + } |
|
721 | 721 | |
722 | - /** |
|
723 | - * this method is used within a Dashlet when the options configuration is posted |
|
724 | - */ |
|
725 | - protected function action_configuredashlet(){ |
|
726 | - global $current_user, $mod_strings; |
|
727 | - |
|
728 | - if(!empty($_REQUEST['id'])) { |
|
729 | - $id = $_REQUEST['id']; |
|
730 | - $dashletDefs = $current_user->getPreference('dashlets', $_REQUEST['module']); // load user's dashlets config |
|
731 | - require_once($dashletDefs[$id]['fileLocation']); |
|
732 | - |
|
733 | - $dashlet = new $dashletDefs[$id]['className']($id, (isset($dashletDefs[$id]['options']) ? $dashletDefs[$id]['options'] : array())); |
|
734 | - if(!empty($_REQUEST['configure']) && $_REQUEST['configure']) { // save settings |
|
735 | - $dashletDefs[$id]['options'] = $dashlet->saveOptions($_REQUEST); |
|
736 | - $current_user->setPreference('dashlets', $dashletDefs, 0, $_REQUEST['module']); |
|
737 | - } |
|
738 | - else { // display options |
|
739 | - $json = getJSONobj(); |
|
740 | - return 'result = ' . $json->encode((array('header' => $dashlet->title . ' : ' . $mod_strings['LBL_OPTIONS'], |
|
741 | - 'body' => $dashlet->displayOptions()))); |
|
742 | - |
|
743 | - } |
|
744 | - } |
|
745 | - else { |
|
746 | - return '0'; |
|
747 | - } |
|
748 | - } |
|
722 | + /** |
|
723 | + * this method is used within a Dashlet when the options configuration is posted |
|
724 | + */ |
|
725 | + protected function action_configuredashlet(){ |
|
726 | + global $current_user, $mod_strings; |
|
727 | + |
|
728 | + if(!empty($_REQUEST['id'])) { |
|
729 | + $id = $_REQUEST['id']; |
|
730 | + $dashletDefs = $current_user->getPreference('dashlets', $_REQUEST['module']); // load user's dashlets config |
|
731 | + require_once($dashletDefs[$id]['fileLocation']); |
|
732 | + |
|
733 | + $dashlet = new $dashletDefs[$id]['className']($id, (isset($dashletDefs[$id]['options']) ? $dashletDefs[$id]['options'] : array())); |
|
734 | + if(!empty($_REQUEST['configure']) && $_REQUEST['configure']) { // save settings |
|
735 | + $dashletDefs[$id]['options'] = $dashlet->saveOptions($_REQUEST); |
|
736 | + $current_user->setPreference('dashlets', $dashletDefs, 0, $_REQUEST['module']); |
|
737 | + } |
|
738 | + else { // display options |
|
739 | + $json = getJSONobj(); |
|
740 | + return 'result = ' . $json->encode((array('header' => $dashlet->title . ' : ' . $mod_strings['LBL_OPTIONS'], |
|
741 | + 'body' => $dashlet->displayOptions()))); |
|
742 | + |
|
743 | + } |
|
744 | + } |
|
745 | + else { |
|
746 | + return '0'; |
|
747 | + } |
|
748 | + } |
|
749 | 749 | |
750 | 750 | /** |
751 | 751 | * Global method to delete an attachment |
@@ -775,84 +775,84 @@ discard block |
||
775 | 775 | sugar_cleanup(true); |
776 | 776 | } |
777 | 777 | |
778 | - /** |
|
779 | - * getActionFilename |
|
780 | - */ |
|
781 | - public static function getActionFilename($action) { |
|
782 | - if(isset(self::$action_case_file[$action])) { |
|
783 | - return self::$action_case_file[$action]; |
|
784 | - } |
|
785 | - return $action; |
|
786 | - } |
|
778 | + /** |
|
779 | + * getActionFilename |
|
780 | + */ |
|
781 | + public static function getActionFilename($action) { |
|
782 | + if(isset(self::$action_case_file[$action])) { |
|
783 | + return self::$action_case_file[$action]; |
|
784 | + } |
|
785 | + return $action; |
|
786 | + } |
|
787 | 787 | |
788 | - /********************************************************************/ |
|
789 | - // PROCESS TASKS |
|
790 | - /********************************************************************/ |
|
788 | + /********************************************************************/ |
|
789 | + // PROCESS TASKS |
|
790 | + /********************************************************************/ |
|
791 | 791 | |
792 | - /** |
|
793 | - * Given the module and action, determine whether the super/admin has prevented access |
|
794 | - * to this url. In addition if any links specified for this module, load the links into |
|
795 | - * GLOBALS |
|
796 | - * |
|
797 | - * @return true if we want to stop processing, false if processing should continue |
|
798 | - */ |
|
799 | - private function blockFileAccess(){ |
|
800 | - //check if the we have enabled file_access_control and if so then check the mappings on the request; |
|
801 | - if(!empty($GLOBALS['sugar_config']['admin_access_control']) && $GLOBALS['sugar_config']['admin_access_control']){ |
|
802 | - $this->loadMapping('file_access_control_map'); |
|
803 | - //since we have this turned on, check the mapping file |
|
804 | - $module = strtolower($this->module); |
|
805 | - $action = strtolower($this->do_action); |
|
806 | - if(!empty($this->file_access_control_map['modules'][$module]['links'])){ |
|
807 | - $GLOBALS['admin_access_control_links'] = $this->file_access_control_map['modules'][$module]['links']; |
|
808 | - } |
|
809 | - |
|
810 | - if(!empty($this->file_access_control_map['modules'][$module]['actions']) && (in_array($action, $this->file_access_control_map['modules'][$module]['actions']) || !empty($this->file_access_control_map['modules'][$module]['actions'][$action]))){ |
|
811 | - //check params |
|
812 | - if(!empty($this->file_access_control_map['modules'][$module]['actions'][$action]['params'])){ |
|
813 | - $block = true; |
|
814 | - $params = $this->file_access_control_map['modules'][$module]['actions'][$action]['params']; |
|
815 | - foreach($params as $param => $paramVals){ |
|
816 | - if(!empty($_REQUEST[$param])){ |
|
817 | - if(!in_array($_REQUEST[$param], $paramVals)){ |
|
818 | - $block = false; |
|
819 | - break; |
|
820 | - } |
|
821 | - } |
|
822 | - } |
|
823 | - if($block){ |
|
824 | - $this->_processed = true; |
|
825 | - $this->no_access(); |
|
826 | - } |
|
827 | - }else{ |
|
828 | - $this->_processed = true; |
|
829 | - $this->no_access(); |
|
830 | - } |
|
831 | - } |
|
832 | - }else |
|
833 | - $this->_processed = false; |
|
834 | - } |
|
792 | + /** |
|
793 | + * Given the module and action, determine whether the super/admin has prevented access |
|
794 | + * to this url. In addition if any links specified for this module, load the links into |
|
795 | + * GLOBALS |
|
796 | + * |
|
797 | + * @return true if we want to stop processing, false if processing should continue |
|
798 | + */ |
|
799 | + private function blockFileAccess(){ |
|
800 | + //check if the we have enabled file_access_control and if so then check the mappings on the request; |
|
801 | + if(!empty($GLOBALS['sugar_config']['admin_access_control']) && $GLOBALS['sugar_config']['admin_access_control']){ |
|
802 | + $this->loadMapping('file_access_control_map'); |
|
803 | + //since we have this turned on, check the mapping file |
|
804 | + $module = strtolower($this->module); |
|
805 | + $action = strtolower($this->do_action); |
|
806 | + if(!empty($this->file_access_control_map['modules'][$module]['links'])){ |
|
807 | + $GLOBALS['admin_access_control_links'] = $this->file_access_control_map['modules'][$module]['links']; |
|
808 | + } |
|
835 | 809 | |
836 | - /** |
|
837 | - * This code is part of the entry points reworking. We have consolidated all |
|
838 | - * entry points to go through index.php. Now in order to bring up an entry point |
|
839 | - * it will follow the format: |
|
840 | - * 'index.php?entryPoint=download' |
|
841 | - * the download entry point is mapped in the following file: entry_point_registry.php |
|
842 | - * |
|
843 | - */ |
|
844 | - private function handleEntryPoint(){ |
|
845 | - if(!empty($_REQUEST['entryPoint'])){ |
|
846 | - $this->loadMapping('entry_point_registry'); |
|
847 | - $entryPoint = $_REQUEST['entryPoint']; |
|
848 | - |
|
849 | - if(!empty($this->entry_point_registry[$entryPoint])){ |
|
850 | - require_once($this->entry_point_registry[$entryPoint]['file']); |
|
851 | - $this->_processed = true; |
|
852 | - $this->view = ''; |
|
853 | - } |
|
854 | - } |
|
855 | - } |
|
810 | + if(!empty($this->file_access_control_map['modules'][$module]['actions']) && (in_array($action, $this->file_access_control_map['modules'][$module]['actions']) || !empty($this->file_access_control_map['modules'][$module]['actions'][$action]))){ |
|
811 | + //check params |
|
812 | + if(!empty($this->file_access_control_map['modules'][$module]['actions'][$action]['params'])){ |
|
813 | + $block = true; |
|
814 | + $params = $this->file_access_control_map['modules'][$module]['actions'][$action]['params']; |
|
815 | + foreach($params as $param => $paramVals){ |
|
816 | + if(!empty($_REQUEST[$param])){ |
|
817 | + if(!in_array($_REQUEST[$param], $paramVals)){ |
|
818 | + $block = false; |
|
819 | + break; |
|
820 | + } |
|
821 | + } |
|
822 | + } |
|
823 | + if($block){ |
|
824 | + $this->_processed = true; |
|
825 | + $this->no_access(); |
|
826 | + } |
|
827 | + }else{ |
|
828 | + $this->_processed = true; |
|
829 | + $this->no_access(); |
|
830 | + } |
|
831 | + } |
|
832 | + }else |
|
833 | + $this->_processed = false; |
|
834 | + } |
|
835 | + |
|
836 | + /** |
|
837 | + * This code is part of the entry points reworking. We have consolidated all |
|
838 | + * entry points to go through index.php. Now in order to bring up an entry point |
|
839 | + * it will follow the format: |
|
840 | + * 'index.php?entryPoint=download' |
|
841 | + * the download entry point is mapped in the following file: entry_point_registry.php |
|
842 | + * |
|
843 | + */ |
|
844 | + private function handleEntryPoint(){ |
|
845 | + if(!empty($_REQUEST['entryPoint'])){ |
|
846 | + $this->loadMapping('entry_point_registry'); |
|
847 | + $entryPoint = $_REQUEST['entryPoint']; |
|
848 | + |
|
849 | + if(!empty($this->entry_point_registry[$entryPoint])){ |
|
850 | + require_once($this->entry_point_registry[$entryPoint]['file']); |
|
851 | + $this->_processed = true; |
|
852 | + $this->view = ''; |
|
853 | + } |
|
854 | + } |
|
855 | + } |
|
856 | 856 | |
857 | 857 | /** |
858 | 858 | * Checks to see if the requested entry point requires auth |
@@ -870,67 +870,67 @@ discard block |
||
870 | 870 | return true; |
871 | 871 | } |
872 | 872 | |
873 | - /** |
|
874 | - * Meant to handle old views e.g. DetailView.php. |
|
875 | - * |
|
876 | - */ |
|
877 | - protected function callLegacyCode() |
|
878 | - { |
|
879 | - $file = self::getActionFilename($this->do_action); |
|
880 | - if ( isset($this->action_view_map[strtolower($this->do_action)]) ) { |
|
881 | - $action = $this->action_view_map[strtolower($this->do_action)]; |
|
882 | - } |
|
883 | - else { |
|
884 | - $action = $this->do_action; |
|
885 | - } |
|
886 | - // index actions actually maps to the view.list.php view |
|
887 | - if ( $action == 'index' ) { |
|
888 | - $action = 'list'; |
|
889 | - } |
|
890 | - |
|
891 | - if ((file_exists('modules/' . $this->module . '/'. $file . '.php') |
|
873 | + /** |
|
874 | + * Meant to handle old views e.g. DetailView.php. |
|
875 | + * |
|
876 | + */ |
|
877 | + protected function callLegacyCode() |
|
878 | + { |
|
879 | + $file = self::getActionFilename($this->do_action); |
|
880 | + if ( isset($this->action_view_map[strtolower($this->do_action)]) ) { |
|
881 | + $action = $this->action_view_map[strtolower($this->do_action)]; |
|
882 | + } |
|
883 | + else { |
|
884 | + $action = $this->do_action; |
|
885 | + } |
|
886 | + // index actions actually maps to the view.list.php view |
|
887 | + if ( $action == 'index' ) { |
|
888 | + $action = 'list'; |
|
889 | + } |
|
890 | + |
|
891 | + if ((file_exists('modules/' . $this->module . '/'. $file . '.php') |
|
892 | 892 | && !file_exists('modules/' . $this->module . '/views/view.'. $action . '.php')) |
893 | 893 | || (file_exists('custom/modules/' . $this->module . '/'. $file . '.php') |
894 | 894 | && !file_exists('custom/modules/' . $this->module . '/views/view.'. $action . '.php')) |
895 | 895 | ) { |
896 | - // A 'classic' module, using the old pre-MVC display files |
|
897 | - // We should now discard the bean we just obtained for tracking as the pre-MVC module will instantiate its own |
|
898 | - unset($GLOBALS['FOCUS']); |
|
899 | - $GLOBALS['log']->debug('Module:' . $this->module . ' using file: '. $file); |
|
900 | - $this->action_default(); |
|
901 | - $this->_processed = true; |
|
902 | - } |
|
903 | - } |
|
896 | + // A 'classic' module, using the old pre-MVC display files |
|
897 | + // We should now discard the bean we just obtained for tracking as the pre-MVC module will instantiate its own |
|
898 | + unset($GLOBALS['FOCUS']); |
|
899 | + $GLOBALS['log']->debug('Module:' . $this->module . ' using file: '. $file); |
|
900 | + $this->action_default(); |
|
901 | + $this->_processed = true; |
|
902 | + } |
|
903 | + } |
|
904 | 904 | |
905 | - /** |
|
906 | - * If the action has been remapped to a different action as defined in |
|
907 | - * action_file_map.php or action_view_map.php load those maps here. |
|
908 | - * |
|
909 | - */ |
|
910 | - private function handleActionMaps(){ |
|
911 | - if(!empty($this->action_file_map[strtolower($this->do_action)])){ |
|
912 | - $this->view = ''; |
|
913 | - $GLOBALS['log']->debug('Using Action File Map:' . $this->action_file_map[strtolower($this->do_action)]); |
|
914 | - require_once($this->action_file_map[strtolower($this->do_action)]); |
|
915 | - $this->_processed = true; |
|
916 | - }elseif(!empty($this->action_view_map[strtolower($this->do_action)])){ |
|
917 | - $GLOBALS['log']->debug('Using Action View Map:' . $this->action_view_map[strtolower($this->do_action)]); |
|
918 | - $this->view = $this->action_view_map[strtolower($this->do_action)]; |
|
919 | - $this->_processed = true; |
|
920 | - }else |
|
921 | - $this->no_action(); |
|
922 | - } |
|
905 | + /** |
|
906 | + * If the action has been remapped to a different action as defined in |
|
907 | + * action_file_map.php or action_view_map.php load those maps here. |
|
908 | + * |
|
909 | + */ |
|
910 | + private function handleActionMaps(){ |
|
911 | + if(!empty($this->action_file_map[strtolower($this->do_action)])){ |
|
912 | + $this->view = ''; |
|
913 | + $GLOBALS['log']->debug('Using Action File Map:' . $this->action_file_map[strtolower($this->do_action)]); |
|
914 | + require_once($this->action_file_map[strtolower($this->do_action)]); |
|
915 | + $this->_processed = true; |
|
916 | + }elseif(!empty($this->action_view_map[strtolower($this->do_action)])){ |
|
917 | + $GLOBALS['log']->debug('Using Action View Map:' . $this->action_view_map[strtolower($this->do_action)]); |
|
918 | + $this->view = $this->action_view_map[strtolower($this->do_action)]; |
|
919 | + $this->_processed = true; |
|
920 | + }else |
|
921 | + $this->no_action(); |
|
922 | + } |
|
923 | 923 | |
924 | - /** |
|
925 | - * Actually remap the action if required. |
|
926 | - * |
|
927 | - */ |
|
928 | - protected function remapAction(){ |
|
929 | - if(!empty($this->action_remap[$this->do_action])){ |
|
930 | - $this->action = $this->action_remap[$this->do_action]; |
|
931 | - $this->do_action = $this->action; |
|
932 | - } |
|
933 | - } |
|
924 | + /** |
|
925 | + * Actually remap the action if required. |
|
926 | + * |
|
927 | + */ |
|
928 | + protected function remapAction(){ |
|
929 | + if(!empty($this->action_remap[$this->do_action])){ |
|
930 | + $this->action = $this->action_remap[$this->do_action]; |
|
931 | + $this->do_action = $this->action; |
|
932 | + } |
|
933 | + } |
|
934 | 934 | |
935 | 935 | } |
936 | 936 | ?> |
@@ -39,19 +39,19 @@ discard block |
||
39 | 39 | ********************************************************************************/ |
40 | 40 | |
41 | 41 | $entry_point_registry = array( |
42 | - 'emailImage' => array('file' => 'modules/EmailMan/EmailImage.php', 'auth' => false), |
|
43 | - 'download' => array('file' => 'download.php', 'auth' => true), |
|
44 | - 'export' => array('file' => 'export.php', 'auth' => true), |
|
45 | - 'export_dataset' => array('file' => 'export_dataset.php', 'auth' => true), |
|
46 | - 'Changenewpassword' => array('file' => 'modules/Users/Changenewpassword.php', 'auth' => false), |
|
47 | - 'GeneratePassword' => array('file' => 'modules/Users/GeneratePassword.php', 'auth' => false), |
|
48 | - 'vCard' => array('file' => 'vCard.php', 'auth' => true), |
|
49 | - 'pdf' => array('file' => 'pdf.php', 'auth' => true), |
|
50 | - 'minify' => array('file' => 'jssource/minify.php', 'auth' => true), |
|
42 | + 'emailImage' => array('file' => 'modules/EmailMan/EmailImage.php', 'auth' => false), |
|
43 | + 'download' => array('file' => 'download.php', 'auth' => true), |
|
44 | + 'export' => array('file' => 'export.php', 'auth' => true), |
|
45 | + 'export_dataset' => array('file' => 'export_dataset.php', 'auth' => true), |
|
46 | + 'Changenewpassword' => array('file' => 'modules/Users/Changenewpassword.php', 'auth' => false), |
|
47 | + 'GeneratePassword' => array('file' => 'modules/Users/GeneratePassword.php', 'auth' => false), |
|
48 | + 'vCard' => array('file' => 'vCard.php', 'auth' => true), |
|
49 | + 'pdf' => array('file' => 'pdf.php', 'auth' => true), |
|
50 | + 'minify' => array('file' => 'jssource/minify.php', 'auth' => true), |
|
51 | 51 | 'json_server' => array('file' => 'json_server.php', 'auth' => true), |
52 | 52 | 'get_url' => array('file' => 'get_url.php', 'auth' => true), |
53 | - 'HandleAjaxCall' => array('file' => 'HandleAjaxCall.php', 'auth' => true), |
|
54 | - 'TreeData' => array('file' => 'TreeData.php', 'auth' => true), |
|
53 | + 'HandleAjaxCall' => array('file' => 'HandleAjaxCall.php', 'auth' => true), |
|
54 | + 'TreeData' => array('file' => 'TreeData.php', 'auth' => true), |
|
55 | 55 | 'image' => array('file' => 'modules/Campaigns/image.php', 'auth' => false), |
56 | 56 | 'campaign_trackerv2' => array('file' => 'modules/Campaigns/Tracker.php', 'auth' => false), |
57 | 57 | 'WebToLeadCapture' => array('file' => 'modules/Campaigns/WebToLeadCapture.php', 'auth' => false), |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | 'acceptDecline' => array('file' => 'modules/Contacts/AcceptDecline.php', 'auth' => false), |
60 | 60 | 'leadCapture' => array('file' => 'modules/Leads/Capture.php', 'auth' => false), |
61 | 61 | 'process_queue' => array('file' => 'process_queue.php', 'auth' => true), |
62 | - 'zipatcher' => array('file' => 'zipatcher.php', 'auth' => true), |
|
62 | + 'zipatcher' => array('file' => 'zipatcher.php', 'auth' => true), |
|
63 | 63 | 'mm_get_doc' => array('file' => 'modules/MailMerge/get_doc.php', 'auth' => true), |
64 | 64 | 'getImage' => array('file' => 'include/SugarTheme/getImage.php', 'auth' => false), |
65 | 65 | 'GenerateQuickComposeFrame' => array('file' => 'modules/Emails/GenerateQuickComposeFrame.php', 'auth' => true), |
@@ -68,18 +68,18 @@ discard block |
||
68 | 68 | 'UploadFileCheck' => array('file' => 'modules/Configurator/UploadFileCheck.php', 'auth' => true), |
69 | 69 | 'SAML'=> array('file' => 'modules/Users/authentication/SAMLAuthenticate/index.php', 'auth' => false), |
70 | 70 | 'jslang'=> array('file' => 'include/language/getJSLanguage.php', 'auth' => true), |
71 | - 'deleteAttachment' => array('file' => 'modules/FP_events/responseEntryPoint.php', 'auth' => false), |
|
72 | - 'responseEntryPoint' => array('file' => 'modules/FP_events/responseEntryPoint.php', 'auth' => false), |
|
73 | - 'formLetter' => array('file' => 'modules/AOS_PDF_Templates/formLetterPdf.php' , 'auth' => true), |
|
74 | - 'generatePdf' => array('file' => 'modules/AOS_PDF_Templates/generatePdf.php' , 'auth' => true), |
|
75 | - 'Reschedule' => array('file' => 'modules/Calls_Reschedule/Reschedule_popup.php' , 'auth' => true), |
|
76 | - 'Reschedule2' => array('file' => 'modules/Calls/Reschedule.php' , 'auth' => true), |
|
77 | - 'social' => array('file' => 'include/social/get_data.php' , 'auth' => true), |
|
78 | - 'social_reader' => array('file' => 'include/social/get_feed_data.php' , 'auth' => true), |
|
79 | - 'add_dash_page' => array('file' => 'modules/Home/AddDashboardPages.php' , 'auth' => true), |
|
80 | - 'retrieve_dash_page' => array('file' => 'include/MySugar/retrieve_dash_page.php' , 'auth' => true), |
|
81 | - 'remove_dash_page' => array('file' => 'modules/Home/RemoveDashboardPages.php' , 'auth' => true), |
|
82 | - 'rename_dash_page' => array('file' => 'modules/Home/RenameDashboardPages.php' , 'auth' => true) |
|
71 | + 'deleteAttachment' => array('file' => 'modules/FP_events/responseEntryPoint.php', 'auth' => false), |
|
72 | + 'responseEntryPoint' => array('file' => 'modules/FP_events/responseEntryPoint.php', 'auth' => false), |
|
73 | + 'formLetter' => array('file' => 'modules/AOS_PDF_Templates/formLetterPdf.php' , 'auth' => true), |
|
74 | + 'generatePdf' => array('file' => 'modules/AOS_PDF_Templates/generatePdf.php' , 'auth' => true), |
|
75 | + 'Reschedule' => array('file' => 'modules/Calls_Reschedule/Reschedule_popup.php' , 'auth' => true), |
|
76 | + 'Reschedule2' => array('file' => 'modules/Calls/Reschedule.php' , 'auth' => true), |
|
77 | + 'social' => array('file' => 'include/social/get_data.php' , 'auth' => true), |
|
78 | + 'social_reader' => array('file' => 'include/social/get_feed_data.php' , 'auth' => true), |
|
79 | + 'add_dash_page' => array('file' => 'modules/Home/AddDashboardPages.php' , 'auth' => true), |
|
80 | + 'retrieve_dash_page' => array('file' => 'include/MySugar/retrieve_dash_page.php' , 'auth' => true), |
|
81 | + 'remove_dash_page' => array('file' => 'modules/Home/RemoveDashboardPages.php' , 'auth' => true), |
|
82 | + 'rename_dash_page' => array('file' => 'modules/Home/RenameDashboardPages.php' , 'auth' => true) |
|
83 | 83 | ); |
84 | 84 | |
85 | 85 | ?> |
@@ -43,7 +43,7 @@ |
||
43 | 43 | * To change the template for this generated file go to |
44 | 44 | * Window - Preferences - PHPeclipse - PHP - Code Templates |
45 | 45 | */ |
46 | - //format '<action_name>' => '<view_name>' |
|
46 | + //format '<action_name>' => '<view_name>' |
|
47 | 47 | $action_view_map['multieditview']= 'multiedit'; |
48 | 48 | $action_view_map['detailview']= 'detail'; |
49 | 49 | $action_view_map['editview']= 'edit'; |