2 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 /*********************************************************************************
4 * SugarCRM Community Edition is a customer relationship management program developed by
5 * SugarCRM, Inc. Copyright (C) 2004-2012 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");
72 $xtpl=new XTemplate ('modules/EmailMarketing/DetailView.html');
74 $xtpl->assign("MOD", $mod_strings);
75 $xtpl->assign("APP", $app_strings);
77 if (isset($_REQUEST['return_module'])) {
78 $xtpl->assign("RETURN_MODULE", $_REQUEST['return_module']);
80 $xtpl->assign("RETURN_MODULE", 'Campaigns');
82 if (isset($_REQUEST['return_action'])) {
83 $xtpl->assign("RETURN_ACTION", $_REQUEST['return_action']);
85 $xtpl->assign("RETURN_ACTION", 'DetailView');
87 if (isset($_REQUEST['return_id'])) {
88 $xtpl->assign("RETURN_ID", $_REQUEST['return_id']);
90 if (!empty($focus->campaign_id)) {
91 $xtpl->assign("RETURN_ID", $focus->campaign_id);
96 if($focus->campaign_id) {
97 $campaign_id=$focus->campaign_id;
100 $campaign_id=$_REQUEST['campaign_id'];
102 $xtpl->assign("CAMPAIGN_ID", $campaign_id);
105 $xtpl->assign("PRINT_URL", "index.php?".$GLOBALS['request_string']);
106 $xtpl->assign("JAVASCRIPT", get_set_focus_js());
107 $xtpl->assign("DATE_ENTERED", $focus->date_entered);
108 $xtpl->assign("DATE_MODIFIED", $focus->date_modified);
109 $xtpl->assign("ID", $focus->id);
110 $xtpl->assign("NAME", $focus->name);
111 $xtpl->assign("FROM_NAME", $focus->from_name);
112 $xtpl->assign("FROM_ADDR", $focus->from_addr);
113 $xtpl->assign("DATE_START", $focus->date_start);
114 $xtpl->assign("TIME_START", $focus->time_start);
116 $email_templates_arr = get_bean_select_array(true, 'EmailTemplate','name');
117 if($focus->template_id) {
118 $xtpl->assign("EMAIL_TEMPLATE", $email_templates_arr[$focus->template_id]);
121 //include campaign utils..
122 require_once('modules/Campaigns/utils.php');
123 if (empty($_REQUEST['campaign_name'])) {
125 $campaign = new Campaign();
126 $campaign->retrieve($campaign_id);
127 $campaign_name=$campaign->name;
129 $campaign_name=$_REQUEST['campaign_name'];
133 $params[] = "<a href='index.php?module=Campaigns&action=index'>{$mod_strings['LNK_CAMPAIGN_LIST']}</a>";
134 $params[] = "<a href='index.php?module=Campaigns&action=DetailView&record={$campaign_id}'>{$campaign_name}</a>";
135 $params[] = $focus->name;
137 echo getClassicModuleTitle($focus->module_dir, $params, true);
139 if (!empty($focus->all_prospect_lists)) {
140 $xtpl->assign("MESSAGE_FOR", $mod_strings['LBL_ALL_PROSPECT_LISTS']);
142 $xtpl->assign("MESSAGE_FOR", $mod_strings['LBL_RELATED_PROSPECT_LISTS']);
145 if (!empty($focus->status)) {
146 $xtpl->assign("STATUS",$app_list_strings['email_marketing_status_dom'][$focus->status]);
149 $mailboxes=get_campaign_mailboxes($emails);
150 //_ppd($emails[$focus->inbound_email_id]);
151 if (!empty($focus->inbound_email_id) && isset($mailboxes[$focus->inbound_email_id])) {
152 $xtpl->assign("FROM_MAILBOX_NAME", $mailboxes[$focus->inbound_email_id]." <{$emails[$focus->inbound_email_id]}>");
155 $xtpl->parse("main");
159 $javascript = new javascript();
160 $javascript->setFormName('EditView');
161 $javascript->setSugarBean($focus);
162 $javascript->addAllFields('');
163 echo $javascript->getScript();
165 require_once('include/SubPanel/SubPanelTiles.php');
166 $subpanel = new SubPanelTiles($focus, 'EmailMarketing');
168 if ($focus->all_prospect_lists == 1) {
169 $subpanel->subpanel_definitions->exclude_tab('prospectlists');
172 $subpanel->subpanel_definitions->exclude_tab('allprospectlists');
176 echo $subpanel->display();