@@ -2,6 +2,6 @@ |
||
2 | 2 | //implements Smarty 3 style {nocache}{/nocache} block to prevent caching of a section of a template. |
3 | 3 | //remove this upon upgrade to Smarty 3 |
4 | 4 | function smarty_block_nocache($param, $content, &$smarty) { |
5 | - return $content; |
|
5 | + return $content; |
|
6 | 6 | } |
7 | 7 | ?> |
8 | 8 | \ No newline at end of file |
@@ -53,28 +53,28 @@ |
||
53 | 53 | |
54 | 54 | function smarty_function_sugar_getimage($params, &$smarty) { |
55 | 55 | |
56 | - // error checking for required parameters |
|
57 | - if(!isset($params['name'])) |
|
58 | - $smarty->trigger_error($GLOBALS['app_strings']['ERR_MISSING_REQUIRED_FIELDS'] . 'name'); |
|
56 | + // error checking for required parameters |
|
57 | + if(!isset($params['name'])) |
|
58 | + $smarty->trigger_error($GLOBALS['app_strings']['ERR_MISSING_REQUIRED_FIELDS'] . 'name'); |
|
59 | 59 | |
60 | - // temp hack to deprecate the use of other_attributes |
|
61 | - if(isset($params['other_attributes'])) |
|
62 | - $params['attr'] = $params['other_attributes']; |
|
60 | + // temp hack to deprecate the use of other_attributes |
|
61 | + if(isset($params['other_attributes'])) |
|
62 | + $params['attr'] = $params['other_attributes']; |
|
63 | 63 | |
64 | - // set defaults |
|
65 | - if(!isset($params['attr'])) |
|
66 | - $params['attr'] = ''; |
|
67 | - if(!isset($params['width'])) |
|
68 | - $params['width'] = null; |
|
69 | - if(!isset($params['height'])) |
|
70 | - $params['height'] = null; |
|
71 | - if(!isset($params['alt'])) |
|
72 | - $params['alt'] = ''; |
|
64 | + // set defaults |
|
65 | + if(!isset($params['attr'])) |
|
66 | + $params['attr'] = ''; |
|
67 | + if(!isset($params['width'])) |
|
68 | + $params['width'] = null; |
|
69 | + if(!isset($params['height'])) |
|
70 | + $params['height'] = null; |
|
71 | + if(!isset($params['alt'])) |
|
72 | + $params['alt'] = ''; |
|
73 | 73 | |
74 | - // deprecated ? |
|
75 | - if(!isset($params['ext'])) |
|
76 | - $params['ext'] = null; |
|
74 | + // deprecated ? |
|
75 | + if(!isset($params['ext'])) |
|
76 | + $params['ext'] = null; |
|
77 | 77 | |
78 | - return SugarThemeRegistry::current()->getImage($params['name'], $params['attr'], $params['width'], $params['height'], $params['ext'], $params['alt']); |
|
78 | + return SugarThemeRegistry::current()->getImage($params['name'], $params['attr'], $params['width'], $params['height'], $params['ext'], $params['alt']); |
|
79 | 79 | } |
80 | 80 | ?> |
@@ -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 |
@@ -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 |
@@ -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 |
@@ -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; |
@@ -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 |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | |
181 | 181 | $field_separator_count = -1; |
182 | 182 | if ($display_months) { |
183 | - $field_separator_count++; |
|
183 | + $field_separator_count++; |
|
184 | 184 | $month_names = array(); |
185 | 185 | $month_values = array(); |
186 | 186 | if(isset($month_empty)) { |
@@ -213,12 +213,12 @@ discard block |
||
213 | 213 | 'values' => $month_values, |
214 | 214 | 'selected' => (int)$time[1] ? strftime($month_value_format, mktime(0, 0, 0, (int)$time[1], 1, 2000)) : '', |
215 | 215 | 'print_result' => false), |
216 | - $smarty); |
|
216 | + $smarty); |
|
217 | 217 | $month_result .= '</select>'; |
218 | 218 | } |
219 | 219 | |
220 | 220 | if ($display_days) { |
221 | - $field_separator_count++; |
|
221 | + $field_separator_count++; |
|
222 | 222 | $days = array(); |
223 | 223 | if (isset($day_empty)) { |
224 | 224 | $days[''] = $day_empty; |
@@ -246,15 +246,15 @@ discard block |
||
246 | 246 | } |
247 | 247 | $day_result .= $extra_attrs . '>'."\n"; |
248 | 248 | $day_result .= smarty_function_html_options(array('output' => $days, |
249 | - 'values' => $day_values, |
|
250 | - 'selected' => $time[2], |
|
251 | - 'print_result' => false), |
|
249 | + 'values' => $day_values, |
|
250 | + 'selected' => $time[2], |
|
251 | + 'print_result' => false), |
|
252 | 252 | $smarty); |
253 | 253 | $day_result .= '</select>'; |
254 | 254 | } |
255 | 255 | |
256 | 256 | if ($display_years) { |
257 | - $field_separator_count++; |
|
257 | + $field_separator_count++; |
|
258 | 258 | if (null !== $field_array){ |
259 | 259 | $year_name = $field_array . '[' . $prefix . 'Year]'; |
260 | 260 | } else { |
@@ -293,10 +293,10 @@ discard block |
||
293 | 293 | } |
294 | 294 | $year_result .= $extra_attrs . '>'."\n"; |
295 | 295 | $year_result .= smarty_function_html_options(array('output' => $years, |
296 | - 'values' => $yearvals, |
|
297 | - 'selected' => $time[0], |
|
298 | - 'print_result' => false), |
|
299 | - $smarty); |
|
296 | + 'values' => $yearvals, |
|
297 | + 'selected' => $time[0], |
|
298 | + 'print_result' => false), |
|
299 | + $smarty); |
|
300 | 300 | $year_result .= '</select>'; |
301 | 301 | } |
302 | 302 | } |
@@ -25,7 +25,7 @@ |
||
25 | 25 | * @return string |
26 | 26 | */ |
27 | 27 | function smarty_modifier_truncate($string, $length = 80, $etc = '...', |
28 | - $break_words = false, $middle = false) |
|
28 | + $break_words = false, $middle = false) |
|
29 | 29 | { |
30 | 30 | if ($length == 0) |
31 | 31 | return ''; |