2 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 /*********************************************************************************
4 * SugarCRM is a customer relationship management program developed by
5 * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
7 * This program is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU Affero General Public License version 3 as published by the
9 * Free Software Foundation with the addition of the following permission added
10 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
11 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
12 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
19 * You should have received a copy of the GNU Affero General Public License along with
20 * this program; if not, see http://www.gnu.org/licenses or write to the Free
21 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
25 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
27 * The interactive user interfaces in modified source and object code versions
28 * of this program must display Appropriate Legal Notices, as required under
29 * Section 5 of the GNU Affero General Public License version 3.
31 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
32 * these Appropriate Legal Notices must retain the display of the "Powered by
33 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
34 * technical reasons, the Appropriate Legal Notices must display the words
35 * "Powered by SugarCRM".
36 ********************************************************************************/
38 /*********************************************************************************
40 * Description: TODO: To be written.
41 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
42 * All Rights Reserved.
43 * Contributor(s): ______________________________________..
44 ********************************************************************************/
48 require_once('modules/EmailMarketing/Forms.php');
51 global $app_list_strings;
55 // Unimplemented until jscalendar language files are fixed
56 // global $current_language;
57 // global $default_language;
60 $focus = new EmailMarketing();
62 if(isset($_REQUEST['record'])) {
63 $focus->retrieve($_REQUEST['record']);
70 $GLOBALS['log']->info("EmailMarketing Edit View");
71 //echo get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_MODULE_NAME'].": ".$focus->name, true);
73 $xtpl=new XTemplate ('modules/EmailMarketing/DetailView.html');
75 $xtpl->assign("MOD", $mod_strings);
76 $xtpl->assign("APP", $app_strings);
78 if (isset($_REQUEST['return_module'])) {
79 $xtpl->assign("RETURN_MODULE", $_REQUEST['return_module']);
81 $xtpl->assign("RETURN_MODULE", 'Campaigns');
83 if (isset($_REQUEST['return_action'])) {
84 $xtpl->assign("RETURN_ACTION", $_REQUEST['return_action']);
86 $xtpl->assign("RETURN_ACTION", 'DetailView');
88 if (isset($_REQUEST['return_id'])) {
89 $xtpl->assign("RETURN_ID", $_REQUEST['return_id']);
91 if (!empty($focus->campaign_id)) {
92 $xtpl->assign("RETURN_ID", $focus->campaign_id);
97 if($focus->campaign_id) {
98 $campaign_id=$focus->campaign_id;
101 $campaign_id=$_REQUEST['campaign_id'];
103 $xtpl->assign("CAMPAIGN_ID", $campaign_id);
106 $xtpl->assign("PRINT_URL", "index.php?".$GLOBALS['request_string']);
107 $xtpl->assign("JAVASCRIPT", get_set_focus_js());
108 $xtpl->assign("DATE_ENTERED", $focus->date_entered);
109 $xtpl->assign("DATE_MODIFIED", $focus->date_modified);
110 $xtpl->assign("ID", $focus->id);
111 $xtpl->assign("NAME", $focus->name);
112 $xtpl->assign("FROM_NAME", $focus->from_name);
113 $xtpl->assign("FROM_ADDR", $focus->from_addr);
114 $xtpl->assign("DATE_START", $focus->date_start);
115 $xtpl->assign("TIME_START", $focus->time_start);
117 $email_templates_arr = get_bean_select_array(true, 'EmailTemplate','name');
118 if($focus->template_id) {
119 $xtpl->assign("EMAIL_TEMPLATE", $email_templates_arr[$focus->template_id]);
122 //include campaign utils..
123 require_once('modules/Campaigns/utils.php');
124 if (empty($_REQUEST['campaign_name'])) {
126 $campaign = new Campaign();
127 $campaign->retrieve($campaign_id);
128 $campaign_name=$campaign->name;
130 $campaign_name=$_REQUEST['campaign_name'];
134 $params[] = "<a href='index.php?module=Campaigns&action=index'>{$mod_strings['LNK_CAMPAIGN_LIST']}</a>";
135 $params[] = "<a href='index.php?module=Campaigns&action=DetailView&record={$campaign_id}'>{$campaign_name}</a>";
136 $params[] = $focus->name;
138 echo getClassicModuleTitle($focus->module_dir, $params, true);
140 if (!empty($focus->all_prospect_lists)) {
141 $xtpl->assign("MESSAGE_FOR", $mod_strings['LBL_ALL_PROSPECT_LISTS']);
143 $xtpl->assign("MESSAGE_FOR", $mod_strings['LBL_RELATED_PROSPECT_LISTS']);
146 if (!empty($focus->status)) {
147 $xtpl->assign("STATUS",$app_list_strings['email_marketing_status_dom'][$focus->status]);
150 $mailboxes=get_campaign_mailboxes($emails);
151 //_ppd($emails[$focus->inbound_email_id]);
152 if (!empty($focus->inbound_email_id) && isset($mailboxes[$focus->inbound_email_id])) {
153 $xtpl->assign("FROM_MAILBOX_NAME", $mailboxes[$focus->inbound_email_id]." <{$emails[$focus->inbound_email_id]}>");
156 $xtpl->parse("main");
160 $javascript = new javascript();
161 $javascript->setFormName('EditView');
162 $javascript->setSugarBean($focus);
163 $javascript->addAllFields('');
164 echo $javascript->getScript();
166 require_once('include/SubPanel/SubPanelTiles.php');
167 $subpanel = new SubPanelTiles($focus, 'EmailMarketing');
169 if ($focus->all_prospect_lists == 1) {
170 $subpanel->subpanel_definitions->exclude_tab('prospectlists');
173 $subpanel->subpanel_definitions->exclude_tab('allprospectlists');
177 echo $subpanel->display();