@@ -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}"> '; |
@@ -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 | } |
@@ -37,9 +37,9 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | function smarty_function_html_select_date($params, &$smarty) |
| 39 | 39 | { |
| 40 | - require_once $smarty->_get_plugin_filepath('shared','escape_special_chars'); |
|
| 41 | - require_once $smarty->_get_plugin_filepath('shared','make_timestamp'); |
|
| 42 | - require_once $smarty->_get_plugin_filepath('function','html_options'); |
|
| 40 | + require_once $smarty->_get_plugin_filepath('shared', 'escape_special_chars'); |
|
| 41 | + require_once $smarty->_get_plugin_filepath('shared', 'make_timestamp'); |
|
| 42 | + require_once $smarty->_get_plugin_filepath('function', 'html_options'); |
|
| 43 | 43 | /* Default values. */ |
| 44 | 44 | $prefix = "Date_"; |
| 45 | 45 | $start_year = strftime("%Y"); |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | break; |
| 125 | 125 | |
| 126 | 126 | default: |
| 127 | - if(!is_array($_value)) { |
|
| 127 | + if (!is_array($_value)) { |
|
| 128 | 128 | $extra_attrs .= ' '.$_key.'="'.smarty_function_escape_special_chars($_value).'"'; |
| 129 | 129 | } else { |
| 130 | 130 | $smarty->trigger_error("html_select_date: extra attribute '$_key' cannot be an array", E_USER_NOTICE); |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | // force start year to include given date if not explicitly set |
| 169 | 169 | $start_year = $time[0]; |
| 170 | 170 | } |
| 171 | - if($end_year < $time[0] && !isset($params['end_year'])) { |
|
| 171 | + if ($end_year < $time[0] && !isset($params['end_year'])) { |
|
| 172 | 172 | // force end year to include given date if not explicitly set |
| 173 | 173 | $end_year = $time[0]; |
| 174 | 174 | } |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | $field_separator_count++; |
| 184 | 184 | $month_names = array(); |
| 185 | 185 | $month_values = array(); |
| 186 | - if(isset($month_empty)) { |
|
| 186 | + if (isset($month_empty)) { |
|
| 187 | 187 | $month_names[''] = $month_empty; |
| 188 | 188 | $month_values[''] = ''; |
| 189 | 189 | } |
@@ -193,21 +193,21 @@ discard block |
||
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | $month_result .= '<select name='; |
| 196 | - if (null !== $field_array){ |
|
| 197 | - $month_result .= '"' . $field_array . '[' . $prefix . 'Month]"'; |
|
| 196 | + if (null !== $field_array) { |
|
| 197 | + $month_result .= '"'.$field_array.'['.$prefix.'Month]"'; |
|
| 198 | 198 | } else { |
| 199 | - $month_result .= '"' . $prefix . 'Month"'; |
|
| 199 | + $month_result .= '"'.$prefix.'Month"'; |
|
| 200 | 200 | } |
| 201 | - if (null !== $month_size){ |
|
| 202 | - $month_result .= ' size="' . $month_size . '"'; |
|
| 201 | + if (null !== $month_size) { |
|
| 202 | + $month_result .= ' size="'.$month_size.'"'; |
|
| 203 | 203 | } |
| 204 | - if (null !== $month_extra){ |
|
| 205 | - $month_result .= ' ' . $month_extra; |
|
| 204 | + if (null !== $month_extra) { |
|
| 205 | + $month_result .= ' '.$month_extra; |
|
| 206 | 206 | } |
| 207 | - if (null !== $all_extra){ |
|
| 208 | - $month_result .= ' ' . $all_extra; |
|
| 207 | + if (null !== $all_extra) { |
|
| 208 | + $month_result .= ' '.$all_extra; |
|
| 209 | 209 | } |
| 210 | - $month_result .= $extra_attrs . '>'."\n"; |
|
| 210 | + $month_result .= $extra_attrs.'>'."\n"; |
|
| 211 | 211 | |
| 212 | 212 | $month_result .= smarty_function_html_options(array('output' => $month_names, |
| 213 | 213 | 'values' => $month_values, |
@@ -230,21 +230,21 @@ discard block |
||
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | $day_result .= '<select name='; |
| 233 | - if (null !== $field_array){ |
|
| 234 | - $day_result .= '"' . $field_array . '[' . $prefix . 'Day]"'; |
|
| 233 | + if (null !== $field_array) { |
|
| 234 | + $day_result .= '"'.$field_array.'['.$prefix.'Day]"'; |
|
| 235 | 235 | } else { |
| 236 | - $day_result .= '"' . $prefix . 'Day"'; |
|
| 236 | + $day_result .= '"'.$prefix.'Day"'; |
|
| 237 | 237 | } |
| 238 | - if (null !== $day_size){ |
|
| 239 | - $day_result .= ' size="' . $day_size . '"'; |
|
| 238 | + if (null !== $day_size) { |
|
| 239 | + $day_result .= ' size="'.$day_size.'"'; |
|
| 240 | 240 | } |
| 241 | - if (null !== $all_extra){ |
|
| 242 | - $day_result .= ' ' . $all_extra; |
|
| 241 | + if (null !== $all_extra) { |
|
| 242 | + $day_result .= ' '.$all_extra; |
|
| 243 | 243 | } |
| 244 | - if (null !== $day_extra){ |
|
| 245 | - $day_result .= ' ' . $day_extra; |
|
| 244 | + if (null !== $day_extra) { |
|
| 245 | + $day_result .= ' '.$day_extra; |
|
| 246 | 246 | } |
| 247 | - $day_result .= $extra_attrs . '>'."\n"; |
|
| 247 | + $day_result .= $extra_attrs.'>'."\n"; |
|
| 248 | 248 | $day_result .= smarty_function_html_options(array('output' => $days, |
| 249 | 249 | 'values' => $day_values, |
| 250 | 250 | 'selected' => $time[2], |
@@ -255,18 +255,18 @@ discard block |
||
| 255 | 255 | |
| 256 | 256 | if ($display_years) { |
| 257 | 257 | $field_separator_count++; |
| 258 | - if (null !== $field_array){ |
|
| 259 | - $year_name = $field_array . '[' . $prefix . 'Year]'; |
|
| 258 | + if (null !== $field_array) { |
|
| 259 | + $year_name = $field_array.'['.$prefix.'Year]'; |
|
| 260 | 260 | } else { |
| 261 | - $year_name = $prefix . 'Year'; |
|
| 261 | + $year_name = $prefix.'Year'; |
|
| 262 | 262 | } |
| 263 | 263 | if ($year_as_text) { |
| 264 | - $year_result .= '<input type="text" name="' . $year_name . '" value="' . $time[0] . '" size="4" maxlength="4"'; |
|
| 265 | - if (null !== $all_extra){ |
|
| 266 | - $year_result .= ' ' . $all_extra; |
|
| 264 | + $year_result .= '<input type="text" name="'.$year_name.'" value="'.$time[0].'" size="4" maxlength="4"'; |
|
| 265 | + if (null !== $all_extra) { |
|
| 266 | + $year_result .= ' '.$all_extra; |
|
| 267 | 267 | } |
| 268 | - if (null !== $year_extra){ |
|
| 269 | - $year_result .= ' ' . $year_extra; |
|
| 268 | + if (null !== $year_extra) { |
|
| 269 | + $year_result .= ' '.$year_extra; |
|
| 270 | 270 | } |
| 271 | 271 | $year_result .= ' />'; |
| 272 | 272 | } else { |
@@ -277,21 +277,21 @@ discard block |
||
| 277 | 277 | sort($years, SORT_NUMERIC); |
| 278 | 278 | } |
| 279 | 279 | $yearvals = $years; |
| 280 | - if(isset($year_empty)) { |
|
| 280 | + if (isset($year_empty)) { |
|
| 281 | 281 | array_unshift($years, $year_empty); |
| 282 | 282 | array_unshift($yearvals, ''); |
| 283 | 283 | } |
| 284 | - $year_result .= '<select name="' . $year_name . '"'; |
|
| 285 | - if (null !== $year_size){ |
|
| 286 | - $year_result .= ' size="' . $year_size . '"'; |
|
| 284 | + $year_result .= '<select name="'.$year_name.'"'; |
|
| 285 | + if (null !== $year_size) { |
|
| 286 | + $year_result .= ' size="'.$year_size.'"'; |
|
| 287 | 287 | } |
| 288 | - if (null !== $all_extra){ |
|
| 289 | - $year_result .= ' ' . $all_extra; |
|
| 288 | + if (null !== $all_extra) { |
|
| 289 | + $year_result .= ' '.$all_extra; |
|
| 290 | 290 | } |
| 291 | - if (null !== $year_extra){ |
|
| 292 | - $year_result .= ' ' . $year_extra; |
|
| 291 | + if (null !== $year_extra) { |
|
| 292 | + $year_result .= ' '.$year_extra; |
|
| 293 | 293 | } |
| 294 | - $year_result .= $extra_attrs . '>'."\n"; |
|
| 294 | + $year_result .= $extra_attrs.'>'."\n"; |
|
| 295 | 295 | $year_result .= smarty_function_html_options(array('output' => $years, |
| 296 | 296 | 'values' => $yearvals, |
| 297 | 297 | 'selected' => $time[0], |
@@ -302,9 +302,9 @@ discard block |
||
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | // Loop thru the field_order field |
| 305 | - for ($i = 0; $i <= 2; $i++){ |
|
| 305 | + for ($i = 0; $i <= 2; $i++) { |
|
| 306 | 306 | $c = substr($field_order, $i, 1); |
| 307 | - switch ($c){ |
|
| 307 | + switch ($c) { |
|
| 308 | 308 | case 'D': |
| 309 | 309 | $html_result .= $day_result; |
| 310 | 310 | break; |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | break; |
| 319 | 319 | } |
| 320 | 320 | // Add the field seperator |
| 321 | - if($i < $field_separator_count) { |
|
| 321 | + if ($i < $field_separator_count) { |
|
| 322 | 322 | $html_result .= $field_separator; |
| 323 | 323 | } |
| 324 | 324 | } |
@@ -28,12 +28,12 @@ |
||
| 28 | 28 | { |
| 29 | 29 | static $_uc_digits = false; |
| 30 | 30 | |
| 31 | - if(isset($uc_digits)) { |
|
| 31 | + if (isset($uc_digits)) { |
|
| 32 | 32 | $_uc_digits = $uc_digits; |
| 33 | 33 | return; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - if(substr($string[0],0,1) != "'" && !preg_match("!\d!",$string[0]) || $_uc_digits) |
|
| 36 | + if (substr($string[0], 0, 1) != "'" && !preg_match("!\d!", $string[0]) || $_uc_digits) |
|
| 37 | 37 | return ucfirst($string[0]); |
| 38 | 38 | else |
| 39 | 39 | return $string[0]; |
@@ -33,11 +33,12 @@ |
||
| 33 | 33 | return; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - if(substr($string[0],0,1) != "'" && !preg_match("!\d!",$string[0]) || $_uc_digits) |
|
| 37 | - return ucfirst($string[0]); |
|
| 38 | - else |
|
| 39 | - return $string[0]; |
|
| 40 | -} |
|
| 36 | + if(substr($string[0],0,1) != "'" && !preg_match("!\d!",$string[0]) || $_uc_digits) { |
|
| 37 | + return ucfirst($string[0]); |
|
| 38 | + } else { |
|
| 39 | + return $string[0]; |
|
| 40 | + } |
|
| 41 | + } |
|
| 41 | 42 | |
| 42 | 43 | |
| 43 | 44 | ?> |
@@ -24,6 +24,9 @@ |
||
| 24 | 24 | return preg_replace_callback('!\'?\b\w(\w|\')*\b!', 'smarty_modifier_capitalize_ucfirst', $string); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | +/** |
|
| 28 | + * @param boolean $uc_digits |
|
| 29 | + */ |
|
| 27 | 30 | function smarty_modifier_capitalize_ucfirst($string, $uc_digits = null) |
| 28 | 31 | { |
| 29 | 32 | static $_uc_digits = false; |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | 'count'=>1 |
| 33 | 33 | ); |
| 34 | 34 | } |
| 35 | - $counter =& $counters[$name]; |
|
| 35 | + $counter = & $counters[$name]; |
|
| 36 | 36 | |
| 37 | 37 | if (isset($params['start'])) { |
| 38 | 38 | $counter['start'] = $counter['count'] = (int)$params['start']; |
@@ -66,10 +66,11 @@ |
||
| 66 | 66 | $counter['direction'] = $params['direction']; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - if ($counter['direction'] == "down") |
|
| 70 | - $counter['count'] -= $counter['skip']; |
|
| 71 | - else |
|
| 72 | - $counter['count'] += $counter['skip']; |
|
| 69 | + if ($counter['direction'] == "down") { |
|
| 70 | + $counter['count'] -= $counter['skip']; |
|
| 71 | + } else { |
|
| 72 | + $counter['count'] += $counter['skip']; |
|
| 73 | + } |
|
| 73 | 74 | |
| 74 | 75 | return $retval; |
| 75 | 76 | |
@@ -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 ''; |
@@ -33,12 +33,12 @@ |
||
| 33 | 33 | if (strlen($string) > $length) { |
| 34 | 34 | $length -= min($length, strlen($etc)); |
| 35 | 35 | if (!$break_words && !$middle) { |
| 36 | - $string = preg_replace('/\s+?(\S+)?$/', '', substr($string, 0, $length+1)); |
|
| 36 | + $string = preg_replace('/\s+?(\S+)?$/', '', substr($string, 0, $length + 1)); |
|
| 37 | 37 | } |
| 38 | - if(!$middle) { |
|
| 39 | - return substr($string, 0, $length) . $etc; |
|
| 38 | + if (!$middle) { |
|
| 39 | + return substr($string, 0, $length).$etc; |
|
| 40 | 40 | } else { |
| 41 | - return substr($string, 0, $length/2) . $etc . substr($string, -$length/2); |
|
| 41 | + return substr($string, 0, $length / 2).$etc.substr($string, -$length / 2); |
|
| 42 | 42 | } |
| 43 | 43 | } else { |
| 44 | 44 | return $string; |
@@ -27,8 +27,9 @@ |
||
| 27 | 27 | function smarty_modifier_truncate($string, $length = 80, $etc = '...', |
| 28 | 28 | $break_words = false, $middle = false) |
| 29 | 29 | { |
| 30 | - if ($length == 0) |
|
| 31 | - return ''; |
|
| 30 | + if ($length == 0) { |
|
| 31 | + return ''; |
|
| 32 | + } |
|
| 32 | 33 | |
| 33 | 34 | if (strlen($string) > $length) { |
| 34 | 35 | $length -= min($length, strlen($etc)); |
@@ -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. |
@@ -94,20 +94,20 @@ discard block |
||
| 94 | 94 | $root_options = array( |
| 95 | 95 | "id" => array_key_exists('id', $params) ? $params['id'] : "" |
| 96 | 96 | ); |
| 97 | - if(array_key_exists('htmlOptions', $params)) { |
|
| 98 | - foreach($params['htmlOptions'] as $attr => $value) { |
|
| 97 | + if (array_key_exists('htmlOptions', $params)) { |
|
| 98 | + foreach ($params['htmlOptions'] as $attr => $value) { |
|
| 99 | 99 | $root_options[$attr] = $value; |
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | $output = SugarHtml::createOpenTag("ul", $root_options); |
| 103 | - foreach($params['items'] as $item) { |
|
| 104 | - if(strpos($item['html'], "</") === 0) { |
|
| 103 | + foreach ($params['items'] as $item) { |
|
| 104 | + if (strpos($item['html'], "</") === 0) { |
|
| 105 | 105 | $output .= $item['html']; |
| 106 | 106 | continue; |
| 107 | 107 | } |
| 108 | 108 | $output .= SugarHtml::createOpenTag('li', !empty($params['itemOptions']) ? $params['itemOptions'] : array()) |
| 109 | 109 | .$item['html']; |
| 110 | - if(isset($item['items']) && count($item['items'])) { |
|
| 110 | + if (isset($item['items']) && count($item['items'])) { |
|
| 111 | 111 | $output .= smarty_function_sugar_menu(array( |
| 112 | 112 | 'items' => $item['items'], |
| 113 | 113 | 'htmlOptions' => !empty($params['submenuHtmlOptions']) ? $params['submenuHtmlOptions'] : (!empty($item['submenuHtmlOptions']) ? $item['submenuHtmlOptions'] : array()) |
@@ -1,5 +1,7 @@ |
||
| 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. |
@@ -20,9 +20,9 @@ |
||
| 20 | 20 | * @param string |
| 21 | 21 | * @return string |
| 22 | 22 | */ |
| 23 | -function smarty_modifier_indent($string,$chars=4,$char=" ") |
|
| 23 | +function smarty_modifier_indent($string, $chars = 4, $char = " ") |
|
| 24 | 24 | { |
| 25 | - return preg_replace('!^!m',str_repeat($char,$chars),$string); |
|
| 25 | + return preg_replace('!^!m', str_repeat($char, $chars), $string); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | ?> |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | */ |
| 26 | 26 | function smarty_modifier_cat($string, $cat) |
| 27 | 27 | { |
| 28 | - return $string . $cat; |
|
| 28 | + return $string.$cat; |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /* vim: set expandtab: */ |