/** * @see ViewQuickcreate::display() */ public function display() { $userPref = $GLOBALS['current_user']->getPreference('email_link_type'); $defaultPref = $GLOBALS['sugar_config']['email_default_client']; if ($userPref != '') { $client = $userPref; } else { $client = $defaultPref; } if ($client == 'sugar') { $eUi = new EmailUI(); if (!empty($this->bean->id) && !in_array($this->bean->object_name, array('EmailMan'))) { $fullComposeUrl = "index.php?module=Emails&action=Compose&parent_id={$this->bean->id}&parent_type={$this->bean->module_dir}"; $composeData = array('parent_id' => $this->bean->id, 'parent_type' => $this->bean->module_dir); } else { $fullComposeUrl = "index.php?module=Emails&action=Compose"; $composeData = array('parent_id' => '', 'parent_type' => ''); } $j_quickComposeOptions = $eUi->generateComposePackageForQuickCreate($composeData, $fullComposeUrl); $json_obj = getJSONobj(); $opts = $json_obj->decode($j_quickComposeOptions); $opts['menu_id'] = 'dccontent'; $ss = new Sugar_Smarty(); $ss->assign('json_output', $json_obj->encode($opts)); $ss->display('modules/Emails/templates/dceMenuQuickCreate.tpl'); } else { $emailAddress = ''; if (!empty($this->bean->id) && !in_array($this->bean->object_name, array('EmailMan')) && !is_null($this->bean->emailAddress)) { $emailAddress = $this->bean->emailAddress->getPrimaryAddress($this->bean); } echo "<script>document.location.href='mailto:{$emailAddress}';lastLoadedMenu=undefined;DCMenu.closeOverlay();</script>"; die; } }
function display($defines) { global $app_strings, $current_user, $sugar_config, $beanList, $beanFiles; $title = $app_strings['LBL_COMPOSE_EMAIL_BUTTON_TITLE']; //$accesskey = $app_strings['LBL_COMPOSE_EMAIL_BUTTON_KEY']; $value = $app_strings['LBL_COMPOSE_EMAIL_BUTTON_LABEL']; $parent_type = $defines['focus']->module_dir; $parent_id = $defines['focus']->id; //martin Bug 19660 $userPref = $current_user->getPreference('email_link_type'); $defaultPref = $sugar_config['email_default_client']; if ($userPref != '') { $client = $userPref; } else { $client = $defaultPref; } if ($client != 'sugar') { $bean = $defines['focus']; // awu: Not all beans have emailAddress property, we must account for this if (isset($bean->emailAddress)) { $to_addrs = $bean->emailAddress->getPrimaryAddress($bean); $button = "<input class='button' type='button' value='{$value}' id='" . $this->getWidgetId() . "' name='" . preg_replace('[ ]', '', $value) . "' title='{$title}' onclick=\"location.href='mailto:{$to_addrs}';return false;\" />"; } else { $button = "<input class='button' type='button' value='{$value}' id='" . $this->getWidgetId() . "' name='" . preg_replace('[ ]', '', $value) . "' title='{$title}' onclick=\"location.href='mailto:';return false;\" />"; } } else { //Generate the compose package for the quick create options. $composeData = array("parent_id" => $parent_id, "parent_type" => $parent_type); require_once 'modules/Emails/EmailUI.php'; $eUi = new EmailUI(); $j_quickComposeOptions = $eUi->generateComposePackageForQuickCreate($composeData, http_build_query($composeData), false, $defines['focus']); $button = "<input title='{$title}' id='" . $this->getWidgetId() . "' onclick='SUGAR.quickCompose.init({$j_quickComposeOptions});' class='button' type='submit' name='" . preg_replace('[ ]', '', $value) . "_button' value='{$value}' />"; } return $button; }
function displayList(&$layout_def) { global $current_user; global $beanList; global $focus; global $sugar_config; global $locale; if (isset($layout_def['varname'])) { $key = strtoupper($layout_def['varname']); } else { $key = $this->_get_column_alias($layout_def); $key = strtoupper($key); } $value = $layout_def['fields'][$key]; if (isset($_REQUEST['action'])) { $action = $_REQUEST['action']; } else { $action = ''; } if (isset($_REQUEST['module'])) { $module = $_REQUEST['module']; } else { $module = ''; } if (isset($_REQUEST['record'])) { $record = $_REQUEST['record']; } else { $record = ''; } if (!empty($focus->name)) { $name = $focus->name; } else { if (!empty($focus->first_name) && !empty($focus->last_name)) { $name = $locale->formatName($focus); } if (empty($name)) { $name = '*'; } } $userPref = $current_user->getPreference('email_link_type'); $defaultPref = $sugar_config['email_default_client']; if ($userPref != '') { $client = $userPref; } else { $client = $defaultPref; } if ($client == 'sugar') { $composeData = array('load_id' => $layout_def['fields']['ID'], 'load_module' => $this->layout_manager->defs['module_name'], 'parent_type' => $this->layout_manager->defs['module_name'], 'parent_id' => $layout_def['fields']['ID'], 'return_module' => $module, 'return_action' => $action, 'return_id' => $record); if (isset($layout_def['fields']['FULL_NAME'])) { $composeData['parent_name'] = $layout_def['fields']['FULL_NAME']; $composeData['to_email_addrs'] = sprintf("%s <%s>", $layout_def['fields']['FULL_NAME'], $layout_def['fields']['EMAIL1']); } else { $composeData['to_email_addrs'] = $layout_def['fields']['EMAIL1']; } require_once 'modules/Emails/EmailUI.php'; $eUi = new EmailUI(); $j_quickComposeOptions = $eUi->generateComposePackageForQuickCreate($composeData, http_build_query($composeData), true); $link = "<a href='javascript:void(0);' onclick='SUGAR.quickCompose.init({$j_quickComposeOptions});'>"; } else { $link = '<a href="mailto:' . $value . '" >'; } return $link . $value . '</a>'; }
function display() { global $mod_strings, $app_strings, $app_list_strings, $sugar_config, $current_user; $this->ss->assign("MOD", $mod_strings); $this->ss->assign("APP_LIST", $app_list_strings); // Sync info from tilkee server $this->bean->sync_from_API('update_connexions'); $button_array = $this->dv->defs['templateMeta']['form']['buttons']; $new_button_array = array(); if ($this->bean->archived === 'true') { $new_button_array[] = $button_array[0]; // DELETED } $new_button_array[] = $button_array[1]; // SEND EMAIL $new_button_array[] = $button_array[2]; // COPY URL $new_button_array[] = $button_array[3]; // ARCHIVED/WON $new_button_array[] = $button_array[4]; // ARCHIVED/LOST $new_button_array[] = $button_array[5]; // ARCHIVED $this->dv->defs['templateMeta']['form']['buttons'] = $new_button_array; // BUILD SEND MAIL BUTTON $userPref = $current_user->getPreference('email_link_type'); $defaultPref = $sugar_config['email_default_client']; if ($userPref != '') { $client = $userPref; } else { $client = $defaultPref; } $title_button = $mod_strings['LBL_SEND_MAIL_TITLE']; $value_button = $mod_strings['LBL_SEND_MAIL_VALUE']; $parent_id = ''; $parent_type = ''; $parent_name = ''; $button = ''; // Links to a Contact if ($this->bean->contacts_id != '') { $parent_id = $this->bean->contacts_id; $parent_name = $this->bean->contacts_name; $parent_type = 'Contacts'; } // Links to a Lead if ($this->bean->leads_id != '') { $parent_id = $this->bean->leads_id; $parent_name = $this->bean->leads_name; $parent_type = 'Leads'; } // Build Send mail action depends on user prefs if ($parent_type != '') { if ($client != 'sugar') { if (isset($this->bean->contact_email)) { $to_addrs = $this->bean->contact_email; $button = "<input class='button' type='button' value='{$value_button}' id='' name='' title='{$title_button}' onclick=\"location.href='mailto:{$to_addrs}';return false;\" />"; } else { $button = "<input class='button' type='button' value='{$value_button}' id='' name='' title='{$title_button}' onclick=\"location.href='mailto:';return false;\" />"; } } else { //Generate the compose package for the quick create options. $composeData = array("to_email_addrs" => $this->bean->contact_email, "parent_id" => $parent_id, "parent_type" => $parent_type, "parent_name" => $parent_name); if (!empty($this->bean->tilk_url)) { $composeData['body'] = "<a href='" . $this->bean->tilk_url . "'>" . $this->bean->tilk_url . "</a>"; } require_once 'modules/Emails/EmailUI.php'; $eUi = new EmailUI(); $j_quickComposeOptions = $eUi->generateComposePackageForQuickCreate($composeData, http_build_query($composeData), false); $button = "<input title='{$title_button}' id='' onclick='SUGAR.quickCompose.init({$j_quickComposeOptions});' class='button' type='submit' name='_button' value='{$value_button}' />"; } } $this->ss->assign("SEND_EMAIL_BUTTON", $button); // BUILD COPY TO CLIPBOARD BUTTON $button_copy = "<button id='copy-button' data-clipboard-text='" . $this->bean->tilk_url . "' title='Click to copy me.'>" . $mod_strings['LBL_COPY_VALUE'] . "</button>"; $this->ss->assign("COPY_TILK_URL", $button_copy); parent::display(); }
function displayList(&$layout_def) { global $current_user; global $beanList; global $focus; global $sugar_config; global $locale; global $mod_strings; if (isset($layout_def['varname'])) { $key = strtoupper($layout_def['varname']); } else { $key = $this->_get_column_alias($layout_def); $key = strtoupper($key); } $value = $layout_def['fields'][$key]; if (isset($_REQUEST['action'])) { $action = $_REQUEST['action']; } else { $action = ''; } if (isset($_REQUEST['module'])) { $module = $_REQUEST['module']; } else { $module = ''; } if (isset($_REQUEST['record'])) { $record = $_REQUEST['record']; } else { $record = ''; } if (!empty($focus->name)) { $name = $focus->name; } $userPref = $current_user->getPreference('email_link_type'); $defaultPref = $sugar_config['email_default_client']; if ($userPref != '') { $client = $userPref; } else { $client = $defaultPref; } if ($client == 'sugar') { $composeData = array('load_id' => $layout_def['fields']['ID'], 'load_module' => $this->layout_manager->defs['module_name'], 'return_module' => $module, 'return_action' => $action, 'return_id' => $record); if (!empty($layout_def['fields']['CONTACTS_NAME'])) { $composeData['parent_name'] = $layout_def['fields']['CONTACTS_NAME']; $composeData['parent_id'] = $layout_def['fields']['CONTACTS_ID']; $composeData['parent_type'] = 'Contacts'; } if (!empty($layout_def['fields']['LEADS_NAME'])) { $composeData['parent_name'] = $layout_def['fields']['LEADS_NAME']; $composeData['parent_id'] = $layout_def['fields']['LEADS_ID']; $composeData['parent_type'] = 'Leads'; } $composeData['to_email_addrs'] = $layout_def['fields']['CONTACT_EMAIL']; if (!empty($layout_def['fields']['TILK_URL'])) { $composeData['body'] = "<a href='" . $layout_def['fields']['TILK_URL'] . "'>" . $layout_def['fields']['TILK_URL'] . "</a>"; } require_once 'modules/Emails/EmailUI.php'; $eUi = new EmailUI(); $j_quickComposeOptions = $eUi->generateComposePackageForQuickCreate($composeData, http_build_query($composeData), true); $link = "<a onclick='SUGAR.quickCompose.init({$j_quickComposeOptions});'>"; } else { $link = '<a href="mailto:' . $value . '" >'; } return $link . $mod_strings['LBL_SEND_MAIL_TITLE'] . '</a>'; }