This commit is contained in:
2024-04-27 09:23:34 +02:00
commit 11e713ca6f
11884 changed files with 3263371 additions and 0 deletions

405
modules/Campaigns/Campaign.php Executable file
View File

@@ -0,0 +1,405 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description:
********************************************************************************/
class Campaign extends SugarBean {
var $field_name_map;
// Stored fields
var $id;
var $date_entered;
var $date_modified;
var $modified_user_id;
var $assigned_user_id;
var $created_by;
var $created_by_name;
var $currency_id;
var $modified_by_name;
var $name;
var $start_date;
var $end_date;
var $status;
var $expected_cost;
var $budget;
var $actual_cost;
var $expected_revenue;
var $campaign_type;
var $objective;
var $content;
var $tracker_key;
var $tracker_text;
var $tracker_count;
var $refer_url;
var $impressions;
// These are related
var $assigned_user_name;
// module name definitions and table relations
var $table_name = "campaigns";
var $rel_prospect_list_table = "prospect_list_campaigns";
var $object_name = "Campaign";
var $module_dir = 'Campaigns';
var $importable = true;
// This is used to retrieve related fields from form posts.
var $additional_column_fields = array(
'assigned_user_name', 'assigned_user_id',
);
var $relationship_fields = Array('prospect_list_id'=>'prospect_lists');
function Campaign() {
global $sugar_config;
parent::SugarBean();
}
var $new_schema = true;
function list_view_parse_additional_sections(&$listTmpl) {
global $locale;
// take $assigned_user_id and get the Username value to assign
$assId = $this->getFieldValue('assigned_user_id');
$query = "SELECT first_name, last_name FROM users WHERE id = '".$assId."'";
$result = $this->db->query($query);
$user = $this->db->fetchByAssoc($result);
//_ppd($user);
if(!empty($user)) {
$fullName = $locale->getLocaleFormattedName($user->first_name, $user->last_name);
$listTmpl->assign('ASSIGNED_USER_NAME', $fullName);
}
}
function get_summary_text()
{
return "$this->name";
}
function create_export_query(&$order_by, &$where, $relate_link_join='')
{
$custom_join = $this->custom_fields->getJOIN(true, true,$where);
if($custom_join)
$custom_join['join'] .= $relate_link_join;
$query = "SELECT
campaigns.*,
users.user_name as assigned_user_name ";
if($custom_join){
$query .= $custom_join['select'];
}
$query .= " FROM campaigns ";
$query .= "LEFT JOIN users
ON campaigns.assigned_user_id=users.id";
if($custom_join){
$query .= $custom_join['join'];
}
$where_auto = " campaigns.deleted=0";
if($where != "")
$query .= " where $where AND ".$where_auto;
else
$query .= " where ".$where_auto;
if($order_by != "")
$query .= " ORDER BY $order_by";
else
$query .= " ORDER BY campaigns.name";
return $query;
}
function clear_campaign_prospect_list_relationship($campaign_id, $prospect_list_id='')
{
if(!empty($prospect_list_id))
$prospect_clause = " and prospect_list_id = '$prospect_list_id' ";
else
$prospect_clause = '';
$query = "DELETE FROM $this->rel_prospect_list_table WHERE campaign_id='$campaign_id' AND deleted = '0' " . $prospect_clause;
$this->db->query($query, true, "Error clearing campaign to prospect_list relationship: ");
}
function mark_relationships_deleted($id)
{
$this->clear_campaign_prospect_list_relationship($id);
}
function fill_in_additional_list_fields()
{
parent::fill_in_additional_list_fields();
}
function fill_in_additional_detail_fields()
{
parent::fill_in_additional_detail_fields();
//format numbers.
//don't need additional formatting here.
//$this->budget=format_number($this->budget);
//$this->expected_cost=format_number($this->expected_cost);
//$this->actual_cost=format_number($this->actual_cost);
//$this->expected_revenue=format_number($this->expected_revenue);
}
function update_currency_id($fromid, $toid){
}
function get_list_view_data(){
$temp_array = $this->get_list_view_array();
if ($this->campaign_type != 'Email') {
$temp_array['OPTIONAL_LINK']="display:none";
}
$temp_array['TRACK_CAMPAIGN_TITLE'] = translate("LBL_TRACK_BUTTON_TITLE",'Campaigns');
$temp_array['TRACK_CAMPAIGN_IMAGE'] = SugarThemeRegistry::current()->getImageURL('view_status.gif');
$temp_array['LAUNCH_WIZARD_TITLE'] = translate("LBL_TO_WIZARD_TITLE",'Campaigns');
$temp_array['LAUNCH_WIZARD_IMAGE'] = SugarThemeRegistry::current()->getImageURL('edit_wizard.gif');
return $temp_array;
}
/**
builds a generic search based on the query string using or
do not include any $this-> because this is called on without having the class instantiated
*/
function build_generic_where_clause ($the_query_string)
{
$where_clauses = Array();
$the_query_string = $this->db->quote($the_query_string);
array_push($where_clauses, "campaigns.name like '$the_query_string%'");
$the_where = "";
foreach($where_clauses as $clause)
{
if($the_where != "") $the_where .= " or ";
$the_where .= $clause;
}
return $the_where;
}
function save($check_notify = FALSE) {
//US DOLLAR
if(isset($this->amount) && !empty($this->amount)){
$currency = new Currency();
$currency->retrieve($this->currency_id);
$this->amount_usdollar = $currency->convertToDollar($this->amount);
}
$this->unformat_all_fields();
return parent::save($check_notify);
}
function set_notification_body($xtpl, $camp)
{
$xtpl->assign("CAMPAIGN_NAME", $camp->name);
$xtpl->assign("CAMPAIGN_AMOUNT", $camp->budget);
$xtpl->assign("CAMPAIGN_CLOSEDATE", $camp->end_date);
$xtpl->assign("CAMPAIGN_STATUS", $camp->status);
$xtpl->assign("CAMPAIGN_DESCRIPTION", $camp->content);
return $xtpl;
}
function track_log_entries($type=array()) {
//get arguments being passed in
$args = func_get_args();
$mkt_id ='';
$this->load_relationship('log_entries');
$query_array = $this->log_entries->getQuery(true);
//if one of the arguments is marketing ID, then we need to filter by it
foreach($args as $arg){
if(isset($arg['EMAIL_MARKETING_ID_VALUE'])){
$mkt_id = $arg['EMAIL_MARKETING_ID_VALUE'];
}
if(isset($arg['group_by'])) {
$query_array['group_by'] = $arg['group_by'];
}
}
if (empty($type))
$type[0]='targeted';
$query_array['select'] ="SELECT campaign_log.* ";
$query_array['where'] = $query_array['where']. " AND activity_type='{$type[0]}' AND archived=0";
//add filtering by marketing id, if it exists
if (!empty($mkt_id)) $query_array['where'] = $query_array['where']. " AND marketing_id ='$mkt_id' ";
//B.F. #37943
if( isset($query_array['group_by']) && $this->db->dbType != 'mysql' )
{
//perform the inner join with the group by if a marketing id is defined, which means we need to filter out duplicates.
//if no marketing id is specified then we are displaying results from multiple marketing emails and it is understood there might be duplicate target entries
if (!empty($mkt_id)){
$group_by = str_replace("campaign_log", "cl", $query_array['group_by']);
$join_where = str_replace("campaign_log", "cl", $query_array['where']);
$query_array['from'] .= " INNER JOIN (select min(id) as id from campaign_log cl $join_where GROUP BY $group_by ) secondary
on campaign_log.id = secondary.id ";
}
unset($query_array['group_by']);
}
else if(isset($query_array['group_by'])) {
$query_array['where'] = $query_array['where'] . ' GROUP BY ' . $query_array['group_by'];
unset($query_array['group_by']);
}
$query = (implode(" ",$query_array));
return $query;
}
function get_queue_items() {
//get arguments being passed in
$args = func_get_args();
$mkt_id ='';
$this->load_relationship('queueitems');
$query_array = $this->queueitems->getQuery(true);
//if one of the arguments is marketing ID, then we need to filter by it
foreach($args as $arg){
if(isset($arg['EMAIL_MARKETING_ID_VALUE'])){
$mkt_id = $arg['EMAIL_MARKETING_ID_VALUE'];
}
if(isset($arg['group_by'])) {
$query_array['group_by'] = $arg['group_by'];
}
}
//add filtering by marketing id, if it exists, and if where key is not empty
if (!empty($mkt_id) && !empty($query_array['where'])){
$query_array['where'] = $query_array['where']. " AND marketing_id ='$mkt_id' ";
}
//get select query from email man
$man = new EmailMan();
$listquery= $man->create_queue_items_query('',str_replace(array("WHERE","where"),"",$query_array['where']),null,$query_array);
return $listquery;
}
// function get_prospect_list_entries() {
// $this->load_relationship('prospectlists');
// $query_array = $this->prospectlists->getQuery(true);
//
// $query=<<<EOQ
// SELECT distinct prospect_lists.*,
// (case when (email_marketing.id is null) then default_message.id else email_marketing.id end) marketing_id,
// (case when (email_marketing.id is null) then default_message.name else email_marketing.name end) marketing_name
//
// FROM prospect_lists
//
// INNER JOIN prospect_list_campaigns ON (prospect_lists.id=prospect_list_campaigns.prospect_list_id AND prospect_list_campaigns.campaign_id='{$this->id}')
//
// LEFT JOIN email_marketing on email_marketing.message_for = prospect_lists.id and email_marketing.campaign_id = '{$this->id}'
// and email_marketing.deleted =0 and email_marketing.status='active'
//
// LEFT JOIN email_marketing default_message on default_message.message_for = prospect_list_campaigns.campaign_id and
// default_message.campaign_id = '{$this->id}' and default_message.deleted =0
// and default_message.status='active'
//
// WHERE prospect_list_campaigns.deleted=0 AND prospect_lists.deleted=0
//
//EOQ;
// return $query;
// }
function bean_implements($interface){
switch($interface){
case 'ACL':return true;
}
return false;
}
/**
* create_list_count_query
* Overrode this method from SugarBean to handle the distinct parameter used to filter out
* duplicate entries for some of the subpanel listivews. Without the distinct filter, the
* list count would be inaccurate because one-to-many email_marketing entries may be associated
* with a campaign.
*
* @param string $query Select query string
* @param array $param array of arguments
* @return string count query
*
*/
function create_list_count_query($query, $params=array())
{
//include the distinct filter if a marketing id is defined, which means we need to filter out duplicates by the passed in group by.
//if no marketing id is specified, it is understood there might be duplicate target entries so no need to filter out
if((strpos($query,'marketing_id') !== false )&& isset($params['distinct'])) {
$pattern = '/SELECT(.*?)(\s){1}FROM(\s){1}/is'; // ignores the case
$replacement = 'SELECT COUNT(DISTINCT ' . $params['distinct'] . ') c FROM ';
$query = preg_replace($pattern, $replacement, $query, 1);
return $query;
}
//If distinct parameter not found, default to SugarBean's function
return parent::create_list_count_query($query);
}
}
?>

View File

@@ -0,0 +1,76 @@
<!--
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
********************************************************************************/
-->
<form id="wizform" name="wizform" method="POST" action="index.php">
<input type="hidden" name="module" value="Campaigns">
<input type="hidden" name="action" = "CampaignDiagnostic">
<input type="hidden" name="return_module" value="{$RETURN_MODULE}">
<input type="hidden" name="return_id" value="{$RETURN_ID}">
<input type="hidden" name="return_action" value="{$RETURN_ACTION}">
<div id="diagnose" class="contentdiv">
<form name="form1" method="post" action="">
<table class="h3Row" border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td nowrap="nowrap"><h3>{$EMAIL_IMAGE}{$EMAIL_COMPONENTS}</h3></td></tr></table>
<div id="email" >
{$EMAIL_SETTINGS_CONFIGURED_MESSAGE}
{$MAILBOXES_DETECTED_MESSAGE}
</div>
<p>{$EMAIL_SETUP_WIZ_LINK}</p>
<p>&nbsp;</p>
<table class="h3Row" border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td nowrap="nowrap"><h3>{$SCHEDULE_IMAGE} {$SCHEDULER_COMPONENTS}</h3></td></tr></table>
<div id="schedule">
{$SCHEDULER_EMAILS_MESSAGE}
</div>
</p>
<p><div id='submit'><input name="Re-Check" onclick="this.form.action.value='CampaignDiagnostic';" class='button' value="{$RECHECK_BTN}" type="submit"></div>
</form></div>

View File

@@ -0,0 +1,278 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
/************** general UI Stuff *************/
global $mod_strings;
global $app_list_strings;
global $app_strings;
global $current_user;
//if (!is_admin($current_user)) sugar_die("Unauthorized access to administration.");
//account for use within wizards
if(!isset($_REQUEST['inline']) || $_REQUEST['inline'] != 'inline'){
$params = array();
$params[] = "<a href='index.php?module=Campaigns&action=index'>{$mod_strings['LBL_MODULE_NAME']}</a>";
$params[] = $mod_strings['LBL_CAMPAIGN_DIAGNOSTICS'];
echo getClassicModuleTitle('Campaigns', $params, true);
//echo "<h2>".get_module_title($mod_strings['LBL_MODULE_NAME'],$mod_strings['LBL_CAMPAIGN_DIAGNOSTICS'],true)."</h2>";
}
global $theme;
global $currentModule;
if(isset($_REQUEST['inline']) && $_REQUEST['inline'] == 'inline'){
{
}
}else{
//use html if not inline
$ss = new Sugar_Smarty();
$ss->assign("MOD", $mod_strings);
$ss->assign("APP", $app_strings);
if (isset($_REQUEST['return_module'])) $ss->assign("RETURN_MODULE", $_REQUEST['return_module']);
if (isset($_REQUEST['return_action'])) $ss->assign("RETURN_ACTION", $_REQUEST['return_action']);
if (isset($_REQUEST['return_id'])) $ss->assign("RETURN_ID", $_REQUEST['return_id']);
// handle Create $module then Cancel
if (empty($_REQUEST['return_id'])) {
$ss->assign("RETURN_ACTION", 'index');
}
}
/************ EMAIL COMPONENTS *************/
//monitored mailbox section
$focus = new Administration();
$focus->retrieveSettings(); //retrieve all admin settings.
//run query for mail boxes of type 'bounce'
$email_health = 0;
$email_components = 2;
$mbox_qry = "select * from inbound_email where deleted ='0' and mailbox_type = 'bounce'";
$mbox_res = $focus->db->query($mbox_qry);
$mboxTable = "<table border ='0' width='100%' class='detail view' cellpadding='0' cellspacing='0'>";
//put all rows returned into an array
$mbox = array();
while ($mbox_row = $focus->db->fetchByAssoc($mbox_res)){$mbox[] = $mbox_row;}
$mbox_msg = ' ';
//if the array is not empty, then set "good" message
if(isset($mbox) && count($mbox)>0){
$mboxTable .= "<tr><td colspan='5' style='text-align: left;'><b>" .count($mbox) ." ". $mod_strings['LBL_MAILBOX_CHECK1_GOOD']." </b>.</td></tr>";
$mboxTable .= "<tr><td width='20%'><b>".$mod_strings['LBL_MAILBOX_NAME']."</b></td>"
. " <td width='20%'><b>".$mod_strings['LBL_LOGIN']."</b></td>"
. " <td width='20%'><b>".$mod_strings['LBL_MAILBOX']."</b></td>"
. " <td width='20%'><b>".$mod_strings['LBL_SERVER_URL']."</b></td>"
. " <td width='20%'><b>".$mod_strings['LBL_LIST_STATUS']."</b></td></tr>";
foreach($mbox as $details){
$mboxTable .= "<tr><td>".$details['name']."</td>";
$mboxTable .= "<td scope='row'>".$details['email_user']."</td>";
$mboxTable .= "<td scope='row'>".$details['mailbox']."</td>";
$mboxTable .= "<td scope='row'>".$details['server_url']."</td>";
$mboxTable .= "<td scope='row'>".$details['status']."</td></tr>";
}
}else{
//if array is empty, then set "bad" message and increment health counter
$mboxTable .= "<tr><td colspan='5'><b class='error'>". $mod_strings['LBL_MAILBOX_CHECK1_BAD']."</b></td></tr>";
$email_health =$email_health +1;
}
$mboxTable.= '</table>' ;
$ss->assign("MAILBOXES_DETECTED_MESSAGE", $mboxTable);
//email settings configured
$conf_msg="<table border='0' width='100%' class='detail view' cellpadding='0' cellspacing='0'>";
if (strstr($focus->settings['notify_fromaddress'], 'example.com')){
//if from address is the default, then set "bad" message and increment health counter
$conf_msg .= "<tr><td colspan = '5'><b class='error'> ".$mod_strings['LBL_MAILBOX_CHECK2_BAD']." </b></td></td>";
$email_health =$email_health +1;
}else{
$conf_msg .= "<tr><td colspan = '5'><b> ".$mod_strings['LBL_MAILBOX_CHECK2_GOOD']."</b></td></tr>";
$conf_msg .= "<tr><td width='20%'><b>".$mod_strings['LBL_WIZ_FROM_NAME']."</b></td>"
. " <td width='20%'><b>".$mod_strings['LBL_WIZ_FROM_ADDRESS']."</b></td>"
. " <td width='20%'><b>".$mod_strings['LBL_MAIL_SENDTYPE']."</b></td>";
if($focus->settings['mail_sendtype']=='SMTP'){
$conf_msg .= " <td width='20%'><b>".$mod_strings['LBL_MAIL_SMTPSERVER']."</b></td>"
. " <td width='20%'><b>".$mod_strings['LBL_MAIL_SMTPUSER']."</b></td></tr>";
}else{$conf_msg .= "</tr>";}
$conf_msg .= "<tr scope='row'><td>".$focus->settings['notify_fromname']."</td>";
$conf_msg .= "<td>".$focus->settings['notify_fromaddress']."</td>";
$conf_msg .= "<td>".$focus->settings['mail_sendtype']."</td>";
if($focus->settings['mail_sendtype']=='SMTP'){
$conf_msg .= "<td>".$focus->settings['mail_smtpserver']."</td>";
$conf_msg .= "<td>".$focus->settings['mail_smtpuser']."</td></tr>";
}else{$conf_msg .= "</tr>";}
}
$conf_msg .= '</table>';
$ss->assign("EMAIL_SETTINGS_CONFIGURED_MESSAGE", $conf_msg);
$email_setup_wiz_link='';
if ($email_health>0){
if (is_admin($current_user)){
$email_setup_wiz_link="<a href='index.php?module=Campaigns&action=WizardEmailSetup'>".$mod_strings['LBL_EMAIL_SETUP_WIZ']."</a>";
}else{
$email_setup_wiz_link=$mod_strings['LBL_NON_ADMIN_ERROR_MSG'];
}
}
$ss->assign("EMAIL_SETUP_WIZ_LINK", $email_setup_wiz_link);
$ss->assign( 'EMAIL_IMAGE', define_image($email_health, 2));
$ss->assign( 'EMAIL_COMPONENTS', $mod_strings['LBL_EMAIL_COMPONENTS']);
$ss->assign( 'SCHEDULER_COMPONENTS', $mod_strings['LBL_SCHEDULER_COMPONENTS']);
$ss->assign( 'RECHECK_BTN', $mod_strings['LBL_RECHECK_BTN']);
/************* SCHEDULER COMPONENTS ************/
//create and run the scheduler queries
$sched_qry = "select job, name, status from schedulers where deleted = 0 and status = 'Active'";
$sched_res = $focus->db->query($sched_qry);
$sched_health = 0;
$sched = array();
$check_sched1 = 'function::runMassEmailCampaign';
$check_sched2 = 'function::pollMonitoredInboxesForBouncedCampaignEmails';
$sched_mes = '';
$sched_mes_body = '';
$scheds = array();
//build the table rows for scheduler display
while ($sched_row = $focus->db->fetchByAssoc($sched_res)){$scheds[] = $sched_row;}
foreach ($scheds as $funct){
if( ($funct['job']==$check_sched1) || ($funct['job']==$check_sched2)){
$sched_mes = 'use';
$sched_mes_body .= "<tr><td scope='row' style='text-align: left;'>".$funct['name']."</td>";
$sched_mes_body .= "<td scope='row' style='text-align: left;'>".$funct['status']."</td></tr>";
if($funct['job']==$check_sched1){
$check_sched1 ="found";
}else{
$check_sched2 ="found";
}
}
}
//determine which table header to use, based on whether or not schedulers were found
$show_admin_link = false;
if($sched_mes == 'use'){
$sched_mes = "<h5>".$mod_strings['LBL_SCHEDULER_CHECK_GOOD']."</h5><br><table class='other view' cellspacing='1'>";
$sched_mes .= "<tr><td width='40%'><b>".$mod_strings['LBL_SCHEDULER_NAME']."</b></td>"
. " <td width='60%'><b>".$mod_strings['LBL_SCHEDULER_STATUS']."</b></td></tr>";
}else{
$sched_mes = "<table class='other view' cellspacing='1'>";
$sched_mes .= "<tr><td colspan ='3'><font color='red'><b> ".$mod_strings['LBL_SCHEDULER_CHECK_BAD']."</b></font></td></tr>";
$show_admin_link = true;
}
//determine if error messages need to be displayed for schedulers
if($check_sched2 != 'found'){
$sched_health =$sched_health +1;
$sched_mes_body .= "<tr><td colspan ='3'><font color='red'> ".$mod_strings['LBL_SCHEDULER_CHECK1_BAD']."</font></td></tr>";
}
if($check_sched1 != 'found'){
$sched_health =$sched_health +1;
$sched_mes_body .= "<tr><td colspan ='3' scope='row'><font color='red'>".$mod_strings['LBL_SCHEDULER_CHECK2_BAD']."</font></td></tr>";
}
$admin_sched_link='';
if ($sched_health>0){
if (is_admin($current_user)){
$admin_sched_link="<a href='index.php?module=Schedulers&action=index'>".$mod_strings['LBL_SCHEDULER_LINK']."</a>";
}else{
$admin_sched_link=$mod_strings['LBL_NON_ADMIN_ERROR_MSG'];
}
}
//put table html together and display
$final_sched_msg = $sched_mes . $sched_mes_body . '</table>' . $admin_sched_link;
$ss->assign("SCHEDULER_EMAILS_MESSAGE", $final_sched_msg);
$ss->assign( 'SCHEDULE_IMAGE', define_image($sched_health, 2));
/********** FINAL END OF PAGE UI Stuff ********/
if(!isset($_REQUEST['inline']) || $_REQUEST['inline'] != 'inline'){
$ss->display('modules/Campaigns/CampaignDiagnostic.html');
}
/**
* This function takes in 3 parameters and determines the appropriate image source.
*
* @param int $num parameter is the "health" parameter being tracked whenever there is something wrong. (higher number =bad)
* @param int $total Parameter is the total number things being checked.
* @return string HTML img tag
*/
function define_image($num, $total)
{
//if health number is equal to total number then all checks failed, set red image
if($num == $total){
//red
return "<img src='".SugarThemeRegistry::current()->getImageURL("red_camp.gif")."' align='absmiddle'> ";
}elseif($num == 0){
//if health number is zero, then all checks passed, set green image
//green
return "<img src='".SugarThemeRegistry::current()->getImageURL("green_camp.gif")."' align='absmiddle' > ";
}else{
//if health number is between total and num params, then some checks failed but not all, set yellow image
//yellow
return "<img src='".SugarThemeRegistry::current()->getImageURL("yellow_camp.gif")."' align='absmiddle' > ";
}
}
?>

View File

@@ -0,0 +1,64 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
/**Check captcha validation here.
*
*/
require_once('include/recaptcha/recaptchalib.php');
$admin=new Administration();
$admin->retrieveSettings('captcha');
if($admin->settings['captcha_on']=='1' && !empty($admin->settings['captcha_private_key'])){
$privatekey = $admin->settings['captcha_private_key'];
}else
die("Captcha settings not found");
$response = recaptcha_check_answer($privatekey,
$_SERVER["REMOTE_ADDR"],
$_REQUEST["recaptcha_challenge_field"],
$_REQUEST["recaptcha_response_field"]);
if(!$response->is_valid){
die("Invalid captcha entry, go back and fix. ". $response->error. " ");
}
else echo("Success");
?>

326
modules/Campaigns/Charts.php Executable file
View File

@@ -0,0 +1,326 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: Includes the functions for Customer module specific charts.
********************************************************************************/
require_once('include/charts/Charts.php');
class campaign_charts {
/**
* Creates opportunity pipeline image as a VERTICAL accumlated bar graph for multiple users.
* param $datax- the month data to display in the x-axis
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc..
* All Rights Reserved..
* Contributor(s): ______________________________________..
*/
function campaign_response_by_activity_type($datay= array(),$targets=array(),$campaign_id, $cache_file_name='a_file', $refresh=false, $marketing_id='') {
global $app_strings, $mod_strings, $charset, $lang, $barChartColors,$app_list_strings;
if (!file_exists($cache_file_name) || $refresh == true) {
$GLOBALS['log']->debug("datay is:");
$GLOBALS['log']->debug($datay);
$GLOBALS['log']->debug("user_id is: ");
$GLOBALS['log']->debug("cache_file_name is: $cache_file_name");
$focus = new Campaign();
$query = "SELECT activity_type,target_type, count(*) hits ";
$query.= " FROM campaign_log ";
$query.= " WHERE campaign_id = '$campaign_id' AND archived=0 AND deleted=0";
//if $marketing id is specified, then lets filter the chart by the value
if (!empty($marketing_id)){
$query.= " AND marketing_id ='$marketing_id'";
}
$query.= " GROUP BY activity_type, target_type";
$query.= " ORDER BY activity_type, target_type";
$result = $focus->db->query($query);
$leadSourceArr = array();
$total=0;
$total_targeted=0;
$rowTotalArr = array();
$rowTotalArr[] = 0;
while($row = $focus->db->fetchByAssoc($result, -1, false))
{
if(!isset($leadSourceArr[$row['activity_type']]['row_total'])) {
$leadSourceArr[$row['activity_type']]['row_total']=0;
}
$leadSourceArr[$row['activity_type']][$row['target_type']]['hits'][] = $row['hits'];
$leadSourceArr[$row['activity_type']][$row['target_type']]['total'][] = $row['hits'];
$leadSourceArr[$row['activity_type']]['outcome'][$row['target_type']]=$row['target_type'];
$leadSourceArr[$row['activity_type']]['row_total'] += $row['hits'];
if (!isset($leadSourceArr['all_activities'][$row['target_type']])) {
$leadSourceArr['all_activities'][$row['target_type']]=array('total'=>0);
}
$leadSourceArr['all_activities'][$row['target_type']]['total'] += $row['hits'];
$total += $row['hits'];
if ($row['activity_type'] =='targeted') {
$targeted[$row['target_type']]=$row['hits'];
$total_targeted+=$row['hits'];
}
}
$fileContents = ' <yData defaultAltText="'.$mod_strings['LBL_ROLLOVER_VIEW'].'">'."\n";
foreach ($datay as $key=>$translation) {
if ($key == '') {
//$key = $mod_strings['NTC_NO_LEGENDS'];
$key = 'None';
$translation = $mod_strings['NTC_NO_LEGENDS'];
}
if(!isset($leadSourceArr[$key])){
$leadSourceArr[$key] = $key;
}
if(is_array($leadSourceArr[$key]) && isset($leadSourceArr[$key]['row_total'])){$rowTotalArr[]=$leadSourceArr[$key]['row_total'];}
if(is_array($leadSourceArr[$key]) && isset($leadSourceArr[$key]['row_total']) && $leadSourceArr[$key]['row_total']>100){
$leadSourceArr[$key]['row_total'] = round($leadSourceArr[$key]['row_total']);
}
$fileContents .= ' <dataRow title="'.$translation.'" endLabel="'.$leadSourceArr[$key]['row_total'].'">'."\n";
if(is_array($leadSourceArr[$key]['outcome'])){
foreach ($leadSourceArr[$key]['outcome'] as $outcome=>$outcome_translation){
//create alternate text.
$alttext = ' ';
if(isset($targeted) && isset($targeted[$outcome])&& !empty($targeted[$outcome])){
$alttext=$targets[$outcome].': '.$mod_strings['LBL_TARGETED'].' '.$targeted[$outcome]. ', '.$mod_strings['LBL_TOTAL_TARGETED'].' '. $total_targeted. ".";
}
if ($key != 'targeted'){
$alttext.=" $translation ". array_sum($leadSourceArr[$key][$outcome]['hits']);
}
$fileContents .= ' <bar id="'.$outcome.'" totalSize="'.array_sum($leadSourceArr[$key][$outcome]['total']).'" altText="'.$alttext.'" url="#'.$key.'"/>'."\n";
}
}
$fileContents .= ' </dataRow>'."\n";
}
$fileContents .= ' </yData>'."\n";
$max = get_max($rowTotalArr);
$fileContents .= ' <xData min="0" max="'.$max.'" length="10" prefix="'.''.'" suffix=""/>'."\n";
$fileContents .= ' <colorLegend status="on">'."\n";
$i=0;
foreach ($targets as $outcome=>$outcome_translation) {
$color = generate_graphcolor($outcome,$i);
$fileContents .= ' <mapping id="'.$outcome.'" name="'.$outcome_translation.'" color="'.$color.'"/>'."\n";
$i++;
}
$fileContents .= ' </colorLegend>'."\n";
$fileContents .= ' <graphInfo>'."\n";
$fileContents .= ' <![CDATA['.' '.']]>'."\n";
$fileContents .= ' </graphInfo>'."\n";
$fileContents .= ' <chartColors ';
foreach ($barChartColors as $key => $value) {
$fileContents .= ' '.$key.'='.'"'.$value.'" ';
}
$fileContents .= ' />'."\n";
$fileContents .= '</graphData>'."\n";
$total = round($total, 2);
$title = '<graphData title="'.$mod_strings['LBL_CAMPAIGN_RESPONSE_BY_RECIPIENT_ACTIVITY'].'">'."\n";
$fileContents = $title.$fileContents;
save_xml_file($cache_file_name, $fileContents);
}
$return = create_chart('hBarF',$cache_file_name);
return $return;
}
//campaign roi compputations
function campaign_response_roi($datay= array(),$targets=array(),$campaign_id, $cache_file_name='a_file', $refresh=false,$marketing_id='',$is_dashlet=false,$dashlet_id='') {
global $app_strings,$mod_strings, $current_module_strings, $charset, $lang, $app_list_strings, $current_language,$sugar_config;
$not_empty = false;
if ($is_dashlet){
$mod_strings = return_module_language($current_language, 'Campaigns');
}
if (!file_exists($cache_file_name) || $refresh == true) {
$GLOBALS['log']->debug("datay is:");
$GLOBALS['log']->debug($datay);
$GLOBALS['log']->debug("user_id is: ");
$GLOBALS['log']->debug("cache_file_name is: $cache_file_name");
$focus = new Campaign();
$focus->retrieve($campaign_id);
$opp_count=0;
$opp_query = "select count(*) opp_count,sum(" . db_convert("amount_usdollar","IFNULL",array(0)).") total_value";
$opp_query .= " from opportunities";
$opp_query .= " where campaign_id='$campaign_id'";
$opp_query .= " and sales_stage='Prospecting'";
$opp_query .= " and deleted=0";
$opp_result=$focus->db->query($opp_query);
$opp_data=$focus->db->fetchByAssoc($opp_result);
// if (empty($opp_data['opp_count'])) $opp_data['opp_count']=0;
if (empty($opp_data['total_value'])) $opp_data['total_value']=0;
//report query
$opp_query1 = "select SUM(opp.amount) as revenue";
$opp_query1 .= " from opportunities opp";
$opp_query1 .= " right join campaigns camp on camp.id = opp.campaign_id";
$opp_query1 .= " where opp.sales_stage = 'Closed Won'and camp.id='$campaign_id' and opp.deleted=0";
$opp_query1 .= " group by camp.name";
$opp_result1=$focus->db->query($opp_query1);
$opp_data1=$focus->db->fetchByAssoc($opp_result1);
//if (empty($opp_data1[]))
if (empty($opp_data1['revenue'])){
$opp_data1[$mod_strings['LBL_ROI_CHART_REVENUE']] = 0;
unset($opp_data1['revenue']);
}else{
$opp_data1[$mod_strings['LBL_ROI_CHART_REVENUE']] = $opp_data1['revenue'];
unset($opp_data1['revenue']);
$not_empty = true;
}
$camp_query1 = "select camp.name, SUM(camp.actual_cost) as investment,SUM(camp.budget) as budget,SUM(camp.expected_revenue) as expected_revenue";
$camp_query1 .= " from campaigns camp";
$camp_query1 .= " where camp.id='$campaign_id'";
$camp_query1 .= " group by camp.name";
$camp_result1=$focus->db->query($camp_query1);
$camp_data1=$focus->db->fetchByAssoc($camp_result1);
//query needs to be lowercase, but array keys need to be propercased, as these are used in
//chart to display legend
if (empty($camp_data1['investment']))
$camp_data1['investment'] = 0;
else
$not_empty = true;
if (empty($camp_data1['budget']))
$camp_data1['budget'] = 0;
else
$not_empty = true;
if (empty($camp_data1['expected_revenue']))
$camp_data1['expected_revenue'] = 0;
else
$not_empty = true;
$opp_data1[$mod_strings['LBL_ROI_CHART_INVESTMENT']]=$camp_data1['investment'];
$opp_data1[$mod_strings['LBL_ROI_CHART_BUDGET']]=$camp_data1['budget'];
$opp_data1[$mod_strings['LBL_ROI_CHART_EXPECTED_REVENUE']]=$camp_data1['expected_revenue'];
$query = "SELECT activity_type,target_type, count(*) hits ";
$query.= " FROM campaign_log ";
$query.= " WHERE campaign_id = '$campaign_id' AND archived=0 AND deleted=0";
//if $marketing id is specified, then lets filter the chart by the value
if (!empty($marketing_id)){
$query.= " AND marketing_id ='$marketing_id'";
}
$query.= " GROUP BY activity_type, target_type";
$query.= " ORDER BY activity_type, target_type";
$result = $focus->db->query($query);
$leadSourceArr = array();
$total=0;
$total_targeted=0;
}
global $current_user;
$user_id = $current_user->id;
require_once('include/SugarCharts/SugarChart.php');
$width = ($is_dashlet) ? '100%' : '720px';
$return = '<script type="text/javascript" src="' . getJSPath('include/javascript/swfobject.js' ) . '"></script>';
if (!$is_dashlet){
$return .= '<br />';
}
$currency_id = $focus->currency_id;
$currency_symbol = $sugar_config['default_currency_symbol'];
if(!empty($currency_id)){
$cur = new Currency();
$cur->retrieve($currency_id);
$currency_symbol = $cur->symbol;
}
$sugarChart = new SugarChart();
$sugarChart->is_currency = true;
$sugarChart->currency_symbol = $currency_symbol;
if ($not_empty)
$sugarChart->setData($opp_data1);
else
$sugarChart->setData(array());
$sugarChart->setProperties($mod_strings['LBL_CAMPAIGN_RETURN_ON_INVESTMENT'], $mod_strings['LBL_AMOUNT_IN'].$currency_symbol, 'bar chart');
if (!$is_dashlet){
$xmlFile = $sugarChart->getXMLFileName('roi_details_chart');
$sugarChart->saveXMLFile($xmlFile, $sugarChart->generateXML());
$return .= $sugarChart->display('roi_details_chart', $xmlFile, $width, '480');
}
else{
$xmlFile = $sugarChart->getXMLFileName($dashlet_id);
$sugarChart->saveXMLFile($xmlFile, $sugarChart->generateXML());
$return .= $sugarChart->display($dashlet_id, $xmlFile, $width, '480');
}
return $return;
}
}// end charts class
?>

105
modules/Campaigns/Charts1.php Executable file
View File

@@ -0,0 +1,105 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: Includes the functions for Customer module specific charts.
********************************************************************************/
//todo: experimental class for chart data handling..not used in the application at this time.
require_once('include/charts/Charts.php');
class charts {
/* @function:
*
* @param array targets: translated list of all activity types, targeted, bounced etc..
* @param string campaign_id: chart for this campaign.
*/
function campaign_response_chart($targets,$campaign_id) {
$focus = new Campaign();
$leadSourceArr = array();
$query = "SELECT activity_type,target_type, count(*) hits ";
$query.= " FROM campaign_log ";
$query.= " WHERE campaign_id = '$campaign_id' AND archived=0 AND deleted=0";
$query.= " GROUP BY activity_type, target_type";
$query.= " ORDER BY activity_type, target_type";
$result = $focus->db->query($query);
while($row = $focus->db->fetchByAssoc($result, -1, false)) {
if (isset($leadSourceArr[$row['activity_type']]['value'])) {
$leadSourceArr[$row['activity_type']]['value']=0;
}
$leadSourceArr[$row['activity_type']]['value']= $leadSourceArr[$row['activity_type']]['value'] + $row['hits'];
if (!empty($row['target_type'])) {
$leadSourceArr[$row['activity_type']]['bars'][$row['target_type']]['value']=$row['hits'];
}
}
foreach ($targets as $key=>$value) {
if (!isset($leadSourceArr[$key])) {
$leadSourceArr[$key]['value']=0;
}
}
//use the new template.
$xtpl=new XTemplate ('modules/Campaigns/chart.tpl');
$xtpl->assign("GRAPHTITLE",'Campaign Response by Recipient Activity');
$xtpl->assign("Y_DEFAULT_ALT_TEXT",'Rollover a bar to view details.');
//process rows
foreach ($leadSourceArr as $key=>$values) {
if (isset($values['bars'])) {
foreach ($values['bars'] as $bar_id=>$bar_value) {
$xpl->assign("Y_BAR_ID",$bar_id);
}
}
}
}
}// end charts class
?>

View File

@@ -0,0 +1,47 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
global $app_strings;
$dashletMeta['TopCampaignsDashlet'] = array('module' => 'Campaigns',
'title' => translate('LBL_TOP_CAMPAIGNS', 'Campaigns'),
'description' => 'Top Performing Campaigns by Revenue',
'category' => 'Module Views',
'hidden' => true);
?>

View File

@@ -0,0 +1,85 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('include/Dashlets/Dashlet.php');
class TopCampaignsDashlet extends Dashlet {
var $top_campaigns = array();
function TopCampaignsDashlet($id, $def = null) {
global $current_user, $app_strings;
parent::Dashlet($id);
$this->isConfigurable = false;
$this->isRefreshable = true;
if(empty($def['title'])) $this->title = translate('LBL_TOP_CAMPAIGNS', 'Campaigns');
$this->seedBean = new Opportunity();
$qry = "SELECT C.name AS campaign_name, SUM(O.amount) AS revenue, C.id as campaign_id " .
"FROM campaigns C, opportunities O " .
"WHERE C.id = O.campaign_id " .
"AND O.sales_stage = 'Closed Won' " .
"GROUP BY C.name,C.id ORDER BY revenue desc";
$result = $this->seedBean->db->limitQuery($qry, 0, 10);
$row = $this->seedBean->db->fetchByAssoc($result);
while ($row != null){
array_push($this->top_campaigns, $row);
$row = $this->seedBean->db->fetchByAssoc($result);
}
}
function display(){
$ss = new Sugar_Smarty();
$ss->assign('lbl_campaign_name', translate('LBL_TOP_CAMPAIGNS_NAME', 'Campaigns'));
$ss->assign('lbl_revenue', translate('LBL_TOP_CAMPAIGNS_REVENUE', 'Campaigns'));
$ss->assign('top_campaigns', $this->top_campaigns);
return parent::display() . $ss->fetch('modules/Campaigns/Dashlets/TopCampaignsDashlet/TopCampaignsDashlet.tpl');
}
}
?>

View File

@@ -0,0 +1,58 @@
{*
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
*}
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="list view">
<tr>
<th>&nbsp;</td>
<th align="center">{$lbl_campaign_name}</td>
<th align="center">{$lbl_revenue}</td>
</tr>
{counter name="num" assign="num"}
{foreach from=$top_campaigns item="campaign"}
<tr>
<td class="oddListRowS1" align="center" valign="top" width="6%">{$num}.</td>
<td class="oddListRowS1" align="left" valign="top" width="74%"><a href="index.php?module=Campaigns&action=DetailView&record={$campaign.campaign_id}">{$campaign.campaign_name}</a></td>
<td class="oddListRowS1" align="left" valign="top" width="20%">{$campaign.revenue}</td>
</tr>
{counter name="num"}
{/foreach}
</table>

94
modules/Campaigns/Delete.php Executable file
View File

@@ -0,0 +1,94 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
if(!isset($_REQUEST['record']))
sugar_die("A record number must be specified to delete the campaign.");
$focus = new Campaign();
$focus->retrieve($_REQUEST['record']);
if (isset($_REQUEST['mode']) and $_REQUEST['mode']=='Test') {
//deletes all data associated with the test run.
//delete from emails table.
if ($focus->db->dbType=='mysql') {
$query="update emails ";
$query.="inner join campaign_log on campaign_log.related_id = emails.id and campaign_log.campaign_id = '{$focus->id}' ";
$query.="inner join prospect_lists on campaign_log.list_id = prospect_lists.id and prospect_lists.list_type='test' ";
$query.="set emails.deleted=1 ";
} else {
}
$focus->db->query($query);
//delete from message queue.
if ($focus->db->dbType=='mysql') {
$query="delete emailman.* from emailman ";
$query.="inner join prospect_lists on emailman.list_id = prospect_lists.id and prospect_lists.list_type='test' ";
$query.="WHERE emailman.campaign_id = '{$focus->id}' ";
} else {
}
$focus->db->query($query);
//delete from campaign_log
if ($focus->db->dbType=='mysql') {
$query="update campaign_log ";
$query.="inner join prospect_lists on campaign_log.list_id = prospect_lists.id and prospect_lists.list_type='test' ";
$query.="set campaign_log.deleted=1 ";
$query.="where campaign_log.campaign_id='{$focus->id}' ";
} else {
}
$focus->db->query($query);
} else {
if(!$focus->ACLAccess('Delete')){
ACLController::displayNoAccess(true);
sugar_cleanup(true);
}
$focus->mark_deleted($_REQUEST['record']);
}
$return_id=!empty($_REQUEST['return_id'])?$_REQUEST['return_id']:$focus->id;
header("Location: index.php?module=".$_REQUEST['return_module']."&action=".$_REQUEST['return_action']."&record=".$return_id);
?>

View File

@@ -0,0 +1,41 @@
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
function set_return_prospect_list_and_save(popup_reply_data)
{var form_name=popup_reply_data.form_name;var name_to_value_array=popup_reply_data.name_to_value_array;for(var the_key in name_to_value_array)
{if(the_key=='toJSON')
{}
else
{window.document.forms[form_name].elements[the_key].value=name_to_value_array[the_key];}}
window.document.forms[form_name].module.value='Campaigns';window.document.forms[form_name].return_module.value=window.document.forms[form_name].module.value;window.document.forms[form_name].return_action.value='DetailView';window.document.forms[form_name].return_id.value=window.document.forms[form_name].record.value;window.document.forms[form_name].action.value='SaveCampaignProspectListRelationship';window.document.forms[form_name].submit();}

124
modules/Campaigns/EmailQueue.php Executable file
View File

@@ -0,0 +1,124 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
global $timedate;
global $current_user;
$campaign = new Campaign();
$campaign->retrieve($_REQUEST['record']);
$query = "SELECT prospect_list_id as id FROM prospect_list_campaigns WHERE campaign_id='$campaign->id' AND deleted=0";
$fromName = $_REQUEST['from_name'];
$fromEmail = $_REQUEST['from_address'];
$date_start = $_REQUEST['date_start'];
$time_start = $_REQUEST['time_start'];
$template_id = $_REQUEST['email_template'];
$dateval = $timedate->merge_date_time($date_start, $time_start);
$listresult = $campaign->db->query($query);
while($list = $campaign->db->fetchByAssoc($listresult))
{
$prospect_list = $list['id'];
$focus = new ProspectList();
$focus->retrieve($prospect_list);
$query = "SELECT prospect_id,contact_id,lead_id FROM prospect_lists_prospects WHERE prospect_list_id='$focus->id' AND deleted=0";
$result = $focus->db->query($query);
while($row = $focus->db->fetchByAssoc($result))
{
$prospect_id = $row['prospect_id'];
$contact_id = $row['contact_id'];
$lead_id = $row['lead_id'];
if($prospect_id <> '')
{
$moduleName = "Prospects";
$moduleID = $row['prospect_id'];
}
if($contact_id <> '')
{
$moduleName = "Contacts";
$moduleID = $row['contact_id'];
}
if($lead_id <> '')
{
$moduleName = "Leads";
$moduleID = $row['lead_id'];
}
$mailer = new EmailMan();
$mailer->module = $moduleName;
$mailer->module_id = $moduleID;
$mailer->user_id = $current_user->id;
$mailer->list_id = $prospect_list;
$mailer->template_id = $template_id;
$mailer->from_name = $fromName;
$mailer->from_email = $fromEmail;
$mailer->send_date_time = $dateval;
$mailer->save();
}
}
$header_URL = "Location: index.php?action=DetailView&module=Campaigns&record={$_REQUEST['record']}";
$GLOBALS['log']->debug("about to post header URL of: $header_URL");
header($header_URL);
?>

View File

@@ -0,0 +1,548 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('include/formbase.php');
require_once('include/utils/db_utils.php');
global $app_list_strings, $app_strings,$mod_strings;
$site_url = $sugar_config['site_url'];
$web_form_header = $mod_strings['LBL_LEAD_DEFAULT_HEADER'];
$web_form_description = $mod_strings['LBL_DESCRIPTION_TEXT_LEAD_FORM'];
$web_form_submit_label = $mod_strings['LBL_DEFAULT_LEAD_SUBMIT'];
$web_form_required_fileds_msg = $mod_strings['LBL_PROVIDE_WEB_TO_LEAD_FORM_FIELDS'];
$web_required_symbol = $app_strings['LBL_REQUIRED_SYMBOL'];
$web_not_valid_email_address = $mod_strings['LBL_NOT_VALID_EMAIL_ADDRESS'];
$web_post_url = $site_url.'/index.php?entryPoint=WebToLeadCapture';
$web_redirect_url = '';
$web_notify_campaign = '';
$web_assigned_user = '';
$web_team_user = '';
$web_form_footer = '';
$regex = "/^\w+(['\.\-\+]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+\$/";
//_ppd($web_required_symbol);
if(!empty($_REQUEST['web_header'])){
$web_form_header= $_REQUEST['web_header'];
}
if(!empty($_REQUEST['web_description'])){
$web_form_description= $_REQUEST['web_description'];
}
if(!empty($_REQUEST['web_submit'])){
$web_form_submit_label=to_html($_REQUEST['web_submit']);
}
if(!empty($_REQUEST['post_url'])){
$web_post_url= $_REQUEST['post_url'];
}
if(!empty($_REQUEST['redirect_url']) && $_REQUEST['redirect_url'] !="http://"){
$web_redirect_url= $_REQUEST['redirect_url'];
}
if(!empty($_REQUEST['notify_campaign'])){
$web_notify_campaign = $_REQUEST['notify_campaign'];
}
if(!empty($_REQUEST['web_footer'])){
$web_form_footer= $_REQUEST['web_footer'];
}
if(!empty($_REQUEST['campaign_id'])){
$web_form_campaign= $_REQUEST['campaign_id'];
}
if(!empty($_REQUEST['assigned_user_id'])){
$web_assigned_user = $_REQUEST['assigned_user_id'];
}
$lead = new Lead();
$fieldsMetaData = new FieldsMetaData();
$xtpl=new XTemplate ('modules/Campaigns/WebToLeadForm.html');
$xtpl->assign("MOD", $mod_strings);
$xtpl->assign("APP", $app_strings);
$Web_To_Lead_Form_html = '';
$Web_To_Lead_Form_html .='<link rel="stylesheet" type="text/css" media="all" href="' . getJSPath(SugarThemeRegistry::current()->getCSSURL('calendar-win2k-cold-1.css')) . '">';
$Web_To_Lead_Form_html .= "<script type=\"text/javascript\" language=\"Javascript\" src='" . getJSPath('include/javascript/sugar_grp1.js') . "'></script>";
$Web_To_Lead_Form_html .= '<script type="text/javascript" src="' . getJSPath('jscalendar/lang/calendar-' . substr($GLOBALS['current_language'], 0, 2) . '.js') . '"></script>';
$Web_To_Lead_Form_html .="<form action='$web_post_url' name='WebToLeadForm' method='POST' id='WebToLeadForm'>";
$Web_To_Lead_Form_html .= "<table width='100%' style='border-top: 1px solid;
border-bottom: 1px solid;
padding: 10px 6px 12px 10px;
background-color: rgb(233, 243, 255);
font-size: 12px;
background-repeat: repeat-x;
background-position: center top;'>";
$Web_To_Lead_Form_html .= "<tr align='center' style='color: rgb(0, 105, 225); font-family: Arial,Verdana,Helvetica,sans-serif; font-size: 18px; font-weight: bold; margin-bottom: 0px; margin-top: 0px;'><TD COLSPAN='4'><b><h2>$web_form_header</h2></b></TD></tr>";
$Web_To_Lead_Form_html .= "<tr align='center' style='color: rgb(0, 105, 225); font-family: Arial,Verdana,Helvetica,sans-serif; font-size: 2px; font-weight: normal; margin-bottom: 0px; margin-top: 0px;'><TD COLSPAN='4'>&nbsp</TD></tr>";
$Web_To_Lead_Form_html .= "<tr align='left' style='color: rgb(0, 105, 225); font-family: Arial,Verdana,Helvetica,sans-serif; font-size: 12px; font-weight: normal; margin-bottom: 0px; margin-top: 0px;'><TD COLSPAN='4'>$web_form_description</TD></tr>";
$Web_To_Lead_Form_html .= "<tr align='center' style='color: rgb(0, 105, 225); font-family: Arial,Verdana,Helvetica,sans-serif; font-size: 8px; font-weight: normal; margin-bottom: 0px; margin-top: 0px;'><TD COLSPAN='4'>&nbsp</TD></tr>";
//$Web_To_Lead_Form_html .= "\n<p>\n";
if(!empty($_REQUEST['colsFirst']) && !empty($_REQUEST['colsSecond'])){
if(count($_REQUEST['colsFirst']) < count($_REQUEST['colsSecond'])){
$columns= count($_REQUEST['colsSecond']);
}
if(count($_REQUEST['colsFirst']) > count($_REQUEST['colsSecond']) || count($_REQUEST['colsFirst']) == count($_REQUEST['colsSecond'])){
$columns= count($_REQUEST['colsFirst']);
}
}
else if(!empty($_REQUEST['colsFirst'])){
$columns= count($_REQUEST['colsFirst']);
}
else if(!empty($_REQUEST['colsSecond'])){
$columns= count($_REQUEST['colsSecond']);
}
$required_fields = array();
$bool_fields = array();
for($i= 0; $i<$columns;$i++){
$colsFirstField = '';
$colsSecondField = '';
if(!empty($_REQUEST['colsFirst'][$i])){
$colsFirstField = $_REQUEST['colsFirst'][$i];
//_pp($_REQUEST['colsFirst']);
}
if(!empty($_REQUEST['colsSecond'][$i])){
$colsSecondField = $_REQUEST['colsSecond'][$i];
//_pp($_REQUEST['colsSecond']);
}
//_pp($lead->field_defs);
if(isset($lead->field_defs[$colsFirstField]) && $lead->field_defs[$colsFirstField] != null)
{
$field_vname = preg_replace('/:$/','',translate($lead->field_defs[$colsFirstField]['vname'],'Leads'));
$field_name = $colsFirstField;
$field_label = $field_vname .": ";
if(isset($lead->field_defs[$colsFirstField]['custom_type']) && $lead->field_defs[$colsFirstField]['custom_type'] != null){
$field_type= $lead->field_defs[$colsFirstField]['custom_type'];
}
else{
$field_type= $lead->field_defs[$colsFirstField]['type'];
}
$field_required = '';
if(isset($lead->field_defs[$colsFirstField]['required']) && $lead->field_defs[$colsFirstField]['required'] != null
&& $lead->field_defs[$colsFirstField]['required'] != 0)
{
$field_required = $lead->field_defs[$colsFirstField]['required'];
if (! in_array($lead->field_defs[$colsFirstField]['name'], $required_fields)){
array_push($required_fields,$lead->field_defs[$colsFirstField]['name']);
}
}
if($lead->field_defs[$colsFirstField]['name']=='last_name'){
if (! in_array($lead->field_defs[$colsFirstField]['name'], $required_fields)){
array_push($required_fields,$lead->field_defs[$colsFirstField]['name']);
}
}
if($field_type=='multienum' || $field_type=='enum' || $field_type=='radioenum') $field_options= $lead->field_defs[$colsFirstField]['options'];
}
//preg_replace('/:$/','',translate($field_def['vname'],'Leads')
if(isset($lead->field_defs[$colsSecondField]) && $lead->field_defs[$colsSecondField] != null)
{
$field1_vname= preg_replace('/:$/','',translate($lead->field_defs[$colsSecondField]['vname'],'Leads'));
$field1_name= $colsSecondField;
$field1_label = $field1_vname .": ";
if(isset($lead->field_defs[$colsSecondField]['custom_type']) && $lead->field_defs[$colsSecondField]['custom_type'] != null){
$field1_type= $lead->field_defs[$colsSecondField]['custom_type'];
}
else{
$field1_type= $lead->field_defs[$colsSecondField]['type'];
}
$field1_required = '';
if(isset($lead->field_defs[$colsSecondField]['required']) && $lead->field_defs[$colsSecondField]['required'] != null
&& $lead->field_defs[$colsSecondField]['required'] != 0){
$field1_required = $lead->field_defs[$colsSecondField]['required'];
if (! in_array($lead->field_defs[$colsSecondField]['name'], $required_fields)){
array_push($required_fields,$lead->field_defs[$colsSecondField]['name']);
}
}
if($lead->field_defs[$colsSecondField]['name']=='last_name'){
if (! in_array($lead->field_defs[$colsSecondField]['name'], $required_fields)){
array_push($required_fields,$lead->field_defs[$colsSecondField]['name']);
}
}
if($field1_type=='multienum' || $field1_type=='enum' || $field1_type=='radioenum') $field1_options= $lead->field_defs[$colsSecondField]['options'];
}
$Web_To_Lead_Form_html .= "<tr>";
if(isset($lead->field_defs[$colsFirstField]) && $lead->field_defs[$colsFirstField] != null){
if($field_type=='multienum' || $field_type=='enum' || $field_type=='radioenum'){
$lead_options = '';
if(!empty($lead->$field_name)){
$lead_options= get_select_options_with_id($app_list_strings[$field_options], unencodeMultienum($lead->$field_name));
}
else{
$lead_options= get_select_options_with_id($app_list_strings[$field_options], '');
}
if($field_required){
$Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field_label</span sugar='slot'><span class='required' style='color: rgb(255, 0, 0);'>$web_required_symbol</span></td>";
}
else{
$Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field_label</span sugar='slot'></td>";
}
if(isset($lead->field_defs[$colsFirstField]['isMultiSelect']) && $lead->field_defs[$colsFirstField]['isMultiSelect'] ==1){
$Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'><select id='{$field_name}[]' multiple='true' name='{$field_name}[]' tabindex='1'>$lead_options</select></span sugar='slot'></td>";
}elseif(ifRadioButton($lead->field_defs[$colsFirstField]['name'])){
$Web_To_Lead_Form_html .="<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'>";
foreach($app_list_strings[$field_options] as $field_option_key => $field_option){
if($field_option != null){
if(!empty($lead->$field_name) && in_array($field_option_key,unencodeMultienum($lead->$field_name))){
$Web_To_Lead_Form_html .="<input id='$colsFirstField"."_$field_option_key' checked name='$colsFirstField' value='$field_option_key' type='radio'>";
} else{
$Web_To_Lead_Form_html .="<input id='$colsFirstField"."_$field_option_key' name='$colsFirstField' value='$field_option_key' type='radio'>";
}
$Web_To_Lead_Form_html .="<span ='document.getElementById('".$lead->field_defs[$colsFirstField]."_$field_option_key').checked =true style='cursor:default'; onmousedown='return false;'>$field_option</span><br>";
}
}
$Web_To_Lead_Form_html .="</span sugar='slot'></td>";
}else{
$Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'><select id=$field_name name=$field_name tabindex='1'>$lead_options</select></span sugar='slot'></td>";
}
}
if($field_type=='bool'){
if($field_required){
$Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field_label</span sugar='slot'><span class='required' style='color: rgb(255, 0, 0);'>$web_required_symbol</span></td>";
}
else{
$Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field_label</span sugar='slot'></td>";
}
$Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'><input type='checkbox' id=$field_name name=$field_name></span sugar='slot'></td>";
if (! in_array($lead->field_defs[$colsFirstField]['name'], $bool_fields)){
array_push($bool_fields,$lead->field_defs[$colsFirstField]['name']);
}
}
if($field_type=='date') {
global $timedate;
$cal_dateformat = $timedate->get_cal_date_format();
$LBL_ENTER_DATE = translate('LBL_ENTER_DATE', 'Charts');
if($field_required){
$Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field_label</span sugar='slot'><span class='required' style='color: rgb(255, 0, 0);'>$web_required_symbol</span></td>";
}
else{
$Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field_label</span sugar='slot'></td>";
}
$Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'><input onblur=\"parseDate(this, '{$cal_dateformat}');\" class=\"text\" name=\"{$field_name}\" size='12' maxlength='10' id='{$field_name}' value=''>
<img src=\"".SugarThemeRegistry::current()->getImageURL('jscalendar.gif')."\" alt=\"{$LBL_ENTER_DATE}\" id=\"{$field_name}_trigger\" align=\"absmiddle\">
<script type='text/javascript'>
Calendar.setup ({
inputField : \"{$field_name}\", ifFormat : \"{$cal_dateformat}\", showsTime : false, button : \"{$field_name}_trigger\", singleClick : true, step : 1, weekNumbers:false
});
</script></span sugar='slot'></td>";
//$Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'><input type='checkbox' id=$field_name name=$field_name></span sugar='slot'></td>";
} // if
if( $field_type=='text' || $field_type=='varchar' || $field_type=='name'
|| $field_type=='phone' || $field_type=='currency'){
if($field_name=='last_name' || $field_required){
$Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field_label</span sugar='slot'><span class='required' style='color: rgb(255, 0, 0);'>$web_required_symbol</span></td>";
}
else{
$Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field_label</span sugar='slot'></td>";
}
$Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'><input id=$field_name name=$field_name type='text'></span sugar='slot'></td>";
}
if($field_type=='relate' && $field_name=='account_name'){
$Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field_label</span sugar='slot'></td>";
$Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'><input id=$field_name name=$field_name type='text'></span sugar='slot'></td>";
}
if($field_type=='email'){
if($field_required){
$Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field_label</span sugar='slot'><span class='required' style='color: rgb(255, 0, 0);'>$web_required_symbol</span></td>";
}
else{
$Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field_label</span sugar='slot'></td>";
}
$Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'><input id=$field_name name=$field_name type='text' onchange='validateEmailAdd();'></span sugar='slot'></td>";
}
}
else{
$Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>&nbsp</span sugar='slot'></td>";
$Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'>&nbsp</span sugar='slot'></td>";
}
if(isset($lead->field_defs[$colsSecondField]) && $lead->field_defs[$colsSecondField] != null){
if($field1_type=='multienum' || $field1_type=='enum' || $field1_type=='radioenum'){
$lead1_options = '';
if(!empty($lead->$field1_name)){
$lead1_options= get_select_options_with_id($app_list_strings[$field1_options], unencodeMultienum($lead->$field1_name));
}
else{
$lead1_options= get_select_options_with_id($app_list_strings[$field1_options], '');
}
if($field1_required){
$Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field1_label</span sugar='slot'><span class='required' style='color: rgb(255, 0, 0);'>$web_required_symbol</span></td>";
}
else{
$Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field1_label</span sugar='slot'></td>";
}
if(isset($lead->field_defs[$colsSecondField]['isMultiSelect']) && $lead->field_defs[$colsSecondField]['isMultiSelect'] ==1){
$Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'><select id='{$field1_name}[]' name='{$field1_name}[]' multiple='true' tabindex='1'>$lead1_options</select></span sugar='slot'></td>";
}elseif(ifRadioButton($lead->field_defs[$colsSecondField]['name'])){
$Web_To_Lead_Form_html .="<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'>";
foreach($app_list_strings[$field1_options] as $field_option_key => $field_option){
if($field_option != null){
if(!empty($lead->$field1_name) && in_array($field_option_key,unencodeMultienum($lead->$field1_name))){
$Web_To_Lead_Form_html .="<input id='$colsSecondField"."_$field_option_key' checked name='$colsSecondField' value='$field_option_key' type='radio'>";
}else{
$Web_To_Lead_Form_html .="<input id='$colsSecondField"."_$field_option_key' name='$colsSecondField' value='$field_option_key' type='radio'>";
}
$Web_To_Lead_Form_html .="<span ='document.getElementById('".$lead->field_defs[$colsSecondField]."_$field_option_key').checked =true style='cursor:default'; onmousedown='return false;'>$field_option</span><br>";
}
}
$Web_To_Lead_Form_html .="</span sugar='slot'></td>";
}else{
$Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'><select id=$field1_name name=$field1_name tabindex='1'>$lead1_options</select></span sugar='slot'></td>";
}
}
if($field1_type=='bool'){
if($field1_required){
$Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field1_label</span sugar='slot'><span class='required' style='color: rgb(255, 0, 0);'>$web_required_symbol</span></td>";
}
else{
$Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field1_label</span sugar='slot'></td>";
}
$Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'><input id=$field1_name name=$field1_name type='checkbox'></span sugar='slot'></td>";
if (! in_array($lead->field_defs[$colsSecondField]['name'], $bool_fields)){
array_push($bool_fields,$lead->field_defs[$colsSecondField]['name']);
}
}
if($field1_type=='date') {
global $timedate;
$cal_dateformat = $timedate->get_cal_date_format();
$LBL_ENTER_DATE = translate('LBL_ENTER_DATE', 'Charts');
if($field1_required){
$Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field1_label</span sugar='slot'><span class='required' style='color: rgb(255, 0, 0);'>$web_required_symbol</span></td>";
}
else{
$Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field1_label</span sugar='slot'></td>";
}
$Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'><input onblur=\"parseDate(this, '{$cal_dateformat}');\" class=\"text\" name=\"{$field1_name}\" size='12' maxlength='10' id='{$field1_name}' value=''>
<img src=\"".SugarThemeRegistry::current()->getImageURL('jscalendar.gif')."\" alt=\"{$LBL_ENTER_DATE}\" id=\"{$field1_name}_trigger\" align=\"absmiddle\">
<script type='text/javascript'>
Calendar.setup ({
inputField : \"{$field1_name}\", ifFormat : \"{$cal_dateformat}\", showsTime : false, button : \"{$field1_name}_trigger\", singleClick : true, step : 1, weekNumbers:false
});
</script></span sugar='slot'></td>";
//$Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'><input type='checkbox' id=$field_name name=$field_name></span sugar='slot'></td>";
} // if
if( $field1_type=='text' || $field1_type=='varchar' || $field1_type=='name'
|| $field1_type=='phone' || $field1_type=='currency'){
if($field1_name=='last_name' || $field1_required){
$Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field1_label</span sugar='slot'><span class='required' style='color: rgb(255, 0, 0);'>$web_required_symbol</span></td>";
}
else{
$Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field1_label</span sugar='slot'></td>";
}
$Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'><input id=$field1_name name=$field1_name type='text'></span sugar='slot'></td>";
}
if($field1_type=='relate' && $field1_name=='account_name'){
$Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field1_label</span sugar='slot'></td>";
$Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'><input id=$field1_name name=$field1_name type='text'></span sugar='slot'></td>";
}
if($field1_type=='email'){
if($field1_required){
$Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field1_label</span sugar='slot'><span class='required' style='color: rgb(255, 0, 0);'>$web_required_symbol</span></td>";
}
else{
$Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>$field1_label</span sugar='slot'></td>";
}
$Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'><input id=$field1_name name=$field1_name type='text' onchange='validateEmailAdd();'></span sugar='slot'></td>";
}
}
else{
$Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>&nbsp</span sugar='slot'></td>";
$Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'>&nbsp</span sugar='slot'></td>";
}
$Web_To_Lead_Form_html .= "</tr>";
}
$Web_To_Lead_Form_html .= "<tr align='center' style='color: rgb(0, 105, 225); font-family: Arial,Verdana,Helvetica,sans-serif; font-size: 18px; font-weight: bold; margin-bottom: 0px; margin-top: 0px;'><TD COLSPAN='4'>&nbsp</TD></tr>";
if(!empty($web_form_footer)){
$Web_To_Lead_Form_html .= "<tr align='center' style='color: rgb(0, 105, 225); font-family: Arial,Verdana,Helvetica,sans-serif; font-size: 18px; font-weight: bold; margin-bottom: 0px; margin-top: 0px;'><TD COLSPAN='4'>&nbsp</TD></tr>";
$Web_To_Lead_Form_html .= "<tr align='left' style='color: rgb(0, 105, 225); font-family: Arial,Verdana,Helvetica,sans-serif; font-size: 12px; font-weight: normal; margin-bottom: 0px; margin-top: 0px;'><TD COLSPAN='4'>$web_form_footer</TD></tr>";
}
$Web_To_Lead_Form_html .= "<tr align='center'><td colspan='10'><input type='button' onclick='submit_form();' class='button' name='Submit' value='$web_form_submit_label'/></td></tr>";
if(!empty($web_form_campaign)){
$Web_To_Lead_Form_html .= "<tr><td style='display: none'><input type='hidden' id='campaign_id' name='campaign_id' value='$web_form_campaign'></td></tr>";
}
if(!empty($web_redirect_url)){
$Web_To_Lead_Form_html .= "<tr><td style='display: none'><input type='hidden' id='redirect_url' name='redirect_url' value='$web_redirect_url'></td></tr>";
}
if(!empty($web_assigned_user)){
$Web_To_Lead_Form_html .= "<tr><td style='display: none'><input type='hidden' id='assigned_user_id' name='assigned_user_id' value='$web_assigned_user'></td></tr>";
}
$req_fields='';
if(isset($required_fields) && $required_fields != null ){
foreach($required_fields as $req){
$req_fields=$req_fields.$req.';';
}
}
$boolean_fields='';
if(isset($bool_fields) && $bool_fields != null ){
foreach($bool_fields as $boo){
$boolean_fields=$boolean_fields.$boo.';';
}
}
if(!empty($req_fields)){
$Web_To_Lead_Form_html .= "<tr><td style='display: none'><input type='hidden' id='req_id' name='req_id' value='$req_fields'></td></tr>";
}
if(!empty($boolean_fields)){
$Web_To_Lead_Form_html .= "<tr><td style='display: none'><input type='hidden' id='bool_id' name='bool_id' value='$boolean_fields'></td></tr>";
}
$Web_To_Lead_Form_html .= "</table >";
$Web_To_Lead_Form_html .="</form>";
$Web_To_Lead_Form_html .="<script type='text/javascript'>
function submit_form(){
if(typeof(validateCaptchaAndSubmit)!='undefined'){
validateCaptchaAndSubmit();
}else{
check_webtolead_fields();
}
}
function check_webtolead_fields(){
if(document.getElementById('bool_id') != null){
var reqs=document.getElementById('bool_id').value;
bools = reqs.substring(0,reqs.lastIndexOf(';'));
var bool_fields = new Array();
var bool_fields = bools.split(';');
nbr_fields = bool_fields.length;
for(var i=0;i<nbr_fields;i++){
if(document.getElementById(bool_fields[i]).value == 'on'){
document.getElementById(bool_fields[i]).value = 1;
}
else{
document.getElementById(bool_fields[i]).value = 0;
}
}
}
if(document.getElementById('req_id') != null){
var reqs=document.getElementById('req_id').value;
reqs = reqs.substring(0,reqs.lastIndexOf(';'));
var req_fields = new Array();
var req_fields = reqs.split(';');
nbr_fields = req_fields.length;
var req = true;
for(var i=0;i<nbr_fields;i++){
if(document.getElementById(req_fields[i]).value.length <=0 || document.getElementById(req_fields[i]).value==0){
req = false;
break;
}
}
if(req){
document.WebToLeadForm.submit();
return true;
}
else{
alert('$web_form_required_fileds_msg');
return false;
}
return false
}
else{
document.WebToLeadForm.submit();
}
}
function validateEmailAdd(){
if(document.getElementById('webtolead_email1').value.length >0) {
if(document.getElementById('webtolead_email1').value.match($regex) == null){
alert('$web_not_valid_email_address');
}
}
if(document.getElementById('webtolead_email2').value.length >0) {
if(document.getElementById('webtolead_email2').value.match($regex) == null){
alert('$web_not_valid_email_address');
}
}
}
</script>";
if(isset($Web_To_Lead_Form_html)) $xtpl->assign("BODY", $Web_To_Lead_Form_html); else $xtpl->assign("BODY", "");
if(isset($Web_To_Lead_Form_html)) $xtpl->assign("BODY_HTML", $Web_To_Lead_Form_html); else $xtpl->assign("BODY_HTML", "");
require_once('include/SugarTinyMCE.php');
$tiny = new SugarTinyMCE();
$tiny->defaultConfig['height']=400;
$tiny->defaultConfig['apply_source_formatting']=true;
$tiny->defaultConfig['cleanup']=false;
$ed = $tiny->getInstance('body_html');
$xtpl->assign("tiny", $ed);
$xtpl->parse("main.textarea");
$xtpl->assign("INSERT_VARIABLE_ONCLICK", "insert_variable_html(document.EditView.variable_text.value)");
$xtpl->parse("main.variable_button");
$xtpl->parse("main");
$xtpl->out("main");
function ifRadioButton($customFieldName){
$custRow = null;
$query="select id,type from fields_meta_data where deleted = 0 and name = '$customFieldName'";
$result=$GLOBALS['db']->query($query);
$row = $GLOBALS['db']->fetchByAssoc($result);
if($row != null && $row['type'] == 'radioenum'){
return $custRow = $row;
}
return $custRow;
}
?>

41
modules/Campaigns/MailMerge.php Executable file
View File

@@ -0,0 +1,41 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$_SESSION['MAILMERGE_MODULE_FROM_LISTVIEW'] = 'Campaigns';
$_SESSION['MAILMERGE_MODULE'] = 'Campaigns';
$_SESSION['MAILMERGE_RECORDS'] = array($_REQUEST['record']);
header('Location: index.php?module=MailMerge&action=index');
?>

115
modules/Campaigns/Menu.php Executable file
View File

@@ -0,0 +1,115 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
global $mod_strings, $app_strings;
if(ACLController::checkAccess('Campaigns', 'edit', true))
$module_menu[] = array(
"index.php?module=Campaigns&action=WizardHome&return_module=Campaigns&return_action=index",
$mod_strings['LNL_NEW_CAMPAIGN_WIZARD'],"CampaignsWizard"
);
if(ACLController::checkAccess('Campaigns', 'edit', true))
$module_menu[]= array(
"index.php?module=Campaigns&action=EditView&return_module=Campaigns&return_action=index",
$mod_strings['LNK_NEW_CAMPAIGN'],"CreateCampaigns"
);
if(ACLController::checkAccess('Campaigns', 'list', true))
$module_menu[]= array(
"index.php?module=Campaigns&action=index&return_module=Campaigns&return_action=index",
$mod_strings['LNK_CAMPAIGN_LIST'],"Campaigns"
);
if(ACLController::checkAccess('Campaigns', 'list', true))
$module_menu[]= array(
"index.php?module=Campaigns&action=newsletterlist&return_module=Campaigns&return_action=index",
$mod_strings['LBL_NEWSLETTERS'], "Newsletters"
);
if(ACLController::checkAccess('ProspectLists', 'edit', true))
$module_menu[]= array(
"index.php?module=ProspectLists&action=EditView&return_module=ProspectLists&return_action=DetailView",
$mod_strings['LNK_NEW_PROSPECT_LIST'],"CreateProspectLists"
);
if(ACLController::checkAccess('ProspectLists', 'list', true))
$module_menu[]= array(
"index.php?module=ProspectLists&action=index&return_module=ProspectLists&return_action=index",
$mod_strings['LNK_PROSPECT_LIST_LIST'],"ProspectLists"
);
if(ACLController::checkAccess('Prospects', 'edit', true))
$module_menu[]= array(
"index.php?module=Prospects&action=EditView&return_module=Prospects&return_action=DetailView",
$mod_strings['LNK_NEW_PROSPECT'],"CreateProspects"
);
if(ACLController::checkAccess('Prospects', 'list', true))
$module_menu[]= array(
"index.php?module=Prospects&action=index&return_module=Prospects&return_action=index",
$mod_strings['LNK_PROSPECT_LIST'],"Prospects"
);
if(ACLController::checkAccess('Prospects', 'import', true))
$module_menu[] = array(
"index.php?module=Import&action=Step1&import_module=Prospects&return_module=Campaigns&return_action=index",
$mod_strings['LBL_IMPORT_PROSPECTS'],"Import"
);
if(ACLController::checkAccess('EmailTemplates', 'edit', true))
$module_menu[] = array(
"index.php?module=EmailTemplates&action=EditView&return_module=EmailTemplates&return_action=DetailView",
$mod_strings['LNK_NEW_EMAIL_TEMPLATE'],"CreateEmails","Emails"
);
if(ACLController::checkAccess('EmailTemplates', 'list', true))
$module_menu[] = array(
"index.php?module=EmailTemplates&action=index",
$mod_strings['LNK_EMAIL_TEMPLATE_LIST'],"EmailFolder", 'Emails'
);
if (is_admin($GLOBALS['current_user']) || is_admin_for_module($GLOBALS['current_user'],'Campaigns'))
$module_menu[] = array(
"index.php?module=Campaigns&action=WizardEmailSetup&return_module=Campaigns&return_action=index",
$mod_strings['LBL_EMAIL_SETUP_WIZARD'],"EmailSetupWizard"
);
if(ACLController::checkAccess('Campaigns', 'edit', true))
$module_menu[] = array(
"index.php?module=Campaigns&action=CampaignDiagnostic&return_module=Campaigns&return_action=index",
$mod_strings['LBL_DIAGNOSTIC_WIZARD'],"EmailDiagnostic"
);
if(ACLController::checkAccess('Campaigns', 'edit', true))
$module_menu[] = array(
"index.php?module=Campaigns&action=WebToLeadCreation&return_module=Campaigns&return_action=index",
$mod_strings['LBL_WEB_TO_LEAD'],"CreateWebToLeadForm"
);

View File

@@ -0,0 +1,70 @@
<!--
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
-->
<!-- BEGIN: main -->
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="edit view">
<tr>
<td>
<form action="index.php" method="post" name="popup_query_form" id="popup_query_form">
<TABLE width="70%" border="1"
summary="This table gives some statistics about fruit
flies: average height and weight, and percentage
with red eyes (for both males and females).">
<td>
<TABLE WIDTH="30%"
<!--<CAPTION>ROI details for the Campaign</CAPTION> -->
<TR><TH ALIGN=LEFT>Planned Budget<TD><TH ALIGN=RIGHT>{PLANNED_BUDGET}{CURRENCY}<TD></BR>
<TR><TH ALIGN=LEFT>Actual Cost<TD><TH ALIGN=RIGHT>{ACTUAL_COST}{CURRENCY}<TD></BR>
<TR><TH ALIGN=LEFT>Expected Revenue<TD><TH ALIGN=RIGHT>{EXPECTED_REVENUE}{CURRENCY}<TD>
<TR><TH ALIGN=LEFT>Opportunities Closed<TD><TH ALIGN=RIGHT>{OPP_COUNT}<TD>
<TR><TH ALIGN=LEFT>Cost per Impression<TD><TH ALIGN=RIGHT>{COST_OF_IMPRESSION}<TD>
<TR><TH ALIGN=LEFT>Cost per Click Through<TD><TH ALIGN=RIGHT>{COST_PER_CLICK_THROUGH}<TD>
</TABLE>
</td>
<td>
<TABLE width="20%"
{MY_CHART_ROI}
</TABLE>
</td>
</TABLE>
</form>
</td>
</tr>
</table>
<!-- END: main -->

View File

@@ -0,0 +1,202 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('include/DetailView/DetailView.php');
require_once('modules/Campaigns/Charts.php');
global $mod_strings;
global $app_strings;
global $app_list_strings;
global $sugar_version, $sugar_config;
/*
echo get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_NEWSLETTER'].": ".$focus->name, true);
*/
global $theme;
$GLOBALS['log']->info("Campaign detail view");
$xtpl=new XTemplate ('modules/Campaigns/PopupCampaignRoi.html');
//_pp($_REQUEST['id']);
$campaign_id=$_REQUEST['id'];
$campaign = new Campaign();
$opp_query1 = "select camp.name, camp.actual_cost,camp.budget,camp.expected_revenue,count(*) opp_count,SUM(opp.amount) as Revenue, SUM(camp.actual_cost) as Investment,
ROUND((SUM(opp.amount) - SUM(camp.actual_cost))/(SUM(camp.actual_cost)), 2)*100 as ROI";
$opp_query1 .= " from opportunities opp";
$opp_query1 .= " right join campaigns camp on camp.id = opp.campaign_id";
$opp_query1 .= " where opp.sales_stage = 'Closed Won' and camp.id='$campaign_id'";
$opp_query1 .= " group by camp.name";
//$opp_query1 .= " and deleted=0";
$opp_result1=$campaign->db->query($opp_query1);
$opp_data1=$campaign->db->fetchByAssoc($opp_result1);
//get the click-throughs
$query_click = "SELECT count(*) hits ";
$query_click.= " FROM campaign_log ";
$query_click.= " WHERE campaign_id = '$campaign_id' AND activity_type='link' AND related_type='CampaignTrackers' AND archived=0 AND deleted=0";
//if $marketing id is specified, then lets filter the chart by the value
if (!empty($marketing_id)){
$query_click.= " AND marketing_id ='$marketing_id'";
}
$query_click.= " GROUP BY activity_type, target_type";
$query_click.= " ORDER BY activity_type, target_type";
$result = $campaign->db->query($query_click);
$xtpl->assign("OPP_COUNT", $opp_data1['opp_count']);
$xtpl->assign("ACTUAL_COST",$opp_data1['actual_cost']);
$xtpl->assign("PLANNED_BUDGET",$opp_data1['budget']);
$xtpl->assign("EXPECTED_REVENUE",$opp_data1['expected_revenue']);
$currency = new Currency();
if(isset($focus->currency_id) && !empty($focus->currency_id))
{
$currency->retrieve($focus->currency_id);
if( $currency->deleted != 1){
$xtpl->assign("CURRENCY", $currency->iso4217 .' '.$currency->symbol );
}else $xtpl->assign("CURRENCY", $currency->getDefaultISO4217() .' '.$currency->getDefaultCurrencySymbol() );
}else{
$xtpl->assign("CURRENCY", $currency->getDefaultISO4217() .' '.$currency->getDefaultCurrencySymbol() );
}
global $current_user;
if(is_admin($current_user) && $_REQUEST['module'] != 'DynamicLayout' && !empty($_SESSION['editinplace'])){
$xtpl->assign("ADMIN_EDIT","<a href='index.php?action=index&module=DynamicLayout&from_action=".$_REQUEST['action'] ."&from_module=".$_REQUEST['module'] ."&record=".$_REQUEST['record']. "'>".SugarThemeRegistry::current()->getImage("EditLayout","border='0' alt='Edit Layout' align='bottom'")."</a>");
}
//$detailView->processListNavigation($xtpl, "CAMPAIGN", $offset, $focus->is_AuditEnabled());
// adding custom fields:
//require_once('modules/DynamicFields/templates/Files/DetailView.php');
/* we need to build the dropdown of related marketing values
$latest_marketing_id = '';
$selected_marketing_id = '';
if(isset($_REQUEST['mkt_id'])) $selected_marketing_id = $_REQUEST['mkt_id'];
$options_str = '<option value="all">--None--</option>';
//query for all email marketing records related to this campaign
$latest_marketing_query = "select id, name, date_modified from email_marketing where campaign_id = '$focus->id' order by date_modified desc";
//build string with value(s) retrieved
$result =$campaign->db->query($latest_marketing_query);
if ($row = $campaign->db->fetchByAssoc($result)){
//first, populated the latest marketing id variable, as this
// variable will be used to build chart and subpanels
$latest_marketing_id = $row['id'];
//fill in first option value
$options_str .= '<option value="'. $row['id'] .'"';
// if the marketing id is same as selected marketing id, set this option to render as "selected"
if (!empty($selected_marketing_id) && $selected_marketing_id == $row['id']) {
$options_str .=' selected>'. $row['name'] .'</option>';
// if the marketing id is empty then set this first option to render as "selected"
}elseif(empty($selected_marketing_id)){
$options_str .=' selected>'. $row['name'] .'</option>';
// if the marketing is not empty, but not same as selected marketing id, then..
//.. do not set this option to render as "selected"
}else{
$options_str .='>'. $row['name'] .'</option>';
}
}
//process rest of records, if they exist
while ($row = $campaign->db->fetchByAssoc($result)){
//add to list of option values
$options_str .= '<option value="'. $row['id'] .'"';
//if the marketing id is same as selected marketing id, then set this option to render as "selected"
if (!empty($selected_marketing_id) && $selected_marketing_id == $row['id']) {
$options_str .=' selected>'. $row['name'] .'</option>';
}else{
$options_str .=' >'. $row['name'] .'</option>';
}
}
//populate the dropdown
$xtpl->assign("MKT_DROP_DOWN",$options_str);
*/
//add chart
$seps = array("-", "/");
$dates = array(date($GLOBALS['timedate']->dbDayFormat), $GLOBALS['timedate']->dbDayFormat);
$dateFileNameSafe = str_replace($seps, "_", $dates);
$cache_file_name_roi = $current_user->getUserPrivGuid()."_campaign_response_by_roi_".$dateFileNameSafe[0]."_".$dateFileNameSafe[1].".xml";
$chart= new campaign_charts();
//ob_start();
//if marketing id has been selected, then set "latest_marketing_id" to the selected value
//latest marketing id will be passed in to filter the charts and subpanels
//_pp($sugar_config['tmp_dir'].$cache_file_name_roi);
if(!empty($selected_marketing_id)){$latest_marketing_id = $selected_marketing_id;}
if(empty($latest_marketing_id) || $latest_marketing_id === 'all'){
$xtpl->assign("MY_CHART_ROI", $chart->campaign_response_roi_popup($app_list_strings['roi_type_dom'],$app_list_strings['roi_type_dom'],$campaign_id,$sugar_config['tmp_dir'].$cache_file_name_roi,true));
}else{
$xtpl->assign("MY_CHART_ROI", $chart->campaign_response_roi_popup($app_list_strings['roi_type_dom'],$app_list_strings['roi_type_dom'],$campaign_id,$sugar_config['tmp_dir'].$cache_file_name_roi,true));
}
//$output_html .= ob_get_contents();
//ob_end_clean();
//_ppd($xtpl);
//end chart
$xtpl->parse("main");
$xtpl->out("main");
?>

View File

@@ -0,0 +1,117 @@
<!--
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
********************************************************************************/
-->
<!-- BEGIN: main -->
<!-- BEGIN: SearchHeader -->
<script type="text/javascript" src="include/JSON.js?s={SUGAR_VERSION}&c={JS_CUSTOM_VERSION}"></script>
<script type="text/javascript" src="include/javascript/popup_helper.js?s={SUGAR_VERSION}&c={JS_CUSTOM_VERSION}"></script>
<table cellpadding="0" cellspacing="0" border="0" width="100%" >
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<form action="index.php" method="post" name="popup_query_form" id="popup_query_form">
<tr>
<td scope="row" nowrap="nowrap">{MOD.LBL_CAMPAIGN_NAME}</td>
<td nowrap="nowrap"><input type="text" size="20" name="name" value="{NAME}" /></td>
<td scope="row" nowrap="nowrap">{MOD.LBL_CAMPAIGN_TYPE}</td>
<td nowrap="nowrap"><select tabindex='1' name='campaign_type'>{TYPE_OPTIONS}</select></td>
<td valign="top" align="right">
<input type="submit" name="button" class="button"
title="{APP.LBL_SEARCH_BUTTON_TITLE}"
accessKey="{APP.LBL_SEARCH_BUTTON_KEY}"
value="{APP.LBL_SEARCH_BUTTON_LABEL}" />
</td>
<td align="right"><input type="hidden" name="action" value="Popup"/>
<input type="hidden" name="query" value="true"/>
<input type="hidden" name="record" value="{RECORD_VALUE}"/>
<input type="hidden" name="module" value="{MODULE_NAME}" />
<input type="hidden" name="form_submit" value="{FORM_SUBMIT}" />
<input type="hidden" name="request_data" value="{request_data}" />
<input type="hidden" name="form" value="{FORM}" />
</form>
</tr>
</table>
</td>
</tr>
</table>
<script type="text/javascript">
<!--
/* initialize the popup request from the parent */
if(window.document.forms['popup_query_form'].request_data.value == "")
{
window.document.forms['popup_query_form'].request_data.value
= JSON.stringify(window.opener.get_popup_request_data());
}
-->
</script>
<!-- END: SearchHeader -->
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="list view">
<!-- BEGIN: list_nav_row -->
{PAGINATION}
<!-- END: list_nav_row -->
<tr height="20" >
<td scope="col" width="5%" nowrap>{CHECKALL}</td>
<td scope="col" width="35%" ><slot><a href="{ORDER_BY}name" class="listViewThLinkS1">{MOD.LBL_CAMPAIGN_NAME}{arrow_start}{name_arrow}{arrow_end}</a></slot></td>
<td scope="col" width="15%" NOWRAP>&nbsp;<slot><a href="{ORDER_BY}status" class="listViewThLinkS1">{MOD.LBL_LIST_STATUS}{arrow_start}{status_arrow}{arrow_end}</a></slot></td>
<td scope="col" width="15%" NOWRAP>&nbsp;<slot><a href="{ORDER_BY}campaign_type" class="listViewThLinkS1">{MOD.LBL_LIST_TYPE}{arrow_start}{campaign_type_arrow}{arrow_end}</a></slot></td>
</tr>
<!-- BEGIN: row -->
<tr height="20" class="{ROW_COLOR}S1">
<td valign="top">{PREROW}</td>
<td scope='row' valign=TOP><slot><{TAG_TYPE} href="#" onclick="send_back('Campaigns','{CAMPAIGN.ID}');">{CAMPAIGN.NAME}</{TAG_TYPE}></slot></td>
<td valign=TOP><slot>{CAMPAIGN.STATUS}</slot></td>
<td valign=TOP><slot>{CAMPAIGN.CAMPAIGN_TYPE}</slot></td>
</tr>
<tr>
<td colspan="20" class="listViewHRS1"></td>
</tr>
<!-- END: row -->
</table>
{ASSOCIATED_JAVASCRIPT_DATA}
<!-- END: main -->

View File

@@ -0,0 +1,175 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
global $theme;
class Popup_Picker
{
/*
*
*/
function Popup_Picker()
{
;
}
/*
*
*/
function _get_where_clause()
{
$where = '';
if(isset($_REQUEST['query']))
{
$where_clauses = array();
append_where_clause($where_clauses, "name", "campaigns.name");
append_where_clause($where_clauses, "campaign_type", "campaign_type");
$where = generate_where_statement($where_clauses);
}
return $where;
}
/**
*
*/
function process_page()
{
global $theme;
global $mod_strings;
global $app_strings;
global $app_list_strings;
global $currentModule;
global $sugar_version, $sugar_config;
$output_html = '';
$where = '';
$where = $this->_get_where_clause();
$name = empty($_REQUEST['name']) ? '' : $_REQUEST['name'];
$status = empty($_REQUEST['status']) ? '' : $_REQUEST['status'];
$campaign_type = empty($_REQUEST['campaign_type']) ? '' : $_REQUEST['campaign_type'];
$request_data = empty($_REQUEST['request_data']) ? '' : $_REQUEST['request_data'];
$hide_clear_button = empty($_REQUEST['hide_clear_button']) ? false : true;
$button = "<form action='index.php' method='post' name='form' id='form'>\n";
//START:FOR MULTI-SELECT
$multi_select=false;
if (!empty($_REQUEST['mode']) && strtoupper($_REQUEST['mode']) == 'MULTISELECT') {
$multi_select=true;
$button .= "<input type='button' name='button' class='button' onclick=\"send_back_selected('Prospects',document.MassUpdate,'mass[]','" .$app_strings['ERR_NOTHING_SELECTED']."');\" title='"
.$app_strings['LBL_SELECT_BUTTON_TITLE']."' accesskey='"
.$app_strings['LBL_SELECT_BUTTON_KEY']."' value=' "
.$app_strings['LBL_SELECT_BUTTON_LABEL']." ' />\n";
}
//END:FOR MULTI-SELECT
if(!$hide_clear_button)
{
$button .= "<input type='button' name='button' class='button' onclick=\"send_back('','');\" title='"
.$app_strings['LBL_CLEAR_BUTTON_TITLE']."' accesskey='"
.$app_strings['LBL_CLEAR_BUTTON_KEY']."' value=' "
.$app_strings['LBL_CLEAR_BUTTON_LABEL']." ' />\n";
}
$button .= "<input type='submit' name='button' class='button' onclick=\"window.close();\" title='"
.$app_strings['LBL_CANCEL_BUTTON_TITLE']."' accesskey='"
.$app_strings['LBL_CANCEL_BUTTON_KEY']."' value=' "
.$app_strings['LBL_CANCEL_BUTTON_LABEL']." ' />\n";
$button .= "</form>\n";
$form = new XTemplate('modules/Campaigns/Popup_picker.html');
$form->assign('MOD', $mod_strings);
$form->assign('APP', $app_strings);
$form->assign('THEME', $theme);
$form->assign('MODULE_NAME', $currentModule);
$form->assign('request_data', $request_data);
$form->assign("TYPE_OPTIONS", get_select_options_with_id($app_list_strings['campaign_type_dom'],""));
ob_start();
insert_popup_header($theme);
$output_html .= ob_get_contents();
ob_end_clean();
$output_html .= get_form_header($mod_strings['LBL_SEARCH_FORM_TITLE'], '', false);
$form->parse('main.SearchHeader');
$output_html .= $form->text('main.SearchHeader');
// Reset the sections that are already in the page so that they do not print again later.
$form->reset('main.SearchHeader');
// create the listview
$seed_bean = new Campaign();
$ListView = new ListView();
$ListView->show_export_button = false;
$ListView->process_for_popups = true;
$ListView->setXTemplate($form);
$ListView->multi_select_popup=$multi_select; //FOR MULTI-SELECT
$ListView->xTemplate->assign("TAG_TYPE","A"); //FOR MULTI-SELECT
$ListView->setHeaderTitle($mod_strings['LBL_LIST_FORM_TITLE']); //FOR MULTI-SELECT
$ListView->setHeaderText($button); //FOR MULTI-SELECT
$ListView->setQuery($where, '', 'name', 'CAMPAIGN');
$ListView->setModStrings($mod_strings);
ob_start();
//$output_html .= get_form_header($mod_strings['LBL_LIST_FORM_TITLE'], $button, false); //FOR MULTI-SELECT
$ListView->processListView($seed_bean, 'main', 'CAMPAIGN');
$output_html .= ob_get_contents();
ob_end_clean();
$output_html .= insert_popup_footer();
return $output_html;
}
} // end of class Popup_Picker
?>

View File

@@ -0,0 +1,126 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description:
********************************************************************************/
//find all mailboxes of type bounce.
function campaign_process_bounced_emails(&$email, &$email_header) {
global $sugar_config;
$emailFromAddress = $email_header->fromaddress;
$email_description = $email->description;
$query1 = "SELECT id, file_mime_type FROM notes WHERE file_mime_type like 'message/r%' and parent_id = '".$email->id."'";
$result1 = $GLOBALS['db']->query($query1);
if (count($result1) > 0) {
$row = $GLOBALS['db']->fetchByAssoc($result1);
$attachId = $row['id'];
if($fp = fopen($sugar_config['upload_dir'].$attachId, 'rb')) {
$contents = fread($fp, filesize($sugar_config['upload_dir'].$attachId));
$emailFromAddress = $emailFromAddress . $contents;
$email_description = $email_description . $contents;
fclose($fp);
}
}
if (preg_match('/MAILER-DAEMON|POSTMASTER/i',$emailFromAddress)) {
//do we have the identifier tag in the email?
$email_description=quoted_printable_decode($email_description);
$matches=array();
if (preg_match('/index.php\?entryPoint=removeme&identifier=[a-z0-9\-]*/',$email_description,$matches)) {
$identifiers=preg_split('/index.php\?entryPoint=removeme&identifier=/',$matches[0],-1,PREG_SPLIT_NO_EMPTY);
if (!empty($identifiers)) {
//array should have only one element in it.
$identifier=trim($identifiers[0]);
if (!class_exists('CampaignLog')) {
}
$targeted = new CampaignLog();
$where="campaign_log.activity_type='targeted' and campaign_log.target_tracker_key='{$identifier}'";
$query=$targeted->create_new_list_query('',$where);
$result=$targeted->db->query($query);
$row=$targeted->db->fetchByAssoc($result);
if (!empty($row)) {
//found entry
//do not create another campaign_log record is we already have an
//invalid email or send error entry for this tracker key.
$query_log = "select * from campaign_log where target_tracker_key='{$row['target_tracker_key']}'";
$query_log .=" and (activity_type='invalid email' or activity_type='send error')";
$result_log=$targeted->db->query($query_log);
$row_log=$targeted->db->fetchByAssoc($result_log);
if (empty($row_log)) {
$bounce = new CampaignLog();
$bounce->campaign_id=$row['campaign_id'];
$bounce->target_tracker_key=$row['target_tracker_key'];
$bounce->target_id= $row['target_id'];
$bounce->target_type=$row['target_type'];
$bounce->list_id=$row['list_id'];
$bounce->marketing_id=$row['marketing_id'];
$bounce->activity_date=$email->date_created;
$bounce->related_type='Emails';
$bounce->related_id= $email->id;
//do we have the phrase permanent error in the email body.
if (preg_match('/permanent[ ]*error/',$email_description)) {
//invalid email address
$bounce->activity_type='invalid email';
} else {
//other -bounced email.
$bounce->activity_type='send error';
}
$return_id=$bounce->save();
}
} else {
$GLOBALS['log']->info("Warning: skipping bounced email with this tracker_key(identifier) in the message body ".$identifier);
}
} else {
//todo mark the email address as invalid. search for prospects/leads/contact associated
//with this email address and set the invalid_email flag... also make email available.
}
} else {
$GLOBALS['log']->info("Warning: skipping bounced email because it does not have the removeme link.");
}
} else {
$GLOBALS['log']->info("Warning: skipping bounced email because the sender is not MAILER-DAEMON.");
}
}
?>

View File

@@ -0,0 +1,211 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: Schedules email for delivery. emailman table holds emails for delivery.
* A cron job polls the emailman table and delivers emails when intended send date time is reached.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
global $timedate;
global $current_user;
global $mod_strings;
$campaign = new Campaign();
$campaign->retrieve($_REQUEST['record']);
$err_messages=array();
$test=false;
if (isset($_REQUEST['mode']) && $_REQUEST['mode'] =='test') {
$test=true;
}
//this is to account for the case of sending directly from summary page in wizards
$from_wiz =false;
if (isset($_REQUEST['wiz_mass'])) {
$mass[] = $_REQUEST['wiz_mass'];
$_POST['mass'] = $mass;
$from_wiz =true;
}
if (isset($_REQUEST['from_wiz'])) {
$from_wiz =true;
}
//if campaign status is 'sending' disallow this step.
if (!empty($campaign->status) && $campaign->status == 'sending') {
$err_messages[]=$mod_strings['ERR_SENDING_NOW'];
}
if ($campaign->db->dbType=='oci8') {
} else {
$current_date= "'".gmdate($GLOBALS['timedate']->get_db_date_time_format())."'";
}
//start scheduling now.....
foreach ($_POST['mass'] as $message_id) {
//fetch email marketing definition.
if (!class_exists('EmailMarketing')) require_once('modules/EmailMarketing/EmailMarketing.php');
$marketing = new EmailMarketing();
$marketing->retrieve($message_id);
//make sure that the marketing message has a mailbox.
//
if (empty($marketing->inbound_email_id)) {
echo "<p>";
echo "<h4>{$mod_strings['ERR_NO_MAILBOX']}</h4>";
echo "<BR><a href='index.php?module=EmailMarketing&action=EditView&record={$marketing->id}'>$marketing->name</a>";
echo "</p>";
sugar_die('');
}
global $timedate;
$mergedvalue=$timedate->merge_date_time($marketing->date_start,$marketing->time_start);
if ($campaign->db->dbType=='oci8') {
} else {
if ($test) {
$send_date_time="'".gmdate($GLOBALS['timedate']->get_db_date_time_format(), mktime() -60) ."'";
} else {
$send_date_time= "'".$timedate->to_db_date($mergedvalue) . ' ' .$timedate->to_db_time($mergedvalue)."'";
}
}
//find all prospect lists associated with this email marketing message.
if ($marketing->all_prospect_lists == 1) {
$query="SELECT prospect_lists.id prospect_list_id from prospect_lists ";
$query.=" INNER JOIN prospect_list_campaigns plc ON plc.prospect_list_id = prospect_lists.id";
$query.=" WHERE plc.campaign_id='{$campaign->id}'";
$query.=" AND prospect_lists.deleted=0";
$query.=" AND plc.deleted=0";
if ($test) {
$query.=" AND prospect_lists.list_type='test'";
} else {
$query.=" AND prospect_lists.list_type!='test' AND prospect_lists.list_type not like 'exempt%'";
}
} else {
$query="select email_marketing_prospect_lists.* FROM email_marketing_prospect_lists ";
$query.=" inner join prospect_lists on prospect_lists.id = email_marketing_prospect_lists.prospect_list_id";
$query.=" WHERE prospect_lists.deleted=0 and email_marketing_id = '$message_id' and email_marketing_prospect_lists.deleted=0";
if ($test) {
$query.=" AND prospect_lists.list_type='test'";
} else {
$query.=" AND prospect_lists.list_type!='test' AND prospect_lists.list_type not like 'exempt%'";
}
}
$result=$campaign->db->query($query);
while (($row=$campaign->db->fetchByAssoc($result))!=null ) {
$prospect_list_id=$row['prospect_list_id'];
//delete all messages for the current campaign and current email marketing message.
$delete_emailman_query="delete from emailman where campaign_id='{$campaign->id}' and marketing_id='{$message_id}' and list_id='{$prospect_list_id}'";
$campaign->db->query($delete_emailman_query);
$insert_query= "INSERT INTO emailman (date_entered, user_id, campaign_id, marketing_id,list_id, related_id, related_type, send_date_time";
if ($campaign->db->dbType=='oci8') {
}
$insert_query.=')';
$insert_query.= " SELECT $current_date,'{$current_user->id}',plc.campaign_id,'{$message_id}',plp.prospect_list_id, plp.related_id, plp.related_type,{$send_date_time} ";
if ($campaign->db->dbType=='oci8') {
}
$insert_query.= "FROM prospect_lists_prospects plp ";
$insert_query.= "INNER JOIN prospect_list_campaigns plc ON plc.prospect_list_id = plp.prospect_list_id ";
$insert_query.= "WHERE plp.prospect_list_id = '{$prospect_list_id}' ";
$insert_query.= "AND plp.deleted=0 ";
$insert_query.= "AND plc.deleted=0 ";
$insert_query.= "AND plc.campaign_id='{$campaign->id}'";
if ($campaign->db->dbType=='oci8') {
}
$campaign->db->query($insert_query);
}
}
//delete all entries from the emailman table that belong to the exempt list.
if (!$test) {
//id based exempt list treatment.
if ($campaign->db->dbType =='mysql') {
$delete_query = "DELETE emailman.* FROM emailman ";
$delete_query.= "INNER JOIN prospect_lists_prospects plp on plp.related_id = emailman.related_id and plp.related_type = emailman.related_type ";
$delete_query.= "INNER JOIN prospect_lists pl ON pl.id = plp.prospect_list_id ";
$delete_query .= "INNER JOIN prospect_list_campaigns plc on plp.prospect_list_id = plc.prospect_list_id ";
$delete_query.= "WHERE plp.deleted=0 ";
$delete_query.= "AND plc.campaign_id = '{$campaign->id}'";
$delete_query.= "AND pl.list_type = 'exempt' ";
$delete_query.= "AND emailman.campaign_id='{$campaign->id}'";
$campaign->db->query($delete_query);
}elseif($campaign->db->dbType =='mssql'){
$delete_query = "DELETE FROM emailman ";
$delete_query .= "WHERE emailman.campaign_id='".$campaign->id."' ";
$delete_query .= "and emailman.related_id in ";
$delete_query .= "(select prospect_lists_prospects.related_id from prospect_lists_prospects where prospect_lists_prospects.prospect_list_id in (select prospect_lists.id from prospect_lists where prospect_lists.list_type = 'exempt' and prospect_lists_prospects.prospect_list_id in(select prospect_list_campaigns.prospect_list_id from prospect_list_campaigns where prospect_list_campaigns.campaign_id = '".$campaign->id."'))) ";
$delete_query .= "and emailman.related_type in ";
$delete_query .= "(select prospect_lists_prospects.related_type from prospect_lists_prospects where prospect_lists_prospects.prospect_list_id in (select prospect_lists.id from prospect_lists where prospect_lists.list_type = 'exempt' and prospect_lists_prospects.prospect_list_id in(select prospect_list_campaigns.prospect_list_id from prospect_list_campaigns where prospect_list_campaigns.campaign_id = '".$campaign->id."'))) ";
$campaign->db->query($delete_query);
}
}
$return_module=isset($_REQUEST['return_module'])?$_REQUEST['return_module']:'Campaigns';
$return_action=isset($_REQUEST['return_action'])?$_REQUEST['return_action']:'DetailView';
$return_id=$_REQUEST['record'];
if ($test) {
//navigate to EmailManDelivery..
$header_URL = "Location: index.php?action=EmailManDelivery&module=EmailMan&campaign_id={$_REQUEST['record']}&return_module={$return_module}&return_action={$return_action}&return_id={$return_id}&mode=test";
if($from_wiz){$header_URL .= "&from_wiz=true";}
} else {
//navigate back to campaign detail view...
$header_URL = "Location: index.php?action={$return_action}&module={$return_module}&record={$return_id}";
if($from_wiz){$header_URL .= "&from=send";}
}
$GLOBALS['log']->debug("about to post header URL of: $header_URL");
header($header_URL);
?>

88
modules/Campaigns/RemoveMe.php Executable file
View File

@@ -0,0 +1,88 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('modules/Campaigns/utils.php');
if (!empty($_REQUEST['remove'])) clean_string($_REQUEST['remove'], "STANDARD");
if (!empty($_REQUEST['from'])) clean_string($_REQUEST['from'], "STANDARD");
if(!empty($_REQUEST['identifier'])) {
$keys=log_campaign_activity($_REQUEST['identifier'],'removed');
global $current_language;
$mod_strings = return_module_language($current_language, 'Campaigns');
global $beanFiles, $beanList;
if (!empty($keys) && $keys['target_type'] == 'Users'){
//Users cannot opt out of receiving emails, print out warning message.
echo $mod_strings['LBL_USERS_CANNOT_OPTOUT'];
}elseif(!empty($keys) && isset($keys['campaign_id']) && !empty($keys['campaign_id'])){
//we need to unsubscribe the user from this particular campaign
$beantype = $beanList[$keys['target_type']];
require_once($beanFiles[$beantype]);
$focus = new $beantype();
$focus->retrieve($keys['target_id']);
unsubscribe($keys['campaign_id'], $focus);
}elseif(!empty($keys)){
$id = $keys['target_id'];
$module = trim($keys['target_type']);
$class = $beanList[$module];
require_once($beanFiles[$class]);
$mod = new $class();
$db = DBManagerFactory::getInstance();
$id = $db->quote($id);
//no opt out for users.
if(preg_match('/^[0-9A-Za-z\-]*$/', $id) && $module != 'Users'){
//record this activity in the campaing log table..
$query = "UPDATE email_addresses SET email_addresses.opt_out = 1 WHERE EXISTS(SELECT 1 FROM email_addr_bean_rel ear WHERE ear.bean_id = '$id' AND ear.deleted=0 AND email_addresses.id = ear.email_address_id)";
$status=$db->query($query);
if($status){
echo "*";
}
}
}
//Print Confirmation Message.
echo $mod_strings['LBL_ELECTED_TO_OPTOUT'];
}
sugar_cleanup();
?>

View File

@@ -0,0 +1,145 @@
<!--
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
********************************************************************************/
-->
<!-- BEGIN: main -->
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<form action="index.php" method="post" name="DetailView" id="form">
<input type="hidden" name="module" value="CampaignLog">
<input type="hidden" name="record" value="{ID}">
<input type="hidden" name="isDuplicate" value=false>
<input type="hidden" name="action">
<input type="hidden" name="return_module">
<input type="hidden" name="return_action">
<input type="hidden" name="return_id" >
<input type="hidden" name="campaign_id" value="{ID}">
<input type="hidden" name="mode" value="">
<input title="{MOD.LBL_TRACK_DELETE_BUTTON_TITLE}" accessKey="{MOD.LBL_TRACK_DELETE_BUTTON_KEY}" class="button" onclick="this.form.module.value='Campaigns'; this.form.action.value='Delete';this.form.return_module.value='Campaigns'; this.form.return_action.value='TrackDetailView';this.form.mode.value='Test';return confirm('{MOD.LBL_TRACK_DELETE_CONFIRM}');" type="submit" name="button" value=" {MOD.LBL_TRACK_DELETE_BUTTON_LABEL} ">
</td>
<td align='right'><span style="{DISABLE_LINK}" >
<input type="button" class="button" onclick="javascript:window.location='index.php?module=Campaigns&action=WizardHome&record={ID}';" value="{MOD.LBL_TO_WIZARD_TITLE}" />
<input type="button" class="button" onclick="javascript:window.location='index.php?module=Campaigns&action=TrackDetailView&record={ID}';" value="{MOD.LBL_TRACK_BUTTON_LABEL}" /></SPAN>{ADMIN_EDIT}
<input type="button" class="button" onclick="javascript:window.location='index.php?module=Campaigns&action=DetailView&record={ID}';" value="{MOD.LBL_TODETAIL_BUTTON_LABEL}" />
</td>
</form>
<td align='right'>{ADMIN_EDIT}</td>
</tr>
</table>
<p>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="detail view">
<tr>
{PAGINATION}
<td width="20%"><slot>{MOD.LBL_NAME}</slot></td>
<td width="30%"><slot>{NAME}</slot></td>
<td width="20%"><slot>{MOD.LBL_ASSIGNED_TO}</slot></td>
<td width="30%"><slot>{ASSIGNED_TO}</slot></td>
</tr><tr>
<td width="20%"><slot>{MOD.LBL_CAMPAIGN_STATUS}</slot></td>
<td width="30%"><slot>{STATUS}</slot></td>
<!-- BEGIN: pro -->
<td width="20%"><slot>{MOD.LBL_TEAM}</slot></td>
<td width="30%"><slot>{TEAM_NAME}</slot></td>
<!-- END: pro -->
<!-- BEGIN: open_source -->
<td width="20%"><slot>&nbsp;</slot></td>
<td width="30%"><slot>&nbsp;</slot></td>
<!-- END: open_source -->
</tr><tr>
<td width="20%"><slot>{MOD.LBL_CAMPAIGN_START_DATE}</slot></td>
<td width="30%"><slot>{START_DATE}</slot></td>
<td ><slot>{APP.LBL_DATE_MODIFIED}&nbsp;</slot></td>
<td ><slot>{DATE_MODIFIED} {APP.LBL_BY} {MODIFIED_BY}</slot></td>
</tr><tr>
<td width="20%"><slot>{MOD.LBL_CAMPAIGN_END_DATE}</slot></td>
<td width="30%"><slot>{END_DATE}</slot></td>
<td ><slot>{APP.LBL_DATE_ENTERED}&nbsp;</slot></td>
<td ><slot>{DATE_ENTERED} {APP.LBL_BY} {CREATED_BY}</slot></td>
</tr><tr>
<td width="20%"><slot>{MOD.LBL_CAMPAIGN_TYPE}</slot></td>
<td width="30%"><slot>{TYPE}</slot></td>
<td width="20%"><slot>&nbsp;</slot></td>
<td width="30%"><slot>&nbsp;</slot></td>
</tr><tr>
<td width="20%"><slot>&nbsp;</slot></td>
<td width="30%"><slot>&nbsp;</slot></td>
<td width="20%"><slot>&nbsp;</slot></td>
<td width="30%"><slot>&nbsp;</slot></td>
</tr><tr>
<td width="20%" nowrap><slot>{MOD.LBL_CAMPAIGN_BUDGET} ({CURRENCY})</slot></td>
<td width="30%"><slot>{BUDGET}</slot></td>
<td width="20%" nowrap><slot>{MOD.LBL_CAMPAIGN_IMPRESSIONS}</slot></td>
<td width="30%" nowrap><slot>{IMPRESSIONS}</slot></td>
</tr><tr>
<td width="20%" nowrap><slot>{MOD.LBL_CAMPAIGN_EXPECTED_COST} ({CURRENCY})</slot></td>
<td width="30%"><slot>{EXPECTED_COST}</slot></td>
<td width="20%" nowrap><slot>{MOD.LBL_CAMPAIGN_OPPORTUNITIES_WON}</slot></td>
<td width="30%"><slot>{OPPORTUNITIES_WON}</slot></td>
</tr><tr>
</tr><tr>
<td width="20%" nowrap><slot>{MOD.LBL_CAMPAIGN_ACTUAL_COST} ({CURRENCY})</slot></td>
<td width="30%"><slot>{ACTUAL_COST}</slot></td>
<td width="20%" nowrap><slot>{MOD.LBL_CAMPAIGN_COST_PER_IMPRESSION} ({CURRENCY})</slot></td>
<td width="30%" nowrap><slot>{COST_PER_IMPRESSION}</slot></td>
</tr><tr>
<td width="20%" nowrap><slot>{MOD.LBL_CAMPAIGN_EXPECTED_REVENUE} ({CURRENCY})</slot></td>
<td width="30%" nowrap><slot>{EXPECTED_REVENUE}</slot></td>
<td width="20%" nowrap><slot>{MOD.LBL_CAMPAIGN_COST_PER_CLICK_THROUGH} ({CURRENCY})</slot></td>
<td width="30%"><slot>{COST_PER_CLICK_THROUGH}</slot></td>
</tr><tr>
<td width="20%"><slot>&nbsp;</slot></td>
<td width="30%"><slot>&nbsp;</slot></td>
<td width="20%"><slot>&nbsp;</slot></td>
<td width="30%"><slot>&nbsp;</slot></td>
</tr>
<!--
<tr>
<td width="20%" valign="top" valign="top"><slot>{MOD.LBL_CAMPAIGN_OBJECTIVE}</slot></td>
<td colspan="3"><slot>{OBJECTIVE}</slot></td>
</tr><tr>
<td width="20%" valign="top" valign="top"><slot>{MOD.LBL_CAMPAIGN_CONTENT}</slot></td>
<td colspan="3"><slot>{CONTENT}</slot></td>
</tr>
-->
</table>
</p>
<div align=center>{MY_CHART_ROI}</div>
<!-- END: main -->

View File

@@ -0,0 +1,205 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('include/DetailView/DetailView.php');
require_once('modules/Campaigns/Charts.php');
global $mod_strings;
global $app_strings;
global $app_list_strings;
global $sugar_version, $sugar_config;
$focus = new Campaign();
$detailView = new DetailView();
$offset = 0;
$offset=0;
if (isset($_REQUEST['offset']) or isset($_REQUEST['record'])) {
$result = $detailView->processSugarBean("CAMPAIGN", $focus, $offset);
if($result == null) {
sugar_die($app_strings['ERROR_NO_RECORD']);
}
$focus=$result;
} else {
header("Location: index.php?module=Accounts&action=index");
}
// For all campaigns show the same ROI interface
// ..else default to legacy detail view
/*
if(!$focus->campaign_type == "NewsLetter"){
include ('modules/Campaigns/NewsLetterTrackDetailView.php');
} else{
*/
echo get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_MODULE_NAME'].": ".$focus->name, true);
$GLOBALS['log']->info("Campaign detail view");
$xtpl=new XTemplate ('modules/Campaigns/RoiDetailView.html');
$xtpl->assign("MOD", $mod_strings);
$xtpl->assign("APP", $app_strings);
$xtpl->assign("THEME", $theme);
$xtpl->assign("GRIDLINE", $gridline);
$xtpl->assign("PRINT_URL", "index.php?".$GLOBALS['request_string']);
$xtpl->assign("ID", $focus->id);
$xtpl->assign("ASSIGNED_TO", $focus->assigned_user_name);
$xtpl->assign("STATUS", $app_list_strings['campaign_status_dom'][$focus->status]);
$xtpl->assign("NAME", $focus->name);
$xtpl->assign("TYPE", $app_list_strings['campaign_type_dom'][$focus->campaign_type]);
$xtpl->assign("START_DATE", $focus->start_date);
$xtpl->assign("END_DATE", $focus->end_date);
$xtpl->assign("BUDGET", $focus->budget);
$xtpl->assign("ACTUAL_COST", $focus->actual_cost);
$xtpl->assign("EXPECTED_COST", $focus->expected_cost);
$xtpl->assign("EXPECTED_REVENUE", $focus->expected_revenue);
$xtpl->assign("OBJECTIVE", nl2br($focus->objective));
$xtpl->assign("CONTENT", nl2br($focus->content));
$xtpl->assign("DATE_MODIFIED", $focus->date_modified);
$xtpl->assign("DATE_ENTERED", $focus->date_entered);
$xtpl->assign("CREATED_BY", $focus->created_by_name);
$xtpl->assign("MODIFIED_BY", $focus->modified_by_name);
$xtpl->assign("TRACKER_URL", $sugar_config['site_url'] . '/campaign_tracker.php?track=' . $focus->tracker_key);
$xtpl->assign("TRACKER_COUNT", intval($focus->tracker_count));
$xtpl->assign("TRACKER_TEXT", $focus->tracker_text);
$xtpl->assign("REFER_URL", $focus->refer_url);
$xtpl->assign("IMPRESSIONS", $focus->impressions);
$roi_vals = array();
$roi_vals['budget']= $focus->budget;
$roi_vals['actual_cost']= $focus->actual_cost;
$roi_vals['Expected_Revenue']= $focus->expected_revenue;
$roi_vals['Expected_Cost']= $focus->expected_cost;
//Query for opportunities won, clickthroughs
$campaign_id = $focus->id;
$opp_query1 = "select camp.name, count(*) opp_count,SUM(opp.amount) as Revenue, SUM(camp.actual_cost) as Investment,
ROUND((SUM(opp.amount) - SUM(camp.actual_cost))/(SUM(camp.actual_cost)), 2)*100 as ROI";
$opp_query1 .= " from opportunities opp";
$opp_query1 .= " right join campaigns camp on camp.id = opp.campaign_id";
$opp_query1 .= " where opp.sales_stage = 'Closed Won' and camp.id='$campaign_id'";
$opp_query1 .= " and opp.deleted=0";
$opp_query1 .= " group by camp.name";
$opp_result1=$focus->db->query($opp_query1);
$opp_data1=$focus->db->fetchByAssoc($opp_result1);
if(empty($opp_data1['opp_count'])) $opp_data1['opp_count']=0;
//_ppd($opp_data1);
$xtpl->assign("OPPORTUNITIES_WON",$opp_data1['opp_count']);
$camp_query1 = "select camp.name, count(*) click_thru_link";
$camp_query1 .= " from campaign_log camp_log";
$camp_query1 .= " right join campaigns camp on camp.id = camp_log.campaign_id";
$camp_query1 .= " where camp_log.activity_type = 'link' and camp.id='$campaign_id'";
$camp_query1 .= " group by camp.name";
$opp_query1 .= " and deleted=0";
$camp_result1=$focus->db->query($camp_query1);
$camp_data1=$focus->db->fetchByAssoc($camp_result1);
if(unformat_number($focus->impressions) > 0){
$cost_per_impression= unformat_number($focus->actual_cost)/unformat_number($focus->impressions);
}
else{
$cost_per_impression = format_number(0);
}
$xtpl->assign("COST_PER_IMPRESSION",currency_format_number($cost_per_impression));
if(empty($camp_data1['click_thru_link'])) $camp_data1['click_thru_link']=0;
$click_thru_links = $camp_data1['click_thru_link'];
if($click_thru_links >0){
$cost_per_click_thru= unformat_number($focus->actual_cost)/unformat_number($click_thru_links);
}
else{
$cost_per_click_thru = format_number(0);
}
$xtpl->assign("COST_PER_CLICK_THROUGH",currency_format_number($cost_per_click_thru));
$currency = new Currency();
if(isset($focus->currency_id) && !empty($focus->currency_id))
{
$currency->retrieve($focus->currency_id);
if( $currency->deleted != 1){
$xtpl->assign("CURRENCY", $currency->iso4217 .' '.$currency->symbol );
}else $xtpl->assign("CURRENCY", $currency->getDefaultISO4217() .' '.$currency->getDefaultCurrencySymbol() );
}else{
$xtpl->assign("CURRENCY", $currency->getDefaultISO4217() .' '.$currency->getDefaultCurrencySymbol() );
}
global $current_user;
if(is_admin($current_user) && $_REQUEST['module'] != 'DynamicLayout' && !empty($_SESSION['editinplace'])){
$xtpl->assign("ADMIN_EDIT","<a href='index.php?action=index&module=DynamicLayout&from_action=".$_REQUEST['action'] ."&from_module=".$_REQUEST['module'] ."&record=".$_REQUEST['record']. "'>".SugarThemeRegistry::current()->getImage("EditLayout","border='0' alt='Edit Layout' align='bottom'")."</a>");
}
$detailView->processListNavigation($xtpl, "CAMPAIGN", $offset, $focus->is_AuditEnabled());
// adding custom fields:
require_once('modules/DynamicFields/templates/Files/DetailView.php');
$xtpl->parse("main.open_source");
//add chart
$seps = array("-", "/");
$dates = array(date($GLOBALS['timedate']->dbDayFormat), $GLOBALS['timedate']->dbDayFormat);
$dateFileNameSafe = str_replace($seps, "_", $dates);
//$cache_file_name = $current_user->getUserPrivGuid()."_campaign_response_by_activity_type_".$dateFileNameSafe[0]."_".$dateFileNameSafe[1].".xml";
$cache_file_name_roi = $current_user->getUserPrivGuid()."_campaign_response_by_roi_".$dateFileNameSafe[0]."_".$dateFileNameSafe[1].".xml";
$chart= new campaign_charts();
//_ppd($roi_vals);
$xtpl->assign("MY_CHART_ROI", $chart->campaign_response_roi($app_list_strings['roi_type_dom'],$app_list_strings['roi_type_dom'],$focus->id,true,true));
//end chart
$xtpl->parse("main");
$xtpl->out("main");
?>

130
modules/Campaigns/Save.php Executable file
View File

@@ -0,0 +1,130 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
$focus = new Campaign();
$focus->retrieve($_POST['record']);
if(!$focus->ACLAccess('Save')){
ACLController::displayNoAccess(true);
sugar_cleanup(true);
}
if (!empty($_POST['assigned_user_id']) && ($focus->assigned_user_id != $_POST['assigned_user_id']) && ($_POST['assigned_user_id'] != $current_user->id)) {
$check_notify = TRUE;
}
else {
$check_notify = FALSE;
}
require_once('include/formbase.php');
$focus = populateFromPost('', $focus);
//store preformatted dates for 2nd save
$preformat_start_date = $focus->start_date;
$preformat_end_date = $focus->end_date;
//_ppd($preformat_end_date);
$focus->save($check_notify);
$return_id = $focus->id;
$GLOBALS['log']->debug("Saved record with id of ".$return_id);
//if type is set to newsletter then make sure there are propsect lists attached
if($focus->campaign_type =='NewsLetter'){
//if this is a duplicate, and the "relate_to" and "relate_id" elements are not cleared out,
//then prospect lists will get related to the original campaign on save of the prospect list, and then
//will get related to the new newsletter campaign, meaning the same (un)subscription list will belong to
//two campaigns, which is wrong
if((isset($_REQUEST['duplicateSave']) && $_REQUEST['duplicateSave']) || (isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate']) ){
$_REQUEST['relate_to'] = '';
$_REQUEST['relate_id'] = '';
}
//add preformatted dates for 2nd save, to avoid formatting conversion errors
$focus->start_date = $preformat_start_date ;
$focus->end_date = $preformat_end_date ;
$focus->load_relationship('prospectlists');
$target_lists = $focus->prospectlists->get();
if(count($target_lists)<1){
global $current_user;
global $mod_strings;
//if no prospect lists are attached, then lets create a subscription and unsubscription
//default prospect lists as these are required for newsletters.
//create subscription list
$subs = new ProspectList();
$subs->name = $focus->name.' '.$mod_strings['LBL_SUBSCRIPTION_LIST'];
$subs->assigned_user_id= $current_user->id;
$subs->list_type = "default";
$subs->save();
$focus->prospectlists->add($subs->id);
//create unsubscription list
$unsubs = new ProspectList();
$unsubs->name = $focus->name.' '.$mod_strings['LBL_UNSUBSCRIPTION_LIST'];
$unsubs->assigned_user_id= $current_user->id;
$unsubs->list_type = "exempt";
$unsubs->save();
$focus->prospectlists->add($unsubs->id);
//create unsubscription list
$test_subs = new ProspectList();
$test_subs->name = $focus->name.' '.$mod_strings['LBL_TEST_LIST'];
$test_subs->assigned_user_id= $current_user->id;
$test_subs->list_type = "test";
$test_subs->save();
$focus->prospectlists->add($test_subs->id);
}
//save new relationships
$focus->save();
}//finish newsletter processing
handleRedirect($focus->id, 'Campaigns');
?>

74
modules/Campaigns/Schedule.html Executable file
View File

@@ -0,0 +1,74 @@
<!--
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
********************************************************************************/
-->
<!-- BEGIN: main -->
<input type="hidden" name="return_module" value="{RETURN_MODULE}"/>
<input type="hidden" name="return_action" value="{RETURN_ACTION}"/>
<input type="hidden" name="return_id" value="{RETURN_ID}"/>
<input type="hidden" name="campaign_id" value="{RETURN_ID}"/>
<input type="hidden" name="mode" value="{MODE}"/>
<p>
<h3>{SCHEDULE_MESSAGE_HEADER}</h3>
<input title="{MOD.LBL_SCHEDULE_BUTTON_TITLE}" accessKey="{MOD.LBL_SCHEDULE_BUTTON_KEY}" class="button" onclick="this.form.module.value='Campaigns';this.form.action.value='QueueCampaign';" type="submit" name="Schedule" value=" {MOD.LBL_SCHEDULE_BUTTON_LABEL} ">
<input title="{APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="this.form.module.value='{RETURN_MODULE}';this.form.action.value='DetailView';this.form.record.value='{RETURN_ID}';" type="submit" name="Schedule" value=" {APP.LBL_CANCEL_BUTTON_LABEL} ">
</p>
<table cellpadding="0" cellspacing="0" width="100%" border="0" class="list view">
<!-- BEGIN: list_nav_row -->
{PAGINATION}
<!-- END: list_nav_row -->
<tr height="20" >
<td scope="col" NOWRAP>{CHECKALL}</td>
<td scope="col" width="40%" NOWRAP><slot>{MOD.LBL_LIST_NAME}</slot></td>
<td scope="col" width="60%" NOWRAP><slot>{MOD.LBL_LIST_PROSPECT_LIST_NAME}</slot></td>
</tr>
<!-- BEGIN: row -->
<tr height="20" class="{ROW_COLOR}S1">
<td>{PREROW}</td>
<td scope="row" valign=TOP ><slot>{EMAILMARKETING.NAME}</slot></td>
<td valign=TOP ><slot>{EMAILMARKETING.PROSPECT_LIST_NAME}</slot></td>
</tr>
<!-- END: row -->
{PAGINATION}
</table>
</form>
<!-- END: main -->

170
modules/Campaigns/Schedule.php Executable file
View File

@@ -0,0 +1,170 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description:
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
$test=false;
//account for case when called from marketing wizard
if(isset($_REQUEST['return_action']) && $_REQUEST['return_action'] == 'WizardMarketing'){
$_POST['return_module'] = $_REQUEST['return_module'];
$_POST['return_action'] = 'TrackDetailView';
$_POST['record'] = $_REQUEST['record'];
}
if (isset($_REQUEST['mode']) && $_REQUEST['mode'] == 'test') {
$test=true;
$_POST['mode'] = 'test';
}
global $app_strings;
global $app_list_strings;
global $current_language;
global $current_user;
global $urlPrefix;
global $currentModule;
$current_module_strings = return_module_language($current_language, 'EmailMarketing');
if ($test) {
echo get_module_title('Campaigns', $current_module_strings['LBL_MODULE_SEND_TEST'], false);
} else {
echo get_module_title('Campaigns', $current_module_strings['LBL_MODULE_SEND_EMAILS'], false);
}
$focus = new EmailMarketing();
if(isset($_REQUEST['record']))
{
// we have a query
if (isset($_REQUEST['record'])) $campaign_id = $_REQUEST['record'];
$where_clauses = Array();
if(isset($campaign_id) && !empty($campaign_id)) array_push($where_clauses, "campaign_id = '".$GLOBALS['db']->quote($campaign_id)."'");
$where = "";
foreach($where_clauses as $clause)
{
if($where != "")
$where .= " and ";
$where .= $clause;
}
$GLOBALS['log']->info("Here is the where clause for the list view: $where");
}
$ListView = new ListView();
$ListView->initNewXTemplate('modules/Campaigns/Schedule.html',$current_module_strings);
if ($test) {
$ListView->xTemplateAssign("SCHEDULE_MESSAGE_HEADER",$current_module_strings['LBL_SCHEDULE_MESSAGE_TEST']);
} else {
$ListView->xTemplateAssign("SCHEDULE_MESSAGE_HEADER",$current_module_strings['LBL_SCHEDULE_MESSAGE_EMAILS']);
}
//force multi-select popup
$ListView->process_for_popups=true;
$ListView->multi_select_popup=true;
//end
$ListView->mergeduplicates = false;
$ListView->show_export_button = false;
$ListView->show_select_menu = false;
$ListView->show_delete_button = false;
$ListView->setDisplayHeaderAndFooter(false);
$ListView->xTemplateAssign("RETURN_MODULE",$_POST['return_module']);
$ListView->xTemplateAssign("RETURN_ACTION",$_POST['return_action']);
$ListView->xTemplateAssign("RETURN_ID",$_POST['record']);
$ListView->setHeaderTitle($current_module_strings['LBL_LIST_FORM_TITLE']);
$ListView->setQuery($where, "", "name", "EMAILMARKETING");
if ($test) {
$ListView->xTemplateAssign("MODE",$_POST['mode']);
//finds all marketing messages that have an association with prospect list of the test.
//this query can be siplified using sub-selects.
$query="select distinct email_marketing.id email_marketing_id from email_marketing ";
$query.=" inner join email_marketing_prospect_lists empl on empl.email_marketing_id = email_marketing.id ";
$query.=" inner join prospect_lists on prospect_lists.id = empl.prospect_list_id ";
$query.=" inner join prospect_list_campaigns plc on plc.prospect_list_id = empl.prospect_list_id ";
$query.=" where empl.deleted=0 ";
$query.=" and prospect_lists.deleted=0 ";
$query.=" and prospect_lists.list_type='test' ";
$query.=" and plc.deleted=0 ";
$query.=" and plc.campaign_id='$campaign_id'";
$query.=" and email_marketing.campaign_id='$campaign_id'";
$query.=" and email_marketing.deleted=0 ";
$query.=" and email_marketing.all_prospect_lists=0 ";
$seed=array();
$result=$focus->db->query($query);
while(($row=$focus->db->fetchByAssoc($result)) != null) {
$bean = new EmailMarketing();
$bean->retrieve($row['email_marketing_id']);
$bean->mode='test';
$seed[]=$bean;
}
$query=" select email_marketing.id email_marketing_id from email_marketing ";
$query.=" WHERE email_marketing.campaign_id='$campaign_id'";
$query.=" and email_marketing.deleted=0 ";
$query.=" and email_marketing.all_prospect_lists=1 ";
$result=$focus->db->query($query);
while(($row=$focus->db->fetchByAssoc($result)) != null) {
$bean = new EmailMarketing();
$bean->retrieve($row['email_marketing_id']);
$bean->mode='test';
$seed[]=$bean;
}
$ListView->processListView($seed, "main", "EMAILMARKETING");
} else {
$ListView->processListView($focus, "main", "EMAILMARKETING");
}
?>

View File

@@ -0,0 +1,102 @@
<!--
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
********************************************************************************/
-->
<!-- BEGIN: main -->
<input type = 'hidden' name='search_tpl' id='search_tpl' value='modules/Campaigns/SearchForm_NewsLetter.html'>
<table cellpadding="0" cellspacing="0" border="0" width="100%" style="border-top: 0px none; margin-bottom: 4px" class="edit view">
<tr><td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td scope="row" noWrap><span sugar='slot1'>{MOD.LBL_CAMPAIGN_NAME}</span sugar='slot'>&nbsp;&nbsp;<span sugar='slot1b'><input type=text size="20" name="name_basic" class=dataField value="{NAME}" /></span sugar='slot'></td>
<td scope="row">{APP.LBL_CURRENT_USER_FILTER}&nbsp;&nbsp;<input name='current_user_only_basic' onchange='this.form.submit();' class="checkbox" type="checkbox" {CURRENT_USER_ONLY}></td>
</tr>
</table>
</td></tr></table>
<input type='hidden' name='campaign_type_basic' value='NewsLetter'>
<!-- END: main -->
<!-- BEGIN: advanced -->
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="border-top: 0px none; margin-bottom: 4px" class="edit view">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20%" scope="row"><span sugar='slot2'>{MOD.LBL_CAMPAIGN_NAME}</span sugar='slot'></td>
<td width="25%" ><span sugar='slot2b'><input name='name' type="text" tabindex='1' size='25' maxlength='50' value="{NAME}"></span sugar='slot'></td>
<td width="20%" scope="row"><span sugar='slot3'>{MOD.LBL_CAMPAIGN_STATUS}</span sugar='slot'></td>
<td width="25%" ><span sugar='slot3b'><select tabindex='2' name='status'>{STATUS_OPTIONS}</select></span sugar='slot'></td>
<tr>
<td scope="row"><span sugar='slot4'>{MOD.LBL_CAMPAIGN_START_DATE}</span sugar='slot'></td>
<td ><span sugar='slot4b'><input name='start_date' onblur="parseDate(this, '{CALENDAR_DATEFORMAT}');" id='search_jscal_field' type="text" tabindex='2' size='11' maxlength='10' value="{START_DATE}"> <img src="index.php?entryPoint=getImage&themeName={THEME}&imageName=jscalendar.gif" alt="{APP.LBL_ENTER_DATE}" id="search_jscal_trigger" align="absmiddle"> <span class="dateFormat">{USER_DATEFORMAT}</span></span sugar='slot'></td>
<td scope="row"><span sugar='slot5'>{MOD.LBL_CAMPAIGN_TYPE}</span sugar='slot'></td>
<td ><span sugar='slot5b'>{MOD.LBL_NEWSLETTER}<input type='hidden' name='campaign_type' value='NewsLetter'></span sugar='slot'></td>
</tr>
<tr>
<td scope="row"><span sugar='slot6'>{MOD.LBL_CAMPAIGN_END_DATE}</span sugar='slot'></td>
<td ><span sugar='slot6b'><input name='end_date' onblur="parseDate(this, '{CALENDAR_DATEFORMAT}');" id='search_enddate_jscal_field' type="text" tabindex='2' size='11' maxlength='10' value="{END_DATE}"> <img src="index.php?entryPoint=getImage&themeName={THEME}&imageName=jscalendar.gif" alt="{APP.LBL_ENTER_DATE}" id="search_enddate_jscal_trigger" align="absmiddle"> <span class="dateFormat">{USER_DATEFORMAT}</span></span sugar='slot'></td>
<td scope="row"><span sugar='slot7'>{APP.LBL_ASSIGNED_TO}</span sugar='slot'></td>
<td ><span sugar='slot7b'><select tabindex='2' size="3" name='assigned_user_id[]' multiple='multiple'>{USER_FILTER}</select></span sugar='slot'></td>
</tr><tr>
<td colspan='6'>&nbsp;</td>
</tr><tr>
<td colspan='6'>
<a onhover href='javascript:toggleInlineSearch()'><img src='{ADVANCED_SEARCH_IMG}' id='up_down_img' border=0> {MOD.LBL_SAVED_SEARCH} </a><br>
<input type='hidden' id='showSSDIV' name='showSSDIV' value='{SHOWSSDIV}'><p>
<div style='{DISPLAYSS}' id='inlineSavedSearch' >
{SAVED_SEARCH}
</div>
</td>
</tr>
</table>
</td></tr></table>
<script type="text/javascript">
Calendar.setup ({
inputField : "search_jscal_field", ifFormat : "{CALENDAR_DATEFORMAT}", showsTime : false, button : "search_jscal_trigger", singleClick : true, step : 1
});
</script>
<script type="text/javascript">
Calendar.setup ({
inputField : "search_enddate_jscal_field", ifFormat : "{CALENDAR_DATEFORMAT}", showsTime : false, button : "search_enddate_jscal_trigger", singleClick : true, step : 1
});
</script>
<!-- END: advanced -->

View File

@@ -0,0 +1,104 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
global $gridline;
global $theme;
global $beanList;
global $beanFiles;
if(empty($_REQUEST['module']))
{
die("'module' was not defined");
}
if(empty($_REQUEST['record']))
{
die("'record' was not defined");
}
if(!isset($beanList[$_REQUEST['module']]))
{
die("'".$_REQUEST['module']."' is not defined in \$beanList");
}
$subpanel = $_REQUEST['subpanel'];
$record = $_REQUEST['record'];
$module = $_REQUEST['module'];
$image_path = 'themes/'.$theme.'/images/';
if(empty($_REQUEST['inline']))
{
insert_popup_header($theme);
}
//require_once('include/SubPanel/SubPanelDefinitions.php');
//require_once($beanFiles[$beanList[$_REQUEST['module']]]);
//$focus=new $beanList[$_REQUEST['module']];
//$focus->retrieve($record);
include('include/SubPanel/SubPanel.php');
$layout_def_key = '';
if(!empty($_REQUEST['layout_def_key'])){
$layout_def_key = $_REQUEST['layout_def_key'];
}
$subpanel_object = new SubPanel($module, $record, $subpanel,null, $layout_def_key);
$subpanel_object->setTemplateFile('include/SubPanel/SubPanelDynamic.html');
if(!empty($_REQUEST['mkt_id']) && $_REQUEST['mkt_id'] != 'all') {// bug 32910
$mkt_id = $_REQUEST['mkt_id'];
}
if(!empty($mkt_id)) {
$subpanel_object->subpanel_defs->_instance_properties['function_parameters']['EMAIL_MARKETING_ID_VALUE'] = $mkt_id;
}
echo (empty($_REQUEST['inline']))?$subpanel_object->get_buttons():'' ;
$subpanel_object->display();
if(empty($_REQUEST['inline']))
{
insert_popup_footer($theme);
}
?>

View File

@@ -0,0 +1,116 @@
<!--
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* {APP.LBL_CURRENCY_SYM}Header: /cvsroot/sugarcrm/sugarcrm/modules/Contacts/EditView.html,v 1.22 2004/07/16 04:04:42 sugarclint Exp {APP.LBL_CURRENCY_SYM}
********************************************************************************/
-->
<!-- BEGIN: main -->
<span>
<form enctype="multipart/form-data" id="SubsForm" name="SubsForm" method="POST" action="index.php">
<input type="hidden" name="module" value="Campaigns">
<input type="hidden" name="action" value="Subscriptions">
<input type="hidden" name="return_module" value="{RETURN_MODULE}">
<input type="hidden" name="return_id" value="{RETURN_ID}">
<input type="hidden" name="return_action" value="{RETURN_ACTION}">
<input type="hidden" name="record" value="{RECORD}">
<input type="hidden" name="subs_action" value="process">
<input type="hidden" name="orig_grid0values" id="orig_grid0values" value="{ORIG_SUBS_VALUES}">
<input type="hidden" name="grid0values" id="grid0values" value="">
<input type="hidden" name="orig_grid1values" id="orig_grid1values" value="{ORIG_UNSUBS_VALUES}">
<input type="hidden" name="grid1values" id="grid1values" value="">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="edit view">
<tr>
<td>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<th align="left" scope="row" colspan="4"><h4 class="">{APP.LBL_MANAGE_SUBSCRIPTIONS_FOR}{FOCUS_NAME}</h4></th>
</tr>
<tr><td>&nbsp;</td></tr>
<td>
<table align="center" border="0" cellpadding="0" cellspacing="0" width='350'>
<tbody><tr><td align="center">
{DRAG_DROP_CHOOSER}
</td></tr></tbody></table>
</td>
</tr>
</table>
</td>
</tr>
<tr><td>&nbsp;</td></tr>
<tr><td>
<input type='submit' class='button' onclick='checkSubs();' value='{APP.LBL_SAVE_BUTTON_LABEL}'>
<input title="{APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="this.form.action.value='{RETURN_ACTION}'; this.form.module.value='{RETURN_MODULE}'; this.form.record.value='{RETURN_ID}'" type="submit" name="button" value="{APP.LBL_CANCEL_BUTTON_LABEL}">
</td></tr>
</table></p></form>
<script>
function checkSubs(){
var webFormDiv = document.getElementById('SubsForm');
var grid0values = Array();
var grid1values = Array();
var grid0keys = Array();
var grid1keys = Array();
for(var i=0; i<{CLASSNAME}_grid0.getRecordSet().getLength(); i++){
/*
var webField = document.createElement('input');
webField.setAttribute('id', 'pl'+i);
webField.setAttribute('name',grid3.getDataModel().getRow(i)[0]);
webField.setAttribute('type', 'hidden');
webField.setAttribute('value',grid3.getDataModel().getRow(i)[1]);
webFormDiv.appendChild(webField);
*/
grid0keys[i] = {CLASSNAME}_grid0.getRecord(i).getData()[0];
grid0values[i] = {CLASSNAME}_grid0.getRecord(i).getData()[1];
}
for(var i=0; i<{CLASSNAME}_grid1.getRecordSet().getLength(); i++){
grid1keys[i] = {CLASSNAME}_grid1.getRecord(i).getData()[0];
grid1values[i] = {CLASSNAME}_grid1.getRecord(i).getData()[1];
}
document.getElementById('grid0values').value = grid0values.toString() ;
document.getElementById('grid1values').value = grid1values.toString() ;
}
</script>
<!-- END: main -->

View File

@@ -0,0 +1,241 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('modules/Campaigns/utils.php');
global $mod_strings, $app_list_strings, $app_strings, $current_user, $import_bean_map;
global $import_file_name, $theme;
$focus = 0;
if(isset($_REQUEST['return_module'])){
if($_REQUEST['return_module'] == 'Contacts'){
$focus = new Contact();
}
if($_REQUEST['return_module'] == 'Leads'){
$focus = new Lead();
}
if($_REQUEST['return_module'] == 'Prospects'){
$focus = new Prospect();
}
}
if(isset($_REQUEST['record'])) {
$GLOBALS['log']->debug("In Subscriptions, about to retrieve record: ".$_REQUEST['record']);
$result = $focus->retrieve($_REQUEST['record']);
if($result == null)
{
sugar_die($app_strings['ERROR_NO_RECORD']);
}
}
//echo get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_MODULE_NAME']." ".$mod_strings['LBL_STEP_3_TITLE'], true);
$this->ss->assign("MOD", $mod_strings);
$this->ss->assign("APP", $app_strings);
if(isset($_REQUEST['return_module'])){$this->ss->assign("RETURN_MODULE", $_REQUEST['return_module']);}
if(isset($_REQUEST['return_id'])){$this->ss->assign("RETURN_ID", $_REQUEST['return_id']);}
if(isset($_REQUEST['return_action'])){$this->ss->assign("RETURN_ACTION", $_REQUEST['return_action']);}
if(isset($_REQUEST['record'])){$this->ss->assign("RECORD", $_REQUEST['record']);}
//if subsaction has been set, then process subscriptions
if(isset($_REQUEST['subs_action'])){manageSubscriptions($focus);}
//$title = $GLOBALS['app_strings']['LBL_MANAGE_SUBSCRIPTIONS_FOR'].$focus->name;
$middleText = "<a href='index.php?module={$focus->module_dir}&action=index'>{$focus->module_dir}</a><span class='pointer'>&raquo;</span><a href='index.php?module={$focus->module_dir}&action=DetailView&record={$focus->id}'>{$focus->name}</a><span class='pointer'>&raquo;</span>{$mod_strings['LBL_MANAGE_SUBSCRIPTIONS_TITLE']}";
$title = get_module_title($focus->module_dir, $middleText, true);
$orig_vals_str = printOriginalValues($focus);
$orig_vals_array = constructDDSubscriptionList($focus);
$this->ss->assign('APP', $GLOBALS['app_strings']);
$this->ss->assign('MOD', $GLOBALS['mod_strings']);
$this->ss->assign('title', $title);
$this->ss->assign('enabled_subs', $orig_vals_array[0]);
$this->ss->assign('disabled_subs', $orig_vals_array[1]);
$this->ss->assign('enabled_subs_string', $orig_vals_str[0]);
$this->ss->assign('disabled_subs_string', $orig_vals_str[1]);
echo $this->ss->fetch('modules/Campaigns/Subscriptions.tpl');
/*
*This function constructs Drag and Drop multiselect box of subscriptions for display in manage subscription form
*/
function constructDDSubscriptionList($focus,$classname=''){
require_once("include/templates/TemplateDragDropChooser.php");
global $mod_strings;
$unsubs_arr = '';
$subs_arr = '';
// Lets start by creating the subscription and unsubscription arrays
$subscription_arrays = get_subscription_lists($focus);
$unsubs_arr = $subscription_arrays['unsubscribed'];
$subs_arr = $subscription_arrays['subscribed'];
$comb_array = array();
$comb_array [0] = array();
$comb_array [1] = array();
foreach ($subs_arr as $key=>$val){
$comb_array [0][$val] = $key;
}
foreach ($unsubs_arr as $key=>$val){
$comb_array [1][$val] = $key;
}
return $comb_array ;
}
/*
*This function constructs multiselect box of subscriptions for display in manage subscription form
*/
function printOriginalValues($focus){
global $app_strings;
$unsubs_arr = '';
$subs_arr = '';
$return_arr = '';
// Lets start by creating the subscription and unsubscription arrays
$subscription_arrays = get_subscription_lists($focus);
$unsubs_arr = $subscription_arrays['unsubscribed'];
$subs_arr = $subscription_arrays['subscribed'];
// ORIG_UNSUBS_VALUES
$unsubs_vals = ' ';
$subs_vals = ' ';
foreach($subs_arr as $name => $id){
$subs_vals .= ", $id";
}
$return_arr[]=$subs_vals;
foreach($unsubs_arr as $name => $id){
$unsubs_vals .= ", $id";
}
$return_arr[]=$unsubs_vals;
return $return_arr;
}
/*
* Perform Subscription management work. This function processes selected subscriptions and calls the
* right methods to subscribe or unsubscribe the user
* */
function manageSubscriptions($focus){
//Process Subscription Lists first
//compare current list of subscriptions to original list and see if there are any additions
$orig_subscription_arr = array();
$curr_subscription_arr = array();
//build array of original subscriptions
if(isset($_REQUEST['orig_enabled_values']) && ! empty($_REQUEST['orig_enabled_values'])){
$orig_subscription_arr = explode(",", $_REQUEST['orig_enabled_values']);
$orig_subscription_arr = process_subscriptions($orig_subscription_arr);
}
//build array of current subscriptions
if(isset($_REQUEST['enabled_subs']) && ! empty($_REQUEST['enabled_subs'])){
$curr_subscription_arr = explode(",", $_REQUEST['enabled_subs']);
$curr_subscription_arr = process_subscriptions($curr_subscription_arr);
}
//compare both arrays and find differences
$i=0;
while($i<(count($curr_subscription_arr)/2)){
//if current subscription existed in original subscription list, do nothing
if(in_array($curr_subscription_arr['campaign'.$i], $orig_subscription_arr)){
//nothing to process
}else{
//current subscription is new, so subscribe
subscribe($curr_subscription_arr['campaign'.$i], $curr_subscription_arr['prospect_list'.$i], $focus);
}
$i = $i +1;
}
//Now process UnSubscription Lists first
//compare current list of subscriptions to original list and see if there are any additions
$orig_unsubscription_arr = array();
$curr_unsubscription_arr = array();
//build array of original subscriptions
if(isset($_REQUEST['orig_disabled_values']) && ! empty($_REQUEST['orig_disabled_values'])){
$orig_unsubscription_arr = explode(",", $_REQUEST['orig_disabled_values']);
$orig_unsubscription_arr = process_subscriptions($orig_unsubscription_arr);
}
//build array of current subscriptions
if(isset($_REQUEST['disabled_subs']) && ! empty($_REQUEST['disabled_subs'])){
$curr_unsubscription_arr = explode(",", $_REQUEST['disabled_subs']);
$curr_unsubscription_arr = process_subscriptions($curr_unsubscription_arr);
}
//compare both arrays and find differences
$i=0;
while($i<(count($curr_unsubscription_arr)/2)){
//if current subscription existed in original subscription list, do nothing
if(in_array($curr_unsubscription_arr['campaign'.$i], $orig_unsubscription_arr)){
//nothing to process
}else{
//current subscription is new, so subscribe
unsubscribe($curr_unsubscription_arr['campaign'.$i], $focus);
}
$i = $i +1;
}
}
?>

View File

@@ -0,0 +1,294 @@
{*
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
*}
<link rel="stylesheet" type="text/css" href="{sugar_getjspath file='modules/Connectors/tpls/tabs.css'}"/>
<!-- begin includes for overlib -->
<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000"></div>
<script type="text/javascript" src="{sugar_getjspath file='include/javascript/sugar_grp_overlib.js'}"></script>
<!-- end includes for overlib -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td colspan='100'><h2>{$title}</h2></td></tr>
<tr><td colspan='100'>
{$description}
</td></tr><tr><td><br></td></tr><tr><td colspan='100'>
<form name="ConfigureSubs" method="POST" method="POST" action="index.php">
<form enctype="multipart/form-data" id="SubsForm" name="SubsForm" method="POST" action="index.php">
<input type="hidden" name="module" value="Campaigns">
<input type="hidden" name="action" value="Subscriptions">
<input type="hidden" name="enabled_subs" value="">
<input type="hidden" name="disabled_subs" value="">
<input type="hidden" name="return_module" value="{$RETURN_MODULE}">
<input type="hidden" name="return_action" value="{$RETURN_ACTION}">
<input type="hidden" name="module_tab" value="{$smarty.request.module_tab}">
<input type="hidden" name="orig_disabled_values" id="orig_disabled_values" value="{$disabled_subs_string}">
<input type="hidden" name="orig_enabled_values" id="orig_enabled_values" value="{$enabled_subs_string}">
<input type="hidden" name="record" value="{$RECORD}">
<input type="hidden" name="subs_action" value="process">
<table border="0" cellspacing="1" cellpadding="1">
<tr>
<td>
<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button" onclick="save();this.form.action.value='Subscriptions'; " type="submit" name="button" value=" {$APP.LBL_SAVE_BUTTON_LABEL} " >
<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="this.form.action.value='{$RETURN_ACTION}'; this.form.module.value='{$RETURN_MODULE}';" type="submit" name="button" value=" {$APP.LBL_CANCEL_BUTTON_LABEL} ">
</td>
</tr>
</table>
<div class='add_table' style='margin-bottom:5px'>
<table id="ConfigureSubs" class="themeSettings edit view" style='margin-bottom:0px;' border="0" cellspacing="0" cellpadding="0">
<tr>
<td><span><b>{$MOD.LBL_ALREADY_SUBSCRIBED_HEADER}</b></span></td>
<td><span><b>{$MOD.LBL_UNSUBSCRIBED_HEADER}</b>
<img border="0" src="{sugar_getimagepath file='helpInline.gif'}"
onmouseover="return overlib('{$MOD.LBL_UNSUBSCRIBED_HEADER_EXPL}', FGCLASS, 'olFgClass', CGCLASS, 'olCgClass', BGCLASS, 'olBgClass', TEXTFONTCLASS, 'olFontClass', CAPTIONFONTCLASS, 'olCapFontClass', CLOSEFONTCLASS, 'olCloseFontClass' );" onmouseout="return nd();" >
</span></td>
</tr>
<tr>
<td width='1%'>
<div id="enabled_div" class="enabled_tab_workarea">
<ul id="enabled_ul" class="module_draglist">
{foreach from=$enabled_subs key=dirname item=name}
<li id="{$dirname}" class="noBullet2">{$name}</li>
{/foreach}
</ul>
</div>
</td>
<td>
<div id="disabled_div" class="disabled_tab_workarea">
<ul id="disabled_ul" class="module_draglist">
{foreach from=$disabled_subs key=dirname item=name}
<li id="{$dirname}" class="noBullet2">{$name}</li>
{/foreach}
</ul>
</div>
</td>
</tr>
</table>
</div>
<table border="0" cellspacing="1" cellpadding="1">
<tr>
<td>
<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button" onclick="save();this.form.action.value='Subscriptions'; " type="submit" name="button" value=" {$APP.LBL_SAVE_BUTTON_LABEL} " >
<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="this.form.action.value='{$RETURN_ACTION}'; this.form.module.value='{$RETURN_MODULE}';" type="submit" name="button" value=" {$APP.LBL_CANCEL_BUTTON_LABEL} ">
</td>
</tr>
</table>
</form>
<script type="text/javascript">
{literal}
var Dom = YAHOO.util.Dom;
var Event = YAHOO.util.Event;
var DDM = YAHOO.util.DragDropMgr;
function save() {
var enabled_display_vals = '';
var disabled_display_vals = '';
//Get the enabled div elements
var elements = document.getElementById('enabled_div');
//Get the li elements
var enabled_list = YAHOO.util.Dom.getElementsByClassName('noBullet2', 'li', elements);
for(var li in enabled_list) {
if(typeof enabled_list[li] != 'function') {
enabled_display_vals += ',' + enabled_list[li].getAttribute('id');
}
}
document.ConfigureSubs.enabled_subs.value = enabled_display_vals != '' ? enabled_display_vals.substr(1,enabled_display_vals.length) : '';
var elements = document.getElementById('disabled_div');
//Get the li elements
var disabled_list = YAHOO.util.Dom.getElementsByClassName('noBullet2', 'li', elements);
for(var li in disabled_list) {
if(typeof disabled_list[li] != 'function') {
disabled_display_vals += ',' + disabled_list[li].getAttribute('id');
}
}
document.ConfigureSubs.disabled_subs.value = disabled_display_vals != '' ? disabled_display_vals.substr(1,disabled_display_vals.length) : '';
}
(function() {
YAHOO.example.DDApp = {
init: function() {
{/literal}
new YAHOO.util.DDTarget("enabled_ul");
new YAHOO.util.DDTarget("disabled_ul");
{foreach from=$enabled_subs key=module item=moduleDisplay}
{if $module != $currentTheme}new YAHOO.example.DDList("{$module}");{/if}
{/foreach}
{foreach from=$disabled_subs key=module item=moduleDisplay}
new YAHOO.example.DDList("{$module}");
{/foreach}
{literal}
}
};
YAHOO.example.DDList = function(id, sGroup, config) {
YAHOO.example.DDList.superclass.constructor.call(this, id, sGroup, config);
var el = this.getDragEl();
Dom.setStyle(el, "opacity", 0.67);
this.goingUp = false;
this.lastY = 0;
};
YAHOO.extend(YAHOO.example.DDList, YAHOO.util.DDProxy, {
startDrag: function(x, y) {
// make the proxy look like the source element
var dragEl = this.getDragEl();
var clickEl = this.getEl();
Dom.setStyle(clickEl, "visibility", "hidden");
dragEl.innerHTML = clickEl.innerHTML;
Dom.setStyle(dragEl, "color", Dom.getStyle(clickEl, "color"));
Dom.setStyle(dragEl, "backgroundColor", Dom.getStyle(clickEl, "backgroundColor"));
Dom.setStyle(dragEl, "border", "2px solid gray");
},
endDrag: function(e) {
var srcEl = this.getEl();
var proxy = this.getDragEl();
// Show the proxy element and animate it to the src element's location
Dom.setStyle(proxy, "visibility", "");
var a = new YAHOO.util.Motion(
proxy, {
points: {
to: Dom.getXY(srcEl)
}
},
0.2,
YAHOO.util.Easing.easeOut
)
var proxyid = proxy.id;
var thisid = this.id;
// Hide the proxy and show the source element when finished with the animation
a.onComplete.subscribe(function() {
Dom.setStyle(proxyid, "visibility", "hidden");
Dom.setStyle(thisid, "visibility", "");
});
a.animate();
},
onDragDrop: function(e, id) {
// If there is one drop interaction, the li was dropped either on the list,
// or it was dropped on the current location of the source element.
if (DDM.interactionInfo.drop.length === 1) {
// The position of the cursor at the time of the drop (YAHOO.util.Point)
var pt = DDM.interactionInfo.point;
// The region occupied by the source element at the time of the drop
var region = DDM.interactionInfo.sourceRegion;
// Check to see if we are over the source element's location. We will
// append to the bottom of the list once we are sure it was a drop in
// the negative space (the area of the list without any list items)
if (!region.intersect(pt)) {
var destEl = Dom.get(id);
var destDD = DDM.getDDById(id);
destEl.appendChild(this.getEl());
destDD.isEmpty = false;
DDM.refreshCache();
}
}
},
onDrag: function(e) {
// Keep track of the direction of the drag for use during onDragOver
var y = Event.getPageY(e);
if (y < this.lastY) {
this.goingUp = true;
} else if (y > this.lastY) {
this.goingUp = false;
}
this.lastY = y;
},
onDragOver: function(e, id) {
var srcEl = this.getEl();
var destEl = Dom.get(id);
// We are only concerned with list items, we ignore the dragover
// notifications for the list.
if (destEl.nodeName.toLowerCase() == "li") {
var orig_p = srcEl.parentNode;
var p = destEl.parentNode;
if (this.goingUp) {
p.insertBefore(srcEl, destEl); // insert above
} else {
p.insertBefore(srcEl, destEl.nextSibling); // insert below
}
DDM.refreshCache();
}
}
});
Event.onDOMReady(YAHOO.example.DDApp.init, YAHOO.example.DDApp, true);
})();
{/literal}
</script>
<!-- END: main -->

View File

@@ -0,0 +1,171 @@
<!--
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
********************************************************************************/
-->
<!-- BEGIN: main -->
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<form action="index.php" method="post" name="DetailView" id="form">
<input type="hidden" name="module" value="CampaignLog">
<input type="hidden" name="subpanel_parent_module" value="Campaigns">
<input type="hidden" name="record" value="{ID}">
<input type="hidden" name="isDuplicate" value=false>
<input type="hidden" name="action">
<input type="hidden" name="return_module">
<input type="hidden" name="return_action">
<input type="hidden" name="return_id" >
<input type="hidden" name="campaign_id" value="{ID}">
<input type="hidden" name="mode" value="">
{TRACK_DELETE_BUTTON}
</td>
<td align='right'></td>
<td align='right'>
<input type="button" class="button" onclick="javascript:window.location='index.php?module=Campaigns&action=WizardHome&record={ID}';" value="{MOD.LBL_TO_WIZARD_TITLE}" />
<input type="button" class="button" onclick="javascript:window.location='index.php?module=Campaigns&action=DetailView&record={ID}';" value="{MOD.LBL_TODETAIL_BUTTON_LABEL}" />
<span style="{DISABLE_LINK}"><input type="button" class="button" onclick="javascript:window.location='index.php?module=Campaigns&action=RoiDetailView&record={ID}';" value="{MOD.LBL_TRACK_ROI_BUTTON_LABEL}" /></SPAN>{ADMIN_EDIT}
</td>
<td align='right'>{ADMIN_EDIT}</td>
</tr>
</table>
<div class="detail view">
<table width="100%" border="0" cellspacing="{GRIDLINE}" cellpadding="0">
<tr>
{PAGINATION}
<td width="20%" scope="row"><slot>{MOD.LBL_NAME}</slot></td>
<td width="30%"><slot>{NAME}</slot></td>
<td width="20%" scope="row"><slot>{MOD.LBL_ASSIGNED_TO}</slot></td>
<td width="30%"><slot>{ASSIGNED_TO}</slot></td>
</tr><tr>
<td width="20%" scope="row"><slot>{MOD.LBL_CAMPAIGN_STATUS}</slot></td>
<td width="30%"><slot>{STATUS}</slot></td>
<!-- BEGIN: pro -->
<td width="20%" scope="row"><slot>{MOD.LBL_TEAM}</slot></td>
<td width="30%"><slot>{TEAM_NAME}</slot></td>
<!-- END: pro -->
<!-- BEGIN: open_source -->
<td width="20%" scope="row"><slot>&nbsp;</slot></td>
<td width="30%"><slot>&nbsp;</slot></td>
<!-- END: open_source -->
</tr><tr>
<td width="20%" scope="row"><slot>{MOD.LBL_CAMPAIGN_START_DATE}</slot></td>
<td width="30%"><slot>{START_DATE}</slot></td>
<td scope="row"><slot>{APP.LBL_DATE_MODIFIED}&nbsp;</slot></td>
<td><slot>{DATE_MODIFIED} {APP.LBL_BY} {MODIFIED_BY}</slot></td>
</tr><tr>
<td width="20%" scope="row"><slot>{MOD.LBL_CAMPAIGN_END_DATE}</slot></td>
<td width="30%"><slot>{END_DATE}</slot></td>
<td scope="row"><slot>{APP.LBL_DATE_ENTERED}&nbsp;</slot></td>
<td><slot>{DATE_ENTERED} {APP.LBL_BY} {CREATED_BY}</slot></td>
</tr><tr>
<td width="20%" scope="row"><slot>{MOD.LBL_CAMPAIGN_TYPE}</slot></td>
<td width="30%"><slot>{TYPE}</slot></td>
<td width="20%" scope="row"><slot>&nbsp;</slot></td>
<td width="30%"><slot>&nbsp;</slot></td>
</tr><tr>
<td width="20%" scope="row"><slot>&nbsp;</slot></td>
<td width="30%"><slot>&nbsp;</slot></td>
<td width="20%" scope="row"><slot>&nbsp;</slot></td>
<td width="30%"><slot>&nbsp;</slot></td>
</tr><tr>
<td width="20%" nowrap scope="row"><slot>{MOD.LBL_CAMPAIGN_BUDGET} ({CURRENCY})</slot></td>
<td width="30%"><slot>{BUDGET}</slot></td>
<td width="20%" nowrap scope="row"><slot>{MOD.LBL_CAMPAIGN_ACTUAL_COST} ({CURRENCY})</slot></td>
<td width="30%"><slot>{ACTUAL_COST}</slot></td>
</tr><tr>
<td width="20%" nowrap scope="row"><slot>{MOD.LBL_CAMPAIGN_EXPECTED_REVENUE} ({CURRENCY})</slot></td>
<td width="30%" nowrap><slot>{EXPECTED_REVENUE}</slot></td>
<td width="20%" nowrap scope="row"><slot>{MOD.LBL_CAMPAIGN_EXPECTED_COST} ({CURRENCY})</slot></td>
<td width="30%"><slot>{EXPECTED_COST}</slot></td>
</tr><tr>
</tr><tr>
<td width="20%" scope="row"><slot>&nbsp;</slot></td>
<td width="30%"><slot>&nbsp;</slot></td>
<td width="20%" scope="row"><slot>&nbsp;</slot></td>
<td width="30%"><slot>&nbsp;</slot></td>
</tr>
<tr>
<td width="20%" valign="top" scope="row"><slot>{MOD.LBL_CAMPAIGN_OBJECTIVE}</slot></td>
<td colspan="3"><slot>{OBJECTIVE}</slot></td>
</tr><tr>
<td width="20%" valign="top" scope="row"><slot>{MOD.LBL_CAMPAIGN_CONTENT}</slot></td>
<td colspan="3"><slot>{CONTENT}</slot></td>
</tr>
</table>
</div>
<table border='0' width='100%'>
<tr>
<td width="10%">{FILTER_LABEL}</td>
<td width="70%">{MKT_DROP_DOWN}</td>
<td width="20%">&nbsp;</td>
</tr>
<tr>
<td width="10%" >&nbsp;</td>
<td><p align=center>{MY_CHART}</p></td>
<td width="20%">&nbsp;</td>
</tr>
</table>
</form>
<script type="text/javascript" language="javascript">
function re_draw_chart(x){
alert(x.value);
}
var toggle = 0;
function show_more_info(tog){
elem = document.getElementById('more_info');
if (tog == 0){
toggle=1;
elem.style.display = '';
}else{
toggle=0;
elem.style.display = 'none';
}
}
</script>
<!-- END: main -->
<!-- BEGIN: subpanel -->
<script type="text/javascript" src="modules/Campaigns/DetailView.js?s={SUGAR_VERSION}&c={JS_CUSTOM_VERSION}"></script>
<slot>{SUBPANEL}</slot>
<!-- END: subpanel -->

View File

@@ -0,0 +1,265 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('include/DetailView/DetailView.php');
require_once('modules/Campaigns/Charts.php');
global $mod_strings;
global $app_strings;
global $app_list_strings;
global $sugar_version, $sugar_config;
$focus = new Campaign();
$detailView = new DetailView();
$offset = 0;
$offset=0;
if (isset($_REQUEST['offset']) or isset($_REQUEST['record'])) {
$result = $detailView->processSugarBean("CAMPAIGN", $focus, $offset);
if($result == null) {
sugar_die($app_strings['ERROR_NO_RECORD']);
}
$focus=$result;
} else {
header("Location: index.php?module=Accounts&action=index");
}
// if campaign type is set to newsletter, then include newsletter detail view..
// ..else default to legacy detail view
// include ('modules/Campaigns/NewsLetterTrackDetailView.php');
if(isset($focus->campaign_type) && $focus->campaign_type == "NewsLetter"){
echo get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_NEWSLETTER'].": ".$focus->name, true);
} else{
echo get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_MODULE_NAME'].": ".$focus->name, true);
}
$GLOBALS['log']->info("Campaign detail view");
$xtpl=new XTemplate ('modules/Campaigns/TrackDetailView.html');
$xtpl->assign("MOD", $mod_strings);
$xtpl->assign("APP", $app_strings);
$xtpl->assign("GRIDLINE", $gridline);
$xtpl->assign("PRINT_URL", "index.php?".$GLOBALS['request_string']);
$xtpl->assign("ID", $focus->id);
$xtpl->assign("ASSIGNED_TO", $focus->assigned_user_name);
$xtpl->assign("STATUS", $app_list_strings['campaign_status_dom'][$focus->status]);
$xtpl->assign("NAME", $focus->name);
$xtpl->assign("TYPE", $app_list_strings['campaign_type_dom'][$focus->campaign_type]);
$xtpl->assign("START_DATE", $focus->start_date);
$xtpl->assign("END_DATE", $focus->end_date);
$xtpl->assign("BUDGET", $focus->budget);
$xtpl->assign("ACTUAL_COST", $focus->actual_cost);
$xtpl->assign("EXPECTED_COST", $focus->expected_cost);
$xtpl->assign("EXPECTED_REVENUE", $focus->expected_revenue);
$xtpl->assign("OBJECTIVE", nl2br($focus->objective));
$xtpl->assign("CONTENT", nl2br($focus->content));
$xtpl->assign("DATE_MODIFIED", $focus->date_modified);
$xtpl->assign("DATE_ENTERED", $focus->date_entered);
$xtpl->assign("CREATED_BY", $focus->created_by_name);
$xtpl->assign("MODIFIED_BY", $focus->modified_by_name);
$xtpl->assign("TRACKER_URL", $sugar_config['site_url'] . '/campaign_tracker.php?track=' . $focus->tracker_key);
$xtpl->assign("TRACKER_COUNT", intval($focus->tracker_count));
$xtpl->assign("TRACKER_TEXT", $focus->tracker_text);
$xtpl->assign("REFER_URL", $focus->refer_url);
if(isset($focus->campaign_type) && $focus->campaign_type == "Email" || $focus->campaign_type == "NewsLetter") {
$xtpl->assign("TRACK_DELETE_BUTTON","<input title=\"{$mod_strings['LBL_TRACK_DELETE_BUTTON_TITLE']}\" accessKey=\"{$mod_strings['LBL_TRACK_DELETE_BUTTON_KEY']}\" class=\"button\" onclick=\"this.form.module.value='Campaigns'; this.form.action.value='Delete';this.form.return_module.value='Campaigns'; this.form.return_action.value='TrackDetailView';this.form.mode.value='Test';return confirm('{$mod_strings['LBL_TRACK_DELETE_CONFIRM']}');\" type=\"submit\" name=\"button\" value=\" {$mod_strings['LBL_TRACK_DELETE_BUTTON_LABEL']} \">");
}
$currency = new Currency();
if(isset($focus->currency_id) && !empty($focus->currency_id))
{
$currency->retrieve($focus->currency_id);
if( $currency->deleted != 1){
$xtpl->assign("CURRENCY", $currency->iso4217 .' '.$currency->symbol );
}else $xtpl->assign("CURRENCY", $currency->getDefaultISO4217() .' '.$currency->getDefaultCurrencySymbol() );
}else{
$xtpl->assign("CURRENCY", $currency->getDefaultISO4217() .' '.$currency->getDefaultCurrencySymbol() );
}
global $current_user;
if(is_admin($current_user) && $_REQUEST['module'] != 'DynamicLayout' && !empty($_SESSION['editinplace'])){
$xtpl->assign("ADMIN_EDIT","<a href='index.php?action=index&module=DynamicLayout&from_action=".$_REQUEST['action'] ."&from_module=".$_REQUEST['module'] ."&record=".$_REQUEST['record']. "'>".SugarThemeRegistry::current()->getImage("EditLayout","border='0' alt='Edit Layout' align='bottom'")."</a>");
}
$detailView->processListNavigation($xtpl, "CAMPAIGN", $offset, $focus->is_AuditEnabled());
// adding custom fields:
require_once('modules/DynamicFields/templates/Files/DetailView.php');
//if this is a newsletter, we need to build dropdown
$selected_marketing_id = '';
if(isset($focus->campaign_type)){
//we need to build the dropdown of related marketing values
$options_str = "<select onchange= \"this.form.module.value='Campaigns';this.form.action.value='TrackDetailView'; submit()\" name='mkt_id'>";
$latest_marketing_id = '';
if(isset($_REQUEST['mkt_id'])) $selected_marketing_id = $_REQUEST['mkt_id'];
$options_str .= '<option value="all">--None--</option>';
//query for all email marketing records related to this campaign
$latest_marketing_query = "select id, name, date_modified from email_marketing where campaign_id = '$focus->id' order by date_modified desc";
//build string with value(s) retrieved
$result =$focus->db->query($latest_marketing_query);
if ($row = $focus->db->fetchByAssoc($result)){
//first, populated the latest marketing id variable, as this
// variable will be used to build chart and subpanels
if($focus->campaign_type == 'NewsLetter') {
$latest_marketing_id = $row['id'];
}
//fill in first option value
$options_str .= '<option value="'. $row['id'] .'"';
// if the marketing id is same as selected marketing id, set this option to render as "selected"
if (!empty($selected_marketing_id) && $selected_marketing_id == $row['id']) {
$options_str .=' selected>'. $row['name'] .'</option>';
// if the marketing id is empty then set this first option to render as "selected"
}elseif(empty($selected_marketing_id) && $focus->campaign_type == 'NewsLetter'){
$options_str .=' selected>'. $row['name'] .'</option>';
// if the marketing is not empty, but not same as selected marketing id, then..
//.. do not set this option to render as "selected"
}else{
$options_str .='>'. $row['name'] .'</option>';
}
}
//process rest of records, if they exist
while ($row = $focus->db->fetchByAssoc($result)){
//add to list of option values
$options_str .= '<option value="'. $row['id'] .'"';
//if the marketing id is same as selected marketing id, then set this option to render as "selected"
if (!empty($selected_marketing_id) && $selected_marketing_id == $row['id']) {
$options_str .=' selected>'. $row['name'] .'</option>';
}else{
$options_str .=' >'. $row['name'] .'</option>';
}
}
$options_str .="</select>";
//populate the dropdown
$xtpl->assign("FILTER_LABEL", $mod_strings['LBL_FILTER_CHART_BY']);
$xtpl->assign("MKT_DROP_DOWN",$options_str);
}
//add chart
$seps = array("-", "/");
$dates = array(date($GLOBALS['timedate']->dbDayFormat), $GLOBALS['timedate']->dbDayFormat);
$dateFileNameSafe = str_replace($seps, "_", $dates);
$cache_file_name = $current_user->getUserPrivGuid()."_campaign_response_by_activity_type_".$dateFileNameSafe[0]."_".$dateFileNameSafe[1].".xml";
$cache_file_name_roi = $current_user->getUserPrivGuid()."_campaign_response_by_roi_".$dateFileNameSafe[0]."_".$dateFileNameSafe[1].".xml";
$chart= new campaign_charts();
//if marketing id has been selected, then set "latest_marketing_id" to the selected value
//latest marketing id will be passed in to filter the charts and subpanels
if(!empty($selected_marketing_id)){$latest_marketing_id = $selected_marketing_id;}
if(empty($latest_marketing_id) || $latest_marketing_id === 'all'){
$xtpl->assign("MY_CHART", $chart->campaign_response_by_activity_type($app_list_strings['campainglog_activity_type_dom'],$app_list_strings['campainglog_target_type_dom'],$focus->id,$sugar_config['tmp_dir'].$cache_file_name,true));
}else{
$xtpl->assign("MY_CHART", $chart->campaign_response_by_activity_type($app_list_strings['campainglog_activity_type_dom'],$app_list_strings['campainglog_target_type_dom'],$focus->id,$sugar_config['tmp_dir'].$cache_file_name,true,$latest_marketing_id));
}
//end chart
$xtpl->parse("main");
$xtpl->out("main");
require_once('include/SubPanel/SubPanelTiles.php');
$subpanel = new SubPanelTiles($focus, 'Campaigns');
//if latest marketing id is empty, or if it is set to 'all'', then do no filtering, otherwise filter..
//.. out the chart and subpanels by marketing id
if(empty($latest_marketing_id) || $latest_marketing_id === 'all'){
//do nothing, no filtering is needed
}else{
//get array of layout defs
$layoutDefsArr= $subpanel->subpanel_definitions->layout_defs;
//iterate through layout defs for processing of subpanels. If a marketing Id is specified, then we need to...
//.. filter the subpanels by it so they match the chart rendered in code above.
foreach($layoutDefsArr as $subpanels_name => $subpanels){
//process each subpanel definition
foreach($subpanels as $subpane_key => $subpane){
//see if "function_parameters" key exists in subpanel properties array
if (isset($subpane['function_parameters'])){
//if a function_parameters property key exists, then process further
$functionParamsArr = $subpane['function_parameters'];//$panelProperty;
//Check the array of function parameters and see if
//one exists for market value id.
if (isset($functionParamsArr['EMAIL_MARKETING_ID_VALUE'])){
//We found the property, lets fill in the marketing id value...
//.. into the subpanel object, using the keys of the array that..
//.. we used to get to thi property
$subpanel->subpanel_definitions->layout_defs[$subpanels_name][$subpane_key]['function_parameters']['EMAIL_MARKETING_ID_VALUE'] = $latest_marketing_id;
}
}//end if (isset($subpane['function_parameters'])){
}//end foreach($subpanels as $subpane_key => $subpane){
}//_pp($subpanel->subpanel_definitions->layout_defs);
}//end else
$alltabs=$subpanel->subpanel_definitions->get_available_tabs();
if (!empty($alltabs)) {
foreach ($alltabs as $name) {
if ($name == 'prospectlists' || $name=='emailmarketing' || $name == 'tracked_urls') {
$subpanel->subpanel_definitions->exclude_tab($name);
}
}
}
echo $subpanel->display();
?>

91
modules/Campaigns/Tracker.php Executable file
View File

@@ -0,0 +1,91 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: Defines the English language pack for the base application.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
// logic will be added here at a later date to track campaigns
// this script; currently forwards to site_URL variable of $sugar_config
// redirect URL will also be added so specified redirect URL can be used
// additionally, another script using fopen will be used to call this
// script externally
require_once('modules/Campaigns/utils.php');
$GLOBALS['log'] = LoggerManager::getLogger('Campaign Tracker v2');
$db = DBManagerFactory::getInstance();
if(empty($_REQUEST['track'])) {
$track = "";
} else {
$track = $_REQUEST['track'];
}
if(!empty($_REQUEST['identifier'])) {
$keys=log_campaign_activity($_REQUEST['identifier'],'link',true,$track);
}else{
//if this has no identifier, then this is a web/banner campaign
//pass in with id set to string 'BANNER'
$keys=log_campaign_activity('BANNER','link',true,$track);
}
$track = $db->quote($track);
if(preg_match('/^[0-9A-Za-z\-]*$/', $track))
{
$query = "SELECT tracker_url FROM campaign_trkrs WHERE id='$track'";
$res = $db->query($query);
$row = $db->fetchByAssoc($res);
$redirect_URL = $row['tracker_url'];
sugar_cleanup();
header("Location: $redirect_URL");
}
else
{
sugar_cleanup();
}
exit;
?>

View File

@@ -0,0 +1,63 @@
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
var grid2,grid3,grid4,grid3F,grid4F;var add_all_fields=SUGAR.language.get('app_strings','LBL_ADD_ALL_LEAD_FIELDS');var remove_all_fields=SUGAR.language.get('app_strings','LBL_REMOVE_ALL_LEAD_FIELDS');function addGrids(form_name){if(!check_form('WebToLeadCreation')){return false;}
else{grid3=SUGAR_GRID_grid1;grid4=SUGAR_GRID_grid2;var webFormDiv=document.getElementById('webformfields');addCols(grid3,'colsFirst',webFormDiv);addCols(grid4,'colsSecond',webFormDiv);return true;}}
function checkFields(REQUIRED_LEAD_FIELDS,LEAD_SELECT_FIELDS){grid2=SUGAR_GRID_grid0;grid3=SUGAR_GRID_grid1;grid4=SUGAR_GRID_grid2;var reqFields='';for(var i=0;i<grid2.getRecordSet().getLength();i++){if(grid2.getRecord(i).getData()[2]!=null){reqFields=reqFields+grid2.getRecord(i).getData()[0]+', ';}}
if(reqFields){reqFields=reqFields.substring(0,reqFields.lastIndexOf(','));alert(REQUIRED_LEAD_FIELDS+' '+reqFields);return false;}
else if(grid3.getRecordSet().getLength()==1&&grid4.getRecordSet().getLength()==1){alert(LEAD_SELECT_FIELDS);return false;}
else{return true;}}
function askLeadQ(direction,REQUIRED_LEAD_FIELDS,LEAD_SELECT_FIELDS){if(direction=='back'){var grid_Div=document.getElementById('grid_Div');var lead_Div=document.getElementById('lead_queries_Div');grid_Div.style.display='block';lead_Div.style.display='none';}
if(direction=='next'){if(!checkFields(REQUIRED_LEAD_FIELDS,LEAD_SELECT_FIELDS)){return false;}
else{var lead_Div=document.getElementById('lead_queries_Div');var grid_Div=document.getElementById('grid_Div');lead_Div.style.display='block';grid_Div.style.display='none';}}}
function campaignPopulated(){var camp_populated=document.getElementById('campaign_id');if(camp_populated.value==0){return true;};return true;}
function selectFields(indexes,grid){var retStr='';for(var i=0;i<indexes.length;i++){retStr=retStr+grid.getRow(indexes[i]).childNodes[0].childNodes[0].innerHTML+','+'\n';retStr=retStr+'\n';}
return retStr.substring(0,retStr.lastIndexOf(','));}
function displayAddRemoveDragButtons(Add_All_Fields,Remove_All_Fields){var addRemove=document.getElementById("lead_add_remove_button");if(grid2.getRecordSet().getLength()==0){addRemove.setAttribute('value',Remove_All_Fields);addRemove.setAttribute('title',Remove_All_Fields);}
else if(grid3.getRecordSet().getLength()==0&&grid4.getRecordSet().getLength()==0){addRemove.setAttribute('value',Add_All_Fields);addRemove.setAttribute('title',Add_All_Fields);}}
function displayAddRemoveButtons(Add_All_Fields,Remove_All_Fields){var addRemove=document.getElementById("lead_add_remove_button");if(grid2.getRecordSet().getLength()>1){addRemove.setAttribute('value',Add_All_Fields);addRemove.setAttribute('title',Add_All_Fields);}
else{addRemove.setAttribute('value',Remove_All_Fields);addRemove.setAttribute('title',Remove_All_Fields);}}
function dragDropAllFields(Add_All_Fields,Remove_All_Fields){grid2=SUGAR_GRID_grid0;grid3=SUGAR_GRID_grid1;grid4=SUGAR_GRID_grid2;var addRemove=document.getElementById("lead_add_remove_button");var availibleSet=grid2.getRecordSet();var availibleCount=availibleSet.getLength();if(addRemove.value==Add_All_Fields&&availibleCount>1){for(var i=0;i<availibleCount;i++){if(i%2==0&&availibleSet.getRecord(i).getData()[0]!=" "){grid3.addRow(availibleSet.getRecord(i).getData(),(i/2));}
if(i%2==1&&availibleSet.getRecord(i).getData()[0]!=" "){grid4.addRow(availibleSet.getRecord(i).getData(),((i-1)/2));}}
for(i=availibleCount-1;i>=0;i--){if(grid2.getRecord(i)!=null&&grid2.getRecord(i).getData()[0]!=" "){grid2.deleteRow(i);}}}
else if(addRemove.value==Remove_All_Fields){var count=0;if(grid3.getRecordSet().getLength()>=grid4.getRecordSet().getLength()){count=grid3.getRecordSet().getLength();}
else{count=grid4.getRecordSet().getLength();}
for(var i=0;i<count;i++){if(grid3.getRecord(i)!=null&&grid3.getRecord(i).getData()[0]!=" "){grid2.addRow(grid3.getRecord(i).getData(),grid2.getRecordSet().getLength()-1);}
if(grid4.getRecord(i)!=null&&grid4.getRecord(i).getData()[0]!=" "){grid2.addRow(grid4.getRecord(i).getData(),grid2.getRecordSet().getLength()-1);}}
for(var i=count-1;i>=0;i--){if(grid4.getRecord(i)!=null&&grid4.getRecord(i).getData()[0]!=" "){grid4.deleteRow(i);}
if(grid3.getRecord(i)!=null&&grid3.getRecord(i).getData()[0]!=" "){grid3.deleteRow(i);}}}
displayAddRemoveButtons(Add_All_Fields,Remove_All_Fields);}
function addCols(grid,colsNumber,webFormDiv){for(var i=0;i<grid.getRecordSet().getLength()-1;i++){var selectedEl=grid.getRecord(i).getData()[1];var webField=document.createElement('input');webField.setAttribute('id',colsNumber+i);webField.setAttribute('name',colsNumber+'[]');webField.setAttribute('type','hidden');webField.setAttribute('value',selectedEl);webFormDiv.appendChild(webField);}}
function editUrl(){var chk_url_elm=document.getElementById("chk_edit_url");if(chk_url_elm.checked==true){var url_elm=document.getElementById("post_url");url_elm.disabled=false;}
if(chk_url_elm.checked==false){var url_elm=document.getElementById("post_url");url_elm.disabled=true;}}

View File

@@ -0,0 +1,167 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('include/formbase.php');
require_once('modules/Leads/LeadFormBase.php');
global $app_strings, $app_list_strings, $sugar_config, $timedate, $current_user;
$mod_strings = return_module_language($sugar_config['default_language'], 'Leads');
$app_list_strings['record_type_module'] = array('Contact'=>'Contacts', 'Account'=>'Accounts', 'Opportunity'=>'Opportunities', 'Case'=>'Cases', 'Note'=>'Notes', 'Call'=>'Calls', 'Email'=>'Emails', 'Meeting'=>'Meetings', 'Task'=>'Tasks', 'Lead'=>'Leads','Bug'=>'Bugs',
);
/**
* To make your changes upgrade safe create a file called leadCapture_override.php and place the changes there
*/
$users = array(
'PUT A RANDOM KEY FROM THE WEBSITE HERE' => array('name'=>'PUT THE USER_NAME HERE', 'pass'=>'PUT THE USER_HASH FOR THE RESPECTIVE USER HERE'),
);
if (isset($_POST['campaign_id']) && !empty($_POST['campaign_id'])) {
//adding the client ip address
$_POST['client_id_address'] = query_client_ip();
$campaign_id=$_POST['campaign_id'];
$campaign = new Campaign();
$camp_query = "select name,id from campaigns where id='$campaign_id'";
$camp_query .= " and deleted=0";
$camp_result=$campaign->db->query($camp_query);
$camp_data=$campaign->db->fetchByAssoc($camp_result);
if (isset($_REQUEST['assigned_user_id']) && !empty($_REQUEST['assigned_user_id'])) {
$current_user = new User();
$current_user->retrieve($_REQUEST['assigned_user_id']);
}
if(isset($camp_data) && $camp_data != null ){
$leadForm = new LeadFormBase();
$lead = new Lead();
$prefix = '';
if(!empty($_POST['prefix'])){
$prefix = $_POST['prefix'];
}
if(empty($lead->id)) {
$lead->id = create_guid();
$lead->new_with_id = true;
}
$lead = $leadForm->handleSave($prefix, false, true, false, $lead);
if(!empty($lead)){
//create campaign log
$camplog = new CampaignLog();
$camplog->campaign_id = $_POST['campaign_id'];
$camplog->related_id = $lead->id;
$camplog->related_type = $lead->module_dir;
$camplog->activity_type = "lead";
$camplog->target_type = $lead->module_dir;
$campaign_log->activity_date=$timedate->to_display_date_time(gmdate($GLOBALS['timedate']->get_db_date_time_format()));
$camplog->target_id = $lead->id;
$camplog->save();
//link campaignlog and lead
if(isset($_POST['webtolead_email1']) && $_POST['webtolead_email1'] != null){
$lead->email1 = $_POST['webtolead_email1'];
}
if(isset($_POST['webtolead_email2']) && $_POST['webtolead_email2'] != null){
$lead->email2 = $_POST['webtolead_email2'];
}
$lead->load_relationship('campaigns');
$lead->campaigns->add($camplog->id);
if(!empty($GLOBALS['check_notify'])) {
$lead->save($GLOBALS['check_notify']);
}
else {
$lead->save(FALSE);
}
}
//in case there are forms out there still using email_opt_out
if(isset($_POST['webtolead_email_opt_out']) || isset($_POST['email_opt_out'])){
if(isset ($lead->email1) && !empty($lead->email1)){
$sea = new SugarEmailAddress();
$sea->AddUpdateEmailAddress($lead->email1,0,1);
}
if(isset ($lead->email2) && !empty($lead->email2)){
$sea = new SugarEmailAddress();
$sea->AddUpdateEmailAddress($lead->email2,0,1);
}
}
if(isset($_POST['redirect_url']) && !empty($_POST['redirect_url'])){
echo '<html><head><title>SugarCRM</title></head><body>';
echo '<form name="redirect" action="' .$_POST['redirect_url']. '" method="GET">';
foreach($_POST as $param => $value) {
if($param != 'redirect_url' ||$param != 'submit') {
echo '<input type="hidden" name="'.$param.'" value="'.$value.'">';
}
}
if(empty($lead)) {
echo '<input type="hidden" name="error" value="1">';
}
echo '</form><script language="javascript" type="text/javascript">document.redirect.submit();</script>';
echo '</body></html>';
}
else{
echo $mod_strings['LBL_THANKS_FOR_SUBMITTING_LEAD'];
}
sugar_cleanup();
// die to keep code from running into redirect case below
die();
}
else{
echo $mod_strings['LBL_SERVER_IS_CURRENTLY_UNAVAILABLE'];
}
}
echo $mod_strings['LBL_SERVER_IS_CURRENTLY_UNAVAILABLE'];
if (!empty($_POST['redirect'])) {
echo '<html><head><title>SugarCRM</title></head><body>';
echo '<form name="redirect" action="' .$_POST['redirect']. '" method="GET">';
echo '</form><script language="javascript" type="text/javascript">document.redirect.submit();</script>';
echo '</body></html>';
}
?>

View File

@@ -0,0 +1,203 @@
<!--
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
********************************************************************************/
-->
<!-- BEGIN: main -->
<script type="text/javascript" src="include/JSON.js?s={SUGAR_VERSION}&c={JS_CUSTOM_VERSION}"></script>
<script type="text/javascript" src="include/javascript/popup_parent_helper.js?s={SUGAR_VERSION}&c={JS_CUSTOM_VERSION}"></script>
<script type="text/javascript" src="modules/Campaigns/WebToLead.js"></script>
<style>
.yui-dt table {
width: 180px;
}
</style>
{JAVASCRIPT}
<form id="WebToLeadCreation" name="WebToLeadCreation" method="POST" action="index.php">
<input type="hidden" name="module" value="Campaigns">
<input type="hidden" name="record" value="{ID}">
<input type="hidden" name="action">
<input type="hidden" name="return_module" value="{RETURN_MODULE}">
<input type="hidden" name="return_id" value="{RETURN_ID}">
<input type="hidden" name="return_action" value="{RETURN_ACTION}">
<div id='grid_Div'>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<!--
<H1>Web To Lead Form generation for Campaign</H1>
-->
<tr>
<td>
{TITLE1}
<br>
<p><b>{MOD.LBL_DRAG_DROP_COLUMNS}</b></p>
</td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td>
<table width="555" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table align="center" border="0" cellpadding="0" cellspacing="0" width='350'>
<tbody><tr><td align="center">
{DRAG_DROP_CHOOSER_WEB_TO_LEAD}
</td></tr></tbody></table>
</td>
</tr>
<tr>
<td colspan='3'>
<div id='webformfields'></div>
</td>
</tr>
</table>
<table width="595" border="0" cellspacing="0" cellpadding="2">
<tr>
<td align="left"><input id="lead_add_remove_button" type='button' title="{APP.LBL_ADD_ALL_LEAD_FIELDS}"
class="button"
onclick="javascript:dragDropAllFields('{APP.LBL_ADD_ALL_LEAD_FIELDS}','{APP.LBL_REMOVE_ALL_LEAD_FIELDS}');"
name="button" value="{APP.LBL_ADD_ALL_LEAD_FIELDS}">
</td>
<td align="right" style="padding-bottom: 2px;"><input title="{APP.LBL_CANCEL_BUTTON_TITLE}"
accessKey="{APP.LBL_CANCEL_BUTTON_KEY}" class="button"
onclick="this.form.action.value='{RETURN_ACTION}'; this.form.module.value='{RETURN_MODULE}'; this.form.record.value='{RETURN_ID}'"
type="submit" name="button" value="{APP.LBL_CANCEL_BUTTON_LABEL}"> <input id="lead_next_button" type='button'
title="{APP.LBL_NEXT_BUTTON_LABEL}" class="button"
onclick="javascript:askLeadQ('next','{MOD.LBL_SELECT_REQUIRED_LEAD_FIELDS}','{MOD.LBL_SELECT_LEAD_FIELDS}');" name="button"
value="{APP.LBL_NEXT_BUTTON_LABEL}">
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div id='lead_queries_Div' style="display: none">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr><td>
{TITLE2}
</td>
</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0" border="0" class="edit view">
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td scope="row" width="20%">{MOD.LBL_DEFINE_LEAD_HEADER}</td>
<td width="80%"><input id="web_header" name="web_header" title="Name" size="60"
value="{MOD.LBL_LEAD_DEFAULT_HEADER}" type="text"></td>
</tr>
<tr>
<td scope="row"><slot>{MOD.LBL_DESCRIPTION_LEAD_FORM}</slot></td>
<td ><slot><textarea tabindex='1' name='web_description' rows='2' cols='55'>{MOD.LBL_DESCRIPTION_TEXT_LEAD_FORM}</textarea></slot></td>
</tr>
<tr>
<td scope="row">{MOD.LBL_DEFINE_LEAD_SUBMIT}</td>
<td ><input id="web_submit" name="web_submit" title="Name" size="60"
value="{MOD.LBL_DEFAULT_LEAD_SUBMIT}" type="text"></td>
</tr>
<tr>
<td scope="row"><slot>{MOD.LBL_DEFINE_LEAD_POST_URL}</slot></td>
<td ><slot><input id="post_url" name="post_url" size="60"
disabled='true' value="{WEB_POST_URL}" type="text"></slot> <input
id="chk_edit_url" name="chk_edit_url" onclick="editUrl();" class='checkbox' type='checkbox'> <class ="dataLabel" width="10%">{MOD.LBL_EDIT_LEAD_POST_URL}
</tr>
</tr>
<tr>
<td scope="row"><slot>{MOD.LBL_DEFINE_LEAD_REDIRECT_URL}</slot></td>
<td ><slot><input id="redirect_url" name="redirect_url" size="60"
value="{REDIRECT_URL_DEFAULT}" type="text"></slot></td>
</tr>
<tr>
<td scope="row"><span sugar='slot40'>{MOD.LBL_LEAD_NOTIFY_CAMPAIGN}</span sugar='slot'><span
class="required">{APP.LBL_REQUIRED_SYMBOL}</span></td>
<td ><span sugar='slot40b'> <input class="sqsEnabled" tabindex="1"
autocomplete="off" id='campaign_name' name='campaign_name' type="text" value="{CAMPAIGN_NAME}" /> <input
id='campaign_id' name='campaign_id' type="hidden" value="{CAMPAIGN_ID}" /> <input
title="{APP.LBL_SELECT_BUTTON_TITLE}" accessKey="{APP.LBL_SELECT_BUTTON_KEY}" type="button" tabindex='1'
class="button" value='{APP.LBL_SELECT_BUTTON_LABEL}' name=btn1
onclick='open_popup("Campaigns", 600, 400, "", true, false,{encoded_campaigns_popup_request_data});' /></span sugar='slot'></td>
</tr>
<tr>
<td scope="row"><span sugar='slot45'>{APP.LBL_ASSIGNED_TO}</span sugar='slot'><span
class="required">{APP.LBL_REQUIRED_SYMBOL}</span></td>
<td ><span sugar='slot45b'><input class="sqsEnabled" tabindex="1" autocomplete="off" id="assigned_user_name" name='assigned_user_name' type="text" value="{ASSIGNED_USER_NAME}"><input id='assigned_user_id' name='assigned_user_id' type="hidden" value="{ASSIGNED_USER_ID}" />
<input title="{APP.LBL_SELECT_BUTTON_TITLE}" accessKey="{APP.LBL_SELECT_BUTTON_KEY}" type="button" tabindex='1' class="button" value='{APP.LBL_SELECT_BUTTON_LABEL}' name=btn1
onclick='open_popup("Users", 600, 400, "", true, false, {encoded_users_popup_request_data});' /></span sugar='slot'>
</td>
</tr>
<!-- BEGIN: open_source -->
<!-- END: open_source -->
<tr>
<td scope="row"><slot>{MOD.LBL_LEAD_FOOTER}</slot></td>
<td ><slot><textarea tabindex='1' name='web_footer' rows='2' cols='55'></textarea></slot></td>
</tr>
</table>
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td align="right" style="padding-bottom: 2px;"><input title="{APP.LBL_BACK}" accessKey="{APP.LBL_BACK}"
class="button" onclick="askLeadQ('back')" type="button" name="button" value="{APP.LBL_BACK}"> <input
title="{APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{APP.LBL_CANCEL_BUTTON_KEY}" class="button"
onclick="this.form.action.value='{RETURN_ACTION}'; this.form.module.value='{RETURN_MODULE}'; this.form.record.value='{RETURN_ID}'"
type="submit" name="button" value="{APP.LBL_CANCEL_BUTTON_LABEL}"> <input
title="{APP.LBL_GENERATE_WEB_TO_LEAD_FORM}" class="button"
onclick="this.form.action.value='GenerateWebToLeadForm';return addGrids('WebToLeadCreation');" type="submit"
name="button" value="{APP.LBL_GENERATE_WEB_TO_LEAD_FORM}"></td>
</tr>
</table>
</div>
</form>
<!-- <div id="ddgrid4" class="ygrid-mso" style="width:250px;height:200px;overflow:hidden;">-->
<!-- END: main -->

View File

@@ -0,0 +1,307 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('include/EditView/EditView2.php');
require_once('modules/Campaigns/utils.php');
require_once('modules/Campaigns/utils.php');
global $mod_strings, $app_list_strings, $app_strings, $current_user, $import_bean_map;
global $import_file_name, $theme;$app_list_strings;
$lead = new Lead();
$fields = array();
$xtpl=new XTemplate ('modules/Campaigns/WebToLeadCreation.html');
$xtpl->assign("MOD", $mod_strings);
$xtpl->assign("APP", $app_strings);
if(isset($_REQUEST['module']))
{
$xtpl->assign("MODULE", $_REQUEST['module']);
}
if(isset($_REQUEST['return_module']))
{
$xtpl->assign("RETURN_MODULE", $_REQUEST['return_module']);
}
if(isset($_REQUEST['return_id']))
{
$xtpl->assign("RETURN_ID", $_REQUEST['return_id']);
}
if(isset($_REQUEST['return_id']))
{
$xtpl->assign("RETURN_ACTION", $_REQUEST['return_action']);
}
if(isset($_REQUEST['record']))
{
$xtpl->assign("RECORD", $_REQUEST['record']);
}
global $theme;
global $currentModule;
$ev = new EditView;
$xtpl->assign("TITLE1",
$this->getModuleTitle(
true,
array(
$this->_getModuleTitleListParam(),
$mod_strings['LBL_WEB_TO_LEAD_FORM_TITLE1']
)
)
);
$xtpl->assign("TITLE2",
$this->getModuleTitle(
true,
array(
$this->_getModuleTitleListParam(),
$mod_strings['LBL_WEB_TO_LEAD_FORM_TITLE2']
)
)
);
$site_url = $sugar_config['site_url'];
$web_post_url = $site_url.'/index.php?entryPoint=WebToLeadCapture';
$json = getJSONobj();
// Users Popup
$popup_request_data = array(
'call_back_function' => 'set_return',
'form_name' => 'WebToLeadCreation',
'field_to_name_array' => array(
'id' => 'assigned_user_id',
'user_name' => 'assigned_user_name',
),
);
$xtpl->assign('encoded_users_popup_request_data', $json->encode($popup_request_data));
//Campaigns popup
$popup_request_data = array(
'call_back_function' => 'set_return',
'form_name' => 'WebToLeadCreation',
'field_to_name_array' => array(
'id' => 'campaign_id',
'name' => 'campaign_name',
),
);
$encoded_users_popup_request_data = $json->encode($popup_request_data);
$xtpl->assign('encoded_campaigns_popup_request_data' , $json->encode($popup_request_data));
//create the cancel button
$cancel_buttons_html = "<input class='button' onclick=\"this.form.action.value='".$_REQUEST['return_action']."'; this.form.module.value='".$_REQUEST['return_module']."';\" type='submit' name='cancel' value='".$app_strings['LBL_BACK']."'/>";
$xtpl->assign("CANCEL_BUTTON", $cancel_buttons_html );
$field_defs_js = "var field_defs = {'Contacts':[";
$count= 0;
foreach($lead->field_defs as $field_def)
{
$email_fields = false;
if($field_def['name']== 'webtolead_email1' || $field_def['name']== 'webtolead_email2')
{
$email_fields = true;
}
if($field_def['name']!= 'account_name'){
if( ( $field_def['type'] == 'relate' && empty($field_def['custom_type']) )
|| $field_def['type'] == 'assigned_user_name' || $field_def['type'] =='link'
|| (isset($field_def['source']) && $field_def['source']=='non-db' && !$email_fields) || $field_def['type'] == 'id')
{
continue;
}
}
if($field_def['name']== 'deleted' || $field_def['name']=='converted' || $field_def['name']=='date_entered'
|| $field_def['name']== 'date_modified' || $field_def['name']=='modified_user_id'
|| $field_def['name']=='assigned_user_id' || $field_def['name']=='created_by'
|| $field_def['name']=='team_id')
{
continue;
}
$field_def['vname'] = preg_replace('/:$/','',translate($field_def['vname'],'Leads'));
//$cols_name = "{'".$field_def['vname']."'}";
$col_arr = array();
if((isset($field_def['required']) && $field_def['required'] != null && $field_def['required'] != 0)
|| $field_def['name']=='last_name'
){
$cols_name=$field_def['vname'].' '.$app_strings['LBL_REQUIRED_SYMBOL'];
$col_arr[0]=$cols_name;
$col_arr[1]=$field_def['name'];
$col_arr[2]=true;
}
else{
$cols_name=$field_def['vname'];
$col_arr[0]=$cols_name;
$col_arr[1]=$field_def['name'];
}
if (! in_array($cols_name, $fields))
{
array_push($fields,$col_arr);
}
$count++;
}
$xtpl->assign("WEB_POST_URL",$web_post_url);
//$xtpl->assign("LEAD_SELECT_FIELDS",'MOD.LBL_SELECT_LEAD_FIELDS');
require_once('include/QuickSearchDefaults.php');
$qsd = new QuickSearchDefaults();
$sqs_objects = array('account_name' => $qsd->getQSParent(),
'assigned_user_name' => $qsd->getQSUser(),
'campaign_name' => $qsd->getQSCampaigns(),
);
$quicksearch_js = '<script type="text/javascript" language="javascript">sqs_objects = ' . $json->encode($sqs_objects) . '</script>';
$xtpl->assign("JAVASCRIPT", $quicksearch_js);
if (empty($focus->assigned_user_id) && empty($focus->id)) $focus->assigned_user_id = $current_user->id;
if (empty($focus->assigned_name) && empty($focus->id)) $focus->assigned_user_name = $current_user->user_name;
$xtpl->assign("ASSIGNED_USER_OPTIONS", get_select_options_with_id(get_user_array(TRUE, "Active", $focus->assigned_user_id), $focus->assigned_user_id));
$xtpl->assign("ASSIGNED_USER_NAME", $focus->assigned_user_name);
$xtpl->assign("ASSIGNED_USER_ID", $focus->assigned_user_id );
$xtpl->assign("REDIRECT_URL_DEFAULT",'http://');
//required fields on Webtolead form
$campaign= new Campaign();
$javascript = new javascript();
$javascript->setFormName('WebToLeadCreation');
$javascript->setSugarBean($lead);
$javascript->addAllFields('');
//$javascript->addFieldGeneric('redirect_url', '', 'LBL_REDIRECT_URL' ,'true');
$javascript->addFieldGeneric('campaign_name', '', 'LBL_RELATED_CAMPAIGN' ,'true');
$javascript->addFieldGeneric('assigned_user_name', '', 'LBL_ASSIGNED_TO' ,'true');
$javascript->addToValidateBinaryDependency('campaign_name', 'alpha', $app_strings['ERR_SQS_NO_MATCH_FIELD'] . $mod_strings['LBL_LEAD_NOTIFY_CAMPAIGN'], 'false', '', 'campaign_id');
$javascript->addToValidateBinaryDependency('assigned_user_name', 'alpha', $app_strings['ERR_SQS_NO_MATCH_FIELD'] . $app_strings['LBL_ASSIGNED_TO'], 'false', '', 'assigned_user_id');
echo $javascript->getScript();
$json = getJSONobj();
$lead_fields = $json->encode($fields);
$xtpl->assign("LEAD_FIELDS",$lead_fields);
$classname = "SUGAR_GRID";
$xtpl->assign("CLASSNAME",$classname);
$xtpl->assign("DRAG_DROP_CHOOSER_WEB_TO_LEAD",constructDDWebToLeadFields($fields,$classname));
$xtpl->parse("main");
$xtpl->out("main");
/*
$str = "<script>
WebToLeadForm.lead_fields = {$lead_fields};
</script>";
echo $str;
*/
/*
*This function constructs Drag and Drop multiselect box of subscriptions for display in manage subscription form
*/
function constructDDWebToLeadFields($fields,$classname){
require_once("include/templates/TemplateDragDropChooser.php");
global $mod_strings;
$d2 = array();
//now call function that creates javascript for invoking DDChooser object
$dd_chooser = new TemplateDragDropChooser();
$dd_chooser->args['classname'] = $classname;
$dd_chooser->args['left_header'] = $mod_strings['LBL_AVALAIBLE_FIELDS_HEADER'];
$dd_chooser->args['mid_header'] = $mod_strings['LBL_LEAD_FORM_FIRST_HEADER'];
$dd_chooser->args['right_header'] = $mod_strings['LBL_LEAD_FORM_SECOND_HEADER'];
$dd_chooser->args['left_data'] = $fields;
$dd_chooser->args['mid_data'] = $d2;
$dd_chooser->args['right_data'] = $d2;
$dd_chooser->args['title'] = ' ';
$dd_chooser->args['left_div_name'] = 'ddgrid2';
$dd_chooser->args['mid_div_name'] = 'ddgrid3';
$dd_chooser->args['right_div_name'] = 'ddgrid4';
$dd_chooser->args['gridcount'] = 'three';
$str = $dd_chooser->displayScriptTags();
$str .= $dd_chooser->displayDefinitionScript();
$str .= $dd_chooser->display();
$str .= "<script>
//function post rows
function postMoveRows(){
//Call other function when this is called
}
</script>";
$str .= "<script>
function displayAddRemoveDragButtons(Add_All_Fields,Remove_All_Fields){
var addRemove = document.getElementById('lead_add_remove_button');
if(" . $dd_chooser->args['classname'] . "_grid0.getDataModel().getTotalRowCount() ==0) {
addRemove.setAttribute('value',Remove_All_Fields);
addRemove.setAttribute('title',Remove_All_Fields);
}
else if(" . $dd_chooser->args['classname'] . "_grid1.getDataModel().getTotalRowCount() ==0 && " . $dd_chooser->args['classname'] . "_grid2.getDataModel().getTotalRowCount() ==0){
addRemove.setAttribute('value',Add_All_Fields);
addRemove.setAttribute('title',Add_All_Fields);
}
}
</script>";
return $str;
}
/**
* function to retrieve webtolead image and title. path to help file
* refactored to use SugarView::getModuleTitle()
*
* @deprecated use SugarView::getModuleTitle() instead
*
* @param $module string not used, only for backward compatibility
* @param $image_name string image name
* @param $module_title string to display as the module title
* @param $show_help boolean which determines if the print and help links are shown.
* @return string HTML
*/
function get_webtolead_title(
$module,
$image_name,
$module_title,
$show_help
)
{
return $GLOBALS['current_view']->getModuleTitle($show_help);
}

View File

@@ -0,0 +1,89 @@
<!--
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
********************************************************************************/
-->
<!-- BEGIN: main -->
<style>
#subjectfield { height: 1.6em; }
</style>
{JAVASCRIPT}
<script type="text/javascript" language="Javascript" src="modules/Emails/javascript/Email.js"></script>
<script type="text/javascript" language="Javascript" src="include/javascript/sugar_grp1_yui.js"></script>
<script type="text/javascript" language="Javascript" src="include/JSON.js"></script>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<form name="WebToLeadDownloadForm" id="WebToLeadDownloadForm" method="POST" action="index.php"
enctype="multipart/form-data"><input type="hidden" name="module" value="Campaigns"> <input
type="hidden" name="record" value="{ID}"> <input type="hidden" name="action"> <input type="hidden"
name="form"> <input type="hidden" name="return_module" value="{RETURN_MODULE}"> <input type="hidden"
name="return_id" value="{RETURN_ID}"> <input type="hidden" name="return_action" value="{RETURN_ACTION}">
<input type="hidden" name="inpopupwindow" value="{INPOPUPWINDOW}"> <input type="hidden" name="old_id"
value="{OLD_ID}">
<td align="right" nowrap><span class="required">{APP.LBL_REQUIRED_SYMBOL}</span> {APP.NTC_REQUIRED}</td>
<td align='right'>{ADMIN_EDIT}</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="edit view">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan=4>&nbsp;</td>
</tr>
<tr>
{LINK_TO_WEB_FORM}
</tr>
</table>
</td>
</tr>
<!-- BEGIN: copy_source -->
<tr>
<td>
<b>{MOD.LBL_COPY_AND_PASTE_CODE}</b><br/>
<textarea rows="6" cols="80">{RAW_SOURCE}</textarea>
</td>
</tr>
<!-- END: copy_source -->
</table>
</form>
<!-- END: main -->

View File

@@ -0,0 +1,101 @@
<!--
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
********************************************************************************/
-->
<!-- BEGIN: main -->
<style>
#subjectfield { height: 1.6em; }
</style>
{JAVASCRIPT}
<script type="text/javascript" language="Javascript" src="modules/EmailTemplates/EmailTemplate.js"></script>
<script type="text/javascript" language="Javascript" src="include/javascript/sugar_grp1_yui.js"></script>
<script type="text/javascript" language="Javascript" src="include/JSON.js"></script>
<script type="text/javascript" language="Javascript" src="modules/Campaigns/WebToLead.js"></script>
<script type="text/javascript">
{FIELD_DEFS_JS}
</script>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<form name="WebToLeadForm" id="WebToLeadForm" method="POST" action="index.php" enctype="multipart/form-data">
<input type="hidden" name="module" value="Campaigns">
<input type="hidden" name="record" value="{ID}">
<input type="hidden" name="action"> <input type="hidden" name="form">
<input type="hidden" name="return_module" value="{RETURN_MODULE}">
<input type="hidden" name="return_id" value="{RETURN_ID}">
<input type="hidden" name="return_action" value="{RETURN_ACTION}">
<input type="hidden" name="inpopupwindow" value="{INPOPUPWINDOW}">
<input type="hidden" name="old_id" value="{OLD_ID}">
<input title="{APP.LBL_SAVE_WEB_TO_LEAD_FORM}" accessKey="{APP.LBL_SAVE_WEB_TO_LEAD_FORM}" class="button"
onclick="this.form.action.value='WebToLeadFormSave';" type="submit" name="button"
value="{APP.LBL_SAVE_WEB_TO_LEAD_FORM}">
<input title="{APP.LBL_CANCEL_BUTTON_TITLE}"
accessKey="{APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="{CANCEL_SCRIPT}" type="submit" name="button"
value="{APP.LBL_CANCEL_BUTTON_LABEL}">
</td>
<td align="right" nowrap><span class="required">{APP.LBL_REQUIRED_SYMBOL}</span> {APP.NTC_REQUIRED}</td>
<td align='right'>{ADMIN_EDIT}</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="edit view">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" scope="row">
{MOD.LBL_BODY}
</td>
<!-- BEGIN: textarea -->
<td colspan="4" >
<textarea id='body_html' tabindex='90' name='body_html' cols="100" rows="40">{BODY_HTML}</textarea>
</td>
<!-- END: textarea -->
</tr>
</table>
</td>
</tr>
</table>
</form>
{tiny}
<!-- END: main -->

View File

@@ -0,0 +1,91 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('include/formbase.php');
require_once('include/SugarTinyMCE.php');
global $mod_strings;
global $app_strings;
$rawsource = false;
if(!empty($_REQUEST['body_html'])){
$dir_path = "{$GLOBALS['sugar_config']['cache_dir']}generated_forms/";
if(!file_exists($dir_path)){
sugar_mkdir($dir_path,0777);
}
//Check to ensure we have <html> tags in the form. Without them, IE8 will attempt to display the page as XML.
$rawsource = $_REQUEST['body_html'];
$SugarTiny = new SugarTinyMCE();
$rawsource = $SugarTiny->cleanEncodedMCEHtml($rawsource);
$html = from_html($rawsource);
if (stripos($html, "<html") === false)
{
$html = "<html><body>" . $html . "</body></html>";
}
$file = $dir_path.'WebToLeadForm_'.time().'.html';
$fp = sugar_fopen($file,'wb');
fwrite($fp, $html);
fclose($fp);
}
$xtpl=new XTemplate ('modules/Campaigns/WebToLeadDownloadForm.html');
$xtpl->assign("MOD", $mod_strings);
$xtpl->assign("APP", $app_strings);
$webformlink = "<b>$mod_strings[LBL_DOWNLOAD_TEXT_WEB_TO_LEAD_FORM]</b><br/>";
$webformlink .= "<a href={$GLOBALS['sugar_config']['cache_dir']}generated_forms/WebToLeadForm_".time().".html>$mod_strings[LBL_DOWNLOAD_WEB_TO_LEAD_FORM]</a>";
$xtpl->assign("LINK_TO_WEB_FORM",$webformlink);
if ($rawsource !== false)
{
$xtpl->assign("RAW_SOURCE", $rawsource);
$xtpl->parse("main.copy_source");
}
$xtpl->parse("main");
$xtpl->out("main");
?>

View File

@@ -0,0 +1,325 @@
<!--
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
********************************************************************************/
-->
{$ROLLOVER}
<form id="wizform" name="wizform" method="POST" action="index.php">
<input type="hidden" name="module" value="Campaigns">
<input type="hidden" name="record" value="{$ID}">
<input type="hidden" name="action">
<input type="hidden" name="return_module" value="{$RETURN_MODULE}">
<input type="hidden" name="return_id" value="{$RETURN_ID}">
<input type="hidden" name="return_action" value="{$RETURN_ACTION}">
<input type='hidden' name='campaign_type' value="{$MOD.LBL_NEWSLETTER}">
<input type="hidden" id="wiz_total_steps" name="totalsteps" value="3">
<input type="hidden" id="wiz_current_step" name="currentstep" value='0'>
<input type="hidden" id="wiz_summary_step" name="wiz_summary_step" value='create_email_setup_summary'>
<p>
<div id ='buttons'>
<table width="100%" border="0" cellspacing="0" cellpadding="0" >
<tr>
<td align="left" width='30%'>
<table border="0" cellspacing="0" cellpadding="0" ><tr>
<td><div id="back_button_div"><input id="wiz_back_button" type='button' title="{$APP.LBL_BACK}" class="button" onclick="navigate('back');" name="back" value=" {$APP.LBL_BACK}"></div></td>
<td><div id="cancel_button_div"><input id="wiz_cancel_button" title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="this.form.action.value='{$RETURN_ACTION}'; this.form.module.value='{$RETURN_MODULE}'; this.form.record.value='{$RETURN_ID}'" type="submit" name="button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}"></div></td>
<td><div id="save_button_div"><input id="wiz_submit_button" title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button" onclick="this.form.action.value='WizardEmailSetupSave';" type="submit" name="button" value="{$APP.LBL_SAVE_BUTTON_LABEL}" > </div></td>
<td><div id="next_button_div"><input id="wiz_next_button" type='button' title="{$APP.LBL_NEXT_BUTTON_LABEL}" class="button" onclick="navigate('next');create_summary();" name="button" value="{$APP.LBL_NEXT_BUTTON_LABEL}"></div></td>
</tr></table>
</td>
<td align="right" width='40%'><div id='wiz_location_message'></td>
</tr>
</table>
</div>
</p>
<table class='other view' width="100%" border="0" cellspacing="3" cellpadding="0">
<tr>
<td width="10%" style="vertical-align: top;">
<div id='nav'>
<table border="0" cellspacing="0" cellpadding="0" width="100%" >
<tr><td scope='row' nowrap><div id='nav_step1'>{$MOD.LBL_NAVIGATION_MENU_SETUP}</div></td></tr>
<tr><td scope='row' nowrap><div id='nav_step2'>{$MOD.LBL_NAVIGATION_MENU_NEW_MAILBOX}</div></td></tr>
<tr><td scope='row' nowrap><div id='nav_step3'>{$MOD.LBL_NAVIGATION_MENU_SUMMARY}</div></td></tr>
</table>
</div>
</td>
<td class='edit view' width='100%'>
<div id="wiz_message"></div>
<div id=wizard>
<div id='step1'><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<th colspan="2" align="left" ><h4>{$MOD.LBL_NAVIGATION_MENU_SETUP}</h4></th>
</tr>
<tr>
<td scope="row"><span sugar='slot1'>
{$EMAILSETUP}{$MOD.LBL_EMAIL_SETUP_DESC}
</span sugar='slot'></td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td>
<table width="100%" border="0" cellspacing="0" cellpadding="0" >
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20%" scope="row">{$MOD.LBL_WIZ_FROM_NAME} <span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span></td>
<td width="30%" ><input name="wiz_step1_notify_fromname" tabindex='1' size='25' maxlength='128' type="text" id="notify_fromname" value="{$notify_fromname}" title="{$MOD.LBL_WIZ_FROM_NAME}"></td>
</tr>
<tr>
<td scope="row">{$MOD.LBL_MAIL_SENDTYPE}</td>
<td >
<select id="mail_sendtype" name="wiz_step1_mail_sendtype" title="{$MOD.LBL_MAIL_SENDTYPE}" onChange="notify_setrequired();" tabindex="1">{$mail_sendtype_options}</select>
</td>
</tr> <tr>
<td scope="row">{$MOD.LBL_WIZ_FROM_ADDRESS} <span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span></td>
<td ><input name='wiz_step1_notify_fromaddress' id='notify_fromaddress' tabindex='1' size='25' maxlength='128' type="text" value="{$notify_fromaddress}" title="{$MOD.LBL_WIZ_FROM_ADDRESS}"></td></tr>
<tr>
<td colspan="4">
<div id="smtp_settings">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td width="20%" scope="row">{$MOD.LBL_MAIL_SMTPSERVER} <span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span></td>
<td width="30%" ><input type="text" title="{$MOD.LBL_MAIL_SMTPSERVER}" name="wiz_step1_mail_smtpserver" id='mail_smtpserver' tabindex="1" size="25" maxlength="64" value="{$mail_smtpserver}"></td>
<td width="20%" scope="row">{$MOD.LBL_MAIL_SMTPPORT} <span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span></td>
<td width="30%" ><input type="text" id='mail_smtpport' name="wiz_step1_mail_smtpport" title="{$MOD.LBL_MAIL_SMTPPORT}" tabindex="1" size="5" maxlength="5" value="{$mail_smtpport}"></td>
</tr>
<tr>
<td scope="row">
{$MOD.LBL_MAIL_SMTPAUTH_REQ}
</td>
<td>
<input title ="{$MOD.LBL_MAIL_SMTPAUTH_REQ}" id='mail_smtpauth_req' name='wiz_step1_mail_smtpauth_req' type="checkbox" class="checkbox" value="1" tabindex='1'
onclick="notify_setrequired();" {$mail_smtpauth_req}>
</td>
<td width="15%" scope="row">&nbsp;&nbsp;{$APP.LBL_EMAIL_SMTP_SSL_OR_TLS}:</td>
<td width="35%" >
<select id="mail_smtpssl" title="{$APP.LBL_EMAIL_SMTP_SSL_OR_TLS}" name="mail_smtpssl" tabindex="1">{$MAIL_SSL_OPTIONS}</select>
</td>
</tr>
<tr>
<td colspan="4">
<div id="smtp_auth">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td width="20%" scope="row">{$MOD.LBL_MAIL_SMTPUSER} <span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span></td>
<td width="30%" ><input type="text" name="wiz_step1_mail_smtpuser" id='mail_smtpuser' title='{$MOD.LBL_MAIL_SMTPUSER}' size="25" maxlength="64" value="{$mail_smtpuser}" tabindex='1' ></td>
<td width="20%" scope="row">{$MOD.LBL_MAIL_SMTPPASS} <span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span></td>
<td width="30%" ><input type="password" title="{$MOD.LBL_MAIL_SMTPPASS}" name="wiz_step1_mail_smtppass" id='mail_smtppass' size="25" maxlength="64" value="{$mail_smtppass}" tabindex='1'></td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td>&nbsp;</td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td><h4>{$MOD.LBL_MASS_MAILING_TITLE}</h4></td></tr>
<tr><td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="40%" scope="row">{$MOD.LBL_EMAILS_PER_RUN}&nbsp;<span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span></td>
<td width="50%" ><input name='wiz_step1_massemailer_campaign_emails_per_run' id='massemailer_campaign_emails_per_run' title="{$MOD.LBL_EMAILS_PER_RUN}"tabindex='1' maxlength='128' type="text" value="{$EMAILS_PER_RUN}"></td>
</tr><tr>
<td scope="row">{$MOD.LBL_LOCATION_TRACK}&nbsp;<span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span></td>
<td ><input type='radio' onclick="change_state(this);" name='wiz_massemailer_tracking_entities_location_type' id='massemailer_tracking_entities_location_type' title="{$MOD.LBL_DEFAULT_LOCATION}" value="1" {$DEFAULT_CHECKED}>{$MOD.LBL_DEFAULT_LOCATION}&nbsp;<input type='radio' {$USERDEFINED_CHECKED} onclick="change_state(this);" name='wiz_massemailer_tracking_entities_location_type' id='massemailer_tracking_entities_location_type' title="{$MOD.LBL_CUSTOM_LOCATION}" value="2">{$MOD.LBL_CUSTOM_LOCATION}
</tr><tr>
<td scope="row"></td>
<td ><input name='wiz_step1_massemailer_tracking_entities_location' id='massemailer_tracking_entities_location' title="{$MOD.LBL_LOCATION_TRACK}" {$TRACKING_ENTRIES_LOCATION_STATE} maxlength='128' type="text" value="{$TRACKING_ENTRIES_LOCATION}"></td>
</tr>
<tr>
<td scope="row">
<div id="rollover">
{$MOD.LBL_CAMP_MESSAGE_COPY}&nbsp;<span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span>
<a href="#" class="rollover"><span>{$MOD.LBL_CAMP_MESSAGE_COPY_DESC}</span><img border="0" src="{sugar_getimagepath file='helpInline.gif'}"></a>
</div>
</td>
<td >
<input type='radio' name='massemailer_email_copy' value="1" {$YES_CHECKED}>{$MOD.LBL_YES}&nbsp;<input type='radio' {$NO_CHECKED} name='massemailer_email_copy' value="2">{$MOD.LBL_NO}
</td>
</tr>
</table>
</td></tr></table>
</td></tr></table>
<script type="text/javascript" >
{literal}
function change_state(radiobutton) {
if (radiobutton.value == '1') {
radiobutton.form['wiz_step1_massemailer_tracking_entities_location'].disabled=true;
{/literal}
radiobutton.form['wiz_step1_massemailer_tracking_entities_location'].value='{$MOD.TRACKING_ENTRIES_LOCATION_DEFAULT_VALUE}';
{literal}
} else {
radiobutton.form['wiz_step1_massemailer_tracking_entities_location'].disabled=false;
radiobutton.form['wiz_step1_massemailer_tracking_entities_location'].value=null;
}
}{/literal}
</script>
</div>
<div id='step2'><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2"><h3>{$MOD.LBL_NAVIGATION_MENU_NEW_MAILBOX}</h3></td>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td scope="row" colspan ='3'>{$MAILBOXES_DETECTED_MESSAGE}</td></td>&nbsp;</td>
</tr>
<tr><td scope="row"><input type='hidden' id='wiz_new_mbox' name='wiz_new_mbox' value='0'>
<input title ="{$MOD.LBL_MAIL_SMTPAUTH_REQ}" id='create_mbox' name='wiz_create_mbox' type="checkbox" class="checkbox"
onclick="notify_setrequired();" {$MBOX_NEEDED}>&nbsp;{$MOD.LBL_CREATE_MAILBOX}</td>
<td colspan='3'>&nbsp;</td></tr>
</table>
<div id="new_mbox">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" scope="row" width="20%" NOWRAP>
<slot>{$MOD.LBL_MAILBOX_NAME} <span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span>&nbsp;</slot></td>
<td valign="top" width="30%">
<slot><input id='name' name='wiz_step2_name' title='{$MOD.LBL_MAILBOX_NAME}' tabindex='10' size='30' maxlength='255' type="text" value="" ></slot></td>
<td valign="top" scope="row" width="20%" NOWRAP>
<slot>{$MOD.LBL_FROM_ADDR}:&nbsp;</slot></td>
<td valign="top" width="30%" NOWRAP>
<slot><input name="wiz_step2_from_addr" id="from_addr" title='{$MOD.LBL_FROM_ADDR}' size='30'>&nbsp;</slot></td>
</tr>
<tr>
<td valign="top" scope="row">
<slot>{$MOD.LBL_SERVER_URL}: <span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span>&nbsp;</slot></td>
<td valign="top" width="30%">
<slot><input title='{$MOD.LBL_SERVER_URL}' name='wiz_step2_server_url' id='server_url' tabindex='20' size='30' maxlength='100' type="text" value="" ></slot></td>
<td valign="top" scope="row">
<slot>{$MOD.LBL_LOGIN}:
<span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span>&nbsp;</slot></td>
<td valign="top" width="30%">
<slot><input title="{$MOD.LBL_LOGIN}" name='wiz_step2_email_user' id='email_user' tabindex='70' size='30' maxlength='100' type="text" value="" ></slot></td>
</tr>
<tr>
<td valign="top" scope="row" width="20%" NOWRAP>
<slot>{$MOD.LBL_SERVER_TYPE}:
<span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span>&nbsp;</slot></td>
<td valign="top" width="30%">
<slot>
<select title='{$MOD.LBL_SERVER_TYPE}' name='wiz_step2_protocol' id='protocol' tabindex='30' onchange="toggle_monitored_folder(this); setPortDefault();" >{$PROTOCOL}</select></slot></td>
<td valign="top" scope="row">
<slot>{$MOD.LBL_PASSWORD}:
<span class="required">{$APP.LBL_REQUIRED_SYMBOL}&nbsp;</slot></td>
<td valign="top" width="30%">
<slot><input id='email_password' title="{$MOD.LBL_PASSWORD}" name='wiz_step_email_password' tabindex='80' size='30' maxlength='100' type="password" value="{$PASSWORD}" {$IE_DISABLED}></span></slot></td>
</tr>
<tr>
<td valign="top" scope="row" width="20%" NOWRAP>
<slot>{$MOD.LBL_PORT}:
<span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span>&nbsp;</slot></td>
<td valign="top" width="30%">
<slot>
<input title="{$MOD.LBL_PORT}" type='text' name='wiz_step2_port' id='port' tabindex="40" value="{$PORT}" size='10'>
<td valign="top" scope="row" width="20%" NOWRAP>
<slot><div id='label_inbox' style="{$DISPLAY}">{$MOD.LBL_MAILBOX}: <span class="required">{$APP.LBL_REQUIRED_SYMBOL}</div></span>&nbsp;</slot></td>
<td valign="top" width="30%">
<slot><div id='inbox' style="{$DISPLAY}"><input id="mailbox" name='mailbox' title="{$MOD.LBL_MAILBOX}" tabindex='90' size='30' maxlength='50' type="text" value="{$MOD.LBL_MAILBOX_DEFAULT}"></div>
</slot></td>
</tr>
<tr>
<td valign="top" scope="row" width="1%" NOWRAP>
<div class="maybe">
<slot>{$MOD.LBL_SSL}:&nbsp;</slot>
</div>
</td>
<td valign="top" width="33%">
<slot>
<div class="maybe">
<div id="rollover">
<a href="#" class="rollover"><span>{$MOD.LBL_SSL_DESC}</span><img border="0" src="{sugar_getimagepath file='helpInline.gif'}"></a>
</div>
<input name='ssl' id='ssl' tabindex='45' type='checkbox' class="checkbox" value="1" onClick="setPortDefault();" title="{$MOD.LBL_SSL}" {$IE_DISABLED}>
</div>
</slot>
</td>
</tr>
</table>
</div>
</div>
<div id='step3'>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td>
<h3>{$MOD.LBL_NAVIGATION_MENU_SUMMARY}</h3>
</td></tr>
<tr><td>
<div id='wiz_summ'></div>
</td></tr>
</table>
</div>
</div>
</td>
</tr>
</table>
</form>
<input id="mark_read" type='hidden'>
<div id='pop3_warn'></div>
<script type="text/javascript" language="javascript" src="modules/Campaigns/wizard.js"></script>
<script type="text/javascript" lang="Javascript" src="modules/InboundEmail/InboundEmail.js"></script>
{$WIZ_JAVASCRIPT}
{$DIV_JAVASCRIPT}
{$JAVASCRIPT}

View File

@@ -0,0 +1,412 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
/*************** general UI Stuff ****************/
global $mod_strings,$app_list_strings,$app_strings,$current_user;
if (!is_admin($current_user)&& !is_admin_for_module($GLOBALS['current_user'],'Campaigns')) sugar_die("Unauthorized access to administration.");
$params = array();
$params[] = "<a href='index.php?module=Campaigns&action=index'>{$mod_strings['LBL_MODULE_NAME']}</a>";
$params[] = $mod_strings['LBL_EMAIL_SETUP_WIZARD_TITLE'];
echo getClassicModuleTitle('Campaigns', $params, true);
global $theme;
global $currentModule;
//get administration bean for email setup
$focus = new Administration();
$focus->retrieveSettings(); //retrieve all admin settings.
$GLOBALS['log']->info("Mass Emailer(EmailMan) ConfigureSettings view");
$email = new Email();
$ss = new Sugar_Smarty();
$ss->assign("MOD", $mod_strings);
$ss->assign("APP", $app_strings);
if (isset($_REQUEST['return_module'])) $ss->assign("RETURN_MODULE", $_REQUEST['return_module']);
if (isset($_REQUEST['return_action'])) $ss->assign("RETURN_ACTION", $_REQUEST['return_action']);
if (isset($_REQUEST['return_id'])) $ss->assign("RETURN_ID", $_REQUEST['return_id']);
/******** Email Setup UI DIV Stuff **********/
//get Settings if they exist
$ss->assign("notify_fromaddress", $focus->settings['notify_fromaddress']);
$ss->assign("notify_send_from_assigning_user", ($focus->settings['notify_send_from_assigning_user']) ? "checked='checked'" : "");
$ss->assign("notify_on", ($focus->settings['notify_on']) ? "checked='checked'" : "");
$ss->assign("notify_fromname", $focus->settings['notify_fromname']);
$ss->assign("mail_smtpserver", $focus->settings['mail_smtpserver']);
$ss->assign("mail_smtpport", $focus->settings['mail_smtpport']);
$ss->assign("mail_sendtype_options", get_select_options_with_id($app_list_strings['notifymail_sendtype'], $focus->settings['mail_sendtype']));
$ss->assign("mail_smtpuser", $focus->settings['mail_smtpuser']);
$ss->assign("mail_smtppass", $focus->settings['mail_smtppass']);
$ss->assign("mail_smtpauth_req", ($focus->settings['mail_smtpauth_req']) ? "checked='checked'" : "");
$protocol = filterInboundEmailPopSelection($app_list_strings['dom_email_server_type']);
$ss->assign('PROTOCOL', get_select_options_with_id($protocol, ''));
if (isset($focus->settings['massemailer_campaign_emails_per_run']) && !empty($focus->settings['massemailer_campaign_emails_per_run'])) {
$ss->assign("EMAILS_PER_RUN", $focus->settings['massemailer_campaign_emails_per_run']);
} else {
$ss->assign("EMAILS_PER_RUN", 500);
}
if (!isset($focus->settings['massemailer_tracking_entities_location_type']) or empty($focus->settings['massemailer_tracking_entities_location_type']) or $focus->settings['massemailer_tracking_entities_location_type']=='1') {
$ss->assign("DEFAULT_CHECKED", "checked");
$ss->assign("TRACKING_ENTRIES_LOCATION_STATE", "disabled");
$ss->assign("TRACKING_ENTRIES_LOCATION",$mod_strings['TRACKING_ENTRIES_LOCATION_DEFAULT_VALUE']);
} else {
$ss->assign("USERDEFINED_CHECKED", "checked");
$ss->assign("TRACKING_ENTRIES_LOCATION",$focus->settings["massemailer_tracking_entities_location"]);
}
// Change the default campaign to not store a copy of each message.
if (!empty($focus->settings['massemailer_email_copy']) and $focus->settings['massemailer_email_copy']=='1') {
$ss->assign("YES_CHECKED", "checked='checked'");
} else {
$ss->assign("NO_CHECKED", "checked='checked'");
}
$ss->assign("MAIL_SSL_OPTIONS", get_select_options_with_id($app_list_strings['email_settings_for_ssl'], $focus->settings['mail_smtpssl']));
/*********** New Mail Box UI DIV Stuff ****************/
$mbox_qry = "select * from inbound_email where deleted ='0' and mailbox_type = 'bounce'";
$mbox_res = $focus->db->query($mbox_qry);
while ($mbox_row = $focus->db->fetchByAssoc($mbox_res)){$mbox[] = $mbox_row;}
$mbox_msg = ' ';
$need_mbox = '';
$mboxTable = "<table class='list view' width='100%' border='0' cellspacing='1' cellpadding='1'>";
if(isset($mbox) && count($mbox)>0){
$mboxTable .= "<tr><td colspan='5'><b>" .count($mbox) ." ". $mod_strings['LBL_MAILBOX_CHECK_WIZ_GOOD']." </b>.</td></tr>";
$mboxTable .= "<tr class='listViewHRS1'><td width='20%'><b>".$mod_strings['LBL_MAILBOX_NAME']."</b></td>"
. " <td width='20%'><b>".$mod_strings['LBL_LOGIN']."</b></td>"
. " <td width='20%'><b>".$mod_strings['LBL_MAILBOX']."</b></td>"
. " <td width='20%'><b>".$mod_strings['LBL_SERVER_URL']."</b></td>"
. " <td width='20%'><b>".$mod_strings['LBL_LIST_STATUS']."</b></td></tr>";
$colorclass=' ';
foreach($mbox as $details){
if( $colorclass == "class='evenListRowS1'"){
$colorclass= "class='oddListRowS1'";
}else{
$colorclass= "class='evenListRowS1'";
}
$mboxTable .= "<tr $colorclass>";
$mboxTable .= "<td>".$details['name']."</td>";
$mboxTable .= "<td>".$details['email_user']."</td>";
$mboxTable .= "<td>".$details['mailbox']."</td>";
$mboxTable .= "<td>".$details['server_url']."</td>";
$mboxTable .= "<td>".$details['status']."</td></tr>";
}
}else{
$need_mbox = 'checked';
$mboxTable .= "<tr><td colspan='5'><b>".$mod_strings['LBL_MAILBOX_CHECK_WIZ_BAD']." </b>.</td></tr>";
}
$mboxTable .= "</table>";
$ss->assign("MAILBOXES_DETECTED_MESSAGE", $mboxTable);
$ss->assign("MBOX_NEEDED", $need_mbox);
$ss->assign('ROLLOVER', $email->rolloverStyle);
if(!function_exists('imap_open')) {
$ss->assign('IE_DISABLED', 'DISABLED');
}
/**************************** SUMMARY UI DIV Stuff *******************/
/**************************** WIZARD UI DIV Stuff *******************/
// this is the wizard control script that resides in page
$divScript = <<<EOQ
<script type="text/javascript" language="javascript">
//this function toggles visibility of fields based on selected options
function notify_setrequired() {
f = document.getElementById("wizform");
document.getElementById("smtp_settings").style.display = (f.mail_sendtype.value == "SMTP") ? "inline" : "none";
document.getElementById("smtp_settings").style.visibility = (f.mail_sendtype.value == "SMTP") ? "visible" : "hidden";
document.getElementById("smtp_auth").style.display = (document.getElementById('mail_smtpauth_req').checked) ? "inline" : "none";
document.getElementById("smtp_auth").style.visibility = (document.getElementById('mail_smtpauth_req').checked) ? "visible" : "hidden";
document.getElementById("new_mbox").style.display = (document.getElementById('create_mbox').checked) ? "inline" : "none";
document.getElementById("new_mbox").style.visibility = (document.getElementById('create_mbox').checked) ? "visible" : "hidden";
document.getElementById("wiz_new_mbox").value = (document.getElementById('create_mbox').checked) ? "1" : "0";
return true;
}
//this function will copy as much information as possible from the first step in wizard
//onto the the second step in wizard
function copy_down() {
document.getElementById("name").value = document.getElementById("notify_fromname").value;
document.getElementById("email_user").value = document.getElementById("notify_fromaddress").value;
document.getElementById("from_addr").value = document.getElementById("notify_fromaddress").value;
if(document.getElementById("mail_sendtype").value=='SMTP'){
document.getElementById("protocol").value = "SMTP";
document.getElementById("server_url").value = document.getElementById("mail_smtpserver").value;
if(document.getElementById('mail_smtpauth_req').checked){
document.getElementById("email_user").value = document.getElementById("mail_smtpuser").value;
document.getElementById("email_password").value = document.getElementById("mail_smtppass").value;
}
}
return true;
}
//this calls the validation functions for each step that needs validation
function validate_wiz_form(step){
switch (step){
case 'step1':
if(!validate_step1()){return false;}
copy_down();
break;
case 'step2':
if(!validate_step2()){return false;}
break;
default://no additional validation needed
}
return true;
}
//this function will add validation to step1
function validate_step1(){
requiredTxt = SUGAR.language.get('app_strings', 'ERR_MISSING_REQUIRED_FIELDS');
var haserrors = 0;
var fields = new Array();
//create list of fields that need validation, based on selected options
fields[0] = 'notify_fromname';
fields[1] = 'notify_fromaddress';
fields[2] = 'massemailer_campaign_emails_per_run';
fields[3] = 'massemailer_tracking_entities_location';
if(document.getElementById("mail_sendtype").value=='SMTP'){
fields[4] = 'mail_smtpserver';
fields[5] = 'mail_smtpport';
if(document.getElementById('mail_smtpauth_req').checked){
fields[6] = 'mail_smtpuser';
fields[7] = 'mail_smtppass';
}
}
var field_value = '';
//iterate through required fields and set empty string values (' '') to null, this will cause failure later on
for (i=0; i < fields.length; i++){
elem = document.getElementById(fields[i]);
field_value = trim(elem.value);
if(field_value.length<1){
elem.value = '';
}
}
//add to generic validation and call function to calidate
if(validate['wizform']!='undefined'){delete validate['wizform']};
addToValidate('wizform', 'notify_fromaddress', 'email', true, document.getElementById('notify_fromaddress').title);
addToValidate('wizform', 'notify_fromname', 'alphanumeric', true, document.getElementById('notify_fromname').title);
addToValidate('wizform', 'massemailer_campaign_emails_per_run', 'int', true, document.getElementById('massemailer_campaign_emails_per_run').title);
addToValidate('wizform', 'massemailer_tracking_entities_location', 'alphanumeric', true, document.getElementById('massemailer_tracking_entities_location').title);
if(document.getElementById("mail_sendtype").value=='SMTP'){
addToValidate('wizform', 'mail_smtpserver', 'alphanumeric', true, document.getElementById('mail_smtpserver').title);
addToValidate('wizform', 'mail_smtpport', 'int', true, document.getElementById('mail_smtpport').title);
if(document.getElementById('mail_smtpauth_req').checked){
addToValidate('wizform', 'mail_smtpuser', 'alphanumeric', true, document.getElementById('mail_smtpuser').title);
addToValidate('wizform', 'mail_smtppass', 'alphanumeric', true, document.getElementById('mail_smtppass').title);
}
}
return check_form('wizform');
}
function validate_step2(){
requiredTxt = SUGAR.language.get('app_strings', 'ERR_MISSING_REQUIRED_FIELDS');
//validate only if the create mailbox form input has been selected
if(document.getElementById("wiz_new_mbox").value == "0"){
//this form is not checked, do not validate
return true;
}
var haserrors = 0;
var wiz_message = document.getElementById('wiz_message');
//create list of fields that need validation, based on selected options
var fields = new Array();
fields[0] = 'name';
fields[1] = 'server_url';
fields[2] = 'email_user';
fields[3] = 'protocol';
fields[4] = 'email_password';
fields[5] = 'mailbox';
fields[6] = 'port';
//iterate through required fields and set empty string values (' '') to null, this will cause failure later on
var field_value = '';
for (i=0; i < fields.length; i++){
field_value = trim(document.getElementById(fields[i]).value);
if(field_value.length<1){
add_error_style('wizform', fields[i], requiredTxt +' ' +document.getElementById(fields[i]).title );
haserrors = 1;
}
}
//add to generic validation and call function to calidate
if(validate['wizform']!='undefined'){delete validate['wizform']};
addToValidate('wizform', 'name', 'alphanumeric', true, document.getElementById('name').title);
addToValidate('wizform', 'server_url', 'alphanumeric', true, document.getElementById('server_url').title);
addToValidate('wizform', 'email_user', 'alphanumeric', true, document.getElementById('email_user').title);
addToValidate('wizform', 'email_password', 'alphanumeric', true, document.getElementById('email_password').title);
addToValidate('wizform', 'mailbox', 'alphanumeric', true, document.getElementById('mailbox').title);
addToValidate('wizform', 'protocol', 'alphanumeric', true, document.getElementById('protocol').title);
addToValidate('wizform', 'port', 'int', true, document.getElementById('port').title);
if(haserrors == 1){
return false;
}
return check_form('wizform');
}
/*
* The generic create summary will not work for this wizard, as we have a step that only gets
* displayed if a check box is marked, and we also have certain inputs we do not want displayed(ie. password)
* so this function will override the genereic version
*/
function create_summary(){
var current_step = document.getElementById('wiz_current_step');
var currentValue = parseInt(current_step.value);
var temp_elem = '';
// alert(test.title);alert(test.name);alert(test.id);
var fields = new Array();
//create the list of fields to create summary table
fields[0] = 'notify_fromname';
fields[1] = 'notify_fromaddress';
fields[2] = 'massemailer_campaign_emails_per_run';
fields[3] = 'massemailer_tracking_entities_location';
if(document.getElementById("mail_sendtype").value=='SMTP'){
fields[4] = 'mail_smtpserver';
fields[5] = 'mail_smtpport';
if(document.getElementById('mail_smtpauth_req').checked){
fields[6] = 'mail_smtpuser';
}
fields[7] = 'mail_smtpssl';
}
if(document.getElementById("wiz_new_mbox").value != "0"){
fields[8] = 'name';
fields[9] = 'server_url';
fields[10] = 'email_user';
fields[11] = 'from_addr';
fields[12] = 'protocol';
fields[13] = 'mailbox';
fields[14] = 'port';
fields[15] = 'ssl';
}
//iterate through list and create table
var summhtml = "<table class='detail view' width='100%' border='0' cellspacing='1' cellpadding='1'>";
var colorclass = 'tabDetailViewDF2';
var elem ='';
for (var i=0; i<fields.length; i++)
{elem = document.getElementById(fields[i]);
if(elem!=null){
if(elem.type.indexOf('select') >= 0 ){
var selInd = elem.selectedIndex;
if(selInd<0){selInd =0;}
summhtml = summhtml+ "<tr class='"+colorclass+"' ><td scope='row' width='15%'><b>" +elem.title+ "</b></td><td class='tabDetailViewDF' width='30%'>" + elem.options[selInd].text+ "&nbsp;</td></tr>";
}else if(elem.type == 'checked'){
summhtml = summhtml+ "<tr class='"+colorclass+"' ><td scope='row' width='15%'><b>" +elem.title+ "</b></td><td class='tabDetailViewDF' width='30%'>" + elem.value + "&nbsp;</td></tr>";
}else if(elem.type == 'checkbox'){
if(elem.checked){
summhtml = summhtml+ "<tr class='"+colorclass+"' ><td scope='row' width='15%'><b>" +elem.title+ "</b></td><td class='tabDetailViewDF' width='30%'><input type='checkbox' class='checkbox' disabled checked>&nbsp;</td></tr>";
}else{
summhtml = summhtml+ "<tr class='"+colorclass+"' ><td scope='row' width='15%'><b>" +elem.title+ "</b></td><td class='tabDetailViewDF' width='30%'><input type='checkbox' class='checkbox' disabled >&nbsp;</td></tr>";
}
}else{
summhtml = summhtml+ "<tr class='"+colorclass+"' ><td scope='row' width='15%'><b>" +elem.title+ "</b></td><td class='tabDetailViewDF' width='30%'>" + elem.value + "&nbsp;</td></tr>";
}
}
if( colorclass== 'tabDetailViewDL2'){
colorclass= 'tabDetailViewDF2';
}else{
colorclass= 'tabDetailViewDL2'
}
}
summhtml = summhtml+ "</table>";
temp_elem = document.getElementById('wiz_summ');
temp_elem.innerHTML = summhtml;
}
showfirst('email');
notify_setrequired();
</script>
EOQ;
$ss->assign("DIV_JAVASCRIPT", $divScript);
/**************************** FINAL END OF PAGE UI Stuff *******************/
//$ss->assign("JAVASCRIPT", get_validate_record_js());
$ss->display('modules/Campaigns/WizardEmailSetup.html');
?>

View File

@@ -0,0 +1,123 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('include/formbase.php');
global $mod_strings;
//get new administration bean for setup
$focus = new Administration();
$camp_steps[] = 'wiz_step_';
$camp_steps[] = 'wiz_step1_';
$camp_steps[] = 'wiz_step2_';
//name is used as key in post, it is also used in creation of summary page for wizard,
//so let's clean up the posting so we can reuse the save functionality for inbound emails and
//from existing save.php's
foreach($camp_steps as $step){
clean_up_post($step);
}
/**************************** Save general Email Setup *****************************/
//we do not need to track location if location type is not set
if(isset($_POST['tracking_entities_location_type'])) {
if ($_POST['tracking_entities_location_type'] != '2') {
unset($_POST['tracking_entities_location']);
unset($_POST['tracking_entities_location_type']);
}
}
//if the check box is empty, then set it to 0
if(!isset($_POST['mail_smtpauth_req'])) { $_POST['mail_smtpauth_req'] = 0; }
//default ssl use to false
if(!isset($_POST['mail_smtpssl'])) { $_POST['mail_smtpssl'] = 0; }
//reuse existing saveconfig functinality
$focus->saveConfig();
/**************************** Add New Monitored Box *****************************/
//perform this if the option to create new mail box has been checked
if(isset($_REQUEST['wiz_new_mbox']) && ($_REQUEST['wiz_new_mbox']=='1')){
//Populate the Request variables that inboundemail expects
$_REQUEST['mark_read'] = 1;
$_REQUEST['only_since'] = 1;
$_REQUEST['mailbox_type'] = 'bounce';
$_REQUEST['from_name'] = $_REQUEST['name'];
$_REQUEST['group_id'] = 'new';
// $_REQUEST['from_addr'] = $_REQUEST['wiz_step1_notify_fromaddress'];
//reuse save functionality for inbound email
require_once('modules/InboundEmail/Save.php');
}
//set navigation details
header("Location: index.php?action=index&module=Campaigns");
/*
* This function will re-add the post variables that exist with the specified prefix.
* It will add them minus the specified prefix. This is needed in order to reuse the save functionality,
* which does not expect the prefix, and still use the generic create summary functionality in wizard, which
* does expect the prefix.
*/
function clean_up_post($prefix){
foreach ($_REQUEST as $key => $val) {
if((strstr($key, $prefix )) && (strpos($key, $prefix )== 0)){
$newkey =substr($key, strlen($prefix)) ;
$_REQUEST[$newkey] = $val;
}
}
foreach ($_POST as $key => $val) {
if((strstr($key, $prefix )) && (strpos($key, $prefix )== 0)){
$newkey =substr($key, strlen($prefix)) ;
$_POST[$newkey] = $val;
}
}
}
?>

View File

@@ -0,0 +1,91 @@
<!--
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
********************************************************************************/
-->
<form id="wizform" name="wizform" method="POST" action="index.php">
<input type="hidden" id="module" name="module" value="Campaigns">
<input type="hidden" id="action" name="action" = "WizardHome">
<input type="hidden" id="process_form" name="process_form" value='false' >
<input type="hidden" id="return_module" name="return_module" value="{$RETURN_MODULE}">
<input type="hidden" id="return_id" name="return_id" value="{$RETURN_ID}">
<input type="hidden" id="return_action" name="return_action" value="{$RETURN_ACTION}">
<input type="hidden" id="record" name="record" value="{$ID}">
<input type="hidden" id="direct_step" name="direct_step" value="1">
<input type="hidden" id="campaign_id" name="campaign_id" value="">
<input type="hidden" id="wiz_mass" name="wiz_mass" value="">
<input type="hidden" id="mode" name="mode" value="">
<table class='other view' cellspacing="1">
<tr>
<td rowspan='2' width='10%' scope='row' style='vertical-align: top;'>
<div id='nav' >
{$NAV_ITEMS}
</div>
</td>
<td class='edit view' rowspan='2' width='100%'>
{$CAMPAIGN_DIAGNOSTIC_LINK}<p>
<table width="100%" border="0" cellspacing="1" cellpadding="0" >
<tr><td>
<div id='campaign_summary'>{$CAMPAIGN_TBL}</div><p>
</td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td>
<p><div id='campaign_trackers'>{$TRACKERS_TBL}</div>
</td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td>
<p><div id='campaign_targets'>{$TARGETS_TBL}</div>
</td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td>
<p><div id='campaign_marketing'>{$MARKETING_TBL}</div>
</td></tr>
</table>
</td></tr></table>
<script>
{$MSG_SCRIPT}
</script>
</form>

489
modules/Campaigns/WizardHome.php Executable file
View File

@@ -0,0 +1,489 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
/************** general UI Stuff *************/
require_once('modules/Campaigns/utils.php');
$focus = new Campaign();
if(isset($_REQUEST['record']) && !empty($_REQUEST['record'])) {
$focus->retrieve($_REQUEST['record']);
global $mod_strings;
global $app_list_strings;
global $app_strings;
global $current_user;
//if (!is_admin($current_user)) sugar_die("Unauthorized access to administration.");
//account for use within wizards
if($focus->campaign_type == 'NewsLetter'){
echo get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_NEWSLETTER_WIZARD_START_TITLE'].$focus->name, true, false);
}else{
echo get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_CAMPAIGN_WIZARD_START_TITLE'].$focus->name, true, false);
}
global $theme;
global $currentModule;
$ss = new Sugar_Smarty();
$ss->assign("MOD", $mod_strings);
$ss->assign("APP", $app_strings);
//if this page has been refreshed as a result of sending emails, then display status
if(isset($_REQUEST['from'])){
$mess = $mod_strings['LBL_TEST_EMAILS_SENT'];
if($_REQUEST['from']=='send'){ $mess = $mod_strings['LBL_EMAILS_SCHEDULED']; }
$confirm_msg = "var ajaxWizStatus = new SUGAR.ajaxStatusClass(); ";
$confirm_msg .= "window.setTimeout(\"ajaxWizStatus.showStatus('".$mess."')\",1000); ";
$confirm_msg .= "window.setTimeout('ajaxWizStatus.hideStatus()', 1500); ";
$confirm_msg .= "window.setTimeout(\"ajaxWizStatus.showStatus('".$mess."')\",2000); ";
$confirm_msg .= "window.setTimeout('ajaxWizStatus.hideStatus()', 5000); ";
$ss->assign("MSG_SCRIPT",$confirm_msg);
}
if (isset($_REQUEST['return_module'])) $ss->assign("RETURN_MODULE", $_REQUEST['return_module']);
if (isset($_REQUEST['return_action'])) $ss->assign("RETURN_ACTION", $_REQUEST['return_action']);
if (isset($_REQUEST['return_id'])) $ss->assign("RETURN_ID", $_REQUEST['return_id']);
if (isset($_REQUEST['record'])) $ss->assign("ID", $_REQUEST['record']);
// handle Create $module then Cancel
if (empty($_REQUEST['return_id'])) {
$ss->assign("RETURN_ACTION", 'index');
}
$ss->assign("CAMPAIGN_TBL", create_campaign_summary ($focus));
$ss->assign("TARGETS_TBL", create_target_summary ($focus));
$ss->assign("TRACKERS_TBL", create_tracker_summary ($focus));
if($focus->campaign_type =='NewsLetter' || $focus->campaign_type =='Email'){
$ss->assign("MARKETING_TBL", create_marketing_summary ($focus));
}
$camp_url = "index.php?action=WizardNewsletter&module=Campaigns&return_module=Campaigns&return_action=WizardHome";
$camp_url .= "&return_id=".$focus->id."&record=".$focus->id."&direct_step=";
$ss->assign("CAMP_WIZ_URL", $camp_url);
$mrkt_string = $mod_strings['LBL_NAVIGATION_MENU_MARKETING'];
if(!empty($focus->id)){
$mrkt_url = "<a href='index.php?action=WizardMarketing&module=Campaigns&return_module=Campaigns&return_action=WizardHome";
$mrkt_url .= "&return_id=".$focus->id."&campaign_id=".$focus->id;
$mrkt_url .= "'>". $mrkt_string."</a>";
$mrkt_string = $mrkt_url;
}
$mrkt_url = "<a href='index.php?action=WizardMarketing&module=Campaigns&return_module=Campaigns&return_action=WizardHome";
$mrkt_url .= "&return_id=".$focus->id."&campaign_id=".$focus->id;
$mrkt_url .= "'>". $mod_strings['LBL_NAVIGATION_MENU_MARKETING']."</a>";
$ss->assign("MRKT_WIZ_URL", $mrkt_url);
$summ_url = "<a href='index.php?action=WizardHome&module=Campaigns";
$summ_url .= "&return_id=".$focus->id."&record=".$focus->id;
$summ_url .= "'> ". $mod_strings['LBL_NAVIGATION_MENU_SUMMARY']."</a>";
//Create the html to fill in the wizard steps
if($focus->campaign_type == 'NewsLetter'){
$ss->assign('NAV_ITEMS',create_wiz_menu_items('newsletter',$mrkt_string,$camp_url,$summ_url ));
$ss->assign("CAMPAIGN_DIAGNOSTIC_LINK", diagnose());
}elseif($focus->campaign_type == 'Email'){
$ss->assign('NAV_ITEMS',create_wiz_menu_items('email',$mrkt_string,$camp_url,$summ_url ));
$ss->assign("CAMPAIGN_DIAGNOSTIC_LINK", diagnose());
}else{
$ss->assign('NAV_ITEMS',create_wiz_menu_items('general',$mrkt_string,$camp_url,$summ_url ));
}
/********** FINAL END OF PAGE UI Stuff ********/
$ss->display('modules/Campaigns/WizardHome.html');
}else{
//there is no record to retrieve, so ask which type of campaign wizard to launch
/* $header_URL = "Location: index.php?module=Campaigns&action=index";
$GLOBALS['log']->debug("about to post header URL of: $header_URL");
header($header_URL);
*/
global $mod_strings;
global $app_list_strings;
global $app_strings;
global $current_user;
//if (!is_admin($current_user)) sugar_die("Unauthorized access to administration.");
//account for use within wizards
echo get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_CAMPAIGN_WIZARD'].$focus->name, true, false);
$ss = new Sugar_Smarty();
$ss->assign("MOD", $mod_strings);
$ss->assign("APP", $app_strings);
$ss->display('modules/Campaigns/tpls/WizardHomeStart.tpl');
}
function create_campaign_summary ($focus){
global $mod_strings,$app_strings;
$fields = array();
$fields[] = 'name';
$fields[] = 'assigned_user_name';
$fields[] = 'status';
$fields[] = 'team_name';
$fields[] = 'start_date';
$fields[] = 'end_date';
if($focus->campaign_type=='NewsLetter'){
$fields[] = 'frequency';
}
$fields[] = 'content';
$fields[] = 'budget';
$fields[] = 'actual_cost';
$fields[] = 'expected_revenue';
$fields[] = 'expected_cost';
$fields[] = 'impressions';
$fields[] = 'objective';
//create edit view status and input buttons
$cmp_input = '';
//create edit campaign button
$cmp_input = "<input id='wiz_next_button' name='SUBMIT' ";
$cmp_input.= "onclick=\"this.form.return_module.value='Campaigns';";
$cmp_input.= "this.form.module.value='Campaigns';";
$cmp_input.= "this.form.action.value='WizardNewsletter';";
$cmp_input.= "this.form.return_action.value='WizardHome';";
$cmp_input.= "this.form.direct_step.value='1';";
$cmp_input.= "this.form.record.value='".$focus->id."';";
$cmp_input.= "this.form.return_id.value='".$focus->id."';\" ";
$cmp_input.= "class='button' value='".$mod_strings['LBL_EDIT_EXISTING']."' type='submit'> ";
//create view status button
if(($focus->campaign_type == 'NewsLetter') || ($focus->campaign_type == 'Email')){
$cmp_input .= " <input id='wiz_status_button' name='SUBMIT' ";
$cmp_input.= "onclick=\"this.form.return_module.value='Campaigns';";
$cmp_input.= "this.form.module.value='Campaigns';";
$cmp_input.= "this.form.action.value='TrackDetailView';";
$cmp_input.= "this.form.return_action.value='WizardHome';";
$cmp_input.= "this.form.record.value='".$focus->id."';";
$cmp_input.= "this.form.return_id.value='".$focus->id."';\" ";
$cmp_input.= "class='button' value='".$mod_strings['LBL_TRACK_BUTTON_TITLE']."' type='submit'>";
}
//create view roi button
$cmp_input .= " <input id='wiz_status_button' name='SUBMIT' ";
$cmp_input.= "onclick=\"this.form.return_module.value='Campaigns';";
$cmp_input.= "this.form.module.value='Campaigns';";
$cmp_input.= "this.form.action.value='RoiDetailView';";
$cmp_input.= "this.form.return_action.value='WizardHome';";
$cmp_input.= "this.form.record.value='".$focus->id."';";
$cmp_input.= "this.form.return_id.value='".$focus->id."';\" ";
$cmp_input.= "class='button' value='".$mod_strings['LBL_TRACK_ROI_BUTTON_LABEL']."' type='submit'>";
//Create Campaign Header
$cmpgn_tbl = "<p><table class='edit view' width='100%' border='0' cellspacing='0' cellpadding='0'>";
$cmpgn_tbl .= "<tr><td class='dataField' align='left'><h4 class='dataLabel'> ".$mod_strings['LBL_LIST_CAMPAIGN_NAME'].' '. $mod_strings['LBL_WIZ_NEWSLETTER_TITLE_SUMMARY']." </h4></td>";
$cmpgn_tbl .= "<td align='right'>$cmp_input</td></tr>";
$colorclass = '';
foreach($fields as $key){
if(!empty($focus->$key)){
$cmpgn_tbl .= "<tr><td scope='row' width='15%'>".$mod_strings[$focus->field_name_map[$key]['vname']]."</td>\n";
if($key == 'team_name') {
require_once('modules/Teams/TeamSetManager.php');
$cmpgn_tbl .= "<td scope='row'>".TeamSetManager::getCommaDelimitedTeams($focus->team_set_id, $focus->team_id, true)."</td></tr>\n";
} else {
$cmpgn_tbl .= "<td scope='row'>".$focus->$key."</td></tr>\n";
}
}
}
$cmpgn_tbl .= "</table></p>";
return $cmpgn_tbl ;
}
function create_marketing_summary ($focus){
global $mod_strings,$app_strings;
$colorclass = '';
//create new marketing button input
$new_mrkt_input = "<input id='wiz_new_mrkt_button' name='SUBMIT' ";
$new_mrkt_input .= "onclick=\"this.form.return_module.value='Campaigns';";
$new_mrkt_input .= "this.form.module.value='Campaigns';";
$new_mrkt_input .= "this.form.record.value='';";
$new_mrkt_input .= "this.form.return_module.value='Campaigns';";
$new_mrkt_input .= "this.form.action.value='WizardMarketing';";
$new_mrkt_input .= "this.form.return_action.value='WizardHome';";
$new_mrkt_input .= "this.form.direct_step.value='1';";
$new_mrkt_input .= "this.form.campaign_id.value='".$focus->id."';";
$new_mrkt_input .= "this.form.return_id.value='".$focus->id."';\" ";
$new_mrkt_input .= "class='button' value='".$mod_strings['LBL_CREATE_NEW_MARKETING_EMAIL']."' type='submit'>";
//create marketing email table
$mrkt_tbl='';
$focus->load_relationship('emailmarketing');
$mrkt_lists = $focus->emailmarketing->get();
$mrkt_tbl = "<p><table class='list view' width='100%' border='0' cellspacing='1' cellpadding='1'>";
$mrkt_tbl .= "<tr class='detail view'><td colspan='3'><h4> ".$mod_strings['LBL_WIZ_MARKETING_TITLE']." </h4></td>" .
"<td colspan=2 align='right'>$new_mrkt_input</td></tr>";
$mrkt_tbl .= "<tr class='listViewHRS1'><td scope='col' width='15%'><b>".$mod_strings['LBL_MRKT_NAME']."</b></td><td width='15%' scope='col'><b>".$mod_strings['LBL_FROM_MAILBOX_NAME']."</b></td><td width='15%' scope='col'><b>".$mod_strings['LBL_STATUS_TEXT']."</b></td><td scope='col' colspan=2>&nbsp;</td></tr>";
if(count($mrkt_lists)>0){
$mrkt_focus = new EmailMarketing();
foreach($mrkt_lists as $mrkt_id){
$mrkt_focus->retrieve($mrkt_id);
//create send test marketing button input
$test_mrkt_input = "<input id='wiz_new_mrkt_button' name='SUBMIT' ";
$test_mrkt_input .= "onclick=\"this.form.return_module.value='Campaigns'; ";
$test_mrkt_input .= "this.form.module.value='Campaigns'; ";
$test_mrkt_input .= "this.form.record.value='';";
$test_mrkt_input .= "this.form.return_module.value='Campaigns'; ";
$test_mrkt_input .= "this.form.action.value='QueueCampaign'; ";
$test_mrkt_input .= "this.form.return_action.value='WizardHome'; ";
$test_mrkt_input .= "this.form.wiz_mass.value='".$mrkt_focus->id."'; ";
$test_mrkt_input .= "this.form.mode.value='test'; ";
$test_mrkt_input .= "this.form.direct_step.value='1'; ";
$test_mrkt_input .= "this.form.record.value='".$focus->id."'; ";
$test_mrkt_input .= "this.form.return_id.value='".$focus->id."';\" ";
$test_mrkt_input .= "class='button' value='".$mod_strings['LBL_TEST_BUTTON_LABEL']."' type='submit'>";
//create send marketing button input
$send_mrkt_input = "<input id='wiz_new_mrkt_button' name='SUBMIT' ";
$send_mrkt_input .= "onclick=\"this.form.return_module.value='Campaigns'; ";
$send_mrkt_input .= "this.form.module.value='Campaigns'; ";
$send_mrkt_input .= "this.form.record.value='';";
$send_mrkt_input .= "this.form.return_module.value='Campaigns'; ";
$send_mrkt_input .= "this.form.action.value='QueueCampaign'; ";
$send_mrkt_input .= "this.form.return_action.value='WizardHome'; ";
$send_mrkt_input .= "this.form.wiz_mass.value='".$mrkt_focus->id."'; ";
$send_mrkt_input .= "this.form.mode.value='send'; ";
$send_mrkt_input .= "this.form.direct_step.value='1'; ";
$send_mrkt_input .= "this.form.record.value='".$focus->id."'; ";
$send_mrkt_input .= "this.form.return_id.value='".$focus->id."';\" ";
$send_mrkt_input .= "class='button' value='".$mod_strings['LBL_SEND_EMAIL']."' type='submit'>";
if( $colorclass== "class='evenListRowS1'"){
$colorclass= "class='oddListRowS1'";
}else{
$colorclass= "class='evenListRowS1'";
}
if(isset($mrkt_focus->name) && !empty($mrkt_focus->name)){
$mrkt_tbl .= "<tr $colorclass>";
$mrkt_tbl .= "<td scope='row' width='40%'><a href='index.php?action=WizardMarketing&module=Campaigns&return_module=Campaigns&return_action=WizardHome";
$mrkt_tbl .= "&return_id=" .$focus->id. "&campaign_id=" .$focus->id."&record=".$mrkt_focus->id."'>".$mrkt_focus->name."</a></td>";
$mrkt_tbl .= "<td scope='row' width='25%'>".$mrkt_focus->from_name."</td>";
$mrkt_tbl .= "<td scope='row' width='15%'>".$mrkt_focus->status."</td>";
$mrkt_tbl .= "<td scope='row' width='10%'>$test_mrkt_input</td>";
$mrkt_tbl .= "<td scope='row' width='10%'>$send_mrkt_input</td>";
$mrkt_tbl .= "</tr>";
}
}
}else{
$mrkt_tbl .= "<tr><td colspan='3'>".$mod_strings['LBL_NONE']."</td></tr>";
}
$mrkt_tbl .= "</table></p>";
return $mrkt_tbl ;
}
function create_target_summary ($focus){
global $mod_strings,$app_strings,$app_list_strings;
$colorclass = '';
$camp_type = $focus->campaign_type;
//create schedule table
$pltbl='';
//set the title based on campaign type
$target_title = $mod_strings['LBL_TARGET_LISTS'];
if($camp_type=='NewsLetter'){
$target_title = $mod_strings['LBL_NAVIGATION_MENU_SUBSCRIPTIONS'];
}
$focus->load_relationship('prospectlists');
$pl_lists = $focus->prospectlists->get();
$pl_tbl = "<p><table align='center' class='list view' width='100%' border='0' cellspacing='1' cellpadding='1'>";
$pl_tbl .= "<tr class='detail view'><td colspan='4'><h4> ".$target_title." </h4></td></tr>";
$pl_tbl .= "<tr class='listViewHRS1'><td width='50%' scope='col'><b>".$mod_strings['LBL_LIST_NAME']."</b></td><td width='30%' scope='col'><b>".$mod_strings['LBL_LIST_TYPE']."</b></td>";
$pl_tbl .= "<td width='15%' scope='col'><b>".$mod_strings['LBL_TOTAL_ENTRIES']."</b></td><td width='5%' scope='col'>&nbsp;</td></tr>";
if(count($pl_lists)>0){
$pl_focus = new ProspectList();
foreach($pl_lists as $pl_id){
if( $colorclass== "class='evenListRowS1'"){
$colorclass= "class='oddListRowS1'";
}else{
$colorclass= "class='evenListRowS1'";
}
$pl_focus->retrieve($pl_id);
//set the list type if this is a newsletter
$type=$pl_focus->list_type;
if($camp_type=='NewsLetter'){
if (($pl_focus->list_type == 'default') || ($pl_focus->list_type == 'seed')){$type = $mod_strings['LBL_SUBSCRIPTION_TYPE_NAME'];}
if($pl_focus->list_type == 'exempt'){$type = $mod_strings['LBL_UNSUBSCRIPTION_TYPE_NAME'];}
if($pl_focus->list_type == 'test'){$type = $mod_strings['LBL_TEST_TYPE_NAME'];}
}else{
$type = $app_list_strings['prospect_list_type_dom'][$pl_focus->list_type];
}
if(isset($pl_focus->id) && !empty($pl_focus->id)){
$pl_tbl .= "<tr $colorclass>";
$pl_tbl .= "<td scope='row' width='50%'><a href='index.php?action=DetailView&module=ProspectLists&return_module=Campaigns&return_action=WizardHome&return_id=" .$focus->id. "&record=".$pl_focus->id."'>";
$pl_tbl .= $pl_focus->name."</a></td>";
$pl_tbl .= "<td scope='row' width='30%'>$type</td>";
$pl_tbl .= "<td scope='row' width='15%'>".$pl_focus->get_entry_count()."</td>";
$pl_tbl .= "<td scope='row' width='5%' align='right'><a href='index.php?action=EditView&module=ProspectLists&return_module=Campaigns&return_action=WizardHome&return_id=" .$focus->id. "&record=".$pl_focus->id."'>";
$pl_tbl .= "<img src='".SugarThemeRegistry::current()->getImageURL("edit_inline.gif")."' border=0></a>&nbsp;";
$pl_tbl .= "<a href='index.php?action=DetailView&module=ProspectLists&return_module=Campaigns&return_action=WizardHome&return_id=" .$focus->id. "&record=".$pl_focus->id."'>";
$pl_tbl .= "<img src='".SugarThemeRegistry::current()->getImageURL("view_inline.gif")."' border=0></a></td>";
}
}
}else{
$pl_tbl .= "<tr><td class='$colorclass' scope='row' colspan='2'>".$mod_strings['LBL_NONE']."</td></tr>";
}
$pl_tbl .= "</table></p>";
return $pl_tbl;
}
function create_tracker_summary ($focus){
global $mod_strings,$app_strings;
$colorclass = '';
$trkr_tbl='';
//create tracker table
$focus->load_relationship('tracked_urls');
$trkr_lists = $focus->tracked_urls->get();
$trkr_tbl = "<p><table align='center' class='list view' width='100%' border='0' cellspacing='1' cellpadding='1'>";
$trkr_tbl .= "<tr class='detail view'><td colspan='6'><h4> ".$mod_strings['LBL_NAVIGATION_MENU_TRACKERS']." </h4></td></tr>";
$trkr_tbl .= "<tr class='listViewHRS1'><td width='15%' scope='col'><b>".$mod_strings['LBL_EDIT_TRACKER_NAME']."</b></td><td width='15%' scope='col'><b>".$mod_strings['LBL_EDIT_TRACKER_URL']."</b></td><td width='15%' scope='col'><b>".$mod_strings['LBL_EDIT_OPT_OUT']."</b></td></tr>";
if(count($trkr_lists)>0){
foreach($trkr_lists as $trkr_id){
if( $colorclass== "class='evenListRowS1'"){
$colorclass= "class='oddListRowS1'";
}else{
$colorclass= "class='evenListRowS1'";
}
$ct_focus = new CampaignTracker();
$ct_focus->retrieve($trkr_id);
if(isset($ct_focus->tracker_name) && !empty($ct_focus->tracker_name)){
if($ct_focus->is_optout){$opt = 'checked';}else{$opt = '';}
$trkr_tbl .= "<tr $colorclass>";
$trkr_tbl .= "<td scope='row' ><a href='index.php?action=DetailView&module=CampaignTrackers&return_module=Campaigns&return_action=WizardHome&return_id=" .$focus->id. "&record=".$ct_focus->id."'>";
$trkr_tbl .= $ct_focus->tracker_name."</a></td>";
$trkr_tbl .= "<td scope='row' width='15%'>".$ct_focus->tracker_url."</td>";
$trkr_tbl .= "<td scope='row' width='15%'>&nbsp;&nbsp;<input type='checkbox' class='checkbox' $opt disabled></td>";
$trkr_tbl .= "</tr>";
}
}
}else{
$trkr_tbl .= "<tr ><td colspan='3'>".$mod_strings['LBL_NONE']."</td>";
}
$trkr_tbl .= "</table></p>";
return $trkr_tbl ;
}
function create_wiz_menu_items($type,$mrkt_string,$camp_url,$summ_url){
global $mod_strings;
$steps[$mod_strings['LBL_NAVIGATION_MENU_GEN1']] = 'modules/Campaigns/tpls/WizardCampaignHeader.tpl';
$steps[$mod_strings['LBL_NAVIGATION_MENU_GEN2']] = 'modules/Campaigns/tpls/WizardCampaignBudget.tpl';
$steps[$mod_strings['LBL_NAVIGATION_MENU_TRACKERS']] = 'modules/Campaigns/tpls/WizardCampaignTracker.tpl';
if($type == 'newsletter'){
$steps[$mod_strings['LBL_NAVIGATION_MENU_SUBSCRIPTIONS']] = 'modules/Campaigns/tpls/WizardCampaignTargetList.tpl';
}else{
$steps[$mod_strings['LBL_TARGET_LISTS']] = 'modules/Campaigns/tpls/WizardCampaignTargetListForNonNewsLetter.tpl';
}
$nav_html = '<table border="0" cellspacing="0" cellpadding="0" width="100%" >';
if(isset($steps) && !empty($steps)){
$i=1;
foreach($steps as $name=>$step){
$nav_html .= "<tr><td scope='row' nowrap><div id='nav_step$i'><a href='".$camp_url.$i."'>$name</a></div></td></tr>";
$i=$i+1;
}
}
if($type == 'newsletter' || $type == 'email'){
$nav_html .= "<td scope='row' nowrap><div id='nav_step'".($i+1).">$mrkt_string</div></td></tr>";
$nav_html .= "<td scope='row' nowrap><div id='nav_step'".($i+2).">".$mod_strings['LBL_NAVIGATION_MENU_SEND_EMAIL']."</div></td></tr>";
$nav_html .= "<td scope='row' nowrap><div id='nav_step'".($i+3).">".$summ_url."</div></td></tr>";
}else{
$nav_html .= "<td scope='row' nowrap><div id='nav_step'".($i+1).">".$summ_url."</div></td></tr>";
}
$nav_html .= '</table>';
return $nav_html;
}
?>

View File

@@ -0,0 +1,381 @@
<!--
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
********************************************************************************/
-->
<div id='wiz_stage'>
<form id="wizform" name="wizform" method="POST" action="index.php">
<input type="hidden" name="module" value="Campaigns">
<input type="hidden" id="record" name="record" value="{$MRKT_ID}">
<input type="hidden" name="campaign_id" value="{$CAMPAIGN_ID}">
<input type="hidden" id='action' name="action">
<input type="hidden" id="return_module" name="return_module" value="{$RETURN_MODULE}">
<input type="hidden" id="return_id" name="return_id" value="{$RETURN_ID}">
<input type="hidden" id="return_action" name="return_action" value="{$RETURN_ACTION}">
<input type="hidden" id="direct_step" name="direct_step" value='4'>
<input type="hidden" id="wiz_total_steps" name="totalsteps" value="2">
<input type="hidden" id="wiz_current_step" name="currentstep" value='0'>
<input type="hidden" id="wiz_back" name="wiz_back" value='none'>
<input type="hidden" id="wiz_next" name="wiz_next" value='2'>
<input type="hidden" id="direction" name="wiz_direction" value='exit'>
<p>
<div id ='buttons' >
<table width="100%" border="0" cellspacing="0" cellpadding="0" >
<tr>
<td align="left" width='30%'>
<table border="0" cellspacing="0" cellpadding="0" ><tr>
<tr>
<td><div id="back_button_div2"><input id="wiz_back_button" type='hidden' title="{$APP.LBL_BACK}" class="button" onclick="determine_back();" name="back" value=" {$APP.LBL_BACK}"></div></td>
<td><div id="back_button_div"><input id="wiz_back_button" type='button' title="{$APP.LBL_BACK}" class="button" onclick="determine_back();" name="back" value=" {$APP.LBL_BACK}"></div></td>
<td><div id="cancel_button_div"><input id="wiz_cancel_button" title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="this.form.action.value='WizardHome'; this.form.module.value='Campaigns'; this.form.record.value='{$CAMPAIGN_ID}';" type="submit" name="button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}"></div></td>
<td><div id="save_button_div"><input id="wiz_submit_button" title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button" onclick="this.form.action.value='WizardMarketingSave'; this.form.module.value='Campaigns';" type="submit" name="button" value="{$MOD.LBL_SAVE_EXIT_BUTTON_LABEL}" ></div>
</td>
<td><div id="next_button_div"><input id="wiz_next_button" type='button' title="{$APP.LBL_NEXT_BUTTON_LABEL}" class="button" onclick="javascript:navigate('next');" name="button" value="{$APP.LBL_NEXT_BUTTON_LABEL}"></div></td>
</tr>
</table>
</td>
<td align="right" width='40%'><div id='wiz_location_message'></td>
</tr>
</table>
</div>
</p>
<table class='other view' cellspacing="1">
<tr>
<td rowspan='2' width='10%' scope="row" style="vertical-align: top;">
<div id='nav' >
<table border="0" cellspacing="0" cellpadding="0" width="100%" >
<tr><td scope='row'><div id='nav_step3'><a href='{$CAMP_WIZ_URL}1'>{$MOD.LBL_NAVIGATION_MENU_GEN1}</a></div></td></tr>
<tr><td scope='row'><div id='nav_step4'><a href='{$CAMP_WIZ_URL}2'>{$MOD.LBL_NAVIGATION_MENU_GEN2}</a></div></td></tr>
<tr><td scope='row'><div id='nav_step5'><a href='{$CAMP_WIZ_URL}3'>{$MOD.LBL_NAVIGATION_MENU_TRACKERS}</a></div></td></tr>
<tr><td scope='row'><div id='nav_step6'><a href='{$CAMP_WIZ_URL}4'>{$MOD.LBL_NAVIGATION_MENU_SUBSCRIPTIONS}</a></div></td></tr>
<tr><td scope='row'><div id='nav_step1'>{$MOD.LBL_NAVIGATION_MENU_MARKETING}</div></td></tr>
<tr><td scope='row'><div id='nav_step2'>{$MOD.LBL_NAVIGATION_MENU_SEND_EMAIL}</div></td></tr>
<tr><td scope='row'><div id='nav_step7'>{$MOD.LBL_NAVIGATION_MENU_SUMMARY}</div></td></tr>
</table>
</div>
</td>
<td rowspan='2' width='100%' style="padding: 0;">
<div id="wiz_message"></div>
<div id=wizard>
<div id='step1' >
<table border="0" cellpadding="0" cellspacing="0" width="100%" class='edit view'>
<tr>
<th colspan="4" align="left" ><h4 scope="row" NOWRAP valign="top">{$MOD.LBL_WIZ_MARKETING_TITLE} {$MRKT_NAME}</h4></td>
</tr>
<tr><td scope="row" colspan="3">{$MOD.LBL_WIZARD_MARKETING_MESSAGE}<br></td><td>&nbsp;</td></tr>
<tr><td colspan="4">&nbsp;</td></tr>
<tr>
<td scope="row" NOWRAP valign="top"><slot>{$MOD.LBL_MRKT_NAME} <span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span></slot></td>
<td ><slot><input id='name' name='wiz_step3_name' title='{$MOD.LBL_MRKT_NAME}' size='25' maxlength='25' type="text" value="{$MRKT_NAME}"></slot></td>
<td scope="row" NOWRAP valign="top"><slot>{$MOD.LBL_STATUS_TEXT} <span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span></slot></td>
<td ><slot><select tabindex='2' id='status' title='{$MOD.LBL_STATUS_TEXT}' name='wiz_step3_status'>{$STATUS_OPTIONS}</select></slot></td>
</tr>
<tr>
<td scope="row" NOWRAP valign="top"><slot>{$MOD.LBL_FROM_MAILBOX_NAME}<span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span></slot></td>
<td ><slot><select title='{$MOD.LBL_FROM_MAILBOX_NAME}' id='inbound_email_id' name='wiz_step3_inbound_email_id' onchange='set_from_reply_info(this);'>{$MAILBOXES}</select></slot></td>
<td scope="row" NOWRAP valign="top"><slot>{$MOD.LBL_START_DATE_TIME} <span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span></slot></td>
<td class="datafield"><slot><table cellpadding="0" cellspacing="0"><tr><td nowrap><input title ='{$MOD.LBL_START_DATE_TIME}' id='date_start' name='wiz_step3_date_start' onblur="parseDate(this, '{$CALENDAR_DATEFORMAT}');" size='11' tabindex='1' maxlength='10' type="text" value="{$MRKT_DATE_START}"> <img src="{sugar_getimagepath file='jscalendar.gif'}" alt="{$CALENDAR_DATEFORMAT}" id="jscal_trigger" align="absmiddle">&nbsp;</td>
<td nowrap><input type="text" size='5' maxlength='5' id='time_start' name='wiz_step3_time_start' tabindex="1" value="{$MRKT_TIME_START}"/>{$TIME_MERIDIEM}</td></tr><tr><td nowrap><span class="dateFormat">{$USER_DATEFORMAT}</span></td><td nowrap><span class="dateFormat">{$TIME_FORMAT}</span></td></tr></table></slot></td>
</tr>
<tr>
<td scope="row" NOWRAP valign="top"><slot>{$MOD.LBL_FROM_NAME} <span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span></slot></td>
<td class="datafield"><slot><input name='wiz_step3_from_name' id='from_name' title='{$MOD.LBL_FROM_NAME}' tabindex='2' size='25' maxlength='{$MRKT_FROM_NAME_LEN}' type="text" value="{$MRKT_FROM_NAME}"></slot></td>
<td scope="row" NOWRAP valign="top"><slot>{$MOD.LBL_FROM_ADDR} <span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span></slot></td>
<td class="datafield"><slot><input name='wiz_step3_from_addr' id='from_addr' title='{$MOD.LBL_FROM_ADDR}' tabindex='2' size='25' maxlength='{$MRKT_FROM_NAME_LEN}' type="text" value="{$MRKT_FROM_ADDR}"></slot></td>
</tr>
<tr>
<td scope="row" NOWRAP valign="top"><slot>{$MOD.LBL_REPLY_NAME}</slot></td>
<td class="datafield"><slot><input name='wiz_step3_reply_to_name' id='reply_name' title='{$MOD.LBL_REPLY_NAME}' tabindex='2' size='25' maxlength='{$MRKT_REPLY_NAME_LEN}' type="text" value="{$MRKT_REPLY_NAME}"></slot></td>
<td scope="row" NOWRAP valign="top"><slot>{$MOD.LBL_REPLY_ADDR}</slot></td>
<td class="datafield"><slot><input name='wiz_step3_reply_to_addr' id='reply_addr' title='{$MOD.LBL_REPLY_ADDR}' tabindex='2' size='25' maxlength='{$MRKT_REPLY_ADDR_LEN}' type="text" value="{$MRKT_REPLY_ADDR}"></slot></td>
</tr>
<tr>
<td scope="row" NOWRAP valign="top"><slot>{$MOD.LBL_MESSAGE_FOR} <span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span></slot></td>
<td class="datafield"><slot><input type="checkbox" tabindex='1' onclick="toggle_message_for(this);" id="all_prospect_lists" {$ALL_PROSPECT_LISTS_CHECKED} name='all_prospect_lists'>{$MOD.LBL_ALL_PROSPECT_LISTS}</slot></td>
<td scope="row" NOWRAP valign="top"><slot>{$MOD.LBL_TEMPLATE} <span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span></slot></td>
<td class="datafield" nowrap>
<select id="template_id" name='template_id' tabindex='2' onchange="show_edit_template_link(this);">{$EMAIL_TEMPLATE_OPTIONS}</select>
&nbsp;<input type='button' class='button' onclick='open_email_template_form();' value='{$MOD.LBL_CREATE_EMAIL_TEMPLATE}'>
<span name='edit_template' id='edit_template' style="{$EDIT_TEMPLATE}">
&nbsp;<input type='button' class='button' onclick='edit_email_template_form();' value='{$MOD.LBL_EDIT_EMAIL_TEMPLATE}'>
</span>
</slot>
</td>
</tr>
<tr>
<td scope="row" NOWRAP valign="top"><slot>&nbsp;</slot></td>
<td width="35%" class="datafield"><slot><select {$MESSAGE_FOR_DISABLED} tabindex='1' multiple size="5" id="message_for" name='message_for[]'>{$SCOPE_OPTIONS}</select></slot></td>
<td scope="row" NOWRAP valign="top"><slot>&nbsp;</slot></td>
<td><slot>&nbsp;</slot></td>
</tr>
</table>
{literal}
<script type="text/javascript">
Calendar.setup ({{/literal}
inputField : "date_start", ifFormat : "{$CALENDAR_DATEFORMAT}", showsTime : false, button : "jscal_trigger", singleClick : true, step : 1
{literal}});
function show_edit_template_link(field) {
var field1=document.getElementById('edit_template');
if (field.selectedIndex == 0) {
field1.style.visibility="hidden";
}
else {
field1.style.visibility="visible";
}
}
function refresh_email_template_list(template_id, template_name) {
var field=document.getElementById('template_id');
var bfound=0;
for (var i=0; i < field.options.length; i++) {
if (field.options[i].value == template_id) {
if (field.options[i].selected==false) {
field.options[i].selected=true;
}
field.options[i].text = template_name;
bfound=1;
}
}
//add item to selection list.
if (bfound == 0) {
var newElement=document.createElement('option');
newElement.text=template_name;
newElement.value=template_id;
field.options.add(newElement);
newElement.selected=true;
}
//enable the edit button.
var field1=document.getElementById('edit_template');
field1.style.visibility="visible";
}
function open_email_template_form() {
{/literal}
URL="index.php?module=EmailTemplates&action=EditView&campaign_id={$CAMPAIGN_ID}";
URL+="&sugar_body_only=1";
{literal}
windowName = 'email_template';
windowFeatures = 'width=800' + ',height=600' + ',resizable=1,scrollbars=1';
win = window.open(URL, windowName, windowFeatures);
if(window.focus)
{
// put the focus on the popup if the browser supports the focus() method
win.focus();
}
}
function edit_email_template_form() {
{/literal}
var field=document.getElementById('template_id');
URL="index.php?module=EmailTemplates&action=EditView&campaign_id={$CAMPAIGN_ID}";
URL+="&sugar_body_only=1";
{literal}
if (field.options[field.selectedIndex].value != 'undefined') {
URL+="&record="+field.options[field.selectedIndex].value;
}
windowName = 'email_template';
windowFeatures = 'width=800' + ',height=600' + ',resizable=1,scrollbars=1';
win = window.open(URL, windowName, windowFeatures);
if(window.focus)
{
// put the focus on the popup if the browser supports the focus() method
win.focus();
}
}
function toggle_message_for(all_prospects_checkbox) {
message_for = document.getElementById('message_for');
if (all_prospects_checkbox.checked) {
message_for.disabled=true;
} else {
message_for.disabled=false;
}
}
{/literal}
var from_emails=new Array({$FROM_EMAILS});
{literal}
function set_from_email_and_name(mailbox) {
from_email_span = document.getElementById('from_email');
from_name = document.getElementById('from_name');
for (i=0; i<=from_emails.length; i++) {
if ((mailbox.value == '' && from_emails[i] =='EMPTY') || from_emails[i] == mailbox.value) {
var j=i+1;
from_email_span.innerHTML=from_emails[j+1];
if (from_name.value=='') {
from_name.value=from_emails[j];
}
return;
}
}
}
{/literal}
// cn: bug 12587 - allow setting of Reply-to X from campaigns
var ie_stored_options = {$IEStoredOptions};
{literal}
function set_from_reply_info(mailbox) {
var fn = document.getElementById('from_name');
var fa = document.getElementById('from_addr');
var rn = document.getElementById('reply_name');
var ra = document.getElementById('reply_addr');
if(mailbox.value != '') {
if(ie_stored_options[mailbox.value]) {
var focusIe = ie_stored_options[mailbox.value];
// from name
if(focusIe.from_name && focusIe.from_name != "")
fn.value = focusIe.from_name;
else
fn.value = '';
// from addr
if(focusIe.from_addr && focusIe.from_addr != "")
fa.value = focusIe.from_addr;
else
fa.value = '';
// reply name
if(focusIe.reply_to_name && focusIe.reply_to_name != "")
rn.value = focusIe.reply_to_name;
else
rn.value = '';
// reply add
if(focusIe.reply_to_addr && focusIe.reply_to_addr != "")
ra.value = focusIe.reply_to_addr;
else
ra.value = '';
}
} else {
fn.value = '';
fa.value = '';
rn.value = '';
ra.value = '';
}
}
</script>
{/literal}
</div>
</div>
<div id='step2' >
<table>
<td ><h3>{$MOD.LBL_WIZ_SENDMAIL_TITLE} {$MRKT_NAME}</h3></td>
<tr><td class="datalabel">{$MOD.LBL_WIZARD_SENDMAIL_MESSAGE}<br></td></tr>
<tr><td class="datalabel">&nbsp;</td></tr>
<tr><td>
<input type="radio" id="next_step" name="wiz_home_next_step" value='1'checked >{$MOD.LBL_SAVE_EXIT_BUTTON_LABEL}
</td></tr>
<tr><td>
&nbsp;<div id='target_message'><font color='red'><b>{$WARNING_MESSAGE}</b></font></div>
&nbsp;<div id='send_email1' ><input type="radio" id="next_step" name="wiz_home_next_step" value='2' {$PL_DISABLED}>{$MOD.LBL_SEND_AS_TEST}</div>
</td></tr>
<tr><td>
&nbsp;<div id='send_email2' {$SHOW_DIVS}><input type="radio" id="next_step" name='wiz_home_next_step' value='3' {$PL_DISABLED}>{$MOD.LBL_SEND_EMAIL}</div>
</td></tr></table>
</div>
</td>
</tr>
</table>
{literal}
<script language="javascript">
function determine_back(){
{/literal}
var current_step = document.getElementById('wiz_current_step').value;
var total_steps = document.getElementById('wiz_total_steps').value;
{literal}
if(current_step == 1){
{/literal}
document.getElementById('action').value='WizardNewsletter';
document.getElementById('record').value='{$CAMPAIGN_ID}';
document.getElementById('return_id').value='{$CAMPAIGN_ID}';
document.getElementById('direct_step').value='4';
document.getElementById('wizform').submit();
{literal}
}else{
navigate('back');
}
}
</script>
{/literal}
</form>
</div>
<script type="text/javascript" language="javascript" src="modules/Campaigns/wizard.js"></script>
<script type='text/javascript' src='include/javascript/sugar_grp_overlib.js'></script>
<div id='overDiv' style='position:absolute; visibility:hidden; z-index:1000;'></div>
{$WIZ_JAVASCRIPT}
{$DIV_JAVASCRIPT}
{$JAVASCRIPT}
<script language="javascript">
// link_navs();
addToValidate('wizform', 'inbound_email_id', 'alphanumeric', true, document.getElementById('inbound_email_id').title);
</script>

View File

@@ -0,0 +1,317 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
/**************************** general UI Stuff *******************/
require_once('modules/Campaigns/utils.php');
global $app_strings;
global $timedate;
global $app_list_strings;
global $mod_strings;
global $current_user;
global $sugar_version, $sugar_config;
/**************************** GENERAL SETUP WORK*******************/
$campaign_focus = new Campaign();
if (isset($_REQUEST['campaign_id']) && !empty($_REQUEST['campaign_id'])) {
$campaign_focus->retrieve($_REQUEST['campaign_id']);
}else{
sugar_die($app_strings['ERROR_NO_RECORD']);
}
global $theme;
$json = getJSONobj();
$GLOBALS['log']->info("Wizard Continue Create Wizard");
if($campaign_focus->campaign_type=='NewsLetter'){
echo get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_NEWSLETTER WIZARD_TITLE'].' '.$campaign_focus->name, true);
}else{
echo get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_CAMPAIGN'].' '.$campaign_focus->name, true);
}
$ss = new Sugar_Smarty();
$ss->assign("MOD", $mod_strings);
$ss->assign("APP", $app_strings);
if (isset($_REQUEST['return_module'])) $ss->assign("RETURN_MODULE", $_REQUEST['return_module']);
if (isset($_REQUEST['return_action'])) $ss->assign("RETURN_ACTION", $_REQUEST['return_action']);
if (isset($_REQUEST['return_id'])) $ss->assign("RETURN_ID", $_REQUEST['return_id']);
// handle Create $module then Cancel
$ss->assign('CAMPAIGN_ID', $campaign_focus->id);
$seps = get_number_seperators();
$ss->assign("NUM_GRP_SEP", $seps[0]);
$ss->assign("DEC_SEP", $seps[1]);
/**************************** MARKETING UI DIV Stuff *******************/
//$campaign_focus->load_relationship('emailmarketing');
//$mrkt_ids = $campaign_focus->emailmarketing->get();
$mrkt_focus = new EmailMarketing();
//if record param exists and it is not empty, then retrieve this bean
if(isset($_REQUEST['record']) and !empty($_REQUEST['record'])){
$mrkt_focus->retrieve($_REQUEST['record']);
}else{
//check to see if this campaign has an email marketing already attached, and if so, create duplicate
$campaign_focus->load_relationship('emailmarketing');
$mrkt_lists = $campaign_focus->emailmarketing->get();
if(!empty($mrkt_lists)){
//reverse array so we always use the most recent one:
$mrkt_lists = array_reverse($mrkt_lists);
$mrkt_focus->retrieve($mrkt_lists[0]);
$mrkt_focus->id = '';
$mrkt_focus->name = $mod_strings['LBL_COPY_OF'] . ' '. $mrkt_focus->name;
}
}
$ss->assign("CALENDAR_LANG", "en");
$ss->assign("USER_DATEFORMAT", '('. $timedate->get_user_date_format().')');
$ss->assign("CALENDAR_DATEFORMAT", $timedate->get_cal_date_format());
$ss->assign("TIME_MERIDIEM", $timedate->AMPMMenu('', $mrkt_focus->time_start));
$ss->assign("MRKT_ID", $mrkt_focus->id);
$ss->assign("MRKT_NAME", $mrkt_focus->name);
$ss->assign("MRKT_FROM_NAME", $mrkt_focus->from_name);
$ss->assign("MRKT_FROM_ADDR", $mrkt_focus->from_addr);
$def = $mrkt_focus->getFieldDefinition('from_name');
$ss->assign("MRKT_FROM_NAME_LEN", $def['len']);
//jc: bug 15498
// assigning the length of the reply name from the var defs to the template to be used
// as the max length for the input field
$def = $mrkt_focus->getFieldDefinition('reply_to_name');
$ss->assign("MRKT_REPLY_NAME_LEN", $def['len']);
$ss->assign("MRKT_REPLY_NAME", $mrkt_focus->reply_to_name);
$def = $mrkt_focus->getFieldDefinition('reply_to_addr');
$ss->assign("MRKT_REPLY_ADDR_LEN", $def['len']);
// end bug 15498
$ss->assign("MRKT_REPLY_ADDR", $mrkt_focus->reply_to_addr);
$ss->assign("MRKT_DATE_START", $mrkt_focus->date_start);
$ss->assign("MRKT_TIME_START", $mrkt_focus->time_start);
//$_REQUEST['mass'] = $mrkt_focus->id;
$ss->assign("MRKT_ID", $mrkt_focus->id);
$emails=array();
$mailboxes=get_campaign_mailboxes($emails);
/*
* get full array of stored options
*/
$IEStoredOptions = get_campaign_mailboxes_with_stored_options();
$IEStoredOptionsJSON = (!empty($IEStoredOptions)) ? $json->encode($IEStoredOptions, false) : 'new Object()';
$ss->assign("IEStoredOptions", $IEStoredOptionsJSON);
//add empty options.
$emails['']='nobody@example.com';
$mailboxes['']='';
//inbound_email_id
$default_email_address='nobody@example.com';
$from_emails = '';
foreach ($mailboxes as $id=>$name) {
if (!empty($from_emails)) {
$from_emails.=',';
}
if ($id=='') {
$from_emails.="'EMPTY','$name','$emails[$id]'";
} else {
$from_emails.="'$id','$name','$emails[$id]'";
}
}
$ss->assign("FROM_EMAILS",$from_emails);
$ss->assign("DEFAULT_FROM_EMAIL",$default_email_address);
$ss->assign("STATUS_OPTIONS", get_select_options_with_id($app_list_strings['email_marketing_status_dom'],$mrkt_focus->status));
if (empty($mrkt_focus->inbound_email_id)) {
$ss->assign("MAILBOXES", get_select_options_with_id($mailboxes, ''));
} else {
$ss->assign("MAILBOXES", get_select_options_with_id($mailboxes, $mrkt_focus->inbound_email_id));
}
$ss->assign("TIME_MERIDIEM", $timedate->AMPMMenu('', $mrkt_focus->time_start));
$ss->assign("TIME_FORMAT", '('. $timedate->get_user_time_format().')');
$email_templates_arr = get_bean_select_array(true, 'EmailTemplate','name','','name');
if($mrkt_focus->template_id) {
$ss->assign("TEMPLATE_ID", $mrkt_focus->template_id);
$ss->assign("EMAIL_TEMPLATE_OPTIONS", get_select_options_with_id($email_templates_arr, $mrkt_focus->template_id));
$ss->assign("EDIT_TEMPLATE","visibility:inline");
}
else {
$ss->assign("EMAIL_TEMPLATE_OPTIONS", get_select_options_with_id($email_templates_arr, ""));
$ss->assign("EDIT_TEMPLATE","visibility:hidden");
}
$scope_options=get_message_scope_dom($campaign_focus->id,$campaign_focus->name,$mrkt_focus->db);
$prospectlists=array();
if (isset($mrkt_focus->all_prospect_lists) && $mrkt_focus->all_prospect_lists==1) {
$ss->assign("ALL_PROSPECT_LISTS_CHECKED","checked");
$ss->assign("MESSAGE_FOR_DISABLED","disabled");
}
else {
//get select prospect list.
if (!empty($mrkt_focus->id)) {
$mrkt_focus->load_relationship('prospectlists');
$prospectlists=$mrkt_focus->prospectlists->get();
};
}
if (empty($prospectlists)) $prospectlists=array();
if (empty($scope_options)) $scope_options=array();
$ss->assign("SCOPE_OPTIONS", get_select_options_with_id($scope_options, $prospectlists));
$ss->assign("SAVE_CONFIRM_MESSAGE", $mod_strings['LBL_CONFIRM_SEND_SAVE']);
$javascript = new javascript();
$javascript->setFormName('wizform');
$javascript->setSugarBean($mrkt_focus);
$javascript->addAllFields('');
echo $javascript->getScript();
/**************************** Final Step UI DIV *******************/
//Grab the prospect list of type default
$default_pl_focus = ' ';
$campaign_focus->load_relationship('prospectlists');
$prospectlists=$campaign_focus->prospectlists->get();
$pl_count = 0;
$pl_lists = 0;
if(!empty($prospectlists)){
foreach ($prospectlists as $prospect_id){
$pl_focus = new ProspectList();
$pl_focus->retrieve($prospect_id);
if (($pl_focus->list_type == 'default') || ($pl_focus->list_type == 'seed')){
$default_pl_focus= $pl_focus;
// get count of all attached target types
$pl_count = $default_pl_focus->get_entry_count();
}
$pl_lists = $pl_lists+1;
}
}
//if count is 0, then hide inputs and and print warning message
if ($pl_count==0){
if ($pl_lists==0){
//print no target list warning
$ss->assign("WARNING_MESSAGE", $mod_strings['LBL_NO_TARGETS_WARNING']);
}else{
//print no entries warning
if($campaign_focus->campaign_type='NewsLetter'){
$ss->assign("WARNING_MESSAGE", $mod_strings['LBL_NO_SUBS_ENTRIES_WARNING']);
}else{
$ss->assign("WARNING_MESSAGE", $mod_strings['LBL_NO_TARGET_ENTRIES_WARNING']);
}
}
//disable the send email options
$ss->assign("PL_DISABLED",'disabled');
}else{
//show inputs and assign type to be radio
}
/**************************** WIZARD UI DIV Stuff *******************/
$camp_url = "index.php?action=WizardNewsletter&module=Campaigns&return_module=Campaigns&return_action=WizardHome";
$camp_url .= "&return_id=".$campaign_focus->id."&record=".$campaign_focus->id."&direct_step=";
$ss->assign("CAMP_WIZ_URL", $camp_url);
$summ_url = $mod_strings['LBL_NAVIGATION_MENU_SUMMARY'];
if(!empty($focus->id)){
$summ_url = "<a href='index.php?action=WizardHome&module=Campaigns";
$summ_url .= "&return_id=".$focus->id."&record=".$focus->id;
$summ_url .= "'> ". $mod_strings['LBL_NAVIGATION_MENU_SUMMARY']."</a>";
}
$summ_url = $mod_strings['LBL_NAVIGATION_MENU_SUMMARY'];
if(!empty($focus->id)){
$summ_url = "index.php?action=WizardHome&module=Campaigns&return_id=".$focus->id."&record=".$focus->id;
}
$ss->assign("SUMM_URL", $summ_url);
// this is the wizard control script that resides in page
$divScript = <<<EOQ
<script type="text/javascript" language="javascript">
/*
* this is the custom validation script that will call the right validation for each div
*/
function validate_wiz_form(step){
switch (step){
case 'step1':
return check_form('wizform');
break;
default://no additional validation needed
}
return true;
}
showfirst('marketing')
</script>
EOQ;
//$ss->assign("WIZ_JAVASCRIPT", print_wizard_jscript());
$ss->assign("DIV_JAVASCRIPT", $divScript);
/**************************** FINAL END OF PAGE UI Stuff *******************/
$ss->display('modules/Campaigns/WizardMarketing.html');
?>

View File

@@ -0,0 +1,188 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
global $timedate;
global $current_user;
$master = 'save';
if (isset($_REQUEST['wiz_home_next_step']) && !empty($_REQUEST['wiz_home_next_step'])) {
if($_REQUEST['wiz_home_next_step']==3){
//user has chosen to save and schedule this campaign for email
$master = 'send';
}elseif($_REQUEST['wiz_home_next_step']==2){
//user has chosen to save and send this campaign in test mode
$master = 'test';
}else{
//user has chosen to simply save
$master = 'save';
}
}else{
//default to just saving and exiting wizard
$master = 'save';
}
$prefix = 'wiz_step3_';
$marketing = new EmailMarketing();
if (isset($_REQUEST['record']) && !empty($_REQUEST['record'])) {
$marketing->retrieve($_REQUEST['record']);
}
if(!$marketing->ACLAccess('Save')){
ACLController::displayNoAccess(true);
sugar_cleanup(true);
}
if (!empty($_REQUEST['assigned_user_id']) && ($marketing->assigned_user_id != $_REQUEST['assigned_user_id']) && ($_POST['assigned_user_id'] != $current_user->id)) {
$check_notify = TRUE;
}
else {
$check_notify = FALSE;
}
foreach ($_REQUEST as $key => $val) {
if((strstr($key, $prefix )) && (strpos($key, $prefix )== 0)){
$newkey =substr($key, strlen($prefix)) ;
$_REQUEST[$newkey] = $val;
}
}
foreach ($_REQUEST as $key => $val) {
if((strstr($key, $prefix )) && (strpos($key, $prefix )== 0)){
$newkey =substr($key, strlen($prefix)) ;
$_REQUEST[$newkey] = $val;
}
}
if(!empty($_REQUEST['meridiem'])){
$_REQUEST['time_start'] = $timedate->merge_time_meridiem($_REQUEST['time_start'],$timedate->get_time_format(true), $_REQUEST['meridiem']);
}
if(empty($_REQUEST['time_start'])) {
$_REQUEST['date_start'] = $_REQUEST['date_start'] . ' 00:00';
} else {
$_REQUEST['date_start'] = $_REQUEST['date_start'] . ' ' . $_REQUEST['time_start'];
}
foreach($marketing->column_fields as $field)
{
if ($field == 'all_prospect_lists') {
if(isset($_REQUEST[$field]) && $_REQUEST[$field]='on' )
{
$marketing->$field = 1;
} else {
$marketing->$field = 0;
}
}else {
if(isset($_REQUEST[$field]))
{
$value = $_REQUEST[$field];
$marketing->$field = trim($value);
}
}
}
foreach($marketing->additional_column_fields as $field)
{
if(isset($_REQUEST[$field]))
{
$value = $_REQUEST[$field];
$marketing->$field = $value;
}
}
$marketing->campaign_id = $_REQUEST['campaign_id'];
$marketing->save($check_notify);
//add prospect lists to campaign.
$marketing->load_relationship('prospectlists');
$prospectlists=$marketing->prospectlists->get();
if ($marketing->all_prospect_lists==1) {
//remove all related prospect lists.
if (!empty($prospectlists)) {
$marketing->prospectlists->delete($marketing->id);
}
} else {
if (isset($_REQUEST['message_for']) && is_array($_REQUEST['message_for'])) {
foreach ($_REQUEST['message_for'] as $prospect_list_id) {
$key=array_search($prospect_list_id,$prospectlists);
if ($key === null or $key === false) {
$marketing->prospectlists->add($prospect_list_id);
} else {
unset($prospectlists[$key]);
}
}
if (count($prospectlists) != 0) {
foreach ($prospectlists as $key=>$list_id) {
$marketing->prospectlists->delete($marketing->id,$list_id);
}
}
}
}
//populate an array with marketing email id to use
$mass[] = $marketing->id;
//if sending an email was chosen, set all the needed variables for queuing campaign
if($master !='save'){
$_REQUEST['mass']= $mass;
$_POST['mass']=$mass;
$_REQUEST['record'] =$marketing->campaign_id;
$_POST['record']=$marketing->campaign_id;
$_REQUEST['mode'] = $master;
$_POST['mode'] = $master;
$_REQUEST['from_wiz']= 'true';
require_once('modules/Campaigns/QueueCampaign.php');
}
$header_URL = "Location: index.php?action=WizardHome&module=Campaigns&record=".$marketing->campaign_id;
$GLOBALS['log']->debug("about to post header URL of: $header_URL");
header($header_URL);
?>

View File

@@ -0,0 +1,106 @@
<!--
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
********************************************************************************/
-->
{$ROLLOVERSTYLE}
<form id="wizform" name="wizform" method="POST" action="index.php">
<input type="hidden" name="module" value="Campaigns">
<input type="hidden" name="record" value="{$ID}">
<input type="hidden" id="action" name="action">
<input type="hidden" name="return_module" value="{$RETURN_MODULE}">
<input type="hidden" name="return_id" value="{$RETURN_ID}">
<input type="hidden" name="return_action" value="{$RETURN_ACTION}">
<input type='hidden' name='campaign_type' value="{$MOD.LBL_NEWSLETTER_FORENTRY}">
<input type="hidden" id="wiz_total_steps" name="totalsteps" value="{$TOTAL_STEPS}">
<input type="hidden" id="wiz_current_step" name="currentstep" value='1'>
<input type="hidden" id="direction" name="wiz_direction" value='exit'>
<table class='other view' cellspacing="1">
<tr>
<td rowspan='2' width="10%" scope='row'>
<div id='nav' >
{$NAV_ITEMS}
</div>
</td>
<td class='tabForm' rowspan='2' width='100%'>
<div id="wiz_message"></div>
<div id=wizard>
{$STEPS}
</div>
</td>
<td width='5%'></td>
</tr>
</table>
<div id ='buttons'>
<table width="100%" border="0" cellspacing="0" cellpadding="0" >
<tr>
<td align="right" width='40%'><div id='wiz_location_message'></td>
<td align="right" width='30%'>
<table><tr>
<td><div id="back_button_div"><input id="wiz_back_button" type='button' title="{$APP.LBL_BACK}" class="button" onclick="javascript:navigate('back');" name="back" value=" {$APP.LBL_BACK}"></div></td>
<td><div id="cancel_button_div"><input id="wiz_cancel_button" title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="this.form.action.value='WizardHome'; this.form.module.value='Campaigns'; this.form.record.value='{$RETURN_ID}';" type="submit" name="button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}"></div></td>
<td nowrap="nowrap">
<div id="save_button_div">
<input id="wiz_submit_button" class="button" onclick="this.form.action.value='WizardNewsletterSave';this.form.direction.value='continue';gatherTrackers();" accesKey="{$APP.LBL_SAVE_BUTTON_TITLE}" type="{$HIDE_CONTINUE}" name="button" value="{$MOD.LBL_SAVE_CONTINUE_BUTTON_LABEL}" >
<input id="wiz_submit_finish_button" class="button" onclick="this.form.action.value='WizardNewsletterSave';this.form.direction.value='exit';gatherTrackers();" accesKey="{$APP.LBL_SAVE_BUTTON_TITLE}" type="submit" name="button" value="{$MOD.LBL_SAVE_EXIT_BUTTON_LABEL}" >
</div></td>
<td><div id="next_button_div"><input id="wiz_next_button" type='button' title="{$APP.LBL_NEXT_BUTTON_LABEL}" class="button" onclick="javascript:navigate('next');" name="button" value="{$APP.LBL_NEXT_BUTTON_LABEL}"></div></td>
</tr></table>
</td>
</tr>
</table>
</div>
</form>
<script type="text/javascript" language="javascript" src="modules/Campaigns/wizard.js"></script>
<script type='text/javascript' src='include/javascript/sugar_grp_overlib.js'></script>
<div id='overDiv' style='position:absolute; visibility:hidden; z-index:1000;'></div>
{$WIZ_JAVASCRIPT}
{$DIV_JAVASCRIPT}
{$JAVASCRIPT}
<script language="javascript">
{$HILITE_ALL}
</script>

View File

@@ -0,0 +1,610 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
/******** general UI Stuff ***********/
require_once('modules/Campaigns/utils.php');
global $app_strings;
global $timedate;
global $app_list_strings;
global $mod_strings;
global $current_user;
global $sugar_version, $sugar_config;
/*************** GENERAL SETUP WORK **********/
$focus = new Campaign();
if(isset($_REQUEST['record'])) {
$focus->retrieve($_REQUEST['record']);
}
if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
$focus->id = "";
}
global $theme;
$json = getJSONobj();
$GLOBALS['log']->info("Campaign NewsLetter Wizard");
if( (isset($_REQUEST['wizardtype']) && $_REQUEST['wizardtype']==1) || ($focus->campaign_type=='NewsLetter')){
echo get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_NEWSLETTER WIZARD_TITLE'].$focus->name, true, false);
}else{
echo get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_CAMPAIGN'].$focus->name, true, false);
}
$ss = new Sugar_Smarty();
$ss->assign("MOD", $mod_strings);
$ss->assign("APP", $app_strings);
if (isset($_REQUEST['return_module'])) $ss->assign("RETURN_MODULE", $_REQUEST['return_module']);
if (isset($_REQUEST['return_action'])) $ss->assign("RETURN_ACTION", $_REQUEST['return_action']);
if (isset($_REQUEST['return_id'])) $ss->assign("RETURN_ID", $_REQUEST['return_id']);
// handle Create $module then Cancel
if (empty($_REQUEST['return_id'])) {
$ss->assign("RETURN_ACTION", 'index');
}
$ss->assign("PRINT_URL", "index.php?".$GLOBALS['request_string']);
require_once('include/QuickSearchDefaults.php');
$qsd = new QuickSearchDefaults();
$qsd->setFormName('wizform');
$sqs_objects = array('parent_name' => $qsd->getQSParent(),
'assigned_user_name' => $qsd->getQSUser(),
//'prospect_list_name' => getProspectListQSObjects(),
'test_name' => getProspectListQSObjects('prospect_list_type_test', 'test_name','wiz_step3_test_name_id'),
'unsubscription_name' => getProspectListQSObjects('prospect_list_type_exempt', 'unsubscription_name','wiz_step3_unsubscription_name_id'),
'subscription_name' => getProspectListQSObjects('prospect_list_type_default', 'subscription_name','wiz_step3_subscription_name_id'),
);
$quicksearch_js = '<script type="text/javascript" language="javascript">sqs_objects = ' . $json->encode($sqs_objects) . '</script>';
$ss->assign("JAVASCRIPT", $quicksearch_js);
//set the campaign type based on wizardtype value from request object
$campaign_type = 'newsletter';
if( (isset($_REQUEST['wizardtype']) && $_REQUEST['wizardtype']==1) || ($focus->campaign_type=='NewsLetter')){
$campaign_type = 'newsletter';
$ss->assign("CAMPAIGN_DIAGNOSTIC_LINK", diagnose());
}elseif( (isset($_REQUEST['wizardtype']) && $_REQUEST['wizardtype']==2) || ($focus->campaign_type=='Email') ){
$campaign_type = 'email';
$ss->assign("CAMPAIGN_DIAGNOSTIC_LINK", diagnose());
}else{
$campaign_type = 'general';
}
//******** CAMPAIGN HEADER AND BUDGET UI DIV Stuff (both divs) **********/
/// Users Popup
$popup_request_data = array(
'call_back_function' => 'set_return',
'form_name' => 'wizform',
'field_to_name_array' => array(
'id' => 'assigned_user_id',
'user_name' => 'assigned_user_name',
),
);
$ss->assign('encoded_users_popup_request_data', $json->encode($popup_request_data));
//set default values
$ss->assign("CALENDAR_LANG", "en");
$ss->assign("USER_DATEFORMAT", '('. $timedate->get_user_date_format().')');
$ss->assign("CALENDAR_DATEFORMAT", $timedate->get_cal_date_format());
$ss->assign("CAMP_DATE_ENTERED", $focus->date_entered);
$ss->assign("CAMP_DATE_MODIFIED", $focus->date_modified);
$ss->assign("CAMP_CREATED_BY", $focus->created_by_name);
$ss->assign("CAMP_MODIFIED_BY", $focus->modified_by_name);
$ss->assign("ID", $focus->id);
$ss->assign("CAMP_TRACKER_TEXT", $focus->tracker_text);
$ss->assign("CAMP_START_DATE", $focus->start_date);
$ss->assign("CAMP_END_DATE", $focus->end_date);
$ss->assign("CAMP_BUDGET", $focus->budget);
$ss->assign("CAMP_ACTUAL_COST", $focus->actual_cost);
$ss->assign("CAMP_EXPECTED_REVENUE", $focus->expected_revenue);
$ss->assign("CAMP_EXPECTED_COST", $focus->expected_cost);
$ss->assign("CAMP_OBJECTIVE", $focus->objective);
$ss->assign("CAMP_CONTENT", $focus->content);
$ss->assign("CAMP_NAME", $focus->name);
$ss->assign("CAMP_RECORD", $focus->id);
$ss->assign("CAMP_IMPRESSIONS", $focus->impressions);
if (empty($focus->assigned_user_id) && empty($focus->id)) $focus->assigned_user_id = $current_user->id;
if (empty($focus->assigned_name) && empty($focus->id)) $focus->assigned_user_name = $current_user->user_name;
$ss->assign("ASSIGNED_USER_OPTIONS", get_select_options_with_id(get_user_array(TRUE, "Active", $focus->assigned_user_id), $focus->assigned_user_id));
$ss->assign("ASSIGNED_USER_NAME", $focus->assigned_user_name);
$ss->assign("ASSIGNED_USER_ID", $focus->assigned_user_id );
if((!isset($focus->status)) && (!isset($focus->id)))
$ss->assign("STATUS_OPTIONS", get_select_options_with_id($app_list_strings['campaign_status_dom'], 'Planning'));
else
$ss->assign("STATUS_OPTIONS", get_select_options_with_id($app_list_strings['campaign_status_dom'], $focus->status));
//hide frequency options if this is not a newsletter
if($campaign_type == 'newsletter'){
$ss->assign("HIDE_FREQUENCY_IF_NEWSLETTER", "Select");
$ss->assign("FREQUENCY_LABEL", $mod_strings['LBL_CAMPAIGN_FREQUENCY']);
if((!isset($focus->frequency)) && (!isset($focus->id))){
$ss->assign("FREQ_OPTIONS", get_select_options_with_id($app_list_strings['newsletter_frequency_dom'], 'Monthly'));
}else{
$ss->assign("FREQ_OPTIONS", get_select_options_with_id($app_list_strings['newsletter_frequency_dom'], $focus->frequency));
}
}else{
$ss->assign("HIDE_FREQUENCY_IF_NEWSLETTER", "input type='hidden'");
$ss->assign("FREQUENCY_LABEL", '&nbsp;');
}
global $current_user;
require_once('modules/Currencies/ListCurrency.php');
$currency = new ListCurrency();
if(isset($focus->currency_id) && !empty($focus->currency_id)){
$selectCurrency = $currency->getSelectOptions($focus->currency_id);
$ss->assign("CURRENCY", $selectCurrency);
}
else if($current_user->getPreference('currency') && !isset($focus->id))
{
$selectCurrency = $currency->getSelectOptions($current_user->getPreference('currency'));
$ss->assign("CURRENCY", $selectCurrency);
}else{
$selectCurrency = $currency->getSelectOptions();
$ss->assign("CURRENCY", $selectCurrency);
}
global $current_user;
if(is_admin($current_user) && $_REQUEST['module'] != 'DynamicLayout' && !empty($_SESSION['editinplace'])){
$record = '';
if(!empty($_REQUEST['record'])){
$record = $_REQUEST['record'];
}
$ss->assign("ADMIN_EDIT","<a href='index.php?action=index&module=DynamicLayout&from_action=".$_REQUEST['action'] ."&from_module=".$_REQUEST['module'] ."&record=".$record. "'>".SugarThemeRegistry::current()->getImage("EditLayout","border='0' alt='Edit Layout' align='bottom'")."</a>");
}
echo $currency->getJavascript();
$seps = get_number_seperators();
$ss->assign("NUM_GRP_SEP", $seps[0]);
$ss->assign("DEC_SEP", $seps[1]);
//fill out the campaign type dropdown based on type of campaign being created
if($campaign_type == 'general'){
//get regular campaign dom object and strip out entries for email and newsletter
$myTypeOptionsArr = array();
$OptionsArr = $app_list_strings['campaign_type_dom'];
foreach($OptionsArr as $key=>$val){
if($val =='Newsletter' || $val =='Email' || $val =='' ){
//do not add
}else{
$myTypeOptionsArr[$key] = $val;
}
}
//now create select option html without the newsletter/email, or blank ('') options
$type_option_html =' ';
$selected = false;
foreach($myTypeOptionsArr as $optionKey=>$optionName){
//if the selected flag is set to true, then just populate
if($selected){
$type_option_html .="<option value='$optionKey' >$optionName</option>";
}else{//if not selected yet, check to see if this option should be selected
//if the campaign type is not empty, then select the retrieved type
if(!empty($focus->campaign_type)){
//check to see if key matches campaign type
if($optionKey == $focus->campaign_type){
//mark as selected
$type_option_html .="<option value='$optionKey' selected>$optionName</option>";
//mark as selected for next time
$selected=true;
}else{
//key does not match, just populate
$type_option_html .="<option value='$optionKey' >$optionName</option>";
}
}else{
//since the campaign type is empty, then select first one
$type_option_html .="<option value='$optionKey' selected>$optionName</option>";
//mark as selected for next time
$selected=true;
}
}
}
//assign the modified dropdown for general campaign creation
$ss->assign("CAMPAIGN_TYPE_OPTIONS", $type_option_html);
$ss->assign("SHOULD_TYPE_BE_DISABLED", "select");
}elseif($campaign_type == 'email'){
//Assign Email as type of campaign being created an disable the select widget
$ss->assign("CAMPAIGN_TYPE_OPTIONS", $mod_strings['LBL_EMAIL']);
$ss->assign("SHOULD_TYPE_BE_DISABLED", "input type='hidden' value='Email'");
}else{
//Assign NewsLetter as type of campaign being created an disable the select widget
$ss->assign("CAMPAIGN_TYPE_OPTIONS", $mod_strings['LBL_NEWSLETTER']);
$ss->assign("SHOULD_TYPE_BE_DISABLED", "input type='hidden' value='NewsLetter'");
}
/*************** TRACKER UI DIV Stuff ***************/
//retrieve the trackers
$focus->load_relationship('tracked_urls');
$trkr_lists = $focus->tracked_urls->get();
$trkr_html ='';
$ss->assign('TRACKER_COUNT',count($trkr_lists));
if(count($trkr_lists)>0){
global $odd_bg, $even_bg, $hilite_bg;
$trkr_count = 0;
//create the html to create tracker table
foreach($trkr_lists as $trkr_id){
$ct_focus = new CampaignTracker();
$ct_focus->retrieve($trkr_id);
if(isset($ct_focus->tracker_name) && !empty($ct_focus->tracker_name)){
if($ct_focus->is_optout){$opt = 'checked';}else{$opt = '';}
$trkr_html .= "<div id='existing_trkr".$trkr_count."'> <table width='100%' border='0' cellspacing='0' cellpadding='0'>" ;
$trkr_html .= "<tr class='evenListRowS1'><td width='15%'><input name='wiz_step3_is_optout".$trkr_count."' title='".$mod_strings['LBL_EDIT_OPT_OUT'] . $trkr_count ."' id='existing_is_optout". $trkr_count ."' class='checkbox' type='checkbox' $opt /><input name='wiz_step3_id".$trkr_count."' value='".$ct_focus->id."' id='existing_tracker_id". $trkr_count ."'type='hidden''/></td>";
$trkr_html .= "<td width='40%'> <input id='existing_tracker_name". $trkr_count ."' type='text' size='20' maxlength='255' name='wiz_step3_tracker_name". $trkr_count ."' title='".$mod_strings['LBL_EDIT_TRACKER_NAME']. $trkr_count ."' value='".$ct_focus->tracker_name."' ></td>";
$trkr_html .= "<td width='40%'><input type='text' size='60' maxlength='255' name='wiz_step3_tracker_url". $trkr_count ."' title='".$mod_strings['LBL_EDIT_TRACKER_URL']. $trkr_count ."' id='existing_tracker_url". $trkr_count ."' value='".$ct_focus->tracker_url."' ></td>";
$trkr_html .= "<td><a href='#' onclick=\"javascript:remove_existing_tracker('existing_trkr".$trkr_count."','".$ct_focus->id."'); \" > ";
$trkr_html .= "<img src='".SugarThemeRegistry::current()->getImageURL("delete_inline.gif")."' border='0' alt='rem' align='absmiddle' border='0' height='12' width='12'>". $mod_strings['LBL_REMOVE']."</a></td></tr></table></div>";
}
$trkr_count =$trkr_count+1;
}
$trkr_html .= "<div id='no_trackers'></div>";
}else{
$trkr_html .= "<div id='no_trackers'><table width='100%' border='0' cellspacing='0' cellpadding='0'><tr class='evenListRowS1'><td>".$mod_strings['LBL_NONE']."</td></tr></table></div>";
}
$ss->assign('EXISTING_TRACKERS', $trkr_html);
/************** SUBSCRIPTION UI DIV Stuff ***************/
//fill in popups for target list options
$popup_request_data = array(
'call_back_function' => 'set_return',
'form_name' => 'wizform',
'field_to_name_array' => array(
'id' => 'wiz_step3_subscription_name_id',
'name' => 'wiz_step3_subscription_name',
),
);
$json = getJSONobj();
$encoded_newsletter_popup_request_data = $json->encode($popup_request_data);
$ss->assign('encoded_subscription_popup_request_data', $encoded_newsletter_popup_request_data);
$popup_request_data = array(
'call_back_function' => 'set_return',
'form_name' => 'wizform',
'field_to_name_array' => array(
'id' => 'wiz_step3_unsubscription_name_id',
'name' => 'unsubscription_name',
),
);
$json = getJSONobj();
$encoded_newsletter_popup_request_data = $json->encode($popup_request_data);
$ss->assign('encoded_unsubscription_popup_request_data', $encoded_newsletter_popup_request_data);
$popup_request_data = array(
'call_back_function' => 'set_return', //set_return_and_save_background
'form_name' => 'wizform',
'field_to_name_array' => array(
'id' => 'wiz_step3_test_name_id',
'name' => 'test_name',
),
);
$json = getJSONobj();
$encoded_newsletter_popup_request_data = $json->encode($popup_request_data);
$ss->assign('encoded_test_popup_request_data', $encoded_newsletter_popup_request_data);
$popup_request_data = array(
'call_back_function' => 'set_return_prospect_list',
'form_name' => 'wizform',
'field_to_name_array' => array(
'id' => 'popup_target_list_id',
'name' => 'popup_target_list_name',
'list_type' => 'popup_target_list_type',
),
);
$json = getJSONobj();
$encoded_newsletter_popup_request_data = $json->encode($popup_request_data);
$ss->assign('encoded_target_list_popup_request_data', $encoded_newsletter_popup_request_data);
$ss->assign('TARGET_OPTIONS', get_select_options_with_id($app_list_strings['prospect_list_type_dom'], 'default'));
//retrieve the subscriptions
$focus->load_relationship('prospectlists');
$prospect_lists = $focus->prospectlists->get();
if((isset($_REQUEST['wizardtype']) && $_REQUEST['wizardtype'] ==1) || ($focus->campaign_type=='NewsLetter')){
//this is a newsletter type campaign, fill in subscription values
//if prospect lists are returned, then iterate through and populate form values
if(count($prospect_lists)>0){
foreach($prospect_lists as $pl_id){
//retrieve prospect list
$pl = new ProspectList();
$pl->retrieve($pl_id);
if(isset($pl->list_type) && !empty($pl->list_type)){
//assign values based on type
if(($pl->list_type == 'default') || ($pl->list_type == 'seed')){
$ss->assign('SUBSCRIPTION_ID', $pl->id);
$ss->assign('SUBSCRIPTION_NAME', $pl->name);
};
if($pl->list_type == 'exempt'){
$ss->assign('UNSUBSCRIPTION_ID', $pl->id);
$ss->assign('UNSUBSCRIPTION_NAME', $pl->name);
};
if($pl->list_type == 'test'){
$ss->assign('TEST_ID', $pl->id);
$ss->assign('TEST_NAME', $pl->name);
};
}
}
}
}else{
//this is not a newlsetter campaign, so fill in target list table
//create array for javascript, this will help to display the option text, not the value
$dom_txt =' ';
foreach($app_list_strings['prospect_list_type_dom'] as $key=>$val){
$dom_txt .="if(trgt_type_text =='$key'){trgt_type_text='$val';}";
}
$ss->assign("PL_DOM_STMT", $dom_txt);
$trgt_count = 0;
$trgt_html = ' ';
if(count($prospect_lists)>0){
foreach($prospect_lists as $pl_id){
//retrieve prospect list
$pl = new ProspectList();
$pl_focus = $pl->retrieve($pl_id);
$trgt_html .= "<div id='existing_trgt".$trgt_count."'> <table class='tabDetailViewDL2' width='100%'>" ;
$trgt_html .= "<td width='25%'> <input id='existing_target_name". $trgt_count ."' type='hidden' type='text' size='60' maxlength='255' name='existing_target_name". $trgt_count ."' value='". $pl_focus->name."' >". $pl_focus->name."</td>";
$trgt_html .= "<td width='25%'><input type='hidden' size='60' maxlength='255' name='existing_tracker_list_type". $trgt_count ."' id='existing_tracker_list_type". $trgt_count ."' value='".$pl_focus->list_type."' >".$app_list_strings['prospect_list_type_dom'][$pl_focus->list_type];
$trgt_html .= "<input type='hidden' name='added_target_id". $trgt_count ."' id='added_target_id". $trgt_count ."' value='". $pl_focus->id ."' ></td>";
$trgt_html .= "<td><a href='#' onclick=\"javascript:remove_existing_target('existing_trgt".$trgt_count."','".$pl_focus->id."'); \" > ";
$trgt_html .= "<img src='".SugarThemeRegistry::current()->getImageURL("delete_inline.gif")."' border='0' alt='rem' align='absmiddle' border='0' height='12' width='12'>". $mod_strings['LBL_REMOVE']."</a></td></tr></table></div>";
$trgt_count =$trgt_count +1;
}
$trgt_html .= "<div id='no_targets'></div>";
}else{
$trgt_html .= "<div id='no_targets'><table width='100%' border='0' cellspacing='0' cellpadding='0'><tr class='evenListRowS1'><td>".$mod_strings['LBL_NONE']."</td></tr></table></div>";
}
$ss->assign('EXISTING_TARGETS', $trgt_html );
}
/**************************** WIZARD UI DIV Stuff *******************/
$mrkt_string = $mod_strings['LBL_NAVIGATION_MENU_MARKETING'];
if(!empty($focus->id)){
$mrkt_url = "<a href='index.php?action=WizardMarketing&module=Campaigns&return_module=Campaigns&return_action=WizardHome";
$mrkt_url .= "&return_id=".$focus->id."&campaign_id=".$focus->id;
$mrkt_url .= "'>". $mrkt_string."</a>";
$mrkt_string = $mrkt_url;
}
$summ_url = $mod_strings['LBL_NAVIGATION_MENU_SUMMARY'];
if(!empty($focus->id)){
$summ_url = "<a href='index.php?action=WizardHome&module=Campaigns";
$summ_url .= "&return_id=".$focus->id."&record=".$focus->id;
$summ_url .= "'> ". $mod_strings['LBL_NAVIGATION_MENU_SUMMARY']."</a>";
}
$script_to_call ='';
if (!empty($focus->id)){
$script_to_call = "link_navs(1,4);";
if(isset($_REQUEST['direct_step']) and !empty($_REQUEST['direct_step'])){
$script_to_call .=' direct('.$_REQUEST['direct_step'].');';
}
}
$ss->assign("HILITE_ALL", $script_to_call);
// this is the wizard control script that resides in page
$divScript = <<<EOQ
<script type="text/javascript" language="javascript">
/*
* this is the custom validation script that will call the right validation for each div
*/
function validate_wiz_form(step){
switch (step){
case 'step1':
if(!validate_step1()){return false;}
break;
case 'step2':
if(!validate_step2()){return false;}
break;
default://no additional validation needed
}
return true;
}
showfirst('newsletter');
</script>
EOQ;
$ss->assign("DIV_JAVASCRIPT", $divScript);
$sshtml = ' ';
$i = 1;
//Create the html to fill in the wizard steps
if($campaign_type == 'general'){
$steps = create_campaign_steps();
$ss->assign('NAV_ITEMS',create_wiz_menu_items($steps,'campaign',$mrkt_string,$summ_url));
$ss->assign('HIDE_CONTINUE','hidden');
}elseif($campaign_type == 'email'){
$steps = create_email_steps();
$ss->assign('NAV_ITEMS',create_wiz_menu_items($steps,'email',$mrkt_string,$summ_url));
$ss->assign('HIDE_CONTINUE','submit');
}else{
$steps = create_newsletter_steps();
$ss->assign('NAV_ITEMS',create_wiz_menu_items($steps,'newsletter',$mrkt_string,$summ_url));
$ss->assign('HIDE_CONTINUE','submit');
}
$ss->assign('TOTAL_STEPS', count($steps));
$sshtml = create_wiz_step_divs($steps,$ss);
$ss->assign('STEPS',$sshtml);
/**************************** FINAL END OF PAGE UI Stuff *******************/
$ss->display("modules/Campaigns/tpls/WizardNewsletter.tpl");
function create_newsletter_steps(){
global $mod_strings;
$steps[$mod_strings['LBL_NAVIGATION_MENU_GEN1']] = 'modules/Campaigns/tpls/WizardCampaignHeader.tpl';
$steps[$mod_strings['LBL_NAVIGATION_MENU_GEN2']] = 'modules/Campaigns/tpls/WizardCampaignBudget.tpl';
$steps[$mod_strings['LBL_NAVIGATION_MENU_TRACKERS']] = 'modules/Campaigns/tpls/WizardCampaignTracker.tpl';
$steps[$mod_strings['LBL_NAVIGATION_MENU_SUBSCRIPTIONS']] = 'modules/Campaigns/tpls/WizardCampaignTargetList.tpl';
return $steps;
}
function create_campaign_steps(){
global $mod_strings;
$steps[$mod_strings['LBL_NAVIGATION_MENU_GEN1']] = 'modules/Campaigns/tpls/WizardCampaignHeader.tpl';
$steps[$mod_strings['LBL_NAVIGATION_MENU_GEN2']] = 'modules/Campaigns/tpls/WizardCampaignBudget.tpl';
$steps[$mod_strings['LBL_NAVIGATION_MENU_TRACKERS']] = 'modules/Campaigns/tpls/WizardCampaignTracker.tpl';
$steps[$mod_strings['LBL_TARGET_LISTS']] = 'modules/Campaigns/tpls/WizardCampaignTargetListForNonNewsLetter.tpl';
return $steps;
}
function create_email_steps(){
global $mod_strings;
$steps[$mod_strings['LBL_NAVIGATION_MENU_GEN1']] = 'modules/Campaigns/tpls/WizardCampaignHeader.tpl';
$steps[$mod_strings['LBL_NAVIGATION_MENU_GEN2']] = 'modules/Campaigns/tpls/WizardCampaignBudget.tpl';
$steps[$mod_strings['LBL_NAVIGATION_MENU_TRACKERS']] = 'modules/Campaigns/tpls/WizardCampaignTracker.tpl';
$steps[$mod_strings['LBL_TARGET_LISTS']] = 'modules/Campaigns/tpls/WizardCampaignTargetListForNonNewsLetter.tpl';
return $steps;
}
function create_wiz_step_divs($steps,$ss){
$step_html = '';
if(isset($steps) && !empty($steps)){
$i=1;
foreach($steps as $name=>$step){
$step_html .="<p><div id='step$i'>";
$step_html .= $ss->fetch($step);
$step_html .="</div></p>";
$i = $i+1;
}
}
return $step_html;
}
function create_wiz_menu_items($steps,$type,$mrkt_string,$summ_url){
global $mod_strings;
$nav_html = '<table border="0" cellspacing="0" cellpadding="0" width="100%" >';
if(isset($steps) && !empty($steps)){
$i=1;
foreach($steps as $name=>$step){
$nav_html .= "<tr><td scope='row' nowrap><div id='nav_step$i'>$name</div></td></tr>";
$i=$i+1;
}
}
if($type == 'newsletter' || $type == 'email'){
$nav_html .= "<tr><td scope='row' nowrap><div id='nav_step'".($i+1).">$mrkt_string</div></td></tr>";
$nav_html .= "<tr><td scope='row' nowrap><div id='nav_step'".($i+2).">".$mod_strings['LBL_NAVIGATION_MENU_SEND_EMAIL']."</div></li>";
$nav_html .= "<tr><td scope='row' nowrap><div id='nav_step'".($i+3).">".$summ_url."</div></td></tr>";
}else{
$nav_html .= "<tr><td scope='row' nowrap><div id='nav_step'".($i+1).">".$summ_url."</div></td></tr>";
}
$nav_html .= '</table>';
return $nav_html;
}
?>

View File

@@ -0,0 +1,336 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('include/formbase.php');
global $mod_strings;
//create new campaign bean and populate
$campaign_focus = new Campaign();
if(isset($_REQUEST['record'])) {
$campaign_focus->retrieve($_REQUEST['record']);
}
$camp_steps[] = 'wiz_step1_';
$camp_steps[] = 'wiz_step2_';
$campaign_focus = populateFromPost('', $campaign_focus);
foreach($camp_steps as $step){
$campaign_focus = populate_wizard_bean_from_request($campaign_focus,$step);
}
//save here so we can link relationships
$campaign_focus->save();
$GLOBALS['log']->debug("Saved record with id of ".$campaign_focus->id);
//process prospect lists
//process subscription lists if this is a newsletter
if($campaign_focus->campaign_type =='NewsLetter'){
$pl_list = process_subscriptions_from_request($campaign_focus->name);
$campaign_focus->load_relationship('prospectlists');
$existing_pls = $campaign_focus->prospectlists->get();
$ui_ids = array();
//for each list returned, add the list to the relationship
foreach($pl_list as $pl){
$campaign_focus->prospectlists->add($pl->id);
//populate array with id's from UI'
$ui_ids[] = $pl->id;
}
//now remove the lists that may have existed before, but were not specified in UI.
//this will enforce that Newsletters only have 3 available target lists.
foreach($existing_pls as $pl_del){
if (!in_array($pl_del, $ui_ids)){
$campaign_focus->prospectlists->delete($campaign_focus->id, $pl_del);
}
}
}else{
//process target lists if this is not a newsletter
//remove Target Lists if defined
if(isset($_REQUEST['wiz_remove_target_list'])){
$remove_target_strings = explode(",", $_REQUEST['wiz_remove_target_list']);
foreach($remove_target_strings as $remove_trgt_string){
if(!empty($remove_trgt_string)){
//load relationship and add to the list
$campaign_focus->load_relationship('prospectlists');
$campaign_focus->prospectlists->delete($campaign_focus->id,$remove_trgt_string);
}
}
}
//create new campaign tracker and save if defined
if(isset($_REQUEST['wiz_list_of_targets'])){
$target_strings = explode(",", $_REQUEST['wiz_list_of_targets']);
foreach($target_strings as $trgt_string){
$target_values = explode("@@", $trgt_string);
if(count($target_values)==3){
if(!empty($target_values[0])){
//this is a selected target, as the id is already populated, retrieve and link
$trgt_focus = new ProspectList();
$trgt_focus->retrieve($target_values[0]);
//load relationship and add to the list
$campaign_focus->load_relationship('prospectlists');
$campaign_focus->prospectlists->add($trgt_focus ->id);
}else{
//this is a new target, as the id is not populated, need to create and link
$trgt_focus = new ProspectList();
$trgt_focus->name = $target_values[1];
$trgt_focus->list_type = $target_values[2];
$trgt_focus->save();
//load relationship and add to the list
$campaign_focus->load_relationship('prospectlists');
$campaign_focus->prospectlists->add($trgt_focus->id);
}
}
}
}
}
//remove campaign trackers if defined
if(isset($_REQUEST['wiz_remove_tracker_list'])){
$remove_tracker_strings = explode(",", $_REQUEST['wiz_remove_tracker_list']);
foreach($remove_tracker_strings as $remove_trkr_string){
if(!empty($remove_trkr_string)){
//load relationship and add to the list
$campaign_focus->load_relationship('tracked_urls');
$campaign_focus->tracked_urls->delete($campaign_focus->id,$remove_trkr_string);
}
}
}
//save campaign trackers and save if defined
if(isset($_REQUEST['wiz_list_of_existing_trackers'])){
$tracker_strings = explode(",", $_REQUEST['wiz_list_of_existing_trackers']);
foreach($tracker_strings as $trkr_string){
$tracker_values = explode("@@", $trkr_string);
$ct_focus = new CampaignTracker();
$ct_focus->retrieve($tracker_values[0]);
if(!empty($ct_focus->tracker_name)){
$ct_focus->tracker_name = $tracker_values[1];
$ct_focus->is_optout = $tracker_values[2];
$ct_focus->tracker_url = $tracker_values[3];
$ct_focus->save();
//load relationship and add to the list
$campaign_focus->load_relationship('tracked_urls');
$campaign_focus->tracked_urls->add($ct_focus->id);
}
}
}
//create new campaign tracker and save if defined
if(isset($_REQUEST['wiz_list_of_trackers'])){
$tracker_strings = explode(",", $_REQUEST['wiz_list_of_trackers']);
foreach($tracker_strings as $trkr_string){
$tracker_values = explode("@@", $trkr_string);
if(count($tracker_values)==3){
$ct_focus = new CampaignTracker();
$ct_focus->tracker_name = $tracker_values[0];
$ct_focus->is_optout = $tracker_values[1];
$ct_focus->tracker_url = $tracker_values[2];
$ct_focus->save();
//load relationship and add to the list
$campaign_focus->load_relationship('tracked_urls');
$campaign_focus->tracked_urls->add($ct_focus->id);
}
}
}
//set navigation details
$_REQUEST['return_id'] = $campaign_focus->id;
$_REQUEST['return_module'] = $campaign_focus->module_dir;
$_REQUEST['return_action'] = "WizardNewsLetter";
$_REQUEST['action'] = "WizardMarketing";
$_REQUEST['record'] = $campaign_focus->id;;
$action = '';
if(isset($_REQUEST['wiz_direction']) && $_REQUEST['wiz_direction']== 'continue'){
$action = 'WizardMarketing';
}else{
$action = 'WizardHome&record='.$campaign_focus->id;
}
//require_once('modules/Campaigns/WizardMarketing.php');
$header_URL = "Location: index.php?return_module=Campaigns&module=Campaigns&action=".$action."&campaign_id=".$campaign_focus->id."&return_action=WizardNewsLetter&return_id=".$campaign_focus->id;
$GLOBALS['log']->debug("about to post header URL of: $header_URL");
header($header_URL);
/*
* This function will populate the passed in bean with the post variables
* that contain the specified prefix
*/
function populate_wizard_bean_from_request($bean,$prefix){
foreach($_REQUEST as $key=> $val){
$key = trim($key);
if((strstr($key, $prefix )) && (strpos($key, $prefix )== 0)){
$field =substr($key, strlen($prefix)) ;
if(isset($_REQUEST[$key]) && !empty($_REQUEST[$key])){
//echo "prefix is $prefix, field is $field, key is $key, and value is $val<br>";
$value = $_REQUEST[$key];
$bean->$field = $value;
}
}
}
return $bean;
}
/*
* This function will process any specified prospect lists and attach them to current campaign
* If no prospect lists have been specified, then it will create one for you. A total of 3 prospect lists
* will be created for you (Subscription, Unsubscription, and test)
*/
function process_subscriptions_from_request($campaign_name){
global $mod_strings;
$pl_list = array();
//process default target list
$create_new = true;
$pl_subs = new ProspectList($campaign_name);
if(!empty($_REQUEST['wiz_step3_subscription_list_id'])){
//if subscription list is specified then attach
$pl_subs->retrieve($_REQUEST['wiz_step3_subscription_list_id']);
//check to see name matches the bean, if not, then the user has chosen to create new bean
if($pl_subs->name == $_REQUEST['wiz_step3_subscription_name']){
$pl_list[] = $pl_subs;
$create_new = false;
}
}
//create new bio if one was not retrieved succesfully
if($create_new){
//use default name if one has not been specified
$name = $campaign_name . " ".$mod_strings['LBL_SUBSCRIPTION_LIST'];
if(isset($_REQUEST['wiz_step3_subscription_name']) && !empty($_REQUEST['wiz_step3_subscription_name'])){
$name = $_REQUEST['wiz_step3_subscription_name'];
}
//if subscription list is not specified then create and attach default one
$pl_subs->name = $name;
$pl_subs->list_type = 'default';
$pl_subs->assigned_user_id= $GLOBALS['current_user']->id;
$pl_subs->save();
$pl_list[] = $pl_subs;
}
//process exempt target list
$create_new = true;
$pl_un_subs = new ProspectList();
if(!empty($_REQUEST['wiz_step3_unsubscription_list_id'])){
//if unsubscription list is specified then attach
$pl_un_subs->retrieve($_REQUEST['wiz_step3_unsubscription_list_id']);
//check to see name matches the bean, if not, then the user has chosen to create new bean
if($pl_un_subs->name == $_REQUEST['wiz_step3_unsubscription_name']){
$pl_list[] = $pl_un_subs;
$create_new = false;
}
}
//create new bean if one was not retrieved succesfully
if($create_new){
//use default name if one has not been specified
$name = $campaign_name . " ".$mod_strings['LBL_UNSUBSCRIPTION_LIST'];
if(isset($_REQUEST['wiz_step3_unsubscription_name']) && !empty($_REQUEST['wiz_step3_unsubscription_name'])){
$name = $_REQUEST['wiz_step3_unsubscription_name'];
}
//if unsubscription list is not specified then create and attach default one
$pl_un_subs->name = $name;
$pl_un_subs->list_type = 'exempt';
$pl_un_subs->assigned_user_id= $GLOBALS['current_user']->id;
$pl_un_subs->save();
$pl_list[] = $pl_un_subs;
}
//process test target list
$pl_test = new ProspectList();
$create_new = true;
if(!empty($_REQUEST['wiz_step3_test_list_id'])){
//if test list is specified then attach
$pl_test->retrieve($_REQUEST['wiz_step3_test_list_id']);
//check to see name matches the bean, if not, then the user has chosen to create new bean
if($pl_test->name == $_REQUEST['wiz_step3_test_name']){
$pl_list[] = $pl_test;
$create_new = false;
}
}
//create new bio if one was not retrieved succesfully
if($create_new){
//use default name if one has not been specified
$name = $campaign_name . " ".$mod_strings['LBL_TEST_LIST'];
if(isset($_REQUEST['wiz_step3_test_name']) && !empty($_REQUEST['wiz_step3_test_name'])){
$name = $_REQUEST['wiz_step3_test_name'];
}
//if test list is not specified then create and attach default one
$pl_test->name = $name;
$pl_test->list_type = 'test';
$pl_test->assigned_user_id= $GLOBALS['current_user']->id;
$pl_test->save();
$pl_list[] = $pl_test;
}
return $pl_list;
}
?>

View File

@@ -0,0 +1,44 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description:
********************************************************************************/
$action_file_map['subpanelviewer'] = 'modules/Campaigns/SubPanelViewer.php';
?>

62
modules/Campaigns/chart.tpl Executable file
View File

@@ -0,0 +1,62 @@
{*
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
*}
<!-- BEGIN: main -->
<graphData title="{GRAPHTITLE}">
<yData defaultAltText="{Y_DEFAULT_ALT_TEXT}">
<!-- BEGIN: row -->
<dataRow title="{Y_ROW_TITLE}" endLabel="{Y_ROW_ENDLABEl}">
<!-- BEGIN: bar -->
<bar id="{Y_BAR_ID}" totalSize="{Y_BAR_SIZE}" altText="{Y_BAR_ALTTEXT}" url="{Y_BAR_URL}"/>
<!-- END: bar -->
</dataRow>
<!-- END: row -->
</yData>
<xData min="{XMIN}" max="{XMAX}" length="{XLENGTH}" kDelim="{XKDELIM}" prefix="{XPREFIX}" suffix="{XSUFFIX}"/>
<colorLegend status="on">
<mapping id="'.$outcome.'" name="'.$outcome_translation.'" color="'.$color.'"/>
</colorLegend>
<graphInfo><![CDATA[{GRAPH_DATA}]]></graphInfo>
<chartColors {COLOR_DEFS}/>
</graphData>
<!-- END: main -->

View File

@@ -0,0 +1,44 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('include/MVC/Controller/SugarController.php');
class CampaignsController extends SugarController{
function action_newsletterlist(){
$this->view = 'newsletterlist';
}
}
?>

View File

@@ -0,0 +1,67 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: Contains field arrays that are used for caching
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
$fields_array['Campaign'] = array ('column_fields' => array(
"id", "date_entered",
"date_modified", "modified_user_id",
"assigned_user_id", "created_by",
"name", "start_date",
"end_date", "status",
"budget", "expected_cost",
"actual_cost", "expected_revenue",
"campaign_type", "objective",
"content", "tracker_key","refer_url","tracker_text",
"tracker_count","currency_id","impressions",
"frequency",
),
'list_fields' => array(
'id', 'name', 'status',
'campaign_type','assigned_user_id','assigned_user_name','end_date',
'refer_url',"currency_id",
),
'required_fields' => array(
'name'=>1, 'end_date'=>2,
'status'=>3, 'campaign_type'=>4
),
);
?>

47
modules/Campaigns/image.php Executable file
View File

@@ -0,0 +1,47 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('modules/Campaigns/utils.php');
$GLOBALS['log']->debug('identifier from the image request is'.$_REQUEST['identifier']);
if(!empty($_REQUEST['identifier'])) {
$keys=log_campaign_activity($_REQUEST['identifier'],'viewed');
}
sugar_cleanup();
Header("Content-Type: image/gif");
$fn=sugar_fopen(SugarThemeRegistry::current()->getImageURL("blank.gif"),"r");
fpassthru($fn);
?>

View File

@@ -0,0 +1,425 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: Defines the English language pack for the base application.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
$mod_strings = array (
'LBL_FROM_ADDR' => '"From" Address: ',
'LBL_REPLY_ADDR' => '"Reply-to" Address: ',
'LBL_REPLY_NAME' => '"Reply-to" Name: ',
'LBL_MODULE_NAME' => 'Campaigns',
'LBL_MODULE_TITLE' => 'Campaigns: Home',
'LBL_NEWSLETTER_TITLE'=>'Campaigns: Newsletters',
'LBL_SEARCH_FORM_TITLE' => 'Campaign Search',
'LBL_LIST_FORM_TITLE' => 'Campaign List',
'LBL_NEWSLETTER_LIST_FORM_TITLE' => 'Newsletter List',
'LBL_CAMPAIGN_NAME' => 'Name:',
'LBL_CAMPAIGN' => 'Campaign:',
'LBL_NAME' => 'Name: ',
'LBL_INVITEE' => 'Contacts',
'LBL_LIST_CAMPAIGN_NAME' => 'Campaign',
'LBL_LIST_STATUS' => 'Status',
'LBL_LIST_TYPE' => 'Type',
'LBL_LIST_START_DATE' => 'Start Date',
'LBL_LIST_END_DATE' => 'End Date',
'LBL_DATE_ENTERED' => 'Date Created',
'LBL_DATE_MODIFIED' => 'Date Modified',
'LBL_MODIFIED' => 'Modified by: ',
'LBL_CREATED' => 'Created by: ',
'LBL_TEAM' => 'Team: ',
'LBL_ASSIGNED_TO' => 'Assigned to: ',
'LBL_ASSIGNED_TO_ID' => 'Assigned to:',
'LBL_ASSIGNED_TO_NAME'=> 'Assigned to:',
'LBL_CAMPAIGN_START_DATE' => 'Start Date: ',
'LBL_CAMPAIGN_END_DATE' => 'End Date: ',
'LBL_CAMPAIGN_STATUS' => 'Status: ',
'LBL_CAMPAIGN_BUDGET' => 'Budget: ',
'LBL_CAMPAIGN_EXPECTED_COST' => 'Expected Cost: ',
'LBL_CAMPAIGN_ACTUAL_COST' => 'Actual Cost: ',
'LBL_CAMPAIGN_EXPECTED_REVENUE' => 'Expected Revenue: ',
'LBL_CAMPAIGN_IMPRESSIONS' => 'Impressions: ',
'LBL_CAMPAIGN_COST_PER_IMPRESSION' => 'Cost Per Impression: ',
'LBL_CAMPAIGN_COST_PER_CLICK_THROUGH' => 'Cost Per Click Through: ',
'LBL_CAMPAIGN_OPPORTUNITIES_WON' =>'Opportunities Won:',
'LBL_CAMPAIGN_TYPE' => 'Type: ',
'LBL_CAMPAIGN_OBJECTIVE' => 'Objective: ',
'LBL_CAMPAIGN_CONTENT' => 'Description: ',
'LBL_CAMPAIGN_DAYS_REMAIN' => 'Days Remaining',
'LNK_NEW_CAMPAIGN' => 'Create Campaign (Classic)',
'LNL_NEW_CAMPAIGN_WIZARD' => 'Create Campaign (Wizard)',
'LNK_CAMPAIGN_LIST' => 'View Campaigns',
'LNK_NEW_PROSPECT' => 'Create Target',
'LNK_PROSPECT_LIST' => 'View Targets',
'LNK_NEW_PROSPECT_LIST' => 'Create Target List',
'LNK_PROSPECT_LIST_LIST' => 'View Target Lists',
'LBL_MODIFIED_BY' => 'Modified by: ',
'LBL_CREATED_BY' => 'Created by: ',
'LBL_DATE_CREATED' => 'Date Created: ',
'LBL_DATE_LAST_MODIFIED' => 'Date Modified: ',
'LBL_TRACKER_KEY' => 'Tracker: ',
'LBL_TRACKER_URL' => 'Tracker URL: ',
'LBL_TRACKER_TEXT' => 'Tracker Link Text: ',
'LBL_TRACKER_COUNT' => 'Tracker Count: ',
'LBL_REFER_URL' => 'Tracker Redirect URL: ',
'LBL_DEFAULT_SUBPANEL_TITLE' => 'Campaigns',
'LBL_EMAIL_CAMPAIGNS_TITLE' =>'Email Campaigns',
'LBL_NEW_FORM_TITLE' => 'New Campaign',
'LBL_TRACKED_URLS'=>'Tracker URLs',
'LBL_TRACKED_URLS_SUBPANEL_TITLE'=>'Tracker URLs',
'LBL_CAMPAIGN_ACCOUNTS_SUBPANEL_TITLE'=>'Accounts',
'LBL_PROSPECT_LIST_SUBPANEL_TITLE' => 'Target List',
'LBL_EMAIL_MARKETING_SUBPANEL_TITLE' => 'Email Marketing',
'LNK_NEW_EMAIL_TEMPLATE' => 'Create Email Template',
'LNK_EMAIL_TEMPLATE_LIST' => 'View Email Templates',
'LBL_TRACK_BUTTON_TITLE' =>'View Status',
'LBL_TRACK_BUTTON_KEY' =>'T',
'LBL_TRACK_BUTTON_LABEL' =>'View Status',
'LBL_QUEUE_BUTTON_TITLE'=>'Send Emails',
'LBL_QUEUE_BUTTON_KEY'=>'u',
'LBL_QUEUE_BUTTON_LABEL'=>'Send Emails',
'LBL_TEST_BUTTON_TITLE'=>'Send Test',
'LBL_TEST_BUTTON_KEY'=>'e',
'LBL_TEST_BUTTON_LABEL'=>'Send Test',
'LBL_COPY_AND_PASTE_CODE' => 'Or copy and paste the html below into an existing page',
'LBL_TODETAIL_BUTTON_TITLE'=>'View Details',
'LBL_TODETAIL_BUTTON_KEY'=>'T',
'LBL_TODETAIL_BUTTON_LABEL'=>'View Details',
'LBL_DEFAULT'=>'All Target Lists',
'LBL_MESSAGE_QUEUE_TITLE'=>'Message Queue',
'LBL_LOG_ENTRIES_TITLE'=>'Responses',
'LBL_LOG_ENTRIES_TARGETED_TITLE'=>'Message Sent/Attempted',
'LBL_LOG_ENTRIES_SEND_ERROR_TITLE'=>'Bounced Messages,Other',
'LBL_LOG_ENTRIES_INVALID_EMAIL_TITLE'=>'Bounced Messages,Invalid Email',
'LBL_LOG_ENTRIES_LINK_TITLE'=>'Click-thru Link',
'LBL_LOG_ENTRIES_VIEWED_TITLE'=>'Viewed Message',
'LBL_LOG_ENTRIES_REMOVED_TITLE'=>'Opted Out',
'LBL_LOG_ENTRIES_LEAD_TITLE'=>'Leads Created',
'LBL_CAMPAIGN_LEAD_SUBPANEL_TITLE'=>'Leads',
'LBL_OPPORTUNITY_SUBPANEL_TITLE'=>'Opportunities',
'LBL_LOG_ENTRIES_CONTACT_TITLE'=>'Contacts Created',
'LBL_BACK_TO_CAMPAIGNS'=>'Back to Campaigns',
//error messages.
'ERR_NO_EMAIL_MARKETING'=>'There must be at least one active Email Marketing message associated with the campaign.',
'ERR_NO_TARGET_LISTS'=>'There must be at least one Target List associated with the campaign.',
'ERR_NO_TEST_TARGET_LISTS'=>'There must be at least one Target List of type Test associated with the campaign.',
'ERR_SENDING_NOW'=>'Messages are being delivered , please try this later.',
'ERR_MESS_NOT_FOUND_FOR_LIST'=>'No Email Marketing message found for this target list',
'ERR_MESS_DUPLICATE_FOR_LIST'=>'Multiple Email Marketing messages are defined for this target list',
'ERR_FIX_MESSAGES'=>'Please correct the following errors before proceeding',
'LBL_TRACK_DELETE_BUTTON_KEY'=>'D',
'LBL_TRACK_ROI_BUTTON_LABEL' =>'View ROI',
'LBL_TRACK_DELETE_BUTTON_TITLE'=>'Delete Test Entries',
'LBL_TRACK_DELETE_BUTTON_LABEL'=>'Delete Test Entries',
'LBL_TRACK_DELETE_CONFIRM'=>'This option will delete log entries created by the test run. Continue?',
'ERR_NO_MAILBOX'=>"The following marketing messages do not have a mail account associated with them.<BR>Please correct that before proceeding.",
'LBL_LIST_TO_ACTIVITY'=>'View Status',
'LBL_CURRENCY_ID'=>'Currency ID',
'LBL_CURRENCY'=>'Currency:',
'LBL_ROLLOVER_VIEW' => 'Rollover a bar to view details.',
'LBL_TARGETED' => 'Targeted',
'LBL_TOTAL_TARGETED' => 'Total Targeted',
'LBL_CAMPAIGN_FREQUENCY'=>'Frequency:',
'LBL_NEWSLETTERS'=>'View Newsletters',
'LBL_NEWSLETTER'=>'Newsletter',
'LBL_NEWSLETTER_FORENTRY'=>'NewsLetter',
'LBL_MORE_DETAILS' => 'More Details',
'LBL_CREATE_NEWSLETTER'=>'Create Newsletter',
'LBL_LIST_NAME' => 'Name',
'LBL_STATUS_TEXT' => 'Status:' ,
'LBL_FROM_MAILBOX_NAME'=>'Use Mail Account:',
'LBL_FROM_NAME' => 'From Name: ',
'LBL_START_DATE_TIME' => 'Start Date & Time: ',
'LBL_DATE_START' => 'Start Date ',
'LBL_TIME_START' => 'Start Time ',
'LBL_TEMPLATE' => 'Email Template: ',
'LBL_CREATE_EMAIL_TEMPLATE'=> 'Create',
'LBL_MESSAGE_FOR' => 'Send This Message To:',
'LBL_FINISH' => 'Finish',
'LBL_ALL_PROSPECT_LISTS'=>'All Target List(s) in the Campaign.',
'LBL_EDIT_EMAIL_TEMPLATE'=> 'Edit',
'LBL_EMAIL_SETUP_WIZARD'=> 'Set Up Email',
'LBL_DIAGNOSTIC_WIZARD'=> 'View Diagnostics',
'LBL_ALREADY_SUBSCRIBED_HEADER'=>'Newsletters Subscribed To',
'LBL_UNSUBSCRIBED_HEADER'=>'Available/Newsletters Unsubscribed To',
'LBL_UNSUBSCRIBED_HEADER_EXPL'=>'Moving the newsletter to the Available Newsletters/Newsletters Unsubscribed To list will add the contact to the Unsubscription List for this newsletter. It will not remove the contact from the original Subscription List or Target List.',
'LBL_FILTER_CHART_BY'=>'Filter Chart By:',
'LBL_MANAGE_SUBSCRIPTIONS_TITLE'=>'Manage Subscriptions',
'LBL_MARK_AS_SENT' =>'Mark As Sent',
'LBL_DEFAULT_LIST_NOT_FOUND'=>'Target list of type default was not found',
'LBL_DEFAULT_LIST_ENTRIES_NOT_FOUND'=>'No entries were found',
'LBL_DEFAULT_LIST_ENTRIES_WERE_PROCESSED' => 'Entries were Processed',
//newsletter wizard
'LBL_EDIT_TRACKER_NAME'=>'Tracker Name:',
'LBL_EDIT_TRACKER_URL'=>'Tracker URL:',
'LBL_EDIT_OPT_OUT_'=>'Opt-out Link?',
'LBL_EDIT_OPT_OUT'=>'Opt-out Link:',
'LBL_UNSUBSCRIPTION_LIST_NAME'=>'Unsubscription List Name:',
'LBL_SUBSCRIPTION_LIST_NAME'=>'Subscription List Name:',
'LBL_TEST_LIST_NAME'=>'Test List Name:',
'LBL_UNSUBSCRIPTION_TYPE_NAME'=>'Unsubscription',
'LBL_SUBSCRIPTION_TYPE_NAME'=>'Subscription',
'LBL_TEST_TYPE_NAME'=>'Test',
'LBL_UNSUBSCRIPTION_LIST'=>'Unsubscription List',
'LBL_SUBSCRIPTION_LIST'=>'Subscription List',
'LBL_MRKT_NAME' => 'Name',
'LBL_TEST_LIST'=>'Test List',
'LBL_WIZARD_HEADER_MESSAGE' => 'Fill out the required fields to help identify the campaign.',
'LBL_WIZARD_BUDGET_MESSAGE' => 'Enter the budget to calculate the ROI.',
'LBL_WIZARD_SUBSCRIPTION_MESSAGE' => 'Each newsletter must have three target lists (Subscription, Unsubscription, and Test). You can assign an existing target list. If not, an empty target list will be created when you save the newsletter.',
'LBL_WIZARD_TARGET_MESSAGE1' => 'Select or create a target list for use with your campaign. This list will be used while sending emails with your marketing messages.',
'LBL_WIZARD_TARGET_MESSAGE2' => 'Or create a new one using the form below:',
'LBL_WIZARD_TRACKER_MESSAGE' => 'Define a tracker URL here to use with this campaign. You must enter both the name and the URL to create the tracker.',
'LBL_WIZARD_MARKETING_MESSAGE' => 'Fill out the form below to create an email instance for your newsletter. This will allow you to specify the information regarding when and how your newsletter should be distributed.',
'LBL_WIZARD_SENDMAIL_MESSAGE' => 'This is the last step in the process. Select whether you wish to send out a test email, schedule your newsletter for distribution, or save the changes and proceed to the summary page.',
'LBL_HOME_START_MESSAGE' => 'Select the type of Campaign you would like to create.',
'LBL_WIZARD_LAST_STEP_MESSAGE'=> ' You are already at the last step.',
'LBL_WIZARD_FIRST_STEP_MESSAGE'=>' You are already at the first step.',
'LBL_WIZ_NEWSLETTER_TITLE_STEP1' => 'Campaign Header',
'LBL_WIZ_NEWSLETTER_TITLE_STEP2' => 'Campaign Budget',
'LBL_WIZ_NEWSLETTER_TITLE_STEP3' => 'Campaign Tracker URLs ',
'LBL_WIZ_NEWSLETTER_TITLE_STEP4' => 'Subscription Information',
'LBL_WIZ_MARKETING_TITLE' => 'Marketing Email',
'LBL_WIZ_SENDMAIL_TITLE' => 'Send Email',
'LBL_WIZ_TEST_EMAIL_TITLE' => 'Test Email',
'LBL_WIZ_NEWSLETTER_TITLE_SUMMARY' => 'Summary',
'LBL_NAVIGATION_MENU_GEN1' => 'Campaign Header',
'LBL_NAVIGATION_MENU_GEN2' => 'Budget',
'LBL_NAVIGATION_MENU_TRACKERS' => 'Trackers',
'LBL_NAVIGATION_MENU_MARKETING' => 'Marketing',
'LBL_NAVIGATION_MENU_SEND_EMAIL' => 'Send Email',
'LBL_NAVIGATION_MENU_SUBSCRIPTIONS' => 'Subscriptions',
'LBL_NAVIGATION_MENU_SUMMARY' => 'Summary',
'LBL_SUBSCRIPTION_TARGET_WIZARD_DESC' => 'This will define the target list of type Subscription for this campaign.<br> This target list will be used to send out emails for this campaign. <br>If you do not have a list ready, an empty list will be created for you.',
'LBL_UNSUBSCRIPTION_TARGET_WIZARD_DESC' => 'This will define the target list of type Unsubscription for this campaign. <br>This target list will contain names of people who have opted out of your campaign and should not be contacted through email. <br>If you do not have a list ready, an empty list will be created for you.',
'LBL_TEST_TARGET_WIZARD_DESC' => 'This will define the target list of type Test for this campaign. <br>This target list will be used to send out test emails for this campaign. <br>If you do not have a list ready, an empty list will be created for you.',
'LBL_TRACKERS' => 'Trackers',
'LBL_ADD_TRACKER' => 'Create Tracker',
'LBL_ADD_TARGET' => 'Add',
'LBL_CREATE_TARGET'=> 'Create',
'LBL_SELECT_TARGET'=> 'Use existing Target List',
'LBL_REMOVE' => ' rem',
'LBL_CONFIRM' => 'Start',
'LBL_START' => 'Start',
'LBL_TOTAL_ENTRIES' => 'Entries',
'LBL_CONFIRM_CAMPAIGN_SAVE_CONTINUE' => 'Save work and proceed to Marketing Email',
'LBL_CONFIRM_CAMPAIGN_SAVE_OPTIONS' => 'Save Options',
'LBL_CONFIRM_CAMPAIGN_SAVE_EXIT' => 'Do you wish to save the information and exit?',
'LBL_CONFIRM_SEND_SAVE' => 'You are about to leave and proceed to the Send Campaign Email page. Do you wish to save and continue?',
'LBL_NEWSLETTER WIZARD_TITLE' => 'Newsletter: ',
'LBL_NEWSLETTER_WIZARD_START_TITLE' => 'Edit Newsletter: ',
'LBL_CAMPAIGN_WIZARD_START_TITLE' => 'Edit Campaign: ',
'LBL_SEND_AS_TEST' => 'Send Marketing Email As Test',
'LBL_SAVE_EXIT_BUTTON_LABEL' => 'Finish',
'LBL_SAVE_CONTINUE_BUTTON_LABEL' => 'Save and Continue',
'LBL_TARGET_LISTS' => 'Target Lists',
'LBL_NO_SUBS_ENTRIES_WARNING' => 'You cannot send a marketing email until your subscription list has at least one entry. You can populate your list after finishing.',
'LBL_NO_TARGET_ENTRIES_WARNING' => 'You cannot send a marketing email until your target list has at least one entry. You can populate your list after finishing.',
'LBL_NO_TARGETS_WARNING' => 'You cannot send a marketing email until your campaign has at least one target list.',
'LBL_NONE' => 'none created',
'LBL_CAMPAIGN_WIZARD' => 'Campaign Wizard',
'LBL_EMAIL' =>'Email',
'LBL_OTHER_TYPE_CAMPAIGN' => 'Non-email based Campaign',
'LBL_CHOOSE_CAMPAIGN_TYPE' => 'Campaign Type',
'LBL_TARGET_LIST' => 'Target List',
'LBL_TARGET_TYPE' => 'Target List Type',
'LBL_TARGET_NAME' => 'Target List Name',
'LBL_EMAILS_SCHEDULED' => 'Emails Scheduled',
'LBL_TEST_EMAILS_SENT' => 'Test Emails Sent',
'LBL_USERS_CANNOT_OPTOUT' => 'System Users cannot opt out of receiving emails.',
'LBL_ELECTED_TO_OPTOUT' => 'You have elected to opt out of receiving emails.',
'LBL_COPY_OF' => 'Copy of ',
'LBL_SAVED_SEARCH' => 'Saved Search & Layout',
//email setup wizard
'LBL_WIZ_FROM_NAME' => 'From Name:',
'LBL_WIZ_FROM_ADDRESS' => 'From Address:',
'LBL_EMAILS_PER_RUN' => 'Number of emails sent per batch:',
'LBL_CUSTOM_LOCATION' => 'User Defined',
'LBL_DEFAULT_LOCATION' => 'Default ',
'ERR_INT_ONLY_EMAIL_PER_RUN' => 'Only integer values are allow for Number of emails sent per batch',
'LBL_LOCATION_TRACK' => 'Location of campaign tracking files (like campaign_tracker.php):',
'LBL_MAIL_SENDTYPE' => 'Mail Transfer Agent:',
'LBL_MAIL_SMTPAUTH_REQ' => 'Use SMTP Authentication?',
'LBL_MAIL_SMTPPASS' => 'SMTP Password:',
'LBL_MAIL_SMTPPORT' => 'SMTP Port',
'LBL_MAIL_SMTPSERVER' => 'SMTP Server',
'LBL_MAIL_SMTPUSER' => 'SMTP Username',
'LBL_EMAIL_SETUP_WIZARD_TITLE' => 'Email Setup for Campaigns',
'TRACKING_ENTRIES_LOCATION_DEFAULT_VALUE' => 'Value of Config.php setting site_url',
'LBL_NOTIFY_TITLE' => 'Email Notification Options',
'LBL_MASS_MAILING_TITLE' => 'Mass Mailing Options',
'LBL_SERVER_TYPE' => 'Mail Server Protocol',
'LBL_SERVER_URL' => 'Mail Server Address',
'LBL_LOGIN' => 'User Name',
'LBL_PORT' => 'Mail Server Port',
'LBL_MAILBOX_NAME' => 'Mail Account Name:',
'LBL_PASSWORD' => 'Password',
'LBL_MAILBOX_DEFAULT' => 'INBOX',
'LBL_MAILBOX' => 'Monitored Folder',
'LBL_NAVIGATION_MENU_SETUP' => 'Setup Email',
'LBL_NAVIGATION_MENU_NEW_MAILBOX' => 'New Mail Account',
'LBL_NAVIGATION_MENU_SUMMARY' => 'Summary',
'LBL_MAILBOX_CHECK_WIZ_GOOD' => 'Mail account(s) with bounce handling were detected. You do not need to create a new one, but you can still do so below.',
'LBL_MAILBOX_CHECK_WIZ_BAD' => 'No mail accounts with bounce handling were detected, please create a new one below.',
'LBL_CAMP_MESSAGE_COPY' => 'Keep copies of campaign messages:',
'LBL_CAMP_MESSAGE_COPY_DESC' => 'Would you like to store complete copies of <bold>EACH</bold> email message sent during all campaigns? <bold>We recommend and default to no</bold>. Choosing no will store only the template that is sent and the needed variables to recreate the individual message.',
'LBL_YES' => 'Yes',
'LBL_NO' => 'No',
'LBL_FROM_ADDR' => '"From" Address',
'LBL_DEFAULT_FROM_ADDR' => 'Default: ',
'LBL_EMAIL_SETUP_DESC' => 'Fill out the form below to modify your system settings so that campaign emails can be sent out.',
'LBL_CREATE_MAILBOX' => 'Create New Mail Account',
'LBL_SSL_DESC' => 'If your mail server supports secure socket connections, enabling this will force SSL connections when importing email.',
'LBL_SSL' => 'Use SSL',
//campaign diagnostics
'LNK_CAMPAIGN_DIGNOSTIC_LINK' => 'Campaign may not function as desired and your emails may not be sent for the following reasons:',
'LBL_CAMPAIGN_DIAGNOSTICS' => 'Campaign Diagnostics',
'LBL_DIAGNOSTIC' => 'Diagnostic',
'LBL_MAILBOX_CHECK1_GOOD' => ' Mail account(s)) with bounce handling detected:',
'LBL_MAILBOX_CHECK1_BAD' => 'No mail account(s) with bounce handling detected.',
'LBL_MAILBOX_CHECK2_GOOD' => ' E-mail Settings have been configured:',
'LBL_MAILBOX_CHECK2_BAD' => 'Please configure your system email address. E-mail Settings have not been configured.',
'LBL_SCHEDULER_CHECK_GOOD' => 'Schedulers detected',
'LBL_SCHEDULER_CHECK_BAD' => 'No Schedulers detected',
'LBL_SCHEDULER_CHECK1_BAD' => 'Scheduler has not been set up to process Bounced Campaign Emails.',
'LBL_SCHEDULER_CHECK2_BAD' => 'Scheduler has not been set up to process Campaign Emails.',
'LBL_SCHEDULER_NAME' => 'Scheduler',
'LBL_SCHEDULER_STATUS' => 'Status',
'LBL_MARKETING_CHECK1_GOOD' => 'Email marketing components detected.',
'LBL_MARKETING_CHECK1_BAD' => 'No Email marketing components detected, you will need to create one to mail out a campaign.',
'LBL_MARKETING_CHECK2_GOOD' => 'Target lists detected.',
'LBL_MARKETING_CHECK2_BAD' => 'No target lists detected, you will need to create one from desired campaign screen.',
'LBL_EMAIL_SETUP_WIZ' => 'Launch Email Setup',
'LBL_SCHEDULER_LINK' => 'go to scheduler admin screen.',
'LBL_TO_WIZARD' => 'launch',
'LBL_TO_WIZARD_TITLE' => 'Launch Wizard',
'LBL_EDIT_EXISTING' => 'Edit Campaign',
'LBL_EDIT_TARGET_LIST' => 'Edit Target List',
'LBL_SEND_EMAIL' => 'Schedule Email',
'LBL_USE_EXISTING' => 'Use Existing',
'LBL_CREATE_NEW_MARKETING_EMAIL' => 'Create New Marketing Email',
'LBL_CHOOSE_NEXT_STEP' => 'Choose your next step',
'LBL_NON_ADMIN_ERROR_MSG' => 'Please notify your System Administrator so that they may correct this problem',
'LBL_EMAIL_COMPONENTS' => 'Email Components',
'LBL_SCHEDULER_COMPONENTS' => 'Scheduler Components',
'LBL_RECHECK_BTN'=>'Re-Check',
//web to lead wizard titles
'LBL_WEB_TO_LEAD_FORM_TITLE1' => 'Create Lead Form: Select fields',
'LBL_WEB_TO_LEAD_FORM_TITLE2' => 'Create Lead Form: Form properties',
'LBL_DRAG_DROP_COLUMNS' => 'Drag and drop lead fields in column 1 & 2',
'LBL_DEFINE_LEAD_HEADER' => 'Form Header:',
'LBL_LEAD_DEFAULT_HEADER' => 'Web to lead form for Campaign',
'LBL_DEFINE_LEAD_SUBMIT' => 'Submit Button Label:',
'LBL_DEFINE_LEAD_POST_URL' => 'Post URL:',
'LBL_EDIT_LEAD_POST_URL' => 'Edit Post URL?',
'LBL_DEFINE_LEAD_REDIRECT_URL' => 'Redirect URL:',
'LBL_LEAD_NOTIFY_CAMPAIGN' => 'Related Campaign:',
'LBL_DEFAULT_LEAD_SUBMIT' => 'Submit',
'LBL_WEB_TO_LEAD' => 'Create Lead Form',
'LBL_LEAD_FOOTER' => 'Form Footer:',
'LBL_CAMPAIGN_NOT_SELECTED' => 'Select and associate a campaign:',
'NTC_NO_LEGENDS' => 'None',
'LBL_SELECT_LEAD_FIELDS' => 'Please select from available fields',
'LBL_DESCRIPTION_LEAD_FORM' => 'Form Description:',
'LBL_DESCRIPTION_TEXT_LEAD_FORM' => 'Submitting this form will create a lead and link with campaign',
'LBL_DOWNLOAD_TEXT_WEB_TO_LEAD_FORM' =>'Please download your Web To Lead form',
'LBL_DOWNLOAD_WEB_TO_LEAD_FORM' =>'Web To Lead Form',
'LBL_PROVIDE_WEB_TO_LEAD_FORM_FIELDS' =>'Please provide all the required fields',
'LBL_NOT_VALID_EMAIL_ADDRESS' =>'Not a valid email address',
'LBL_AVALAIBLE_FIELDS_HEADER' => 'Available Fields',
'LBL_LEAD_FORM_FIRST_HEADER' => 'Lead Form (First Column)',
'LBL_LEAD_FORM_SECOND_HEADER' =>'Lead Form (Second Column)',
'LBL_LEAD_MODULE' => 'Leads',
'LBL_CREATE_WEB_TO_LEAD_FORM' => 'CreateWebToLeadForm',
'LBL_SELECT_REQUIRED_LEAD_FIELDS' => 'Please select required fields:',
//Campaign charts
'LBL_CAMPAIGN_RETURN_ON_INVESTMENT' =>'Campaign Return On Investment',
'LBL_CAMPAIGN_RESPONSE_BY_RECIPIENT_ACTIVITY'=>'Campaign Response by Recipient Activity',
'LBL_LOG_ENTRIES_BLOCKEDD_TITLE'=>'Suppressed by Email Address or domain',
'LBL_AMOUNT_IN' => 'Amount in ',
// Labels for ROI Chart
'LBL_ROI_CHART_REVENUE' => 'Revenue',
'LBL_ROI_CHART_INVESTMENT' => 'Investment',
'LBL_ROI_CHART_BUDGET' => 'Budget',
'LBL_ROI_CHART_EXPECTED_REVENUE' => 'Expected Revenue',
// Top Campaigns Dashlet
'LBL_TOP_CAMPAIGNS' => 'Top Campaigns',
'LBL_TOP_CAMPAIGNS_NAME' => 'Campaign Name',
'LBL_TOP_CAMPAIGNS_REVENUE' => 'Revenue',
'LBL_LEADS' => 'Leads',
'LBL_CONTACTS' => 'Contacts',
'LBL_ACCOUNTS' => 'Accounts',
'LBL_OPPORTUNITIES' => 'Opportunities',
'LBL_CREATED_USER' => 'Created User',
'LBL_MODIFIED_USER' => 'Modified User',
'LBL_LOG_ENTRIES' => 'Log Entries',
'LBL_PROSPECTLISTS_SUBPANEL_TITLE' => 'Prospect List',
'LBL_EMAILMARKETING_SUBPANEL_TITLE' => 'Email Marketing',
'LBL_TRACK_QUEUE_SUBPANEL_TITLE' => 'Track Queue',
'LBL_TARGETED_SUBPANEL_TITLE' => 'Targeted',
'LBL_VIEWED_SUBPANEL_TITLE' => 'Viewed',
'LBL_LINK_SUBPANEL_TITLE' => 'Link',
'LBL_LEAD_SUBPANEL_TITLE' => 'Lead',
'LBL_CONTACT_SUBPANEL_TITLE' => 'Contact',
'LBL_INVALID EMAIL_SUBPANEL_TITLE' => 'Invalid Email',
'LBL_SEND ERROR_SUBPANEL_TITLE' => 'Send Error',
'LBL_REMOVED_SUBPANEL_TITLE' => 'Removed',
'LBL_BLOCKED_SUBPANEL_TITLE' => 'Blocked',
'LBL_ACCOUNTS_SUBPANEL_TITLE' => 'Accounts',
'LBL_LEADS_SUBPANEL_TITLE' => 'Leads',
'LBL_OPPORTUNITIES_SUBPANEL_TITLE' => 'Opportunities',
'LBL_IMPORT_PROSPECTS'=>'Import Targets',
'LBL_LEAD_FORM_WIZARD' => 'Lead Form Wizard',
'LBL_CAMPAIGN_INFORMATION' => 'Campaign Overview',
);
?>

View File

@@ -0,0 +1,412 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* The contents of this file are subject to the SugarCRM Public License Version
* 1.1.3 ("License"); You may not use this file except in compliance with the
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* All copies of the Covered Code must include on each user interface screen:
* (i) the "Powered by SugarCRM" logo and
* (ii) the SugarCRM copyright notice
* in the same form as they appear in the distribution. See full license for
* requirements.
*
* The Original Code is: SugarCRM Open Source
* The Initial Developer of the Original Code is SugarCRM, Inc.
* Portions created by SugarCRM are Copyright (C) 2004-2005 SugarCRM, Inc.;
* All Rights Reserved.
* Contributor(s): ______________________________________.
********************************************************************************/
/*********************************************************************************
* pl_pl.lang.ext.php,v for SugarCRM 4.5.1-->>
* Translator: Krzysztof Morawski
* All Rights Reserved.
* Any bugs report welcome: krzysiek<at>kmmgroup<dot>pl
* Contributor(s): ______________________________________..
********************************************************************************/
$mod_strings = array (
'LBL_FROM_ADDR' => 'Adres "Od": ',
'LBL_REPLY_ADDR' => 'Adres "Odpowiedź do": ',
'LBL_REPLY_NAME' => 'Nazwa "Odpowiedź do": ',
'LBL_MODULE_NAME' => 'Kampanie',
'LBL_MODULE_TITLE' => 'Kampanie: Strona główna',
'LBL_NEWSLETTER_TITLE'=>'Kampanie: Newslettery',
'LBL_CAMPAIGN_INFORMATION'=>'Informacje o kampanii',
'LBL_SEARCH_FORM_TITLE' => 'Wyszukiwanie kampanii',
'LBL_LIST_FORM_TITLE' => 'Lista kampanii',
'LBL_NEWSLETTER_LIST_FORM_TITLE' => 'Lista newsletterów',
'LBL_CAMPAIGN_NAME' => 'Nazwa:',
'LBL_BIRTHDATE'=>'Data urodzin',
'LBL_CAMPAIGN' => 'Kampanii:',
'LBL_NAME' => 'Nazwa: ',
'LBL_INVITEE' => 'Kontakty',
'LBL_LIST_CAMPAIGN_NAME' => 'Kampania',
'LBL_LIST_STATUS' => 'Status',
'LBL_LIST_TYPE' => 'Typ',
'LBL_LIST_START_DATE' => 'Data rozpoczęcia',
'LBL_LIST_END_DATE' => 'Data zakończenia',
'LBL_DATE_ENTERED' => 'Data rozpoczęcia',
'LBL_DATE_MODIFIED' => 'Data modyfikacji',
'LBL_MODIFIED' => 'Zmodyfikowane przez: ',
'LBL_CREATED' => 'Stworzone przez: ',
'LBL_TEAM' => 'Zespół: ',
'LBL_ASSIGNED_TO' => 'Przydzielony do: ',
'LBL_ASSIGNED_TO_ID' => 'Przydzielony do:',
'LBL_ASSIGNED_TO_NAME'=> 'Przydzielony do:',
'LBL_CAMPAIGN_START_DATE' => 'Data rozpoczęcia: ',
'LBL_CAMPAIGN_END_DATE' => 'Data zakończenia: ',
'LBL_CAMPAIGN_STATUS' => 'Status: ',
'LBL_CAMPAIGN_BUDGET' => 'Budżet: ',
'LBL_CAMPAIGN_EXPECTED_COST' => 'Spodziewane koszty: ',
'LBL_CAMPAIGN_ACTUAL_COST' => 'Aktualne koszty: ',
'LBL_CAMPAIGN_EXPECTED_REVENUE' => 'Spodziewane przychody: ',
'LBL_CAMPAIGN_IMPRESSIONS' => 'Nakład (ilość): ',
'LBL_CAMPAIGN_COST_PER_IMPRESSION' => 'Koszt na nakład: ',
'LBL_CAMPAIGN_COST_PER_CLICK_THROUGH' => 'Koszt przez przekierowanie: ',
'LBL_CAMPAIGN_OPPORTUNITIES_WON' =>'Wygrane okazje:',
'LBL_CAMPAIGN_TYPE' => 'Typ: ',
'LBL_CAMPAIGN_OBJECTIVE' => 'Cel: ',
'LBL_CAMPAIGN_CONTENT' => 'Opis: ',
'LBL_CAMPAIGN_DAYS_REMAIN' => 'Pozostałe dni',
'LNK_NEW_CAMPAIGN' => 'Utwórz kampanię (klasyczną)',
'LNK_CAMPAIGN_LIST' => 'Kampanie',
'LNK_NEW_PROSPECT' => 'Utwórz docelowego odbiorcę',
'LNK_PROSPECT_LIST' => 'Lista odbiorców',
'LNK_NEW_PROSPECT_LIST' => 'Utwórz listę grup odbiorców',
'LNK_PROSPECT_LIST_LIST' => 'Lista grup odbiorców',
'LBL_MODIFIED_BY' => 'Zmodyfikowane przez: ',
'LBL_CREATED_BY' => 'Stworzone przez: ',
'LBL_DATE_CREATED' => 'Data utworzenia: ',
'LBL_DATE_LAST_MODIFIED' => 'Data modyfikacji: ',
'LBL_TRACKER_KEY' => 'Śledzenie: ',
'LBL_TRACKER_URL' => 'Śledzenie URL: ',
'LBL_TRACKER_TEXT' => 'Śledzenie link text: ',
'LBL_TRACKER_COUNT' => 'Śledzenie licznika: ',
'LBL_REFER_URL' => 'Śledzenie przekierowań URL: ',
'LBL_DEFAULT_SUBPANEL_TITLE' => 'Kampanie',
'LBL_EMAIL_CAMPAIGNS_TITLE' =>'Kampanie mailingowe',
'LBL_NEW_FORM_TITLE' => 'Nowa kampania',
'LBL_TRACKED_URLS'=>'Śledzenie łącz URL',
'LBL_TRACKED_URLS_SUBPANEL_TITLE'=>'Śledzenie łącz URL',
'LBL_CAMPAIGN_ACCOUNTS_SUBPANEL_TITLE'=>'Klienci',
'LBL_PROSPECT_LIST_SUBPANEL_TITLE' => 'Lista odbiorców',
'LBL_EMAIL_MARKETING_SUBPANEL_TITLE' => 'Mailing',
'LNK_NEW_EMAIL_TEMPLATE' => 'Utwórz szablon wiadomości',
'LNK_EMAIL_TEMPLATE_LIST' => 'Szablony wiadomości',
'LBL_TRACK_BUTTON_TITLE' =>'Zobacz status',
'LBL_TRACK_BUTTON_KEY' =>'T',
'LBL_TRACK_BUTTON_LABEL' =>'Zobacz status',
'LBL_QUEUE_BUTTON_TITLE'=>'Wyślij wiadomość',
'LBL_QUEUE_BUTTON_KEY'=>'u',
'LBL_QUEUE_BUTTON_LABEL'=>'Wyślij wiadomość',
'LBL_TEST_BUTTON_TITLE'=>'Wyślij test',
'LBL_TEST_BUTTON_KEY'=>'e',
'LBL_TEST_BUTTON_LABEL'=>'Wyślij test',
'LBL_COPY_AND_PASTE_CODE' => 'Or copy and paste the html below into an existing page',
'LBL_TODETAIL_BUTTON_TITLE'=>'Zobacz szczegóły',
'LBL_TODETAIL_BUTTON_KEY'=>'T',
'LBL_TODETAIL_BUTTON_LABEL'=>'Zobacz szczegóły',
'LBL_DEFAULT'=>'Wszystkie Listy odbiorców',
'LBL_MESSAGE_QUEUE_TITLE'=>'Kolejka wiadomosci',
'LBL_LOG_ENTRIES_TITLE'=>'Odpowiedzi',
'LBL_LOG_ENTRIES_TARGETED_TITLE'=>'Wiadomosci wysłane/próba wysłania',
'LBL_LOG_ENTRIES_SEND_ERROR_TITLE'=>'Wiadomości odrzucone, inne',
'LBL_LOG_ENTRIES_INVALID_EMAIL_TITLE'=>'Wiadomości odrzucone, nieprawidłowe',
'LBL_LOG_ENTRIES_LINK_TITLE'=>'Link przekierowania',
'LBL_LOG_ENTRIES_VIEWED_TITLE'=>'Obejrzane wiadomości',
'LBL_LOG_ENTRIES_REMOVED_TITLE'=>'Wychodzące',
'LBL_LOG_ENTRIES_LEAD_TITLE'=>'Stworzeni decydenci',
'LBL_CAMPAIGN_LEAD_SUBPANEL_TITLE'=>'Adresy',
'LBL_OPPORTUNITY_SUBPANEL_TITLE'=>'Okazje',
'LBL_LOG_ENTRIES_CONTACT_TITLE'=>'Stworzone kontakty',
'LBL_BACK_TO_CAMPAIGNS'=>'Powrót do kampanii',
//error messages.
'ERR_NO_EMAIL_MARKETING'=>'Musi co najmniej jedna aktywna wiadomość z marketingowa, przynależąca do kampanii.',
'ERR_NO_TARGET_LISTS'=>'Musi być co najmniej jedna aktywna lista odbiorców, przynależąca do kampanii.',
'ERR_NO_TEST_TARGET_LISTS'=>'Musi być co najmniej jedna lista subskrybentów testowych połączona z kampanią.',
'ERR_SENDING_NOW'=>'Wiadomość jest dostarczana , sprawdź to później.',
'ERR_MESS_NOT_FOUND_FOR_LIST'=>'Nie znaleziono żadnych wiadomości z kampanii w tej liscie odbiorców',
'ERR_MESS_DUPLICATE_FOR_LIST'=>'Różne wiadomości marketingowe są zdefiniowane dla tej listy odbiorców',
'ERR_FIX_MESSAGES'=>'Popraw następujące błędy przed kontynuacją',
'LBL_TRACK_DELETE_BUTTON_KEY'=>'D',
'LBL_TRACK_ROI_BUTTON_LABEL' =>'Obejrzyj zwroty z inwestycji (ROI)',
'LBL_TRACK_DELETE_BUTTON_TITLE'=>'Usuń rekord testowy',
'LBL_TRACK_DELETE_BUTTON_LABEL'=>'Usuń rekord testowy',
'LBL_TRACK_DELETE_CONFIRM'=>'Ta opcja usunie log rekordów stworzonych podczas testowania. Kontynuować?',
'ERR_NO_MAILBOX'=>"Nastepujące wiadomości nie są skojarzone z żadną skrzynką pocztową.<BR>Napraw to, zanim przejdziesz dalej.",
'LBL_LIST_TO_ACTIVITY'=>'Zobacz status',
'LBL_CURRENCY_ID'=>'ID Waluty',
'LBL_CURRENCY'=>'Waluta',
'LBL_ROLLOVER_VIEW' => 'Rozwiń pasek, żeby zobaczyć detale.',
'LBL_TARGETED' => 'Namierzone cele',
'LBL_TOTAL_TARGETED' => 'Wszystkie namierzone cele',
'LBL_CAMPAIGN_FREQUENCY'=>'Częstotliwość',
'LBL_NEWSLETTERS'=>'Newslettery',
'LBL_NEWSLETTER'=>'Newsletter',
'LBL_NEWSLETTER_FORENTRY'=>'Newsletter',
'LBL_MORE_DETAILS' => 'Więcej szczegółów',
'LBL_CREATE_NEWSLETTER'=>'Utwórz newsLetter',
'LBL_LIST_NAME' => 'Nazwa',
'LBL_STATUS_TEXT' => 'Status:' ,
'LBL_FROM_MAILBOX_NAME'=>'Użyj skrzynki pocztowej:',
'LBL_FROM_NAME' => 'Pole Od: ',
'LBL_START_DATE_TIME' => 'Czas i data rozpoczęcia: ',
'LBL_DATE_START' => 'Data rozpoczęcia ',
'LBL_TIME_START' => 'Czas rozpoczęcia ',
'LBL_TEMPLATE' => 'Skic Wiadomości email: ',
'LBL_CREATE_EMAIL_TEMPLATE'=> 'Utwórz',
'LBL_MESSAGE_FOR' => 'Wyślij tę wiadomość do:',
'LBL_FINISH' => 'Zakończ',
'LBL_ALL_PROSPECT_LISTS'=>'Wszystkie listy grup odbiorców w kampanii.',
'LBL_EDIT_EMAIL_TEMPLATE'=> 'Edytuj',
'LBL_EMAIL_SETUP_WIZARD'=> 'Ustawienia wiadomości pocztowych',
'LBL_DIAGNOSTIC_WIZARD'=> 'Diagnostyka',
'LBL_ALREADY_SUBSCRIBED_HEADER'=>'Newsletters zasubskrybowany dla',
'LBL_UNSUBSCRIBED_HEADER'=>'Dostępne newsLettery',
'LBL_UNSUBSCRIBED_HEADER_EXPL'=>'Przenosząc wiadomość do Dostępne / Anulowano nadawca wiadomości zostanie dodany do listy Anulowano, Nie można usunać kontaktu z orginalnej listy subskrypcji.',
'LBL_FILTER_CHART_BY'=>'Filtruj Wykresy przez:',
'LBL_MANAGE_SUBSCRIPTIONS_TITLE'=>'Zarządzaj subskrybcją',
'LBL_MARK_AS_SENT' =>'Oznacz jako wysłane',
'LBL_DEFAULT_LIST_NOT_FOUND'=>'Nie znaleziono domyślnych typów list odbiorców',
'LBL_DEFAULT_LIST_ENTRIES_NOT_FOUND'=>'Nie znaleziono żadnych wpisów',
'LBL_DEFAULT_LIST_ENTRIES_WERE_PROCESSED' => 'Wpisy zostały przetworzone',
//newsletter wizard
'LBL_EDIT_TRACKER_NAME'=>'Nazwa śladu:',
'LBL_EDIT_TRACKER_URL'=>'URL śladu:',
'LBL_EDIT_OPT_OUT_'=>'Czy link jest aktywny?',
'LBL_EDIT_OPT_OUT'=>'Czy link jest aktywny?',
'LBL_UNSUBSCRIPTION_LIST_NAME'=>'Lista niezasubskrybowanych odbiorców:',
'LBL_SUBSCRIPTION_LIST_NAME'=>'Lista subskrybentów:',
'LBL_TEST_LIST_NAME'=>'Testowa Lista subskrybentów',
'LBL_UNSUBSCRIPTION_TYPE_NAME'=>'Wyłącz ',
'LBL_SUBSCRIPTION_TYPE_NAME'=>'Subskrypcja',
'LBL_TEST_TYPE_NAME'=>'Test',
'LBL_UNSUBSCRIPTION_LIST'=>'Lista niezasubskrybowanych',
'LBL_SUBSCRIPTION_LIST'=>'Lista subskrybentów',
'LBL_MRKT_NAME' => 'Nazwa',
'LBL_TEST_LIST'=>'Lista Testowa',
'LBL_WIZARD_HEADER_MESSAGE' => 'Wypełnij wymagane pola, aby można było zidentyfikować kampanie.',
'LBL_WIZARD_BUDGET_MESSAGE' => 'Wprowadź kwotę budżetu, aby obliczyć Zwrot z Inwestycji (ROI).',
'LBL_WIZARD_SUBSCRIPTION_MESSAGE' => 'Każdy newsletter musi posiadać trzy listy odbiorców (subskrybentów, osób niezasubskrybowanych i listę testową). Możesz przydzielić istniejącej Listy. Jeżeli nie użyjesz, to zostanie utworzona pusta lista, kiedy zapiszesz newsletter.',
'LBL_WIZARD_TARGET_MESSAGE1' => 'Wybierz lub utwórz listę odbiorców do użycia w Twoje kamapnii. Będzie ona użyta, kiedy wysyłasz wiadomości marketingowe.',
'LBL_WIZARD_TARGET_MESSAGE2' => 'Lub utwórz nową, korzystając z formularza poniżej:',
'LBL_WIZARD_TRACKER_MESSAGE' => 'Zdefiniuj ślad URL kampanii tutaj. Musisz wprowadzić nazwę i URL, aby utworzyć ślad.',
'LBL_WIZARD_MARKETING_MESSAGE' => 'Wypełnij formularz poniżej, aby utworzyć przykładową wiadomość pocztową do twojego newslettera. To pozwoli na określenie kiedy i jak Twój newsletter ma zostać wysłany.',
'LBL_WIZARD_SENDMAIL_MESSAGE' => 'To jest ostatni krok tego procesu. Wybierz, czy chcesz wysłać wiadomość testową teraz, czy okreslić kiedy ma zostać wysłana, czy po prostu zapisać sowją prace i przejść do podsumowania.',
'LBL_HOME_START_MESSAGE' => 'Wybierz typ kampanii, którą chcesz utworzyć .',
'LBL_WIZARD_LAST_STEP_MESSAGE'=> 'Nie możesz przejść dalej, jesteś w ostatnim kroku.',
'LBL_WIZARD_FIRST_STEP_MESSAGE'=>'Nie możesz się cofnąć. Jesteś w kroku początkowym.',
'LBL_WIZ_NEWSLETTER_TITLE_STEP1' => 'Nagłówek kampanii',
'LBL_WIZ_NEWSLETTER_TITLE_STEP2' => 'Budżet kampanii',
'LBL_WIZ_NEWSLETTER_TITLE_STEP3' => 'Ślad URL kampanii',
'LBL_WIZ_NEWSLETTER_TITLE_STEP4' => 'Informacje o subskrypcji',
'LBL_WIZ_MARKETING_TITLE' => 'Wiadmości marketingowe',
'LBL_WIZ_SENDMAIL_TITLE' => 'Wyślij wiadomość',
'LBL_WIZ_TEST_EMAIL_TITLE' => 'Wiadomość testowa ',
'LBL_WIZ_NEWSLETTER_TITLE_SUMMARY' => 'Podsumowanie',
'LBL_NAVIGATION_MENU_GEN1' => 'Nagłówek kampanii',
'LBL_NAVIGATION_MENU_GEN2' => 'Budżet',
'LBL_NAVIGATION_MENU_TRACKERS' => 'Ślady',
'LBL_NAVIGATION_MENU_MARKETING' => 'Marketing',
'LBL_NAVIGATION_MENU_SEND_EMAIL' => 'Wyślij wiadomość',
'LBL_NAVIGATION_MENU_SUBSCRIPTIONS' => 'Subskrybcje',
'LBL_NAVIGATION_MENU_SUMMARY' => 'Podsumowanie',
'LBL_SUBSCRIPTION_TARGET_WIZARD_DESC' => 'Określi to listy odbiorców i typy subskrybcji dla tej kampanii.<br> Lista odbiorców będą użyte do wysyłania wiadomości pocztowych tej kampanii. <br>Jeżeli nie masz jeszcze gotowych list, zostaną utworzone puste listy.',
'LBL_UNSUBSCRIPTION_TARGET_WIZARD_DESC' => 'To określi listy odbiorców i typy niezasubskrybowanych dla tej kampanii. <br>Ta Lista Odbiorców będzie zawierać nazwiska ludzi, którzy zostali wyłączeni z Twojej kampanii i nie powinni być powiadamiani poprzez Email. <br>Jeżeli nie masz jeszcze gotowych list, zostaną utworzone puste listy.',
'LBL_TEST_TARGET_WIZARD_DESC' => 'To zdefiniuje listę odbiorców odbiorców, do których zostaną wysłane wiadomości testowe Twojej kampanii. <br>Ta lista docelowa bedzie użyta do wysyłania wiadomości testowych z kampanii. <br>Jeżeli nie masz jeszcze gotowych list, zostaną utworzone puste listy.',
'LBL_TRACKERS' => 'Ślady',
'LBL_ADD_TRACKER' => 'Utwórz ślad',
'LBL_ADD_TARGET' => 'Dodaj',
'LBL_CREATE_TARGET'=> 'Utwórz',
'LBL_SELECT_TARGET'=> 'Wybierz z listy grup odbiorców',
'LBL_REMOVE' => ' usuń',
'LBL_CONFIRM' => 'Start',
'LBL_START' => 'Start',
'LBL_TOTAL_ENTRIES' => 'Wpisy',
'LBL_CONFIRM_CAMPAIGN_SAVE_CONTINUE' => 'Zapisz pracę i przejdź do mailingu',
'LBL_CONFIRM_CAMPAIGN_SAVE_OPTIONS' => 'Zachowaj opcje',
'LBL_CONFIRM_CAMPAIGN_SAVE_EXIT' => 'Czy chcesz zapisać informacje i opuścić kreator?',
'LBL_CONFIRM_SEND_SAVE' => 'Zamierzasz przejść do storny wysyłania wiadomości kampanii. Czy chcesz zapisać i kontynuować?',
'LBL_NEWSLETTER WIZARD_TITLE' => 'Newsletter: ',
'LBL_NEWSLETTER_WIZARD_START_TITLE' => 'Edytuj newsletter: ',
'LBL_CAMPAIGN_WIZARD_START_TITLE' => 'Edytuj kampanię: ',
'LBL_SEND_AS_TEST' => 'Wyślij wiadomość marketingową, jako test',
'LBL_SAVE_EXIT_BUTTON_LABEL' => 'Zakończ',
'LBL_SAVE_CONTINUE_BUTTON_LABEL' => 'Zapisz i kontynuuj',
'LBL_TARGET_LISTS' => 'Listy odbiorców',
'LBL_NO_SUBS_ENTRIES_WARNING' => 'Nie możesz wysłać wiadomości, dopóki Twoja lista odbiorców nie zawiera choć jednego wpisu. Możesz wypełnić Listę później. ',
'LBL_NO_TARGET_ENTRIES_WARNING' => 'Nie możesz wysłać wiadomości, dopóki Twoja lista odbiorców nie otrzymujących wiadomości, nie zawiera choć jednego wpisu. Możesz wypełnić Listę później. ',
'LBL_NO_TARGETS_WARNING' => 'Nie możesz wysłać wiadomości, dopóki Twoja Kampania zawiera tylko jedną listę odbiorców. ',
'LBL_NONE' => 'nie utworzono',
'LBL_CAMPAIGN_WIZARD' => 'Kreator kampanii',
'LBL_EMAIL' =>'Poczta email',
'LBL_OTHER_TYPE_CAMPAIGN' => 'Kampania nie bazująca na wiadomościach email',
'LBL_CHOOSE_CAMPAIGN_TYPE' => 'Typ kapmanii',
'LBL_TARGET_LIST' => 'lista odbiorców',
'LBL_TARGET_TYPE' => 'Typ list odbiorców',
'LBL_TARGET_NAME' => 'Nazwa listy odbiorców',
'LBL_EMAILS_SCHEDULED' => 'Wiadomości o zaplanowajej wysyłce',
'LBL_TEST_EMAILS_SENT' => 'Wysłano wiadomość testową',
'LBL_USERS_CANNOT_OPTOUT' => 'Użytkownicy systemu nie mają możliości wyłączenia otrzymywania wiadomości.',
'LBL_ELECTED_TO_OPTOUT' => 'Zostałeś usunięty z listy i nie będziesz otrzymywał wiecej wiadomości pocztowych.',
'LBL_COPY_OF' => 'Kopia z ',
'LBL_SAVED_SEARCH' => 'Zapisane wyniki wyszukiwania i wyglądu',
//email setup wizard
'LBL_WIZ_FROM_NAME' => 'Od (Nazwa):',
'LBL_WIZ_FROM_ADDRESS' => 'Od (Adres):',
'LBL_EMAILS_PER_RUN' => 'Liczba wiadomości wysyłanych w serii:',
'LBL_CUSTOM_LOCATION' => 'Pozwolenie na wybór',
'LBL_DEFAULT_LOCATION' => 'Auto-tworzenie',
'ERR_INT_ONLY_EMAIL_PER_RUN' => 'Tylko cyfry są dozwolone przy określaniu Liczby wiadomości wysyłanych w serii',
'LBL_LOCATION_TRACK' => 'Lokalizacja śledzenia kampanii (jak campaign_tracker.php):',
'LBL_MAIL_SENDTYPE' => 'MTA:',
'LBL_MAIL_SMTPAUTH_REQ' => 'Użyć autentykacji SMTP?',
'LBL_MAIL_SMTPPASS' => 'Hasło SMTP:',
'LBL_MAIL_SMTPPORT' => 'Port SMTP',
'LBL_MAIL_SMTPSERVER' => 'Serwer SMTP',
'LBL_MAIL_SMTPUSER' => 'Nazwa użytkownika SMTP',
'LBL_EMAIL_SETUP_WIZARD_TITLE' => 'Ustawienia wiadomości pocztowych dla kampanii',
'TRACKING_ENTRIES_LOCATION_DEFAULT_VALUE' => 'Wartości zmiennej site_url w pliku Config.php',
'LBL_NOTIFY_TITLE' => 'Opcje powiadamiania wiadomości pocztowych',
'LBL_MASS_MAILING_TITLE' => 'Opcje korespondencji seryjnej',
'LBL_SERVER_TYPE' => 'Protokuł serwera pocztowego',
'LBL_SERVER_URL' => 'Adres serwera pocztowego',
'LBL_LOGIN' => 'Nazwa użytkownika',
'LBL_PORT' => 'Port serwera pocztowego',
'LBL_MAILBOX_NAME' => 'Nazwa skrzynki pocztowej:',
'LBL_PASSWORD' => 'Hasło',
'LBL_MAILBOX_DEFAULT' => 'INBOX',
'LBL_MAILBOX' => 'Monitorowane foldery',
'LBL_NAVIGATION_MENU_SETUP' => 'Ustawienia poczty',
'LBL_NAVIGATION_MENU_NEW_MAILBOX' => 'Nowa skrzynka pocztowa',
'LBL_NAVIGATION_MENU_SUMMARY' => 'Podsumowanie',
'LBL_MAILBOX_CHECK_WIZ_GOOD' => 'Wykryto skrzynke(i) z ustawieniem zwrotu gdy niedoręczono. Nie musisz tworzyć nowej, ale możesz to też zrobić poniżej.',
'LBL_MAILBOX_CHECK_WIZ_BAD' => 'Nie wykryto skrzynki(ek) z ustawieniem zwrotu, gdy niedoręczono. Proszę utwórz taką skrzynkę poniżej.',
'LBL_CAMP_MESSAGE_COPY' => 'Zachowaj kopię wiadomości kampanii :',
'LBL_CAMP_MESSAGE_COPY_DESC' => 'Czy chcesz zachować kompletną kopię wiadomości wysłanych podczas wszystkich kampani? <bold>Zaleca się pozostawienie opcji w domyślnym ustawieniu - nie</bold>. Wybierając nie, zachowane zostaną wzory i niezbędne zmienne wiadomości, aby odtworzyć indywidualną wiadomość.',
'LBL_YES' => 'Tak',
'LBL_NO' => 'Nie',
'LBL_FROM_ADDR' => 'Adres "Od"',
'LBL_DEFAULT_FROM_ADDR' => 'Domyślnie: ',
'LBL_EMAIL_SETUP_DESC' => 'Wypełnij poniższy formularz w celu modyfikacji Twoich ustawień systemowych, po to aby można było wysyłać wiadomości kampanii.',
'LBL_CREATE_MAILBOX' => 'Utwórz nowe skrzynki pocztowe',
'LBL_SSL_DESC' => 'Jeżeli Twój serwer wspiera SSL, włączenie tej funkcji wymusi korzystanie z niego, podczas importu wiadomości.',
'LBL_SSL' => 'Użyj SSL',
//campaign diagnostics
'LNK_CAMPAIGN_DIGNOSTIC_LINK' => 'Kampanie nie mogą funkcjonować zgodnie z założeniami, z powodu następujących błędów:',
'LBL_CAMPAIGN_DIAGNOSTICS' => 'Diagnostyka kampanii',
'LBL_DIAGNOSTIC' => 'Diagnostyka',
'LBL_MAILBOX_CHECK1_GOOD' => ' Wykryto skrzynek pocztowych z ustawieniami zwrotu gdy niedoręczono:',
'LBL_MAILBOX_CHECK1_BAD' => 'Nie wykryto skrzynek pocztowych z ustawieniami zwrotu, gdy niedoręczono.',
'LBL_MAILBOX_CHECK2_GOOD' => ' Ustawienia e-mail zostały skonfigurowane:',
'LBL_MAILBOX_CHECK2_BAD' => 'Ustawienia e-mail nie zostały skonfigurowane.',
'LBL_SCHEDULER_CHECK_GOOD' => 'Wykryto harmonogramy',
'LBL_SCHEDULER_CHECK_BAD' => 'Nie wykryto harmonogramów',
'LBL_SCHEDULER_CHECK1_BAD' => 'Nie ustawiono harmonogramu dla przetworzenia odrzuconych wiadomości kampanii..',
'LBL_SCHEDULER_CHECK2_BAD' => 'Nie ustawiono harmonogramu dla przetworzenia wiadomości kampanii..',
'LBL_SCHEDULER_NAME' => 'Harmonogram',
'LBL_SCHEDULER_STATUS' => 'Status',
'LBL_MARKETING_CHECK1_GOOD' => 'Wykryto komponenty marketingu email.',
'LBL_MARKETING_CHECK1_BAD' => 'Nie wykyryto komponentów Marketingu Email. Musisz je utworzyć, aby było możliwe wysyłanie wiadomości kampanii.',
'LBL_MARKETING_CHECK2_GOOD' => 'Wykryto listy odbiorców.',
'LBL_MARKETING_CHECK2_BAD' => 'Nie wykryto list odbiorców, będziesz musiał je utworzyć, aby osiągnąć porządany obraz kampanii.',
'LBL_EMAIL_SETUP_WIZ' => 'Wyświetl formularz ustawień wiadomości pocztowych',
'LBL_SCHEDULER_LINK' => 'idź do strony zarządzania harmonogramem.',
'LBL_TO_WIZARD' => 'załaduj',
'LBL_TO_WIZARD_TITLE' => 'Uruchom kreator',
'LBL_EDIT_EXISTING' => 'Edytuj kampanie',
'LBL_EDIT_TARGET_LIST' => 'Edytuj listy odbiorców',
'LBL_SEND_EMAIL' => 'Harmonogram wiadomości pocztowych',
'LBL_USE_EXISTING' => 'Użyj istniejącego',
'LBL_CREATE_NEW_MARKETING_EMAIL' => 'Utwórz nową wiadomość marketingową',
'LBL_CHOOSE_NEXT_STEP' => 'Wybierz swój kolejny krok',
'LBL_NON_ADMIN_ERROR_MSG' => 'Powiadom administratora systemu, aby ten problem został naprawiony',
'LBL_EMAIL_COMPONENTS' => 'Składniki wiadomości',
'LBL_SCHEDULER_COMPONENTS' => 'Harmonogram składników',
'LBL_RECHECK_BTN'=>'Sprawdź ponownie',
//web to lead wizard titles
'LBL_WEB_TO_LEAD_FORM_TITLE1' => 'Tworzenie nagłówka formularza: Wybierz pola',
'LBL_WEB_TO_LEAD_FORM_TITLE2' => 'Tworzenie nagłówka formularza: Właściwości formularza',
'LBL_DRAG_DROP_COLUMNS' => 'Przeciągnij i upuść pola nagłówka w kolumnie 1 i 2',
'LBL_DEFINE_LEAD_HEADER' => 'Nagłówek formularza:',
'LBL_LEAD_DEFAULT_HEADER' => 'Strona jako nagłówek formularza dla kampanii',
'LBL_DEFINE_LEAD_SUBMIT' => 'Etykieta przycisku wyślij:',
'LBL_DEFINE_LEAD_POST_URL' => 'Opublikuj adres URL:',
'LBL_EDIT_LEAD_POST_URL' => 'Edytuj adres URL?',
'LBL_DEFINE_LEAD_REDIRECT_URL' => 'Adres przekierowania URL:',
'LBL_LEAD_NOTIFY_CAMPAIGN' => 'Połączone kampanie:',
'LBL_DEFAULT_LEAD_SUBMIT' => 'Wyślij',
'LBL_WEB_TO_LEAD' => 'Utwórz formularz adresu',
'LBL_LEAD_FOOTER' => 'Stopka formularza:',
'LBL_CAMPAIGN_NOT_SELECTED' => 'Wybierz i przydziel kampanię:',
'NTC_NO_LEGENDS' => 'Nic',
'LBL_SELECT_LEAD_FIELDS' => 'Wybierz z dostępnych pól',
'LBL_DESCRIPTION_LEAD_FORM' => 'Opis formularza:',
'LBL_DESCRIPTION_TEXT_LEAD_FORM' => 'Wysłanie tego formularza spowoduje dodanie adresu i połączenie z kampanią',
'LBL_DOWNLOAD_TEXT_WEB_TO_LEAD_FORM' =>'Ściągnij tekst ze swojej strony do umieszczenia w nakgówku formularza',
'LBL_DOWNLOAD_WEB_TO_LEAD_FORM' =>'Tekst do nagłówka',
'LBL_PROVIDE_WEB_TO_LEAD_FORM_FIELDS' =>'Wypełnij wszystkie wymagane pola',
'LBL_NOT_VALID_EMAIL_ADDRESS' =>'Niepoprawny adres email',
'LBL_AVALAIBLE_FIELDS_HEADER' => 'Dostępne pola',
'LBL_LEAD_FORM_FIRST_HEADER' => 'Nagłowek formularza (pierwsza kolumna)',
'LBL_LEAD_FORM_SECOND_HEADER' =>'Nagłowek formularza (druga kolumna)',
'LBL_LEAD_MODULE' => 'Adresy',
'LBL_CREATE_WEB_TO_LEAD_FORM' => 'Umieść strone w nagłówku formlularza',
'LBL_SELECT_REQUIRED_LEAD_FIELDS' => 'Wybierz wymagane pola:',
//Campaign charts
'LBL_CAMPAIGN_RETURN_ON_INVESTMENT' =>'kampanie zwrotu z inwestycji',
'LBL_CAMPAIGN_RESPONSE_BY_RECIPIENT_ACTIVITY'=>'kampania odpowiedzi na aktywność klienta',
'LBL_LOG_ENTRIES_BLOCKEDD_TITLE'=>'Usunięte z powodu niewłaściwego odbiorcy lub błędu aderu',
'LBL_AMOUNT_IN' => 'Kwota w ',
// Labels for ROI Chart
'LBL_ROI_CHART_REVENUE' => 'Dochód',
'LBL_ROI_CHART_INVESTMENT' => 'Inwestycja',
'LBL_ROI_CHART_BUDGET' => 'Budżet',
'LBL_ROI_CHART_EXPECTED_REVENUE' => 'Spodziewany dochód',
// Top Campaigns Dashlet
'LBL_TOP_CAMPAIGNS' => 'Najlepsze kampanie',
'LBL_TOP_CAMPAIGNS_NAME' => 'Nazwy kampanii',
'LBL_TOP_CAMPAIGNS_REVENUE' => 'Dochód',
'LBL_LEADS' => 'Adresy',
'LBL_CONTACTS' => 'Kontakty',
'LBL_ACCOUNTS' => 'Klienci',
'LBL_OPPORTUNITIES' => 'Okazje',
'LBL_CREATED_USER' => 'Użytkownik tworzący',
'LBL_MODIFIED_USER' => 'Użytkownik modyfikujący',
'LBL_LOG_ENTRIES' => 'Wpisy logu',
'LBL_PROSPECTLISTS_SUBPANEL_TITLE' => 'Klient docelowy',
'LBL_EMAILMARKETING_SUBPANEL_TITLE' => 'Email marketingowy',
'LBL_TRACK_QUEUE_SUBPANEL_TITLE' => 'Śledzenie kolejki',
'LBL_TARGETED_SUBPANEL_TITLE' => 'Ukierunkowanie',
'LBL_VIEWED_SUBPANEL_TITLE' => 'Wyświetlono',
'LBL_LINK_SUBPANEL_TITLE' => 'Link',
'LBL_LEAD_SUBPANEL_TITLE' => 'Kontakt',
'LBL_CONTACT_SUBPANEL_TITLE' => 'Osoba kontaktowa',
'LBL_INVALID EMAIL_SUBPANEL_TITLE' => 'Nieprawidłowy email',
'LBL_SEND ERROR_SUBPANEL_TITLE' => 'Błąd wysyłania',
'LBL_REMOVED_SUBPANEL_TITLE' => 'Usunięty',
'LBL_BLOCKED_SUBPANEL_TITLE' => 'Zablokowanu',
'LBL_ACCOUNTS_SUBPANEL_TITLE' => 'Klienci',
'LBL_LEADS_SUBPANEL_TITLE' => 'Kontakty',
'LBL_OPPORTUNITIES_SUBPANEL_TITLE' => 'Szanse',
);
?>

View File

@@ -0,0 +1,45 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$searchFields['Campaigns'] =
array (
'name' => array( 'query_type'=>'default'),
'campaign_type'=> array('query_type'=>'default', 'options' => 'campaign_type_dom', 'template_var' => 'TYPE_OPTIONS'),
'status'=> array('query_type'=>'default', 'options' => 'campaign_status_dom', 'template_var' => 'STATUS_OPTIONS'),
'current_user_only'=> array('query_type'=>'default','db_field'=>array('assigned_user_id'),'my_items'=>true, 'vname' => 'LBL_CURRENT_USER_FILTER', 'type' => 'bool'),
'assigned_user_id'=> array('query_type'=>'default'),
);
?>

View File

@@ -0,0 +1,73 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
function additionalDetailsCampaign($fields) {
static $mod_strings;
if(empty($mod_strings)) {
global $current_language;
$mod_strings = return_module_language($current_language, 'Campaigns');
}
$overlib_string = '';
if(!empty($fields['START_DATE']))
$overlib_string .= '<b>'. $mod_strings['LBL_CAMPAIGN_START_DATE'] . '</b> ' . $fields['START_DATE'] . '<br>';
if(!empty($fields['TRACKER_TEXT']))
$overlib_string .= '<b>'. $mod_strings['LBL_TRACKER_TEXT'] . '</b> ' . $fields['TRACKER_TEXT'] . '<br>';
if(!empty($fields['REFER_URL']))
$overlib_string .= '<a target=_blank href='. $fields['REFER_URL'] . '>' . $fields['REFER_URL'] . '</a><br>';
if(!empty($fields['OBJECTIVE'])) {
$overlib_string .= '<b>'. $mod_strings['LBL_CAMPAIGN_OBJECTIVE'] . '</b> ' . substr($fields['OBJECTIVE'], 0, 300);
if(strlen($fields['OBJECTIVE']) > 300) $overlib_string .= '...';
$overlib_string .= '<br>';
}
if(!empty($fields['CONTENT'])) {
$overlib_string .= '<b>'. $mod_strings['LBL_CAMPAIGN_CONTENT'] . '</b> ' . substr($fields['CONTENT'], 0, 300);
if(strlen($fields['CONTENT']) > 300) $overlib_string .= '...';
}
return array('fieldToAddTo' => 'NAME',
'string' => $overlib_string,
'editLink' => "index.php?action=EditView&module=Campaigns&return_module=Campaigns&record={$fields['ID']}",
'viewLink' => "index.php?action=DetailView&module=Campaigns&return_module=Campaigns&record={$fields['ID']}");
}
?>

View File

@@ -0,0 +1,162 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$viewdefs['Campaigns']['DetailView'] = array(
'templateMeta' => array('form' => array('buttons' =>
array('EDIT', 'DUPLICATE', 'DELETE',
array('customCode'=>'<input title="{$MOD.LBL_TEST_BUTTON_TITLE}" accessKey="{$MOD.LBL_TEST_BUTTON_KEY}" class="button" onclick="this.form.return_module.value=\'Campaigns\'; this.form.return_action.value=\'TrackDetailView\';this.form.action.value=\'Schedule\';this.form.mode.value=\'test\'" type="{$ADD_BUTTON_STATE}" name="button" value="{$MOD.LBL_TEST_BUTTON_LABEL}">'),
array('customCode'=>'<input title="{$MOD.LBL_QUEUE_BUTTON_TITLE}" accessKey="{$MOD.LBL_QUEUE_BUTTON_KEY}" class="button" onclick="this.form.return_module.value=\'Campaigns\'; this.form.return_action.value=\'TrackDetailView\';this.form.action.value=\'Schedule\'" type="{$ADD_BUTTON_STATE}" name="button" value="{$MOD.LBL_QUEUE_BUTTON_LABEL}">'),
array('customCode'=>'<input title="{$APP.LBL_MAILMERGE}" accessKey="{$APP.LBL_MAILMERGE_KEY}" class="button" onclick="this.form.return_module.value=\'Campaigns\'; this.form.return_action.value=\'TrackDetailView\';this.form.action.value=\'MailMerge\'" type="submit" name="button" value="{$APP.LBL_MAILMERGE}">'),
array('customCode'=>'<input title="{$MOD.LBL_MARK_AS_SENT}" class="button" onclick="this.form.return_module.value=\'Campaigns\'; this.form.return_action.value=\'TrackDetailView\';this.form.action.value=\'DetailView\';this.form.mode.value=\'set_target\'" type="{$TARGET_BUTTON_STATE}" name="button" value="{$MOD.LBL_MARK_AS_SENT}"><input title="mode" class="button" id="mode" name="mode" type="hidden" value="">'),
array('customCode'=>'<script>{$MSG_SCRIPT}</script>'),
),
'links' => array('<input type="button" class="button" onclick="javascript:window.location=\'index.php?module=Campaigns&action=WizardHome&record={$fields.id.value}\';" value="{$MOD.LBL_TO_WIZARD_TITLE}" />',
'<input type="button" class="button" onclick="javascript:window.location=\'index.php?module=Campaigns&action=TrackDetailView&record={$fields.id.value}\';" value="{$MOD.LBL_TRACK_BUTTON_LABEL}" />',
'<input type="button" class="button" onclick="javascript:window.location=\'index.php?module=Campaigns&action=RoiDetailView&record={$fields.id.value}\';" value="{$MOD.LBL_TRACK_ROI_BUTTON_LABEL}" />',
),
),
'maxColumns' => '2',
'widths' => array(
array('label' => '10', 'field' => '30'),
array('label' => '10', 'field' => '30')
),
),
'panels' =>array (
'lbl_campaign_information'=> array(
array (
'name',
array (
'name' => 'status',
'label' => 'LBL_CAMPAIGN_STATUS',
),
),
array (
array (
'name' => 'start_date',
'label' => 'LBL_CAMPAIGN_START_DATE',
),
array (
'name' => 'end_date',
'label' => 'LBL_CAMPAIGN_END_DATE',
),
),
array (
'campaign_type',
array('name' => 'frequency',
'customCode' => '{if $fields.campaign_type.value == "NewsLetter"}<div style=\'none\' id=\'freq_field\'>{$fields.frequency.value}</div>{/if}&nbsp;',
'customLabel' => '{if $fields.campaign_type.value == "NewsLetter"}<div style=\'none\' id=\'freq_label\'>{$MOD.LBL_CAMPAIGN_FREQUENCY}</div>{/if}&nbsp;')
,
),
array (
array (
'name' => 'budget',
'label' => '{$MOD.LBL_CAMPAIGN_BUDGET} ({$CURRENCY})',
),
array (
'name' => 'actual_cost',
'label' => '{$MOD.LBL_CAMPAIGN_ACTUAL_COST} ({$CURRENCY})',
),
),
array (
array (
'name' => 'expected_revenue',
'label' => '{$MOD.LBL_CAMPAIGN_EXPECTED_REVENUE} ({$CURRENCY})',
),
array (
'name' => 'expected_cost',
'label' => '{$MOD.LBL_CAMPAIGN_EXPECTED_COST} ({$CURRENCY})',
),
),
array (
array (
'name' => 'impressions',
'label' => 'LBL_CAMPAIGN_IMPRESSIONS',
),
),
array (
array (
'name' => 'objective',
'label' => 'LBL_CAMPAIGN_OBJECTIVE',
),
),
array (
array (
'name' => 'content',
'label' => 'LBL_CAMPAIGN_CONTENT',
),
),
),
'LBL_PANEL_ASSIGNMENT' => array(
array (
array (
'name' => 'assigned_user_name',
'label' => 'LBL_ASSIGNED_TO',
),
array (
'name' => 'date_modified',
'label' => 'LBL_DATE_MODIFIED',
'customCode' => '{$fields.date_modified.value} {$APP.LBL_BY} {$fields.modified_by_name.value}',
),
),
array (
array (
'name' => 'date_entered',
'customCode' => '{$fields.date_entered.value} {$APP.LBL_BY} {$fields.created_by_name.value}',
),
),
),
)
);
?>

View File

@@ -0,0 +1,153 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$viewdefs['Campaigns']['EditView'] = array(
'templateMeta' => array('maxColumns' => '2',
'widths' => array(
array('label' => '10', 'field' => '30'),
array('label' => '10', 'field' => '30')
),
'javascript' => '<script type="text/javascript" src="' . getJSPath('include/javascript/popup_parent_helper.js') . '"></script>
<script type="text/javascript">
function type_change() {ldelim}
type = document.getElementsByName(\'campaign_type\');
if(type[0].value==\'NewsLetter\') {ldelim}
document.getElementById(\'freq_label\').style.display = \'\';
document.getElementById(\'freq_field\').style.display = \'\';
{rdelim} else {ldelim}
document.getElementById(\'freq_label\').style.display = \'none\';
document.getElementById(\'freq_field\').style.display = \'none\';
{rdelim}
{rdelim}
type_change();
function ConvertItems(id) {ldelim}
var items = new Array();
//get the items that are to be converted
expected_revenue = document.getElementById(\'expected_revenue\');
budget = document.getElementById(\'budget\');
actual_cost = document.getElementById(\'actual_cost\');
expected_cost = document.getElementById(\'expected_cost\');
//unformat the values of the items to be converted
expected_revenue.value = unformatNumber(expected_revenue.value, num_grp_sep, dec_sep);
expected_cost.value = unformatNumber(expected_cost.value, num_grp_sep, dec_sep);
budget.value = unformatNumber(budget.value, num_grp_sep, dec_sep);
actual_cost.value = unformatNumber(actual_cost.value, num_grp_sep, dec_sep);
//add the items to an array
items[items.length] = expected_revenue;
items[items.length] = budget;
items[items.length] = expected_cost;
items[items.length] = actual_cost;
//call function that will convert currency
ConvertRate(id, items);
//Add formatting back to items
expected_revenue.value = formatNumber(expected_revenue.value, num_grp_sep, dec_sep);
expected_cost.value = formatNumber(expected_cost.value, num_grp_sep, dec_sep);
budget.value = formatNumber(budget.value, num_grp_sep, dec_sep);
actual_cost.value = formatNumber(actual_cost.value, num_grp_sep, dec_sep);
{rdelim}
</script>',
),
'panels' =>array (
'lbl_campaign_information' =>
array (
array (
array('name'=>'name'),
array('name' => 'status'),
),
array (
array('name'=>'start_date', 'displayParams'=>array('required'=>false, 'showFormats'=>true)),
'',
),
array (
array('name'=>'end_date', 'displayParams'=>array('showFormats'=>true)),
),
array (
array('name'=>'campaign_type',
'displayParams'=>array('javascript'=>'onchange="type_change();"'),
),
array (
'name' => 'frequency',
'customCode' => '<div style=\'none\' id=\'freq_field\'>{html_options name="frequency" options=$fields.frequency.options selected=$fields.frequency.value}</div></TD>',
'customLabel' => '<div style=\'none\' id=\'freq_label\'>{$MOD.LBL_CAMPAIGN_FREQUENCY}</div>',
),
),
array (
'currency_id',
'impressions',
),
array (
'budget',
'actual_cost',
),
array (
'expected_revenue',
'expected_cost',
),
array (
array('name'=>'objective','displayParams'=>array('rows'=>8,'cols'=>80)),
),
array (
array('name'=>'content','displayParams'=>array('rows'=>8, 'cols'=>80)),
),
),
'LBL_PANEL_ASSIGNMENT' => array(
array (
array (
'name' => 'assigned_user_name',
'label' => 'LBL_ASSIGNED_TO',
),
),
),
)
);
?>

View File

@@ -0,0 +1,83 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
global $theme, $mod_strings;
$listViewDefs['Campaigns'] = array(
'NAME' => array(
'width' => '20',
'label' => 'LBL_LIST_CAMPAIGN_NAME',
'link' => true,
'default' => true),
'STATUS' => array(
'width' => '10',
'label' => 'LBL_LIST_STATUS',
'default' => true),
'CAMPAIGN_TYPE' => array(
'width' => '10',
'label' => 'LBL_LIST_TYPE',
'default' => true),
'END_DATE' => array(
'width' => '10',
'label' => 'LBL_LIST_END_DATE',
'default' => true),
'ASSIGNED_USER_NAME' => array(
'width' => '8',
'label' => 'LBL_LIST_ASSIGNED_USER',
'default' => true),
'TRACK_CAMPAIGN' => array(
'width' => '1',
'label' => '&nbsp;',
'link' => true,
'customCode' => ' <a title="{$TRACK_CAMPAIGN_TITLE}" href="index.php?action=TrackDetailView&module=Campaigns&record={$ID}"><img border="0" src="{$TRACK_CAMPAIGN_IMAGE}"></a> ',
'default' => true,
'studio' => false,
'nowrap' => true,
'sortable' => false),
'LAUNCH_WIZARD' => array(
'width' => '1',
'label' => '&nbsp;',
'link' => true,
'customCode' => ' <a title="{$LAUNCH_WIZARD_TITLE}" href="index.php?action=WizardHome&module=Campaigns&record={$ID}"><img border="0" src="{$LAUNCH_WIZARD_IMAGE}"></a> ',
'default' => true,
'studio' => false,
'nowrap' => true,
'sortable' => false),
);
?>

View File

@@ -0,0 +1,77 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$popupMeta = array(
'moduleMain' => 'Campaign',
'varName' => 'CAMPAIGN',
'orderBy' => 'name',
'whereClauses' =>
array('name' => 'campaigns.name'),
'searchInputs' =>
array('name'),
'listviewdefs' => array(
'NAME' => array(
'width' => '20',
'label' => 'LBL_LIST_CAMPAIGN_NAME',
'link' => true,
'default' => true),
'CAMPAIGN_TYPE' => array(
'width' => '10',
'label' => 'LBL_LIST_TYPE',
'default' => true),
'STATUS' => array(
'width' => '10',
'label' => 'LBL_LIST_STATUS',
'default' => true),
'START_DATE' => array(
'width' => '10',
'label' => 'LBL_LIST_START_DATE',
'default' => true),
'END_DATE' => array(
'width' => '10',
'label' => 'LBL_LIST_END_DATE',
'default' => true),
),
'searchdefs' => array(
'name',
'campaign_type',
'status',
'start_date',
'end_date'
)
);
?>

View File

@@ -0,0 +1,57 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$searchdefs['Campaigns'] = array(
'templateMeta' => array(
'maxColumns' => '3',
'widths' => array('label' => '10', 'field' => '30'),
),
'layout' => array(
'basic_search' => array(
'name',
array('name'=>'current_user_only', 'label'=>'LBL_CURRENT_USER_FILTER', 'type'=>'bool'),
),
'advanced_search' => array(
'name',
array('name'=>'start_date', 'type'=>'date', 'displayParams'=>array('showFormats'=>true)),
array('name'=>'end_date', 'type'=>'date', 'displayParams'=>array('showFormats'=>true)),
'status',
'campaign_type',
array('name' => 'assigned_user_id', 'label'=>'LBL_ASSIGNED_TO', 'type' => 'enum', 'function' => array('name' => 'get_user_array', 'params' => array(false))),
),
),
);
?>

View File

@@ -0,0 +1,65 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$GLOBALS['studioDefs']['Campaigns'] = array(
'LBL_DETAILVIEW'=>array(
'template'=>'xtpl',
'template_file'=>'modules/Campaigns/DetailView.html',
'php_file'=>'modules/Campaigns/DetailView.php',
'type'=>'DetailView',
),
'LBL_EDITVIEW'=>array(
'template'=>'xtpl',
'template_file'=>'modules/Campaigns/EditView.html',
'php_file'=>'modules/Campaigns/EditView.php',
'type'=>'EditView',
),
'LBL_LISTVIEW'=>array(
'template'=>'listview',
'meta_file'=>'modules/Campaigns/listviewdefs.php',
'type'=>'ListView',
),
'LBL_SEARCHFORM'=>array(
'template'=>'xtpl',
'template_file'=>'modules/Campaigns/SearchForm.html',
'php_file'=>'modules/Campaigns/ListView.php',
'type'=>'SearchForm',
),
);

View File

@@ -0,0 +1,204 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$layout_defs['Campaigns'] = array(
// list of what Subpanels to show in the DetailView
'subpanel_setup' => array(
'prospectlists' => array(
'order' => 10,
'sort_order' => 'asc',
'sort_by' => 'name',
'module' => 'ProspectLists',
'get_subpanel_data'=>'prospectlists',
'set_subpanel_data'=>'prospectlists',
'subpanel_name' => 'default',
'title_key' => 'LBL_PROSPECT_LIST_SUBPANEL_TITLE',
),
'tracked_urls' => array(
'order' => 15,
'sort_order' => 'asc',
'sort_by' => 'tracker_name',
'module' => 'CampaignTrackers',
'get_subpanel_data'=>'tracked_urls',
'subpanel_name' => 'default',
'title_key' => 'LBL_TRACKED_URLS_SUBPANEL_TITLE',
),
'emailmarketing' => array(
'order' => 20,
'sort_order' => 'desc',
'sort_by' => 'date_start',
'module' => 'EmailMarketing',
'get_subpanel_data'=>'emailmarketing',
'subpanel_name' => 'default',
'title_key' => 'LBL_EMAIL_MARKETING_SUBPANEL_TITLE',
),
//subpanels for the tracking view...
'track_queue' => array(
'order' => 100,
'module' => 'EmailMan',
'get_subpanel_data'=>'function:get_queue_items',
'function_parameters'=>array('EMAIL_MARKETING_ID_VALUE'=>'','distinct'=>'emailman.id', 'group_by'=>'emailman.related_id,emailman.marketing_id'),
'subpanel_name' => 'default',
'title_key' => 'LBL_MESSAGE_QUEUE_TITLE',
'sort_order' => 'desc',
),
'targeted' => array(
'order' => 110,
'module' => 'CampaignLog',
'get_subpanel_data'=>"function:track_log_entries",
'function_parameters'=>array(0=>'targeted','EMAIL_MARKETING_ID_VALUE'=>'',/*'distinct'=>'campaign_log.target_id','group_by'=>'campaign_log.target_id, campaign_log.marketing_id'*/),
'subpanel_name' => 'default',
'title_key' => 'LBL_LOG_ENTRIES_TARGETED_TITLE',
'sort_order' => 'desc',
'sort_by' => 'campaign_log.id'
),
'viewed' => array(
'order' => 120,
'module' => 'CampaignLog',
'get_subpanel_data'=>"function:track_log_entries",
'subpanel_name' => 'default',
'function_parameters'=>array(0=>'viewed','EMAIL_MARKETING_ID_VALUE'=>'',/*'group_by'=>'campaign_log.target_id','distinct'=>'campaign_log.target_id'*/),
'title_key' => 'LBL_LOG_ENTRIES_VIEWED_TITLE',
'sort_order' => 'desc',
'sort_by' => 'campaign_log.id'
),
'link' => array(
'order' => 130,
'module' => 'CampaignLog',
'get_subpanel_data'=>"function:track_log_entries",
'function_parameters'=>array(0=>'link','EMAIL_MARKETING_ID_VALUE'=>'',/*'group_by'=>'campaign_log.target_id','distinct'=>'campaign_log.target_id'*/),
'subpanel_name' => 'default',
'title_key' => 'LBL_LOG_ENTRIES_LINK_TITLE',
'sort_order' => 'desc',
'sort_by' => 'campaign_log.id'
),
'lead' => array(
'order' => 140,
'module' => 'CampaignLog',
'get_subpanel_data'=>"function:track_log_entries",
'function_parameters'=>array(0=>'lead','EMAIL_MARKETING_ID_VALUE'=>'',/*'group_by'=>'campaign_log.target_id','distinct'=>'campaign_log.target_id'*/),
'subpanel_name' => 'default',
'title_key' => 'LBL_LOG_ENTRIES_LEAD_TITLE',
'sort_order' => 'desc',
'sort_by' => 'campaign_log.id'
),
'contact' => array(
'order' => 150,
'module' => 'CampaignLog',
'get_subpanel_data'=>"function:track_log_entries",
'function_parameters'=>array(0=>'contact','EMAIL_MARKETING_ID_VALUE'=>'',/*'group_by'=>'campaign_log.target_id','distinct'=>'campaign_log.target_id'*/),
'subpanel_name' => 'default',
'title_key' => 'LBL_LOG_ENTRIES_CONTACT_TITLE',
'sort_order' => 'desc',
'sort_by' => 'campaign_log.id'
),
'invalid email' => array(
'order' => 160,
'module' => 'CampaignLog',
'get_subpanel_data'=>"function:track_log_entries",
'function_parameters'=>array(0=>'invalid email','EMAIL_MARKETING_ID_VALUE'=>'',/*'group_by'=>'campaign_log.target_id','distinct'=>'campaign_log.target_id'*/),
'subpanel_name' => 'default',
'title_key' => 'LBL_LOG_ENTRIES_INVALID_EMAIL_TITLE',
'sort_order' => 'desc',
'sort_by' => 'campaign_log.id'
),
'send error' => array(
'order' => 170,
'module' => 'CampaignLog',
'get_subpanel_data'=>"function:track_log_entries",
'function_parameters'=>array(0=>'send error','EMAIL_MARKETING_ID_VALUE'=>'',/*'group_by'=>'campaign_log.target_id','distinct'=>'campaign_log.target_id'*/),
'subpanel_name' => 'default',
'title_key' => 'LBL_LOG_ENTRIES_SEND_ERROR_TITLE',
'sort_order' => 'desc',
'sort_by' => 'campaign_log.id'
),
'removed' => array(
'order' => 180,
'module' => 'CampaignLog',
'get_subpanel_data'=>"function:track_log_entries",
'function_parameters'=>array(0=>'removed','EMAIL_MARKETING_ID_VALUE'=>'',/*'group_by'=>'campaign_log.target_id','distinct'=>'campaign_log.target_id'*/),
'subpanel_name' => 'default',
'title_key' => 'LBL_LOG_ENTRIES_REMOVED_TITLE',
'sort_order' => 'desc',
'sort_by' => 'campaign_log.id'
),
'blocked' => array(
'order' => 185,
'module' => 'CampaignLog',
'get_subpanel_data'=>"function:track_log_entries",
'function_parameters'=>array(0=>'blocked','EMAIL_MARKETING_ID_VALUE'=>'',/*'group_by'=>'campaign_log.target_id','distinct'=>'campaign_log.target_id'*/),
'subpanel_name' => 'default',
'title_key' => 'LBL_LOG_ENTRIES_BLOCKEDD_TITLE',
'sort_order' => 'desc',
'sort_by' => 'campaign_log.id'
),
'accounts' => array(
'order' => 190,
'sort_order' => 'desc',
'sort_by' => 'name',
'module' => 'Accounts',
'get_subpanel_data'=>'accounts',
'subpanel_name' => 'default',
'title_key' => 'LBL_CAMPAIGN_ACCOUNTS_SUBPANEL_TITLE',
'top_buttons' => array(),
),
'leads' => array(
'order' => 195,
'sort_order' => 'desc',
'sort_by' => 'name',
'module' => 'Leads',
'get_subpanel_data'=>'leads',
'subpanel_name' => 'default',
'title_key' => 'LBL_CAMPAIGN_LEAD_SUBPANEL_TITLE',
'top_buttons' => array(),
),
'opportunities' => array(
'order' => 200,
'sort_order' => 'desc',
'sort_by' => 'name',
'module' => 'Opportunities',
'get_subpanel_data'=>'opportunities',
'subpanel_name' => 'default',
'title_key' => 'LBL_OPPORTUNITY_SUBPANEL_TITLE',
'top_buttons' => array(),
),
),
);
?>

View File

@@ -0,0 +1,50 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$subpanel_layout = array(
'buttons' => array(
array('widget_class' => 'SubPanelTopCreateButton'),
array('widget_class' => 'SubPanelTopSelectButton'),
),
'where' => '',
'list_fields' => array(),
);
?>

View File

@@ -0,0 +1,74 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$subpanel_layout = array(
'top_buttons' => array(
array('widget_class' => 'SubPanelTopCreateButton'),
array('widget_class' => 'SubPanelTopSelectButton', 'popup_module' => 'Campaigns'),
),
'where' => '',
'list_fields' => array(
'name'=>array(
'name' => 'name',
'vname' => 'LBL_LIST_CAMPAIGN_NAME',
'widget_class' => 'SubPanelDetailViewLink',
'width' => '85%',
),
'status'=>array(
'name' => 'status',
'vname' => 'LBL_LIST_STATUS',
'width' => '15%',
),
'edit_button'=>array(
'vname' => 'LBL_EDIT_BUTTON',
'widget_class' => 'SubPanelEditButton',
'module' => 'Campaigns',
'width' => '5%',
),
'remove_button'=>array(
'vname' => 'LBL_REMOVE',
'widget_class' => 'SubPanelRemoveButton',
'module' => 'Campgains',
'width' => '5%',
),
),
);
?>

View File

@@ -0,0 +1,136 @@
{*
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
********************************************************************************/
*}
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<th colspan="4" align="left" ><h4>{$MOD.LBL_WIZ_NEWSLETTER_TITLE_STEP2}</h4></th>
</tr>
<tr><td class="datalabel" colspan="3">{$MOD.LBL_WIZARD_BUDGET_MESSAGE}<br></td><td>&nbsp;</td></tr>
<tr><td class="datalabel" colspan="4">&nbsp;</td></tr>
<tr>
<td scope="row"><span sugar='slot14'>{$MOD.LBL_CAMPAIGN_BUDGET}</span sugar='slot'></td>
<td ><span sugar='slot14b'><input type="text" size="10" tabindex="1" maxlength="15" id="budget" name="wiz_step2_budget" title="{$MOD.LBL_CAMPAIGN_BUDGET}" value="{$CAMP_BUDGET}"></span sugar='slot'></td>
<td scope="row"><span sugar='slot15'>{$MOD.LBL_CAMPAIGN_ACTUAL_COST}</span sugar='slot'></td>
<td ><span sugar='slot15b'><input type="text" size="10" tabindex='2' maxlength="15" id="actual_cost" name="wiz_step2_actual_cost" title="{$MOD.LBL_CAMPAIGN_ACTUAL_COST}" value="{$CAMP_ACTUAL_COST}"></span sugar='slot'></td>
</tr>
<tr>
<td scope="row"><span sugar='slot16'>{$MOD.LBL_CAMPAIGN_EXPECTED_REVENUE}</span sugar='slot'></td>
<td ><span sugar='slot16b'><input type="text" size="10" tabindex="1" maxlength="15" id="expected_revenue" name="wiz_step2_expected_revenue" title="{$MOD.LBL_CAMPAIGN_EXPECTED_REVENUE}" value="{$CAMP_EXPECTED_REVENUE}"></span sugar='slot'></td>
<td scope="row"><span sugar='slot17'>{$MOD.LBL_CAMPAIGN_EXPECTED_COST}</span sugar='slot'></td>
<td ><span sugar='slot17b'><input type="text" size="10" tabindex="2" maxlength="15" id="expected_cost" name="wiz_step2_expected_cost" title="{$MOD.LBL_CAMPAIGN_EXPECTED_COST}" value="{$CAMP_EXPECTED_COST}"></span sugar='slot'></td>
</tr>
<tr>
<td scope="row"><span sugar='slot18'>{$MOD.LBL_CURRENCY}</span sugar='slot'></td>
<td><span sugar='slot18b'><select tabindex='1' title='{$MOD.LBL_CURRENCY}' name='wiz_step2_currency_id' id='currency_id' onchange='ConvertItems(this.options[selectedIndex].value);'>{$CURRENCY}</select></span sugar='slot'></td>
<td scope="row"><span sugar='slot17'>{$MOD.LBL_CAMPAIGN_IMPRESSIONS}</span sugar='slot'></td>
<td ><span sugar='slot17b'><input type="text" size="10" tabindex="2" maxlength="15" id="impressions" name="wiz_step2_impressions" title="{$MOD.LBL_CAMPAIGN_IMPRESSIONS}" value="{$CAMP_IMPRESSIONS}"></span sugar='slot'></td></tr>
<tr>
<td scope="row"><span sugar='slot18'>&nbsp;</span sugar='slot'></td>
<td><span sugar='slot18b'>&nbsp;</td>
<td scope="row"><span sugar='slot19'>&nbsp;</span sugar='slot'></td>
<td><span sugar='slot19b'>&nbsp;</span sugar='slot'></td>
</tr>
<tr>
<td valign="top" scope="row"><span sugar='slot20'>{$MOD.LBL_CAMPAIGN_OBJECTIVE}</span sugar='slot'></td>
<td colspan="4"><span sugar='slot20b'><textarea id="objective" name="wiz_step2_objective" title='{$MOD.LBL_CAMPAIGN_OBJECTIVE}' tabindex='3' cols="110" rows="5">{$OBJECTIVE}</textarea></span sugar='slot'></td>
</tr>
<tr>
<td scope="row">&nbsp;</td>
<td>&nbsp;</td>
<td scope="row">&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
<p>
<script>
var num_grp_sep ='{$NUM_GRP_SEP}';
var dec_sep = '{$DEC_SEP}';
/*
* this is the custom validation script that will validate the fields on step2 of wizard
*/
{literal}
function validate_step2(){
//add fields to validation and call generic validation script
var requiredTxt = SUGAR.language.get('app_strings', 'ERR_MISSING_REQUIRED_FIELDS');
if(validate['wizform']!='undefined'){delete validate['wizform']};
addToValidate('wizform', 'budget', 'float', false, document.getElementById('budget').title);
addToValidate('wizform', 'actual_cost', 'float', false, document.getElementById('actual_cost').title);
addToValidate('wizform', 'expected_revenue', 'float', false, document.getElementById('expected_revenue').title);
addToValidate('wizform', 'expected_cost', 'float', false, document.getElementById('expected_cost').title);
addToValidate('wizform', 'impressions', 'float', false, document.getElementById('impressions').title);
var check_date = new Date();
oldStartsWith =84;
return check_form('wizform');
}
function ConvertItems(id) {
var items = new Array();
//get the items that are to be converted
expected_revenue = document.getElementById('expected_revenue');
budget = document.getElementById('budget');
actual_cost = document.getElementById('actual_cost');
expected_cost = document.getElementById('expected_cost');
//unformat the values of the items to be converted
expected_revenue.value = unformatNumber(expected_revenue.value, num_grp_sep, dec_sep);
expected_cost.value = unformatNumber(expected_cost.value, num_grp_sep, dec_sep);
budget.value = unformatNumber(budget.value, num_grp_sep, dec_sep);
actual_cost.value = unformatNumber(actual_cost.value, num_grp_sep, dec_sep);
//add the items to an array
items[items.length] = expected_revenue;
items[items.length] = budget;
items[items.length] = expected_cost;
items[items.length] = actual_cost;
//call function that will convert currency
ConvertRate(id, items);
//Add formatting back to items
expected_revenue.value = formatNumber(expected_revenue.value, num_grp_sep, dec_sep);
expected_cost.value = formatNumber(expected_cost.value, num_grp_sep, dec_sep);
budget.value = formatNumber(budget.value, num_grp_sep, dec_sep);
actual_cost.value = formatNumber(actual_cost.value, num_grp_sep, dec_sep);
}
{/literal}
</script>

View File

@@ -0,0 +1,155 @@
{*
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
********************************************************************************/
*}
<!-- Begin Campaign Diagnostic Link -->
{$CAMPAIGN_DIAGNOSTIC_LINK}
<!-- End Campaign Diagnostic Link -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3"><h3>{$MOD.LBL_WIZ_NEWSLETTER_TITLE_STEP1} </h3></div></td>
<td colspan="1">&nbsp;</td>
</tr>
<tr><td class="datalabel" colspan="3">{$MOD.LBL_WIZARD_HEADER_MESSAGE}<br></td><td>&nbsp;</td></tr>
<tr><td class="datalabel" colspan="4">&nbsp;</td></tr>
<tr>
<td width="17%" scope="row"><span sugar='slot1'>{$MOD.LBL_NAME} <span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span></span sugar='slot'></td>
<td width="33%" ><span sugar='slot1b'><input id='name' name='wiz_step1_name' title='{$MOD.LBL_NAME}' {$DISABLED} tabindex='1' size='50' maxlength='50' type="text" value="{$CAMP_NAME}" ></span sugar='slot'></td>
<td width="15%" scope="row"><span sugar='slot2'>{$APP.LBL_ASSIGNED_TO}</span sugar='slot'></td>
<td width="35%" ><span sugar='slot2b'><input class="sqsEnabled" tabindex="2" autocomplete="off" id="assigned_user_name" name="wiz_step1_assigned_user_name" title='{$APP.LBL_ASSIGNED_TO}' type="text" value="{$ASSIGNED_USER_NAME}"><input id='assigned_user_id' name='wiz_step1_assigned_user_id' type="hidden" value="{$ASSIGNED_USER_ID}" />
<input title="{$APP.LBL_SELECT_BUTTON_TITLE}" accessKey="{$APP.LBL_SELECT_BUTTON_KEY}" type="button" tabindex='2' class="button" value='{$APP.LBL_SELECT_BUTTON_LABEL}' name=btn1
onclick='open_popup("Users", 600, 400, "", true, false, {$encoded_users_popup_request_data});' /></span sugar='slot'>
</td>
</tr>
<tr>
<td width="15%" scope="row"><span sugar='slot3'>{$MOD.LBL_CAMPAIGN_STATUS} <span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span></span sugar='slot'></td>
<td width="35%" ><span sugar='slot3b'><select tabindex='1' id='status' name='wiz_step1_status' title='{$MOD.LBL_CAMPAIGN_STATUS}'>{$STATUS_OPTIONS}</select></span sugar='slot'></td>
</tr>
<tr>
<td scope="row"><span sugar='slot5'>{$MOD.LBL_CAMPAIGN_START_DATE} </span sugar='slot'></td>
<td ><span sugar='slot5b'><input id='start_date' name='wiz_step1_start_date' title='{$MOD.LBL_CAMPAIGN_START_DATE}' onblur="parseDate(this, '{$CALENDAR_DATEFORMAT}');" type="text" tabindex='1' size='11' maxlength='10' value="{$CAMP_START_DATE}"> <img src="{sugar_getimagepath file='jscalendar.gif'}" alt="{$APP.LBL_ENTER_DATE}" id="start_date_trigger" align="absmiddle"> <span class="dateFormat">{$USER_DATEFORMAT}</span></span sugar='slot'></td>
<td scope="row"><span sugar='slot6'>{$MOD.LBL_CAMPAIGN_TYPE} </td>
<td><span sugar='slot6b'><{$SHOULD_TYPE_BE_DISABLED} id='campaign_type' title='{$MOD.LBL_CAMPAIGN_TYPE}' name='wiz_step1_campaign_type' >{$CAMPAIGN_TYPE_OPTIONS}</select></span sugar='slot'></td>
</tr>
<tr>
<td scope="row"><span sugar='slot7'>{$MOD.LBL_CAMPAIGN_END_DATE} <span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span></span sugar='slot'></td>
<td ><span sugar='slot7b'><input id='end_date' name='wiz_step1_end_date' title='{$MOD.LBL_CAMPAIGN_END_DATE}' onblur="parseDate(this, '{$CALENDAR_DATEFORMAT}');" type="text" tabindex='1' size='11' maxlength='10' value="{$CAMP_END_DATE}"> <img src="{sugar_getimagepath file='jscalendar.gif'}" alt="{$APP.LBL_ENTER_DATE}" id="end_date_trigger" align="absmiddle"> <span class="dateFormat">{$USER_DATEFORMAT}</span></span sugar='slot'></td>
<td scope="row"><span sugar='slot8'>{$FREQUENCY_LABEL} </span sugar='slot'></td>
<td><span sugar='slot8b'><{$HIDE_FREQUENCY_IF_NEWSLETTER} tabindex='1' id='frequency' name='wiz_step1_frequency' title='{$MOD.LBL_CAMPAIGN_FREQUENCY}'>{$FREQ_OPTIONS}</select></span sugar='slot'></td>
</tr>
<tr>
<td width="15%" scope="row"><span sugar='slot9'>&nbsp;</span></span sugar='slot'></td>
<td width="35%" ><span sugar='slot9b'>&nbsp;</span sugar='slot'></td>
<td scope="row"><span sugar='slot10'>&nbsp;</span sugar='slot'></td>
<td><span sugar='slot10b'>&nbsp;</span sugar='slot'></td>
<tr>
</tr>
<td valign="top" scope="row"><span sugar='slot10'>{$MOD.LBL_CAMPAIGN_CONTENT}</span sugar='slot'></td>
<td colspan="3"><span sugar='slot10a'><textarea id='wiz_content' name='wiz_step1_content' title='{$MOD.LBL_CAMPAIGN_CONTENT}' tabindex='3' cols="110" rows="5">{$CONTENT}</textarea></span sugar='slot'></td>
</tr>
<tr>
<td scope="row">&nbsp;</td>
<td>&nbsp;</td>
<td scope="row">&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table><p>
{literal}
<script type="text/javascript">
Calendar.setup ({{/literal}
inputField : "start_date", ifFormat : "{$CALENDAR_DATEFORMAT}", showsTime : false, button : "start_date_trigger", singleClick : true, step : 1, weekNumbers:false
{literal}
});
Calendar.setup ({{/literal}
inputField : "end_date", ifFormat : "{$CALENDAR_DATEFORMAT}", showsTime : false, button : "end_date_trigger", singleClick : true, step : 2, weekNumbers:false
{literal}
});
/*
* this is the custom validation script that will validate the fields on step1 of wizard
*/
function validate_step1(){
//loop through and check for empty strings (' ')
requiredTxt = SUGAR.language.get('app_strings', 'ERR_MISSING_REQUIRED_FIELDS');
var stepname = 'wiz_step_1_';
var has_error = 0;
var fields = new Array();
fields[0] = 'name';
fields[1] = 'status';
fields[2] = 'end_date';
var field_value = '';
for (i=0; i < fields.length; i++){
if(document.getElementById(fields[i]) !=null){
field_value = trim(document.getElementById(fields[i]).value);
if(field_value.length<1){
//throw error if string is empty
add_error_style('wizform', fields[i], requiredTxt +' ' +document.getElementById(fields[i]).title );
has_error = 1;
}
}
}
if(has_error == 1){
//error has been thrown, return false
return false;
}
//add fields to validation and call generic validation script
if(validate['wizform']!='undefined'){delete validate['wizform']};
addToValidate('wizform', 'name', 'alphanumeric', true, document.getElementById('name').title);
addToValidate('wizform', 'status', 'alphanumeric', true, document.getElementById('status').title);
addToValidate('wizform', 'end_date', 'date', true, document.getElementById('end_date').title);
addToValidate('wizform', 'start_date', 'date', false, document.getElementById('start_date').title);
addToValidate('wizform', 'currency_id', 'alphanumeric', false, document.getElementById('currency_id').title);
return check_form('wizform');
}
</script>
{/literal}

View File

@@ -0,0 +1,182 @@
{*
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
********************************************************************************/
*}
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<th colspan="4" align="left" ><h4>{$MOD.LBL_WIZ_NEWSLETTER_TITLE_STEP4}</h4></th>
</tr>
<tr>
<td scope="row" colspan="4">{$MOD.LBL_WIZARD_SUBSCRIPTION_MESSAGE}<br></td>
</tr>
<tr>
<td scope="row" colspan="4">&nbsp;</td>
</tr>
<tr>
<td scope="row"><span sugar='slot26'><img border="0" src="{sugar_getimagepath file='helpInline.gif'}" onmouseover="return overlib('{$MOD.LBL_SUBSCRIPTION_TARGET_WIZARD_DESC}', FGCLASS, 'olFgClass', CGCLASS, 'olCgClass', BGCLASS, 'olBgClass', TEXTFONTCLASS, 'olFontClass', CAPTIONFONTCLASS, 'olCapFontClass', CLOSEFONTCLASS, 'olCloseFontClass' );" onmouseout="return nd();" >
{$MOD.LBL_SUBSCRIPTION_LIST_NAME}</span sugar='slot'>
</td>
<td><input type='radio' onclick="change_target_list(this,'subs');" name='wiz_subscriptions_def_type' id='wiz_subscriptions_def_type' title="{$MOD.LBL_DEFAULT_LOCATION}" value="1" >{$MOD.LBL_DEFAULT_LOCATION}<br>
<input type='radio' onclick="change_target_list(this,'subs');" name='wiz_subscriptions_def_type' id='wiz_subscriptions_def_type' title="{$MOD.LBL_CUSTOM_LOCATION}" value="2" checked >{$MOD.LBL_CUSTOM_LOCATION}
</td>
<td colspan='2'><span sugar='slot26b'>
<input class="sqsEnabled" autocomplete="off" id="subscription_name" name="wiz_step3_subscription_name" title='{$MOD.LBL_SUBSCRIPTION_LIST_NAME}' type="text" size='35' value="{$SUBSCRIPTION_NAME}">
<input id='prospect_list_type_default' name='prospect_list_type_default' type="hidden" value="default" />
<input id='wiz_step3_subscription_name_id' name='wiz_step3_subscription_list_id' title='Subscription List ID' type="hidden" value='{$SUBSCRIPTION_ID}'>
<input title="{$APP.LBL_SELECT_BUTTON_TITLE}" accessKey="{$APP.LBL_SELECT_BUTTON_KEY}" type="button" tabindex='1' class="button" value='{$APP.LBL_SELECT_BUTTON_LABEL}' name=btn1 id='wiz_step3_subscription_name_button'
onclick='open_popup("ProspectLists", 600, 400, "&list_type=default", true, false, {$encoded_subscription_popup_request_data}, "single", true);'>
</span sugar='slot'></td>
</tr>
<tr><td colspan='4'>&nbsp;</td></tr>
<tr>
<td scope="row"><span sugar='slot27'><img border="0" src="{sugar_getimagepath file='helpInline.gif'}" onmouseover="return overlib('{$MOD.LBL_UNSUBSCRIPTION_TARGET_WIZARD_DESC}', FGCLASS, 'olFgClass', CGCLASS, 'olCgClass', BGCLASS, 'olBgClass', TEXTFONTCLASS, 'olFontClass', CAPTIONFONTCLASS, 'olCapFontClass', CLOSEFONTCLASS, 'olCloseFontClass' );" onmouseout="return nd();" >
{$MOD.LBL_UNSUBSCRIPTION_LIST_NAME}</span sugar='slot'>
</td>
<td><input type='radio' onclick="change_target_list(this,'unsubs');" name='wiz_unsubscriptions_def_type' id='wiz_unsubscriptions_def_type' title="{$MOD.LBL_DEFAULT_LOCATION}" value="1">{$MOD.LBL_DEFAULT_LOCATION}<br>
<input type='radio' onclick="change_target_list(this,'unsubs');" name='wiz_unsubscriptions_def_type' id='wiz_unsubscriptions_def_type' title="{$MOD.LBL_CUSTOM_LOCATION}" value="2" checked>{$MOD.LBL_CUSTOM_LOCATION}
</td>
<td colspan='2'><span sugar='slot27b'>
<input class="sqsEnabled" autocomplete="off" id="unsubscription_name" name="wiz_step3_unsubscription_name" title='{$MOD.LBL_UNSUBSCRIPTION_LIST_NAME}' type="text" size='35' value="{$UNSUBSCRIPTION_NAME}" >
<input id='prospect_list_type_exempt' name='prospect_list_type_exempt' type="hidden" value="exempt" />
<input id='wiz_step3_unsubscription_name_id' name='wiz_step3_unsubscription_list_id' title='UnSubscription List ID' type="hidden" value='{$UNSUBSCRIPTION_ID}'>
<input title="{$APP.LBL_SELECT_BUTTON_TITLE}" accessKey="{$APP.LBL_SELECT_BUTTON_KEY}" type="button" tabindex='1' class="button" value='{$APP.LBL_SELECT_BUTTON_LABEL}' name=btn2 id='wiz_step3_unsubscription_name_button'
onclick='open_popup("ProspectLists", 600, 400, "&list_type=exempt", true, false, {$encoded_unsubscription_popup_request_data}, "single", true);'>
</span sugar='slot'></td>
</tr>
<tr><td colspan='4'>&nbsp;</td></tr>
<tr>
<td scope="row">
<span sugar='slot28'><img border="0" src="{sugar_getimagepath file='helpInline.gif'}" onmouseover="return overlib('{$MOD.LBL_TEST_TARGET_WIZARD_DESC}', FGCLASS, 'olFgClass', CGCLASS, 'olCgClass', BGCLASS, 'olBgClass', TEXTFONTCLASS, 'olFontClass', CAPTIONFONTCLASS, 'olCapFontClass', CLOSEFONTCLASS, 'olCloseFontClass' );" onmouseout="return nd();">
{$MOD.LBL_TEST_LIST_NAME}</span sugar='slot'>
</td>
<td><input type='radio' onclick="change_target_list(this,'test');" name='wiz_test_def_type' id='wiz_test_def_type' title="{$MOD.LBL_DEFAULT_LOCATION}" value="1" >{$MOD.LBL_DEFAULT_LOCATION}<br>
<input type='radio' onclick="change_target_list(this,'test');" name='wiz_test_def_type' id='wiz_test_def_type' title="{$MOD.LBL_CUSTOM_LOCATION}" value="2" checked >{$MOD.LBL_CUSTOM_LOCATION}
</td>
<td colspan='2'><span sugar='slot28b'>
<input class="sqsEnabled" autocomplete="off" id="test_name" name="wiz_step3_test_name" title='{$MOD.LBL_TEST_LIST_NAME}' type="text" size='35' value="{$TEST_NAME}">
<input id='prospect_list_type_test' name='prospect_list_type_test' type="hidden" value="test" />
<input id='wiz_step3_test_name_id' name='wiz_step3_test_list_id' title='Test List ID' type="hidden" value='{$TEST_ID}'>
<input title="{$APP.LBL_SELECT_BUTTON_TITLE}" accessKey="{$APP.LBL_SELECT_BUTTON_KEY}" type="button" tabindex='1' class="button" value='{$APP.LBL_SELECT_BUTTON_LABEL}' name=btn3 id='wiz_step3_test_name_button'
onclick='open_popup("ProspectLists", 600, 400, "&list_type=test", true, false, {$encoded_test_popup_request_data}, "single", true);'>
</span sugar='slot'></td>
</tr>
<tr>
<td scope="row">&nbsp;</td>
<td>&nbsp;</td>
<td scope="row">&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
<p>
{literal}
<script type="text/javascript" >
//this function will toggle the popup forms to be read only if "Default" is selected,
//and enable the pop up select if "Custom" is selected
function change_target_list(radiobutton,list) {
var def_value ='';
if(list == 'subs'){
list_name = 'wiz_step3_subscription_name';
{/literal}
def_id ='{$SUBSCRIPTION_ID}';
def_value ='{$SUBSCRIPTION_NAME}'
{literal}
}
if(list == 'unsubs'){
list_name = 'wiz_step3_unsubscription_name';
{/literal}
def_id ='{$UNSUBSCRIPTION_ID}';
def_value ='{$UNSUBSCRIPTION_NAME}'
{literal}
}
if(list == 'test'){
list_name = 'wiz_step3_test_name';
{/literal}
def_id ='{$TEST_ID}';
def_value ='{$TEST_NAME}'
{literal}
}
//default selected, set inputs to read only
if (radiobutton.value == '1') {
radiobutton.form[list_name].disabled=true;
radiobutton.form[list_name+"_button"].style.visibility='hidden';
radiobutton.form[list_name+"_id"].value=def_id;
//call function that populates the default value
change_target_list_names(list,def_value);
} else {
//custom selected, make inputs editable
radiobutton.form[list_name].disabled=false;
radiobutton.form[list_name+"_button"].style.visibility='visible';
radiobutton.form[list_name].value='';
radiobutton.form[list_name+"_id"].value='';
}
}
//this function will populate the "default" name on the target list. It will either do one,
//if specified, or all three widgets, if blank idis passed in
function change_target_list_names(list,def_value) {
//id was passed in, create the listname and inputname variables
if(list != ''){
switch (list){{/literal}
case 'subs':
listname = '{$MOD.LBL_SUBSCRIPTION_LIST}';
inputname = 'subscription_name';
break;
case 'unsubs':
listname = '{$MOD.LBL_UNSUBSCRIPTION_LIST}';
inputname = 'unsubscription_name';
break;
case 'test':
inputname = 'test_name';
listname = '{$MOD.LBL_TEST_LIST}';
break;
default:
inputname = '';
{literal}
}
}
//populate specified input with default value
if(def_value==''){
def_value = document.getElementById('name').value + ' ' + listname;}
document.getElementById(inputname).value = def_value;
}
</script>
{/literal}

View File

@@ -0,0 +1,307 @@
{*
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
********************************************************************************/
*}
<input type="hidden" id="existing_target_count" name="existing_target_count" value={$TARGET_COUNT}>
<input type="hidden" id="added_target_count" name="added_target_count" value=''>
<input type="hidden" id="wiz_list_of_existing_targets" name="wiz_list_of_existing_targets" value="">
<input type="hidden" id="wiz_list_of_targets" name="wiz_list_of_targets" value="">
<input type="hidden" id="wiz_remove_target_list" name="wiz_remove_target_list" value="">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<th colspan="5" align="left" ><h4>{$MOD.LBL_TARGET_LISTS}</h4></th>
</tr>
<tr>
<td scope="row" colspan="5">{$MOD.LBL_WIZARD_TARGET_MESSAGE1}<br></td>
</tr>
<tr><td colspan=5>&nbsp;</td></tr>
<tr>
<td scope="row" colspan="4">{$MOD.LBL_SELECT_TARGET}&nbsp;
<input id="popup_target_list_type" name="popup_target_list_type" type='hidden'>
<input id="popup_target_list_name" name="popup_target_list_name" type="hidden" value="">
<input id='popup_target_list_id' name='popup_target_list_id' title='List ID' type="hidden" value=''>
<input title="{$APP.LBL_SELECT_BUTTON_TITLE}" type="button" tabindex='1' class="button" value='{$APP.LBL_SELECT_BUTTON_LABEL}' name=btn3 id='target_list_button'
onclick='open_popup("ProspectLists", 600, 400, "", true, false, {$encoded_target_list_popup_request_data}, "single", true);'>
</span sugar='slot'>
</td>
<td scope="row">&nbsp;</td>
</tr>
<tr><td colspan=5>&nbsp;</td></tr>
<tr>
<td scope="row" colspan="5">{$MOD.LBL_WIZARD_TARGET_MESSAGE2}<br></td>
</tr>
<tr>
<td width='10%' scope="row">{$MOD.LBL_TARGET_NAME}</td>
<td width='20%' scope="row">
<input id="target_list_name" name="target_list_name" type='text' size='40'>
</td>
<td width='10%' scope="row">
<span sugar='slot28'>{$MOD.LBL_TARGET_TYPE}</span sugar='slot'>
</td>
<td width='20%' >
<span sugar='slot28b'>
<select id="target_list_type" name="target_list_type">{$TARGET_OPTIONS}</select>
<input id='target_list_id' name='target_list_id' title='List ID' type="hidden" value=''>
</span sugar='slot'>
</td>
<td width='30%'><input type='button' value ='{$MOD.LBL_CREATE_TARGET}' class= 'button' onclick="add_target('false');"></td>
</tr>
<tr><td colspan=5>&nbsp;</td></tr>
</table>
<table width = '100%' class='detail view'>
<tr><td>{$MOD.LBL_TRACKERS_ADDED}</td></tr>
<tr><td>
<table bprder=1 width='100%'><tr class='detail view'>
<td width='25%'><b>{$MOD.LBL_TARGET_NAME}</b></td>
<td width='25%'><b>{$MOD.LBL_TARGET_TYPE}</b></td><td>&nbsp;</td>
<td width='25%'><b>&nbsp;</b></td>
</tr>
</table>
<div id='added_targets'>
{$EXISTING_TARGETS}
</div>
</td></tr>
</table>
<p>
<script>
var image_path = '{$IMAGE_PATH}';
{literal}
//create variables that will be used to monitor the number of target url
var targets_added = 0;
//variable that will be passed back to server to specify list of targets
var wiz_list_of_targets_array = new Array();
//this function adds selected target to list
function add_target(from_popup){
//perform validation
if(validate_step4(from_popup)){
TRGTNAME = 'target_list_name';
TRGTID = 'target_list_id';
TRGTYPE = 'target_list_type';
if(from_popup == 'true'){
TRGTNAME = 'popup_target_list_name'
TRGTID = 'popup_target_list_id'
TRGTYPE = 'popup_target_list_type'
}
//increment target count value
targets_added++;
document.getElementById('added_target_count').value = targets_added ;
//get the appropriate values from target form
var trgt_name = document.getElementById(TRGTNAME);
var trgt_id = document.getElementById(TRGTID);
var trgt_type = document.getElementById(TRGTYPE);
// var selInd = trgt_type.selectedIndex;
// trgt_type_text_value = trgt_type.options[selInd].text
var trgt_type_text = trgt_type.value ;
{/literal}
//display the selected display text, not the value
{$PL_DOM_STMT}
{literal}
//construct html to display chosen tracker
var trgt_name_html = "<input id='target_name"+targets_added +"' type='hidden' size='20' maxlength='255' name='added_target_name"+targets_added+"' value='"+trgt_name.value+"' >"+trgt_name.value;
var trgt_id_html = "<input type='hidden' name='added_target_id"+trackers_added+"' id='added_target_id"+trackers_added+"' value='"+trgt_id.value+"' >";
var trgt_type_html = "<input name='added_target_type"+trackers_added+"' id='added_target_type"+trackers_added+"' type='hidden' value='"+trgt_type.value+"'/>"+trgt_type_text;
{/literal}
//display the html
var trgt_html = "<div id='trgt_added_"+targets_added+"'> <table width='100%' class='tabDetailViewDL2'><tr class='tabDetailViewDL2' ><td width='25%'>"+trgt_name_html+"</td><td width='25%'>"+trgt_type_html+"</td><td>"+trgt_id_html+"<a href='#' onclick=\"remove_target('trgt_added_"+targets_added+"','"+targets_added+"'); \" > <img src='{sugar_getimagepath file='delete_inline.gif'}' alt='rem' align='absmiddle' border='0' height='12' width='12'>{$MOD.LBL_REMOVE}</a></td></tr></table></div>";
document.getElementById('added_targets').innerHTML = document.getElementById('added_targets').innerHTML + trgt_html;
//add values to array in string, seperated by "@@" characters
wiz_list_of_targets_array[targets_added] = trgt_id.value+"@@"+trgt_name.value+"@@"+trgt_type.value;
//assign array to hidden input, which will be used by server to process array of targets
document.getElementById('wiz_list_of_targets').value = wiz_list_of_targets_array.toString();
//now lets clear the form to allow input of new target
trgt_name.value = '';
trgt_id.value = '';
trgt_type.value = 'default';
{literal}
if(targets_added ==1){
document.getElementById('no_targets').style.display='none';
}
}
}
//this function will remove the selected target from the ui, and from the target array
function remove_target(div,num){
//clear UI
var trgt_div = document.getElementById(div);
trgt_div.style.display = 'none';
parentNE=trgt_div.parentNode;
parentNE.removeChild(trgt_div);
//clear target array from this entry and assign to form input
wiz_list_of_targets_array[num] = '';
document.getElementById('wiz_list_of_targets').value = wiz_list_of_targets_array.toString();
}
//this function will remove the existing target from the ui, and add it's value to an array for removal upon save
function remove_existing_target(div,id){
//clear UI
var trgt_div = document.getElementById(div);
trgt_div.style.display = 'none';
parentNE=trgt_div.parentNode;
parentNE.removeChild(trgt_div);
//assign this id to form input for removal
document.getElementById('wiz_remove_target_list').value += ','+id;
}
/*
* this is the custom validation script that will validate the fields on step3 of wizard
* this is called directly from the add target button
*/
function validate_step4(from_popup){
if(from_popup=='true'){
return true;
}
requiredTxt = SUGAR.language.get('app_strings', 'ERR_MISSING_REQUIRED_FIELDS');
var stepname = 'wiz_step3_';
var has_error = 0;
var fields = new Array();
fields[0] = 'target_list_name';
fields[1] = 'target_list_type';
//loop through and check for empty strings (' ')
var field_value = '';
if( (trim(document.getElementById(fields[0]).value) !='') || (trim(document.getElementById(fields[1]).value) !='')){
for (i=0; i < fields.length; i++){
field_value = trim(document.getElementById(fields[i]).value);
if(field_value.length<1){
add_error_style('wizform', fields[i], requiredTxt +' ' +document.getElementById(fields[i]).title );
has_error = 1;
}
}
}else{
//no values have been entered, return false without error
return false;
}
//error has been thrown, return false
if(has_error == 1){
return false;
}
return true;
}
/**
*This function will iterate through list of targets and gather all the values. It will
*populate these values, seperated by delimiters into hidden inputs for processing
*/
function gathertargets(){
//start with the newly added targets, get count of total added
count = parseInt(targets_added);
final_list_of_targets_array = new Array();
//iterate through list of added targets
for(i=1;i<=count;i++){
//make sure all values exist
if( document.getElementById('target_name'+i) && document.getElementById('is_optout'+i) && document.getElementById('target_url'+i) ){
//make sure the check box value is int (0/1)
var opt_val = '0';
if(document.getElementById('is_optout'+i).checked){opt_val =1;}
//add values for this target entry into array of target entries
final_list_of_targets_array[i] = document.getElementById('target_name'+i).value+"@@"+opt_val+"@@"+document.getElementById('target_url'+i).value;
}
}
//assign array of target entries to hidden input, which will be used by server to process array of targets
document.getElementById('wiz_list_of_targets').value = final_list_of_targets_array.toString();
//Now lets process existing targets, get count of existing targets
count = parseInt(document.getElementById('existing_target_count').value);
final_list_of_existing_targets_array = new Array();
//iterate through list of existing targets
for(i=0;i<count;i++){
//make sure all values exist
if( document.getElementById('existing_target_name'+i) && document.getElementById('existing_is_optout'+i) && document.getElementById('existing_target_url'+i) ){
//make sure the check box value is int (0/1)
var opt_val = '0';
if(document.getElementById('existing_is_optout'+i).checked){opt_val =1;}
//add values for this target entry into array of target entries
final_list_of_existing_targets_array[i] = document.getElementById('existing_target_id'+i).value+"@@"+document.getElementById('existing_target_name'+i).value+"@@"+opt_val+"@@"+document.getElementById('existing_target_url'+i).value;
}
}
//assign array of target entries to hidden input, which will be used by server to process array of targets
document.getElementById('wiz_list_of_existing_targets').value = final_list_of_existing_targets_array.toString();
}
/*
*This function will populate values based on popup selection, and then call the
*function to add the entry to the list of targets
*/
function set_return_prospect_list(popup_reply_data)
{
var form_name = popup_reply_data.form_name;
var name_to_value_array = popup_reply_data.name_to_value_array;
for (var the_key in name_to_value_array)
{
if(the_key == 'toJSON')
{
/* just ignore */
}
else
{
window.document.forms[form_name].elements[the_key].value = name_to_value_array[the_key];
}
}
add_target('true');
}
</script>
{/literal}

View File

@@ -0,0 +1,256 @@
{*
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
********************************************************************************/
*}
<input type="hidden" id="existing_tracker_count" name="existing_tracker_count" value="{$TRACKER_COUNT}">
<input type="hidden" id="added_tracker_count" name="added_tracker_count" value=''>
<input type="hidden" id="wiz_list_of_existing_trackers" name="wiz_list_of_existing_trackers" value="">
<input type="hidden" id="wiz_list_of_trackers" name="wiz_list_of_trackers" value="">
<input type="hidden" id="wiz_remove_tracker_list" name="wiz_remove_tracker_list" value="">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<th colspan="4" align="left" ><h4>{$MOD.LBL_WIZ_NEWSLETTER_TITLE_STEP3}</h4></th>
</tr>
<tr><td class="datalabel" colspan="3">{$MOD.LBL_WIZARD_TRACKER_MESSAGE}<br></td><td>&nbsp;</td></tr>
<tr><td class="datalabel" colspan="4">&nbsp;</td></tr>
</table>
<div id='tracker_input_div'>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="15%" scope="row"><slot>{$MOD.LBL_EDIT_TRACKER_NAME}<span class="required">&nbsp;</span></slot></td>
<td width="25%" ><slot><input id="tracker_name" type="text" size="30" tabindex='1' name="tracker_name" title="{$MOD.LBL_EDIT_TRACKER_NAME}" value="{$TRACKER_NAME}"></slot></td>
<td width="25%" scope="row"><slot><input onclick="toggle_tracker_url(this);" name="is_optout" title="{$MOD.LBL_EDIT_OPT_OUT}" id="is_optout" tabindex='2' class="checkbox" type="checkbox" />&nbsp;{$MOD.LBL_EDIT_OPT_OUT_}</slot></td>
<td width="35%" ><slot>&nbsp;</slot></td>
</tr>
<tr>
<td scope="row"><slot>{$MOD.LBL_EDIT_TRACKER_URL}&nbsp;<span class="required"></span></slot></td>
<td colspan=3><slot><input type="text" size="80" maxlength='255' tabindex='3' {$TRACKER_URL_DISABLED} name="tracker_url" title="{$MOD.LBL_EDIT_TRACKER_URL}" id="tracker_url" value="http://"></slot> <input type='button' value ='{$MOD.LBL_ADD_TRACKER}' class= 'button' onclick='javascript:add_tracker();'></td>
</tr>
<tr><td colspan='4'>&nbsp;</td></tr>
</table>
</div>
<table width='100%' border="0" cellspacing="0" cellpadding="0">
<tr><td>{$MOD.LBL_TRACKERS_ADDED}</td></tr>
<tr><td class='list view'>
<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr >
<td width='15%' scope="col" nowrap>{$MOD.LBL_EDIT_OPT_OUT}</td>
<td width='40%' scope="col">{$MOD.LBL_EDIT_TRACKER_NAME}</td>
<td width='45%' scope="col" colspan="2">{$MOD.LBL_EDIT_TRACKER_URL}</td>
</tr>
</table>
<div id='added_trackers'>
{$EXISTING_TRACKERS}
</div>
</td></tr>
</table>
<p>
<script>
var image_path = '{$IMAGE_PATH}';
{literal}
//this function toggles the tracker values based on whether the opt out check box is selected
function toggle_tracker_url(isoptout) {
tracker_url = document.getElementById('tracker_url');
if (isoptout.checked) {
tracker_url.disabled=true;
tracker_url.value="index.php?entryPoint=removeme";
} else {
tracker_url.disabled=false;
}
}
//create variables that will be used to monitor the number of tracker url
var trackers_added = 0;
//variable that will be passed back to server to specify list of trackers
var list_of_trackers_array = new Array();
//this function adds selected tracker to list
function add_tracker(){
//perform validation
if(validate_step3()){
//increment tracker count value
trackers_added++;
document.getElementById('added_tracker_count').value = trackers_added ;
//get the appropriate values from tracker form
var trkr_name = document.getElementById('tracker_name');
var trkr_url = document.getElementById('tracker_url');
var trkr_opt = document.getElementById('is_optout');
var trkr_opt_checked = '';
if(trkr_opt.checked){trkr_opt_checked = 'checked'; }
{/literal}
//construct html to display chosen tracker
var trkr_name_html = "<input id='tracker_name"+trackers_added +"' type='text' size='20' maxlength='255' name='wiz_step3_tracker_name"+trackers_added+"' title='{$MOD.LBL_EDIT_TRACKER_NAME}"+trackers_added+"' value='"+trkr_name.value+"' >";
var trkr_url_html = "<input type='text' size='60' maxlength='255' name='wiz_step3_tracker_url"+trackers_added+"' title='{$MOD.LBL_EDIT_TRACKER_URL}"+trackers_added+"' id='tracker_url"+trackers_added+"' value='"+trkr_url.value+"' >";
var trkr_opt_html = "<input name='wiz_step3_is_optout"+trackers_added+"' title='{$MOD.LBL_EDIT_OPT_OUT}"+trackers_added+"' id='is_optout"+trackers_added+"' class='checkbox' type='checkbox' "+trkr_opt_checked+" />";
//display the html
var trkr_html = "<div id='trkr_added_"+trackers_added+"'> <table width='100%' border='0' cellspacing='0' cellpadding='0'><tr class='evenListRowS1'><td width='15%'>"+trkr_opt_html+"</td><td width='40%'>"+trkr_name_html+"</td><td width='40%'>"+trkr_url_html+"</td><td><a href='#' onclick=\"javascript:remove_tracker('trkr_added_"+trackers_added+"','"+trackers_added+"'); \" > <img src='{sugar_getimagepath file='delete_inline.gif'}' alt='rem' align='absmiddle' border='0' height='12' width='12'>{$MOD.LBL_REMOVE}</a></td></tr></table></div>";
document.getElementById('added_trackers').innerHTML = document.getElementById('added_trackers').innerHTML + trkr_html;
//add values to array in string, seperated by "@@" characters
list_of_trackers_array[trackers_added] = trkr_name.value+"@@"+trkr_opt.checked+"@@"+trkr_url.value;
//assign array to hidden input, which will be used by server to process array of trackers
document.getElementById('wiz_list_of_trackers').value = list_of_trackers_array.toString();
//now lets clear the form to allow input of new tracker
trkr_name.value = '';
trkr_url.disabled = false;
trkr_url.value = 'http://';
trkr_opt.checked = false;
{literal}
if(trackers_added ==1){
document.getElementById('no_trackers').style.display='none';
}
}
}
//this function will remove the selected tracker from the ui, and from the tracker array
function remove_tracker(div,num){
//clear UI
var trkr_div = document.getElementById(div);
trkr_div.style.display = 'none';
trkr_div.parentNode.removeChild(trkr_div);
//clear tracker array from this entry and assign to form input
list_of_trackers_array[num] = '';
document.getElementById('wiz_list_of_trackers').value = list_of_trackers_array.toString();
}
//this function will remove the existing tracker from the ui, and add it's value to an array for removal upon save
function remove_existing_tracker(div,id){
//clear UI
var trkr_div = document.getElementById(div);
trkr_div.style.display = 'none';
trkr_div.parentNode.removeChild(trkr_div);
//assign this id to form input for removal
document.getElementById('wiz_remove_tracker_list').value += ','+id;
}
/**
*This function will iterate through list of trackers and gather all the values. It will
*populate these values, seperated by delimiters into hidden inputs for processing
*/
function gatherTrackers(){
//start with the newly added trackers, get count of total added
count = parseInt(trackers_added);
final_list_of_trackers_array = new Array();
//iterate through list of added trackers
for(i=1;i<=count;i++){
//make sure all values exist
if( document.getElementById('tracker_name'+i) && document.getElementById('is_optout'+i) && document.getElementById('tracker_url'+i) ){
//make sure the check box value is int (0/1)
var opt_val = '0';
if(document.getElementById('is_optout'+i).checked){opt_val =1;}
//add values for this tracker entry into array of tracker entries
final_list_of_trackers_array[i] = document.getElementById('tracker_name'+i).value+"@@"+opt_val+"@@"+document.getElementById('tracker_url'+i).value;
}
}
//assign array of tracker entries to hidden input, which will be used by server to process array of trackers
document.getElementById('wiz_list_of_trackers').value = final_list_of_trackers_array.toString();
//Now lets process existing trackers, get count of existing trackers
count = parseInt(document.getElementById('existing_tracker_count').value);
final_list_of_existing_trackers_array = new Array();
//iterate through list of existing trackers
for(i=0;i<count;i++){
//make sure all values exist
if( document.getElementById('existing_tracker_name'+i) && document.getElementById('existing_is_optout'+i) && document.getElementById('existing_tracker_url'+i) ){
//make sure the check box value is int (0/1)
var opt_val = '0';
if(document.getElementById('existing_is_optout'+i).checked){opt_val =1;}
//add values for this tracker entry into array of tracker entries
final_list_of_existing_trackers_array[i] = document.getElementById('existing_tracker_id'+i).value+"@@"+document.getElementById('existing_tracker_name'+i).value+"@@"+opt_val+"@@"+document.getElementById('existing_tracker_url'+i).value;
}
}
//assign array of tracker entries to hidden input, which will be used by server to process array of trackers
document.getElementById('wiz_list_of_existing_trackers').value = final_list_of_existing_trackers_array.toString();
}
/*
* this is the custom validation script that will validate the fields on step3 of wizard
* this is called directly from the add tracker button
*/
function validate_step3(){
requiredTxt = SUGAR.language.get('app_strings', 'ERR_MISSING_REQUIRED_FIELDS');
var stepname = 'wiz_step3_';
var has_error = 0;
var fields = new Array();
fields[0] = 'tracker_name';
fields[1] = 'tracker_url';
//loop through and check for empty strings (' ')
var field_value = '';
if(
(trim(document.getElementById(fields[0]).value) !='')
|| ((trim(document.getElementById(fields[1]).value) !='')
&& (trim(document.getElementById(fields[1]).value) !='http://'))
){
for (i=0; i < fields.length; i++){
field_value = trim(document.getElementById(fields[i]).value);
if(field_value.length<1 || field_value == 'http://'){
add_error_style('wizform', fields[i], requiredTxt +' ' +document.getElementById(fields[i]).title );
has_error = 1;
}
}
}else{
//no values have been entered, return false without error
return false;
}
//error has been thrown, return false
if(has_error == 1){
return false;
}
//add fields to validation and call generic validation script
if(validate['wizform']!='undefined'){delete validate['wizform']};
addToValidate('wizform', 'tracker_name', 'alphanumeric', false, document.getElementById('tracker_name').title);
addToValidate('wizform', 'tracker_url', 'alphanumeric', false, document.getElementById('tracker_url').title);
return check_form('wizform');
}
</script>
{/literal}

View File

@@ -0,0 +1,110 @@
{*
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
********************************************************************************/
*}
<div id='wiz_stage'>
<form id="wizform" name="wizform" method="POST" action="index.php">
<input type="hidden" name="module" value="Campaigns">
<input type="hidden" id='action' name="action" value='WizardNewsletter'>
<input type="hidden" id="return_module" name="return_module" value="Campaigns">
<input type="hidden" id="return_action" name="return_action" value="WizardHome">
<table class='other view' cellspacing="1">
<tr>
<td rowspan='2' width="10%" scope="row" style="vertical-align: top;">
<p>
<div id='nav'>
<table border="0" cellspacing="0" cellpadding="0" width="100%" >
<tr><td scope='row' ><div id='nav_step1'>{$MOD.LBL_CHOOSE_CAMPAIGN_TYPE}</div></td></tr>
</table>
</div>
</p>
</td>
<td rowspan='2' width='100%' class='edit view'>
<div id="wiz_message"></div>
<div id=wizard>
<div id='step1' >
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><th colspan='2' align="left" ><h4>{$MOD.LBL_CHOOSE_CAMPAIGN_TYPE}</h4></th></tr>
<tr><td colspan='2' ><p>{$MOD.LBL_HOME_START_MESSAGE}</p></td></tr>
<tr><td width='2%'>&nbsp;</td>
<td >
<input type="radio" id="wizardtype" name="wizardtype" value='1'checked >{$MOD.LBL_NEWSLETTER}<br>
<input type="radio" id="wizardtype" name="wizardtype" value='2'>{$MOD.LBL_EMAIL}<br>
<input type="radio" id="wizardtype" name='wizardtype' value='3'>{$MOD.LBL_OTHER_TYPE_CAMPAIGN}<br>
</td></tr>
</table>
</div>
</p>
</td>
</tr>
</table>
<div id ='buttons' >
<table width="100%" border="0" cellspacing="0" cellpadding="0" >
<tr>
<td align="right" width='40%'>&nbsp;</td>
<td align="right" width='30%'>
<table><tr>
<td><div id="start_button_div"><input id="startbutton" type='submit' title="{$MOD.LBL_START}" class="button" name="{$MOD.LBL_START}" value="{$MOD.LBL_START}"></div></td>
</tr></table>
</td>
</tr>
</table>
</div>
</form>
<script>
document.getElementById('startbutton').focus=true;
</script>
</div>

View File

@@ -0,0 +1,108 @@
{*
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
********************************************************************************/
*}
{$ROLLOVERSTYLE}
<form id="wizform" name="wizform" method="POST" action="index.php">
<input type="hidden" name="module" value="Campaigns">
<input type="hidden" name="record" value="{$ID}">
<input type="hidden" id="action" name="action">
<input type="hidden" name="return_module" value="{$RETURN_MODULE}">
<input type="hidden" name="return_id" value="{$RETURN_ID}">
<input type="hidden" name="return_action" value="{$RETURN_ACTION}">
<input type='hidden' name='campaign_type' value="{$MOD.LBL_NEWSLETTER_FORENTRY}">
<input type="hidden" id="wiz_total_steps" name="totalsteps" value="{$TOTAL_STEPS}">
<input type="hidden" id="wiz_current_step" name="currentstep" value='1'>
<input type="hidden" id="direction" name="wiz_direction" value='exit'>
<p>
<div id ='buttons'>
<table width="100%" border="0" cellspacing="0" cellpadding="0" >
<tr>
<td align="left" width='30%'>
<table border="0" cellspacing="0" cellpadding="0" ><tr>
<td><div id="back_button_div"><input id="wiz_back_button" type='button' title="{$APP.LBL_BACK}" class="button" onclick="javascript:navigate('back');" name="back" value=" {$APP.LBL_BACK}"></div></td>
<td><div id="cancel_button_div"><input id="wiz_cancel_button" title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="this.form.action.value='WizardHome'; this.form.module.value='Campaigns'; this.form.record.value='{$RETURN_ID}';" type="submit" name="button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}"></div></td>
<td nowrap="nowrap">
<div id="save_button_div">
<input id="wiz_submit_button" class="button" onclick="this.form.action.value='WizardNewsletterSave';this.form.direction.value='continue';gatherTrackers();" accesKey="{$APP.LBL_SAVE_BUTTON_TITLE}" type="{$HIDE_CONTINUE}" name="button" value="{$MOD.LBL_SAVE_CONTINUE_BUTTON_LABEL}" ><input id="wiz_submit_finish_button" class="button" onclick="this.form.action.value='WizardNewsletterSave';this.form.direction.value='exit';gatherTrackers();" accesKey="{$APP.LBL_SAVE_BUTTON_TITLE}" type="submit" name="button" value="{$MOD.LBL_SAVE_EXIT_BUTTON_LABEL}" >
</div></td>
<td><div id="next_button_div"><input id="wiz_next_button" type='button' title="{$APP.LBL_NEXT_BUTTON_LABEL}" class="button" onclick="javascript:navigate('next');" name="button" value="{$APP.LBL_NEXT_BUTTON_LABEL}"></div></td>
</tr></table>
</td>
<td align="right" width='70%'><div id='wiz_location_message'></td>
</tr>
</table>
</div>
</p>
<table class='other view' cellspacing="1">
<tr>
<td scope='row' rowspan='2' width="10%" style="vertical-align: top;">
<div id='nav' >
{$NAV_ITEMS}
</div>
</td>
<td class='edit view' rowspan='2' width='100%'>
<div id="wiz_message"></div>
<div id=wizard>
{$STEPS}
</div>
</td>
</tr>
</table>
</form>
<script type="text/javascript" src="include/javascript/popup_parent_helper.js?s={$SUGAR_VERSION}&c={$JS_CUSTOM_VERSION}"></script>
<script type="text/javascript" language="javascript" src="modules/Campaigns/wizard.js"></script>
<script type='text/javascript' src='include/javascript/sugar_grp_overlib.js'></script>
<div id='overDiv' style='position:absolute; visibility:hidden; z-index:1000;'></div>
{$WIZ_JAVASCRIPT}
{$DIV_JAVASCRIPT}
{$JAVASCRIPT}
<script language="javascript">
{$HILITE_ALL}
</script>

982
modules/Campaigns/utils.php Executable file
View File

@@ -0,0 +1,982 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: Defines the English language pack for the base application.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
/*
*returns a list of objects a message can be scoped by, the list contacts the current campaign
*name and list of all prospects associated with this campaign..
*
*/
function get_message_scope_dom($campaign_id, $campaign_name,$db=null, $mod_strings=array()) {
//find prospect list attached to this campaign..
$query = "SELECT prospect_list_id, prospect_lists.name ";
$query .= "FROM prospect_list_campaigns ";
$query .= "INNER join prospect_lists on prospect_lists.id = prospect_list_campaigns.prospect_list_id ";
$query .= "WHERE prospect_lists.deleted = 0 ";
$query .= "AND prospect_list_campaigns.deleted=0 ";
$query .= "AND campaign_id='".$campaign_id."'";
$query.=" and prospect_lists.list_type not like 'exempt%'";
if (empty($db)) {
$db = DBManagerFactory::getInstance();
}
if (empty($mod_strings) or !isset($mod_strings['LBL_DEFAULT'])) {
global $current_language;
$mod_strings = return_module_language($current_language, 'Campaigns');
}
//add campaign to the result array.
//$return_array[$campaign_id]= $campaign_name . ' (' . $mod_strings['LBL_DEFAULT'] . ')';
$result=$db->query($query);
while(($row=$db->fetchByAssoc($result))!= null) {
$return_array[$row['prospect_list_id']]=$row['name'];
}
if (empty($return_array)) $return_array=array();
else return $return_array;
}
/**
* Return bounce handling mailboxes for campaign.
*
* @param unknown_type $emails
* @param unknown_type $get_box_name, Set it to false if want to get "From Name" other than the InboundEmail Name.
* @return $get_name=true, bounce handling mailboxes' name; $get_name=false, bounce handling mailboxes' from name.
*/
function get_campaign_mailboxes(&$emails, $get_name=true) {
if (!class_exists('InboundEmail')) {
require('modules/InboundEmail/InboundEmail.php');
}
$query = "select id,name,stored_options from inbound_email where mailbox_type='bounce' and status='Active' and deleted='0'";
$db = DBManagerFactory::getInstance();
$result=$db->query($query);
while(($row=$db->fetchByAssoc($result))!= null) {
if($get_name) {
$return_array[$row['id']] = $row['name'];
} else {
$return_array[$row['id']]= InboundEmail::get_stored_options('from_name',$row['name'],$row['stored_options']);
}
$emails[$row['id']]=InboundEmail::get_stored_options('from_addr','nobody@example.com',$row['stored_options']);
}
if (empty($return_array)) $return_array=array(''=>'');
return $return_array;
}
function get_campaign_mailboxes_with_stored_options() {
$ret = array();
if(!class_exists('InboundEmail')) {
require('modules/InboundEmail/InboundEmail.php');
}
$q = "SELECT id, name, stored_options FROM inbound_email WHERE mailbox_type='bounce' AND status='Active' AND deleted='0'";
$db = DBManagerFactory::getInstance();
$r = $db->query($q);
while($a = $db->fetchByAssoc($r)) {
$ret[$a['id']] = unserialize(base64_decode($a['stored_options']));
}
return $ret;
}
function log_campaign_activity($identifier, $activity, $update=true, $clicked_url_key=null) {
$return_array = array();
$db = DBManagerFactory::getInstance();
//check to see if the identifier has been replaced with Banner string
if($identifier == 'BANNER' && isset($clicked_url_key) && !empty($clicked_url_key))
{
// create md5 encrypted string using the client ip, this will be used for tracker id purposes
$enc_id = 'BNR'.md5($_SERVER['REMOTE_ADDR']);
//default the identifier to ip address
$identifier = $enc_id;
//if user has chosen to not use this mode of id generation, then replace identifier with plain guid.
//difference is that guid will generate a new campaign log for EACH CLICK!!
//encrypted generation will generate 1 campaign log and update the hit counter for each click
if(isset($sugar_config['campaign_banner_id_generation']) && $sugar_config['campaign_banner_id_generation'] != 'md5'){
$identifier = create_guid();
}
//retrieve campaign log.
$trkr_query = "select * from campaign_log where target_tracker_key='$identifier ' and related_id = '$clicked_url_key'";
$current_trkr=$db->query($trkr_query);
$row=$db->fetchByAssoc($current_trkr);
//if campaign log is not retrieved (this is a new ip address or we have chosen to create
//unique entries for each click
if($row==null || empty($row)){
//retrieve campaign id
$trkr_query = "select ct.campaign_id from campaign_trkrs ct, campaigns c where c.id = ct.campaign_id and ct.id = '$clicked_url_key'";
$current_trkr=$db->query($trkr_query);
$row=$db->fetchByAssoc($current_trkr);
//create new campaign log with minimal info. Note that we are creating new unique id
//as target id, since we do not link banner/web campaigns to any users
$data['target_id']="'" . create_guid() . "'";
$data['target_type']= "'Prospects'";
$data['id']="'" . create_guid() . "'";
$data['campaign_id']="'" . $row['campaign_id'] . "'";
$data['target_tracker_key']="'" . $identifier . "'";
$data['activity_type']="'" . $activity . "'";
$data['activity_date']="'" . gmdate($GLOBALS['timedate']->get_db_date_time_format()) . "'";
$data['hits']=1;
if (!empty($clicked_url_key)) {
$data['related_id']="'".$clicked_url_key."'";
$data['related_type']="'".'CampaignTrackers'."'";
}
//values for return array..
$return_array['target_id']=$data['target_id'];
$return_array['target_type']=$data['target_type'];
//create insert query for new campaign log
$insert_query="INSERT into campaign_log (" . implode(",",array_keys($data)) . ")";
$insert_query.=" VALUES (" . implode(",",array_values($data)) . ")";
$db->query($insert_query);
}else{
//campaign log already exists, so just set the return array and update hits column
$return_array['target_id']= $row['target_id'];
$return_array['target_type']= $row['target_type'];
$query1="update campaign_log set hits=hits+1 where id='{$row['id']}'";
$current=$db->query($query1);
}
//return array and exit
return $return_array;
}
$query1="select * from campaign_log where target_tracker_key='$identifier' and activity_type='$activity'";
if (!empty($clicked_url_key)) {
$query1.=" AND related_id='$clicked_url_key'";
}
$current=$db->query($query1);
$row=$db->fetchByAssoc($current);
if ($row==null) {
$query="select * from campaign_log where target_tracker_key='$identifier' and activity_type='targeted'";
$targeted=$db->query($query);
$row=$db->fetchByAssoc($targeted);
//if activity is removed and target type is users, then a user is trying to opt out
//of emails. This is not possible as Users Table does not have opt out column.
if ($row && (strtolower($row['target_type']) == 'users' && $activity == 'removed' )) {
$return_array['target_id']= $row['target_id'];
$return_array['target_type']= $row['target_type'];
return $return_array;
}
elseif ($row){
$data['id']="'" . create_guid() . "'";
$data['campaign_id']="'" . $row['campaign_id'] . "'";
$data['target_tracker_key']="'" . $identifier . "'";
$data['target_id']="'" . $row['target_id'] . "'";
$data['target_type']="'" . $row['target_type'] . "'";
$data['activity_type']="'" . $activity . "'";
$data['activity_date']="'" . gmdate($GLOBALS['timedate']->get_db_date_time_format()) . "'";
$data['list_id']="'" . $row['list_id'] . "'";
$data['marketing_id']="'" . $row['marketing_id'] . "'";
$data['hits']=1;
if (!empty($clicked_url_key)) {
$data['related_id']="'".$clicked_url_key."'";
$data['related_type']="'".'CampaignTrackers'."'";
}
//values for return array..
$return_array['target_id']=$row['target_id'];
$return_array['target_type']=$row['target_type'];
$insert_query="INSERT into campaign_log (" . implode(",",array_keys($data)) . ")";
$insert_query.=" VALUES (" . implode(",",array_values($data)) . ")";
$db->query($insert_query);
}
} else {
$return_array['target_id']= $row['target_id'];
$return_array['target_type']= $row['target_type'];
$query1="update campaign_log set hits=hits+1 where id='{$row['id']}'";
$current=$db->query($query1);
}
//check to see if this is a removal action
if ($row && $activity == 'removed' ) {
//retrieve campaign and check it's type, we are looking for newsletter Campaigns
$query = "SELECT campaigns.* FROM campaigns WHERE campaigns.id = '".$row['campaign_id']."' ";
$result = $db->query($query);
if(!empty($result))
{
$c_row = $db->fetchByAssoc($result);
//if type is newsletter, then add campaign id to return_array for further processing.
if(isset($c_row['campaign_type']) && $c_row['campaign_type'] == 'NewsLetter'){
$return_array['campaign_id']=$c_row['id'];
}
}
}
return $return_array;
}
function campaign_log_lead_entry($campaign_id, $parent_bean,$child_bean,$activity_type){
global $timedate;
//create campaign tracker id and retrieve related bio bean
$tracker_id = create_guid();
//create new campaign log record.
$campaign_log = new CampaignLog();
$campaign_log->campaign_id = $campaign_id;
$campaign_log->target_tracker_key = $tracker_id;
$campaign_log->related_id = $parent_bean->id;
$campaign_log->related_type = $parent_bean->module_dir;
$campaign_log->target_id = $child_bean->id;
$campaign_log->target_type = $child_bean->module_dir;
$campaign_log->activity_date = $timedate->to_display_date_time(gmdate($GLOBALS['timedate']->get_db_date_time_format()));;
$campaign_log->activity_type = $activity_type;
//save the campaign log entry
$campaign_log->save();
}
function get_campaign_urls($campaign_id) {
$return_array=array();
if (!empty($campaign_id)) {
$db = DBManagerFactory::getInstance();
$query1="select * from campaign_trkrs where campaign_id='$campaign_id' and deleted=0";
$current=$db->query($query1);
while (($row=$db->fetchByAssoc($current)) != null) {
$return_array['{'.$row['tracker_name'].'}']=$row['tracker_name'] . ' : ' . $row['tracker_url'];
}
}
return $return_array;
}
/**
* Queries for the list
*/
function get_subscription_lists_query($focus, $additional_fields = null) {
//get all prospect lists belonging to Campaigns of type newsletter
$all_news_type_pl_query = "select c.name, pl.list_type, plc.campaign_id, plc.prospect_list_id";
if(is_array($additional_fields) && !empty($additional_fields)) $all_news_type_pl_query .= ', ' . implode(', ', $additional_fields);
$all_news_type_pl_query .= " from prospect_list_campaigns plc , prospect_lists pl, campaigns c ";
$all_news_type_pl_query .= "where plc.campaign_id = c.id ";
$all_news_type_pl_query .= "and plc.prospect_list_id = pl.id ";
$all_news_type_pl_query .= "and c.campaign_type = 'NewsLetter' and pl.deleted = 0 and c.deleted=0 and plc.deleted=0 ";
$all_news_type_pl_query .= "and (pl.list_type like 'exempt%' or pl.list_type ='default') ";
$all_news_type_list =$focus->db->query($all_news_type_pl_query);
//build array of all newsletter campaigns
$news_type_list_arr = array();
while ($row = $focus->db->fetchByAssoc($all_news_type_list)){$news_type_list_arr[] = $row;}
//now get all the campaigns that the current user is assigned to
$all_plp_current = "select prospect_list_id from prospect_lists_prospects where related_id = '$focus->id' and deleted = 0 ";
//build array of prospect lists that this user belongs to
$current_plp =$focus->db->query($all_plp_current );
$current_plp_arr = array();
while ($row = $focus->db->fetchByAssoc($current_plp)){$current_plp_arr[] = $row;}
return array('current_plp_arr' => $current_plp_arr, 'news_type_list_arr' => $news_type_list_arr);
}
/*
* This function takes in a bean from a lead, propsect, or contact and returns an array containing
* all subscription lists that the bean is a part of, and all the subscriptions that the bean is not
* a part of. The array elements have the key names of "subscribed" and "unsusbscribed". These elements contain an array
* of the corresponding list. In other words, the "subscribed" element holds another array that holds the subscription information.
*
* The subscription information is a concatenated string that holds the prospect list id and the campaign id, seperated by at "@" character.
* To parse these information string into something more usable, use the "process subscriptions()" function
*
* */
function get_subscription_lists($focus, $descriptions = false) {
$subs_arr = array();
$unsubs_arr = array();
$results = get_subscription_lists_query($focus, $descriptions);
$news_type_list_arr = $results['news_type_list_arr'];
$current_plp_arr = $results['current_plp_arr'];
//For each prospect list of type 'NewsLetter', check to see if current user is already in list,
foreach($news_type_list_arr as $news_list){
$match = 'false';
//perform this check against each prospect list this user belongs to
foreach($current_plp_arr as $current_list_key => $current_list){//echo " new entry from current lists user is subscribed to-------------";
//compare current user list id against newsletter id
if ($news_list['prospect_list_id'] == $current_list['prospect_list_id']){
//if id's match, user is subscribed to this list, check to see if this is an exempt list,
if(strpos($news_list['list_type'], 'exempt')!== false){
//this is an exempt list, so process
if(array_key_exists($news_list['name'],$subs_arr)){
//first, add to unsubscribed array
$unsubs_arr[$news_list['name']] = $subs_arr[$news_list['name']];
//now remove from exempt subscription list
unset($subs_arr[$news_list['name']]);
}else{
//we know this is an exempt list the user belongs to, but the
//non exempt list has not been processed yet, so just add to exempt array
$unsubs_arr[$news_list['name']] = "prospect_list@".$news_list['prospect_list_id']."@campaign@".$news_list['campaign_id'];
}
$match = 'false';//although match is false, this is an exempt array, so
//it will not be added a second time down below
}else{
//this list is not exempt, and user is subscribed, so add to subscribed array, and unset from the unsubs_arr
//as long as this list is not in exempt array
$temp = "prospect_list@".$news_list['prospect_list_id']."@campaign@".$news_list['campaign_id'];
if(!array_search($temp,$unsubs_arr)){
$subs_arr[$news_list['name']] = "prospect_list@".$news_list['prospect_list_id']."@campaign@".$news_list['campaign_id'];
$match = 'true';
//unset($unsubs_arr[$news_list['name']]);
}
}
}else{
//do nothing, there is no match
}
}
//if this newsletter id never matched a user subscription..
//..then add to available(unsubscribed) NewsLetters if list is not of type exempt
if(($match == 'false') && (strpos($news_list['list_type'], 'exempt') === false)){
$unsubs_arr[$news_list['name']] = "prospect_list@".$news_list['prospect_list_id']."@campaign@".$news_list['campaign_id'];
}
}
$return_array['unsubscribed'] = $unsubs_arr;
$return_array['subscribed'] = $subs_arr;
return $return_array;
}
/**
* same function as get_subscription_lists, but with the data seperated in an associated array
*/
function get_subscription_lists_keyed($focus) {
$subs_arr = array();
$unsubs_arr = array();
$results = get_subscription_lists_query($focus, array('c.content', 'c.frequency'));
$news_type_list_arr = $results['news_type_list_arr'];
$current_plp_arr = $results['current_plp_arr'];
//For each prospect list of type 'NewsLetter', check to see if current user is already in list,
foreach($news_type_list_arr as $news_list){
$match = false;
$news_list_data = array('prospect_list_id' => $news_list['prospect_list_id'],
'campaign_id' => $news_list['campaign_id'],
'description' => $news_list['content'],
'frequency' => $news_list['frequency']);
//perform this check against each prospect list this user belongs to
foreach($current_plp_arr as $current_list_key => $current_list){//echo " new entry from current lists user is subscribed to-------------";
//compare current user list id against newsletter id
if ($news_list['prospect_list_id'] == $current_list['prospect_list_id']){
//if id's match, user is subscribed to this list, check to see if this is an exempt list,
if($news_list['list_type'] == 'exempt'){
//this is an exempt list, so process
if(array_key_exists($news_list['name'],$subs_arr)){
//first, add to unsubscribed array
$unsubs_arr[$news_list['name']] = $subs_arr[$news_list['name']];
//now remove from exempt subscription list
unset($subs_arr[$news_list['name']]);
}else{
//we know this is an exempt list the user belongs to, but the
//non exempt list has not been processed yet, so just add to exempt array
$unsubs_arr[$news_list['name']] = $news_list_data;
}
$match = false;//although match is false, this is an exempt array, so
//it will not be added a second time down below
}else{
//this list is not exempt, and user is subscribed, so add to subscribed array
//as long as this list is not in exempt array
if(!array_key_exists($news_list['name'],$unsubs_arr)){
$subs_arr[$news_list['name']] = $news_list_data;
$match = 'true';
}
}
}else{
//do nothing, there is no match
}
}
//if this newsletter id never matched a user subscription..
//..then add to available(unsubscribed) NewsLetters if list is not of type exempt
if(($match == false) && ($news_list['list_type'] != 'exempt')){
$unsubs_arr[$news_list['name']] = $news_list_data;
}
}
$return_array['unsubscribed'] = $unsubs_arr;
$return_array['subscribed'] = $subs_arr;
return $return_array;
}
/*
* This function will take an array of strings that have been created by the "get_subscription_lists()" method
* and parses it into an array. The returned array has it's key's labeled in a specific fashion.
*
* Each string produces a campaign and a prospect id. The keys are appended with a number specifying the order
* it was process in. So an input array containing 3 strings will have the following key values:
* "prospect_list0", "campaign0"
* "prospect_list1", "campaign1"
* "prospect_list2", "campaign2"
*
* */
function process_subscriptions($subscription_string_to_parse) {
$subs_change = array();
//parse through and build list of id's'. We are retrieving the campaign_id and
//the prospect_list id from the selected subscriptions
$i = 0;
foreach($subscription_string_to_parse as $subs_changes){
$subs_changes = trim($subs_changes);
if(!empty($subs_changes)){
$ids_arr = explode("@", $subs_changes);
$subs_change[$ids_arr[0].$i] = $ids_arr[1];
$subs_change[$ids_arr[2].$i] = $ids_arr[3];
$i = $i+1;
}
}
return $subs_change;
}
/*This function is used by the Manage Subscriptions page in order to add the user
* to the default prospect lists of the passed in campaign
* Takes in campaign and prospect list id's we are subscribing to.
* It also takes in a bean of the user (lead,target,prospect) we are subscribing
* */
function subscribe($campaign, $prospect_list, $focus, $default_list = false) {
$relationship = strtolower($focus->getObjectName()).'s';
//--grab all the lists for the passed in campaign id
$pl_qry ="select id, list_type from prospect_lists where id in (select prospect_list_id from prospect_list_campaigns ";
$pl_qry .= "where campaign_id = '$campaign') and deleted = 0 ";
$GLOBALS['log']->debug("In Campaigns Util: subscribe function, about to run query: ".$pl_qry );
$pl_qry_result = $focus->db->query($pl_qry);
//build the array of all prospect_lists
$pl_arr = array();
while ($row = $focus->db->fetchByAssoc($pl_qry_result)){$pl_arr[] = $row;}
//--grab all the prospect_lists this user belongs to
$curr_pl_qry ="select prospect_list_id, related_id from prospect_lists_prospects ";
$curr_pl_qry .="where related_id = '$focus->id' and deleted = 0 ";
$GLOBALS['log']->debug("In Campaigns Util: subscribe function, about to run query: ".$curr_pl_qry );
$curr_pl_qry_result = $focus->db->query($curr_pl_qry);
//build the array of all prospect lists that this current user belongs to
$curr_pl_arr = array();
while ($row = $focus->db->fetchByAssoc($curr_pl_qry_result)){$curr_pl_arr[] = $row;}
//search through prospect lists for this campaign and identifiy the "unsubscription list"
$exempt_id = '';
foreach($pl_arr as $subscription_list){
if(strpos($subscription_list['list_type'], 'exempt')!== false){
$exempt_id = $subscription_list['id'];
}
if($subscription_list['list_type'] == 'default' && $default_list) {
$prospect_list = $subscription_list['id'];
}
}
//now that we have exempt (unsubscription) list id, compare against user list id's
if(!empty($exempt_id)){
$exempt_array['exempt_id'] = $exempt_id;
foreach($curr_pl_arr as $curr_subscription_list){
if($curr_subscription_list['prospect_list_id'] == $exempt_id){
//--if we are in here then user is subscribing to a list in which they are exempt.
// we need to remove the user from this unsubscription list.
//Begin by retrieving unsubscription prospect list
$exempt_subscription_list = new ProspectList();
$exempt_result = $exempt_subscription_list->retrieve($exempt_id);
if($exempt_result == null)
{//error happened while retrieving this list
return;
}
//load realationships and delete user from unsubscription list
$exempt_subscription_list->load_relationship($relationship);
$exempt_subscription_list->$relationship->delete($exempt_id,$focus->id);
}
}
}
//Now we need to check if user is already in subscription list
$already_here = 'false';
//for each list user is subscribed to, compare id's with current list id'
foreach($curr_pl_arr as $user_list){
if(in_array($prospect_list, $user_list)){
//if user already exists, then set flag to true
$already_here = 'true';
}
}
if($already_here ==='true'){
//do nothing, user is already subscribed
}else{
//user is not subscribed already, so add to subscription list
$subscription_list = new ProspectList();
$subs_result = $subscription_list->retrieve($prospect_list);
if($subs_result == null)
{//error happened while retrieving this list, iterate and continue
return;
}
//load subscription list and add this user
$GLOBALS['log']->debug("In Campaigns Util, loading relationship: ".$relationship);
$subscription_list->load_relationship($relationship);
$subscription_list->$relationship->add($focus->id);
}
}
/*This function is used by the Manage Subscriptions page in order to add the user
* to the exempt prospect lists of the passed in campaign
* Takes in campaign and focus parameters.
* */
function unsubscribe($campaign, $focus) {
$relationship = strtolower($focus->getObjectName()).'s';
//--grab all the list for this campaign id
$pl_qry ="select id, list_type from prospect_lists where id in (select prospect_list_id from prospect_list_campaigns ";
$pl_qry .= "where campaign_id = '$campaign') and deleted = 0 ";
$pl_qry_result = $focus->db->query($pl_qry);
//build the array with list information
$pl_arr = array();
$GLOBALS['log']->debug("In Campaigns Util, about to run query: ".$pl_qry);
while ($row = $focus->db->fetchByAssoc($pl_qry_result)){$pl_arr[] = $row;}
//retrieve lists that this user belongs to
$curr_pl_qry ="select prospect_list_id, related_id from prospect_lists_prospects ";
$curr_pl_qry .="where related_id = '$focus->id' and deleted = 0 ";
$GLOBALS['log']->debug("In Campaigns Util, unsubscribe function about to run query: ".$curr_pl_qry );
$curr_pl_qry_result = $focus->db->query($curr_pl_qry);
//build the array with current user list information
$curr_pl_arr = array();
while ($row = $focus->db->fetchByAssoc($curr_pl_qry_result)){$curr_pl_arr[] = $row;}
//check to see if user is already there in prospect list
$already_here = 'false';
$exempt_id = '';
foreach($curr_pl_arr as $user_list){
foreach($pl_arr as $v){
//if list is exempt list
if($v['list_type'] == 'exempt'){
//save the exempt list id for later use
$exempt_id = $v['id'];
//check to see if user is already in this exempt list
if(in_array($v['id'], $user_list)){
$already_here = 'true';
}
break 2;
}
}
}
//unsubscribe subscripted newsletter
foreach($pl_arr as $subscription_list){
//create a new instance of the prospect list
$exempt_list = new ProspectList();
$exempt_list->retrieve($subscription_list['id']);
$exempt_list->load_relationship($relationship);
//if list type is default, then delete the relationship
//if list type is exempt, then add the relationship to unsubscription list
if($subscription_list['list_type'] == 'exempt') {
$exempt_list->$relationship->add($focus->id);
}elseif($subscription_list['list_type'] == 'default' || $subscription_list['list_type'] == 'test'){
//if list type is default or test, then delete the relationship
//$exempt_list->$relationship->delete($subscription_list['id'],$focus->id);
}
}
if($already_here =='true'){
//do nothing, user is already exempted
}else{
//user is not exempted yet , so add to unsubscription list
$exempt_result = $exempt_list->retrieve($exempt_id);
if($exempt_result == null)
{//error happened while retrieving this list
return;
}
$GLOBALS['log']->debug("In Campaigns Util, loading relationship: ".$relationship);
$exempt_list->load_relationship($relationship);
$exempt_list->$relationship->add($focus->id);
}
}
/*
*This function will return a string to the newsletter wizard if campaign check
*does not return 100% healthy.
*/
function diagnose()
{
global $mod_strings;
global $current_user;
$msg = " <table class='detail view small' width='100%'><tr><td> ".$mod_strings['LNK_CAMPAIGN_DIGNOSTIC_LINK']."</td></tr>";
//Start with email components
//monitored mailbox section
$focus = new Administration();
$focus->retrieveSettings(); //retrieve all admin settings.
//run query for mail boxes of type 'bounce'
$email_health = 0;
$email_components = 2;
$mbox_qry = "select * from inbound_email where deleted ='0' and mailbox_type = 'bounce'";
$mbox_res = $focus->db->query($mbox_qry);
$mbox = array();
while ($mbox_row = $focus->db->fetchByAssoc($mbox_res)){$mbox[] = $mbox_row;}
//if the array is not empty, then set "good" message
if(isset($mbox) && count($mbox)>0){
//everything is ok, do nothing
}else{
//if array is empty, then increment health counter
$email_health =$email_health +1;
$msg .= "<tr><td ><font color='red'><b>". $mod_strings['LBL_MAILBOX_CHECK1_BAD']."</b></font></td></tr>";
}
if (strstr($focus->settings['notify_fromaddress'], 'example.com')){
//if "from_address" is the default, then set "bad" message and increment health counter
$email_health =$email_health +1;
$msg .= "<tr><td ><font color='red'><b> ".$mod_strings['LBL_MAILBOX_CHECK2_BAD']." </b></font></td></tr>";
}else{
//do nothing, address has been changed
}
//if health counter is above 1, then show admin link
if($email_health>0){
if (is_admin($current_user)){
$msg.="<tr><td ><a href='index.php?module=Campaigns&action=WizardEmailSetup";
if(isset($_REQUEST['return_module'])){
$msg.="&return_module=".$_REQUEST['return_module'];
}
if(isset($_REQUEST['return_action'])){
$msg.="&return_action=".$_REQUEST['return_action'];
}
$msg.="'>".$mod_strings['LBL_EMAIL_SETUP_WIZ']."</a></td></tr>";
}else{
$msg.="<tr><td >".$mod_strings['LBL_NON_ADMIN_ERROR_MSG']."</td></tr>";
}
}
// proceed with scheduler components
//create and run the scheduler queries
$sched_qry = "select job, name, status from schedulers where deleted = 0 and status = 'Active'";
$sched_res = $focus->db->query($sched_qry);
$sched_health = 0;
$sched = array();
$check_sched1 = 'function::runMassEmailCampaign';
$check_sched2 = 'function::pollMonitoredInboxesForBouncedCampaignEmails';
$sched_mes = '';
$sched_mes_body = '';
$scheds = array();
while ($sched_row = $focus->db->fetchByAssoc($sched_res)){$scheds[] = $sched_row;}
//iterate through and see which jobs were found
foreach ($scheds as $funct){
if( ($funct['job']==$check_sched1) || ($funct['job']==$check_sched2)){
if($funct['job']==$check_sched1){
$check_sched1 ="found";
}else{
$check_sched2 ="found";
}
}
}
//determine if error messages need to be displayed for schedulers
if($check_sched2 != 'found'){
$sched_health =$sched_health +1;
$msg.= "<tr><td><font color='red'><b>".$mod_strings['LBL_SCHEDULER_CHECK1_BAD']."</b></font></td></tr>";
}
if($check_sched1 != 'found'){
$sched_health =$sched_health +1;
$msg.= "<tr><td><font color='red'><b>".$mod_strings['LBL_SCHEDULER_CHECK2_BAD']."</b></font></td></tr>";
}
//if health counter is above 1, then show admin link
if($sched_health>0){
global $current_user;
if (is_admin($current_user)){
$msg.="<tr><td ><a href='index.php?module=Schedulers&action=index'>".$mod_strings['LBL_SCHEDULER_LINK']."</a></td></tr>";
}else{
$msg.="<tr><td >".$mod_strings['LBL_NON_ADMIN_ERROR_MSG']."</td></tr>";
}
}
//determine whether message should be returned
if(($sched_health + $email_health)>0){
$msg .= "</table> ";
}else{
$msg = '';
}
return $msg;
}
/**
* Handle campaign log entry creation for mail-merge activity. The function will be called by the soap component.
*
* @param String campaign_id Primary key of the campaign
* @param array targets List of keys for entries from prospect_lists_prosects table
*/
function campaign_log_mail_merge($campaign_id, $targets) {
$campaign= new Campaign();
$campaign->retrieve($campaign_id);
if (empty($campaign->id)) {
$GLOBALS['log']->debug('set_campaign_merge: Invalid campaign id'. $campaign_id);
} else {
foreach ($targets as $target_list_id) {
$pl_query = "select * from prospect_lists_prospects where id='$target_list_id'";
$result=$GLOBALS['db']->query($pl_query);
$row=$GLOBALS['db']->fetchByAssoc($result);
if (!empty($row)) {
write_mail_merge_log_entry($campaign_id,$row);
}
}
}
}
/**
* Function creates a campaign_log entry for campaigns processesed using the mail-merge feature. If any entry
* exist the hit counter is updated. target_tracker_key is used to locate duplicate entries.
* @param string campaign_id Primary key of the campaign
* @param array $pl_row A row of data from prospect_lists_prospects table.
*/
function write_mail_merge_log_entry($campaign_id,$pl_row) {
//Update the log entry if it exists.
$update="update campaign_log set hits=hits+1 where campaign_id='$campaign_id' and target_tracker_key='" . $pl_row['id'] . "'";
$result=$GLOBALS['db']->query($update);
//get affected row count...
$count=$GLOBALS['db']->getAffectedRowCount();
if ($count==0) {
$data=array();
$data['id']="'" . create_guid() . "'";
$data['campaign_id']="'" . $campaign_id . "'";
$data['target_tracker_key']="'" . $pl_row['id'] . "'";
$data['target_id']="'" . $pl_row['related_id'] . "'";
$data['target_type']="'" . $pl_row['related_type'] . "'";
$data['activity_type']="'targeted'";
$data['activity_date']="'" . gmdate($GLOBALS['timedate']->get_db_date_time_format()) . "'";
$data['list_id']="'" . $pl_row['prospect_list_id'] . "'";
$data['hits']=1;
$insert_query="INSERT into campaign_log (" . implode(",",array_keys($data)) . ")";
$insert_query.=" VALUES (" . implode(",",array_values($data)) . ")";
$GLOBALS['db']->query($insert_query);
}
}
function track_campaign_prospects($focus){
$delete_query="delete from campaign_log where campaign_id='{$focus->id}' and activity_type='targeted'";
$focus->db->query($delete_query);
$query="SELECT prospect_lists.id prospect_list_id from prospect_lists ";
$query.=" INNER JOIN prospect_list_campaigns plc ON plc.prospect_list_id = prospect_lists.id";
$query.=" WHERE plc.campaign_id='{$focus->id}'";
$query.=" AND prospect_lists.deleted=0";
$query.=" AND plc.deleted=0";
$query.=" AND prospect_lists.list_type!='test' AND prospect_lists.list_type not like 'exempt%'";
$result=$focus->db->query($query);
while (($row=$focus->db->fetchByAssoc($result))!=null ) {
$prospect_list_id=$row['prospect_list_id'];
if ($focus->db->dbType=='oci8') {
}
else if ($focus->db->dbType=='mssql') {
$current_date= "'".gmdate($GLOBALS['timedate']->get_db_date_time_format())."'";
$guid = "NEWID()";
}
else {
$current_date= "'".gmdate($GLOBALS['timedate']->get_db_date_time_format())."'";
$guid = "UUID()";
}
$insert_query= "INSERT INTO campaign_log (id,activity_date, campaign_id, target_tracker_key,list_id, target_id, target_type, activity_type";
$insert_query.=')';
$insert_query.= " SELECT $guid,$current_date,plc.campaign_id,$guid,plp.prospect_list_id, plp.related_id, plp.related_type,'targeted' ";
$insert_query.= "FROM prospect_lists_prospects plp ";
$insert_query.= "INNER JOIN prospect_list_campaigns plc ON plc.prospect_list_id = plp.prospect_list_id ";
$insert_query.= "WHERE plp.prospect_list_id = '{$prospect_list_id}' ";
$insert_query.= "AND plp.deleted=0 ";
$insert_query.= "AND plc.deleted=0 ";
$insert_query.= "AND plc.campaign_id='{$focus->id}'";
/*
if ($focus->db->dbType=='oci8') {
}
*/
$focus->db->query($insert_query);
}
global $mod_strings;
//return success message
return $mod_strings['LBL_DEFAULT_LIST_ENTRIES_WERE_PROCESSED'];
}
function create_campaign_log_entry($campaign_id, $focus, $rel_name, $rel_bean, $target_id = ''){
global $timedate;
$target_ids = array();
//check if this is specified for one target/contact/prospect/lead (from contact/lead detail subpanel)
if(!empty($target_id)){
$target_ids[] = $target_id;
}else{
//this is specified for all, so load target/prospect relationships (mark as sent button)
$focus->load_relationship($rel_name);
$target_ids = $focus->$rel_name->get();
}
if(count($target_ids)>0){
//retrieve the target beans and create campaign log entry
foreach($target_ids as $id){
//perform duplicate check
$dup_query = "select id from campaign_log where campaign_id = '$campaign_id' and target_id = '$id'";
$dup_result = $focus->db->query($dup_query);
$row = $focus->db->fetchByAssoc($dup_result);
//process if this is not a duplicate campaign log entry
if(empty($row)){
//create campaign tracker id and retrieve related bio bean
$tracker_id = create_guid();
$rel_bean->retrieve($id);
//create new campaign log record.
$campaign_log = new CampaignLog();
$campaign_log->campaign_id = $campaign_id;
$campaign_log->target_tracker_key = $tracker_id;
$campaign_log->target_id = $rel_bean->id;
$campaign_log->target_type = $rel_bean->module_dir;
$campaign_log->activity_type = 'targeted';
$campaign_log->activity_date=$timedate->to_display_date_time(gmdate($GLOBALS['timedate']->get_db_date_time_format()));
//save the campaign log entry
$campaign_log->save();
}
}
}
}
/*
* This function will return an array that has been formatted to work as a Quick Search Object for prospect lists
*/
function getProspectListQSObjects($source = '', $return_field_name='name', $return_field_id='id' ) {
global $app_strings;
//if source has not been specified, then search across all prospect lists
if(empty($source)){
$qsProspectList = array('method' => 'query',
'modules'=> array('ProspectLists'),
'group' => 'and',
'field_list' => array('name', 'id'),
'populate_list' => array('prospect_list_name', 'prospect_list_id'),
'conditions' => array( array('name'=>'name','op'=>'like_custom','end'=>'%','value'=>'') ),
'order' => 'name',
'limit' => '30',
'no_match_text' => $app_strings['ERR_SQS_NO_MATCH']);
}else{
//source has been specified use it to tell quicksearch.js which html input to use to get filter value
$qsProspectList = array('method' => 'query',
'modules'=> array('ProspectLists'),
'group' => 'and',
'field_list' => array('name', 'id'),
'populate_list' => array($return_field_name, $return_field_id),
'conditions' => array(
array('name'=>'name','op'=>'like_custom','end'=>'%','value'=>''),
//this condition has the source parameter defined, meaning the query will take the value specified below
array('name'=>'list_type', 'op'=>'like_custom', 'end'=>'%','value'=>'', 'source' => $source)
),
'order' => 'name',
'limit' => '30',
'no_match_text' => $app_strings['ERR_SQS_NO_MATCH']);
}
return $qsProspectList;
}
?>

317
modules/Campaigns/vardefs.php Executable file
View File

@@ -0,0 +1,317 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$dictionary['Campaign'] = array ('audited'=>true,
'comment' => 'Campaigns are a series of operations undertaken to accomplish a purpose, usually acquiring leads',
'table' => 'campaigns',
'fields' => array (
'tracker_key' => array (
'name' => 'tracker_key',
'vname' => 'LBL_TRACKER_KEY',
'type' => 'int',
'required' => true,
'studio' => array('editview' => false),
'len' => '11',
'auto_increment' => true,
'comment' => 'The internal ID of the tracker used in a campaign; no longer used as of 4.2 (see campaign_trkrs)'
),
'tracker_count' => array (
'name' => 'tracker_count',
'vname' => 'LBL_TRACKER_COUNT',
'type' => 'int',
'len' => '11',
'default' => '0',
'comment' => 'The number of accesses made to the tracker URL; no longer used as of 4.2 (see campaign_trkrs)'
),
'name' => array (
'name' => 'name',
'vname' => 'LBL_CAMPAIGN_NAME',
'dbType' => 'varchar',
'type' => 'name',
'len' => '50',
'comment' => 'The name of the campaign',
'importable' => 'required',
'required' => true,
),
'refer_url' => array (
'name' => 'refer_url',
'vname' => 'LBL_REFER_URL',
'type' => 'varchar',
'len' => '255',
'default' => 'http://',
'comment' => 'The URL referenced in the tracker URL; no longer used as of 4.2 (see campaign_trkrs)'
),
'description'=>array('name'=>'description','type'=>'none', 'comment'=>'inhertied but not used', 'source'=>'non-db'),
'tracker_text' => array (
'name' => 'tracker_text',
'vname' => 'LBL_TRACKER_TEXT',
'type' => 'varchar',
'len' => '255',
'comment' => 'The text that appears in the tracker URL; no longer used as of 4.2 (see campaign_trkrs)'
),
'start_date' => array (
'name' => 'start_date',
'vname' => 'LBL_CAMPAIGN_START_DATE',
'type' => 'date',
'audited'=>true,
'comment' => 'Starting date of the campaign',
'validation' => array ('type' => 'isbefore', 'compareto' => 'end_date'),
),
'end_date' => array (
'name' => 'end_date',
'vname' => 'LBL_CAMPAIGN_END_DATE',
'type' => 'date',
'audited'=>true,
'comment' => 'Ending date of the campaign',
'importable' => 'required',
'required' => true,
),
'status' => array (
'name' => 'status',
'vname' => 'LBL_CAMPAIGN_STATUS',
'type' => 'enum',
'options' => 'campaign_status_dom',
'len' => '25',
'audited'=>true,
'comment' => 'Status of the campaign',
'importable' => 'required',
'required' => true,
),
'impressions' => array (
'name' => 'impressions',
'vname' => 'LBL_CAMPAIGN_IMPRESSIONS',
'type' => 'int',
'default'=>0,
'reportable'=>true,
'comment' => 'Expected Click throughs manually entered by Campaign Manager'
),
'currency_id' =>
array (
'name' => 'currency_id',
'vname' => 'LBL_CURRENCY',
'type' => 'id',
'group'=>'currency_id',
'function'=>array('name'=>'getCurrencyDropDown', 'returns'=>'html'),
'required'=>false,
'do_report'=>false,
'reportable'=>false,
'comment' => 'Currency in use for the campaign'
),
'budget' => array (
'name' => 'budget',
'vname' => 'LBL_CAMPAIGN_BUDGET',
'type' => 'currency',
'dbType' => 'double',
'comment' => 'Budgeted amount for the campaign'
),
'expected_cost' => array (
'name' => 'expected_cost',
'vname' => 'LBL_CAMPAIGN_EXPECTED_COST',
'type' => 'currency',
'dbType' => 'double',
'comment' => 'Expected cost of the campaign'
),
'actual_cost' => array (
'name' => 'actual_cost',
'vname' => 'LBL_CAMPAIGN_ACTUAL_COST',
'type' => 'currency',
'dbType' => 'double',
'comment' => 'Actual cost of the campaign'
),
'expected_revenue' => array (
'name' => 'expected_revenue',
'vname' => 'LBL_CAMPAIGN_EXPECTED_REVENUE',
'type' => 'currency',
'dbType' => 'double',
'comment' => 'Expected revenue stemming from the campaign'
),
'campaign_type' => array (
'name' => 'campaign_type',
'vname' => 'LBL_CAMPAIGN_TYPE',
'type' => 'enum',
'options' => 'campaign_type_dom',
'len' => '25',
'audited'=>true,
'comment' => 'The type of campaign',
'importable' => 'required',
'required' => true,
),
'objective' => array (
'name' => 'objective',
'vname' => 'LBL_CAMPAIGN_OBJECTIVE',
'type' => 'text',
'comment' => 'The objective of the campaign'
),
'content' => array (
'name' => 'content',
'vname' => 'LBL_CAMPAIGN_CONTENT',
'type' => 'text',
'comment' => 'The campaign description'
),
'prospectlists'=> array (
'name' => 'prospectlists',
'type' => 'link',
'relationship' => 'prospect_list_campaigns',
'source'=>'non-db',
),
'emailmarketing'=> array (
'name' => 'emailmarketing',
'type' => 'link',
'relationship' => 'campaign_email_marketing',
'source'=>'non-db',
),
'queueitems'=> array (
'name' => 'queueitems',
'type' => 'link',
'relationship' => 'campaign_emailman',
'source'=>'non-db',
),
'log_entries'=> array (
'name' => 'log_entries',
'type' => 'link',
'relationship' => 'campaign_campaignlog',
'source'=>'non-db',
'vname' => 'LBL_LOG_ENTRIES',
),
'tracked_urls' => array (
'name' => 'tracked_urls',
'type' => 'link',
'relationship' => 'campaign_campaigntrakers',
'source'=>'non-db',
'vname'=>'LBL_TRACKED_URLS',
),
'frequency' => array (
'name' => 'frequency',
'vname' => 'LBL_CAMPAIGN_FREQUENCY',
'type' => 'enum',
//'options' => 'campaign_status_dom',
'len' => '25',
'comment' => 'Frequency of the campaign',
'options' => 'newsletter_frequency_dom',
'len' => '25',
),
'leads'=> array (
'name' => 'leads',
'type' => 'link',
'relationship' => 'campaign_leads',
'source'=>'non-db',
'vname' => 'LBL_LEADS',
),
'opportunities'=> array (
'name' => 'opportunities',
'type' => 'link',
'relationship' => 'campaign_opportunities',
'source'=>'non-db',
'vname' => 'LBL_OPPORTUNITIES',
),
'contacts'=> array (
'name' => 'contacts',
'type' => 'link',
'relationship' => 'campaign_contacts',
'source'=>'non-db',
'vname' => 'LBL_CONTACTS',
),
'accounts'=> array (
'name' => 'accounts',
'type' => 'link',
'relationship' => 'campaign_accounts',
'source'=>'non-db',
'vname' => 'LBL_ACCOUNTS',
),
),
'indices' => array (
array (
'name' => 'camp_auto_tracker_key' ,
'type'=>'index' ,
'fields'=>array('tracker_key')
),
array (
'name' =>'idx_campaign_name',
'type' =>'index',
'fields'=>array('name')
),
),
'relationships' => array (
'campaign_accounts' => array('lhs_module'=> 'Campaigns', 'lhs_table'=> 'campaigns', 'lhs_key' => 'id',
'rhs_module'=> 'Accounts', 'rhs_table'=> 'accounts', 'rhs_key' => 'campaign_id',
'relationship_type'=>'one-to-many'),
'campaign_contacts' => array('lhs_module'=> 'Campaigns', 'lhs_table'=> 'campaigns', 'lhs_key' => 'id',
'rhs_module'=> 'Contacts', 'rhs_table'=> 'contacts', 'rhs_key' => 'campaign_id',
'relationship_type'=>'one-to-many'),
'campaign_leads' => array('lhs_module'=> 'Campaigns', 'lhs_table'=> 'campaigns', 'lhs_key' => 'id',
'rhs_module'=> 'Leads', 'rhs_table'=> 'leads', 'rhs_key' => 'campaign_id',
'relationship_type'=>'one-to-many'),
'campaign_prospects' => array('lhs_module'=> 'Campaigns', 'lhs_table'=> 'campaigns', 'lhs_key' => 'id',
'rhs_module'=> 'Prospects', 'rhs_table'=> 'prospects', 'rhs_key' => 'campaign_id',
'relationship_type'=>'one-to-many'),
'campaign_opportunities' => array('lhs_module'=> 'Campaigns', 'lhs_table'=> 'campaigns', 'lhs_key' => 'id',
'rhs_module'=> 'Opportunities', 'rhs_table'=> 'opportunities', 'rhs_key' => 'campaign_id',
'relationship_type'=>'one-to-many'),
'campaign_email_marketing' => array('lhs_module'=> 'Campaigns', 'lhs_table'=> 'campaigns', 'lhs_key' => 'id',
'rhs_module'=> 'EmailMarketing', 'rhs_table'=> 'email_marketing', 'rhs_key' => 'campaign_id',
'relationship_type'=>'one-to-many'),
'campaign_emailman' => array('lhs_module'=> 'Campaigns', 'lhs_table'=> 'campaigns', 'lhs_key' => 'id',
'rhs_module'=> 'EmailMan', 'rhs_table'=> 'emailman', 'rhs_key' => 'campaign_id',
'relationship_type'=>'one-to-many'),
'campaign_campaignlog' => array('lhs_module'=> 'Campaigns', 'lhs_table'=> 'campaigns', 'lhs_key' => 'id',
'rhs_module'=> 'CampaignLog', 'rhs_table'=> 'campaign_log', 'rhs_key' => 'campaign_id',
'relationship_type'=>'one-to-many'),
'campaign_assigned_user' => array('lhs_module'=> 'Users', 'lhs_table'=> 'users', 'lhs_key' => 'id',
'rhs_module'=> 'Campaigns', 'rhs_table'=> 'campaigns', 'rhs_key' => 'assigned_user_id',
'relationship_type'=>'one-to-many'),
'campaign_modified_user' => array('lhs_module'=> 'Users', 'lhs_table'=> 'users', 'lhs_key' => 'id',
'rhs_module'=> 'Campaigns', 'rhs_table'=> 'campaigns', 'rhs_key' => 'modified_user_id',
'relationship_type'=>'one-to-many'),
)
);
VardefManager::createVardef('Campaigns','Campaign', array('default', 'assignable',
));
?>

View File

@@ -0,0 +1,103 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('include/MVC/View/SugarView.php');
require_once('include/MVC/Controller/SugarController.php');
class CampaignsViewClassic extends SugarView
{
function CampaignsViewClassic()
{
parent::SugarView();
$this->type = $this->action;
}
/**
* @see SugarView::display()
*/
public function display()
{
// Call SugarController::getActionFilename to handle case sensitive file names
$file = SugarController::getActionFilename($this->action);
if(file_exists('custom/modules/' . $this->module . '/'. $file . '.php')){
$this->includeClassicFile('custom/modules/'. $this->module . '/'. $file . '.php');
return true;
}elseif(file_exists('modules/' . $this->module . '/'. $file . '.php')){
$this->includeClassicFile('modules/'. $this->module . '/'. $file . '.php');
return true;
}
return false;
}
/**
* @see SugarView::_getModuleTitleParams()
*/
protected function _getModuleTitleParams()
{
$params = array();
$params[] = $this->_getModuleTitleListParam();
if (isset($this->action)){
switch($_REQUEST['action']){
case 'WizardHome':
if(!empty($this->bean->id)){
$params[] = "<a href='index.php?module={$this->module}&action=DetailView&record={$this->bean->id}'>".$this->bean->name."</a>";
$params[] = $GLOBALS['mod_strings']['LBL_CAMPAIGN_WIZARD'];
}else{
$params[] = $GLOBALS['mod_strings']['LBL_CAMPAIGN_WIZARD'];
}
break;
case 'WebToLeadCreation':
$params[] = $GLOBALS['mod_strings']['LBL_LEAD_FORM_WIZARD'];
break;
case 'WizardNewsletter':
if(!empty($this->bean->id)){
$params[] = "<a href='index.php?module={$this->module}&action=DetailView&record={$this->bean->id}'>".$GLOBALS['mod_strings']['LBL_NEWSLETTER_TITLE']."</a>";
$params[] = $GLOBALS['mod_strings']['LBL_CREATE_NEWSLETTER'];
}else{
$params[] = $GLOBALS['mod_strings']['LBL_CREATE_NEWSLETTER'];
}
break;
case 'CampaignDiagnostic':
$params[] = $GLOBALS['mod_strings']['LBL_CAMPAIGN_DIAGNOSTICS'];
break;
case 'WizardEmailSetup':
$params[] = $GLOBALS['mod_strings']['LBL_EMAIL_SETUP_WIZARD_TITLE'];
break;
}//switch
}//fi
return $params;
}
}

View File

@@ -0,0 +1,137 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: This file is used to override the default Meta-data DetailView behavior
* to provide customization specific to the Campaigns module.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('include/json_config.php');
require_once('include/MVC/View/views/view.detail.php');
class CampaignsViewDetail extends ViewDetail {
function CampaignsViewDetail(){
parent::ViewDetail();
//turn off normal display of subpanels
$this->options['show_subpanels'] = false;
}
function preDisplay(){
global $mod_strings;
if (isset($this->bean->campaign_type) && strtolower($this->bean->campaign_type) == 'newsletter'){
$mod_strings['LBL_MODULE_NAME'] = $mod_strings['LBL_NEWSLETTERS'];
}
parent::preDisplay();
}
function display() {
if (isset($_REQUEST['mode']) && $_REQUEST['mode']=='set_target'){
require_once('modules/Campaigns/utils.php');
//call function to create campaign logs
$mess = track_campaign_prospects($this->bean);
$confirm_msg = "var ajax_C_LOG_Status = new SUGAR.ajaxStatusClass();
window.setTimeout(\"ajax_C_LOG_Status.showStatus('".$mess."')\",1000);
window.setTimeout('ajax_C_LOG_Status.hideStatus()', 1500);
window.setTimeout(\"ajax_C_LOG_Status.showStatus('".$mess."')\",2000);
window.setTimeout('ajax_C_LOG_Status.hideStatus()', 5000); ";
$this->ss->assign("MSG_SCRIPT",$confirm_msg);
}
if (($this->bean->campaign_type == 'Email') || ($this->bean->campaign_type == 'NewsLetter' )) {
$this->ss->assign("ADD_BUTTON_STATE", "submit");
$this->ss->assign("TARGET_BUTTON_STATE", "hidden");
} else {
$this->ss->assign("ADD_BUTTON_STATE", "hidden");
$this->ss->assign("DISABLE_LINK", "display:none");
$this->ss->assign("TARGET_BUTTON_STATE", "submit");
}
$currency = new Currency();
if(isset($this->bean->currency_id) && !empty($this->bean->currency_id))
{
$currency->retrieve($this->bean->currency_id);
if( $currency->deleted != 1){
$this->ss->assign('CURRENCY', $currency->iso4217 .' '.$currency->symbol);
}else {
$this->ss->assign('CURRENCY', $currency->getDefaultISO4217() .' '.$currency->getDefaultCurrencySymbol());
}
}else{
$this->ss->assign('CURRENCY', $currency->getDefaultISO4217() .' '.$currency->getDefaultCurrencySymbol());
}
parent::display();
//We want to display subset of available, panels, so we will call subpanel
//object directly instead of using sugarview.
$GLOBALS['focus'] = $this->bean;
require_once('include/SubPanel/SubPanelTiles.php');
$subpanel = new SubPanelTiles($this->bean, $this->module);
//get available list of subpanels
$alltabs=$subpanel->subpanel_definitions->get_available_tabs();
if (!empty($alltabs)) {
//iterate through list, and filter out all but 3 subpanels
foreach ($alltabs as $key=>$name) {
if ($name != 'prospectlists' && $name!='emailmarketing' && $name != 'tracked_urls') {
//exclude subpanels that are not prospectlists, emailmarketing, or tracked urls
$subpanel->subpanel_definitions->exclude_tab($name);
}
}
//only show email marketing subpanel for email/newsletter campaigns
if ($this->bean->campaign_type != 'Email' && $this->bean->campaign_type != 'NewsLetter' ) {
//exclude subpanels that are not prospectlists, emailmarketing, or tracked urls
$subpanel->subpanel_definitions->exclude_tab('emailmarketing');
}
}
//show filtered subpanel list
echo $subpanel->display();
}
}
?>

View File

@@ -0,0 +1,55 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('include/MVC/View/views/view.modulelistmenu.php');
class CampaignsViewModulelistmenu extends ViewModulelistmenu
{
public function display()
{
//last viewed
$tracker = new Tracker();
$history = $tracker->get_recently_viewed($GLOBALS['current_user']->id, array('Campaigns','ProspectLists','Prospects'));
foreach ( $history as $key => $row ) {
$history[$key]['item_summary_short'] = getTrackerSubstring($row['item_summary']);
$history[$key]['image'] = SugarThemeRegistry::current()
->getImage($row['module_name'],'border="0" align="absmiddle" alt="'.$row['item_summary'].'"');
}
$this->ss->assign('LAST_VIEWED',$history);
$this->ss->display('include/MVC/View/tpls/modulelistmenu.tpl');
}
}
?>

View File

@@ -0,0 +1,74 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
********************************************************************************/
require_once('include/MVC/View/views/view.list.php');
class ViewNewsLetterList extends ViewList
{
function processSearchForm()
{
// we have a query
if(!empty($_SERVER['HTTP_REFERER']) && preg_match('/action=EditView/', $_SERVER['HTTP_REFERER'])) { // from EditView cancel
$this->searchForm->populateFromArray($this->storeQuery->query);
}
else {
$this->searchForm->populateFromRequest();
}
$where_clauses = $this->searchForm->generateSearchWhere(true, $this->seed->module_dir);
$where_clauses[] = "campaigns.campaign_type in ('NewsLetter')";
if (count($where_clauses) > 0 )$this->where = '('. implode(' ) AND ( ', $where_clauses) . ')';
$GLOBALS['log']->info("List View Where Clause: $this->where");
echo $this->searchForm->display($this->headers);
}
/**
* @see SugarView::preDisplay()
*/
public function preDisplay()
{
global $mod_strings;
$mod_strings['LBL_MODULE_TITLE'] = $mod_strings['LBL_NEWSLETTER_TITLE'];
$mod_strings['LBL_LIST_FORM_TITLE'] = $mod_strings['LBL_NEWSLETTER_LIST_FORM_TITLE'];
parent::preDisplay();
}
}

View File

@@ -0,0 +1,56 @@
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
function hide(divname){var elem1=document.getElementById(divname);elem1.style.display='none';}
function show(div){var elem1=document.getElementById(div);elem1.style.display='';}
function showdiv(div){hideall();show(div);}
function hideall(){var last_val=document.getElementById('wiz_total_steps');var last=parseInt(last_val.value);for(i=1;i<=last;i++){hide('step'+i);}}
function showfirst(wiz_mode){showdiv('step1');var current_step=document.getElementById('wiz_current_step');current_step.value="1";var save_button=document.getElementById('wiz_submit_button');var next_button=document.getElementById('wiz_next_button');var save_button_div=document.getElementById('save_button_div');var next_button_div=document.getElementById('next_button_div');var back_button_div=document.getElementById('back_button_div');save_button.disabled=true;back_button_div.style.display='none';save_button_div.style.display='none';next_button.focus();if(wiz_mode=='marketing'){back_button_div.style.display='';}
hilite(current_step.value);}
function navigate(direction){var current_step=document.getElementById('wiz_current_step');var currentValue=parseInt(current_step.value);if(validate_wiz(current_step.value,direction)){if(direction=='back'){current_step.value=currentValue-1;}
if(direction=='next'){current_step.value=currentValue+1;}
if(direction=='direct'){}
showdiv("step"+current_step.value);hilite(current_step.value);var total=document.getElementById('wiz_total_steps').value;var save_button=document.getElementById('wiz_submit_button');var back_button_div=document.getElementById('back_button_div');var save_button_div=document.getElementById('save_button_div');var next_button_div=document.getElementById('next_button_div');if(current_step.value==total){save_button.disabled=false;back_button_div.style.display='';save_button_div.style.display='';next_button_div.style.display='none';}else{if(current_step.value<2){back_button_div.style.display='none';}else{back_button_div.style.display='';}
var next_button=document.getElementById('wiz_next_button');next_button_div.style.display='';save_button_div.style.display='none';next_button.focus();}}else{}}
var already_linked='';function hilite(hilite){var last=parseInt(document.getElementById('wiz_total_steps').value);for(i=1;i<=last;i++){var nav_step=document.getElementById('nav_step'+i);nav_step.className='';}
var nav_step=document.getElementById('nav_step'+hilite);nav_step.className='';if(already_linked.indexOf(hilite)<0){nav_step.innerHTML="<a href='#' onclick=\"javascript:direct('"+hilite+"');\">"+nav_step.innerHTML+"</a>";already_linked+=',hilite';}}
function link_navs(beg,end){if(beg==''){beg=1;}
if(end==''){var last=document.getElementById('wiz_total_steps').value;end=last;}
beg=parseInt(beg);end=parseInt(end);for(i=beg;i<=end;i++){var nav_step=document.getElementById('nav_step'+i);nav_step.innerHTML="<a href='#' onclick=\"javascript:direct('"+i+"');\">"+nav_step.innerHTML+"</a>";}}
function direct(stepnumber){var current_step=document.getElementById('wiz_current_step');var currentValue=parseInt(current_step.value);if(validate_wiz(current_step.value,'direct')){current_step.value=stepnumber;navigate('direct');}else{}}
function validate_wiz(step,direction){var total=document.getElementById('wiz_total_steps').value;var wiz_message=document.getElementById('wiz_message');if(direction=='back'){if(step=='1'){var msg=SUGAR.language.get('mod_strings','LBL_WIZARD_FIRST_STEP_MESSAGE');wiz_message.innerHTML="<font color=\'red\' size=\'2\'><b>"+msg+"</b></font>";return false;}else{wiz_message.innerHTML='';}}
if(direction=='next'){if(step==total){var msg=SUGAR.language.get('mod_strings','LBL_WIZARD_LAST_STEP_MESSAGE');wiz_message.innerHTML="<font color=\'red\' size=\'2\'><b>"+msg+"</b></font>";return false;}else{wiz_message.innerHTML='';}}
if(direction=='direct'){}
if((direction!='direct')&&(window.validate_wiz_form)&&(!validate_wiz_form('step'+step))){return false;}
return true;}