@@ -31,19 +31,19 @@ |
||
31 | 31 | preg_match_all("!<script[^>]*?>.*?</script>!is", $source, $match); |
32 | 32 | $_script_blocks = $match[0]; |
33 | 33 | $source = preg_replace("!<script[^>]*?>.*?</script>!is", |
34 | - '@@@SMARTY:TRIM:SCRIPT@@@', $source); |
|
34 | + '@@@SMARTY:TRIM:SCRIPT@@@', $source); |
|
35 | 35 | |
36 | 36 | // Pull out the pre blocks |
37 | 37 | preg_match_all("!<pre[^>]*?>.*?</pre>!is", $source, $match); |
38 | 38 | $_pre_blocks = $match[0]; |
39 | 39 | $source = preg_replace("!<pre[^>]*?>.*?</pre>!is", |
40 | - '@@@SMARTY:TRIM:PRE@@@', $source); |
|
40 | + '@@@SMARTY:TRIM:PRE@@@', $source); |
|
41 | 41 | |
42 | 42 | // Pull out the textarea blocks |
43 | 43 | preg_match_all("!<textarea[^>]*?>.*?</textarea>!is", $source, $match); |
44 | 44 | $_textarea_blocks = $match[0]; |
45 | 45 | $source = preg_replace("!<textarea[^>]*?>.*?</textarea>!is", |
46 | - '@@@SMARTY:TRIM:TEXTAREA@@@', $source); |
|
46 | + '@@@SMARTY:TRIM:TEXTAREA@@@', $source); |
|
47 | 47 | |
48 | 48 | // remove all leading spaces, tabs and carriage returns NOT |
49 | 49 | // preceeded by a php close tag. |
@@ -68,46 +68,46 @@ |
||
68 | 68 | |
69 | 69 | function smarty_function_sugarvar($params, &$smarty) |
70 | 70 | { |
71 | - if(empty($params['key'])) { |
|
72 | - $smarty->trigger_error("sugarvar: missing 'key' parameter"); |
|
73 | - return; |
|
74 | - } |
|
75 | - |
|
76 | - $object = (empty($params['objectName']))?$smarty->get_template_vars('parentFieldArray'): $params['objectName']; |
|
77 | - $displayParams = $smarty->get_template_vars('displayParams'); |
|
78 | - |
|
79 | - |
|
80 | - if(empty($params['memberName'])){ |
|
81 | - $member = $smarty->get_template_vars('vardef'); |
|
82 | - $member = $member['name']; |
|
83 | - }else{ |
|
84 | - $members = explode('.', $params['memberName']); |
|
85 | - $member = $smarty->get_template_vars($members[0]); |
|
86 | - for($i = 1; $i < count($members); $i++){ |
|
87 | - $member = $member[$members[$i]]; |
|
88 | - } |
|
89 | - } |
|
71 | + if(empty($params['key'])) { |
|
72 | + $smarty->trigger_error("sugarvar: missing 'key' parameter"); |
|
73 | + return; |
|
74 | + } |
|
75 | + |
|
76 | + $object = (empty($params['objectName']))?$smarty->get_template_vars('parentFieldArray'): $params['objectName']; |
|
77 | + $displayParams = $smarty->get_template_vars('displayParams'); |
|
78 | + |
|
79 | + |
|
80 | + if(empty($params['memberName'])){ |
|
81 | + $member = $smarty->get_template_vars('vardef'); |
|
82 | + $member = $member['name']; |
|
83 | + }else{ |
|
84 | + $members = explode('.', $params['memberName']); |
|
85 | + $member = $smarty->get_template_vars($members[0]); |
|
86 | + for($i = 1; $i < count($members); $i++){ |
|
87 | + $member = $member[$members[$i]]; |
|
88 | + } |
|
89 | + } |
|
90 | 90 | |
91 | 91 | $_contents = '$'. $object . '.' . $member . '.' . $params['key']; |
92 | - if(empty($params['stringFormat']) && empty($params['string'])) { |
|
93 | - $_contents = '{' . $_contents; |
|
94 | - if(!empty($displayParams['htmlescape'])){ |
|
95 | - $_contents .= '|escape:\'html\''; |
|
96 | - } |
|
97 | - if(!empty($params['htmlentitydecode'])){ |
|
98 | - $_contents .= '|escape:\'html_entity_decode\''; |
|
99 | - } |
|
100 | - if(!empty($displayParams['strip_tags'])){ |
|
101 | - $_contents .= '|strip_tags'; |
|
102 | - } |
|
103 | - if(!empty($displayParams['url2html'])){ |
|
104 | - $_contents .= '|url2html'; |
|
105 | - } |
|
106 | - if(!empty($displayParams['nl2br'])){ |
|
107 | - $_contents .= '|nl2br'; |
|
108 | - } |
|
109 | - |
|
110 | - $_contents .= '}'; |
|
92 | + if(empty($params['stringFormat']) && empty($params['string'])) { |
|
93 | + $_contents = '{' . $_contents; |
|
94 | + if(!empty($displayParams['htmlescape'])){ |
|
95 | + $_contents .= '|escape:\'html\''; |
|
96 | + } |
|
97 | + if(!empty($params['htmlentitydecode'])){ |
|
98 | + $_contents .= '|escape:\'html_entity_decode\''; |
|
99 | + } |
|
100 | + if(!empty($displayParams['strip_tags'])){ |
|
101 | + $_contents .= '|strip_tags'; |
|
102 | + } |
|
103 | + if(!empty($displayParams['url2html'])){ |
|
104 | + $_contents .= '|url2html'; |
|
105 | + } |
|
106 | + if(!empty($displayParams['nl2br'])){ |
|
107 | + $_contents .= '|nl2br'; |
|
108 | + } |
|
109 | + |
|
110 | + $_contents .= '}'; |
|
111 | 111 | } |
112 | 112 | return $_contents; |
113 | 113 | } |
@@ -27,44 +27,44 @@ |
||
27 | 27 | */ |
28 | 28 | function smarty_function_sugar_button_slider($params, &$smarty) |
29 | 29 | { |
30 | - if(empty($params['module'])) { |
|
31 | - $smarty->trigger_error("sugar_button_slider: missing required param (module)"); |
|
32 | - } else if(empty($params['buttons'])) { |
|
33 | - $smarty->trigger_error("sugar_button_slider: missing required param (buttons)"); |
|
34 | - } else if(empty($params['view'])) { |
|
35 | - $smarty->trigger_error("sugar_button_slider: missing required param (view)"); |
|
36 | - } |
|
37 | - $module = $params['module']; |
|
38 | - $view = $params['view']; |
|
39 | - $buttons = $params['buttons']; |
|
40 | - $str = ''; |
|
41 | - if(is_array($buttons)) { |
|
42 | - if(count($buttons) <= 2){ |
|
43 | - foreach($buttons as $val => $button){ |
|
44 | - $str .= smarty_function_sugar_button(array('module' => $module, 'id' => $button, 'view' => $view), $smarty); |
|
45 | - } |
|
46 | - }else{ |
|
47 | - $str = '<div id="buttonSlide" class="yui-module">'; |
|
48 | - $str .= '<table border="0">'; |
|
49 | - $str .='<tr><td>'; |
|
50 | - $str .='<div class="yui-hd">'; |
|
51 | - for($i = 0; $i < 2; $i++){ |
|
52 | - $button = $buttons[$i]; |
|
53 | - $str .= smarty_function_sugar_button(array('module' => $module, 'id' => $button, 'view' => $view), $smarty); |
|
54 | - $str .= ' '; |
|
55 | - } |
|
56 | - $str .= '</div></td>'; |
|
57 | - $str .='<td align="right"> <div class="yui-bd">'; |
|
58 | - for($i = 2; $i < count($buttons); $i++){ |
|
59 | - $button = $buttons[$i]; |
|
60 | - $str .= smarty_function_sugar_button(array('module' => $module, 'id' => $button, 'view' => $view), $smarty); |
|
61 | - $str .= ' '; |
|
62 | - } |
|
63 | - $str .='</div></td>'; |
|
64 | - $str .='</tr></table>'; |
|
65 | - } |
|
66 | - } |
|
67 | - return $str; |
|
30 | + if(empty($params['module'])) { |
|
31 | + $smarty->trigger_error("sugar_button_slider: missing required param (module)"); |
|
32 | + } else if(empty($params['buttons'])) { |
|
33 | + $smarty->trigger_error("sugar_button_slider: missing required param (buttons)"); |
|
34 | + } else if(empty($params['view'])) { |
|
35 | + $smarty->trigger_error("sugar_button_slider: missing required param (view)"); |
|
36 | + } |
|
37 | + $module = $params['module']; |
|
38 | + $view = $params['view']; |
|
39 | + $buttons = $params['buttons']; |
|
40 | + $str = ''; |
|
41 | + if(is_array($buttons)) { |
|
42 | + if(count($buttons) <= 2){ |
|
43 | + foreach($buttons as $val => $button){ |
|
44 | + $str .= smarty_function_sugar_button(array('module' => $module, 'id' => $button, 'view' => $view), $smarty); |
|
45 | + } |
|
46 | + }else{ |
|
47 | + $str = '<div id="buttonSlide" class="yui-module">'; |
|
48 | + $str .= '<table border="0">'; |
|
49 | + $str .='<tr><td>'; |
|
50 | + $str .='<div class="yui-hd">'; |
|
51 | + for($i = 0; $i < 2; $i++){ |
|
52 | + $button = $buttons[$i]; |
|
53 | + $str .= smarty_function_sugar_button(array('module' => $module, 'id' => $button, 'view' => $view), $smarty); |
|
54 | + $str .= ' '; |
|
55 | + } |
|
56 | + $str .= '</div></td>'; |
|
57 | + $str .='<td align="right"> <div class="yui-bd">'; |
|
58 | + for($i = 2; $i < count($buttons); $i++){ |
|
59 | + $button = $buttons[$i]; |
|
60 | + $str .= smarty_function_sugar_button(array('module' => $module, 'id' => $button, 'view' => $view), $smarty); |
|
61 | + $str .= ' '; |
|
62 | + } |
|
63 | + $str .='</div></td>'; |
|
64 | + $str .='</tr></table>'; |
|
65 | + } |
|
66 | + } |
|
67 | + return $str; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | ?> |
@@ -37,13 +37,13 @@ |
||
37 | 37 | |
38 | 38 | function smarty_function_sugar_fetch($params, &$smarty) |
39 | 39 | { |
40 | - if(empty($params['key'])) { |
|
41 | - $smarty->trigger_error("sugar_fetch: missing 'key' parameter"); |
|
42 | - return; |
|
43 | - } |
|
40 | + if(empty($params['key'])) { |
|
41 | + $smarty->trigger_error("sugar_fetch: missing 'key' parameter"); |
|
42 | + return; |
|
43 | + } |
|
44 | 44 | if(empty($params['object'])) { |
45 | - $smarty->trigger_error("sugar_fetch: missing 'object' parameter"); |
|
46 | - return; |
|
45 | + $smarty->trigger_error("sugar_fetch: missing 'object' parameter"); |
|
46 | + return; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | $theKey = $params['key']; |
@@ -40,14 +40,14 @@ |
||
40 | 40 | function smarty_function_sugar_image($params, &$smarty) |
41 | 41 | { |
42 | 42 | |
43 | - if(!isset($params['name'])){ |
|
44 | - $smarty->trigger_error("sugar_field: missing 'name' parameter"); |
|
45 | - return; |
|
46 | - } |
|
47 | - $height = (!empty($params['height']))?$params['height']:'48'; |
|
48 | - $width = (!empty($params['width']))?$params['width']:'48'; |
|
49 | - $image = (!empty($params['image']))?$params['image']:$params['name']; |
|
50 | - $altimage = (!empty($params['altimage']))?$params['altimage']:$params['name']; |
|
51 | - return getStudioIcon($image, $altimage, $height, $width); |
|
43 | + if(!isset($params['name'])){ |
|
44 | + $smarty->trigger_error("sugar_field: missing 'name' parameter"); |
|
45 | + return; |
|
46 | + } |
|
47 | + $height = (!empty($params['height']))?$params['height']:'48'; |
|
48 | + $width = (!empty($params['width']))?$params['width']:'48'; |
|
49 | + $image = (!empty($params['image']))?$params['image']:$params['name']; |
|
50 | + $altimage = (!empty($params['altimage']))?$params['altimage']:$params['name']; |
|
51 | + return getStudioIcon($image, $altimage, $height, $width); |
|
52 | 52 | |
53 | 53 | } |
54 | 54 | \ No newline at end of file |
@@ -29,7 +29,7 @@ |
||
29 | 29 | |
30 | 30 | if (!empty($params['src'])) { |
31 | 31 | return '<div id="overDiv" style="position:absolute; visibility:hidden; z-index:'.$zindex.';"></div>' . "\n" |
32 | - . '<script type="text/javascript" language="JavaScript" src="'.$params['src'].'"></script>' . "\n"; |
|
32 | + . '<script type="text/javascript" language="JavaScript" src="'.$params['src'].'"></script>' . "\n"; |
|
33 | 33 | } else { |
34 | 34 | $smarty->trigger_error("popup_init: missing src parameter"); |
35 | 35 | } |
@@ -22,7 +22,7 @@ |
||
22 | 22 | function smarty_modifier_count_characters($string, $include_spaces = false) |
23 | 23 | { |
24 | 24 | if ($include_spaces) |
25 | - return(strlen($string)); |
|
25 | + return(strlen($string)); |
|
26 | 26 | |
27 | 27 | return preg_match_all("/[^\s]/",$string, $match); |
28 | 28 | } |
@@ -62,19 +62,19 @@ |
||
62 | 62 | */ |
63 | 63 | function smarty_function_sugar_translate($params, &$smarty) |
64 | 64 | { |
65 | - if (!isset($params['label'])){ |
|
66 | - $smarty->trigger_error("sugar_translate: missing 'label' parameter"); |
|
67 | - return ''; |
|
68 | - } |
|
65 | + if (!isset($params['label'])){ |
|
66 | + $smarty->trigger_error("sugar_translate: missing 'label' parameter"); |
|
67 | + return ''; |
|
68 | + } |
|
69 | 69 | |
70 | - $module = (isset($params['module']))? $params['module']: ''; |
|
70 | + $module = (isset($params['module']))? $params['module']: ''; |
|
71 | 71 | if(isset($params['select'])){ |
72 | - if(empty($params['select'])) |
|
73 | - $value = ""; |
|
74 | - else |
|
75 | - $value = translate($params['label'] , $module, $params['select']); |
|
76 | - }else{ |
|
77 | - $value = translate($params['label'] , $module); |
|
72 | + if(empty($params['select'])) |
|
73 | + $value = ""; |
|
74 | + else |
|
75 | + $value = translate($params['label'] , $module, $params['select']); |
|
76 | + }else{ |
|
77 | + $value = translate($params['label'] , $module); |
|
78 | 78 | } |
79 | 79 | if (!empty($params['for_js']) && $params['for_js']) { |
80 | 80 | $value = addslashes($value); |
@@ -88,24 +88,24 @@ discard block |
||
88 | 88 | if (!empty($params['var']['assign'])) { |
89 | 89 | return '{$' . $params['colData']['field']['name'] . '}'; |
90 | 90 | } else { |
91 | - $code = $params['var']['customCode']; |
|
92 | - if(isset($params['tabindex']) && preg_match_all("'(<[ ]*?)(textarea|input|select)([^>]*?)(>)'si", $code, $matches, PREG_PATTERN_ORDER)) { |
|
93 | - $str_replace = array(); |
|
94 | - $tabindex = ' tabindex="' . $params['tabindex'] . '" '; |
|
95 | - foreach($matches[3] as $match) { |
|
96 | - $str_replace[$match] = $tabindex . $match; |
|
97 | - } |
|
98 | - $code = str_replace(array_keys($str_replace), array_values($str_replace), $code); |
|
99 | - } |
|
91 | + $code = $params['var']['customCode']; |
|
92 | + if(isset($params['tabindex']) && preg_match_all("'(<[ ]*?)(textarea|input|select)([^>]*?)(>)'si", $code, $matches, PREG_PATTERN_ORDER)) { |
|
93 | + $str_replace = array(); |
|
94 | + $tabindex = ' tabindex="' . $params['tabindex'] . '" '; |
|
95 | + foreach($matches[3] as $match) { |
|
96 | + $str_replace[$match] = $tabindex . $match; |
|
97 | + } |
|
98 | + $code = str_replace(array_keys($str_replace), array_values($str_replace), $code); |
|
99 | + } |
|
100 | 100 | |
101 | 101 | if(isset($params['accesskey']) && preg_match_all("'(<[ ]*?)(textarea|input|select)([^>]*?)(>)'si", $code, $matches, PREG_PATTERN_ORDER)) { |
102 | - $str_replace = array(); |
|
103 | - $accesskey = ' accesskey="' . $params['accesskey'] . '" '; |
|
104 | - foreach($matches[3] as $match) { |
|
105 | - $str_replace[$match] = $accesskey . $match; |
|
106 | - } |
|
107 | - $code = str_replace(array_keys($str_replace), array_values($str_replace), $code); |
|
108 | - } |
|
102 | + $str_replace = array(); |
|
103 | + $accesskey = ' accesskey="' . $params['accesskey'] . '" '; |
|
104 | + foreach($matches[3] as $match) { |
|
105 | + $str_replace[$match] = $accesskey . $match; |
|
106 | + } |
|
107 | + $code = str_replace(array_keys($str_replace), array_values($str_replace), $code); |
|
108 | + } |
|
109 | 109 | |
110 | 110 | // Add a string replace to swap out @@FIELD@@ for the actual field, |
111 | 111 | // we can't do this through customCode directly because the sugar_field smarty function returns smarty code to run on the second pass |
@@ -126,12 +126,12 @@ discard block |
||
126 | 126 | $code = str_replace('@@FIELD@@',$fieldText,$code); |
127 | 127 | } |
128 | 128 | |
129 | - //eggsurplus bug 28321: add support for rendering customCode AND normal field rendering |
|
130 | - if(!empty($params['var']['displayParams']['enableConnectors']) && empty($params['var']['customCodeRenderField'])) { |
|
131 | - require_once('include/connectors/utils/ConnectorUtils.php'); |
|
132 | - $code .= ' ' . ConnectorUtils::getConnectorButtonScript($params['var']['displayParams'], $smarty); |
|
133 | - } |
|
134 | - return $code; |
|
129 | + //eggsurplus bug 28321: add support for rendering customCode AND normal field rendering |
|
130 | + if(!empty($params['var']['displayParams']['enableConnectors']) && empty($params['var']['customCodeRenderField'])) { |
|
131 | + require_once('include/connectors/utils/ConnectorUtils.php'); |
|
132 | + $code .= ' ' . ConnectorUtils::getConnectorButtonScript($params['var']['displayParams'], $smarty); |
|
133 | + } |
|
134 | + return $code; |
|
135 | 135 | } |
136 | 136 | |
137 | 137 |