protected function action_getEmailField() { $module = $_REQUEST['aow_module']; $aow_field = $_REQUEST['aow_newfieldname']; if (isset($_REQUEST['view'])) { $view = $_REQUEST['view']; } else { $view = 'EditView'; } if (isset($_REQUEST['aow_value'])) { $value = $_REQUEST['aow_value']; } else { $value = ''; } switch ($_REQUEST['aow_type']) { case 'Record Email': echo ''; break; case 'Related Field': $rel_field_list = getRelatedEmailableFields($module); if ($view == 'EditView') { echo "<select type='text' style='width:178px;' name='{$aow_field}' id='{$aow_field}' title='' tabindex='116'>" . get_select_options_with_id($rel_field_list, $value) . "</select>"; } else { echo $rel_field_list[$value]; } break; case 'Specify User': echo getModuleField('Accounts', 'assigned_user_name', $aow_field, $view, $value); break; case 'Users': echo getAssignField($aow_field, $view, $value); break; case 'Email Address': default: if ($view == 'EditView') { echo "<input type='text' name='{$aow_field}' id='{$aow_field}' size='25' title='' tabindex='116' value='{$value}'>"; } else { echo $value; } break; } die; }
function edit_display($line, SugarBean $bean = null, $params = array()) { global $app_list_strings; $email_templates_arr = get_bean_select_array(true, 'EmailTemplate', 'name'); if (!in_array($bean->module_dir, getEmailableModules())) { unset($app_list_strings['aow_email_type_list']['Record Email']); } $targetOptions = getRelatedEmailableFields($bean->module_dir); if (empty($targetOptions)) { unset($app_list_strings['aow_email_type_list']['Related Field']); } $html = '<input type="hidden" name="aow_email_type_list" id="aow_email_type_list" value="' . get_select_options_with_id($app_list_strings['aow_email_type_list'], '') . '"> <input type="hidden" name="aow_email_to_list" id="aow_email_to_list" value="' . get_select_options_with_id($app_list_strings['aow_email_to_list'], '') . '">'; $checked = ''; if (isset($params['individual_email']) && $params['individual_email']) { $checked = 'CHECKED'; } $html .= "<table border='0' cellpadding='0' cellspacing='0' width='100%'>"; $html .= "<tr>"; $html .= '<td id="relate_label" scope="row" valign="top">' . translate("LBL_INDIVIDUAL_EMAILS", "AOW_Actions") . ':'; $html .= '</td>'; $html .= "<td valign='top' width='37.5%'>"; $html .= "<input type='hidden' name='aow_actions_param[" . $line . "][individual_email]' value='0' >"; $html .= "<input type='checkbox' id='aow_actions_param[" . $line . "][individual_email]' name='aow_actions_param[" . $line . "][individual_email]' value='1' {$checked}></td>"; $html .= '</td>'; if (!isset($params['email_template'])) { $params['email_template'] = ''; } $hidden = "style='visibility: hidden;'"; if ($params['email_template'] != '') { $hidden = ""; } $html .= '<td id="name_label" scope="row" valign="top" width="12.5%">' . translate("LBL_EMAIL_TEMPLATE", "AOW_Actions") . ':<span class="required">*</span></td>'; $html .= "<td valign='top' width='37.5%'>"; $html .= "<select name='aow_actions_param[" . $line . "][email_template]' id='aow_actions_param_email_template" . $line . "' onchange='show_edit_template_link(this," . $line . ");' >" . get_select_options_with_id($email_templates_arr, $params['email_template']) . "</select>"; $html .= " <a href='javascript:open_email_template_form(" . $line . ")' >" . translate('LBL_CREATE_EMAIL_TEMPLATE', 'AOW_Actions') . "</a>"; $html .= " <span name='edit_template' id='aow_actions_edit_template_link" . $line . "' {$hidden}><a href='javascript:edit_email_template_form(" . $line . ")' >" . translate('LBL_EDIT_EMAIL_TEMPLATE', 'AOW_Actions') . "</a></span>"; $html .= "</td>"; $html .= "</tr>"; $html .= "<tr>"; $html .= '<td id="name_label" scope="row" valign="top" width="12.5%">' . translate("LBL_EMAIL", "AOW_Actions") . ':<span class="required">*</span></td>'; $html .= '<td valign="top" scope="row" width="37.5%">'; $html .= '<button type="button" onclick="add_emailLine(' . $line . ')"><img src="' . SugarThemeRegistry::current()->getImageURL('id-ff-add.png') . '"></button>'; $html .= '<table id="emailLine' . $line . '_table" width="100%"></table>'; $html .= '</td>'; $html .= "</tr>"; $html .= "</table>"; $html .= "<script id ='aow_script" . $line . "'>"; //backward compatible if (isset($params['email_target_type']) && !is_array($params['email_target_type'])) { $email = ''; switch ($params['email_target_type']) { case 'Email Address': $email = $params['email']; break; case 'Specify User': $email = $params['email_user_id']; break; case 'Related Field': $email = $params['email_target']; break; } $html .= "load_emailline('" . $line . "','to','" . $params['email_target_type'] . "','" . $email . "');"; } //end backward compatible if (isset($params['email_target_type'])) { foreach ($params['email_target_type'] as $key => $field) { if (is_array($params['email'][$key])) { $params['email'][$key] = json_encode($params['email'][$key]); } $html .= "load_emailline('" . $line . "','" . $params['email_to_type'][$key] . "','" . $params['email_target_type'][$key] . "','" . $params['email'][$key] . "');"; } } $html .= "</script>"; return $html; }