/** * Generate the composePackage for the quick compose email UI. The package contains * key/value pairs generated by the Compose.php file which are then set into the * quick compose email UI (eg. to addr, parent id, parent type, etc) * * @param Array $composeData Associative array read and processed by generateComposeDataPackage. * @param String $fullLinkUrl A link that contains all pertinant information so the user can be * directed to the full compose screen if needed * @param SugarBean $bean Optional - the parent object bean with data * @return JSON Object containg composePackage and fullLinkUrl */ function generateComposePackageForQuickCreate($composeData, $fullLinkUrl, $lazyLoad = false, $bean = null) { $_REQUEST['forQuickCreate'] = true; if (!$lazyLoad) { require_once 'modules/Emails/Compose.php'; $composePackage = generateComposeDataPackage($composeData, FALSE, $bean); } else { $composePackage = $composeData; } // JSON object is passed into the function defined within the a href onclick event // which is delimeted by '. Need to escape all single quotes and &, <, > // but not double quotes since json would escape them foreach ($composePackage as $key => $singleCompose) { if (is_string($singleCompose)) { $composePackage[$key] = str_replace(" ", " ", from_html($singleCompose)); } } $quickComposeOptions = array('fullComposeUrl' => $fullLinkUrl, 'composePackage' => $composePackage); $j_quickComposeOptions = JSON::encode($quickComposeOptions, false, true); return $j_quickComposeOptions; }
public function testComposeFromMethodCallForContact() { $_REQUEST['forQuickCreate'] = true; require_once 'modules/Emails/Compose.php'; $data = array(); $data['parent_type'] = 'Contacts'; $data['parent_id'] = $this->c->id; $compose_data = generateComposeDataPackage($data, FALSE); $this->assertEquals('Contacts', $compose_data['parent_type']); $this->assertEquals($this->c->id, $compose_data['parent_id']); $this->assertEquals($this->c->name, $compose_data['parent_name']); }
* "Powered by SugarCRM". ********************************************************************************/ /********************************************************************************* * Description: TODO: To be written. * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. * All Rights Reserved. * Contributor(s): ______________________________________.. ********************************************************************************/ //Shorten name. $data = $_REQUEST; if (!empty($data['listViewExternalClient'])) { $email = new Email(); echo $email->getNamePlusEmailAddressesForCompose($_REQUEST['action_module'], explode(",", $_REQUEST['uid'])); } else { if (!isset($data['forQuickCreate'])) { $ret = generateComposeDataPackage($data); } } /** * Initialize the full compose window by creating the compose package * and then including Emails index.php file. * * @param Array $ret */ function initFullCompose($ret) { global $current_user; $json = getJSONobj(); $composeOut = $json->encode($ret); //For listview 'Email' call initiated by subpanels, just returned the composePackage data, do not //include the entire Emails page
/** * Generate the composePackage for the quick compose email UI. The package contains * key/value pairs generated by the Compose.php file which are then set into the * quick compose email UI (eg. to addr, parent id, parent type, etc) * * @param Array $composeData Associative array read and processed by generateComposeDataPackage. * @param String $fullLinkUrl A link that contains all pertinant information so the user can be * directed to the full compose screen if needed * @return JSON Object containg composePackage and fullLinkUrl */ function generateComposePackageForQuickCreate($composeData, $fullLinkUrl) { $_REQUEST['forQuickCreate'] = true; require_once 'modules/Emails/Compose.php'; $composePackage = generateComposeDataPackage($composeData, FALSE); //JSON object is passed into the function defined within the a href onclick event //which is delimeted by '. Need to escape all single quotes, every other char is valid. foreach ($composePackage as $key => $singleCompose) { if (is_string($singleCompose)) { $composePackage[$key] = str_replace("'", "'", $singleCompose); } } $quickComposeOptions = array('fullComposeUrl' => $fullLinkUrl, 'composePackage' => $composePackage); $j_quickComposeOptions = json_encode($quickComposeOptions); return $j_quickComposeOptions; }