@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | { |
29 | 29 | if ($smarty->debugging) { |
30 | 30 | $_params = array(); |
31 | - require_once(SMARTY_CORE_DIR . 'core.get_microtime.php'); |
|
31 | + require_once(SMARTY_CORE_DIR.'core.get_microtime.php'); |
|
32 | 32 | $_debug_start_time = smarty_core_get_microtime($_params, $smarty); |
33 | 33 | } |
34 | 34 | |
@@ -59,13 +59,13 @@ discard block |
||
59 | 59 | 'resource_base_path' => $smarty->config_dir, |
60 | 60 | 'get_source' => false); |
61 | 61 | $smarty->_parse_resource_name($_params); |
62 | - $_file_path = $_params['resource_type'] . ':' . $_params['resource_name']; |
|
62 | + $_file_path = $_params['resource_type'].':'.$_params['resource_name']; |
|
63 | 63 | if (isset($_section)) |
64 | 64 | $_compile_file = $smarty->_get_compile_path($_file_path.'|'.$_section); |
65 | 65 | else |
66 | 66 | $_compile_file = $smarty->_get_compile_path($_file_path); |
67 | 67 | |
68 | - if($smarty->force_compile || !file_exists($_compile_file)) { |
|
68 | + if ($smarty->force_compile || !file_exists($_compile_file)) { |
|
69 | 69 | $_compile = true; |
70 | 70 | } elseif ($smarty->compile_check) { |
71 | 71 | $_params = array('resource_name' => $_file, |
@@ -77,10 +77,10 @@ discard block |
||
77 | 77 | $_compile = false; |
78 | 78 | } |
79 | 79 | |
80 | - if($_compile) { |
|
80 | + if ($_compile) { |
|
81 | 81 | // compile config file |
82 | - if(!is_object($smarty->_conf_obj)) { |
|
83 | - require_once SMARTY_DIR . $smarty->config_class . '.class.php'; |
|
82 | + if (!is_object($smarty->_conf_obj)) { |
|
83 | + require_once SMARTY_DIR.$smarty->config_class.'.class.php'; |
|
84 | 84 | $smarty->_conf_obj = new $smarty->config_class(); |
85 | 85 | $smarty->_conf_obj->overwrite = $smarty->config_overwrite; |
86 | 86 | $smarty->_conf_obj->booleanize = $smarty->config_booleanize; |
@@ -97,13 +97,13 @@ discard block |
||
97 | 97 | $smarty->_conf_obj->set_file_contents($_file, $_params['source_content']); |
98 | 98 | $_config_vars = array_merge($smarty->_conf_obj->get($_file), |
99 | 99 | $smarty->_conf_obj->get($_file, $_section)); |
100 | - if(function_exists('var_export')) { |
|
101 | - $_output = '<?php $_config_vars = ' . var_export($_config_vars, true) . '; ?>'; |
|
100 | + if (function_exists('var_export')) { |
|
101 | + $_output = '<?php $_config_vars = '.var_export($_config_vars, true).'; ?>'; |
|
102 | 102 | } else { |
103 | - $_output = '<?php $_config_vars = unserialize(\'' . strtr(serialize($_config_vars),array('\''=>'\\\'', '\\'=>'\\\\')) . '\'); ?>'; |
|
103 | + $_output = '<?php $_config_vars = unserialize(\''.strtr(serialize($_config_vars), array('\''=>'\\\'', '\\'=>'\\\\')).'\'); ?>'; |
|
104 | 104 | } |
105 | 105 | $_params = (array('compile_path' => $_compile_file, 'compiled_content' => $_output, 'resource_timestamp' => $_params['resource_timestamp'])); |
106 | - require_once(SMARTY_CORE_DIR . 'core.write_compiled_resource.php'); |
|
106 | + require_once(SMARTY_CORE_DIR.'core.write_compiled_resource.php'); |
|
107 | 107 | smarty_core_write_compiled_resource($_params, $smarty); |
108 | 108 | } else { |
109 | 109 | include($_compile_file); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | if ($smarty->debugging) { |
130 | 130 | $_params = array(); |
131 | - require_once(SMARTY_CORE_DIR . 'core.get_microtime.php'); |
|
131 | + require_once(SMARTY_CORE_DIR.'core.get_microtime.php'); |
|
132 | 132 | $smarty->_smarty_debug_info[] = array('type' => 'config', |
133 | 133 | 'filename' => $_file.' ['.$_section.'] '.$_scope, |
134 | 134 | 'depth' => $smarty->_inclusion_depth, |
@@ -60,10 +60,11 @@ |
||
60 | 60 | 'get_source' => false); |
61 | 61 | $smarty->_parse_resource_name($_params); |
62 | 62 | $_file_path = $_params['resource_type'] . ':' . $_params['resource_name']; |
63 | - if (isset($_section)) |
|
64 | - $_compile_file = $smarty->_get_compile_path($_file_path.'|'.$_section); |
|
65 | - else |
|
66 | - $_compile_file = $smarty->_get_compile_path($_file_path); |
|
63 | + if (isset($_section)) { |
|
64 | + $_compile_file = $smarty->_get_compile_path($_file_path.'|'.$_section); |
|
65 | + } else { |
|
66 | + $_compile_file = $smarty->_get_compile_path($_file_path); |
|
67 | + } |
|
67 | 68 | |
68 | 69 | if($smarty->force_compile || !file_exists($_compile_file)) { |
69 | 70 | $_compile = true; |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | $_params = array('resource_name' => $_file, |
59 | - 'resource_base_path' => $smarty->config_dir, |
|
60 | - 'get_source' => false); |
|
59 | + 'resource_base_path' => $smarty->config_dir, |
|
60 | + 'get_source' => false); |
|
61 | 61 | $smarty->_parse_resource_name($_params); |
62 | 62 | $_file_path = $_params['resource_type'] . ':' . $_params['resource_name']; |
63 | 63 | if (isset($_section)) |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | $_compile = true; |
70 | 70 | } elseif ($smarty->compile_check) { |
71 | 71 | $_params = array('resource_name' => $_file, |
72 | - 'resource_base_path' => $smarty->config_dir, |
|
73 | - 'get_source' => false); |
|
72 | + 'resource_base_path' => $smarty->config_dir, |
|
73 | + 'get_source' => false); |
|
74 | 74 | $_compile = $smarty->_fetch_resource_info($_params) && |
75 | 75 | $_params['resource_timestamp'] > filemtime($_compile_file); |
76 | 76 | } else { |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | } |
90 | 90 | |
91 | 91 | $_params = array('resource_name' => $_file, |
92 | - 'resource_base_path' => $smarty->config_dir, |
|
93 | - $_params['get_source'] = true); |
|
92 | + 'resource_base_path' => $smarty->config_dir, |
|
93 | + $_params['get_source'] = true); |
|
94 | 94 | if (!$smarty->_fetch_resource_info($_params)) { |
95 | 95 | return; |
96 | 96 | } |
@@ -47,19 +47,19 @@ discard block |
||
47 | 47 | function smarty_function_sugar_evalcolumn_old($params, &$smarty) |
48 | 48 | { |
49 | 49 | if (!isset($params['var']) || !isset($params['rowData'])) { |
50 | - if(!isset($params['var'])) |
|
50 | + if (!isset($params['var'])) |
|
51 | 51 | $smarty->trigger_error("evalcolumn: missing 'var' parameter"); |
52 | - if(!isset($params['rowData'])) |
|
52 | + if (!isset($params['rowData'])) |
|
53 | 53 | $smarty->trigger_error("evalcolumn: missing 'rowData' parameter"); |
54 | 54 | return; |
55 | 55 | } |
56 | 56 | |
57 | - if($params['var'] == '') { |
|
57 | + if ($params['var'] == '') { |
|
58 | 58 | return; |
59 | 59 | } |
60 | 60 | |
61 | - if(is_array($params['var'])) { |
|
62 | - foreach($params['var'] as $key => $value) { |
|
61 | + if (is_array($params['var'])) { |
|
62 | + foreach ($params['var'] as $key => $value) { |
|
63 | 63 | $params['var'][$key] = searchReplace($value, $params['rowData']); |
64 | 64 | } |
65 | 65 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $params['var'] = searchReplace($params['var'], $params['rowData']); |
68 | 68 | } |
69 | 69 | |
70 | - if(isset($params['toJSON'])) { |
|
70 | + if (isset($params['toJSON'])) { |
|
71 | 71 | $json = getJSONobj(); |
72 | 72 | $params['var'] = $json->encode($params['var']); |
73 | 73 | } |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | function searchReplace($value, &$rowData) { |
83 | 83 | preg_match_all('/\{\$(.*)\}/U', $value, $matches); |
84 | 84 | |
85 | - for($wp = 0; $wp < count($matches[0]); $wp++) { |
|
86 | - if(isset($rowData[$matches[1][$wp]])) |
|
85 | + for ($wp = 0; $wp < count($matches[0]); $wp++) { |
|
86 | + if (isset($rowData[$matches[1][$wp]])) |
|
87 | 87 | $value = str_replace($matches[0][$wp], $rowData[$matches[1][$wp]], $value); |
88 | 88 | else |
89 | 89 | $value = str_replace($matches[0][$wp], '', $value); |
@@ -47,10 +47,12 @@ discard block |
||
47 | 47 | function smarty_function_sugar_evalcolumn_old($params, &$smarty) |
48 | 48 | { |
49 | 49 | if (!isset($params['var']) || !isset($params['rowData'])) { |
50 | - if(!isset($params['var'])) |
|
51 | - $smarty->trigger_error("evalcolumn: missing 'var' parameter"); |
|
52 | - if(!isset($params['rowData'])) |
|
53 | - $smarty->trigger_error("evalcolumn: missing 'rowData' parameter"); |
|
50 | + if(!isset($params['var'])) { |
|
51 | + $smarty->trigger_error("evalcolumn: missing 'var' parameter"); |
|
52 | + } |
|
53 | + if(!isset($params['rowData'])) { |
|
54 | + $smarty->trigger_error("evalcolumn: missing 'rowData' parameter"); |
|
55 | + } |
|
54 | 56 | return; |
55 | 57 | } |
56 | 58 | |
@@ -62,8 +64,7 @@ discard block |
||
62 | 64 | foreach($params['var'] as $key => $value) { |
63 | 65 | $params['var'][$key] = searchReplace($value, $params['rowData']); |
64 | 66 | } |
65 | - } |
|
66 | - else { |
|
67 | + } else { |
|
67 | 68 | $params['var'] = searchReplace($params['var'], $params['rowData']); |
68 | 69 | } |
69 | 70 | |
@@ -83,10 +84,11 @@ discard block |
||
83 | 84 | preg_match_all('/\{\$(.*)\}/U', $value, $matches); |
84 | 85 | |
85 | 86 | for($wp = 0; $wp < count($matches[0]); $wp++) { |
86 | - if(isset($rowData[$matches[1][$wp]])) |
|
87 | - $value = str_replace($matches[0][$wp], $rowData[$matches[1][$wp]], $value); |
|
88 | - else |
|
89 | - $value = str_replace($matches[0][$wp], '', $value); |
|
87 | + if(isset($rowData[$matches[1][$wp]])) { |
|
88 | + $value = str_replace($matches[0][$wp], $rowData[$matches[1][$wp]], $value); |
|
89 | + } else { |
|
90 | + $value = str_replace($matches[0][$wp], '', $value); |
|
91 | + } |
|
90 | 92 | } |
91 | 93 | return $value; |
92 | 94 | } |
@@ -40,12 +40,12 @@ discard block |
||
40 | 40 | */ |
41 | 41 | function smarty_function_sugar_replace_vars($params, &$smarty) |
42 | 42 | { |
43 | - if(empty($params['subject'])) { |
|
44 | - $smarty->trigger_error("sugarvar: missing 'subject' parameter"); |
|
45 | - return; |
|
46 | - } |
|
47 | - $fields = empty($params['fields']) ? $smarty->get_template_vars('fields') : $params['fields']; |
|
48 | - $lDelim = "["; |
|
43 | + if(empty($params['subject'])) { |
|
44 | + $smarty->trigger_error("sugarvar: missing 'subject' parameter"); |
|
45 | + return; |
|
46 | + } |
|
47 | + $fields = empty($params['fields']) ? $smarty->get_template_vars('fields') : $params['fields']; |
|
48 | + $lDelim = "["; |
|
49 | 49 | $rDelim = "]"; |
50 | 50 | if ($params['use_curly']) |
51 | 51 | { |
@@ -53,10 +53,10 @@ discard block |
||
53 | 53 | $rDelim = "}"; |
54 | 54 | } |
55 | 55 | $subject = $params['subject']; |
56 | - $matches = array(); |
|
57 | - $count = preg_match_all('/\\' . $lDelim . '([^\\' . $rDelim . ']*)\\' . $rDelim . '/', $subject, $matches); |
|
56 | + $matches = array(); |
|
57 | + $count = preg_match_all('/\\' . $lDelim . '([^\\' . $rDelim . ']*)\\' . $rDelim . '/', $subject, $matches); |
|
58 | 58 | for($i = 0; $i < $count; $i++) { |
59 | - $match = $matches[1][$i]; |
|
59 | + $match = $matches[1][$i]; |
|
60 | 60 | //List views will have fields be an array where all the keys are upper case and the values are jsut strings |
61 | 61 | if (!isset($fields[$match]) && isset($fields[strtoupper($match)])) |
62 | 62 | $match = strtoupper($match); |
@@ -74,21 +74,21 @@ discard block |
||
74 | 74 | } |
75 | 75 | |
76 | 76 | if (isset($fields[$match]['type']) && $fields[$match]['type']=='enum' |
77 | - && isset($fields[$match]['options']) && isset($fields[$match]['options'][$value])) |
|
78 | - { |
|
79 | - $subject = str_replace($matches[0][$i], $fields[$match]['options'][$value], $subject); |
|
80 | - } else |
|
81 | - { |
|
82 | - $subject = str_replace($matches[0][$i], $value, $subject); |
|
83 | - } |
|
84 | - } |
|
85 | - } |
|
77 | + && isset($fields[$match]['options']) && isset($fields[$match]['options'][$value])) |
|
78 | + { |
|
79 | + $subject = str_replace($matches[0][$i], $fields[$match]['options'][$value], $subject); |
|
80 | + } else |
|
81 | + { |
|
82 | + $subject = str_replace($matches[0][$i], $value, $subject); |
|
83 | + } |
|
84 | + } |
|
85 | + } |
|
86 | 86 | |
87 | - if (!empty($params['assign'])) |
|
88 | - { |
|
89 | - $smarty->assign($params['assign'], $subject); |
|
90 | - return ''; |
|
91 | - } |
|
87 | + if (!empty($params['assign'])) |
|
88 | + { |
|
89 | + $smarty->assign($params['assign'], $subject); |
|
90 | + return ''; |
|
91 | + } |
|
92 | 92 | |
93 | - return $subject; |
|
93 | + return $subject; |
|
94 | 94 | } |
95 | 95 | \ No newline at end of file |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | function smarty_function_sugar_replace_vars($params, &$smarty) |
42 | 42 | { |
43 | - if(empty($params['subject'])) { |
|
43 | + if (empty($params['subject'])) { |
|
44 | 44 | $smarty->trigger_error("sugarvar: missing 'subject' parameter"); |
45 | 45 | return; |
46 | 46 | } |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | } |
55 | 55 | $subject = $params['subject']; |
56 | 56 | $matches = array(); |
57 | - $count = preg_match_all('/\\' . $lDelim . '([^\\' . $rDelim . ']*)\\' . $rDelim . '/', $subject, $matches); |
|
58 | - for($i = 0; $i < $count; $i++) { |
|
57 | + $count = preg_match_all('/\\'.$lDelim.'([^\\'.$rDelim.']*)\\'.$rDelim.'/', $subject, $matches); |
|
58 | + for ($i = 0; $i < $count; $i++) { |
|
59 | 59 | $match = $matches[1][$i]; |
60 | 60 | //List views will have fields be an array where all the keys are upper case and the values are jsut strings |
61 | 61 | if (!isset($fields[$match]) && isset($fields[strtoupper($match)])) |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $value = $value['value']; |
74 | 74 | } |
75 | 75 | |
76 | - if (isset($fields[$match]['type']) && $fields[$match]['type']=='enum' |
|
76 | + if (isset($fields[$match]['type']) && $fields[$match]['type'] == 'enum' |
|
77 | 77 | && isset($fields[$match]['options']) && isset($fields[$match]['options'][$value])) |
78 | 78 | { |
79 | 79 | $subject = str_replace($matches[0][$i], $fields[$match]['options'][$value], $subject); |
@@ -58,8 +58,9 @@ discard block |
||
58 | 58 | for($i = 0; $i < $count; $i++) { |
59 | 59 | $match = $matches[1][$i]; |
60 | 60 | //List views will have fields be an array where all the keys are upper case and the values are jsut strings |
61 | - if (!isset($fields[$match]) && isset($fields[strtoupper($match)])) |
|
62 | - $match = strtoupper($match); |
|
61 | + if (!isset($fields[$match]) && isset($fields[strtoupper($match)])) { |
|
62 | + $match = strtoupper($match); |
|
63 | + } |
|
63 | 64 | |
64 | 65 | $value = isset($fields[$match]) ? $fields[$match] : null; |
65 | 66 | if (!is_null($value)) { |
@@ -67,8 +68,7 @@ discard block |
||
67 | 68 | { |
68 | 69 | $bean = $smarty->get_template_vars('bean'); |
69 | 70 | $value = $bean->$match; |
70 | - } |
|
71 | - else if (is_array($value) && isset($value['value'])) |
|
71 | + } else if (is_array($value) && isset($value['value'])) |
|
72 | 72 | { |
73 | 73 | $value = $value['value']; |
74 | 74 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | function smarty_function_html_checkboxes($params, &$smarty) |
42 | 42 | { |
43 | - require_once $smarty->_get_plugin_filepath('shared','escape_special_chars'); |
|
43 | + require_once $smarty->_get_plugin_filepath('shared', 'escape_special_chars'); |
|
44 | 44 | |
45 | 45 | $name = 'checkbox'; |
46 | 46 | $values = null; |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | |
53 | 53 | $extra = ''; |
54 | 54 | |
55 | - foreach($params as $_key => $_val) { |
|
56 | - switch($_key) { |
|
55 | + foreach ($params as $_key => $_val) { |
|
56 | + switch ($_key) { |
|
57 | 57 | case 'name': |
58 | 58 | case 'separator': |
59 | 59 | $$_key = $_val; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | break; |
87 | 87 | |
88 | 88 | default: |
89 | - if(!is_array($_val)) { |
|
89 | + if (!is_array($_val)) { |
|
90 | 90 | $extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"'; |
91 | 91 | } else { |
92 | 92 | $smarty->trigger_error("html_checkboxes: extra attribute '$_key' cannot be an array", E_USER_NOTICE); |
@@ -115,10 +115,10 @@ discard block |
||
115 | 115 | |
116 | 116 | } |
117 | 117 | |
118 | - if(!empty($params['assign'])) { |
|
118 | + if (!empty($params['assign'])) { |
|
119 | 119 | $smarty->assign($params['assign'], $_html_result); |
120 | 120 | } else { |
121 | - return implode("\n",$_html_result); |
|
121 | + return implode("\n", $_html_result); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | } |
@@ -127,15 +127,15 @@ discard block |
||
127 | 127 | $_output = ''; |
128 | 128 | if ($labels) $_output .= '<label>'; |
129 | 129 | $_output .= '<input type="checkbox" name="' |
130 | - . smarty_function_escape_special_chars($name) . '[]" value="' |
|
131 | - . smarty_function_escape_special_chars($value) . '"'; |
|
130 | + . smarty_function_escape_special_chars($name).'[]" value="' |
|
131 | + . smarty_function_escape_special_chars($value).'"'; |
|
132 | 132 | |
133 | 133 | if (in_array((string)$value, $selected)) { |
134 | 134 | $_output .= ' checked="checked"'; |
135 | 135 | } |
136 | - $_output .= $extra . ' />' . $output; |
|
136 | + $_output .= $extra.' />'.$output; |
|
137 | 137 | if ($labels) $_output .= '</label>'; |
138 | - $_output .= $separator; |
|
138 | + $_output .= $separator; |
|
139 | 139 | |
140 | 140 | return $_output; |
141 | 141 | } |
@@ -95,16 +95,19 @@ discard block |
||
95 | 95 | } |
96 | 96 | } |
97 | 97 | |
98 | - if (!isset($options) && !isset($values)) |
|
99 | - return ''; /* raise error here? */ |
|
98 | + if (!isset($options) && !isset($values)) { |
|
99 | + return ''; |
|
100 | + } |
|
101 | + /* raise error here? */ |
|
100 | 102 | |
101 | 103 | settype($selected, 'array'); |
102 | 104 | $_html_result = array(); |
103 | 105 | |
104 | 106 | if (isset($options)) { |
105 | 107 | |
106 | - foreach ($options as $_key=>$_val) |
|
107 | - $_html_result[] = smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels); |
|
108 | + foreach ($options as $_key=>$_val) { |
|
109 | + $_html_result[] = smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels); |
|
110 | + } |
|
108 | 111 | |
109 | 112 | |
110 | 113 | } else { |
@@ -125,7 +128,9 @@ discard block |
||
125 | 128 | |
126 | 129 | function smarty_function_html_checkboxes_output($name, $value, $output, $selected, $extra, $separator, $labels) { |
127 | 130 | $_output = ''; |
128 | - if ($labels) $_output .= '<label>'; |
|
131 | + if ($labels) { |
|
132 | + $_output .= '<label>'; |
|
133 | + } |
|
129 | 134 | $_output .= '<input type="checkbox" name="' |
130 | 135 | . smarty_function_escape_special_chars($name) . '[]" value="' |
131 | 136 | . smarty_function_escape_special_chars($value) . '"'; |
@@ -134,7 +139,9 @@ discard block |
||
134 | 139 | $_output .= ' checked="checked"'; |
135 | 140 | } |
136 | 141 | $_output .= $extra . ' />' . $output; |
137 | - if ($labels) $_output .= '</label>'; |
|
142 | + if ($labels) { |
|
143 | + $_output .= '</label>'; |
|
144 | + } |
|
138 | 145 | $_output .= $separator; |
139 | 146 | |
140 | 147 | return $_output; |
@@ -56,9 +56,9 @@ |
||
56 | 56 | */ |
57 | 57 | function smarty_function_sugar_getscript($params, &$smarty) |
58 | 58 | { |
59 | - if(!isset($params['file'])) { |
|
60 | - $smarty->trigger_error($GLOBALS['app_strings']['ERR_MISSING_REQUIRED_FIELDS'] . 'file'); |
|
61 | - } |
|
62 | - return getVersionedScript($params['file']); |
|
59 | + if(!isset($params['file'])) { |
|
60 | + $smarty->trigger_error($GLOBALS['app_strings']['ERR_MISSING_REQUIRED_FIELDS'] . 'file'); |
|
61 | + } |
|
62 | + return getVersionedScript($params['file']); |
|
63 | 63 | } |
64 | 64 | ?> |
65 | 65 | \ No newline at end of file |
@@ -56,8 +56,8 @@ |
||
56 | 56 | */ |
57 | 57 | function smarty_function_sugar_getscript($params, &$smarty) |
58 | 58 | { |
59 | - if(!isset($params['file'])) { |
|
60 | - $smarty->trigger_error($GLOBALS['app_strings']['ERR_MISSING_REQUIRED_FIELDS'] . 'file'); |
|
59 | + if (!isset($params['file'])) { |
|
60 | + $smarty->trigger_error($GLOBALS['app_strings']['ERR_MISSING_REQUIRED_FIELDS'].'file'); |
|
61 | 61 | } |
62 | 62 | return getVersionedScript($params['file']); |
63 | 63 | } |
@@ -77,9 +77,9 @@ |
||
77 | 77 | function smarty_modifier_to_url($string) |
78 | 78 | { |
79 | 79 | if (preg_match('/^[^:\/]*:\/\/.*/', $string)) { |
80 | - return $string; |
|
80 | + return $string; |
|
81 | 81 | } else { |
82 | - return 'http://' . $string; |
|
82 | + return 'http://' . $string; |
|
83 | 83 | } |
84 | 84 | } |
85 | 85 |
@@ -79,7 +79,7 @@ |
||
79 | 79 | if (preg_match('/^[^:\/]*:\/\/.*/', $string)) { |
80 | 80 | return $string; |
81 | 81 | } else { |
82 | - return 'http://' . $string; |
|
82 | + return 'http://'.$string; |
|
83 | 83 | } |
84 | 84 | } |
85 | 85 |
@@ -108,7 +108,7 @@ |
||
108 | 108 | $retval = $trigger . '="return overlib(\''.preg_replace(array("!'!","![\r\n]!"),array("\'",'\r'),$text).'\''; |
109 | 109 | $retval .= $append . ');"'; |
110 | 110 | if ($trigger == 'onmouseover') |
111 | - $retval .= ' onmouseout="nd();"'; |
|
111 | + $retval .= ' onmouseout="nd();"'; |
|
112 | 112 | |
113 | 113 | |
114 | 114 | return $retval; |
@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | case 'inarray': |
31 | 31 | $$_key = (string)$_value; |
32 | 32 | if ($_key == 'function' || $_key == 'inarray') |
33 | - $append .= ',' . strtoupper($_key) . ",'$_value'"; |
|
33 | + $append .= ','.strtoupper($_key).",'$_value'"; |
|
34 | 34 | break; |
35 | 35 | |
36 | 36 | case 'caption': |
37 | 37 | case 'closetext': |
38 | 38 | case 'status': |
39 | - $append .= ',' . strtoupper($_key) . ",'" . str_replace("'","\'",$_value) . "'"; |
|
39 | + $append .= ','.strtoupper($_key).",'".str_replace("'", "\'", $_value)."'"; |
|
40 | 40 | break; |
41 | 41 | |
42 | 42 | case 'fgcolor': |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | case 'capicon': |
54 | 54 | case 'background': |
55 | 55 | case 'frame': |
56 | - $append .= ',' . strtoupper($_key) . ",'$_value'"; |
|
56 | + $append .= ','.strtoupper($_key).",'$_value'"; |
|
57 | 57 | break; |
58 | 58 | |
59 | 59 | case 'textsize': |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | case 'pady': |
73 | 73 | case 'timeout': |
74 | 74 | case 'delay': |
75 | - $append .= ',' . strtoupper($_key) . ",$_value"; |
|
75 | + $append .= ','.strtoupper($_key).",$_value"; |
|
76 | 76 | break; |
77 | 77 | |
78 | 78 | case 'sticky': |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | case 'mouseoff': |
91 | 91 | case 'followmouse': |
92 | 92 | case 'closeclick': |
93 | - if ($_value) $append .= ',' . strtoupper($_key); |
|
93 | + if ($_value) $append .= ','.strtoupper($_key); |
|
94 | 94 | break; |
95 | 95 | |
96 | 96 | default: |
@@ -105,8 +105,8 @@ discard block |
||
105 | 105 | |
106 | 106 | if (empty($trigger)) { $trigger = "onmouseover"; } |
107 | 107 | |
108 | - $retval = $trigger . '="return overlib(\''.preg_replace(array("!'!","![\r\n]!"),array("\'",'\r'),$text).'\''; |
|
109 | - $retval .= $append . ');"'; |
|
108 | + $retval = $trigger.'="return overlib(\''.preg_replace(array("!'!", "![\r\n]!"), array("\'", '\r'), $text).'\''; |
|
109 | + $retval .= $append.');"'; |
|
110 | 110 | if ($trigger == 'onmouseover') |
111 | 111 | $retval .= ' onmouseout="nd();"'; |
112 | 112 |
@@ -29,8 +29,9 @@ discard block |
||
29 | 29 | case 'function': |
30 | 30 | case 'inarray': |
31 | 31 | $$_key = (string)$_value; |
32 | - if ($_key == 'function' || $_key == 'inarray') |
|
33 | - $append .= ',' . strtoupper($_key) . ",'$_value'"; |
|
32 | + if ($_key == 'function' || $_key == 'inarray') { |
|
33 | + $append .= ',' . strtoupper($_key) . ",'$_value'"; |
|
34 | + } |
|
34 | 35 | break; |
35 | 36 | |
36 | 37 | case 'caption': |
@@ -90,7 +91,9 @@ discard block |
||
90 | 91 | case 'mouseoff': |
91 | 92 | case 'followmouse': |
92 | 93 | case 'closeclick': |
93 | - if ($_value) $append .= ',' . strtoupper($_key); |
|
94 | + if ($_value) { |
|
95 | + $append .= ',' . strtoupper($_key); |
|
96 | + } |
|
94 | 97 | break; |
95 | 98 | |
96 | 99 | default: |
@@ -107,8 +110,9 @@ discard block |
||
107 | 110 | |
108 | 111 | $retval = $trigger . '="return overlib(\''.preg_replace(array("!'!","![\r\n]!"),array("\'",'\r'),$text).'\''; |
109 | 112 | $retval .= $append . ');"'; |
110 | - if ($trigger == 'onmouseover') |
|
111 | - $retval .= ' onmouseout="nd();"'; |
|
113 | + if ($trigger == 'onmouseover') { |
|
114 | + $retval .= ' onmouseout="nd();"'; |
|
115 | + } |
|
112 | 116 | |
113 | 117 | |
114 | 118 | return $retval; |
@@ -44,29 +44,29 @@ |
||
44 | 44 | { |
45 | 45 | $error = false; |
46 | 46 | |
47 | - if(!isset($params['func'])) { |
|
47 | + if (!isset($params['func'])) { |
|
48 | 48 | $error = true; |
49 | 49 | $smarty->trigger_error("sugar_field: missing 'func' parameter"); |
50 | 50 | } |
51 | - if(!isset($params['displayType'])) { |
|
51 | + if (!isset($params['displayType'])) { |
|
52 | 52 | $error = true; |
53 | 53 | $smarty->trigger_error("sugar_field: missing 'displayType' parameter"); |
54 | 54 | } |
55 | - if(!isset($params['bean'])) { |
|
55 | + if (!isset($params['bean'])) { |
|
56 | 56 | $params['bean'] = $GLOBALS['focus']; |
57 | 57 | } |
58 | 58 | |
59 | - if ( $error ) { |
|
59 | + if ($error) { |
|
60 | 60 | return; |
61 | 61 | } |
62 | 62 | |
63 | 63 | $funcName = $params['func']; |
64 | 64 | |
65 | - if ( !empty($params['include']) ) { |
|
65 | + if (!empty($params['include'])) { |
|
66 | 66 | require_once($params['include']); |
67 | 67 | } |
68 | 68 | |
69 | - $_contents = $funcName($params['bean'],$params['field'],$params['value'],$params['displayType'],$params['tabindex']); |
|
69 | + $_contents = $funcName($params['bean'], $params['field'], $params['value'], $params['displayType'], $params['tabindex']); |
|
70 | 70 | return $_contents; |
71 | 71 | } |
72 | 72 | ?> |
@@ -50,120 +50,120 @@ |
||
50 | 50 | */ |
51 | 51 | function smarty_function_sugar_actions_link($params, &$smarty) |
52 | 52 | { |
53 | - if(empty($params['module'])) { |
|
54 | - $smarty->trigger_error("sugar_button: missing required param (module)"); |
|
55 | - } else if(empty($params['id'])) { |
|
56 | - $smarty->trigger_error("sugar_button: missing required param (id)"); |
|
57 | - } else if(empty($params['view'])) { |
|
58 | - $smarty->trigger_error("sugar_button: missing required param (view)"); |
|
59 | - } |
|
60 | - |
|
61 | - $type = $params['id']; |
|
62 | - $location = (empty($params['location'])) ? "" : "_".$params['location']; |
|
63 | - |
|
64 | - if(!is_array($type)) { |
|
65 | - $module = $params['module']; |
|
66 | - $view = $params['view']; |
|
67 | - switch(strtoupper($type)) { |
|
68 | - case "SEARCH": |
|
69 | - return '<input tabindex="2" title="{$APP.LBL_SEARCH_BUTTON_TITLE}" accessKey="{$APP.LBL_SEARCH_BUTTON_KEY}" onclick="SUGAR.savedViews.setChooser(); SUGAR.ajaxUI.submitForm(this.form);" class="button" type="button" name="button" value="{$APP.LBL_SEARCH_BUTTON_LABEL}" id="search_form_submit"/> '; |
|
70 | - break; |
|
71 | - |
|
72 | - case "CANCEL": |
|
73 | - $cancelButton = '{if !empty($smarty.request.return_action) && ($smarty.request.return_action == "DetailView" && !empty($smarty.request.return_id))}'; |
|
74 | - $cancelButton = '{if !empty($smarty.request.return_action) && ($smarty.request.return_action == "DetailView" && !empty($smarty.request.return_id))}'; |
|
75 | - $cancelButton .= '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="SUGAR.ajaxUI.loadContent(\'index.php?action=DetailView&module={$smarty.request.return_module|escape:"url"}&record={$smarty.request.return_id|escape:"url"}\'); return false;" name="button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}" type="button" id="'.$type.$location.'"> '; |
|
76 | - $cancelButton .= '{elseif !empty($smarty.request.return_action) && ($smarty.request.return_action == "DetailView" && !empty($fields.id.value))}'; |
|
77 | - $cancelButton .= '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="SUGAR.ajaxUI.loadContent(\'index.php?action=DetailView&module={$smarty.request.return_module|escape:"url"}&record={$fields.id.value}\'); return false;" type="button" name="button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}" id="'.$type.$location.'"> '; |
|
78 | - $cancelButton .= '{elseif empty($smarty.request.return_action) || empty($smarty.request.return_id) && !empty($fields.id.value)}'; |
|
79 | - $cancelButton .= '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="SUGAR.ajaxUI.loadContent(\'index.php?action=index&module='.$module.'\'); return false;" type="button" name="button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}" id="'.$type.$location.'"> '; |
|
80 | - $cancelButton .= '{else}'; |
|
81 | - $cancelButton .= '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="SUGAR.ajaxUI.loadContent(\'index.php?action=index&module={$smarty.request.return_module|escape:"url"}&record={$smarty.request.return_id|escape:"url"}\'); return false;" type="button" name="button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}" id="'.$type.$location.'"> '; |
|
82 | - $cancelButton .= '{/if}'; |
|
83 | - return $cancelButton; |
|
84 | - break; |
|
85 | - |
|
86 | - case "DELETE": |
|
87 | - return '{if $bean->aclAccess("delete")}<a title="{$APP.LBL_DELETE_BUTTON_TITLE}" accessKey="{$APP.LBL_DELETE_BUTTON_KEY}" onclick="$(\'#form\')[0].return_module.value=\'' . $module . '\'; $(\'#form\')[0].return_action.value=\'ListView\'; $(\'#form\')[0].action.value=\'Delete\'; if(confirm(\'{$APP.NTC_DELETE_CONFIRMATION}\')){literal}{$(\'#form\').submit()}{/literal};" name="Delete" id="delete_button">{$APP.LBL_DELETE_BUTTON_LABEL}</a>{/if} '; |
|
88 | - break; |
|
89 | - |
|
90 | - case "DUPLICATE": |
|
91 | - return '{if $bean->aclAccess("edit")}<a title="{$APP.LBL_DUPLICATE_BUTTON_TITLE}" accessKey="{$APP.LBL_DUPLICATE_BUTTON_KEY}" onclick="$(\'#form\')[0].return_module.value=\''. $module . '\'; $(\'#form\')[0].return_action.value=\'DetailView\'; $(\'#form\')[0].isDuplicate.value=true; $(\'#form\')[0].action.value=\'' . $view . '\'; $(\'#form\')[0].return_id.value=\'{$id}\';SUGAR.ajaxUI.submitForm($(\'#form\')[0]);" name="Duplicate" id="duplicate_button">{$APP.LBL_DUPLICATE_BUTTON_LABEL}</a>{/if} '; |
|
92 | - break; |
|
93 | - |
|
94 | - case "EDIT"; |
|
95 | - return '{if $bean->aclAccess("edit")}<a title="{$APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{$APP.LBL_EDIT_BUTTON_KEY}" onclick="$(\'#form\')[0].return_module.value=\'' . $module . '\'; $(\'#form\')[0].return_action.value=\'DetailView\'; $(\'#form\')[0].return_id.value=\'{$id}\'; $(\'#form\')[0].action.value=\'EditView\';SUGAR.ajaxUI.submitForm($(\'#form\')[0]);" name="Edit" id="edit_button">{$APP.LBL_EDIT_BUTTON_LABEL}</a>{/if} '; |
|
96 | - break; |
|
53 | + if(empty($params['module'])) { |
|
54 | + $smarty->trigger_error("sugar_button: missing required param (module)"); |
|
55 | + } else if(empty($params['id'])) { |
|
56 | + $smarty->trigger_error("sugar_button: missing required param (id)"); |
|
57 | + } else if(empty($params['view'])) { |
|
58 | + $smarty->trigger_error("sugar_button: missing required param (view)"); |
|
59 | + } |
|
60 | + |
|
61 | + $type = $params['id']; |
|
62 | + $location = (empty($params['location'])) ? "" : "_".$params['location']; |
|
63 | + |
|
64 | + if(!is_array($type)) { |
|
65 | + $module = $params['module']; |
|
66 | + $view = $params['view']; |
|
67 | + switch(strtoupper($type)) { |
|
68 | + case "SEARCH": |
|
69 | + return '<input tabindex="2" title="{$APP.LBL_SEARCH_BUTTON_TITLE}" accessKey="{$APP.LBL_SEARCH_BUTTON_KEY}" onclick="SUGAR.savedViews.setChooser(); SUGAR.ajaxUI.submitForm(this.form);" class="button" type="button" name="button" value="{$APP.LBL_SEARCH_BUTTON_LABEL}" id="search_form_submit"/> '; |
|
70 | + break; |
|
71 | + |
|
72 | + case "CANCEL": |
|
73 | + $cancelButton = '{if !empty($smarty.request.return_action) && ($smarty.request.return_action == "DetailView" && !empty($smarty.request.return_id))}'; |
|
74 | + $cancelButton = '{if !empty($smarty.request.return_action) && ($smarty.request.return_action == "DetailView" && !empty($smarty.request.return_id))}'; |
|
75 | + $cancelButton .= '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="SUGAR.ajaxUI.loadContent(\'index.php?action=DetailView&module={$smarty.request.return_module|escape:"url"}&record={$smarty.request.return_id|escape:"url"}\'); return false;" name="button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}" type="button" id="'.$type.$location.'"> '; |
|
76 | + $cancelButton .= '{elseif !empty($smarty.request.return_action) && ($smarty.request.return_action == "DetailView" && !empty($fields.id.value))}'; |
|
77 | + $cancelButton .= '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="SUGAR.ajaxUI.loadContent(\'index.php?action=DetailView&module={$smarty.request.return_module|escape:"url"}&record={$fields.id.value}\'); return false;" type="button" name="button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}" id="'.$type.$location.'"> '; |
|
78 | + $cancelButton .= '{elseif empty($smarty.request.return_action) || empty($smarty.request.return_id) && !empty($fields.id.value)}'; |
|
79 | + $cancelButton .= '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="SUGAR.ajaxUI.loadContent(\'index.php?action=index&module='.$module.'\'); return false;" type="button" name="button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}" id="'.$type.$location.'"> '; |
|
80 | + $cancelButton .= '{else}'; |
|
81 | + $cancelButton .= '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="SUGAR.ajaxUI.loadContent(\'index.php?action=index&module={$smarty.request.return_module|escape:"url"}&record={$smarty.request.return_id|escape:"url"}\'); return false;" type="button" name="button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}" id="'.$type.$location.'"> '; |
|
82 | + $cancelButton .= '{/if}'; |
|
83 | + return $cancelButton; |
|
84 | + break; |
|
85 | + |
|
86 | + case "DELETE": |
|
87 | + return '{if $bean->aclAccess("delete")}<a title="{$APP.LBL_DELETE_BUTTON_TITLE}" accessKey="{$APP.LBL_DELETE_BUTTON_KEY}" onclick="$(\'#form\')[0].return_module.value=\'' . $module . '\'; $(\'#form\')[0].return_action.value=\'ListView\'; $(\'#form\')[0].action.value=\'Delete\'; if(confirm(\'{$APP.NTC_DELETE_CONFIRMATION}\')){literal}{$(\'#form\').submit()}{/literal};" name="Delete" id="delete_button">{$APP.LBL_DELETE_BUTTON_LABEL}</a>{/if} '; |
|
88 | + break; |
|
89 | + |
|
90 | + case "DUPLICATE": |
|
91 | + return '{if $bean->aclAccess("edit")}<a title="{$APP.LBL_DUPLICATE_BUTTON_TITLE}" accessKey="{$APP.LBL_DUPLICATE_BUTTON_KEY}" onclick="$(\'#form\')[0].return_module.value=\''. $module . '\'; $(\'#form\')[0].return_action.value=\'DetailView\'; $(\'#form\')[0].isDuplicate.value=true; $(\'#form\')[0].action.value=\'' . $view . '\'; $(\'#form\')[0].return_id.value=\'{$id}\';SUGAR.ajaxUI.submitForm($(\'#form\')[0]);" name="Duplicate" id="duplicate_button">{$APP.LBL_DUPLICATE_BUTTON_LABEL}</a>{/if} '; |
|
92 | + break; |
|
93 | + |
|
94 | + case "EDIT"; |
|
95 | + return '{if $bean->aclAccess("edit")}<a title="{$APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{$APP.LBL_EDIT_BUTTON_KEY}" onclick="$(\'#form\')[0].return_module.value=\'' . $module . '\'; $(\'#form\')[0].return_action.value=\'DetailView\'; $(\'#form\')[0].return_id.value=\'{$id}\'; $(\'#form\')[0].action.value=\'EditView\';SUGAR.ajaxUI.submitForm($(\'#form\')[0]);" name="Edit" id="edit_button">{$APP.LBL_EDIT_BUTTON_LABEL}</a>{/if} '; |
|
96 | + break; |
|
97 | 97 | |
98 | 98 | case "EDIT2"; |
99 | - return '{if $bean->aclAccess("edit")}<a title="{$APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{$APP.LBL_EDIT_BUTTON_KEY}" onclick="$(\'#form\')[0].return_module.value=\'' . $module . '\'; $(\'#form\')[0].return_action.value=\'DetailView\'; $(\'#form\')[0].return_id.value=\'{$id}\'; $(\'#form\')[0].action.value=\'EditView\';SUGAR.ajaxUI.submitForm($(\'#form\')[0]);" name="Edit">{$APP.LBL_EDIT_BUTTON_LABEL}</a>{/if} '; |
|
100 | - break; |
|
99 | + return '{if $bean->aclAccess("edit")}<a title="{$APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{$APP.LBL_EDIT_BUTTON_KEY}" onclick="$(\'#form\')[0].return_module.value=\'' . $module . '\'; $(\'#form\')[0].return_action.value=\'DetailView\'; $(\'#form\')[0].return_id.value=\'{$id}\'; $(\'#form\')[0].action.value=\'EditView\';SUGAR.ajaxUI.submitForm($(\'#form\')[0]);" name="Edit">{$APP.LBL_EDIT_BUTTON_LABEL}</a>{/if} '; |
|
100 | + break; |
|
101 | 101 | |
102 | - case "FIND_DUPLICATES": |
|
103 | - return '{if $bean->aclAccess("edit") && $bean->aclAccess("delete")}<a title="{$APP.LBL_DUP_MERGE}" accessKey="M" onclick="$(\'#form\')[0].return_module.value=\'' . $module . '\'; $(\'#form\')[0].return_action.value=\'DetailView\'; $(\'#form\')[0].return_id.value=\'{$id}\'; $(\'#form\')[0].action.value=\'Step1\'; $(\'#form\')[0].module.value=\'MergeRecords\';SUGAR.ajaxUI.submitForm($(\'#form\')[0]);" name="Merge" id="merge_duplicate_button">{$APP.LBL_DUP_MERGE}</a>{/if} '; |
|
104 | - break; |
|
102 | + case "FIND_DUPLICATES": |
|
103 | + return '{if $bean->aclAccess("edit") && $bean->aclAccess("delete")}<a title="{$APP.LBL_DUP_MERGE}" accessKey="M" onclick="$(\'#form\')[0].return_module.value=\'' . $module . '\'; $(\'#form\')[0].return_action.value=\'DetailView\'; $(\'#form\')[0].return_id.value=\'{$id}\'; $(\'#form\')[0].action.value=\'Step1\'; $(\'#form\')[0].module.value=\'MergeRecords\';SUGAR.ajaxUI.submitForm($(\'#form\')[0]);" name="Merge" id="merge_duplicate_button">{$APP.LBL_DUP_MERGE}</a>{/if} '; |
|
104 | + break; |
|
105 | 105 | |
106 | - case "SAVE": |
|
107 | - $view = ($_REQUEST['action'] == 'EditView') ? 'EditView' : (($view == 'EditView') ? 'EditView' : $view); |
|
108 | - return '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button primary" onclick="{if $isDuplicate}this.form.return_id.value=\'\'; {/if}this.form.action.value=\'Save\'; if(check_form(\'' . $view . '\'))SUGAR.ajaxUI.submitForm(this.form);return false;" type="submit" name="button" value="{$APP.LBL_SAVE_BUTTON_LABEL}" id="'.$type.$location.'">{/if} '; |
|
109 | - break; |
|
106 | + case "SAVE": |
|
107 | + $view = ($_REQUEST['action'] == 'EditView') ? 'EditView' : (($view == 'EditView') ? 'EditView' : $view); |
|
108 | + return '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button primary" onclick="{if $isDuplicate}this.form.return_id.value=\'\'; {/if}this.form.action.value=\'Save\'; if(check_form(\'' . $view . '\'))SUGAR.ajaxUI.submitForm(this.form);return false;" type="submit" name="button" value="{$APP.LBL_SAVE_BUTTON_LABEL}" id="'.$type.$location.'">{/if} '; |
|
109 | + break; |
|
110 | 110 | |
111 | - case "SUBPANELSAVE": |
|
111 | + case "SUBPANELSAVE": |
|
112 | 112 | if($view == 'QuickCreate' || (isset($_REQUEST['target_action']) && strtolower($_REQUEST['target_action'])) == 'quickcreate') $view = "form_SubpanelQuickCreate_{$module}"; |
113 | 113 | return '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button" onclick="disableOnUnloadEditView();this.form.action.value=\'Save\';if(check_form(\''.$view.'\'))return SUGAR.subpanelUtils.inlineSave(this.form.id, \'' . $params['module'] . '_subpanel_save_button\');return false;" type="submit" name="' . $params['module'] . '_subpanel_save_button" id="' . $params['module'] . '_subpanel_save_button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">{/if} '; |
114 | - case "SUBPANELCANCEL": |
|
115 | - return '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="return SUGAR.subpanelUtils.cancelCreate($(this).attr(\'id\'));return false;" type="submit" name="' . $params['module'] . '_subpanel_cancel_button" id="' . $params['module'] . '_subpanel_cancel_button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}"> '; |
|
116 | - case "SUBPANELFULLFORM": |
|
117 | - $html = '<input title="{$APP.LBL_FULL_FORM_BUTTON_TITLE}" accessKey="{$APP.LBL_FULL_FORM_BUTTON_KEY}" class="button" onclick="disableOnUnloadEditView(this.form); this.form.return_action.value=\'DetailView\'; this.form.action.value=\'EditView\'; if(typeof(this.form.to_pdf)!=\'undefined\') this.form.to_pdf.value=\'0\';" type="submit" name="' . $params['module'] . '_subpanel_full_form_button" id="' . $params['module'] . '_subpanel_full_form_button" value="{$APP.LBL_FULL_FORM_BUTTON_LABEL}"> '; |
|
118 | - $html .= '<input type="hidden" name="full_form" value="full_form">'; |
|
119 | - return $html; |
|
120 | - case "DCMENUCANCEL": |
|
121 | - return '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="javascript:lastLoadedMenu=undefined;DCMenu.closeOverlay();return false;" type="submit" name="' . $params['module'] . '_dcmenu_cancel_button" id="' . $params['module'] . '_dcmenu_cancel_button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}"> '; |
|
122 | - |
|
123 | - case "DCMENUSAVE": |
|
114 | + case "SUBPANELCANCEL": |
|
115 | + return '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="return SUGAR.subpanelUtils.cancelCreate($(this).attr(\'id\'));return false;" type="submit" name="' . $params['module'] . '_subpanel_cancel_button" id="' . $params['module'] . '_subpanel_cancel_button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}"> '; |
|
116 | + case "SUBPANELFULLFORM": |
|
117 | + $html = '<input title="{$APP.LBL_FULL_FORM_BUTTON_TITLE}" accessKey="{$APP.LBL_FULL_FORM_BUTTON_KEY}" class="button" onclick="disableOnUnloadEditView(this.form); this.form.return_action.value=\'DetailView\'; this.form.action.value=\'EditView\'; if(typeof(this.form.to_pdf)!=\'undefined\') this.form.to_pdf.value=\'0\';" type="submit" name="' . $params['module'] . '_subpanel_full_form_button" id="' . $params['module'] . '_subpanel_full_form_button" value="{$APP.LBL_FULL_FORM_BUTTON_LABEL}"> '; |
|
118 | + $html .= '<input type="hidden" name="full_form" value="full_form">'; |
|
119 | + return $html; |
|
120 | + case "DCMENUCANCEL": |
|
121 | + return '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="javascript:lastLoadedMenu=undefined;DCMenu.closeOverlay();return false;" type="submit" name="' . $params['module'] . '_dcmenu_cancel_button" id="' . $params['module'] . '_dcmenu_cancel_button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}"> '; |
|
122 | + |
|
123 | + case "DCMENUSAVE": |
|
124 | 124 | if ($view == 'QuickCreate') { |
125 | 125 | $view = "form_DCQuickCreate_{$module}"; |
126 | 126 | } else if ($view == 'EditView') { |
127 | 127 | $view = "form_DCEditView_{$module}"; |
128 | 128 | } |
129 | - return '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button primary" onclick="this.form.action.value=\'Save\';if(check_form(\''.$view.'\'))return DCMenu.save(this.form.id, \'' . $params['module'] . '_subpanel_save_button\');return false;" type="submit" name="' . $params['module'] . '_dcmenu_save_button" id="' . $params['module'] . '_dcmenu_save_button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">{/if} '; |
|
130 | - case "DCMENUFULLFORM": |
|
129 | + return '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button primary" onclick="this.form.action.value=\'Save\';if(check_form(\''.$view.'\'))return DCMenu.save(this.form.id, \'' . $params['module'] . '_subpanel_save_button\');return false;" type="submit" name="' . $params['module'] . '_dcmenu_save_button" id="' . $params['module'] . '_dcmenu_save_button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">{/if} '; |
|
130 | + case "DCMENUFULLFORM": |
|
131 | 131 | $html = '<input title="{$APP.LBL_FULL_FORM_BUTTON_TITLE}" accessKey="{$APP.LBL_FULL_FORM_BUTTON_KEY}" class="button" onclick="disableOnUnloadEditView(this.form); this.form.return_action.value=\'DetailView\'; this.form.action.value=\'EditView\'; this.form.return_module.value=\'' . $params['module'] . '\';this.form.return_id.value=this.form.record.value;if(typeof(this.form.to_pdf)!=\'undefined\') this.form.to_pdf.value=\'0\';SUGAR.ajaxUI.submitForm(this.form,null,true);DCMenu.closeOverlay();" type="button" name="' . $params['module'] . '_subpanel_full_form_button" id="' . $params['module'] . '_subpanel_full_form_button" value="{$APP.LBL_FULL_FORM_BUTTON_LABEL}"> '; |
132 | - $html .= '<input type="hidden" name="full_form" value="full_form">'; |
|
133 | - return $html; |
|
134 | - case "POPUPSAVE": |
|
135 | - $view = $view == 'QuickCreate' ? "form_QuickCreate_{$module}" : $view; |
|
136 | - return '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" ' |
|
137 | - . 'class="button primary" onclick="this.form.action.value=\'Popup\';' |
|
138 | - . 'return check_form(\''.$view.'\')" type="submit" name="' . $params['module'] |
|
139 | - . '_popupcreate_save_button" id="' . $params['module'] |
|
140 | - . '_popupcreate_save_button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">{/if} '; |
|
141 | - case "POPUPCANCEL": |
|
142 | - return '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" ' |
|
143 | - . 'class="button" onclick="toggleDisplay(\'addform\');return false;" ' |
|
144 | - . 'name="' . $params['module'] . '_popup_cancel_button" type="submit"' |
|
145 | - . 'id="' . $params['module'] . '_popup_cancel_button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}"> '; |
|
146 | - |
|
147 | - case "AUDIT": |
|
148 | - $popup_request_data = array( |
|
149 | - 'call_back_function' => 'set_return', |
|
150 | - 'form_name' => 'EditView', |
|
151 | - 'field_to_name_array' => array(), |
|
152 | - ); |
|
153 | - $json = getJSONobj(); |
|
154 | - |
|
155 | - require_once('include/SugarFields/Parsers/MetaParser.php'); |
|
156 | - $encoded_popup_request_data = MetaParser::parseDelimiters($json->encode($popup_request_data)); |
|
157 | - $audit_link = '<a id="btn_view_change_log" title="{$APP.LNK_VIEW_CHANGE_LOG}" onclick=\'open_popup("Audit", "600", "400", "&record={$fields.id.value}&module_name=' . $params['module'] . '", true, false, ' . $encoded_popup_request_data . '); return false;\'>{$APP.LNK_VIEW_CHANGE_LOG}</a>'; |
|
158 | - $view = '{if $bean->aclAccess("detail")}{if !empty($fields.id.value) && $isAuditEnabled}'.$audit_link.'{/if}{/if}'; |
|
159 | - return $view; |
|
160 | - |
|
161 | - |
|
162 | - } //switch |
|
163 | - |
|
164 | - } else if(is_array($type) && isset($type['customCode'])) { |
|
165 | - return $type['customCode']; |
|
166 | - } |
|
132 | + $html .= '<input type="hidden" name="full_form" value="full_form">'; |
|
133 | + return $html; |
|
134 | + case "POPUPSAVE": |
|
135 | + $view = $view == 'QuickCreate' ? "form_QuickCreate_{$module}" : $view; |
|
136 | + return '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" ' |
|
137 | + . 'class="button primary" onclick="this.form.action.value=\'Popup\';' |
|
138 | + . 'return check_form(\''.$view.'\')" type="submit" name="' . $params['module'] |
|
139 | + . '_popupcreate_save_button" id="' . $params['module'] |
|
140 | + . '_popupcreate_save_button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">{/if} '; |
|
141 | + case "POPUPCANCEL": |
|
142 | + return '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" ' |
|
143 | + . 'class="button" onclick="toggleDisplay(\'addform\');return false;" ' |
|
144 | + . 'name="' . $params['module'] . '_popup_cancel_button" type="submit"' |
|
145 | + . 'id="' . $params['module'] . '_popup_cancel_button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}"> '; |
|
146 | + |
|
147 | + case "AUDIT": |
|
148 | + $popup_request_data = array( |
|
149 | + 'call_back_function' => 'set_return', |
|
150 | + 'form_name' => 'EditView', |
|
151 | + 'field_to_name_array' => array(), |
|
152 | + ); |
|
153 | + $json = getJSONobj(); |
|
154 | + |
|
155 | + require_once('include/SugarFields/Parsers/MetaParser.php'); |
|
156 | + $encoded_popup_request_data = MetaParser::parseDelimiters($json->encode($popup_request_data)); |
|
157 | + $audit_link = '<a id="btn_view_change_log" title="{$APP.LNK_VIEW_CHANGE_LOG}" onclick=\'open_popup("Audit", "600", "400", "&record={$fields.id.value}&module_name=' . $params['module'] . '", true, false, ' . $encoded_popup_request_data . '); return false;\'>{$APP.LNK_VIEW_CHANGE_LOG}</a>'; |
|
158 | + $view = '{if $bean->aclAccess("detail")}{if !empty($fields.id.value) && $isAuditEnabled}'.$audit_link.'{/if}{/if}'; |
|
159 | + return $view; |
|
160 | + |
|
161 | + |
|
162 | + } //switch |
|
163 | + |
|
164 | + } else if(is_array($type) && isset($type['customCode'])) { |
|
165 | + return $type['customCode']; |
|
166 | + } |
|
167 | 167 | |
168 | 168 | } |
169 | 169 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -50,21 +50,21 @@ discard block |
||
50 | 50 | */ |
51 | 51 | function smarty_function_sugar_actions_link($params, &$smarty) |
52 | 52 | { |
53 | - if(empty($params['module'])) { |
|
53 | + if (empty($params['module'])) { |
|
54 | 54 | $smarty->trigger_error("sugar_button: missing required param (module)"); |
55 | - } else if(empty($params['id'])) { |
|
55 | + } else if (empty($params['id'])) { |
|
56 | 56 | $smarty->trigger_error("sugar_button: missing required param (id)"); |
57 | - } else if(empty($params['view'])) { |
|
57 | + } else if (empty($params['view'])) { |
|
58 | 58 | $smarty->trigger_error("sugar_button: missing required param (view)"); |
59 | 59 | } |
60 | 60 | |
61 | 61 | $type = $params['id']; |
62 | 62 | $location = (empty($params['location'])) ? "" : "_".$params['location']; |
63 | 63 | |
64 | - if(!is_array($type)) { |
|
64 | + if (!is_array($type)) { |
|
65 | 65 | $module = $params['module']; |
66 | 66 | $view = $params['view']; |
67 | - switch(strtoupper($type)) { |
|
67 | + switch (strtoupper($type)) { |
|
68 | 68 | case "SEARCH": |
69 | 69 | return '<input tabindex="2" title="{$APP.LBL_SEARCH_BUTTON_TITLE}" accessKey="{$APP.LBL_SEARCH_BUTTON_KEY}" onclick="SUGAR.savedViews.setChooser(); SUGAR.ajaxUI.submitForm(this.form);" class="button" type="button" name="button" value="{$APP.LBL_SEARCH_BUTTON_LABEL}" id="search_form_submit"/> '; |
70 | 70 | break; |
@@ -84,41 +84,41 @@ discard block |
||
84 | 84 | break; |
85 | 85 | |
86 | 86 | case "DELETE": |
87 | - return '{if $bean->aclAccess("delete")}<a title="{$APP.LBL_DELETE_BUTTON_TITLE}" accessKey="{$APP.LBL_DELETE_BUTTON_KEY}" onclick="$(\'#form\')[0].return_module.value=\'' . $module . '\'; $(\'#form\')[0].return_action.value=\'ListView\'; $(\'#form\')[0].action.value=\'Delete\'; if(confirm(\'{$APP.NTC_DELETE_CONFIRMATION}\')){literal}{$(\'#form\').submit()}{/literal};" name="Delete" id="delete_button">{$APP.LBL_DELETE_BUTTON_LABEL}</a>{/if} '; |
|
87 | + return '{if $bean->aclAccess("delete")}<a title="{$APP.LBL_DELETE_BUTTON_TITLE}" accessKey="{$APP.LBL_DELETE_BUTTON_KEY}" onclick="$(\'#form\')[0].return_module.value=\''.$module.'\'; $(\'#form\')[0].return_action.value=\'ListView\'; $(\'#form\')[0].action.value=\'Delete\'; if(confirm(\'{$APP.NTC_DELETE_CONFIRMATION}\')){literal}{$(\'#form\').submit()}{/literal};" name="Delete" id="delete_button">{$APP.LBL_DELETE_BUTTON_LABEL}</a>{/if} '; |
|
88 | 88 | break; |
89 | 89 | |
90 | 90 | case "DUPLICATE": |
91 | - return '{if $bean->aclAccess("edit")}<a title="{$APP.LBL_DUPLICATE_BUTTON_TITLE}" accessKey="{$APP.LBL_DUPLICATE_BUTTON_KEY}" onclick="$(\'#form\')[0].return_module.value=\''. $module . '\'; $(\'#form\')[0].return_action.value=\'DetailView\'; $(\'#form\')[0].isDuplicate.value=true; $(\'#form\')[0].action.value=\'' . $view . '\'; $(\'#form\')[0].return_id.value=\'{$id}\';SUGAR.ajaxUI.submitForm($(\'#form\')[0]);" name="Duplicate" id="duplicate_button">{$APP.LBL_DUPLICATE_BUTTON_LABEL}</a>{/if} '; |
|
91 | + return '{if $bean->aclAccess("edit")}<a title="{$APP.LBL_DUPLICATE_BUTTON_TITLE}" accessKey="{$APP.LBL_DUPLICATE_BUTTON_KEY}" onclick="$(\'#form\')[0].return_module.value=\''.$module.'\'; $(\'#form\')[0].return_action.value=\'DetailView\'; $(\'#form\')[0].isDuplicate.value=true; $(\'#form\')[0].action.value=\''.$view.'\'; $(\'#form\')[0].return_id.value=\'{$id}\';SUGAR.ajaxUI.submitForm($(\'#form\')[0]);" name="Duplicate" id="duplicate_button">{$APP.LBL_DUPLICATE_BUTTON_LABEL}</a>{/if} '; |
|
92 | 92 | break; |
93 | 93 | |
94 | 94 | case "EDIT"; |
95 | - return '{if $bean->aclAccess("edit")}<a title="{$APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{$APP.LBL_EDIT_BUTTON_KEY}" onclick="$(\'#form\')[0].return_module.value=\'' . $module . '\'; $(\'#form\')[0].return_action.value=\'DetailView\'; $(\'#form\')[0].return_id.value=\'{$id}\'; $(\'#form\')[0].action.value=\'EditView\';SUGAR.ajaxUI.submitForm($(\'#form\')[0]);" name="Edit" id="edit_button">{$APP.LBL_EDIT_BUTTON_LABEL}</a>{/if} '; |
|
95 | + return '{if $bean->aclAccess("edit")}<a title="{$APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{$APP.LBL_EDIT_BUTTON_KEY}" onclick="$(\'#form\')[0].return_module.value=\''.$module.'\'; $(\'#form\')[0].return_action.value=\'DetailView\'; $(\'#form\')[0].return_id.value=\'{$id}\'; $(\'#form\')[0].action.value=\'EditView\';SUGAR.ajaxUI.submitForm($(\'#form\')[0]);" name="Edit" id="edit_button">{$APP.LBL_EDIT_BUTTON_LABEL}</a>{/if} '; |
|
96 | 96 | break; |
97 | 97 | |
98 | 98 | case "EDIT2"; |
99 | - return '{if $bean->aclAccess("edit")}<a title="{$APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{$APP.LBL_EDIT_BUTTON_KEY}" onclick="$(\'#form\')[0].return_module.value=\'' . $module . '\'; $(\'#form\')[0].return_action.value=\'DetailView\'; $(\'#form\')[0].return_id.value=\'{$id}\'; $(\'#form\')[0].action.value=\'EditView\';SUGAR.ajaxUI.submitForm($(\'#form\')[0]);" name="Edit">{$APP.LBL_EDIT_BUTTON_LABEL}</a>{/if} '; |
|
99 | + return '{if $bean->aclAccess("edit")}<a title="{$APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{$APP.LBL_EDIT_BUTTON_KEY}" onclick="$(\'#form\')[0].return_module.value=\''.$module.'\'; $(\'#form\')[0].return_action.value=\'DetailView\'; $(\'#form\')[0].return_id.value=\'{$id}\'; $(\'#form\')[0].action.value=\'EditView\';SUGAR.ajaxUI.submitForm($(\'#form\')[0]);" name="Edit">{$APP.LBL_EDIT_BUTTON_LABEL}</a>{/if} '; |
|
100 | 100 | break; |
101 | 101 | |
102 | 102 | case "FIND_DUPLICATES": |
103 | - return '{if $bean->aclAccess("edit") && $bean->aclAccess("delete")}<a title="{$APP.LBL_DUP_MERGE}" accessKey="M" onclick="$(\'#form\')[0].return_module.value=\'' . $module . '\'; $(\'#form\')[0].return_action.value=\'DetailView\'; $(\'#form\')[0].return_id.value=\'{$id}\'; $(\'#form\')[0].action.value=\'Step1\'; $(\'#form\')[0].module.value=\'MergeRecords\';SUGAR.ajaxUI.submitForm($(\'#form\')[0]);" name="Merge" id="merge_duplicate_button">{$APP.LBL_DUP_MERGE}</a>{/if} '; |
|
103 | + return '{if $bean->aclAccess("edit") && $bean->aclAccess("delete")}<a title="{$APP.LBL_DUP_MERGE}" accessKey="M" onclick="$(\'#form\')[0].return_module.value=\''.$module.'\'; $(\'#form\')[0].return_action.value=\'DetailView\'; $(\'#form\')[0].return_id.value=\'{$id}\'; $(\'#form\')[0].action.value=\'Step1\'; $(\'#form\')[0].module.value=\'MergeRecords\';SUGAR.ajaxUI.submitForm($(\'#form\')[0]);" name="Merge" id="merge_duplicate_button">{$APP.LBL_DUP_MERGE}</a>{/if} '; |
|
104 | 104 | break; |
105 | 105 | |
106 | 106 | case "SAVE": |
107 | 107 | $view = ($_REQUEST['action'] == 'EditView') ? 'EditView' : (($view == 'EditView') ? 'EditView' : $view); |
108 | - return '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button primary" onclick="{if $isDuplicate}this.form.return_id.value=\'\'; {/if}this.form.action.value=\'Save\'; if(check_form(\'' . $view . '\'))SUGAR.ajaxUI.submitForm(this.form);return false;" type="submit" name="button" value="{$APP.LBL_SAVE_BUTTON_LABEL}" id="'.$type.$location.'">{/if} '; |
|
108 | + return '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button primary" onclick="{if $isDuplicate}this.form.return_id.value=\'\'; {/if}this.form.action.value=\'Save\'; if(check_form(\''.$view.'\'))SUGAR.ajaxUI.submitForm(this.form);return false;" type="submit" name="button" value="{$APP.LBL_SAVE_BUTTON_LABEL}" id="'.$type.$location.'">{/if} '; |
|
109 | 109 | break; |
110 | 110 | |
111 | 111 | case "SUBPANELSAVE": |
112 | - if($view == 'QuickCreate' || (isset($_REQUEST['target_action']) && strtolower($_REQUEST['target_action'])) == 'quickcreate') $view = "form_SubpanelQuickCreate_{$module}"; |
|
113 | - return '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button" onclick="disableOnUnloadEditView();this.form.action.value=\'Save\';if(check_form(\''.$view.'\'))return SUGAR.subpanelUtils.inlineSave(this.form.id, \'' . $params['module'] . '_subpanel_save_button\');return false;" type="submit" name="' . $params['module'] . '_subpanel_save_button" id="' . $params['module'] . '_subpanel_save_button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">{/if} '; |
|
112 | + if ($view == 'QuickCreate' || (isset($_REQUEST['target_action']) && strtolower($_REQUEST['target_action'])) == 'quickcreate') $view = "form_SubpanelQuickCreate_{$module}"; |
|
113 | + return '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button" onclick="disableOnUnloadEditView();this.form.action.value=\'Save\';if(check_form(\''.$view.'\'))return SUGAR.subpanelUtils.inlineSave(this.form.id, \''.$params['module'].'_subpanel_save_button\');return false;" type="submit" name="'.$params['module'].'_subpanel_save_button" id="'.$params['module'].'_subpanel_save_button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">{/if} '; |
|
114 | 114 | case "SUBPANELCANCEL": |
115 | - return '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="return SUGAR.subpanelUtils.cancelCreate($(this).attr(\'id\'));return false;" type="submit" name="' . $params['module'] . '_subpanel_cancel_button" id="' . $params['module'] . '_subpanel_cancel_button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}"> '; |
|
115 | + return '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="return SUGAR.subpanelUtils.cancelCreate($(this).attr(\'id\'));return false;" type="submit" name="'.$params['module'].'_subpanel_cancel_button" id="'.$params['module'].'_subpanel_cancel_button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}"> '; |
|
116 | 116 | case "SUBPANELFULLFORM": |
117 | - $html = '<input title="{$APP.LBL_FULL_FORM_BUTTON_TITLE}" accessKey="{$APP.LBL_FULL_FORM_BUTTON_KEY}" class="button" onclick="disableOnUnloadEditView(this.form); this.form.return_action.value=\'DetailView\'; this.form.action.value=\'EditView\'; if(typeof(this.form.to_pdf)!=\'undefined\') this.form.to_pdf.value=\'0\';" type="submit" name="' . $params['module'] . '_subpanel_full_form_button" id="' . $params['module'] . '_subpanel_full_form_button" value="{$APP.LBL_FULL_FORM_BUTTON_LABEL}"> '; |
|
117 | + $html = '<input title="{$APP.LBL_FULL_FORM_BUTTON_TITLE}" accessKey="{$APP.LBL_FULL_FORM_BUTTON_KEY}" class="button" onclick="disableOnUnloadEditView(this.form); this.form.return_action.value=\'DetailView\'; this.form.action.value=\'EditView\'; if(typeof(this.form.to_pdf)!=\'undefined\') this.form.to_pdf.value=\'0\';" type="submit" name="'.$params['module'].'_subpanel_full_form_button" id="'.$params['module'].'_subpanel_full_form_button" value="{$APP.LBL_FULL_FORM_BUTTON_LABEL}"> '; |
|
118 | 118 | $html .= '<input type="hidden" name="full_form" value="full_form">'; |
119 | 119 | return $html; |
120 | 120 | case "DCMENUCANCEL": |
121 | - return '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="javascript:lastLoadedMenu=undefined;DCMenu.closeOverlay();return false;" type="submit" name="' . $params['module'] . '_dcmenu_cancel_button" id="' . $params['module'] . '_dcmenu_cancel_button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}"> '; |
|
121 | + return '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="javascript:lastLoadedMenu=undefined;DCMenu.closeOverlay();return false;" type="submit" name="'.$params['module'].'_dcmenu_cancel_button" id="'.$params['module'].'_dcmenu_cancel_button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}"> '; |
|
122 | 122 | |
123 | 123 | case "DCMENUSAVE": |
124 | 124 | if ($view == 'QuickCreate') { |
@@ -126,23 +126,23 @@ discard block |
||
126 | 126 | } else if ($view == 'EditView') { |
127 | 127 | $view = "form_DCEditView_{$module}"; |
128 | 128 | } |
129 | - return '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button primary" onclick="this.form.action.value=\'Save\';if(check_form(\''.$view.'\'))return DCMenu.save(this.form.id, \'' . $params['module'] . '_subpanel_save_button\');return false;" type="submit" name="' . $params['module'] . '_dcmenu_save_button" id="' . $params['module'] . '_dcmenu_save_button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">{/if} '; |
|
129 | + return '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button primary" onclick="this.form.action.value=\'Save\';if(check_form(\''.$view.'\'))return DCMenu.save(this.form.id, \''.$params['module'].'_subpanel_save_button\');return false;" type="submit" name="'.$params['module'].'_dcmenu_save_button" id="'.$params['module'].'_dcmenu_save_button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">{/if} '; |
|
130 | 130 | case "DCMENUFULLFORM": |
131 | - $html = '<input title="{$APP.LBL_FULL_FORM_BUTTON_TITLE}" accessKey="{$APP.LBL_FULL_FORM_BUTTON_KEY}" class="button" onclick="disableOnUnloadEditView(this.form); this.form.return_action.value=\'DetailView\'; this.form.action.value=\'EditView\'; this.form.return_module.value=\'' . $params['module'] . '\';this.form.return_id.value=this.form.record.value;if(typeof(this.form.to_pdf)!=\'undefined\') this.form.to_pdf.value=\'0\';SUGAR.ajaxUI.submitForm(this.form,null,true);DCMenu.closeOverlay();" type="button" name="' . $params['module'] . '_subpanel_full_form_button" id="' . $params['module'] . '_subpanel_full_form_button" value="{$APP.LBL_FULL_FORM_BUTTON_LABEL}"> '; |
|
131 | + $html = '<input title="{$APP.LBL_FULL_FORM_BUTTON_TITLE}" accessKey="{$APP.LBL_FULL_FORM_BUTTON_KEY}" class="button" onclick="disableOnUnloadEditView(this.form); this.form.return_action.value=\'DetailView\'; this.form.action.value=\'EditView\'; this.form.return_module.value=\''.$params['module'].'\';this.form.return_id.value=this.form.record.value;if(typeof(this.form.to_pdf)!=\'undefined\') this.form.to_pdf.value=\'0\';SUGAR.ajaxUI.submitForm(this.form,null,true);DCMenu.closeOverlay();" type="button" name="'.$params['module'].'_subpanel_full_form_button" id="'.$params['module'].'_subpanel_full_form_button" value="{$APP.LBL_FULL_FORM_BUTTON_LABEL}"> '; |
|
132 | 132 | $html .= '<input type="hidden" name="full_form" value="full_form">'; |
133 | 133 | return $html; |
134 | 134 | case "POPUPSAVE": |
135 | 135 | $view = $view == 'QuickCreate' ? "form_QuickCreate_{$module}" : $view; |
136 | 136 | return '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" ' |
137 | 137 | . 'class="button primary" onclick="this.form.action.value=\'Popup\';' |
138 | - . 'return check_form(\''.$view.'\')" type="submit" name="' . $params['module'] |
|
139 | - . '_popupcreate_save_button" id="' . $params['module'] |
|
138 | + . 'return check_form(\''.$view.'\')" type="submit" name="'.$params['module'] |
|
139 | + . '_popupcreate_save_button" id="'.$params['module'] |
|
140 | 140 | . '_popupcreate_save_button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">{/if} '; |
141 | 141 | case "POPUPCANCEL": |
142 | 142 | return '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" ' |
143 | 143 | . 'class="button" onclick="toggleDisplay(\'addform\');return false;" ' |
144 | - . 'name="' . $params['module'] . '_popup_cancel_button" type="submit"' |
|
145 | - . 'id="' . $params['module'] . '_popup_cancel_button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}"> '; |
|
144 | + . 'name="'.$params['module'].'_popup_cancel_button" type="submit"' |
|
145 | + . 'id="'.$params['module'].'_popup_cancel_button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}"> '; |
|
146 | 146 | |
147 | 147 | case "AUDIT": |
148 | 148 | $popup_request_data = array( |
@@ -154,14 +154,14 @@ discard block |
||
154 | 154 | |
155 | 155 | require_once('include/SugarFields/Parsers/MetaParser.php'); |
156 | 156 | $encoded_popup_request_data = MetaParser::parseDelimiters($json->encode($popup_request_data)); |
157 | - $audit_link = '<a id="btn_view_change_log" title="{$APP.LNK_VIEW_CHANGE_LOG}" onclick=\'open_popup("Audit", "600", "400", "&record={$fields.id.value}&module_name=' . $params['module'] . '", true, false, ' . $encoded_popup_request_data . '); return false;\'>{$APP.LNK_VIEW_CHANGE_LOG}</a>'; |
|
157 | + $audit_link = '<a id="btn_view_change_log" title="{$APP.LNK_VIEW_CHANGE_LOG}" onclick=\'open_popup("Audit", "600", "400", "&record={$fields.id.value}&module_name='.$params['module'].'", true, false, '.$encoded_popup_request_data.'); return false;\'>{$APP.LNK_VIEW_CHANGE_LOG}</a>'; |
|
158 | 158 | $view = '{if $bean->aclAccess("detail")}{if !empty($fields.id.value) && $isAuditEnabled}'.$audit_link.'{/if}{/if}'; |
159 | 159 | return $view; |
160 | 160 | |
161 | 161 | |
162 | 162 | } //switch |
163 | 163 | |
164 | - } else if(is_array($type) && isset($type['customCode'])) { |
|
164 | + } else if (is_array($type) && isset($type['customCode'])) { |
|
165 | 165 | return $type['customCode']; |
166 | 166 | } |
167 | 167 |
@@ -1,5 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
3 | + die('Not A Valid Entry Point'); |
|
4 | +} |
|
3 | 5 | /********************************************************************************* |
4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -109,7 +111,9 @@ discard block |
||
109 | 111 | break; |
110 | 112 | |
111 | 113 | case "SUBPANELSAVE": |
112 | - if($view == 'QuickCreate' || (isset($_REQUEST['target_action']) && strtolower($_REQUEST['target_action'])) == 'quickcreate') $view = "form_SubpanelQuickCreate_{$module}"; |
|
114 | + if($view == 'QuickCreate' || (isset($_REQUEST['target_action']) && strtolower($_REQUEST['target_action'])) == 'quickcreate') { |
|
115 | + $view = "form_SubpanelQuickCreate_{$module}"; |
|
116 | + } |
|
113 | 117 | return '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button" onclick="disableOnUnloadEditView();this.form.action.value=\'Save\';if(check_form(\''.$view.'\'))return SUGAR.subpanelUtils.inlineSave(this.form.id, \'' . $params['module'] . '_subpanel_save_button\');return false;" type="submit" name="' . $params['module'] . '_subpanel_save_button" id="' . $params['module'] . '_subpanel_save_button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">{/if} '; |
114 | 118 | case "SUBPANELCANCEL": |
115 | 119 | return '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="return SUGAR.subpanelUtils.cancelCreate($(this).attr(\'id\'));return false;" type="submit" name="' . $params['module'] . '_subpanel_cancel_button" id="' . $params['module'] . '_subpanel_cancel_button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}"> '; |